@tiny-codes/react-easy 1.7.5 → 1.7.7

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 (138) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/es/components/Animation/Pulse/index.d.ts +18 -2
  3. package/es/components/Animation/Pulse/index.js +1 -1
  4. package/es/components/Animation/Pulse/index.js.map +1 -1
  5. package/es/components/BreakLines/index.d.ts +7 -7
  6. package/es/components/BreakLines/index.js.map +1 -1
  7. package/es/components/ColumnSetting/index.d.ts +7 -2
  8. package/es/components/ColumnSetting/index.js +29 -17
  9. package/es/components/ColumnSetting/index.js.map +1 -1
  10. package/es/components/ConfigProvider/context.d.ts +38 -0
  11. package/es/components/ConfigProvider/context.js +2 -1
  12. package/es/components/ConfigProvider/context.js.map +1 -1
  13. package/es/components/ConfigProvider/index.d.ts +22 -4
  14. package/es/components/ConfigProvider/index.js +22 -10
  15. package/es/components/ConfigProvider/index.js.map +1 -1
  16. package/es/components/ConfigProvider/style/index.js +1 -1
  17. package/es/components/ConfigProvider/style/index.js.map +1 -1
  18. package/es/components/ContextMenu/index.d.ts +16 -0
  19. package/es/components/ContextMenu/index.js +3 -2
  20. package/es/components/ContextMenu/index.js.map +1 -1
  21. package/es/components/ContextMenu/style/index.js.map +1 -1
  22. package/es/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
  23. package/es/components/EditableText/form.d.ts +4 -0
  24. package/es/components/EditableText/form.js.map +1 -1
  25. package/es/components/EditableText/index.d.ts +6 -2
  26. package/es/components/EditableText/index.js +3 -2
  27. package/es/components/EditableText/index.js.map +1 -1
  28. package/es/components/FloatDrawer/index.d.ts +10 -0
  29. package/es/components/FloatDrawer/index.js +3 -2
  30. package/es/components/FloatDrawer/index.js.map +1 -1
  31. package/es/components/FloatDrawer/style/index.js +1 -1
  32. package/es/components/FloatDrawer/style/index.js.map +1 -1
  33. package/es/components/Iconfont/createIconfont.d.ts +28 -0
  34. package/es/components/Iconfont/createIconfont.js +57 -0
  35. package/es/components/Iconfont/createIconfont.js.map +1 -0
  36. package/es/components/Iconfont/index.d.ts +1 -0
  37. package/es/components/Iconfont/index.js +2 -0
  38. package/es/components/Iconfont/index.js.map +1 -0
  39. package/es/components/Loading/index.js +3 -2
  40. package/es/components/Loading/index.js.map +1 -1
  41. package/es/components/Loading/style/index.js +1 -1
  42. package/es/components/Loading/style/index.js.map +1 -1
  43. package/es/components/OverflowTags/index.d.ts +2 -0
  44. package/es/components/OverflowTags/index.js +3 -2
  45. package/es/components/OverflowTags/index.js.map +1 -1
  46. package/es/components/OverflowTags/style/index.js +1 -1
  47. package/es/components/OverflowTags/style/index.js.map +1 -1
  48. package/es/components/index.d.ts +1 -0
  49. package/es/components/index.js +1 -0
  50. package/es/components/index.js.map +1 -1
  51. package/es/hooks/index.d.ts +2 -0
  52. package/es/hooks/index.js +2 -0
  53. package/es/hooks/index.js.map +1 -1
  54. package/es/hooks/style/useSplitter.d.ts +3 -0
  55. package/es/hooks/style/useSplitter.js +40 -0
  56. package/es/hooks/style/useSplitter.js.map +1 -0
  57. package/es/hooks/useLocalStorage.d.ts +16 -0
  58. package/es/hooks/useLocalStorage.js +115 -0
  59. package/es/hooks/useLocalStorage.js.map +1 -0
  60. package/es/hooks/useMovable.js +2 -2
  61. package/es/hooks/useMovable.js.map +1 -1
  62. package/es/hooks/useSplitter.d.ts +52 -9
  63. package/es/hooks/useSplitter.js +69 -39
  64. package/es/hooks/useSplitter.js.map +1 -1
  65. package/es/locales/index.js +1 -1
  66. package/es/locales/index.js.map +1 -1
  67. package/es/utils/math.d.ts +11 -3
  68. package/es/utils/math.js +62 -9
  69. package/es/utils/math.js.map +1 -1
  70. package/lib/components/Animation/Pulse/index.d.ts +18 -2
  71. package/lib/components/Animation/Pulse/index.js +0 -5
  72. package/lib/components/Animation/Pulse/index.js.map +2 -2
  73. package/lib/components/BreakLines/index.d.ts +7 -7
  74. package/lib/components/BreakLines/index.js.map +1 -1
  75. package/lib/components/ColumnSetting/index.d.ts +7 -2
  76. package/lib/components/ColumnSetting/index.js +20 -15
  77. package/lib/components/ColumnSetting/index.js.map +3 -3
  78. package/lib/components/ConfigProvider/context.d.ts +38 -0
  79. package/lib/components/ConfigProvider/context.js +2 -1
  80. package/lib/components/ConfigProvider/context.js.map +2 -2
  81. package/lib/components/ConfigProvider/index.d.ts +22 -4
  82. package/lib/components/ConfigProvider/index.js +17 -6
  83. package/lib/components/ConfigProvider/index.js.map +2 -2
  84. package/lib/components/ConfigProvider/style/index.js +1 -1
  85. package/lib/components/ConfigProvider/style/index.js.map +2 -2
  86. package/lib/components/ContextMenu/index.d.ts +16 -0
  87. package/lib/components/ContextMenu/index.js +2 -1
  88. package/lib/components/ContextMenu/index.js.map +3 -3
  89. package/lib/components/ContextMenu/style/index.js.map +2 -2
  90. package/lib/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
  91. package/lib/components/EditableText/form.d.ts +4 -0
  92. package/lib/components/EditableText/form.js.map +2 -2
  93. package/lib/components/EditableText/index.d.ts +6 -2
  94. package/lib/components/EditableText/index.js +3 -2
  95. package/lib/components/EditableText/index.js.map +3 -3
  96. package/lib/components/FloatDrawer/index.d.ts +10 -0
  97. package/lib/components/FloatDrawer/index.js +3 -2
  98. package/lib/components/FloatDrawer/index.js.map +3 -3
  99. package/lib/components/FloatDrawer/style/index.js +1 -1
  100. package/lib/components/FloatDrawer/style/index.js.map +2 -2
  101. package/lib/components/Iconfont/createIconfont.d.ts +28 -0
  102. package/lib/components/Iconfont/createIconfont.js +65 -0
  103. package/lib/components/Iconfont/createIconfont.js.map +7 -0
  104. package/lib/components/Iconfont/index.d.ts +1 -0
  105. package/lib/components/Iconfont/index.js +24 -0
  106. package/lib/components/Iconfont/index.js.map +7 -0
  107. package/lib/components/Loading/index.js +3 -2
  108. package/lib/components/Loading/index.js.map +3 -3
  109. package/lib/components/Loading/style/index.js +1 -1
  110. package/lib/components/Loading/style/index.js.map +2 -2
  111. package/lib/components/OverflowTags/index.d.ts +2 -0
  112. package/lib/components/OverflowTags/index.js +3 -2
  113. package/lib/components/OverflowTags/index.js.map +3 -3
  114. package/lib/components/OverflowTags/style/index.js +1 -1
  115. package/lib/components/OverflowTags/style/index.js.map +2 -2
  116. package/lib/components/index.d.ts +1 -0
  117. package/lib/components/index.js +3 -1
  118. package/lib/components/index.js.map +2 -2
  119. package/lib/hooks/index.d.ts +2 -0
  120. package/lib/hooks/index.js +5 -0
  121. package/lib/hooks/index.js.map +2 -2
  122. package/lib/hooks/style/useSplitter.d.ts +3 -0
  123. package/lib/hooks/style/useSplitter.js +72 -0
  124. package/lib/hooks/style/useSplitter.js.map +7 -0
  125. package/lib/hooks/useLocalStorage.d.ts +16 -0
  126. package/lib/hooks/useLocalStorage.js +120 -0
  127. package/lib/hooks/useLocalStorage.js.map +7 -0
  128. package/lib/hooks/useMovable.js +2 -2
  129. package/lib/hooks/useMovable.js.map +3 -3
  130. package/lib/hooks/useSplitter.d.ts +52 -9
  131. package/lib/hooks/useSplitter.js +56 -26
  132. package/lib/hooks/useSplitter.js.map +3 -3
  133. package/lib/locales/index.js +1 -1
  134. package/lib/locales/index.js.map +1 -1
  135. package/lib/utils/math.d.ts +11 -3
  136. package/lib/utils/math.js +43 -8
  137. package/lib/utils/math.js.map +3 -3
  138. package/package.json +14 -7
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","ConfigProvider","Spin","classNames","useStyle","jsx","_jsx","Loading","props","prefixClsInProps","prefixCls","_props$mode","mode","rootClassName","rootStyle","children","_props$spinning","spinning","className","spinProps","_objectWithoutProperties","_excluded","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","_objectSpread","concat","style"],"sources":["../../../src/components/Loading/index.tsx"],"sourcesContent":["import { type CSSProperties, type FC, useContext } from 'react';\nimport type { SpinProps } from 'antd';\nimport { ConfigProvider, Spin } from 'antd';\nimport classNames from 'classnames';\nimport useStyle from './style';\n\nexport type LoadingProps = SpinProps & {\n /**\n * - **EN:** When used independently, the positioning method of the animation:\n *\n * - **absolute** - Uses absolute positioning, and the animation will automatically center itself\n * within the parent container.\n * - **flex** - Uses flexbox layout, and the animation will automatically fill the parent container\n * and center itself.\n * - **CN:** 独立使用时,动画的定位方式:\n *\n * - **absolute** - 使用绝对定位,动画会自动居中显示在父容器中。\n * - **flex** - 使用弹性布局,动画会自动填充父容器并居中显示。\n *\n * @default `flex`\n */\n mode?: 'absolute' | 'flex';\n /**\n * - **EN:** When used independently, set the class name for the mask parent container of the\n * animation\n * - **CN:** 在独立使用时,设置动画遮罩父容器的样式类名\n */\n rootClassName?: string;\n /**\n * - **EN:** When used independently, set the style for the mask parent container of the animation\n * - **CN:** 在独立使用时,设置动画遮罩父容器的样式\n */\n rootStyle?: CSSProperties;\n};\n\n/**\n * **EN:** Page loading animation component, providing two usage methods:\n *\n * - **Spin** - When the component wraps children, it wraps the `Spin` component around the children\n * to provide animation effects.\n * - **Independent** - Directly render a loading animation that automatically fills the parent\n * container and is centered.\n *\n * **CN:** 页面加载动画组件,提供两种使用方式:\n *\n * - **Spin** - 组件包裹children时,在children外层包裹 `Spin` 组件,提供动画效果。\n * - **独立使用** - 直接渲染一个加载动画,自动撑满父容器,且显示在居中位置。\n *\n * @example\n * 1. Spin surrounding children\n *\n * ```tsx\n * <PageLoading spinning={loading}>\n * <div>This is content</div>\n * </PageLoading>;\n * ```\n *\n * 2. Independent usage (inline layout)\n *\n * ```tsx\n * <PageLoading />;\n * ```\n *\n * 3. Centered display within container (absolute layout)\n *\n * ```tsx\n * <div className=\"container\" style={{ position: 'relative' }}>\n * <PageLoading absolute />\n * </div>;\n * ```\n */\nconst Loading: FC<LoadingProps> = (props) => {\n const {\n prefixCls: prefixClsInProps,\n mode = 'flex',\n rootClassName,\n rootStyle,\n children,\n spinning = true,\n className,\n ...spinProps\n } = props;\n\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('easy-loading', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n\n return children\n ? // Use spin to wrap children when children is provided,\n // and control the animation display with the spinning prop.\n wrapCSSVar(\n <Spin className={classNames(hashId, cssVarCls, prefixCls, className)} spinning={spinning} {...spinProps}>\n {children}\n </Spin>\n )\n : // Show the loading animation in a wrapper that fills the parent container and centers the animation,\n // and hides the entire component when the animation is off.\n spinning &&\n wrapCSSVar(\n <div\n className={classNames(\n hashId,\n cssVarCls,\n prefixCls,\n rootClassName,\n mode === 'absolute' ? `${prefixCls}-absolute` : `${prefixCls}-flex`\n )}\n style={rootStyle}\n >\n <Spin className={className} spinning={spinning} {...spinProps} />\n </div>\n );\n};\n\nexport default Loading;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAsCA,UAAU,QAAQ,OAAO;AAE/D,SAASC,cAAc,EAAEC,IAAI,QAAQ,MAAM;AAC3C,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ;AAAgB,SAAAC,GAAA,IAAAC,IAAA;AA+B/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,OAAyB,GAAG,SAA5BA,OAAyBA,CAAIC,KAAK,EAAK;EAC3C,IACaC,gBAAgB,GAQzBD,KAAK,CARPE,SAAS;IAAAC,WAAA,GAQPH,KAAK,CAPPI,IAAI;IAAJA,IAAI,GAAAD,WAAA,cAAG,MAAM,GAAAA,WAAA;IACbE,aAAa,GAMXL,KAAK,CANPK,aAAa;IACbC,SAAS,GAKPN,KAAK,CALPM,SAAS;IACTC,QAAQ,GAINP,KAAK,CAJPO,QAAQ;IAAAC,eAAA,GAINR,KAAK,CAHPS,QAAQ;IAARA,QAAQ,GAAAD,eAAA,cAAG,IAAI,GAAAA,eAAA;IACfE,SAAS,GAEPV,KAAK,CAFPU,SAAS;IACNC,SAAS,GAAAC,wBAAA,CACVZ,KAAK,EAAAa,SAAA;EAET,IAAAC,WAAA,GAAyBtB,UAAU,CAACC,cAAc,CAACsB,aAAa,CAAC;IAAzDC,YAAY,GAAAF,WAAA,CAAZE,YAAY;EACpB,IAAMd,SAAS,GAAGc,YAAY,CAAC,cAAc,EAAEf,gBAAgB,CAAC;EAChE,IAAAgB,SAAA,GAAwCrB,QAAQ,CAACM,SAAS,CAAC;IAAAgB,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAApDG,UAAU,GAAAF,UAAA;IAAEG,MAAM,GAAAH,UAAA;IAAEI,SAAS,GAAAJ,UAAA;EAEpC,OAAOX,QAAQ;EACX;EACA;EACAa,UAAU,eACRtB,IAAA,CAACJ,IAAI,EAAA6B,aAAA,CAAAA,aAAA;IAACb,SAAS,EAAEf,UAAU,CAAC0B,MAAM,EAAEC,SAAS,EAAEpB,SAAS,EAAEQ,SAAS,CAAE;IAACD,QAAQ,EAAEA;EAAS,GAAKE,SAAS;IAAAJ,QAAA,EACpGA;EAAQ,EACL,CACR,CAAC;EACD;EACA;EACAE,QAAQ,IACNW,UAAU,eACRtB,IAAA;IACEY,SAAS,EAAEf,UAAU,CACnB0B,MAAM,EACNC,SAAS,EACTpB,SAAS,EACTG,aAAa,EACbD,IAAI,KAAK,UAAU,MAAAoB,MAAA,CAAMtB,SAAS,oBAAAsB,MAAA,CAAiBtB,SAAS,UAC9D,CAAE;IACFuB,KAAK,EAAEnB,SAAU;IAAAC,QAAA,eAEjBT,IAAA,CAACJ,IAAI,EAAA6B,aAAA;MAACb,SAAS,EAAEA,SAAU;MAACD,QAAQ,EAAEA;IAAS,GAAKE,SAAS,CAAG;EAAC,CAC9D,CACP,CAAC;AACT,CAAC;AAED,eAAeZ,OAAO"}
1
+ {"version":3,"names":["useContext","Spin","classNames","ConfigProvider","useStyle","jsx","_jsx","Loading","props","prefixClsInProps","prefixCls","_props$mode","mode","rootClassName","rootStyle","children","_props$spinning","spinning","className","spinProps","_objectWithoutProperties","_excluded","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","_objectSpread","concat","style"],"sources":["../../../src/components/Loading/index.tsx"],"sourcesContent":["import { type CSSProperties, type FC, useContext } from 'react';\nimport type { SpinProps } from 'antd';\nimport { Spin } from 'antd';\nimport classNames from 'classnames';\nimport ConfigProvider from '../ConfigProvider';\nimport useStyle from './style';\n\nexport type LoadingProps = SpinProps & {\n /**\n * - **EN:** When used independently, the positioning method of the animation:\n *\n * - **absolute** - Uses absolute positioning, and the animation will automatically center itself\n * within the parent container.\n * - **flex** - Uses flexbox layout, and the animation will automatically fill the parent container\n * and center itself.\n * - **CN:** 独立使用时,动画的定位方式:\n *\n * - **absolute** - 使用绝对定位,动画会自动居中显示在父容器中。\n * - **flex** - 使用弹性布局,动画会自动填充父容器并居中显示。\n *\n * @default `flex`\n */\n mode?: 'absolute' | 'flex';\n /**\n * - **EN:** When used independently, set the class name for the mask parent container of the\n * animation\n * - **CN:** 在独立使用时,设置动画遮罩父容器的样式类名\n */\n rootClassName?: string;\n /**\n * - **EN:** When used independently, set the style for the mask parent container of the animation\n * - **CN:** 在独立使用时,设置动画遮罩父容器的样式\n */\n rootStyle?: CSSProperties;\n};\n\n/**\n * **EN:** Page loading animation component, providing two usage methods:\n *\n * - **Spin** - When the component wraps children, it wraps the `Spin` component around the children\n * to provide animation effects.\n * - **Independent** - Directly render a loading animation that automatically fills the parent\n * container and is centered.\n *\n * **CN:** 页面加载动画组件,提供两种使用方式:\n *\n * - **Spin** - 组件包裹children时,在children外层包裹 `Spin` 组件,提供动画效果。\n * - **独立使用** - 直接渲染一个加载动画,自动撑满父容器,且显示在居中位置。\n *\n * @example\n * 1. Spin surrounding children\n *\n * ```tsx\n * <PageLoading spinning={loading}>\n * <div>This is content</div>\n * </PageLoading>;\n * ```\n *\n * 2. Independent usage (inline layout)\n *\n * ```tsx\n * <PageLoading />;\n * ```\n *\n * 3. Centered display within container (absolute layout)\n *\n * ```tsx\n * <div className=\"container\" style={{ position: 'relative' }}>\n * <PageLoading absolute />\n * </div>;\n * ```\n */\nconst Loading: FC<LoadingProps> = (props) => {\n const {\n prefixCls: prefixClsInProps,\n mode = 'flex',\n rootClassName,\n rootStyle,\n children,\n spinning = true,\n className,\n ...spinProps\n } = props;\n\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('loading', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n\n return children\n ? // Use spin to wrap children when children is provided,\n // and control the animation display with the spinning prop.\n wrapCSSVar(\n <Spin className={classNames(hashId, cssVarCls, prefixCls, className)} spinning={spinning} {...spinProps}>\n {children}\n </Spin>\n )\n : // Show the loading animation in a wrapper that fills the parent container and centers the animation,\n // and hides the entire component when the animation is off.\n spinning &&\n wrapCSSVar(\n <div\n className={classNames(\n hashId,\n cssVarCls,\n prefixCls,\n rootClassName,\n mode === 'absolute' ? `${prefixCls}-absolute` : `${prefixCls}-flex`\n )}\n style={rootStyle}\n >\n <Spin className={className} spinning={spinning} {...spinProps} />\n </div>\n );\n};\n\nexport default Loading;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAsCA,UAAU,QAAQ,OAAO;AAE/D,SAASC,IAAI,QAAQ,MAAM;AAC3B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,cAAc;AACrB,OAAOC,QAAQ;AAAgB,SAAAC,GAAA,IAAAC,IAAA;AA+B/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,OAAyB,GAAG,SAA5BA,OAAyBA,CAAIC,KAAK,EAAK;EAC3C,IACaC,gB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AA,CAAiBtB,SAAS,UAC9D,CAAE;IACFuB,KAAK,EAAEnB,SAAU;IAAAC,QAAA,eAEjBT,IAAA,CAACL,IAAI,EAAA8B,aAAA;MAACb,SAAS,EAAEA,SAAU;MAACD,QAAQ,EAAEA;IAAS,GAAKE,SAAS,CAAG;EAAC,CAC9D,CACP,CAAC;AACT,CAAC;AAED,eAAeZ,OAAO"}
@@ -23,5 +23,5 @@ var genStyle = function genStyle(token) {
23
23
  lineHeight: 0
24
24
  }));
25
25
  };
