@tiny-codes/react-easy 1.4.17 → 1.4.19
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.
- package/CHANGELOG.md +18 -0
- package/es/components/FloatDrawer/index.d.ts +5 -0
- package/es/components/FloatDrawer/index.js +3 -1
- package/es/components/FloatDrawer/index.js.map +1 -1
- package/lib/components/FloatDrawer/index.d.ts +5 -0
- package/lib/components/FloatDrawer/index.js +2 -1
- package/lib/components/FloatDrawer/index.js.map +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## 1.4.19
|
|
6
|
+
|
|
7
|
+
2025-9-29
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- 🛠️ move `i18next` to peerDependencies
|
|
12
|
+
|
|
13
|
+
## 1.4.18
|
|
14
|
+
|
|
15
|
+
2025-9-23
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
#### `FloatDrawer`
|
|
20
|
+
|
|
21
|
+
- ✨ add `destroyOnClose` prop to control whether to destroy the drawer content when closed
|
|
22
|
+
|
|
5
23
|
## 1.4.17
|
|
6
24
|
|
|
7
25
|
2025-9-23
|
|
@@ -60,6 +60,11 @@ export interface FloatDrawerProps {
|
|
|
60
60
|
* - **CN:** 抽屉是否可调整大小, 默认`true`。
|
|
61
61
|
*/
|
|
62
62
|
resizable?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* - **EN:** Whether to destroy the drawer content when closed, default is `false`.
|
|
65
|
+
* - **CN:** 抽屉关闭时是否销毁内容,默认`false`。
|
|
66
|
+
*/
|
|
67
|
+
destroyOnClose?: boolean;
|
|
63
68
|
/**
|
|
64
69
|
* - **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be
|
|
65
70
|
* cached.
|
|
@@ -44,6 +44,8 @@ var FloatDrawer = function FloatDrawer(props) {
|
|
|
44
44
|
showToggle = _props$showToggle === void 0 ? true : _props$showToggle,
|
|
45
45
|
_props$resizable = props.resizable,
|
|
46
46
|
resizable = _props$resizable === void 0 ? true : _props$resizable,
|
|
47
|
+
_props$destroyOnClose = props.destroyOnClose,
|
|
48
|
+
destroyOnClose = _props$destroyOnClose === void 0 ? false : _props$destroyOnClose,
|
|
47
49
|
onOpenChange = props.onOpenChange,
|
|
48
50
|
onResize = props.onResize,
|
|
49
51
|
onClick = props.onClick;
|
|
@@ -179,7 +181,7 @@ var FloatDrawer = function FloatDrawer(props) {
|
|
|
179
181
|
className: classNames("".concat(prefixCls, "-card"), classNamesInProps === null || classNamesInProps === void 0 ? void 0 : classNamesInProps.card),
|
|
180
182
|
style: styles === null || styles === void 0 ? void 0 : styles.card
|
|
181
183
|
}, cardProps), {}, {
|
|
182
|
-
children: children
|
|
184
|
+
children: !destroyOnClose || isOpen ? children : null
|
|
183
185
|
}))
|
|
184
186
|
}), showToggle && /*#__PURE__*/_jsx("div", {
|
|
185
187
|
className: classNames("".concat(prefixCls, "-toggle"), classNamesInProps === null || classNamesInProps === void 0 ? void 0 : classNamesInProps.toggle),
|
|
@@ -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","prefixClsInProps","prefixCls","open","_props$position","position","cardProps","children","className","classNamesInProps","style","styles","cacheKey","defaultSize","_props$minSize","minSize","_props$maxSize","maxSize","Infinity","edgeOffset","_props$showToggle","showToggle","_props$resizable","resizable","onOpenChange","onResize","onClick","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","_useState","_useState2","drawerRef","setDrawerRef","_useState3","localStorage","getItem","Number","_useState4","size","setSize","sizeMap","type","_defineProperty","_useState5","_useState6","isOpen","setIsOpen","_useState7","_useState8","isDragging","setIsDragging","dragStartPos","dragStartSize","classString","concat","closeIcon","openIcon","toggleDrawer","handleResizeStart","e","current","clientY","clientX","preventDefault","handleResize","newSize","setItem","String","handleResizeEnd","undefined","rect","getBoundingClientRect","width","height","window","addEventListener","removeEventListener","_objectSpread","ref","drawer","resizeHandle","onMouseDown","content","bordered","variant","card","toggle","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 prefixCls?: string;\n /**\n * - **EN:** Whether the drawer is open\n * - **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * - **EN:** Position of the drawer\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. If not set, the drawer will adapt to the content size.\n * - **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。不设置时,抽屉会根据内容自适应大小。\n */\n defaultSize?: number;\n /**\n * - **EN:** Minimum size of the drawer\n * - **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * - **EN:** Maximum size of the drawer\n * - **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * - **EN:** Offset of the drawer from the edge of the screen, supports all CSS length units,\n * default is `0`.\n *\n * > The drawer will be hidden outside the parent container's edge, but since the parent container\n * > may have padding or border, the drawer may not be completely hidden. You can adjust the\n * > `edgeOffset` to ensure the drawer is completely hidden outside the parent container.\n *\n * - **CN:** 抽屉距离屏幕边缘的偏移量,支持所有的CSS长度单位, 默认`0`。\n *\n * > 抽屉会隐藏在父容器的外边缘, 但由于父容器可能有padding或border, 导致抽屉不能完全隐藏, 因此可以通过设置 `edgeOffset` 来调整抽屉的偏移量,\n * > 以确保抽屉完全隐藏在父容器之外。\n *\n * @default 0\n */\n edgeOffset?: CSSProperties['width'];\n /**\n * - **EN:** Whether to show the toggle button, default is `true`.\n * - **CN:** 是否显示展开/收起按钮,默认`true`。\n */\n showToggle?: boolean;\n /**\n * - **EN:** Whether the drawer is resizable, default is `true`.\n * - **CN:** 抽屉是否可调整大小, 默认`true`。\n */\n resizable?: boolean;\n /**\n * - **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n * - **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * - **EN:** Custom class name for the root element\n * - **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * - **EN:** Custom class names for specific elements\n * - **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * - **EN:** Class name for the drawer element\n * - **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * - **EN:** Class name for the expand handle\n * - **CN:** 展开手柄的类名\n */\n toggle?: string;\n /**\n * - **EN:** Class name for the resize handle\n * - **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * - **EN:** Class name for the handle icon\n * - **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * - **EN:** Class name for the content area\n * - **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * - **EN:** Class name for the card element\n * - **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * - **EN:** Custom styles for the root element\n * - **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * - **EN:** Custom styles for specific elements\n * - **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * - **EN:** Styles for the drawer element\n * - **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * - **EN:** Styles for the expand handle\n * - **CN:** 展开手柄的样式\n */\n toggle?: CSSProperties;\n /**\n * - **EN:** Styles for the resize handle\n * - **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * - **EN:** Styles for the handle icon\n * - **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * - **EN:** Styles for the content area\n * - **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * - **EN:** Styles for the card element\n * - **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * - **EN:** Custom properties for the card element\n * - **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * - **EN:** Content to be rendered inside the drawer\n * - **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * - **EN:** Callback function when the open state changes\n * - **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * - **EN:** Callback function when the drawer is resized\n * - **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n /**\n * - **EN:** Event handler for click events on the drawer container and its internal elements\n * - **CN:** 点击抽屉容器及内部元素时的事件\n */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n}\n\n/**\n * - **EN:** FloatDrawer component for creating a draggable, resizable drawer\n * - **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n prefixCls: prefixClsInProps,\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize,\n minSize = 0,\n maxSize = +Infinity,\n edgeOffset,\n showToggle = true,\n resizable = true,\n onOpenChange,\n onResize,\n onClick,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('easy-float-drawer', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [drawerRef, setDrawerRef] = useState<HTMLDivElement | null>(null);\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 [isOpen, setIsOpen] = useState<boolean>();\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 && dragStartSize.current) {\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 // Monitor drawer ref, calculate size if not set\n // This is useful for initial rendering when size is not provided\n useEffect(() => {\n if (drawerRef && size === undefined) {\n const rect = drawerRef.getBoundingClientRect();\n setSize(position === 'left' || position === 'right' ? rect.width : rect.height);\n }\n }, [drawerRef, position, size]);\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\n className={classString}\n style={{\n // @ts-expect-error: because of dynamic CSS variables\n '--edge-offset': typeof edgeOffset === 'number' ? `${edgeOffset}px` : edgeOffset,\n ...style,\n }}\n onClick={onClick}\n >\n <div\n ref={setDrawerRef}\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n {resizable && (\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 )}\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 {showToggle && (\n <div\n className={classNames(`${prefixCls}-toggle`, classNamesInProps?.toggle)}\n style={styles?.toggle}\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 )}\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,EAAEC,UAAU,QAAQ,mBAAmB;AACzF,OAAOC,cAAc;AACrB,OAAOC,QAAQ;AAAgB,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAiL/B;AACA;AACA;AACA;AACA,IAAMC,WAAiC,GAAG,SAApCA,WAAiCA,CAAIC,KAAK,EAAK;EACnD,IACaC,gBAAgB,GAmBzBD,KAAK,CAnBPE,SAAS;IACTC,IAAI,GAkBFH,KAAK,CAlBPG,IAAI;IAAAC,eAAA,GAkBFJ,KAAK,CAjBPK,QAAQ;IAARA,QAAQ,GAAAD,eAAA,cAAG,OAAO,GAAAA,eAAA;IAClBE,SAAS,GAgBPN,KAAK,CAhBPM,SAAS;IACTC,QAAQ,GAeNP,KAAK,CAfPO,QAAQ;IACRC,SAAS,GAcPR,KAAK,CAdPQ,SAAS;IACGC,iBAAiB,GAa3BT,KAAK,CAbPZ,UAAU;IACVsB,KAAK,GAYHV,KAAK,CAZPU,KAAK;IACLC,MAAM,GAWJX,KAAK,CAXPW,MAAM;IACNC,QAAQ,GAUNZ,KAAK,CAVPY,QAAQ;IACRC,WAAW,GASTb,KAAK,CATPa,WAAW;IAAAC,cAAA,GASTd,KAAK,CARPe,OAAO;IAAPA,OAAO,GAAAD,cAAA,c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AAM,aAANA,MAAM,uBAANA,MAAM,CAAEmF,UAAW;UAAAvF,QAAA,EAEzB6C,MAAM,GAAGW,QAAQ,GAAGD;QAAS,CAC3B;MAAC,CACH,CACN;IAAA,CACE;EAAC,CACH,CACP,CAAC;AACH,CAAC;AAED,eAAe/D,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","prefixClsInProps","prefixCls","open","_props$position","position","cardProps","children","className","classNamesInProps","style","styles","cacheKey","defaultSize","_props$minSize","minSize","_props$maxSize","maxSize","Infinity","edgeOffset","_props$showToggle","showToggle","_props$resizable","resizable","_props$destroyOnClose","destroyOnClose","onOpenChange","onResize","onClick","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","_useState","_useState2","drawerRef","setDrawerRef","_useState3","localStorage","getItem","Number","_useState4","size","setSize","sizeMap","type","_defineProperty","_useState5","_useState6","isOpen","setIsOpen","_useState7","_useState8","isDragging","setIsDragging","dragStartPos","dragStartSize","classString","concat","closeIcon","openIcon","toggleDrawer","handleResizeStart","e","current","clientY","clientX","preventDefault","handleResize","newSize","setItem","String","handleResizeEnd","undefined","rect","getBoundingClientRect","width","height","window","addEventListener","removeEventListener","_objectSpread","ref","drawer","resizeHandle","onMouseDown","content","bordered","variant","card","toggle","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 prefixCls?: string;\n /**\n * - **EN:** Whether the drawer is open\n * - **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * - **EN:** Position of the drawer\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. If not set, the drawer will adapt to the content size.\n * - **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。不设置时,抽屉会根据内容自适应大小。\n */\n defaultSize?: number;\n /**\n * - **EN:** Minimum size of the drawer\n * - **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * - **EN:** Maximum size of the drawer\n * - **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * - **EN:** Offset of the drawer from the edge of the screen, supports all CSS length units,\n * default is `0`.\n *\n * > The drawer will be hidden outside the parent container's edge, but since the parent container\n * > may have padding or border, the drawer may not be completely hidden. You can adjust the\n * > `edgeOffset` to ensure the drawer is completely hidden outside the parent container.\n *\n * - **CN:** 抽屉距离屏幕边缘的偏移量,支持所有的CSS长度单位, 默认`0`。\n *\n * > 抽屉会隐藏在父容器的外边缘, 但由于父容器可能有padding或border, 导致抽屉不能完全隐藏, 因此可以通过设置 `edgeOffset` 来调整抽屉的偏移量,\n * > 以确保抽屉完全隐藏在父容器之外。\n *\n * @default 0\n */\n edgeOffset?: CSSProperties['width'];\n /**\n * - **EN:** Whether to show the toggle button, default is `true`.\n * - **CN:** 是否显示展开/收起按钮,默认`true`。\n */\n showToggle?: boolean;\n /**\n * - **EN:** Whether the drawer is resizable, default is `true`.\n * - **CN:** 抽屉是否可调整大小, 默认`true`。\n */\n resizable?: boolean;\n /**\n * - **EN:** Whether to destroy the drawer content when closed, default is `false`.\n * - **CN:** 抽屉关闭时是否销毁内容,默认`false`。\n */\n destroyOnClose?: boolean;\n /**\n * - **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n * - **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * - **EN:** Custom class name for the root element\n * - **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * - **EN:** Custom class names for specific elements\n * - **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * - **EN:** Class name for the drawer element\n * - **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * - **EN:** Class name for the expand handle\n * - **CN:** 展开手柄的类名\n */\n toggle?: string;\n /**\n * - **EN:** Class name for the resize handle\n * - **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * - **EN:** Class name for the handle icon\n * - **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * - **EN:** Class name for the content area\n * - **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * - **EN:** Class name for the card element\n * - **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * - **EN:** Custom styles for the root element\n * - **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * - **EN:** Custom styles for specific elements\n * - **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * - **EN:** Styles for the drawer element\n * - **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * - **EN:** Styles for the expand handle\n * - **CN:** 展开手柄的样式\n */\n toggle?: CSSProperties;\n /**\n * - **EN:** Styles for the resize handle\n * - **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * - **EN:** Styles for the handle icon\n * - **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * - **EN:** Styles for the content area\n * - **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * - **EN:** Styles for the card element\n * - **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * - **EN:** Custom properties for the card element\n * - **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * - **EN:** Content to be rendered inside the drawer\n * - **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * - **EN:** Callback function when the open state changes\n * - **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * - **EN:** Callback function when the drawer is resized\n * - **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n /**\n * - **EN:** Event handler for click events on the drawer container and its internal elements\n * - **CN:** 点击抽屉容器及内部元素时的事件\n */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n}\n\n/**\n * - **EN:** FloatDrawer component for creating a draggable, resizable drawer\n * - **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n prefixCls: prefixClsInProps,\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize,\n minSize = 0,\n maxSize = +Infinity,\n edgeOffset,\n showToggle = true,\n resizable = true,\n destroyOnClose = false,\n onOpenChange,\n onResize,\n onClick,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('easy-float-drawer', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [drawerRef, setDrawerRef] = useState<HTMLDivElement | null>(null);\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 [isOpen, setIsOpen] = useState<boolean>();\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 && dragStartSize.current) {\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 // Monitor drawer ref, calculate size if not set\n // This is useful for initial rendering when size is not provided\n useEffect(() => {\n if (drawerRef && size === undefined) {\n const rect = drawerRef.getBoundingClientRect();\n setSize(position === 'left' || position === 'right' ? rect.width : rect.height);\n }\n }, [drawerRef, position, size]);\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\n className={classString}\n style={{\n // @ts-expect-error: because of dynamic CSS variables\n '--edge-offset': typeof edgeOffset === 'number' ? `${edgeOffset}px` : edgeOffset,\n ...style,\n }}\n onClick={onClick}\n >\n <div\n ref={setDrawerRef}\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n {resizable && (\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 )}\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 {!destroyOnClose || isOpen ? children : null}\n </Card>\n </div>\n {showToggle && (\n <div\n className={classNames(`${prefixCls}-toggle`, classNamesInProps?.toggle)}\n style={styles?.toggle}\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 )}\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,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是否可调整大小, 默认`true`。
|
|
61
61
|
*/
|
|
62
62
|
resizable?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* - **EN:** Whether to destroy the drawer content when closed, default is `false`.
|
|
65
|
+
* - **CN:** 抽屉关闭时是否销毁内容,默认`false`。
|
|
66
|
+
*/
|
|
67
|
+
destroyOnClose?: boolean;
|
|
63
68
|
/**
|
|
64
69
|
* - **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be
|
|
65
70
|
* cached.
|
|
@@ -56,6 +56,7 @@ var FloatDrawer = (props) => {
|
|
|
56
56
|
edgeOffset,
|
|
57
57
|
showToggle = true,
|
|
58
58
|
resizable = true,
|
|
59
|
+
destroyOnClose = false,
|
|
59
60
|
onOpenChange,
|
|
60
61
|
onResize,
|
|
61
62
|
onClick
|
|
@@ -194,7 +195,7 @@ var FloatDrawer = (props) => {
|
|
|
194
195
|
style: styles == null ? void 0 : styles.card,
|
|
195
196
|
...cardProps
|
|
196
197
|
},
|
|
197
|
-
children
|
|
198
|
+
!destroyOnClose || isOpen ? children : null
|
|
198
199
|
)),
|
|
199
200
|
showToggle && /* @__PURE__ */ React.createElement(
|
|
200
201
|
"div",
|
|
@@ -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 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 prefixCls?: string;\n /**\n * - **EN:** Whether the drawer is open\n * - **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * - **EN:** Position of the drawer\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. If not set, the drawer will adapt to the content size.\n * - **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。不设置时,抽屉会根据内容自适应大小。\n */\n defaultSize?: number;\n /**\n * - **EN:** Minimum size of the drawer\n * - **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * - **EN:** Maximum size of the drawer\n * - **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * - **EN:** Offset of the drawer from the edge of the screen, supports all CSS length units,\n * default is `0`.\n *\n * > The drawer will be hidden outside the parent container's edge, but since the parent container\n * > may have padding or border, the drawer may not be completely hidden. You can adjust the\n * > `edgeOffset` to ensure the drawer is completely hidden outside the parent container.\n *\n * - **CN:** 抽屉距离屏幕边缘的偏移量,支持所有的CSS长度单位, 默认`0`。\n *\n * > 抽屉会隐藏在父容器的外边缘, 但由于父容器可能有padding或border, 导致抽屉不能完全隐藏, 因此可以通过设置 `edgeOffset` 来调整抽屉的偏移量,\n * > 以确保抽屉完全隐藏在父容器之外。\n *\n * @default 0\n */\n edgeOffset?: CSSProperties['width'];\n /**\n * - **EN:** Whether to show the toggle button, default is `true`.\n * - **CN:** 是否显示展开/收起按钮,默认`true`。\n */\n showToggle?: boolean;\n /**\n * - **EN:** Whether the drawer is resizable, default is `true`.\n * - **CN:** 抽屉是否可调整大小, 默认`true`。\n */\n resizable?: boolean;\n /**\n * - **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n * - **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * - **EN:** Custom class name for the root element\n * - **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * - **EN:** Custom class names for specific elements\n * - **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * - **EN:** Class name for the drawer element\n * - **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * - **EN:** Class name for the expand handle\n * - **CN:** 展开手柄的类名\n */\n toggle?: string;\n /**\n * - **EN:** Class name for the resize handle\n * - **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * - **EN:** Class name for the handle icon\n * - **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * - **EN:** Class name for the content area\n * - **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * - **EN:** Class name for the card element\n * - **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * - **EN:** Custom styles for the root element\n * - **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * - **EN:** Custom styles for specific elements\n * - **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * - **EN:** Styles for the drawer element\n * - **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * - **EN:** Styles for the expand handle\n * - **CN:** 展开手柄的样式\n */\n toggle?: CSSProperties;\n /**\n * - **EN:** Styles for the resize handle\n * - **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * - **EN:** Styles for the handle icon\n * - **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * - **EN:** Styles for the content area\n * - **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * - **EN:** Styles for the card element\n * - **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * - **EN:** Custom properties for the card element\n * - **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * - **EN:** Content to be rendered inside the drawer\n * - **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * - **EN:** Callback function when the open state changes\n * - **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * - **EN:** Callback function when the drawer is resized\n * - **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n /**\n * - **EN:** Event handler for click events on the drawer container and its internal elements\n * - **CN:** 点击抽屉容器及内部元素时的事件\n */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n}\n\n/**\n * - **EN:** FloatDrawer component for creating a draggable, resizable drawer\n * - **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n prefixCls: prefixClsInProps,\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize,\n minSize = 0,\n maxSize = +Infinity,\n edgeOffset,\n showToggle = true,\n resizable = true,\n onOpenChange,\n onResize,\n onClick,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('easy-float-drawer', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [drawerRef, setDrawerRef] = useState<HTMLDivElement | null>(null);\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 [isOpen, setIsOpen] = useState<boolean>();\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 && dragStartSize.current) {\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 // Monitor drawer ref, calculate size if not set\n // This is useful for initial rendering when size is not provided\n useEffect(() => {\n if (drawerRef && size === undefined) {\n const rect = drawerRef.getBoundingClientRect();\n setSize(position === 'left' || position === 'right' ? rect.width : rect.height);\n }\n }, [drawerRef, position, size]);\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\n className={classString}\n style={{\n // @ts-expect-error: because of dynamic CSS variables\n '--edge-offset': typeof edgeOffset === 'number' ? `${edgeOffset}px` : edgeOffset,\n ...style,\n }}\n onClick={onClick}\n >\n <div\n ref={setDrawerRef}\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n {resizable && (\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 )}\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 {showToggle && (\n <div\n className={classNames(`${prefixCls}-toggle`, classNamesInProps?.toggle)}\n style={styles?.toggle}\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 )}\n </div>\n </div>\n );\n};\n\nexport default FloatDrawer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiE;AAEjE,kBAAqC;AACrC,wBAAuB;AACvB,mBAAsE;AACtE,4BAA2B;AAC3B,mBAAqB;
|
|
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 prefixCls?: string;\n /**\n * - **EN:** Whether the drawer is open\n * - **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * - **EN:** Position of the drawer\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. If not set, the drawer will adapt to the content size.\n * - **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。不设置时,抽屉会根据内容自适应大小。\n */\n defaultSize?: number;\n /**\n * - **EN:** Minimum size of the drawer\n * - **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * - **EN:** Maximum size of the drawer\n * - **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * - **EN:** Offset of the drawer from the edge of the screen, supports all CSS length units,\n * default is `0`.\n *\n * > The drawer will be hidden outside the parent container's edge, but since the parent container\n * > may have padding or border, the drawer may not be completely hidden. You can adjust the\n * > `edgeOffset` to ensure the drawer is completely hidden outside the parent container.\n *\n * - **CN:** 抽屉距离屏幕边缘的偏移量,支持所有的CSS长度单位, 默认`0`。\n *\n * > 抽屉会隐藏在父容器的外边缘, 但由于父容器可能有padding或border, 导致抽屉不能完全隐藏, 因此可以通过设置 `edgeOffset` 来调整抽屉的偏移量,\n * > 以确保抽屉完全隐藏在父容器之外。\n *\n * @default 0\n */\n edgeOffset?: CSSProperties['width'];\n /**\n * - **EN:** Whether to show the toggle button, default is `true`.\n * - **CN:** 是否显示展开/收起按钮,默认`true`。\n */\n showToggle?: boolean;\n /**\n * - **EN:** Whether the drawer is resizable, default is `true`.\n * - **CN:** 抽屉是否可调整大小, 默认`true`。\n */\n resizable?: boolean;\n /**\n * - **EN:** Whether to destroy the drawer content when closed, default is `false`.\n * - **CN:** 抽屉关闭时是否销毁内容,默认`false`。\n */\n destroyOnClose?: boolean;\n /**\n * - **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n * - **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * - **EN:** Custom class name for the root element\n * - **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * - **EN:** Custom class names for specific elements\n * - **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * - **EN:** Class name for the drawer element\n * - **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * - **EN:** Class name for the expand handle\n * - **CN:** 展开手柄的类名\n */\n toggle?: string;\n /**\n * - **EN:** Class name for the resize handle\n * - **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * - **EN:** Class name for the handle icon\n * - **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * - **EN:** Class name for the content area\n * - **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * - **EN:** Class name for the card element\n * - **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * - **EN:** Custom styles for the root element\n * - **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * - **EN:** Custom styles for specific elements\n * - **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * - **EN:** Styles for the drawer element\n * - **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * - **EN:** Styles for the expand handle\n * - **CN:** 展开手柄的样式\n */\n toggle?: CSSProperties;\n /**\n * - **EN:** Styles for the resize handle\n * - **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * - **EN:** Styles for the handle icon\n * - **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * - **EN:** Styles for the content area\n * - **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * - **EN:** Styles for the card element\n * - **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * - **EN:** Custom properties for the card element\n * - **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * - **EN:** Content to be rendered inside the drawer\n * - **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * - **EN:** Callback function when the open state changes\n * - **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * - **EN:** Callback function when the drawer is resized\n * - **CN:** 抽屉调整大小时的回调函数\n */\n onResize?: (size: number) => void;\n /**\n * - **EN:** Event handler for click events on the drawer container and its internal elements\n * - **CN:** 点击抽屉容器及内部元素时的事件\n */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n}\n\n/**\n * - **EN:** FloatDrawer component for creating a draggable, resizable drawer\n * - **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n prefixCls: prefixClsInProps,\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize,\n minSize = 0,\n maxSize = +Infinity,\n edgeOffset,\n showToggle = true,\n resizable = true,\n destroyOnClose = false,\n onOpenChange,\n onResize,\n onClick,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('easy-float-drawer', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [drawerRef, setDrawerRef] = useState<HTMLDivElement | null>(null);\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 [isOpen, setIsOpen] = useState<boolean>();\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 && dragStartSize.current) {\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 // Monitor drawer ref, calculate size if not set\n // This is useful for initial rendering when size is not provided\n useEffect(() => {\n if (drawerRef && size === undefined) {\n const rect = drawerRef.getBoundingClientRect();\n setSize(position === 'left' || position === 'right' ? rect.width : rect.height);\n }\n }, [drawerRef, position, size]);\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\n className={classString}\n style={{\n // @ts-expect-error: because of dynamic CSS variables\n '--edge-offset': typeof edgeOffset === 'number' ? `${edgeOffset}px` : edgeOffset,\n ...style,\n }}\n onClick={onClick}\n >\n <div\n ref={setDrawerRef}\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n {resizable && (\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 )}\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 {!destroyOnClose || isOpen ? children : null}\n </Card>\n </div>\n {showToggle && (\n <div\n className={classNames(`${prefixCls}-toggle`, classNamesInProps?.toggle)}\n style={styles?.toggle}\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 )}\n </div>\n </div>\n );\n};\n\nexport default FloatDrawer;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiE;AAEjE,kBAAqC;AACrC,wBAAuB;AACvB,mBAAsE;AACtE,4BAA2B;AAC3B,mBAAqB;AA0LrB,IAAM,cAAoC,CAAC,UA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AAAA,QAEF,oCAAC,SAAI,eAAW,kBAAAA,SAAW,GAAG,qBAAqB,uDAAmB,OAAO,GAAG,OAAO,iCAAQ,WAC7F;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,SAAQ;AAAA,YACR,eAAW,kBAAAA,SAAW,GAAG,kBAAkB,uDAAmB,IAAI;AAAA,YAClE,OAAO,iCAAQ;AAAA,YACd,GAAG;AAAA;AAAA,UAEH,CAAC,kBAAkB,SAAS,WAAW;AAAA,QAC1C,CACF;AAAA,QACC,cACC;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,kBAAAA,SAAW,GAAG,oBAAoB,uDAAmB,MAAM;AAAA,YACtE,OAAO,iCAAQ;AAAA,YACf,SAAS;AAAA;AAAA,UAET;AAAA,YAAC;AAAA;AAAA,cACC,eAAW,kBAAAA,SAAW,GAAG,yBAAyB,uDAAmB,UAAU;AAAA,cAC/E,OAAO,iCAAQ;AAAA;AAAA,YAEd,SAAS,WAAW;AAAA,UACvB;AAAA,QACF;AAAA,MAEJ;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["useStyle", "classNames", "useRefFunction"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiny-codes/react-easy",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.19",
|
|
4
4
|
"description": "Simplify React and AntDesign development with practical components and hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
43
43
|
"@stomp/stompjs": "^7.1.1",
|
|
44
44
|
"crypto-js": "^4.2.0",
|
|
45
|
-
"i18next": "^24.2.3",
|
|
46
45
|
"lexical": "^0.33.1",
|
|
47
46
|
"react-contexify": "^6.0.0",
|
|
48
47
|
"sockjs-client": "^1.6.1"
|
|
@@ -70,6 +69,7 @@
|
|
|
70
69
|
},
|
|
71
70
|
"peerDependencies": {
|
|
72
71
|
"antd": ">=5.1.0",
|
|
72
|
+
"i18next": ">=8.4.0",
|
|
73
73
|
"react": ">=16.8.0",
|
|
74
74
|
"react-is": ">=16.8.0"
|
|
75
75
|
}
|