@tiny-codes/react-easy 1.0.12 → 1.1.0

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 (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -2
  3. package/es/components/FloatDrawer/index.d.ts +1 -1
  4. package/es/components/FloatDrawer/index.js.map +1 -1
  5. package/es/components/OverflowTags/index.d.ts +52 -0
  6. package/es/components/OverflowTags/index.js +91 -0
  7. package/es/components/OverflowTags/index.js.map +1 -0
  8. package/es/components/OverflowTags/style/index.d.ts +3 -0
  9. package/es/components/OverflowTags/style/index.js +18 -0
  10. package/es/components/OverflowTags/style/index.js.map +1 -0
  11. package/es/components/index.d.ts +2 -0
  12. package/es/components/index.js +1 -2
  13. package/es/components/index.js.map +1 -1
  14. package/es/utils/index.d.ts +1 -0
  15. package/es/utils/index.js +1 -0
  16. package/es/utils/index.js.map +1 -1
  17. package/es/utils/math.d.ts +11 -0
  18. package/es/utils/math.js +17 -0
  19. package/es/utils/math.js.map +1 -0
  20. package/lib/components/FloatDrawer/index.d.ts +1 -1
  21. package/lib/components/FloatDrawer/index.js.map +2 -2
  22. package/lib/components/OverflowTags/index.d.ts +52 -0
  23. package/lib/components/OverflowTags/index.js +107 -0
  24. package/lib/components/OverflowTags/index.js.map +7 -0
  25. package/lib/components/OverflowTags/style/index.d.ts +3 -0
  26. package/lib/components/OverflowTags/style/index.js +38 -0
  27. package/lib/components/OverflowTags/style/index.js.map +7 -0
  28. package/lib/components/index.d.ts +2 -0
  29. package/lib/components/index.js +3 -0
  30. package/lib/components/index.js.map +2 -2
  31. package/lib/utils/index.d.ts +1 -0
  32. package/lib/utils/index.js +3 -1
  33. package/lib/utils/index.js.map +2 -2
  34. package/lib/utils/math.d.ts +11 -0
  35. package/lib/utils/math.js +35 -0
  36. package/lib/utils/math.js.map +7 -0
  37. package/package.json +4 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## 1.1.0
6
+
7
+ 2025-7-1
8
+
9
+ ### Features
10
+
11
+ - 🔥 Add `OverflowTags` component
12
+
5
13
  ## 1.0.12
6
14
 
7
15
  2025-6-26
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @tiny-codes/react-easy
2
2
 
3
- [English](./README.md) | [中文](./README.zh-CN.md)
3
+ [English](./README.md) | [中文](./README.zh-CN.md) | [Changelog](./CHANGELOG.md)
4
4
 
5
- > Helps you use React and AntDesign more easily
5
+ > A toolkit that simplifies React and AntDesign development with powerful components and hooks
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@tiny-codes/react-easy.svg)](https://www.npmjs.com/package/@tiny-codes/react-easy)
8
8
  [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@tiny-codes/react-easy)](https://bundlephobia.com/result?p=@tiny-codes/react-easy)
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperties, FC, ReactNode } from 'react';
2
- import { type CardProps } from 'antd';
2
+ import type { CardProps } from 'antd';
3
3
  export interface FloatDrawerProps {
4
4
  /**
5
5
  * **EN:** Whether the drawer is open
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useEffect","useMemo","useRef","useState","Card","ConfigProvider","classNames","DownOutlined","LeftOutlined","RightOutlined","UpOutlined","useRefFunction","useStyle","jsx","_jsx","jsxs","_jsxs","FloatDrawer","props","open","_props$position","position","cardProps","children","className","classNamesInProps","style","styles","cacheKey","_props$defaultSize","defaultSize","_props$minSize","minSize","_props$maxSize","maxSize","Infinity","onOpenChange","onResize","_useContext","ConfigContext","getPrefixCls","prefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","_useState","_useState2","isOpen","setIsOpen","_useState3","localStorage","getItem","Number","_useState4","size","setSize","sizeMap","type","_defineProperty","_useState5","_useState6","isDragging","setIsDragging","dragStartPos","dragStartSize","classString","concat","closeIcon","openIcon","toggleDrawer","handleResizeStart","e","current","clientY","clientX","preventDefault","handleResize","newSize","setItem","String","handleResizeEnd","window","addEventListener","removeEventListener","drawer","_objectSpread","resizeHandle","onMouseDown","content","bordered","variant","card","expandHandle","onClick","handleIcon"],"sources":["../../../src/components/FloatDrawer/index.tsx"],"sourcesContent":["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { Card, type CardProps, ConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '@ant-design/icons';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport useStyle from './style';\n\nexport interface FloatDrawerProps {\n /**\n * **EN:** Whether the drawer is open\n *\n * **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * **EN:** Position of the drawer\n *\n * **CN:** 抽屉的位置\n *\n * @default 'right'\n */\n position?: 'left' | 'right' | 'top' | 'bottom';\n /**\n * **EN:** Default size of the drawer. If the drawer is placed on the left or right, this is the\n * width, otherwise it is the height.\n *\n * **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。\n *\n * @default 300\n */\n defaultSize?: number;\n /**\n * **EN:** Minimum size of the drawer\n *\n * **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * **EN:** Maximum size of the drawer\n *\n * **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n *\n * **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * **EN:** Custom class name for the root element\n *\n * **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * **EN:** Custom class names for specific elements\n *\n * **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * **EN:** Class name for the drawer element\n *\n * **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * **EN:** Class name for the expand handle\n *\n * **CN:** 展开手柄的类名\n */\n expandHandle?: string;\n /**\n * **EN:** Class name for the resize handle\n *\n * **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * **EN:** Class name for the handle icon\n *\n * **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * **EN:** Class name for the content area\n *\n * **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * **EN:** Class name for the card element\n *\n * **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * **EN:** Custom styles for the root element\n *\n * **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * **EN:** Custom styles for specific elements\n *\n * **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * **EN:** Styles for the drawer element\n *\n * **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * **EN:** Styles for the expand handle\n *\n * **CN:** 展开手柄的样式\n */\n expandHandle?: CSSProperties;\n /**\n * **EN:** Styles for the resize handle\n *\n * **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * **EN:** Styles for the handle icon\n *\n * **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * **EN:** Styles for the content area\n *\n * **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * **EN:** Styles for the card element\n *\n * **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * **EN:** Custom properties for the card element\n *\n * **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * **EN:** Content to be rendered inside the drawer\n *\n * **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * **EN:** Callback function when the open state changes\n *\n * **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * **EN:** Callback function when the drawer is resized\n *\n * **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n}\n\n/**\n * **EN:** FloatDrawer component for creating a draggable, resizable drawer\n *\n * **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize = 300,\n minSize = 0,\n maxSize = +Infinity,\n onOpenChange,\n onResize,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('re-float-drawer');\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [isOpen, setIsOpen] = useState<boolean>();\n const [size, setSize] = useState(\n cacheKey && localStorage.getItem(cacheKey) ? Number(localStorage.getItem(cacheKey)) || defaultSize : defaultSize\n );\n const sizeMap = useMemo(() => {\n const type = position === 'left' || position === 'right' ? 'width' : 'height';\n return {\n [type]: size,\n };\n }, [position, size]);\n const [isDragging, setIsDragging] = useState(false);\n const dragStartPos = useRef<number>(0);\n const dragStartSize = useRef<number>(size);\n const classString = classNames(\n prefixCls,\n className,\n {\n [`${prefixCls}-open`]: isOpen,\n [`${prefixCls}-closed`]: !isOpen,\n [`${prefixCls}-${position}`]: position,\n },\n hashId,\n cssVarCls\n );\n const closeIcon = useMemo(() => {\n return position === 'left' ? (\n <RightOutlined />\n ) : position === 'top' ? (\n <DownOutlined />\n ) : position === 'bottom' ? (\n <UpOutlined />\n ) : (\n <LeftOutlined />\n );\n }, [position]);\n const openIcon = useMemo(() => {\n return position === 'left' ? (\n <LeftOutlined />\n ) : position === 'top' ? (\n <UpOutlined />\n ) : position === 'bottom' ? (\n <DownOutlined />\n ) : (\n <RightOutlined />\n );\n }, [position]);\n\n // Handle drawer visibility\n const toggleDrawer = () => {\n setIsOpen(!isOpen);\n onOpenChange?.(!isOpen);\n };\n\n // Handle resize events\n const handleResizeStart = useRefFunction((e: React.MouseEvent) => {\n setIsDragging(true);\n if (position === 'top' || position === 'bottom') {\n dragStartPos.current = e.clientY;\n } else {\n dragStartPos.current = e.clientX;\n }\n dragStartSize.current = size;\n e.preventDefault();\n });\n const handleResize = useRefFunction((e: MouseEvent) => {\n if (isDragging) {\n let newSize: number;\n if (position === 'left') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientX);\n } else if (position === 'top') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientY);\n } else if (position === 'bottom') {\n newSize = dragStartSize.current - (e.clientY - dragStartPos.current);\n } else {\n newSize = dragStartSize.current - (e.clientX - dragStartPos.current);\n }\n if (newSize >= minSize && newSize <= maxSize) {\n setSize(newSize);\n if (cacheKey) {\n localStorage.setItem(cacheKey, String(newSize));\n }\n onResize?.(newSize);\n }\n }\n });\n const handleResizeEnd = useRefFunction(() => {\n setIsDragging(false);\n });\n\n // Controlled open state\n useEffect(() => {\n setIsOpen(open);\n }, [open]);\n\n // Handle global events\n useEffect(() => {\n if (isDragging) {\n window.addEventListener('mousemove', handleResize);\n window.addEventListener('mouseup', handleResizeEnd);\n } else {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n }\n return () => {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n };\n }, [isDragging]);\n\n return wrapCSSVar(\n <div className={classString} style={style}>\n <div\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n <div\n className={classNames(\n `${prefixCls}-resize-handle`,\n isDragging && `${prefixCls}-resize-handle-dragging`,\n classNamesInProps?.resizeHandle\n )}\n style={styles?.resizeHandle}\n onMouseDown={handleResizeStart}\n />\n <div className={classNames(`${prefixCls}-content`, classNamesInProps?.content)} style={styles?.content}>\n <Card\n bordered={false}\n variant=\"borderless\"\n className={classNames(`${prefixCls}-card`, classNamesInProps?.card)}\n style={styles?.card}\n {...cardProps}\n >\n {children}\n </Card>\n </div>\n <div\n className={classNames(`${prefixCls}-expand-handle`, classNamesInProps?.expandHandle)}\n style={styles?.expandHandle}\n onClick={toggleDrawer}\n >\n <div\n className={classNames(`${prefixCls}-handle-icon`, classNamesInProps?.handleIcon)}\n style={styles?.handleIcon}\n >\n {isOpen ? openIcon : closeIcon}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default FloatDrawer;\n"],"mappings":";;;;;;;;;;;;AACA,SAASA,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SAASC,IAAI,EAAkBC,cAAc,QAAQ,MAAM;AAC3D,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,YAAY,EAAEC,YAAY,EAAEC,aAAa,EAAEC,UAAU,QAAQ,mBAAmB;AACzF,OAAOC,cAAc;AACrB,OAAOC,QAAQ;AAAgB,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AA6K/B;AACA;AACA;AACA;AACA;AACA,IAAMC,WAAiC,GAAG,SAApCA,WAAiCA,CAAIC,KAAK,EAAK;EACnD,IACEC,IAAI,GAcFD,KAAK,CAdPC,IAAI;IAAAC,eAAA,GAcFF,KAAK,CAbPG,QAAQ;IAARA,QAAQ,GAAAD,eAAA,cAAG,OAAO,GAAAA,eAAA;IAClBE,SAAS,GAYPJ,KAAK,CAZPI,SAAS;IACTC,QAAQ,GAWNL,KAAK,CAXPK,QAAQ;IACRC,SAAS,GAUPN,KAAK,CAVPM,SAAS;IACGC,iBAAiB,GAS3BP,KAAK,CATPZ,UAAU;IACVoB,KAAK,GAQHR,KAAK,CARPQ,KAAK;IACLC,MAAM,GAOJT,KAAK,CAPPS,MAAM;IACNC,QAAQ,GAMNV,KAAK,CANPU,QAAQ;IAAAC,kBAAA,GAMNX,KAAK,CALPY,WAAW;IAAXA,WAAW,GAAAD,kBAAA,cAAG,GAAG,GAAAA,kBAAA;IAAAE,cAAA,GAKfb,KAAK,CAJPc,OAAO;IAAPA,OAAO,GAAAD,cAAA,cAAG,CAAC,GAAAA,cAAA;IAAAE,cAAA,GAITf,KAAK,CAHPgB,O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U,SAAS,EAAElB,UAAU,IAAA+D,MAAA,CAAI5B,SAAS,mBAAgBhB,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAEwE,UAAU,CAAE;UACjFvE,KAAK,EAAEC,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEsE,UAAW;UAAA1E,QAAA,EAEzB2B,MAAM,GAAGqB,QAAQ,GAAGD;QAAS,CAC3B;MAAC,CACH,CAAC;IAAA,CACH;EAAC,CACH,CACP,CAAC;AACH,CAAC;AAED,eAAerD,WAAW"}
1
+ {"version":3,"names":["useContext","useEffect","useMemo","useRef","useState","Card","ConfigProvider","classNames","DownOutlined","LeftOutlined","RightOutlined","UpOutlined","useRefFunction","useStyle","jsx","_jsx","jsxs","_jsxs","FloatDrawer","props","open","_props$position","position","cardProps","children","className","classNamesInProps","style","styles","cacheKey","_props$defaultSize","defaultSize","_props$minSize","minSize","_props$maxSize","maxSize","Infinity","onOpenChange","onResize","_useContext","ConfigContext","getPrefixCls","prefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","_useState","_useState2","isOpen","setIsOpen","_useState3","localStorage","getItem","Number","_useState4","size","setSize","sizeMap","type","_defineProperty","_useState5","_useState6","isDragging","setIsDragging","dragStartPos","dragStartSize","classString","concat","closeIcon","openIcon","toggleDrawer","handleResizeStart","e","current","clientY","clientX","preventDefault","handleResize","newSize","setItem","String","handleResizeEnd","window","addEventListener","removeEventListener","drawer","_objectSpread","resizeHandle","onMouseDown","content","bordered","variant","card","expandHandle","onClick","handleIcon"],"sources":["../../../src/components/FloatDrawer/index.tsx"],"sourcesContent":["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport type { CardProps } from 'antd';\nimport { Card, ConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '@ant-design/icons';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport useStyle from './style';\n\nexport interface FloatDrawerProps {\n /**\n * **EN:** Whether the drawer is open\n *\n * **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * **EN:** Position of the drawer\n *\n * **CN:** 抽屉的位置\n *\n * @default 'right'\n */\n position?: 'left' | 'right' | 'top' | 'bottom';\n /**\n * **EN:** Default size of the drawer. If the drawer is placed on the left or right, this is the\n * width, otherwise it is the height.\n *\n * **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。\n *\n * @default 300\n */\n defaultSize?: number;\n /**\n * **EN:** Minimum size of the drawer\n *\n * **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * **EN:** Maximum size of the drawer\n *\n * **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n *\n * **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * **EN:** Custom class name for the root element\n *\n * **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * **EN:** Custom class names for specific elements\n *\n * **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * **EN:** Class name for the drawer element\n *\n * **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * **EN:** Class name for the expand handle\n *\n * **CN:** 展开手柄的类名\n */\n expandHandle?: string;\n /**\n * **EN:** Class name for the resize handle\n *\n * **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * **EN:** Class name for the handle icon\n *\n * **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * **EN:** Class name for the content area\n *\n * **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * **EN:** Class name for the card element\n *\n * **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * **EN:** Custom styles for the root element\n *\n * **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * **EN:** Custom styles for specific elements\n *\n * **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * **EN:** Styles for the drawer element\n *\n * **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * **EN:** Styles for the expand handle\n *\n * **CN:** 展开手柄的样式\n */\n expandHandle?: CSSProperties;\n /**\n * **EN:** Styles for the resize handle\n *\n * **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * **EN:** Styles for the handle icon\n *\n * **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * **EN:** Styles for the content area\n *\n * **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * **EN:** Styles for the card element\n *\n * **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * **EN:** Custom properties for the card element\n *\n * **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * **EN:** Content to be rendered inside the drawer\n *\n * **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * **EN:** Callback function when the open state changes\n *\n * **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * **EN:** Callback function when the drawer is resized\n *\n * **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n}\n\n/**\n * **EN:** FloatDrawer component for creating a draggable, resizable drawer\n *\n * **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize = 300,\n minSize = 0,\n maxSize = +Infinity,\n onOpenChange,\n onResize,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('re-float-drawer');\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [isOpen, setIsOpen] = useState<boolean>();\n const [size, setSize] = useState(\n cacheKey && localStorage.getItem(cacheKey) ? Number(localStorage.getItem(cacheKey)) || defaultSize : defaultSize\n );\n const sizeMap = useMemo(() => {\n const type = position === 'left' || position === 'right' ? 'width' : 'height';\n return {\n [type]: size,\n };\n }, [position, size]);\n const [isDragging, setIsDragging] = useState(false);\n const dragStartPos = useRef<number>(0);\n const dragStartSize = useRef<number>(size);\n const classString = classNames(\n prefixCls,\n className,\n {\n [`${prefixCls}-open`]: isOpen,\n [`${prefixCls}-closed`]: !isOpen,\n [`${prefixCls}-${position}`]: position,\n },\n hashId,\n cssVarCls\n );\n const closeIcon = useMemo(() => {\n return position === 'left' ? (\n <RightOutlined />\n ) : position === 'top' ? (\n <DownOutlined />\n ) : position === 'bottom' ? (\n <UpOutlined />\n ) : (\n <LeftOutlined />\n );\n }, [position]);\n const openIcon = useMemo(() => {\n return position === 'left' ? (\n <LeftOutlined />\n ) : position === 'top' ? (\n <UpOutlined />\n ) : position === 'bottom' ? (\n <DownOutlined />\n ) : (\n <RightOutlined />\n );\n }, [position]);\n\n // Handle drawer visibility\n const toggleDrawer = () => {\n setIsOpen(!isOpen);\n onOpenChange?.(!isOpen);\n };\n\n // Handle resize events\n const handleResizeStart = useRefFunction((e: React.MouseEvent) => {\n setIsDragging(true);\n if (position === 'top' || position === 'bottom') {\n dragStartPos.current = e.clientY;\n } else {\n dragStartPos.current = e.clientX;\n }\n dragStartSize.current = size;\n e.preventDefault();\n });\n const handleResize = useRefFunction((e: MouseEvent) => {\n if (isDragging) {\n let newSize: number;\n if (position === 'left') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientX);\n } else if (position === 'top') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientY);\n } else if (position === 'bottom') {\n newSize = dragStartSize.current - (e.clientY - dragStartPos.current);\n } else {\n newSize = dragStartSize.current - (e.clientX - dragStartPos.current);\n }\n if (newSize >= minSize && newSize <= maxSize) {\n setSize(newSize);\n if (cacheKey) {\n localStorage.setItem(cacheKey, String(newSize));\n }\n onResize?.(newSize);\n }\n }\n });\n const handleResizeEnd = useRefFunction(() => {\n setIsDragging(false);\n });\n\n // Controlled open state\n useEffect(() => {\n setIsOpen(open);\n }, [open]);\n\n // Handle global events\n useEffect(() => {\n if (isDragging) {\n window.addEventListener('mousemove', handleResize);\n window.addEventListener('mouseup', handleResizeEnd);\n } else {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n }\n return () => {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n };\n }, [isDragging]);\n\n return wrapCSSVar(\n <div className={classString} style={style}>\n <div\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n <div\n className={classNames(\n `${prefixCls}-resize-handle`,\n isDragging && `${prefixCls}-resize-handle-dragging`,\n classNamesInProps?.resizeHandle\n )}\n style={styles?.resizeHandle}\n onMouseDown={handleResizeStart}\n />\n <div className={classNames(`${prefixCls}-content`, classNamesInProps?.content)} style={styles?.content}>\n <Card\n bordered={false}\n variant=\"borderless\"\n className={classNames(`${prefixCls}-card`, classNamesInProps?.card)}\n style={styles?.card}\n {...cardProps}\n >\n {children}\n </Card>\n </div>\n <div\n className={classNames(`${prefixCls}-expand-handle`, classNamesInProps?.expandHandle)}\n style={styles?.expandHandle}\n onClick={toggleDrawer}\n >\n <div\n className={classNames(`${prefixCls}-handle-icon`, classNamesInProps?.handleIcon)}\n style={styles?.handleIcon}\n >\n {isOpen ? openIcon : closeIcon}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default FloatDrawer;\n"],"mappings":";;;;;;;;;;;;AACA,SAASA,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAExE,SAASC,IAAI,EAAEC,cAAc,QAAQ,MAAM;AAC3C,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,YAAY,EAAEC,YAAY,EAAEC,aAAa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Node } from 'react';
2
+ import type { TagProps } from 'antd';
3
+ import type { OverflowProps } from 'rc-overflow';
4
+ export interface OverflowTagsProps<T extends Record<string, unknown> = Record<string, unknown>> extends OverflowProps<T> {
5
+ /**
6
+ * **CN**: 标签集合的数据
7
+ *
8
+ * **EN**: Data collection of tags
9
+ */
10
+ tags: T[] | undefined;
11
+ /**
12
+ * **EN**: Function to get the tag name, default is `tag.name`
13
+ *
14
+ * **CN**: 获取标签名称的函数,默认取`tag.name`
15
+ */
16
+ getTagName?: (tag: T) => ReactNode;
17
+ /**
18
+ * **EN**: Function to get the unique identifier of the tag, default is `tag.id`
19
+ *
20
+ * **CN**: 获取标签唯一标识的函数,默认取`tag.id`
21
+ */
22
+ getTagKey?: (tag: T) => React.Key;
23
+ /**
24
+ * **EN**: Function to render the tag, returns `TagProps`
25
+ *
26
+ * **CN**: 渲染标签的函数,返回`TagProps`
27
+ */
28
+ renderTag?: (tag: T, tags: T[]) => TagProps;
29
+ /**
30
+ * **EN**: Custom properties for the tag component, if `renderTag` is also specified, the latter
31
+ * will override the former
32
+ *
33
+ * **CN**: 自定义标签的组件属性,如果同时指定了`renderTag`,则后者会覆盖前者
34
+ */
35
+ tagProps?: TagProps;
36
+ /**
37
+ * **EN**: When the number of tags exceeds the maximum display count, an ellipsis tag will be
38
+ * shown. This property is used to set the style of the ellipsis tag.
39
+ *
40
+ * **CN**: 当标签数量超过最大显示数量时,会显示省略号的标签,此属性用于设置省略号标签的样式
41
+ */
42
+ ellipsisTagProps?: TagProps;
43
+ /**
44
+ * **EN**: Whether to use random colors, default is `false`. Note that the tag object can also
45
+ * contain a `color` property to specify the color, and the latter takes precedence.
46
+ *
47
+ * **CN**: 是否使用随机颜色,默认`false`。注意,tag对象还可以包含`color`属性来指定颜色,而且后者优先级更高。
48
+ */
49
+ randomColors?: boolean;
50
+ }
51
+ declare const OverflowTags: <T extends Record<string, any>>(props: OverflowTagsProps<T>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
52
+ export default OverflowTags;
@@ -0,0 +1,91 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["tags", "randomColors", "getTagName", "getTagKey", "renderTag", "tagProps", "ellipsisTagProps", "className"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
+ import { useCallback, useContext, useMemo } from 'react';
17
+ import { ConfigProvider, Dropdown, Tag, theme } from 'antd';
18
+ import { PresetColors } from 'antd/es/theme/internal';
19
+ import classNames from 'classnames';
20
+ import Overflow from 'rc-overflow';
21
+ import { random } from "../../utils/math";
22
+ import useStyle from "./style";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { jsxs as _jsxs } from "react/jsx-runtime";
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ var OverflowTags = function OverflowTags(props) {
27
+ var _props$tags = props.tags,
28
+ tags = _props$tags === void 0 ? [] : _props$tags,
29
+ randomColors = props.randomColors,
30
+ getTagNameInProps = props.getTagName,
31
+ getTagKey = props.getTagKey,
32
+ renderTagInProps = props.renderTag,
33
+ tagProps = props.tagProps,
34
+ ellipsisTagProps = props.ellipsisTagProps,
35
+ className = props.className,
36
+ restProps = _objectWithoutProperties(props, _excluded);
37
+ var _theme$useToken = theme.useToken(),
38
+ token = _theme$useToken.token;
39
+ var _useContext = useContext(ConfigProvider.ConfigContext),
40
+ getPrefixCls = _useContext.getPrefixCls;
41
+ var prefixCls = getPrefixCls('re-float-drawer');
42
+ var _useStyle = useStyle(prefixCls),
43
+ _useStyle2 = _slicedToArray(_useStyle, 3),
44
+ wrapCSSVar = _useStyle2[0],
45
+ hashId = _useStyle2[1],
46
+ cssVarCls = _useStyle2[2];
47
+ var colors = useMemo(function () {
48
+ return PresetColors.filter(function (c) {
49
+ return !['lime', 'yellow', 'magenta'].includes(c);
50
+ }).map(function (color) {
51
+ return token["".concat(color, "-3")];
52
+ });
53
+ }, [token]);
54
+ var getTagName = useCallback(function (tag) {
55
+ return getTagNameInProps ? getTagNameInProps(tag) : tag.name;
56
+ }, [getTagNameInProps]);
57
+ var renderTag = function renderTag(item) {
58
+ var _item$color;
59
+ var customProps = renderTagInProps === null || renderTagInProps === void 0 ? void 0 : renderTagInProps(item, tags);
60
+ return /*#__PURE__*/_jsx(Tag, _objectSpread(_objectSpread(_objectSpread({}, tagProps), {}, {
61
+ color: randomColors ? colors[random(0, colors.length - 1)] : (_item$color = item.color) !== null && _item$color !== void 0 ? _item$color : 'default'
62
+ }, customProps), {}, {
63
+ children: getTagName(item)
64
+ }));
65
+ };
66
+ return wrapCSSVar( /*#__PURE__*/_jsx(Overflow, _objectSpread({
67
+ className: classNames(hashId, cssVarCls, prefixCls, className),
68
+ data: tags,
69
+ maxCount: "responsive",
70
+ renderItem: renderTag,
71
+ renderRest: function renderRest(omittedItems) {
72
+ return /*#__PURE__*/_jsx(Dropdown, {
73
+ menu: {
74
+ items: omittedItems.map(function (tag) {
75
+ var _tag$id;
76
+ return {
77
+ type: 'item',
78
+ key: getTagKey ? getTagKey(tag) : (_tag$id = tag.id) !== null && _tag$id !== void 0 ? _tag$id : getTagName(tag),
79
+ label: getTagName(tag)
80
+ };
81
+ })
82
+ },
83
+ children: /*#__PURE__*/_jsxs(Tag, _objectSpread(_objectSpread({}, ellipsisTagProps), {}, {
84
+ children: ["+ ", omittedItems.length, "..."]
85
+ }))
86
+ });
87
+ }
88
+ }, restProps)));
89
+ };
90
+ export default OverflowTags;
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useContext","useMemo","ConfigProvider","Dropdown","Tag","theme","PresetColors","classNames","Overflow","random","useStyle","jsx","_jsx","jsxs","_jsxs","OverflowTags","props","_props$tags","tags","randomColors","getTagNameInProps","getTagName","getTagKey","renderTagInProps","renderTag","tagProps","ellipsisTagProps","className","restProps","_objectWithoutProperties","_excluded","_theme$useToken","useToken","token","_useContext","ConfigContext","getPrefixCls","prefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","colors","filter","c","includes","map","color","concat","tag","name","item","_item$color","customProps","_objectSpread","length","children","data","maxCount","renderItem","renderRest","omittedItems","menu","items","_tag$id","type","key","id","label"],"sources":["../../../src/components/OverflowTags/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport type { TagProps } from 'antd';\nimport { ConfigProvider, Dropdown, Tag, theme } from 'antd';\nimport { PresetColors } from 'antd/es/theme/internal';\nimport classNames from 'classnames';\nimport type { OverflowProps } from 'rc-overflow';\nimport Overflow from 'rc-overflow';\nimport { random } from '../../utils/math';\nimport useStyle from './style';\n\nexport interface OverflowTagsProps<T extends Record<string, unknown> = Record<string, unknown>>\n extends OverflowProps<T> {\n /**\n * **CN**: 标签集合的数据\n *\n * **EN**: Data collection of tags\n */\n tags: T[] | undefined;\n /**\n * **EN**: Function to get the tag name, default is `tag.name`\n *\n * **CN**: 获取标签名称的函数,默认取`tag.name`\n */\n getTagName?: (tag: T) => ReactNode;\n /**\n * **EN**: Function to get the unique identifier of the tag, default is `tag.id`\n *\n * **CN**: 获取标签唯一标识的函数,默认取`tag.id`\n */\n getTagKey?: (tag: T) => React.Key;\n /**\n * **EN**: Function to render the tag, returns `TagProps`\n *\n * **CN**: 渲染标签的函数,返回`TagProps`\n */\n renderTag?: (tag: T, tags: T[]) => TagProps;\n /**\n * **EN**: Custom properties for the tag component, if `renderTag` is also specified, the latter\n * will override the former\n *\n * **CN**: 自定义标签的组件属性,如果同时指定了`renderTag`,则后者会覆盖前者\n */\n tagProps?: TagProps;\n /**\n * **EN**: When the number of tags exceeds the maximum display count, an ellipsis tag will be\n * shown. This property is used to set the style of the ellipsis tag.\n *\n * **CN**: 当标签数量超过最大显示数量时,会显示省略号的标签,此属性用于设置省略号标签的样式\n */\n ellipsisTagProps?: TagProps;\n /**\n * **EN**: Whether to use random colors, default is `false`. Note that the tag object can also\n * contain a `color` property to specify the color, and the latter takes precedence.\n *\n * **CN**: 是否使用随机颜色,默认`false`。注意,tag对象还可以包含`color`属性来指定颜色,而且后者优先级更高。\n */\n randomColors?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst OverflowTags = <T extends Record<string, any>>(props: OverflowTagsProps<T>) => {\n const {\n tags = [],\n randomColors,\n getTagName: getTagNameInProps,\n getTagKey,\n renderTag: renderTagInProps,\n tagProps,\n ellipsisTagProps,\n className,\n ...restProps\n } = props;\n const { token } = theme.useToken();\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('re-float-drawer');\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n\n const colors = useMemo(\n () => PresetColors.filter((c) => !['lime', 'yellow', 'magenta'].includes(c)).map((color) => token[`${color}-3`]),\n [token]\n );\n const getTagName = useCallback(\n (tag: T) => {\n return getTagNameInProps ? getTagNameInProps(tag) : tag.name;\n },\n [getTagNameInProps]\n );\n const renderTag = (item: T) => {\n const customProps = renderTagInProps?.(item, tags);\n return (\n <Tag\n {...tagProps}\n color={randomColors ? colors[random(0, colors.length - 1)] : (item.color ?? 'default')}\n {...customProps}\n >\n {getTagName(item)}\n </Tag>\n );\n };\n\n return wrapCSSVar(\n <Overflow<T>\n className={classNames(hashId, cssVarCls, prefixCls, className)}\n data={tags}\n maxCount=\"responsive\"\n renderItem={renderTag}\n renderRest={(omittedItems) => (\n <Dropdown\n menu={{\n items: omittedItems.map((tag) => ({\n type: 'item',\n key: getTagKey ? getTagKey(tag) : (tag.id ?? getTagName(tag)),\n label: getTagName(tag),\n })),\n }}\n >\n <Tag {...ellipsisTagProps}>+ {omittedItems.length}...</Tag>\n </Dropdown>\n )}\n {...restProps}\n />\n );\n};\n\nexport default OverflowTags;\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAASA,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAExD,SAASC,cAAc,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,KAAK,QAAQ,MAAM;AAC3D,SAASC,YAAY,QAAQ,wBAAwB;AACrD,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,MAAM;AACf,OAAOC,QAAQ;AAAgB,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAmD/B;AACA,IAAMC,YAAY,GAAG,SAAfA,YAAYA,C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AIf,GAAG,CAACkB,EAAE,cAAAH,OAAA,cAAAA,OAAA,GAAI7C,UAAU,CAAC8B,GAAG,CAAE;cAC7DmB,KAAK,EAAEjD,UAAU,CAAC8B,GAAG;YACvB,CAAC;UAAA,CAAC;QACJ,CAAE;QAAAO,QAAA,eAEF5C,KAAA,CAACV,GAAG,EAAAoD,aAAA,CAAAA,aAAA,KAAK9B,gBAAgB;UAAAgC,QAAA,GAAE,IAAE,EAACK,YAAY,CAACN,MAAM,EAAC,KAAG;QAAA,EAAK;MAAC,CACnD,CAAC;IAAA;EACX,GACE7B,SAAS,CACd,CACH,CAAC;AACH,CAAC;AAED,eAAeb,YAAY"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: (prefixCls: string, rootCls?: string | undefined) => readonly [(node: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>, string, string];
3
+ export default _default;
@@ -0,0 +1,18 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { genStyleHooks } from 'antd/es/theme/internal';
6
+ var genStyle = function genStyle(token) {
7
+ var componentCls = token.componentCls;
8
+ return _defineProperty({}, componentCls, {
9
+ display: 'flex',
10
+ flexWrap: 'wrap',
11
+ maxWidth: '100%',
12
+ position: 'relative'
13
+ });
14
+ };
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ export default genStyleHooks('re-overflow-tags', genStyle);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","display","flexWrap","maxWidth","position"],"sources":["../../../../src/components/OverflowTags/style/index.ts"],"sourcesContent":["import { genStyleHooks } from 'antd/es/theme/internal';\nimport type { AliasToken, GenerateStyle } from 'antd/es/theme/internal';\nimport type { CSSObject } from '@ant-design/cssinjs';\nimport type { FullToken } from '@ant-design/cssinjs-utils';\n\ntype OverflowTagsToken = FullToken<{ ''?: object }, AliasToken, ''>;\n\nconst genStyle: GenerateStyle<OverflowTagsToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n display: 'flex',\n flexWrap: 'wrap',\n maxWidth: '100%',\n position: 'relative',\n },\n };\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default genStyleHooks('re-overflow-tags' as any, genStyle);\n"],"mappings":";;;;AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAOtD,IAAMC,QAA0C,GAAG,SAA7CA,QAA0CA,CAAIC,KAAK,EAAgB;EACvE,IAAQC,YAAY,GAAKD,KAAK,CAAtBC,YAAY;EACpB,OAAAC,eAAA,KACGD,YAAY,EAAG;IACdE,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE,MAAM;IAChBC,QAAQ,EAAE,MAAM;IAChBC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;;AAED;AACA,eAAeR,aAAa,CAAC,kBAAkB,EAASC,QAAQ,CAAC"}
@@ -13,3 +13,5 @@ export { default as FloatDrawer } from './FloatDrawer';
13
13
  export type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';
14
14
  export { withDefaultModalActionProps, withModalAction } from './ModalAction';
15
15
  export { default as ModalAction } from './ModalAction';
16
+ export type { OverflowTagsProps } from './OverflowTags';
17
+ export { default as OverflowTags } from './OverflowTags';
@@ -9,6 +9,5 @@ export { default as DeleteConfirmAction } from "./DeleteConfirmAction";
9
9
  export { default as FloatDrawer } from "./FloatDrawer";
10
10
  export { withDefaultModalActionProps, withModalAction } from "./ModalAction";
11
11
  export { default as ModalAction } from "./ModalAction";
12
-
13
- // export * from '../utils';
12
+ export { default as OverflowTags } from "./OverflowTags";
14
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","BreakLines","ConfigProvider","ReactEasyContext","withDefaultConfirmActionProps","ConfirmAction","DeleteConfirmAction","FloatDrawer","withDefaultModalActionProps","withModalAction","ModalAction"],"sources":["../../src/components/index.tsx"],"sourcesContent":["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\n// export * from '../utils';\n"],"mappings":"AACA,SAASA,OAAO,IAAIC,UAAU;AAG9B,SAASD,OAAO,IAAIE,cAAc;AAElC,SAASF,OAAO,IAAIG,gBAAgB;AAGpC,SAASC,6BAA6B;AACtC,SAASJ,OAAO,IAAIK,aAAa;;AAEjC;AACA,SAASL,OAAO,IAAIM,mBAAmB;AAGvC,SAASN,OAAO,IAAIO,WAAW;AAG/B,SAASC,2BAA2B,EAAEC,eAAe;AACrD,SAAST,OAAO,IAAIU,WAAW;;AAE/B"}
1
+ {"version":3,"names":["default","BreakLines","ConfigProvider","ReactEasyContext","withDefaultConfirmActionProps","ConfirmAction","DeleteConfirmAction","FloatDrawer","withDefaultModalActionProps","withModalAction","ModalAction","OverflowTags"],"sources":["../../src/components/index.tsx"],"sourcesContent":["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\nexport type { OverflowTagsProps } from './OverflowTags';\nexport { default as OverflowTags } from './OverflowTags';\n"],"mappings":"AACA,SAASA,OAAO,IAAIC,UAAU;AAG9B,SAASD,OAAO,IAAIE,cAAc;AAElC,SAASF,OAAO,IAAIG,gBAAgB;AAGpC,SAASC,6BAA6B;AACtC,SAASJ,OAAO,IAAIK,aAAa;;AAEjC;AACA,SAASL,OAAO,IAAIM,mBAAmB;AAGvC,SAASN,OAAO,IAAIO,WAAW;AAG/B,SAASC,2BAA2B,EAAEC,eAAe;AACrD,SAAST,OAAO,IAAIU,WAAW;AAG/B,SAASV,OAAO,IAAIW,YAAY"}
@@ -1 +1,2 @@
1
1
  export * from './color';
2
+ export * from './math';
package/es/utils/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./color";
2
+ export * from "./math";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './color';\n"],"mappings":"AAAA"}
1
+ {"version":3,"names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './color';\nexport * from './math';\n"],"mappings":"AAAA;AACA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * **EN**: Generate a random number within a specified range (inclusive on both ends)
3
+ *
4
+ * **CN**: 生成指定范围(两端包含)内的随机数
5
+ *
6
+ * @param min The minimum value (inclusive) | 最小值(包含)
7
+ * @param max The maximum value (inclusive) | 最大值(包含)
8
+ *
9
+ * @returns The generated random number | 生成的随机数
10
+ */
11
+ export declare function random(min: number, max: number): number;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * **EN**: Generate a random number within a specified range (inclusive on both ends)
3
+ *
4
+ * **CN**: 生成指定范围(两端包含)内的随机数
5
+ *
6
+ * @param min The minimum value (inclusive) | 最小值(包含)
7
+ * @param max The maximum value (inclusive) | 最大值(包含)
8
+ *
9
+ * @returns The generated random number | 生成的随机数
10
+ */
11
+ export function random(min, max) {
12
+ var array = new Uint32Array(1);
13
+ globalThis.crypto.getRandomValues(array);
14
+ var randomValue = array[0] / (0xffffffff + 1);
15
+ return Math.floor(randomValue * (max - min + 1)) + min;
16
+ }
17
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["random","min","max","array","Uint32Array","globalThis","crypto","getRandomValues","randomValue","Math","floor"],"sources":["../../src/utils/math.ts"],"sourcesContent":["/**\n * **EN**: Generate a random number within a specified range (inclusive on both ends)\n *\n * **CN**: 生成指定范围(两端包含)内的随机数\n *\n * @param min The minimum value (inclusive) | 最小值(包含)\n * @param max The maximum value (inclusive) | 最大值(包含)\n *\n * @returns The generated random number | 生成的随机数\n */\nexport function random(min: number, max: number): number {\n const array = new Uint32Array(1);\n globalThis.crypto.getRandomValues(array);\n const randomValue = array[0] / (0xffffffff + 1);\n return Math.floor(randomValue * (max - min + 1)) + min;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,MAAMA,CAACC,GAAW,EAAEC,GAAW,EAAU;EACvD,IAAMC,KAAK,GAAG,IAAIC,WAAW,CAAC,CAAC,CAAC;EAChCC,UAAU,CAACC,MAAM,CAACC,eAAe,CAACJ,KAAK,CAAC;EACxC,IAAMK,WAAW,GAAGL,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,GAAG,CAAC,CAAC;EAC/C,OAAOM,IAAI,CAACC,KAAK,CAACF,WAAW,IAAIN,GAAG,GAAGD,GAAG,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG;AACxD"}
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperties, FC, ReactNode } from 'react';
2
- import { type CardProps } from 'antd';
2
+ import type { CardProps } from 'antd';
3
3
  export interface FloatDrawerProps {
4
4
  /**
5
5
  * **EN:** Whether the drawer is open
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FloatDrawer/index.tsx"],
4
- "sourcesContent": ["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { Card, type CardProps, ConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '@ant-design/icons';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport useStyle from './style';\n\nexport interface FloatDrawerProps {\n /**\n * **EN:** Whether the drawer is open\n *\n * **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * **EN:** Position of the drawer\n *\n * **CN:** 抽屉的位置\n *\n * @default 'right'\n */\n position?: 'left' | 'right' | 'top' | 'bottom';\n /**\n * **EN:** Default size of the drawer. If the drawer is placed on the left or right, this is the\n * width, otherwise it is the height.\n *\n * **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。\n *\n * @default 300\n */\n defaultSize?: number;\n /**\n * **EN:** Minimum size of the drawer\n *\n * **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * **EN:** Maximum size of the drawer\n *\n * **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n *\n * **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * **EN:** Custom class name for the root element\n *\n * **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * **EN:** Custom class names for specific elements\n *\n * **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * **EN:** Class name for the drawer element\n *\n * **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * **EN:** Class name for the expand handle\n *\n * **CN:** 展开手柄的类名\n */\n expandHandle?: string;\n /**\n * **EN:** Class name for the resize handle\n *\n * **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * **EN:** Class name for the handle icon\n *\n * **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * **EN:** Class name for the content area\n *\n * **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * **EN:** Class name for the card element\n *\n * **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * **EN:** Custom styles for the root element\n *\n * **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * **EN:** Custom styles for specific elements\n *\n * **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * **EN:** Styles for the drawer element\n *\n * **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * **EN:** Styles for the expand handle\n *\n * **CN:** 展开手柄的样式\n */\n expandHandle?: CSSProperties;\n /**\n * **EN:** Styles for the resize handle\n *\n * **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * **EN:** Styles for the handle icon\n *\n * **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * **EN:** Styles for the content area\n *\n * **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * **EN:** Styles for the card element\n *\n * **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * **EN:** Custom properties for the card element\n *\n * **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * **EN:** Content to be rendered inside the drawer\n *\n * **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * **EN:** Callback function when the open state changes\n *\n * **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * **EN:** Callback function when the drawer is resized\n *\n * **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n}\n\n/**\n * **EN:** FloatDrawer component for creating a draggable, resizable drawer\n *\n * **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize = 300,\n minSize = 0,\n maxSize = +Infinity,\n onOpenChange,\n onResize,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('re-float-drawer');\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [isOpen, setIsOpen] = useState<boolean>();\n const [size, setSize] = useState(\n cacheKey && localStorage.getItem(cacheKey) ? Number(localStorage.getItem(cacheKey)) || defaultSize : defaultSize\n );\n const sizeMap = useMemo(() => {\n const type = position === 'left' || position === 'right' ? 'width' : 'height';\n return {\n [type]: size,\n };\n }, [position, size]);\n const [isDragging, setIsDragging] = useState(false);\n const dragStartPos = useRef<number>(0);\n const dragStartSize = useRef<number>(size);\n const classString = classNames(\n prefixCls,\n className,\n {\n [`${prefixCls}-open`]: isOpen,\n [`${prefixCls}-closed`]: !isOpen,\n [`${prefixCls}-${position}`]: position,\n },\n hashId,\n cssVarCls\n );\n const closeIcon = useMemo(() => {\n return position === 'left' ? (\n <RightOutlined />\n ) : position === 'top' ? (\n <DownOutlined />\n ) : position === 'bottom' ? (\n <UpOutlined />\n ) : (\n <LeftOutlined />\n );\n }, [position]);\n const openIcon = useMemo(() => {\n return position === 'left' ? (\n <LeftOutlined />\n ) : position === 'top' ? (\n <UpOutlined />\n ) : position === 'bottom' ? (\n <DownOutlined />\n ) : (\n <RightOutlined />\n );\n }, [position]);\n\n // Handle drawer visibility\n const toggleDrawer = () => {\n setIsOpen(!isOpen);\n onOpenChange?.(!isOpen);\n };\n\n // Handle resize events\n const handleResizeStart = useRefFunction((e: React.MouseEvent) => {\n setIsDragging(true);\n if (position === 'top' || position === 'bottom') {\n dragStartPos.current = e.clientY;\n } else {\n dragStartPos.current = e.clientX;\n }\n dragStartSize.current = size;\n e.preventDefault();\n });\n const handleResize = useRefFunction((e: MouseEvent) => {\n if (isDragging) {\n let newSize: number;\n if (position === 'left') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientX);\n } else if (position === 'top') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientY);\n } else if (position === 'bottom') {\n newSize = dragStartSize.current - (e.clientY - dragStartPos.current);\n } else {\n newSize = dragStartSize.current - (e.clientX - dragStartPos.current);\n }\n if (newSize >= minSize && newSize <= maxSize) {\n setSize(newSize);\n if (cacheKey) {\n localStorage.setItem(cacheKey, String(newSize));\n }\n onResize?.(newSize);\n }\n }\n });\n const handleResizeEnd = useRefFunction(() => {\n setIsDragging(false);\n });\n\n // Controlled open state\n useEffect(() => {\n setIsOpen(open);\n }, [open]);\n\n // Handle global events\n useEffect(() => {\n if (isDragging) {\n window.addEventListener('mousemove', handleResize);\n window.addEventListener('mouseup', handleResizeEnd);\n } else {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n }\n return () => {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n };\n }, [isDragging]);\n\n return wrapCSSVar(\n <div className={classString} style={style}>\n <div\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n <div\n className={classNames(\n `${prefixCls}-resize-handle`,\n isDragging && `${prefixCls}-resize-handle-dragging`,\n classNamesInProps?.resizeHandle\n )}\n style={styles?.resizeHandle}\n onMouseDown={handleResizeStart}\n />\n <div className={classNames(`${prefixCls}-content`, classNamesInProps?.content)} style={styles?.content}>\n <Card\n bordered={false}\n variant=\"borderless\"\n className={classNames(`${prefixCls}-card`, classNamesInProps?.card)}\n style={styles?.card}\n {...cardProps}\n >\n {children}\n </Card>\n </div>\n <div\n className={classNames(`${prefixCls}-expand-handle`, classNamesInProps?.expandHandle)}\n style={styles?.expandHandle}\n onClick={toggleDrawer}\n >\n <div\n className={classNames(`${prefixCls}-handle-icon`, classNamesInProps?.handleIcon)}\n style={styles?.handleIcon}\n >\n {isOpen ? openIcon : closeIcon}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default FloatDrawer;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiE;AACjE,kBAAqD;AACrD,wBAAuB;AACvB,mBAAsE;AACtE,4BAA2B;AAC3B,mBAAqB;AAkLrB,IAAM,cAAoC,CAAC,UAAU;AACnD,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAA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
4
+ "sourcesContent": ["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport type { CardProps } from 'antd';\nimport { Card, ConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '@ant-design/icons';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport useStyle from './style';\n\nexport interface FloatDrawerProps {\n /**\n * **EN:** Whether the drawer is open\n *\n * **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * **EN:** Position of the drawer\n *\n * **CN:** 抽屉的位置\n *\n * @default 'right'\n */\n position?: 'left' | 'right' | 'top' | 'bottom';\n /**\n * **EN:** Default size of the drawer. If the drawer is placed on the left or right, this is the\n * width, otherwise it is the height.\n *\n * **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。\n *\n * @default 300\n */\n defaultSize?: number;\n /**\n * **EN:** Minimum size of the drawer\n *\n * **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * **EN:** Maximum size of the drawer\n *\n * **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n *\n * **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * **EN:** Custom class name for the root element\n *\n * **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * **EN:** Custom class names for specific elements\n *\n * **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * **EN:** Class name for the drawer element\n *\n * **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * **EN:** Class name for the expand handle\n *\n * **CN:** 展开手柄的类名\n */\n expandHandle?: string;\n /**\n * **EN:** Class name for the resize handle\n *\n * **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * **EN:** Class name for the handle icon\n *\n * **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * **EN:** Class name for the content area\n *\n * **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * **EN:** Class name for the card element\n *\n * **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * **EN:** Custom styles for the root element\n *\n * **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * **EN:** Custom styles for specific elements\n *\n * **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * **EN:** Styles for the drawer element\n *\n * **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * **EN:** Styles for the expand handle\n *\n * **CN:** 展开手柄的样式\n */\n expandHandle?: CSSProperties;\n /**\n * **EN:** Styles for the resize handle\n *\n * **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * **EN:** Styles for the handle icon\n *\n * **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * **EN:** Styles for the content area\n *\n * **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * **EN:** Styles for the card element\n *\n * **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * **EN:** Custom properties for the card element\n *\n * **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * **EN:** Content to be rendered inside the drawer\n *\n * **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * **EN:** Callback function when the open state changes\n *\n * **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * **EN:** Callback function when the drawer is resized\n *\n * **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n}\n\n/**\n * **EN:** FloatDrawer component for creating a draggable, resizable drawer\n *\n * **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize = 300,\n minSize = 0,\n maxSize = +Infinity,\n onOpenChange,\n onResize,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('re-float-drawer');\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [isOpen, setIsOpen] = useState<boolean>();\n const [size, setSize] = useState(\n cacheKey && localStorage.getItem(cacheKey) ? Number(localStorage.getItem(cacheKey)) || defaultSize : defaultSize\n );\n const sizeMap = useMemo(() => {\n const type = position === 'left' || position === 'right' ? 'width' : 'height';\n return {\n [type]: size,\n };\n }, [position, size]);\n const [isDragging, setIsDragging] = useState(false);\n const dragStartPos = useRef<number>(0);\n const dragStartSize = useRef<number>(size);\n const classString = classNames(\n prefixCls,\n className,\n {\n [`${prefixCls}-open`]: isOpen,\n [`${prefixCls}-closed`]: !isOpen,\n [`${prefixCls}-${position}`]: position,\n },\n hashId,\n cssVarCls\n );\n const closeIcon = useMemo(() => {\n return position === 'left' ? (\n <RightOutlined />\n ) : position === 'top' ? (\n <DownOutlined />\n ) : position === 'bottom' ? (\n <UpOutlined />\n ) : (\n <LeftOutlined />\n );\n }, [position]);\n const openIcon = useMemo(() => {\n return position === 'left' ? (\n <LeftOutlined />\n ) : position === 'top' ? (\n <UpOutlined />\n ) : position === 'bottom' ? (\n <DownOutlined />\n ) : (\n <RightOutlined />\n );\n }, [position]);\n\n // Handle drawer visibility\n const toggleDrawer = () => {\n setIsOpen(!isOpen);\n onOpenChange?.(!isOpen);\n };\n\n // Handle resize events\n const handleResizeStart = useRefFunction((e: React.MouseEvent) => {\n setIsDragging(true);\n if (position === 'top' || position === 'bottom') {\n dragStartPos.current = e.clientY;\n } else {\n dragStartPos.current = e.clientX;\n }\n dragStartSize.current = size;\n e.preventDefault();\n });\n const handleResize = useRefFunction((e: MouseEvent) => {\n if (isDragging) {\n let newSize: number;\n if (position === 'left') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientX);\n } else if (position === 'top') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientY);\n } else if (position === 'bottom') {\n newSize = dragStartSize.current - (e.clientY - dragStartPos.current);\n } else {\n newSize = dragStartSize.current - (e.clientX - dragStartPos.current);\n }\n if (newSize >= minSize && newSize <= maxSize) {\n setSize(newSize);\n if (cacheKey) {\n localStorage.setItem(cacheKey, String(newSize));\n }\n onResize?.(newSize);\n }\n }\n });\n const handleResizeEnd = useRefFunction(() => {\n setIsDragging(false);\n });\n\n // Controlled open state\n useEffect(() => {\n setIsOpen(open);\n }, [open]);\n\n // Handle global events\n useEffect(() => {\n if (isDragging) {\n window.addEventListener('mousemove', handleResize);\n window.addEventListener('mouseup', handleResizeEnd);\n } else {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n }\n return () => {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n };\n }, [isDragging]);\n\n return wrapCSSVar(\n <div className={classString} style={style}>\n <div\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n <div\n className={classNames(\n `${prefixCls}-resize-handle`,\n isDragging && `${prefixCls}-resize-handle-dragging`,\n classNamesInProps?.resizeHandle\n )}\n style={styles?.resizeHandle}\n onMouseDown={handleResizeStart}\n />\n <div className={classNames(`${prefixCls}-content`, classNamesInProps?.content)} style={styles?.content}>\n <Card\n bordered={false}\n variant=\"borderless\"\n className={classNames(`${prefixCls}-card`, classNamesInProps?.card)}\n style={styles?.card}\n {...cardProps}\n >\n {children}\n </Card>\n </div>\n <div\n className={classNames(`${prefixCls}-expand-handle`, classNamesInProps?.expandHandle)}\n style={styles?.expandHandle}\n onClick={toggleDrawer}\n >\n <div\n className={classNames(`${prefixCls}-handle-icon`, classNamesInProps?.handleIcon)}\n style={styles?.handleIcon}\n >\n {isOpen ? openIcon : closeIcon}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default F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C;AAAA;AAAA,UACC,eAAW,kBAAAA,SAAW,GAAG,2BAA2B,uDAAmB,YAAY;AAAA,UACnF,OAAO,iCAAQ;AAAA,UACf,SAAS;AAAA;AAAA,QAET;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,kBAAAA,SAAW,GAAG,yBAAyB,uDAAmB,UAAU;AAAA,YAC/E,OAAO,iCAAQ;AAAA;AAAA,UAEd,SAAS,WAAW;AAAA,QACvB;AAAA,MACF;AAAA,IACF,CACF;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;",
6
6
  "names": ["useStyle", "classNames", "useRefFunction"]
7
7
  }
@@ -0,0 +1,52 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { TagProps } from 'antd';
3
+ import type { OverflowProps } from 'rc-overflow';
4
+ export interface OverflowTagsProps<T extends Record<string, unknown> = Record<string, unknown>> extends OverflowProps<T> {
5
+ /**
6
+ * **CN**: 标签集合的数据
7
+ *
8
+ * **EN**: Data collection of tags
9
+ */
10
+ tags: T[] | undefined;
11
+ /**
12
+ * **EN**: Function to get the tag name, default is `tag.name`
13
+ *
14
+ * **CN**: 获取标签名称的函数,默认取`tag.name`
15
+ */
16
+ getTagName?: (tag: T) => ReactNode;
17
+ /**
18
+ * **EN**: Function to get the unique identifier of the tag, default is `tag.id`
19
+ *
20
+ * **CN**: 获取标签唯一标识的函数,默认取`tag.id`
21
+ */
22
+ getTagKey?: (tag: T) => React.Key;
23
+ /**
24
+ * **EN**: Function to render the tag, returns `TagProps`
25
+ *
26
+ * **CN**: 渲染标签的函数,返回`TagProps`
27
+ */
28
+ renderTag?: (tag: T, tags: T[]) => TagProps;
29
+ /**
30
+ * **EN**: Custom properties for the tag component, if `renderTag` is also specified, the latter
31
+ * will override the former
32
+ *
33
+ * **CN**: 自定义标签的组件属性,如果同时指定了`renderTag`,则后者会覆盖前者
34
+ */
35
+ tagProps?: TagProps;
36
+ /**
37
+ * **EN**: When the number of tags exceeds the maximum display count, an ellipsis tag will be
38
+ * shown. This property is used to set the style of the ellipsis tag.
39
+ *
40
+ * **CN**: 当标签数量超过最大显示数量时,会显示省略号的标签,此属性用于设置省略号标签的样式
41
+ */
42
+ ellipsisTagProps?: TagProps;
43
+ /**
44
+ * **EN**: Whether to use random colors, default is `false`. Note that the tag object can also
45
+ * contain a `color` property to specify the color, and the latter takes precedence.
46
+ *
47
+ * **CN**: 是否使用随机颜色,默认`false`。注意,tag对象还可以包含`color`属性来指定颜色,而且后者优先级更高。
48
+ */
49
+ randomColors?: boolean;
50
+ }
51
+ declare const OverflowTags: <T extends Record<string, any>>(props: OverflowTagsProps<T>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
52
+ export default OverflowTags;
@@ -0,0 +1,107 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/OverflowTags/index.tsx
30
+ var OverflowTags_exports = {};
31
+ __export(OverflowTags_exports, {
32
+ default: () => OverflowTags_default
33
+ });
34
+ module.exports = __toCommonJS(OverflowTags_exports);
35
+ var import_react = require("react");
36
+ var import_antd = require("antd");
37
+ var import_internal = require("antd/es/theme/internal");
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_rc_overflow = __toESM(require("rc-overflow"));
40
+ var import_math = require("../../utils/math");
41
+ var import_style = __toESM(require("./style"));
42
+ var OverflowTags = (props) => {
43
+ const {
44
+ tags = [],
45
+ randomColors,
46
+ getTagName: getTagNameInProps,
47
+ getTagKey,
48
+ renderTag: renderTagInProps,
49
+ tagProps,
50
+ ellipsisTagProps,
51
+ className,
52
+ ...restProps
53
+ } = props;
54
+ const { token } = import_antd.theme.useToken();
55
+ const { getPrefixCls } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
56
+ const prefixCls = getPrefixCls("re-float-drawer");
57
+ const [wrapCSSVar, hashId, cssVarCls] = (0, import_style.default)(prefixCls);
58
+ const colors = (0, import_react.useMemo)(
59
+ () => import_internal.PresetColors.filter((c) => !["lime", "yellow", "magenta"].includes(c)).map((color) => token[`${color}-3`]),
60
+ [token]
61
+ );
62
+ const getTagName = (0, import_react.useCallback)(
63
+ (tag) => {
64
+ return getTagNameInProps ? getTagNameInProps(tag) : tag.name;
65
+ },
66
+ [getTagNameInProps]
67
+ );
68
+ const renderTag = (item) => {
69
+ const customProps = renderTagInProps == null ? void 0 : renderTagInProps(item, tags);
70
+ return /* @__PURE__ */ React.createElement(
71
+ import_antd.Tag,
72
+ {
73
+ ...tagProps,
74
+ color: randomColors ? colors[(0, import_math.random)(0, colors.length - 1)] : item.color ?? "default",
75
+ ...customProps
76
+ },
77
+ getTagName(item)
78
+ );
79
+ };
80
+ return wrapCSSVar(
81
+ /* @__PURE__ */ React.createElement(
82
+ import_rc_overflow.default,
83
+ {
84
+ className: (0, import_classnames.default)(hashId, cssVarCls, prefixCls, className),
85
+ data: tags,
86
+ maxCount: "responsive",
87
+ renderItem: renderTag,
88
+ renderRest: (omittedItems) => /* @__PURE__ */ React.createElement(
89
+ import_antd.Dropdown,
90
+ {
91
+ menu: {
92
+ items: omittedItems.map((tag) => ({
93
+ type: "item",
94
+ key: getTagKey ? getTagKey(tag) : tag.id ?? getTagName(tag),
95
+ label: getTagName(tag)
96
+ }))
97
+ }
98
+ },
99
+ /* @__PURE__ */ React.createElement(import_antd.Tag, { ...ellipsisTagProps }, "+ ", omittedItems.length, "...")
100
+ ),
101
+ ...restProps
102
+ }
103
+ )
104
+ );
105
+ };
106
+ var OverflowTags_default = OverflowTags;
107
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/OverflowTags/index.tsx"],
4
+ "sourcesContent": ["import type { ReactNode } from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport type { TagProps } from 'antd';\nimport { ConfigProvider, Dropdown, Tag, theme } from 'antd';\nimport { PresetColors } from 'antd/es/theme/internal';\nimport classNames from 'classnames';\nimport type { OverflowProps } from 'rc-overflow';\nimport Overflow from 'rc-overflow';\nimport { random } from '../../utils/math';\nimport useStyle from './style';\n\nexport interface OverflowTagsProps<T extends Record<string, unknown> = Record<string, unknown>>\n extends OverflowProps<T> {\n /**\n * **CN**: 标签集合的数据\n *\n * **EN**: Data collection of tags\n */\n tags: T[] | undefined;\n /**\n * **EN**: Function to get the tag name, default is `tag.name`\n *\n * **CN**: 获取标签名称的函数,默认取`tag.name`\n */\n getTagName?: (tag: T) => ReactNode;\n /**\n * **EN**: Function to get the unique identifier of the tag, default is `tag.id`\n *\n * **CN**: 获取标签唯一标识的函数,默认取`tag.id`\n */\n getTagKey?: (tag: T) => React.Key;\n /**\n * **EN**: Function to render the tag, returns `TagProps`\n *\n * **CN**: 渲染标签的函数,返回`TagProps`\n */\n renderTag?: (tag: T, tags: T[]) => TagProps;\n /**\n * **EN**: Custom properties for the tag component, if `renderTag` is also specified, the latter\n * will override the former\n *\n * **CN**: 自定义标签的组件属性,如果同时指定了`renderTag`,则后者会覆盖前者\n */\n tagProps?: TagProps;\n /**\n * **EN**: When the number of tags exceeds the maximum display count, an ellipsis tag will be\n * shown. This property is used to set the style of the ellipsis tag.\n *\n * **CN**: 当标签数量超过最大显示数量时,会显示省略号的标签,此属性用于设置省略号标签的样式\n */\n ellipsisTagProps?: TagProps;\n /**\n * **EN**: Whether to use random colors, default is `false`. Note that the tag object can also\n * contain a `color` property to specify the color, and the latter takes precedence.\n *\n * **CN**: 是否使用随机颜色,默认`false`。注意,tag对象还可以包含`color`属性来指定颜色,而且后者优先级更高。\n */\n randomColors?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst OverflowTags = <T extends Record<string, any>>(props: OverflowTagsProps<T>) => {\n const {\n tags = [],\n randomColors,\n getTagName: getTagNameInProps,\n getTagKey,\n renderTag: renderTagInProps,\n tagProps,\n ellipsisTagProps,\n className,\n ...restProps\n } = props;\n const { token } = theme.useToken();\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('re-float-drawer');\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n\n const colors = useMemo(\n () => PresetColors.filter((c) => !['lime', 'yellow', 'magenta'].includes(c)).map((color) => token[`${color}-3`]),\n [token]\n );\n const getTagName = useCallback(\n (tag: T) => {\n return getTagNameInProps ? getTagNameInProps(tag) : tag.name;\n },\n [getTagNameInProps]\n );\n const renderTag = (item: T) => {\n const customProps = renderTagInProps?.(item, tags);\n return (\n <Tag\n {...tagProps}\n color={randomColors ? colors[random(0, colors.length - 1)] : (item.color ?? 'default')}\n {...customProps}\n >\n {getTagName(item)}\n </Tag>\n );\n };\n\n return wrapCSSVar(\n <Overflow<T>\n className={classNames(hashId, cssVarCls, prefixCls, className)}\n data={tags}\n maxCount=\"responsive\"\n renderItem={renderTag}\n renderRest={(omittedItems) => (\n <Dropdown\n menu={{\n items: omittedItems.map((tag) => ({\n type: 'item',\n key: getTagKey ? getTagKey(tag) : (tag.id ?? getTagName(tag)),\n label: getTagName(tag),\n })),\n }}\n >\n <Tag {...ellipsisTagProps}>+ {omittedItems.length}...</Tag>\n </Dropdown>\n )}\n {...restProps}\n />\n );\n};\n\nexport default OverflowTags;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiD;AAEjD,kBAAqD;AACrD,sBAA6B;AAC7B,wBAAuB;AAEvB,yBAAqB;AACrB,kBAAuB;AACvB,mBAAqB;AAoDrB,IAAM,eAAe,CAAgC,UAAgC;AACnF,QAAM;AAAA,IACJ,OAAO,CAAC;AAAA,IACR;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,MAAM,IAAI,kBAAM,SAAS;AACjC,QAAM,EAAE,aAAa,QAAI,yBAAW,2BAAe,aAAa;AAChE,QAAM,YAAY,aAAa,iBAAiB;AAChD,QAAM,CAAC,YAAY,QAAQ,SAAS,QAAI,aAAAA,SAAS,SAAS;AAE1D,QAAM,aAAS;AAAA,IACb,MAAM,6BAAa,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,UAAU,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,MAAM,GAAG,SAAS,CAAC;AAAA,IAC/G,CAAC,KAAK;AAAA,EACR;AACA,QAAM,iBAAa;AAAA,IACjB,CAAC,QAAW;AACV,aAAO,oBAAoB,kBAAkB,GAAG,IAAI,IAAI;AAAA,IAC1D;AAAA,IACA,CAAC,iBAAiB;AAAA,EACpB;AACA,QAAM,YAAY,CAAC,SAAY;AAC7B,UAAM,cAAc,qDAAmB,MAAM;AAC7C,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,OAAO,eAAe,WAAO,oBAAO,GAAG,OAAO,SAAS,CAAC,CAAC,IAAK,KAAK,SAAS;AAAA,QAC3E,GAAG;AAAA;AAAA,MAEH,WAAW,IAAI;AAAA,IAClB;AAAA,EAEJ;AAEA,SAAO;AAAA,IACL;AAAA,MAAC,mBAAAC;AAAA,MAAA;AAAA,QACC,eAAW,kBAAAC,SAAW,QAAQ,WAAW,WAAW,SAAS;AAAA,QAC7D,MAAM;AAAA,QACN,UAAS;AAAA,QACT,YAAY;AAAA,QACZ,YAAY,CAAC,iBACX;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,cACJ,OAAO,aAAa,IAAI,CAAC,SAAS;AAAA,gBAChC,MAAM;AAAA,gBACN,KAAK,YAAY,UAAU,GAAG,IAAK,IAAI,MAAM,WAAW,GAAG;AAAA,gBAC3D,OAAO,WAAW,GAAG;AAAA,cACvB,EAAE;AAAA,YACJ;AAAA;AAAA,UAEA,oCAAC,mBAAK,GAAG,oBAAkB,MAAG,aAAa,QAAO,KAAG;AAAA,QACvD;AAAA,QAED,GAAG;AAAA;AAAA,IACN;AAAA,EACF;AACF;AAEA,IAAO,uBAAQ;",
6
+ "names": ["useStyle", "Overflow", "classNames"]
7
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: (prefixCls: string, rootCls?: string | undefined) => readonly [(node: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>, string, string];
3
+ export default _default;
@@ -0,0 +1,38 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/OverflowTags/style/index.ts
20
+ var style_exports = {};
21
+ __export(style_exports, {
22
+ default: () => style_default
23
+ });
24
+ module.exports = __toCommonJS(style_exports);
25
+ var import_internal = require("antd/es/theme/internal");
26
+ var genStyle = (token) => {
27
+ const { componentCls } = token;
28
+ return {
29
+ [componentCls]: {
30
+ display: "flex",
31
+ flexWrap: "wrap",
32
+ maxWidth: "100%",
33
+ position: "relative"
34
+ }
35
+ };
36
+ };
37
+ var style_default = (0, import_internal.genStyleHooks)("re-overflow-tags", genStyle);
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/components/OverflowTags/style/index.ts"],
4
+ "sourcesContent": ["import { genStyleHooks } from 'antd/es/theme/internal';\nimport type { AliasToken, GenerateStyle } from 'antd/es/theme/internal';\nimport type { CSSObject } from '@ant-design/cssinjs';\nimport type { FullToken } from '@ant-design/cssinjs-utils';\n\ntype OverflowTagsToken = FullToken<{ ''?: object }, AliasToken, ''>;\n\nconst genStyle: GenerateStyle<OverflowTagsToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n display: 'flex',\n flexWrap: 'wrap',\n maxWidth: '100%',\n position: 'relative',\n },\n };\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default genStyleHooks('re-overflow-tags' as any, genStyle);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8B;AAO9B,IAAM,WAA6C,CAAC,UAAqB;AACvE,QAAM,EAAE,aAAa,IAAI;AACzB,SAAO;AAAA,IACL,CAAC,YAAY,GAAG;AAAA,MACd,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAGA,IAAO,oBAAQ,+BAAc,oBAA2B,QAAQ;",
6
+ "names": []
7
+ }
@@ -13,3 +13,5 @@ export { default as FloatDrawer } from './FloatDrawer';
13
13
  export type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';
14
14
  export { withDefaultModalActionProps, withModalAction } from './ModalAction';
15
15
  export { default as ModalAction } from './ModalAction';
16
+ export type { OverflowTagsProps } from './OverflowTags';
17
+ export { default as OverflowTags } from './OverflowTags';
@@ -35,6 +35,7 @@ __export(components_exports, {
35
35
  DeleteConfirmAction: () => import_DeleteConfirmAction.default,
36
36
  FloatDrawer: () => import_FloatDrawer.default,
37
37
  ModalAction: () => import_ModalAction2.default,
38
+ OverflowTags: () => import_OverflowTags.default,
38
39
  ReactEasyContext: () => import_context.default,
39
40
  withDefaultConfirmActionProps: () => import_ConfirmAction.withDefaultConfirmActionProps,
40
41
  withDefaultModalActionProps: () => import_ModalAction.withDefaultModalActionProps,
@@ -50,6 +51,7 @@ var import_DeleteConfirmAction = __toESM(require("./DeleteConfirmAction"));
50
51
  var import_FloatDrawer = __toESM(require("./FloatDrawer"));
51
52
  var import_ModalAction = require("./ModalAction");
52
53
  var import_ModalAction2 = __toESM(require("./ModalAction"));
54
+ var import_OverflowTags = __toESM(require("./OverflowTags"));
53
55
  // Annotate the CommonJS export names for ESM import in node:
54
56
  0 && (module.exports = {
55
57
  BreakLines,
@@ -58,6 +60,7 @@ var import_ModalAction2 = __toESM(require("./ModalAction"));
58
60
  DeleteConfirmAction,
59
61
  FloatDrawer,
60
62
  ModalAction,
63
+ OverflowTags,
61
64
  ReactEasyContext,
62
65
  withDefaultConfirmActionProps,
63
66
  withDefaultModalActionProps,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/index.tsx"],
4
- "sourcesContent": ["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\n// export * from '../utils';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AAGtC,4BAA0C;AAE1C,qBAA4C;AAG5C,2BAA8C;AAC9C,IAAAA,wBAAyC;AAGzC,iCAA+C;AAG/C,yBAAuC;AAGvC,yBAA6D;AAC7D,IAAAC,sBAAuC;",
4
+ "sourcesContent": ["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\nexport type { OverflowTagsProps } from './OverflowTags';\nexport { default as OverflowTags } from './OverflowTags';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AAGtC,4BAA0C;AAE1C,qBAA4C;AAG5C,2BAA8C;AAC9C,IAAAA,wBAAyC;AAGzC,iCAA+C;AAG/C,yBAAuC;AAGvC,yBAA6D;AAC7D,IAAAC,sBAAuC;AAGvC,0BAAwC;",
6
6
  "names": ["import_ConfirmAction", "import_ModalAction"]
7
7
  }
@@ -1 +1,2 @@
1
1
  export * from './color';
2
+ export * from './math';
@@ -17,8 +17,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  var utils_exports = {};
18
18
  module.exports = __toCommonJS(utils_exports);
19
19
  __reExport(utils_exports, require("./color"), module.exports);
20
+ __reExport(utils_exports, require("./math"), module.exports);
20
21
  // Annotate the CommonJS export names for ESM import in node:
21
22
  0 && (module.exports = {
22
- ...require("./color")
23
+ ...require("./color"),
24
+ ...require("./math")
23
25
  });
24
26
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/index.ts"],
4
- "sourcesContent": ["export * from './color';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,oBAAd;",
4
+ "sourcesContent": ["export * from './color';\nexport * from './math';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,oBAAd;AACA,0BAAc,mBADd;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * **EN**: Generate a random number within a specified range (inclusive on both ends)
3
+ *
4
+ * **CN**: 生成指定范围(两端包含)内的随机数
5
+ *
6
+ * @param min The minimum value (inclusive) | 最小值(包含)
7
+ * @param max The maximum value (inclusive) | 最大值(包含)
8
+ *
9
+ * @returns The generated random number | 生成的随机数
10
+ */
11
+ export declare function random(min: number, max: number): number;
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/utils/math.ts
20
+ var math_exports = {};
21
+ __export(math_exports, {
22
+ random: () => random
23
+ });
24
+ module.exports = __toCommonJS(math_exports);
25
+ function random(min, max) {
26
+ const array = new Uint32Array(1);
27
+ globalThis.crypto.getRandomValues(array);
28
+ const randomValue = array[0] / (4294967295 + 1);
29
+ return Math.floor(randomValue * (max - min + 1)) + min;
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ random
34
+ });
35
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/math.ts"],
4
+ "sourcesContent": ["/**\n * **EN**: Generate a random number within a specified range (inclusive on both ends)\n *\n * **CN**: 生成指定范围(两端包含)内的随机数\n *\n * @param min The minimum value (inclusive) | 最小值(包含)\n * @param max The maximum value (inclusive) | 最大值(包含)\n *\n * @returns The generated random number | 生成的随机数\n */\nexport function random(min: number, max: number): number {\n const array = new Uint32Array(1);\n globalThis.crypto.getRandomValues(array);\n const randomValue = array[0] / (0xffffffff + 1);\n return Math.floor(randomValue * (max - min + 1)) + min;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,OAAO,KAAa,KAAqB;AACvD,QAAM,QAAQ,IAAI,YAAY,CAAC;AAC/B,aAAW,OAAO,gBAAgB,KAAK;AACvC,QAAM,cAAc,MAAM,CAAC,KAAK,aAAa;AAC7C,SAAO,KAAK,MAAM,eAAe,MAAM,MAAM,EAAE,IAAI;AACrD;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@tiny-codes/react-easy",
3
- "version": "1.0.12",
4
- "description": "Helps you use React and AntDesign more easily",
3
+ "version": "1.1.0",
4
+ "description": "Simplify React and AntDesign development with practical components and hooks",
5
5
  "keywords": [
6
6
  "react",
7
7
  "antd",
8
8
  "ant-design",
9
9
  "hoc",
10
- "hooks"
10
+ "hooks",
11
+ "utils"
11
12
  ],
12
13
  "homepage": "https://github.com/shijistar/react-easy#readme",
13
14
  "bugs": {