26
- export default genStyleHooks('EasyLoading', genStyle);
26
+ export default genStyleHooks('Loading', genStyle);
27
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","display","alignItems","justifyContent","width","height","position","top","left","transform","concat","antCls","lineHeight"],"sources":["../../../../src/components/Loading/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 '&-flex': {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n },\n '&-absolute': {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n [`:global(.${token.antCls}-spin)`]: {\n lineHeight: 0,\n },\n },\n };\n};\n\nexport default genStyleHooks('EasyLoading' as never, 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,EAAAC,eAAA;IACX,QAAQ,EAAE;MACRC,OAAO,EAAE,MAAM;MACfC,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE,QAAQ;MACxBC,KAAK,EAAE,MAAM;MACbC,MAAM,EAAE;IACV,CAAC;IACD,YAAY,EAAE;MACZC,QAAQ,EAAE,UAAU;MACpBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,SAAS,EAAE;IACb;EAAC,eAAAC,MAAA,CACYZ,KAAK,CAACa,MAAM,aAAW;IAClCC,UAAU,EAAE;EACd,CAAC;AAGP,CAAC;AAED,eAAehB,aAAa,CAAC,aAAa,EAAWC,QAAQ,CAAC"}
1
+ {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","display","alignItems","justifyContent","width","height","position","top","left","transform","concat","antCls","lineHeight"],"sources":["../../../../src/components/Loading/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 LoadingToken = FullToken<{ ''?: object }, AliasToken, ''>;\n\nconst genStyle: GenerateStyle<LoadingToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n '&-flex': {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n },\n '&-absolute': {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n [`:global(.${token.antCls}-spin)`]: {\n lineHeight: 0,\n },\n },\n };\n};\n\nexport default genStyleHooks('Loading' as never, genStyle);\n"],"mappings":";;;;AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAOtD,IAAMC,QAAqC,GAAG,SAAxCA,QAAqCA,CAAIC,KAAK,EAAgB;EAClE,IAAQC,YAAY,GAAKD,KAAK,CAAtBC,YAAY;EACpB,OAAAC,eAAA,KACGD,YAAY,EAAAC,eAAA;IACX,QAAQ,EAAE;MACRC,OAAO,EAAE,MAAM;MACfC,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE,QAAQ;MACxBC,KAAK,EAAE,MAAM;MACbC,MAAM,EAAE;IACV,CAAC;IACD,YAAY,EAAE;MACZC,QAAQ,EAAE,UAAU;MACpBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,SAAS,EAAE;IACb;EAAC,eAAAC,MAAA,CACYZ,KAAK,CAACa,MAAM,aAAW;IAClCC,UAAU,EAAE;EACd,CAAC;AAGP,CAAC;AAED,eAAehB,aAAa,CAAC,SAAS,EAAWC,QAAQ,CAAC"}
@@ -55,6 +55,8 @@ export interface OverflowTagsProps<T> extends Omit<OverflowProps<T>, 'renderItem
55
55
  * contain a `color` property to specify the color, and the latter takes precedence.
56
56
  *
57
57
  * **CN**: 是否使用随机颜色,默认`false`。注意,tag对象还可以包含`color`属性来指定颜色,而且后者优先级更高。
58
+ *
59
+ * @default false
58
60
  */
59
61
  randomColors?: boolean;
60
62
  }
@@ -14,11 +14,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
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
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
16
  import { useCallback, useContext, useMemo } from 'react';
17
- import { ConfigProvider, Dropdown, Tag, theme } from 'antd';
17
+ import { Dropdown, Tag, theme } from 'antd';
18
18
  import { PresetColors } from 'antd/es/theme/internal';
19
19
  import classNames from 'classnames';
20
20
  import Overflow from 'rc-overflow';
21
21
  import { random } from "../../utils/math";
22
+ import ConfigProvider from "../ConfigProvider";
22
23
  import useStyle from "./style";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
24
25
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -55,7 +56,7 @@ var OverflowTags = function OverflowTags(props) {
55
56
  token = _theme$useToken.token;
56
57
  var _useContext = useContext(ConfigProvider.ConfigContext),
57
58
  getPrefixCls = _useContext.getPrefixCls;
58
- var prefixCls = getPrefixCls('easy-overflow-tags', prefixClsInProps);
59
+ var prefixCls = getPrefixCls('overflow-tags', prefixClsInProps);
59
60
  var _useStyle = useStyle(prefixCls),
60
61
  _useStyle2 = _slicedToArray(_useStyle, 3),
61
62
  wrapCSSVar = _useStyle2[0],
@@ -1 +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","tagProps","ellipsisTagProps","ellipsisDropdownProps","className","prefixClsInProps","prefixCls","restProps","_objectWithoutProperties","_excluded","_theme$useToken","useToken","token","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","colors","filter","c","includes","map","color","concat","getValue","tag","field","_typeof","record","undefined","_ref","_getValue","toString","renderTag","item","_objectSpread","icon","length","children","data","maxCount","renderItem","renderRest","omittedItems","menu","items","_ref2","_getValue2","type","key","label","allTags"],"sources":["../../../src/components/OverflowTags/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport type { DropdownProps, 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 Omit<OverflowProps<T>, 'renderItem'> {\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.label` or `tag.name`\n *\n * **CN**: 获取标签名称的函数,默认取`tag.label`或`tag.name`\n */\n getTagName?: (tag: T) => ReactNode;\n /**\n * **EN**: Function to get the unique identifier of the tag, default is `tag.value` or `tag.id`\n *\n * **CN**: 获取标签唯一标识的函数,默认取`tag.value`或`tag.id`\n */\n getTagKey?: (tag: T) => React.Key;\n\n /**\n * **EN**: Custom tag rendering function\n *\n * **CN**: 标签渲染函数\n */\n renderTag?: OverflowProps<T>['renderItem'];\n /**\n * **EN**: Custom properties for the tag component\n *\n * **CN**: 自定义标签的组件属性\n */\n tagProps?: TagProps | ((tag: T, options: { tags: T[] }) => 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 | ((tag: T, options: { omittedItems: T[]; allTags: T[] }) => TagProps);\n /**\n * **EN**: Custom properties for the dropdown component when tags are overflowed\n *\n * **CN**: 当标签溢出时,下拉菜单的自定义属性\n */\n ellipsisDropdownProps?: DropdownProps;\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/**\n * - **EN:** Overflow tags component, used to display a collection of tags that can overflow and be\n * truncated. It supports displaying tags in a dropdown when the number of tags exceeds the\n * maximum display count. It also supports custom tag rendering and properties.\n * - **CN:** 溢出标签组件,用于显示一组可以溢出和截断的标签集合。当标签数量超过最大显示数量时,支持在下拉菜单中显示标签。还支持自定义标签渲染和属性。\n *\n * @example\n * <OverflowTags\n * tags={[\n * { value: 1, label: 'Tag1', icon: <Icon1 /> },\n * { value: 2, label: 'Tag2', icon: <Icon2 /> },\n * ]}\n * tagProps={{ color: 'blue' }}\n * ellipsisTagProps={{ color: 'grey' }}\n * />;\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst OverflowTags = <T,>(props: OverflowTagsProps<T>) => {\n const {\n tags = [],\n randomColors,\n getTagName: getTagNameInProps,\n getTagKey,\n tagProps,\n ellipsisTagProps,\n ellipsisDropdownProps,\n className,\n prefixCls: prefixClsInProps,\n ...restProps\n } = props;\n const { token } = theme.useToken();\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('easy-overflow-tags', prefixClsInProps);\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 getValue = useCallback((tag: T | undefined, field: string) => {\n if (tag != null && typeof tag === 'object') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const record = tag as Record<string, any>;\n return record[field];\n }\n return undefined;\n }, []);\n const getTagName = useCallback(\n (tag: T) => {\n return getTagNameInProps\n ? getTagNameInProps(tag)\n : (getValue(tag, 'label') ?? getValue(tag, 'name') ?? tag?.toString());\n },\n [getTagNameInProps, getValue]\n );\n const renderTag = (item: T) => {\n return (\n <Tag\n icon={getValue(item, 'icon')}\n color={randomColors ? colors[random(0, colors.length - 1)] : getValue(item, 'color') || 'default'}\n {...(typeof tagProps === 'function' ? tagProps(item, { tags }) : tagProps)}\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 {...ellipsisDropdownProps}\n menu={{\n items: omittedItems.map((tag) => ({\n type: 'item',\n key: getTagKey ? getTagKey(tag) : (getValue(tag, 'value') ?? getValue(tag, 'id') ?? getTagName(tag)),\n label: getTagName(tag),\n })),\n ...ellipsisDropdownProps?.menu,\n }}\n >\n <Tag\n {...(typeof ellipsisTagProps === 'function'\n ? ellipsisTagProps(omittedItems[0], { omittedItems, allTags: tags })\n : ellipsisTagProps)}\n >\n + {omittedItems.length}...\n </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;AAwD/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAQC,KAA2B,EAAK;EACxD,IAAAC,WAAA,GAWID,KAAK,CAVPE,IAAI;IAAJA,IAAI,GAAAD,WAAA,cAAG,EAAE,GAAAA,WAAA;IACTE,YAAY,GASVH,KAAK,CATPG,YAAY;IACAC,iBAAiB,GAQ3BJ,KAAK,CARPK,UAAU;IACVC,SAAS,GAOPN,KAAK,CAPPM,SAAS;IACTC,QAAQ,GAMNP,KAAK,CANPO,QAAQ;IACRC,gBAAgB,GAKd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C,UAAU,EAAER,SAAU;IACtBS,UAAU,EAAE,SAAAA,WAACC,YAAY;MAAA,oBACvB1D,IAAA,CAACT,QAAQ,EAAA2D,aAAA,CAAAA,aAAA,KACHrC,qBAAqB;QACzB8C,IAAI,EAAAT,aAAA;UACFU,KAAK,EAAEF,YAAY,CAACtB,GAAG,CAAC,UAACI,GAAG;YAAA,IAAAqB,KAAA,EAAAC,UAAA;YAAA,OAAM;cAChCC,IAAI,EAAE,MAAM;cACZC,GAAG,EAAEtD,SAAS,GAAGA,SAAS,CAAC8B,GAAG,CAAC,IAAAqB,KAAA,IAAAC,UAAA,GAAIvB,QAAQ,CAACC,GAAG,EAAE,OAAO,CAAC,cAAAsB,UAAA,cAAAA,UAAA,GAAIvB,QAAQ,CAACC,GAAG,EAAE,IAAI,CAAC,cAAAqB,KAAA,cAAAA,KAAA,GAAIpD,UAAU,CAAC+B,GAAG,CAAE;cACpGyB,KAAK,EAAExD,UAAU,CAAC+B,GAAG;YACvB,CAAC;UAAA,CAAC;QAAC,GACA3B,qBAAqB,aAArBA,qBAAqB,uBAArBA,qBAAqB,CAAE8C,IAAI,CAC9B;QAAAN,QAAA,eAEFnD,KAAA,CAACV,GAAG,EAAA0D,aAAA,CAAAA,aAAA,KACG,OAAOtC,gBAAgB,KAAK,UAAU,GACvCA,gBAAgB,CAAC8C,YAAY,CAAC,CAAC,CAAC,EAAE;UAAEA,YAAY,EAAZA,YAAY;UAAEQ,OAAO,EAAE5D;QAAK,CAAC,CAAC,GAClEM,gBAAgB;UAAAyC,QAAA,GACrB,IACG,EAACK,YAAY,CAACN,MAAM,EAAC,KACzB;QAAA,EAAK;MAAC,EACE,CAAC;IAAA;EACX,GACEnC,SAAS,CACd,CACH,CAAC;AACH,CAAC;AAED,eAAed,YAAY"}
1
+ {"version":3,"names":["useCallback","useContext","useMemo","Dropdown","Tag","theme","PresetColors","classNames","Overflow","random","ConfigProvider","useStyle","jsx","_jsx","jsxs","_jsxs","OverflowTags","props","_props$tags","tags","randomColors","getTagNameInProps","getTagName","getTagKey","tagProps","ellipsisTagProps","ellipsisDropdownProps","className","prefixClsInProps","prefixCls","restProps","_objectWithoutProperties","_excluded","_theme$useToken","useToken","token","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","colors","filter","c","includes","map","color","concat","getValue","tag","field","_typeof","record","undefined","_ref","_getValue","toString","renderTag","item","_objectSpread","icon","length","children","data","maxCount","renderItem","renderRest","omittedItems","menu","items","_ref2","_getValue2","type","key","label","allTags"],"sources":["../../../src/components/OverflowTags/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport type { DropdownProps, TagProps } from 'antd';\nimport { 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 ConfigProvider from '../ConfigProvider';\nimport useStyle from './style';\n\nexport interface OverflowTagsProps<T> extends Omit<OverflowProps<T>, 'renderItem'> {\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.label` or `tag.name`\n *\n * **CN**: 获取标签名称的函数,默认取`tag.label`或`tag.name`\n */\n getTagName?: (tag: T) => ReactNode;\n /**\n * **EN**: Function to get the unique identifier of the tag, default is `tag.value` or `tag.id`\n *\n * **CN**: 获取标签唯一标识的函数,默认取`tag.value`或`tag.id`\n */\n getTagKey?: (tag: T) => React.Key;\n\n /**\n * **EN**: Custom tag rendering function\n *\n * **CN**: 标签渲染函数\n */\n renderTag?: OverflowProps<T>['renderItem'];\n /**\n * **EN**: Custom properties for the tag component\n *\n * **CN**: 自定义标签的组件属性\n */\n tagProps?: TagProps | ((tag: T, options: { tags: T[] }) => 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 | ((tag: T, options: { omittedItems: T[]; allTags: T[] }) => TagProps);\n /**\n * **EN**: Custom properties for the dropdown component when tags are overflowed\n *\n * **CN**: 当标签溢出时,下拉菜单的自定义属性\n */\n ellipsisDropdownProps?: DropdownProps;\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 * @default false\n */\n randomColors?: boolean;\n}\n\n/**\n * - **EN:** Overflow tags component, used to display a collection of tags that can overflow and be\n * truncated. It supports displaying tags in a dropdown when the number of tags exceeds the\n * maximum display count. It also supports custom tag rendering and properties.\n * - **CN:** 溢出标签组件,用于显示一组可以溢出和截断的标签集合。当标签数量超过最大显示数量时,支持在下拉菜单中显示标签。还支持自定义标签渲染和属性。\n *\n * @example\n * <OverflowTags\n * tags={[\n * { value: 1, label: 'Tag1', icon: <Icon1 /> },\n * { value: 2, label: 'Tag2', icon: <Icon2 /> },\n * ]}\n * tagProps={{ color: 'blue' }}\n * ellipsisTagProps={{ color: 'grey' }}\n * />;\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst OverflowTags = <T,>(props: OverflowTagsProps<T>) => {\n const {\n tags = [],\n randomColors,\n getTagName: getTagNameInProps,\n getTagKey,\n tagProps,\n ellipsisTagProps,\n ellipsisDropdownProps,\n className,\n prefixCls: prefixClsInProps,\n ...restProps\n } = props;\n const { token } = theme.useToken();\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('overflow-tags', prefixClsInProps);\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 getValue = useCallback((tag: T | undefined, field: string) => {\n if (tag != null && typeof tag === 'object') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const record = tag as Record<string, any>;\n return record[field];\n }\n return undefined;\n }, []);\n const getTagName = useCallback(\n (tag: T) => {\n return getTagNameInProps\n ? getTagNameInProps(tag)\n : (getValue(tag, 'label') ?? getValue(tag, 'name') ?? tag?.toString());\n },\n [getTagNameInProps, getValue]\n );\n const renderTag = (item: T) => {\n return (\n <Tag\n icon={getValue(item, 'icon')}\n color={randomColors ? colors[random(0, colors.length - 1)] : getValue(item, 'color') || 'default'}\n {...(typeof tagProps === 'function' ? tagProps(item, { tags }) : tagProps)}\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 {...ellipsisDropdownProps}\n menu={{\n items: omittedItems.map((tag) => ({\n type: 'item',\n key: getTagKey ? getTagKey(tag) : (getValue(tag, 'value') ?? getValue(tag, 'id') ?? getTagName(tag)),\n label: getTagName(tag),\n })),\n ...ellipsisDropdownProps?.menu,\n }}\n >\n <Tag\n {...(typeof ellipsisTagProps === 'function'\n ? ellipsisTagProps(omittedItems[0], { omittedItems, allTags: tags })\n : ellipsisTagProps)}\n >\n + {omittedItems.length}...\n </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,QAAQ,EAAEC,GAAG,EAAEC,KAAK,QAAQ,MAAM;AAC3C,SAASC,YAAY,QAAQ,wBAAwB;AACrD,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,QAAQ,MAAM,aAAa;A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,CAC9B;QAAAN,QAAA,eAEFnD,KAAA,CAACX,GAAG,EAAA2D,aAAA,CAAAA,aAAA,KACG,OAAOtC,gBAAgB,KAAK,UAAU,GACvCA,gBAAgB,CAAC8C,YAAY,CAAC,CAAC,CAAC,EAAE;UAAEA,YAAY,EAAZA,YAAY;UAAEQ,OAAO,EAAE5D;QAAK,CAAC,CAAC,GAClEM,gBAAgB;UAAAyC,QAAA,GACrB,IACG,EAACK,YAAY,CAACN,MAAM,EAAC,KACzB;QAAA,EAAK;MAAC,EACE,CAAC;IAAA;EACX,GACEnC,SAAS,CACd,CACH,CAAC;AACH,CAAC;AAED,eAAed,YAAY"}
@@ -14,5 +14,5 @@ var genStyle = function genStyle(token) {
14
14
  position: 'relative'
15
15
  });
16
16
  };
17
- export default genStyleHooks('EasyOverflowTags', genStyle);
17
+ export default genStyleHooks('OverflowTags', genStyle);
18
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","display","flexWrap","alignItems","width","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 alignItems: 'center',\n width: '100%',\n maxWidth: '100%',\n position: 'relative',\n },\n };\n};\n\nexport default genStyleHooks('EasyOverflowTags' as never, 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,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,QAAQ,EAAE,MAAM;IAChBC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;AAED,eAAeV,aAAa,CAAC,kBAAkB,EAAWC,QAAQ,CAAC"}
1
+ {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","display","flexWrap","alignItems","width","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 alignItems: 'center',\n width: '100%',\n maxWidth: '100%',\n position: 'relative',\n },\n };\n};\n\nexport default genStyleHooks('OverflowTags' as never, 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,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,QAAQ,EAAE,MAAM;IAChBC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;AAED,eAAeV,aAAa,CAAC,cAAc,EAAWC,QAAQ,CAAC"}
@@ -28,6 +28,7 @@ export type { FloatDrawerProps } from './FloatDrawer';
28
28
  export { default as FloatDrawer } from './FloatDrawer';
29
29
  export type { FormItemControlProps } from './FormItemControl';
30
30
  export { default as FormItemControl } from './FormItemControl';
31
+ export * from './Iconfont';
31
32
  export type { LoadingProps } from './Loading';
32
33
  export { default as Loading } from './Loading';
33
34
  export type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';
@@ -21,6 +21,7 @@ export * from "./EllipsisTypography/EllipsisLink";
21
21
  export { default as EllipsisLink } from "./EllipsisTypography/EllipsisLink";
22
22
  export { default as FloatDrawer } from "./FloatDrawer";
23
23
  export { default as FormItemControl } from "./FormItemControl";
24
+ export * from "./Iconfont";
24
25
  export { default as Loading } from "./Loading";
25
26
  export { withDefaultModalActionProps, withModalAction } from "./ModalAction";
26
27
  export { default as ModalAction } from "./ModalAction";
@@ -1 +1 @@
1
- {"version":3,"names":["default","BreakLines","ColumnSetting","ConfigProvider","ReactEasyContext","withDefaultConfirmActionProps","withConfirmAction","ConfirmAction","ContextMenu","DeleteConfirmAction","withDeleteConfirmAction","EditableText","EllipsisParagraph","EllipsisText","EllipsisTitle","EllipsisLink","FloatDrawer","FormItemControl","Loading","withDefaultModalActionProps","withModalAction","ModalAction","OverflowTags","PulseAnimation"],"sources":["../../src/components/index.tsx"],"sourcesContent":["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ColumnSettingProps } from './ColumnSetting';\nexport { default as ColumnSetting } from './ColumnSetting';\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, ActionCompConstraint } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as withConfirmAction } from './ConfirmAction/withConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\nexport type {\n ContextMenuProps,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuSubmenu,\n ContextMenuRef,\n} from './ContextMenu';\nexport { default as ContextMenu } from './ContextMenu';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\nexport { default as withDeleteConfirmAction } from './DeleteConfirmAction/withDeleteConfirmAction';\n\nexport type { EditableTextProps } from './EditableText';\nexport { default as EditableText } from './EditableText';\n\nexport * from './EllipsisTypography/EllipsisParagraph';\nexport { default as EllipsisParagraph } from './EllipsisTypography/EllipsisParagraph';\n\nexport * from './EllipsisTypography/EllipsisText';\nexport { default as EllipsisText } from './EllipsisTypography/EllipsisText';\n\nexport * from './EllipsisTypography/EllipsisTitle';\nexport { default as EllipsisTitle } from './EllipsisTypography/EllipsisTitle';\n\nexport * from './EllipsisTypography/EllipsisLink';\nexport { default as EllipsisLink } from './EllipsisTypography/EllipsisLink';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { FormItemControlProps } from './FormItemControl';\nexport { default as FormItemControl } from './FormItemControl';\n\nexport type { LoadingProps } from './Loading';\nexport { default as Loading } from './Loading';\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\nexport type { PulseAnimationProps } from './Animation/Pulse';\nexport { default as PulseAnimation } from './Animation/Pulse';\n"],"mappings":"AACA,SAASA,OAAO,IAAIC,UAAU;AAG9B,SAASD,OAAO,IAAIE,aAAa;AAGjC,SAASF,OAAO,IAAIG,cAAc;AAElC,SAASH,OAAO,IAAII,gBAAgB;AAGpC,SAASC,6BAA6B;AACtC,SAASL,OAAO,IAAIM,iBAAiB;AACrC,SAASN,OAAO,IAAIO,aAAa;AASjC,SAASP,OAAO,IAAIQ,WAAW;;AAE/B;AACA,SAASR,OAAO,IAAIS,mBAAmB;AACvC,SAAST,OAAO,IAAIU,uBAAuB;AAG3C,SAASV,OAAO,IAAIW,YAAY;AAEhC;AACA,SAASX,OAAO,IAAIY,iBAAiB;AAErC;AACA,SAASZ,OAAO,IAAIa,YAAY;AAEhC;AACA,SAASb,OAAO,IAAIc,aAAa;AAEjC;AACA,SAASd,OAAO,IAAIe,YAAY;AAGhC,SAASf,OAAO,IAAIgB,WAAW;AAG/B,SAAShB,OAAO,IAAIiB,eAAe;AAGnC,SAASjB,OAAO,IAAIkB,OAAO;AAG3B,SAASC,2BAA2B,EAAEC,eAAe;AACrD,SAASpB,OAAO,IAAIqB,WAAW;AAG/B,SAASrB,OAAO,IAAIsB,YAAY;AAGhC,SAAStB,OAAO,IAAIuB,cAAc"}
1
+ {"version":3,"names":["default","BreakLines","ColumnSetting","ConfigProvider","ReactEasyContext","withDefaultConfirmActionProps","withConfirmAction","ConfirmAction","ContextMenu","DeleteConfirmAction","withDeleteConfirmAction","EditableText","EllipsisParagraph","EllipsisText","EllipsisTitle","EllipsisLink","FloatDrawer","FormItemControl","Loading","withDefaultModalActionProps","withModalAction","ModalAction","OverflowTags","PulseAnimation"],"sources":["../../src/components/index.tsx"],"sourcesContent":["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ColumnSettingProps } from './ColumnSetting';\nexport { default as ColumnSetting } from './ColumnSetting';\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, ActionCompConstraint } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as withConfirmAction } from './ConfirmAction/withConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\nexport type {\n ContextMenuProps,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuSubmenu,\n ContextMenuRef,\n} from './ContextMenu';\nexport { default as ContextMenu } from './ContextMenu';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\nexport { default as withDeleteConfirmAction } from './DeleteConfirmAction/withDeleteConfirmAction';\n\nexport type { EditableTextProps } from './EditableText';\nexport { default as EditableText } from './EditableText';\n\nexport * from './EllipsisTypography/EllipsisParagraph';\nexport { default as EllipsisParagraph } from './EllipsisTypography/EllipsisParagraph';\n\nexport * from './EllipsisTypography/EllipsisText';\nexport { default as EllipsisText } from './EllipsisTypography/EllipsisText';\n\nexport * from './EllipsisTypography/EllipsisTitle';\nexport { default as EllipsisTitle } from './EllipsisTypography/EllipsisTitle';\n\nexport * from './EllipsisTypography/EllipsisLink';\nexport { default as EllipsisLink } from './EllipsisTypography/EllipsisLink';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { FormItemControlProps } from './FormItemControl';\nexport { default as FormItemControl } from './FormItemControl';\n\nexport * from './Iconfont';\n\nexport type { LoadingProps } from './Loading';\nexport { default as Loading } from './Loading';\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\nexport type { PulseAnimationProps } from './Animation/Pulse';\nexport { default as PulseAnimation } from './Animation/Pulse';\n"],"mappings":"AACA,SAASA,OAAO,IAAIC,UAAU;AAG9B,SAASD,OAAO,IAAIE,aAAa;AAGjC,SAASF,OAAO,IAAIG,cAAc;AAElC,SAASH,OAAO,IAAII,gBAAgB;AAGpC,SAASC,6BAA6B;AACtC,SAASL,OAAO,IAAIM,iBAAiB;AACrC,SAASN,OAAO,IAAIO,aAAa;AASjC,SAASP,OAAO,IAAIQ,WAAW;;AAE/B;AACA,SAASR,OAAO,IAAIS,mBAAmB;AACvC,SAAST,OAAO,IAAIU,uBAAuB;AAG3C,SAASV,OAAO,IAAIW,YAAY;AAEhC;AACA,SAASX,OAAO,IAAIY,iBAAiB;AAErC;AACA,SAASZ,OAAO,IAAIa,YAAY;AAEhC;AACA,SAASb,OAAO,IAAIc,aAAa;AAEjC;AACA,SAASd,OAAO,IAAIe,YAAY;AAGhC,SAASf,OAAO,IAAIgB,WAAW;AAG/B,SAAShB,OAAO,IAAIiB,eAAe;AAEnC;AAGA,SAASjB,OAAO,IAAIkB,OAAO;AAG3B,SAASC,2BAA2B,EAAEC,eAAe;AACrD,SAASpB,OAAO,IAAIqB,WAAW;AAG/B,SAASrB,OAAO,IAAIsB,YAAY;AAGhC,SAAStB,OAAO,IAAIuB,cAAc"}
@@ -1,5 +1,7 @@
1
1
  export { default as useAudioPlayer } from './useAudioPlayer';
2
2
  export { default as useDebounce } from './useDebounce';
3
+ export * from './useLocalStorage';
4
+ export { default as useLocalStorage } from './useLocalStorage';
3
5
  export * from './useMovable';
4
6
  export { default as useMovable } from './useMovable';
5
7
  export * from './useProcessingText';
package/es/hooks/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export { default as useAudioPlayer } from "./useAudioPlayer";
2
2
  export { default as useDebounce } from "./useDebounce";
3
+ export * from "./useLocalStorage";
4
+ export { default as useLocalStorage } from "./useLocalStorage";
3
5
  export * from "./useMovable";
4
6
  export { default as useMovable } from "./useMovable";
5
7
  export * from "./useProcessingText";
@@ -1 +1 @@
1
- {"version":3,"names":["default","useAudioPlayer","useDebounce","useMovable","useProcessingText","useRefValue","useRefFunction","useSplitter","useSSE","useStompSocket","useUserMedia","useValidators","useValidator","useValidatorBuilder"],"sources":["../../src/hooks/index.ts"],"sourcesContent":["export { default as useAudioPlayer } from './useAudioPlayer';\n\nexport { default as useDebounce } from './useDebounce';\n\nexport * from './useMovable';\nexport { default as useMovable } from './useMovable';\n\nexport * from './useProcessingText';\nexport { default as useProcessingText } from './useProcessingText';\n\nexport { default as useRefValue } from './useRefValue';\n\nexport { default as useRefFunction } from './useRefFunction';\n\nexport * from './useSplitter';\nexport { default as useSplitter } from './useSplitter';\n\nexport * from './useSSE';\nexport { default as useSSE } from './useSSE';\n\nexport * from './useStompSocket';\nexport { default as useStompSocket } from './useStompSocket';\n\nexport * from './useUserMedia';\nexport { default as useUserMedia } from './useUserMedia';\n\nexport type { ValidatorRuleMap } from './useValidators';\nexport { default as useValidators } from './useValidators';\n\nexport { default as useValidator } from './useValidator';\n\nexport type { Validator, RuleRegExpFlags, ValidatorRule, BuilderOptions } from './useValidatorBuilder';\nexport { default as useValidatorBuilder } from './useValidatorBuilder';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,cAAc;AAElC,SAASD,OAAO,IAAIE,WAAW;AAE/B;AACA,SAASF,OAAO,IAAIG,UAAU;AAE9B;AACA,SAASH,OAAO,IAAII,iBAAiB;AAErC,SAASJ,OAAO,IAAIK,WAAW;AAE/B,SAASL,OAAO,IAAIM,cAAc;AAElC;AACA,SAASN,OAAO,IAAIO,WAAW;AAE/B;AACA,SAASP,OAAO,IAAIQ,MAAM;AAE1B;AACA,SAASR,OAAO,IAAIS,cAAc;AAElC;AACA,SAAST,OAAO,IAAIU,YAAY;AAGhC,SAASV,OAAO,IAAIW,aAAa;AAEjC,SAASX,OAAO,IAAIY,YAAY;AAGhC,SAASZ,OAAO,IAAIa,mBAAmB"}
1
+ {"version":3,"names":["default","useAudioPlayer","useDebounce","useLocalStorage","useMovable","useProcessingText","useRefValue","useRefFunction","useSplitter","useSSE","useStompSocket","useUserMedia","useValidators","useValidator","useValidatorBuilder"],"sources":["../../src/hooks/index.ts"],"sourcesContent":["export { default as useAudioPlayer } from './useAudioPlayer';\n\nexport { default as useDebounce } from './useDebounce';\n\nexport * from './useLocalStorage';\nexport { default as useLocalStorage } from './useLocalStorage';\n\nexport * from './useMovable';\nexport { default as useMovable } from './useMovable';\n\nexport * from './useProcessingText';\nexport { default as useProcessingText } from './useProcessingText';\n\nexport { default as useRefValue } from './useRefValue';\n\nexport { default as useRefFunction } from './useRefFunction';\n\nexport * from './useSplitter';\nexport { default as useSplitter } from './useSplitter';\n\nexport * from './useSSE';\nexport { default as useSSE } from './useSSE';\n\nexport * from './useStompSocket';\nexport { default as useStompSocket } from './useStompSocket';\n\nexport * from './useUserMedia';\nexport { default as useUserMedia } from './useUserMedia';\n\nexport type { ValidatorRuleMap } from './useValidators';\nexport { default as useValidators } from './useValidators';\n\nexport { default as useValidator } from './useValidator';\n\nexport type { Validator, RuleRegExpFlags, ValidatorRule, BuilderOptions } from './useValidatorBuilder';\nexport { default as useValidatorBuilder } from './useValidatorBuilder';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,cAAc;AAElC,SAASD,OAAO,IAAIE,WAAW;AAE/B;AACA,SAASF,OAAO,IAAIG,eAAe;AAEnC;AACA,SAASH,OAAO,IAAII,UAAU;AAE9B;AACA,SAASJ,OAAO,IAAIK,iBAAiB;AAErC,SAASL,OAAO,IAAIM,WAAW;AAE/B,SAASN,OAAO,IAAIO,cAAc;AAElC;AACA,SAASP,OAAO,IAAIQ,WAAW;AAE/B;AACA,SAASR,OAAO,IAAIS,MAAM;AAE1B;AACA,SAAST,OAAO,IAAIU,cAAc;AAElC;AACA,SAASV,OAAO,IAAIW,YAAY;AAGhC,SAASX,OAAO,IAAIY,aAAa;AAEjC,SAASZ,OAAO,IAAIa,YAAY;AAGhC,SAASb,OAAO,IAAIc,mBAAmB"}
@@ -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,40 @@
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
+ _token$EasySplitter = token.EasySplitter,
9
+ _token$EasySplitter2 = _token$EasySplitter === void 0 ? {} : _token$EasySplitter,
10
+ _token$EasySplitter2$ = _token$EasySplitter2.splitterDefaultWidth,
11
+ splitterDefaultWidth = _token$EasySplitter2$ === void 0 ? 1 : _token$EasySplitter2$;
12
+ return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
13
+ flex: 'none',
14
+ userSelect: 'none'
15
+ }, "&".concat(componentCls, "-vertical"), _defineProperty({
16
+ cursor: 'col-resize',
17
+ padding: '0 4px',
18
+ height: '100%'
19
+ }, "".concat(componentCls, "-handle"), {
20
+ width: "var(--splitter-width, ".concat(splitterDefaultWidth, "px)"),
21
+ height: '100%'
22
+ })), "&".concat(componentCls, "-horizontal"), _defineProperty({
23
+ cursor: 'row-resize',
24
+ padding: '4px 0',
25
+ width: '100%'
26
+ }, "".concat(componentCls, "-handle"), {
27
+ width: '100%',
28
+ height: "var(--splitter-width, ".concat(splitterDefaultWidth, "px)")
29
+ })), '&:hover', _defineProperty({}, "".concat(componentCls, "-handle"), {
30
+ background: token.colorPrimaryActive
31
+ })), "&".concat(componentCls, "-dragging"), _defineProperty({}, "".concat(componentCls, "-handle"), {
32
+ background: token.colorPrimaryHover
33
+ })), "&".concat(componentCls, "-hover"), _defineProperty({}, "".concat(componentCls, "-handle"), {
34
+ background: token.colorPrimaryActive
35
+ })), "".concat(componentCls, "-handle"), {
36
+ background: token.colorBorder
37
+ }));
38
+ };
39
+ export default genStyleHooks('EasySplitter', genStyle);
40
+ //# sourceMappingURL=useSplitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_token$EasySplitter","EasySplitter","_token$EasySplitter2","_token$EasySplitter2$","splitterDefaultWidth","_defineProperty","flex","userSelect","concat","cursor","padding","height","width","background","colorPrimaryActive","colorPrimaryHover","colorBorder"],"sources":["../../../src/hooks/style/useSplitter.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 UseSplitterToken = FullToken<\n {\n EasySplitter?: {\n splitterDefaultWidth?: number;\n };\n },\n AliasToken,\n 'EasySplitter'\n>;\n\nconst genStyle: GenerateStyle<UseSplitterToken> = (token): CSSObject => {\n const { componentCls, EasySplitter: { splitterDefaultWidth = 1 } = {} } = token;\n return {\n [componentCls]: {\n flex: 'none',\n userSelect: 'none',\n [`&${componentCls}-vertical`]: {\n cursor: 'col-resize',\n padding: '0 4px',\n height: '100%',\n [`${componentCls}-handle`]: {\n width: `var(--splitter-width, ${splitterDefaultWidth}px)`,\n height: '100%',\n },\n },\n [`&${componentCls}-horizontal`]: {\n cursor: 'row-resize',\n padding: '4px 0',\n width: '100%',\n [`${componentCls}-handle`]: {\n width: '100%',\n height: `var(--splitter-width, ${splitterDefaultWidth}px)`,\n },\n },\n '&:hover': {\n [`${componentCls}-handle`]: {\n background: token.colorPrimaryActive,\n },\n },\n [`&${componentCls}-dragging`]: {\n [`${componentCls}-handle`]: {\n background: token.colorPrimaryHover,\n },\n },\n [`&${componentCls}-hover`]: {\n [`${componentCls}-handle`]: {\n background: token.colorPrimaryActive,\n },\n },\n [`${componentCls}-handle`]: {\n background: token.colorBorder,\n },\n },\n };\n};\n\nexport default genStyleHooks('EasySplitter' as never, genStyle);\n"],"mappings":";;;;AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAetD,IAAMC,QAAyC,GAAG,SAA5CA,QAAyCA,CAAIC,KAAK,EAAgB;EACtE,IAAQC,YAAY,GAAsDD,KAAK,CAAvEC,YAAY;IAAAC,mBAAA,GAAsDF,KAAK,CAAzDG,YAAY;IAAAC,oBAAA,GAAAF,mBAAA,cAAiC,CAAC,CAAC,GAAAA,mBAAA;IAAAG,qBAAA,GAAAD,oBAAA,CAA/BE,oBAAoB;IAApBA,oBAAoB,GAAAD,qBAAA,cAAG,CAAC,GAAAA,qBAAA;EAC9D,OAAAE,eAAA,KACGN,YAAY,EAAAM,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAAA,eAAA;IACXC,IAAI,EAAE,MAAM;IACZC,UAAU,EAAE;EAAM,OAAAC,MAAA,CACbT,YAAY,gBAAAM,eAAA;IACfI,MAAM,EAAE,YAAY;IACpBC,OAAO,EAAE,OAAO;IAChBC,MAAM,EAAE;EAAM,MAAAH,MAAA,CACVT,YAAY,cAAY;IAC1Ba,KAAK,2BAAAJ,MAAA,CAA2BJ,oBAAoB,QAAK;IACzDO,MAAM,EAAE;EACV,CAAC,QAAAH,MAAA,CAEET,YAAY,kBAAAM,eAAA;IACfI,MAAM,EAAE,YAAY;IACpBC,OAAO,EAAE,OAAO;IAChBE,KAAK,EAAE;EAAM,MAAAJ,MAAA,CACTT,YAAY,cAAY;IAC1Ba,KAAK,EAAE,MAAM;IACbD,MAAM,2BAAAH,MAAA,CAA2BJ,oBAAoB;EACvD,CAAC,IAEH,SAAS,EAAAC,eAAA,QAAAG,MAAA,CACHT,YAAY,cAAY;IAC1Bc,UAAU,EAAEf,KAAK,CAACgB;EACpB,CAAC,QAAAN,MAAA,CAEET,YAAY,gBAAAM,eAAA,QAAAG,MAAA,CACXT,YAAY,cAAY;IAC1Bc,UAAU,EAAEf,KAAK,CAACiB;EACpB,CAAC,QAAAP,MAAA,CAEET,YAAY,aAAAM,eAAA,QAAAG,MAAA,CACXT,YAAY,cAAY;IAC1Bc,UAAU,EAAEf,KAAK,CAACgB;EACpB,CAAC,OAAAN,MAAA,CAECT,YAAY,cAAY;IAC1Bc,UAAU,EAAEf,KAAK,CAACkB;EACpB,CAAC;AAGP,CAAC;AAED,eAAepB,aAAa,CAAC,cAAc,EAAWC,QAAQ,CAAC"}
@@ -0,0 +1,16 @@
1
+ type SetStateAction<T> = T | ((prev: T) => T);
2
+ export interface UseLocalStorageOptions<T> {
3
+ /** When true, listen to `storage` events and keep state in sync across tabs. Defaults to true. */
4
+ sync?: boolean;
5
+ /** Custom serializer. Defaults to JSON.stringify. */
6
+ serialize?: (value: T) => string;
7
+ /** Custom deserializer. Defaults to JSON.parse. */
8
+ deserialize?: (raw: string) => T;
9
+ }
10
+ /**
11
+ * useLocalStorage
12
+ *
13
+ * - If `key` is empty/falsy, behaves like useState and does not touch localStorage.
14
+ */
15
+ declare function useLocalStorage<T>(key?: string | null, initialValue?: T | (() => T), options?: UseLocalStorageOptions<T>): [T, (action: SetStateAction<T>) => void, () => void];
16
+ export default useLocalStorage;
@@ -0,0 +1,115 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
+ function isBrowser() {
9
+ return typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';
10
+ }
11
+ function defaultSerialize(value) {
12
+ return JSON.stringify(value);
13
+ }
14
+ function defaultDeserialize(raw) {
15
+ return JSON.parse(raw);
16
+ }
17
+
18
+ /**
19
+ * useLocalStorage
20
+ *
21
+ * - If `key` is empty/falsy, behaves like useState and does not touch localStorage.
22
+ */
23
+ function useLocalStorage(key, initialValue, options) {
24
+ var _options$sync, _options$serialize, _options$deserialize;
25
+ var storageKey = (key !== null && key !== void 0 ? key : '').trim();
26
+ var enabled = storageKey.length > 0;
27
+ var sync = (_options$sync = options === null || options === void 0 ? void 0 : options.sync) !== null && _options$sync !== void 0 ? _options$sync : true;
28
+ var serialize = (_options$serialize = options === null || options === void 0 ? void 0 : options.serialize) !== null && _options$serialize !== void 0 ? _options$serialize : defaultSerialize;
29
+ var deserialize = (_options$deserialize = options === null || options === void 0 ? void 0 : options.deserialize) !== null && _options$deserialize !== void 0 ? _options$deserialize : defaultDeserialize;
30
+ var initialValueRef = useRef(initialValue);
31
+ initialValueRef.current = initialValue;
32
+ var getInitial = useCallback(function () {
33
+ var fallback = function () {
34
+ var v = initialValueRef.current;
35
+ return typeof v === 'function' ? v() : v;
36
+ }();
37
+ if (!enabled || !isBrowser()) return fallback;
38
+ try {
39
+ var _raw = window.localStorage.getItem(storageKey);
40
+ if (_raw == null) return fallback;
41
+ return deserialize(_raw);
42
+ } catch (_unused) {
43
+ return fallback;
44
+ }
45
+ }, [deserialize, enabled, storageKey]);
46
+ var _useState = useState(getInitial),
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ value = _useState2[0],
49
+ setValueState = _useState2[1];
50
+ var writeStorage = useCallback(function (nextValue) {
51
+ if (!enabled || !isBrowser()) return;
52
+ try {
53
+ window.localStorage.setItem(storageKey, serialize(nextValue));
54
+ } catch (_unused2) {
55
+ // ignore write errors (e.g., quota exceeded, blocked storage)
56
+ }
57
+ }, [enabled, serialize, storageKey]);
58
+ var setValue = useCallback(function (action) {
59
+ setValueState(function (prev) {
60
+ var next = typeof action === 'function' ? action(prev) : action;
61
+ writeStorage(next);
62
+ return next;
63
+ });
64
+ }, [writeStorage]);
65
+ var remove = useCallback(function () {
66
+ // If key is empty/falsy, just reset to initial value.
67
+ var next = function () {
68
+ var v = initialValueRef.current;
69
+ return typeof v === 'function' ? v() : v;
70
+ }();
71
+ setValueState(next);
72
+ if (!enabled || !isBrowser()) return;
73
+ try {
74
+ window.localStorage.removeItem(storageKey);
75
+ } catch (_unused3) {
76
+ // ignore
77
+ }
78
+ }, [enabled, storageKey]);
79
+
80
+ // Keep state updated if key changes.
81
+ useEffect(function () {
82
+ setValueState(getInitial());
83
+ }, [getInitial]);
84
+
85
+ // Cross-tab sync.
86
+ useEffect(function () {
87
+ if (!enabled || !sync || !isBrowser()) return;
88
+ var onStorage = function onStorage(e) {
89
+ if (e.storageArea !== window.localStorage) return;
90
+ if (e.key !== storageKey) return;
91
+
92
+ // When removed, fall back to initial.
93
+ if (e.newValue == null) {
94
+ setValueState(getInitial());
95
+ return;
96
+ }
97
+ try {
98
+ setValueState(deserialize(e.newValue));
99
+ } catch (_unused4) {
100
+ // ignore parse errors
101
+ }
102
+ };
103
+ window.addEventListener('storage', onStorage);
104
+ return function () {
105
+ return window.removeEventListener('storage', onStorage);
106
+ };
107
+ }, [deserialize, enabled, getInitial, storageKey, sync]);
108
+
109
+ // Stable tuple identity.
110
+ return useMemo(function () {
111
+ return [value, setValue, remove];
112
+ }, [remove, setValue, value]);
113
+ }
114
+ export default useLocalStorage;
115
+ //# sourceMappingURL=useLocalStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","isBrowser","window","localStorage","defaultSerialize","value","JSON","stringify","defaultDeserialize","raw","parse","useLocalStorage","key","initialValue","options","_options$sync","_options$serialize","_options$deserialize","storageKey","trim","enabled","length","sync","serialize","deserialize","initialValueRef","current","getInitial","fallback","v","getItem","_unused","_useState","_useState2","_slicedToArray","setValueState","writeStorage","nextValue","setItem","_unused2","setValue","action","prev","next","remove","removeItem","_unused3","onStorage","e","storageArea","newValue","_unused4","addEventListener","removeEventListener"],"sources":["../../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\ntype SetStateAction<T> = T | ((prev: T) => T);\n\nexport interface UseLocalStorageOptions<T> {\n /** When true, listen to `storage` events and keep state in sync across tabs. Defaults to true. */\n sync?: boolean;\n /** Custom serializer. Defaults to JSON.stringify. */\n serialize?: (value: T) => string;\n /** Custom deserializer. Defaults to JSON.parse. */\n deserialize?: (raw: string) => T;\n}\n\nfunction isBrowser() {\n return typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';\n}\n\nfunction defaultSerialize<T>(value: T) {\n return JSON.stringify(value);\n}\n\nfunction defaultDeserialize<T>(raw: string) {\n return JSON.parse(raw) as T;\n}\n\n/**\n * useLocalStorage\n *\n * - If `key` is empty/falsy, behaves like useState and does not touch localStorage.\n */\nfunction useLocalStorage<T>(\n key?: string | null,\n initialValue?: T | (() => T),\n options?: UseLocalStorageOptions<T>\n): [T, (action: SetStateAction<T>) => void, () => void] {\n const storageKey = (key ?? '').trim();\n const enabled = storageKey.length > 0;\n const sync = options?.sync ?? true;\n const serialize = options?.serialize ?? defaultSerialize;\n const deserialize = options?.deserialize ?? defaultDeserialize;\n\n const initialValueRef = useRef(initialValue);\n initialValueRef.current = initialValue;\n\n const getInitial = useCallback((): T => {\n const fallback = (() => {\n const v = initialValueRef.current;\n return (typeof v === 'function' ? (v as () => T)() : (v as T)) as T;\n })();\n\n if (!enabled || !isBrowser()) return fallback;\n\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (raw == null) return fallback;\n return deserialize(raw);\n } catch {\n return fallback;\n }\n }, [deserialize, enabled, storageKey]);\n\n const [value, setValueState] = useState<T>(getInitial);\n\n const writeStorage = useCallback(\n (nextValue: T) => {\n if (!enabled || !isBrowser()) return;\n try {\n window.localStorage.setItem(storageKey, serialize(nextValue));\n } catch {\n // ignore write errors (e.g., quota exceeded, blocked storage)\n }\n },\n [enabled, serialize, storageKey]\n );\n\n const setValue = useCallback(\n (action: SetStateAction<T>) => {\n setValueState((prev) => {\n const next = typeof action === 'function' ? (action as (p: T) => T)(prev) : action;\n writeStorage(next);\n return next;\n });\n },\n [writeStorage]\n );\n\n const remove = useCallback(() => {\n // If key is empty/falsy, just reset to initial value.\n const next = (() => {\n const v = initialValueRef.current;\n return (typeof v === 'function' ? (v as () => T)() : (v as T)) as T;\n })();\n\n setValueState(next);\n\n if (!enabled || !isBrowser()) return;\n try {\n window.localStorage.removeItem(storageKey);\n } catch {\n // ignore\n }\n }, [enabled, storageKey]);\n\n // Keep state updated if key changes.\n useEffect(() => {\n setValueState(getInitial());\n }, [getInitial]);\n\n // Cross-tab sync.\n useEffect(() => {\n if (!enabled || !sync || !isBrowser()) return;\n\n const onStorage = (e: StorageEvent) => {\n if (e.storageArea !== window.localStorage) return;\n if (e.key !== storageKey) return;\n\n // When removed, fall back to initial.\n if (e.newValue == null) {\n setValueState(getInitial());\n return;\n }\n\n try {\n setValueState(deserialize(e.newValue));\n } catch {\n // ignore parse errors\n }\n };\n\n window.addEventListener('storage', onStorage);\n return () => window.removeEventListener('storage', onStorage);\n }, [deserialize, enabled, getInitial, storageKey, sync]);\n\n // Stable tuple identity.\n return useMemo(() => [value, setValue, remove] as const, [remove, setValue, value]);\n}\n\nexport default useLocalStorage;\n"],"mappings":";;;;;;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAazE,SAASC,SAASA,CAAA,EAAG;EACnB,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,YAAY,KAAK,WAAW;AACpF;AAEA,SAASC,gBAAgBA,CAAIC,KAAQ,EAAE;EACrC,OAAOC,IAAI,CAACC,SAAS,CAACF,KAAK,CAAC;AAC9B;AAEA,SAASG,kBAAkBA,CAAIC,GAAW,EAAE;EAC1C,OAAOH,IAAI,CAACI,KAAK,CAACD,GAAG,CAAC;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASE,eAAeA,CACtBC,GAAmB,EACnBC,YAA4B,EAC5BC,OAAmC,EACmB;EAAA,IAAAC,aAAA,EAAAC,kBAAA,EAAAC,oBAAA;EACtD,IAAMC,UAAU,GAAG,CAACN,GAAG,aAAHA,GAAG,cAAHA,GAAG,GAAI,EAAE,EAAEO,IAAI,CAAC,CAAC;EACrC,IAAMC,OAAO,GAAGF,UAAU,CAACG,MAAM,GAAG,CAAC;EACrC,IAAMC,IAAI,IAAAP,aAAA,GAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEQ,IAAI,cAAA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9B,SAAS,CAAC,YAAM;IACd,IAAI,CAACuB,OAAO,IAAI,CAACE,IAAI,IAAI,CAACrB,SAAS,CAAC,CAAC,EAAE;IAEvC,IAAM8C,SAAS,GAAG,SAAZA,SAASA,CAAIC,CAAe,EAAK;MACrC,IAAIA,CAAC,CAACC,WAAW,KAAK/C,MAAM,CAACC,YAAY,EAAE;MAC3C,IAAI6C,CAAC,CAACpC,GAAG,KAAKM,UAAU,EAAE;;MAE1B;MACA,IAAI8B,CAAC,CAACE,QAAQ,IAAI,IAAI,EAAE;QACtBf,aAAa,CAACR,UAAU,CAAC,CAAC,CAAC;QAC3B;MACF;MAEA,IAAI;QACFQ,aAAa,CAACX,WAAW,CAACwB,CAAC,CAACE,QAAQ,CAAC,CAAC;MACxC,CAAC,CAAC,OAAAC,QAAA,EAAM;QACN;MAAA;IAEJ,CAAC;IAEDjD,MAAM,CAACkD,gBAAgB,CAAC,SAAS,EAAEL,SAAS,CAAC;IAC7C,OAAO;MAAA,OAAM7C,MAAM,CAACmD,mBAAmB,CAAC,SAAS,EAAEN,SAAS,CAAC;IAAA;EAC/D,CAAC,EAAE,CAACvB,WAAW,EAAEJ,OAAO,EAAEO,UAAU,EAAET,UAAU,EAAEI,IAAI,CAAC,CAAC;;EAExD;EACA,OAAOxB,OAAO,CAAC;IAAA,OAAM,CAACO,KAAK,EAAEmC,QAAQ,EAAEI,MAAM,CAAC;EAAA,CAAS,EAAE,CAACA,MAAM,EAAEJ,QAAQ,EAAEnC,KAAK,CAAC,CAAC;AACrF;AAEA,eAAeM,eAAe"}
@@ -5,7 +5,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  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; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { useEffect, useRef, useState } from 'react';
8
- import { useLocalStorage } from 'react-use';
8
+ import useLocalStorage from "./useLocalStorage";
9
9
  import useRefFunction from "./useRefFunction";
10
10
  import useRefValue from "./useRefValue";
11
11
  /**
@@ -66,7 +66,7 @@ var useMovable = function useMovable(props) {
66
66
  e.preventDefault();
67
67
  });
68
68
 
69
- // 调整:在窗口 resize 时自动收敛位置,防止超出可视区域
69
+ // Automatically adjust the position during window resize to prevent it from exceeding the visible area.
70
70
  useEffect(function () {
71
71
  var clampToViewport = function clampToViewport() {
72
72
  var _containerRef$current3;
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","useState","useLocalStorage","useRefFunction","useRefValue","useMovable","props","enabled","containerRef","ignoreSelectors","storageKey","storageKeyRef","_useLocalStorage","_useLocalStorage2","_slicedToArray","savedPosition","savePosition","savePositionRef","_useState","undefined","_useState2","position","setPosition","positionRef","draggingRef","dragOffsetRef","x","y","sizeRef","w","h","handlePointerDown","e","_position$left","_position$top","target","closest","join","current","rect","getBoundingClientRect","width","height","currentLeft","left","currentTop","top","clientX","clientY","_containerRef$current","_containerRef$current2","setPointerCapture","call","pointerId","_unused","preventDefault","clampToViewport","_containerRef$current3","pos","maxLeft","Math","max","window","innerWidth","maxTop","innerHeight","clampedLeft","min","clampedTop","next","addEventListener","removeEventListener","onMove","newLeft","newTop","onUp","onPointerDown"],"sources":["../../src/hooks/useMovable.ts"],"sourcesContent":["import { type RefObject, useEffect, useRef, useState } from 'react';\nimport { useLocalStorage } from 'react-use';\nimport useRefFunction from './useRefFunction';\nimport useRefValue from './useRefValue';\n\nexport interface UseMovableProps {\n /**\n * - **EN:** Whether dragging is enabled, default is `true`\n * - **CN:** 是否启用拖动,默认`true`\n */\n enabled?: boolean;\n /**\n * - **EN:** The ref of the container element\n * - **CN:** 容器元素的ref\n */\n containerRef: RefObject<HTMLElement>;\n /**\n * - **EN:** Selectors of elements that should not trigger dragging, e.g., interactive controls\n * - **CN:** 不应触发拖动的元素的选择器,例如交互控件\n */\n ignoreSelectors?: string[];\n /**\n * - **EN:** Key for storing position in localStorage; if not provided, position won't be saved\n * - **CN:** 用于在 localStorage 中存储位置的键;如果未提供,则不会保存位置\n */\n storageKey?: string;\n}\n\n/**\n * - **EN:** Hook to make an element movable by dragging, with position persistence using localStorage\n * - **CN:** 通过拖动使元素可移动的钩子,并使用 localStorage 持久化位置\n */\nconst useMovable = (props: UseMovableProps) => {\n const { enabled, containerRef, ignoreSelectors, storageKey } = props;\n\n const storageKeyRef = useRefValue(storageKey);\n const [savedPosition, savePosition] = useLocalStorage<MovePosition>(storageKey ?? '');\n const savePositionRef = useRefValue(savePosition);\n const [position, setPosition] = useState<MovePosition | undefined>(savedPosition ?? undefined);\n const positionRef = useRefValue(position);\n const draggingRef = useRef(false);\n const dragOffsetRef = useRef({ x: 0, y: 0 });\n const sizeRef = useRef({ w: 0, h: 0 });\n\n // Drag start (exclude interactive controls)\n const handlePointerDown = useRefFunction((e: React.PointerEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement;\n // Set the selector for elements that do not trigger dragging\n if (ignoreSelectors && target.closest(ignoreSelectors.join(','))) return;\n\n if (!containerRef.current) return;\n const rect = containerRef.current.getBoundingClientRect();\n sizeRef.current = { w: rect.width, h: rect.height };\n const currentLeft = position?.left ?? rect.left;\n const currentTop = position?.top ?? rect.top;\n\n dragOffsetRef.current = { x: e.clientX - currentLeft, y: e.clientY - currentTop };\n draggingRef.current = true;\n try {\n containerRef.current.setPointerCapture?.(e.pointerId);\n } catch {\n // do nothing\n }\n e.preventDefault();\n });\n\n // 调整:在窗口 resize 时自动收敛位置,防止超出可视区域\n useEffect(() => {\n const clampToViewport = () => {\n const pos = positionRef.current;\n if (!pos) return;\n\n // Refresh the container size before each convergence to ensure accurate boundaries.\n const rect = containerRef.current?.getBoundingClientRect();\n if (rect) {\n sizeRef.current = { w: rect.width, h: rect.height };\n }\n\n const maxLeft = Math.max(0, window.innerWidth - sizeRef.current.w);\n const maxTop = Math.max(0, window.innerHeight - sizeRef.current.h);\n const clampedLeft = Math.min(Math.max(0, pos.left), maxLeft);\n const clampedTop = Math.min(Math.max(0, pos.top), maxTop);\n\n if (clampedLeft !== pos.left || clampedTop !== pos.top) {\n const next = { left: clampedLeft, top: clampedTop };\n setPosition(next);\n if (storageKeyRef.current) {\n savePositionRef.current(next);\n }\n }\n };\n\n window.addEventListener('resize', clampToViewport);\n // Calibrate immediately after the first mount/position change.\n clampToViewport();\n\n return () => {\n window.removeEventListener('resize', clampToViewport);\n };\n }, [containerRef]);\n\n // Update position during dragging; restrict within the visible area.\n useEffect(() => {\n const onMove = (e: PointerEvent) => {\n if (!draggingRef.current) return;\n const newLeft = e.clientX - dragOffsetRef.current.x;\n const newTop = e.clientY - dragOffsetRef.current.y;\n const maxLeft = Math.max(0, window.innerWidth - sizeRef.current.w);\n const maxTop = Math.max(0, window.innerHeight - sizeRef.current.h);\n const clampedLeft = Math.min(Math.max(0, newLeft), maxLeft);\n const clampedTop = Math.min(Math.max(0, newTop), maxTop);\n const pos = { left: clampedLeft, top: clampedTop };\n setPosition(pos);\n if (storageKeyRef.current) {\n savePositionRef.current(pos);\n }\n };\n const onUp = () => {\n if (draggingRef.current) draggingRef.current = false;\n };\n if (enabled) {\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n }\n return () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n };\n }, [enabled]);\n\n return {\n onPointerDown: handlePointerDown,\n position,\n };\n};\n\nexport interface MovePosition {\n left: number;\n top: number;\n}\n\nexport default useMovable;\n"],"mappings":";;;;;;AAAA,SAAyBA,SAAS,EAAE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/C,aAAa,CAAC2B,OAAO,EAAE;QACzBrB,eAAe,CAACqB,OAAO,CAACoB,GAAG,CAAC;MAC9B;IACF,CAAC;IACD,IAAMiB,IAAI,GAAG,SAAPA,IAAIA,CAAA,EAAS;MACjB,IAAInD,WAAW,CAACc,OAAO,EAAEd,WAAW,CAACc,OAAO,GAAG,KAAK;IACtD,CAAC;IACD,IAAI/B,OAAO,EAAE;MACXuD,MAAM,CAACQ,gBAAgB,CAAC,aAAa,EAAEE,MAAM,CAAC;MAC9CV,MAAM,CAACQ,gBAAgB,CAAC,WAAW,EAAEK,IAAI,CAAC;MAC1Cb,MAAM,CAACQ,gBAAgB,CAAC,eAAe,EAAEK,IAAI,CAAC;IAChD;IACA,OAAO,YAAM;MACXb,MAAM,CAACS,mBAAmB,CAAC,aAAa,EAAEC,MAAM,CAAC;MACjDV,MAAM,CAACS,mBAAmB,CAAC,WAAW,EAAEI,IAAI,CAAC;MAC7Cb,MAAM,CAACS,mBAAmB,CAAC,eAAe,EAAEI,IAAI,CAAC;IACnD,CAAC;EACH,CAAC,EAAE,CAACpE,OAAO,CAAC,CAAC;EAEb,OAAO;IACLqE,aAAa,EAAE7C,iBAAiB;IAChCV,QAAQ,EAARA;EACF,CAAC;AACH,CAAC;AAOD,eAAehB,UAAU"}
1
+ {"version":3,"names":["useEffect","useRef","useState","useLocalStorage","useRefFunction","useRefValue","useMovable","props","enabled","containerRef","ignoreSelectors","storageKey","storageKeyRef","_useLocalStorage","_useLocalStorage2","_slicedToArray","savedPosition","savePosition","savePositionRef","_useState","undefined","_useState2","position","setPosition","positionRef","draggingRef","dragOffsetRef","x","y","sizeRef","w","h","handlePointerDown","e","_position$left","_position$top","target","closest","join","current","rect","getBoundingClientRect","width","height","currentLeft","left","currentTop","top","clientX","clientY","_containerRef$current","_containerRef$current2","setPointerCapture","call","pointerId","_unused","preventDefault","clampToViewport","_containerRef$current3","pos","maxLeft","Math","max","window","innerWidth","maxTop","innerHeight","clampedLeft","min","clampedTop","next","addEventListener","removeEventListener","onMove","newLeft","newTop","onUp","onPointerDown"],"sources":["../../src/hooks/useMovable.ts"],"sourcesContent":["import { type RefObject, useEffect, useRef, useState } from 'react';\nimport useLocalStorage from './useLocalStorage';\nimport useRefFunction from './useRefFunction';\nimport useRefValue from './useRefValue';\n\nexport interface UseMovableProps {\n /**\n * - **EN:** Whether dragging is enabled, default is `true`\n * - **CN:** 是否启用拖动,默认`true`\n */\n enabled?: boolean;\n /**\n * - **EN:** The ref of the container element\n * - **CN:** 容器元素的ref\n */\n containerRef: RefObject<HTMLElement>;\n /**\n * - **EN:** Selectors of elements that should not trigger dragging, e.g., interactive controls\n * - **CN:** 不应触发拖动的元素的选择器,例如交互控件\n */\n ignoreSelectors?: string[];\n /**\n * - **EN:** Key for storing position in localStorage; if not provided, position won't be saved\n * - **CN:** 用于在 localStorage 中存储位置的键;如果未提供,则不会保存位置\n */\n storageKey?: string;\n}\n\n/**\n * - **EN:** Hook to make an element movable by dragging, with position persistence using localStorage\n * - **CN:** 通过拖动使元素可移动的钩子,并使用 localStorage 持久化位置\n */\nconst useMovable = (props: UseMovableProps) => {\n const { enabled, containerRef, ignoreSelectors, storageKey } = props;\n\n const storageKeyRef = useRefValue(storageKey);\n const [savedPosition, savePosition] = useLocalStorage<MovePosition>(storageKey ?? '');\n const savePositionRef = useRefValue(savePosition);\n const [position, setPosition] = useState<MovePosition | undefined>(savedPosition ?? undefined);\n const positionRef = useRefValue(position);\n const draggingRef = useRef(false);\n const dragOffsetRef = useRef({ x: 0, y: 0 });\n const sizeRef = useRef({ w: 0, h: 0 });\n\n // Drag start (exclude interactive controls)\n const handlePointerDown = useRefFunction((e: React.PointerEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement;\n // Set the selector for elements that do not trigger dragging\n if (ignoreSelectors && target.closest(ignoreSelectors.join(','))) return;\n\n if (!containerRef.current) return;\n const rect = containerRef.current.getBoundingClientRect();\n sizeRef.current = { w: rect.width, h: rect.height };\n const currentLeft = position?.left ?? rect.left;\n const currentTop = position?.top ?? rect.top;\n\n dragOffsetRef.current = { x: e.clientX - currentLeft, y: e.clientY - currentTop };\n draggingRef.current = true;\n try {\n containerRef.current.setPointerCapture?.(e.pointerId);\n } catch {\n // do nothing\n }\n e.preventDefault();\n });\n\n // Automatically adjust the position during window resize to prevent it from exceeding the visible area.\n useEffect(() => {\n const clampToViewport = () => {\n const pos = positionRef.current;\n if (!pos) return;\n\n // Refresh the container size before each convergence to ensure accurate boundaries.\n const rect = containerRef.current?.getBoundingClientRect();\n if (rect) {\n sizeRef.current = { w: rect.width, h: rect.height };\n }\n\n const maxLeft = Math.max(0, window.innerWidth - sizeRef.current.w);\n const maxTop = Math.max(0, window.innerHeight - sizeRef.current.h);\n const clampedLeft = Math.min(Math.max(0, pos.left), maxLeft);\n const clampedTop = Math.min(Math.max(0, pos.top), maxTop);\n\n if (clampedLeft !== pos.left || clampedTop !== pos.top) {\n const next = { left: clampedLeft, top: clampedTop };\n setPosition(next);\n if (storageKeyRef.current) {\n savePositionRef.current(next);\n }\n }\n };\n\n window.addEventListener('resize', clampToViewport);\n // Calibrate immediately after the first mount/position change.\n clampToViewport();\n\n return () => {\n window.removeEventListener('resize', clampToViewport);\n };\n }, [containerRef]);\n\n // Update position during dragging; restrict within the visible area.\n useEffect(() => {\n const onMove = (e: PointerEvent) => {\n if (!draggingRef.current) return;\n const newLeft = e.clientX - dragOffsetRef.current.x;\n const newTop = e.clientY - dragOffsetRef.current.y;\n const maxLeft = Math.max(0, window.innerWidth - sizeRef.current.w);\n const maxTop = Math.max(0, window.innerHeight - sizeRef.current.h);\n const clampedLeft = Math.min(Math.max(0, newLeft), maxLeft);\n const clampedTop = Math.min(Math.max(0, newTop), maxTop);\n const pos = { left: clampedLeft, top: clampedTop };\n setPosition(pos);\n if (storageKeyRef.current) {\n savePositionRef.current(pos);\n }\n };\n const onUp = () => {\n if (draggingRef.current) draggingRef.current = false;\n };\n if (enabled) {\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n }\n return () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n };\n }, [enabled]);\n\n return {\n onPointerDown: handlePointerDown,\n position,\n };\n};\n\nexport interface MovePosition {\n left: number;\n top: number;\n}\n\nexport default useMovable;\n"],"mappings":";;;;;;AAAA,SAAyBA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnE,OAAOC,eAAe;AACtB,OAAOC,cAAc;AACrB,OAAOC,WAAW;AAyBlB;AACA;AACA;AACA;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,KAAsB,EAAK;EAC7C,IAAQC,OAAO,GAAgDD,KAAK,CAA5DC,OAAO;IAAEC,YAAY,GAAkCF,KAAK,CAAnDE,YAAY;IAAEC,eAAe,GAAiBH,KAAK,CAArCG,eAAe;IAAEC,UAAU,GAAKJ,KAAK,CAApBI,UAAU;EAE1D,IAAMC,aAAa,GAAGP,WAAW,CAACM,UAAU,CAAC;EAC7C,IAAAE,gBAAA,GAAsCV,eAAe,CAAeQ,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,EAAE,CAAC;IAAAG,iBAAA,GAAAC,cAAA,CAAAF,gBAAA;IAA9EG,aAAa,GAAAF,iBAAA;IAAEG,YAAY,GAAAH,iBAAA;EAClC,IAAMI,eAAe,GAAGb,WAAW,CAACY,YAAY,CAAC;EACjD,IAAAE,SAAA,GAAgCjB,QAAQ,CAA2Bc,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAII,SAAS,CAAC;IAAAC,UAAA,GAAAN,cAAA,CAAAI,SAAA;IAAvFG,QAAQ,GAAAD,UAAA;IAAEE,WAAW,GAAAF,UAAA;EAC5B,IAAMG,WAAW,GAAGnB,WAAW,CAACiB,QAAQ,CAAC;EACzC,IAAMG,WAAW,GAAGxB,MAAM,CAAC,KAAK,CAAC;EACjC,IAAMyB,aAAa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