@tiny-codes/react-easy 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/es/components/BreakLines/index.d.ts +13 -19
  3. package/es/components/BreakLines/index.js +2 -3
  4. package/es/components/BreakLines/index.js.map +1 -1
  5. package/es/components/ConfigProvider/context.d.ts +20 -26
  6. package/es/components/ConfigProvider/context.js.map +1 -1
  7. package/es/components/ConfigProvider/index.d.ts +5 -7
  8. package/es/components/ConfigProvider/index.js +2 -3
  9. package/es/components/ConfigProvider/index.js.map +1 -1
  10. package/es/components/ConfirmAction/index.d.ts +66 -89
  11. package/es/components/ConfirmAction/index.js +27 -18
  12. package/es/components/ConfirmAction/index.js.map +1 -1
  13. package/es/components/ContextMenu/index.d.ts +42 -0
  14. package/es/components/ContextMenu/index.js +188 -0
  15. package/es/components/ContextMenu/index.js.map +1 -0
  16. package/es/components/ContextMenu/style/index.d.ts +3 -0
  17. package/es/components/ContextMenu/style/index.js +25 -0
  18. package/es/components/ContextMenu/style/index.js.map +1 -0
  19. package/es/components/DeleteConfirmAction/index.d.ts +2 -3
  20. package/es/components/DeleteConfirmAction/index.js +8 -12
  21. package/es/components/DeleteConfirmAction/index.js.map +1 -1
  22. package/es/components/EditableText/form.d.ts +150 -0
  23. package/es/components/EditableText/form.js +359 -0
  24. package/es/components/EditableText/form.js.map +1 -0
  25. package/es/components/EditableText/index.d.ts +160 -0
  26. package/es/components/EditableText/index.js +222 -0
  27. package/es/components/EditableText/index.js.map +1 -0
  28. package/es/components/EditableText/style/index.d.ts +3 -0
  29. package/es/components/EditableText/style/index.js +76 -0
  30. package/es/components/EditableText/style/index.js.map +1 -0
  31. package/es/components/FloatDrawer/index.d.ts +89 -86
  32. package/es/components/FloatDrawer/index.js +43 -20
  33. package/es/components/FloatDrawer/index.js.map +1 -1
  34. package/es/components/FloatDrawer/style/index.js +42 -21
  35. package/es/components/FloatDrawer/style/index.js.map +1 -1
  36. package/es/components/Loading/index.d.ts +9 -14
  37. package/es/components/Loading/index.js +7 -6
  38. package/es/components/Loading/index.js.map +1 -1
  39. package/es/components/Loading/style/index.js +1 -1
  40. package/es/components/Loading/style/index.js.map +1 -1
  41. package/es/components/ModalAction/index.d.ts +98 -139
  42. package/es/components/ModalAction/index.js +25 -37
  43. package/es/components/ModalAction/index.js.map +1 -1
  44. package/es/components/OverflowTags/index.d.ts +30 -8
  45. package/es/components/OverflowTags/index.js +26 -7
  46. package/es/components/OverflowTags/index.js.map +1 -1
  47. package/es/components/OverflowTags/style/index.js +1 -1
  48. package/es/components/OverflowTags/style/index.js.map +1 -1
  49. package/es/components/index.d.ts +4 -0
  50. package/es/components/index.js +2 -0
  51. package/es/components/index.js.map +1 -1
  52. package/es/hooks/useRefFunction.d.ts +4 -5
  53. package/es/hooks/useRefFunction.js +6 -7
  54. package/es/hooks/useRefFunction.js.map +1 -1
  55. package/es/hooks/useRefValue.d.ts +2 -3
  56. package/es/hooks/useRefValue.js +2 -3
  57. package/es/hooks/useRefValue.js.map +1 -1
  58. package/es/hooks/useT.js +1 -2
  59. package/es/hooks/useT.js.map +1 -1
  60. package/es/hooks/useValidator.d.ts +2 -3
  61. package/es/hooks/useValidator.js +2 -3
  62. package/es/hooks/useValidator.js.map +1 -1
  63. package/es/hooks/useValidatorBuilder.d.ts +41 -61
  64. package/es/hooks/useValidatorBuilder.js +4 -6
  65. package/es/hooks/useValidatorBuilder.js.map +1 -1
  66. package/es/hooks/useValidators.d.ts +62 -83
  67. package/es/hooks/useValidators.js +3 -4
  68. package/es/hooks/useValidators.js.map +1 -1
  69. package/es/locales/index.d.ts +15 -0
  70. package/es/locales/langs/en-US.d.ts +5 -0
  71. package/es/locales/langs/en-US.js +5 -0
  72. package/es/locales/langs/en-US.js.map +1 -1
  73. package/es/locales/langs/zh-CN.d.ts +5 -0
  74. package/es/locales/langs/zh-CN.js +5 -0
  75. package/es/locales/langs/zh-CN.js.map +1 -1
  76. package/lib/components/BreakLines/index.d.ts +13 -19
  77. package/lib/components/BreakLines/index.js.map +2 -2
  78. package/lib/components/ConfigProvider/context.d.ts +20 -26
  79. package/lib/components/ConfigProvider/context.js.map +2 -2
  80. package/lib/components/ConfigProvider/index.d.ts +5 -7
  81. package/lib/components/ConfigProvider/index.js.map +2 -2
  82. package/lib/components/ConfirmAction/index.d.ts +66 -89
  83. package/lib/components/ConfirmAction/index.js +9 -0
  84. package/lib/components/ConfirmAction/index.js.map +2 -2
  85. package/lib/components/ContextMenu/index.d.ts +42 -0
  86. package/lib/components/ContextMenu/index.js +190 -0
  87. package/lib/components/ContextMenu/index.js.map +7 -0
  88. package/lib/components/ContextMenu/style/index.d.ts +3 -0
  89. package/lib/components/ContextMenu/style/index.js +48 -0
  90. package/lib/components/ContextMenu/style/index.js.map +7 -0
  91. package/lib/components/DeleteConfirmAction/index.d.ts +2 -3
  92. package/lib/components/DeleteConfirmAction/index.js.map +2 -2
  93. package/lib/components/EditableText/form.d.ts +150 -0
  94. package/lib/components/EditableText/form.js +253 -0
  95. package/lib/components/EditableText/form.js.map +7 -0
  96. package/lib/components/EditableText/index.d.ts +160 -0
  97. package/lib/components/EditableText/index.js +181 -0
  98. package/lib/components/EditableText/index.js.map +7 -0
  99. package/lib/components/EditableText/style/index.d.ts +3 -0
  100. package/lib/components/EditableText/style/index.js +118 -0
  101. package/lib/components/EditableText/style/index.js.map +7 -0
  102. package/lib/components/FloatDrawer/index.d.ts +89 -86
  103. package/lib/components/FloatDrawer/index.js +64 -39
  104. package/lib/components/FloatDrawer/index.js.map +2 -2
  105. package/lib/components/FloatDrawer/style/index.js +60 -23
  106. package/lib/components/FloatDrawer/style/index.js.map +2 -2
  107. package/lib/components/Loading/index.d.ts +9 -14
  108. package/lib/components/Loading/index.js +13 -4
  109. package/lib/components/Loading/index.js.map +2 -2
  110. package/lib/components/Loading/style/index.js +1 -1
  111. package/lib/components/Loading/style/index.js.map +2 -2
  112. package/lib/components/ModalAction/index.d.ts +98 -139
  113. package/lib/components/ModalAction/index.js.map +2 -2
  114. package/lib/components/OverflowTags/index.d.ts +30 -8
  115. package/lib/components/OverflowTags/index.js +7 -5
  116. package/lib/components/OverflowTags/index.js.map +2 -2
  117. package/lib/components/OverflowTags/style/index.js +1 -1
  118. package/lib/components/OverflowTags/style/index.js.map +2 -2
  119. package/lib/components/index.d.ts +4 -0
  120. package/lib/components/index.js +6 -0
  121. package/lib/components/index.js.map +2 -2
  122. package/lib/hooks/useRefFunction.d.ts +4 -5
  123. package/lib/hooks/useRefFunction.js.map +2 -2
  124. package/lib/hooks/useRefValue.d.ts +2 -3
  125. package/lib/hooks/useRefValue.js.map +2 -2
  126. package/lib/hooks/useT.js.map +2 -2
  127. package/lib/hooks/useValidator.d.ts +2 -3
  128. package/lib/hooks/useValidator.js.map +2 -2
  129. package/lib/hooks/useValidatorBuilder.d.ts +41 -61
  130. package/lib/hooks/useValidatorBuilder.js.map +2 -2
  131. package/lib/hooks/useValidators.d.ts +62 -83
  132. package/lib/hooks/useValidators.js.map +2 -2
  133. package/lib/locales/index.d.ts +15 -0
  134. package/lib/locales/langs/en-US.d.ts +5 -0
  135. package/lib/locales/langs/en-US.js +5 -0
  136. package/lib/locales/langs/en-US.js.map +2 -2
  137. package/lib/locales/langs/zh-CN.d.ts +5 -0
  138. package/lib/locales/langs/zh-CN.js +5 -0
  139. package/lib/locales/langs/zh-CN.js.map +2 -2
  140. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## 1.2.0
6
+
7
+ 2025-7-16
8
+
9
+ ### Features
10
+
11
+ - 🔥 Add `ContextMenu` component
12
+ - `EditableText` component
13
+ - ✨ now supports `block` prop to control both view and editing mode
14
+ - ✨ `inputComp` prop allows for custom input components
15
+ - `Loading` component
16
+ - 💥 Renamed two properties:
17
+ - `maskStyle` to `rootStyle`
18
+ - `maskClassName` to `rootClassName`
19
+
20
+ ## 1.1.3
21
+
22
+ 2025-7-4
23
+
24
+ ### Features
25
+
26
+ - 🔥 Add `EditableText` component
27
+ - ✨ `OverflowTags` component now supports `tag.icon`, and tries to use `tag.label`/`tag.name` as the label, tries to use `tag.value`/`tag.id` as the value
28
+
5
29
  ## 1.1.2
6
30
 
7
31
  2025-7-3
@@ -1,47 +1,41 @@
1
1
  import { type FC } from 'react';
2
2
  export interface BreakLinesProps {
3
3
  /**
4
- * **EN:** Text content
5
- *
6
- * **CN:** 文本内容
4
+ * - **EN:** Text content
5
+ * - **CN:** 文本内容
7
6
  */
8
7
  value: string | undefined;
9
8
  /**
10
- * **EN:** Whether to enable line breaking
11
- *
12
- * **CN:** 是否启用换行功能
9
+ * - **EN:** Whether to enable line breaking
10
+ * - **CN:** 是否启用换行功能
13
11
  *
14
12
  * @default true
15
13
  */
16
14
  enabled?: boolean;
17
15
  /**
18
- * **EN:** Line break character
19
- *
20
- * **CN:** 换行符
16
+ * - **EN:** Line break character
17
+ * - **CN:** 换行符
21
18
  *
22
19
  * @default '\n'
23
20
  */
24
21
  EOL?: string;
25
22
  /**
26
- * **CN:** 渲染dom节点的标签名
27
- *
28
- * **EN:** Render the tag name of the DOM node
23
+ * - **CN:** 渲染dom节点的标签名
24
+ * - **EN:** Render the tag name of the DOM node
29
25
  *
30
26
  * @default false
31
27
  */
32
28
  tagName?: 'span' | 'div' | 'i' | 'pre' | (string & {}) | false;
33
29
  /**
34
- * **EN:** The CSS class name of the dom node, if `tagName` is set to false, this property is
35
- * invalid
36
- *
37
- * **CN:** dom节点的css类名,如果`tagName`设置为false,则此属性无效
30
+ * - **EN:** The CSS class name of the dom node, if `tagName` is set to false, this property is
31
+ * invalid
32
+ * - **CN:** dom节点的css类名,如果`tagName`设置为false,则此属性无效
38
33
  */
39
34
  className?: string;
40
35
  }
41
36
  /**
42
- * **EN:** Output a piece of text, keeping line breaks
43
- *
44
- * **CN:** 输出一段文本,保留换行符
37
+ * - **EN:** Output a piece of text, keeping line breaks
38
+ * - **CN:** 输出一段文本,保留换行符
45
39
  *
46
40
  * @example
47
41
  * <BreakLines value="hello \n world" />;
@@ -3,9 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { Fragment as _Fragment } from "react/jsx-runtime";
5
5
  /**
6
- * **EN:** Output a piece of text, keeping line breaks
7
- *
8
- * **CN:** 输出一段文本,保留换行符
6
+ * - **EN:** Output a piece of text, keeping line breaks
7
+ * - **CN:** 输出一段文本,保留换行符
9
8
  *
10
9
  * @example
11
10
  * <BreakLines value="hello \n world" />;
@@ -1 +1 @@
1
- {"version":3,"names":["createElement","Fragment","jsx","_jsx","jsxs","_jsxs","_Fragment","BreakLines","props","value","className","_props$tagName","tagName","_props$enabled","enabled","_props$EOL","EOL","content","includes","segments","split","map","str","i","children","length","concat"],"sources":["../../../src/components/BreakLines/index.tsx"],"sourcesContent":["import { createElement, type FC, Fragment, type ReactNode } from 'react';\n\nexport interface BreakLinesProps {\n /**\n * **EN:** Text content\n *\n * **CN:** 文本内容\n */\n value: string | undefined;\n /**\n * **EN:** Whether to enable line breaking\n *\n * **CN:** 是否启用换行功能\n *\n * @default true\n */\n enabled?: boolean;\n /**\n * **EN:** Line break character\n *\n * **CN:** 换行符\n *\n * @default '\\n'\n */\n EOL?: string;\n /**\n * **CN:** 渲染dom节点的标签名\n *\n * **EN:** Render the tag name of the DOM node\n *\n * @default false\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n tagName?: 'span' | 'div' | 'i' | 'pre' | (string & {}) | false;\n /**\n * **EN:** The CSS class name of the dom node, if `tagName` is set to false, this property is\n * invalid\n *\n * **CN:** dom节点的css类名,如果`tagName`设置为false,则此属性无效\n */\n className?: string;\n}\n\n/**\n * **EN:** Output a piece of text, keeping line breaks\n *\n * **CN:** 输出一段文本,保留换行符\n *\n * @example\n * <BreakLines value=\"hello \\n world\" />;\n * // hello <br/> world\n */\nconst BreakLines: FC<BreakLinesProps> = (props) => {\n const { value, className, tagName = false, enabled = true, EOL = '\\n' } = props;\n\n let content: ReactNode;\n if (value) {\n if (enabled) {\n if (value.includes(EOL)) {\n const segments = value?.split(EOL);\n content = segments.map((str, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={`${str}:${i}`}>\n {str}\n {i !== segments.length - 1 && <br />}\n </Fragment>\n ));\n } else {\n content = value;\n }\n } else {\n content = value;\n }\n } else {\n content = value;\n }\n\n if (tagName) {\n return createElement(tagName, { className }, content);\n } else {\n return <>{content}</>;\n }\n};\n\nexport default BreakLines;\n"],"mappings":"AAAA,SAASA,aAAa,EAAWC,QAAQ,QAAwB,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAJ,QAAA,IAAAK,SAAA;AA2CzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,UAA+B,GAAG,SAAlCA,UAA+BA,CAAIC,KAAK,EAAK;EACjD,IAAQC,KAAK,GAA6DD,KAAK,CAAvEC,KAAK;IAAEC,SAAS,GAAkDF,KAAK,CAAhEE,SAAS;IAAAC,cAAA,GAAkDH,KAAK,CAArDI,OAAO;IAAPA,OAAO,GAAAD,cAAA,cAAG,KAAK,GAAAA,cAAA;IAAAE,cAAA,GAAiCL,KAAK,CAApCM,OAAO;IAAPA,OAAO,GAAAD,cAAA,cAAG,IAAI,GAAAA,cAAA;IAAAE,UAAA,GAAiBP,KAAK,CAApBQ,GAAG;IAAHA,GAAG,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;EAErE,IAAIE,OAAkB;EACtB,IAAIR,KAAK,EAAE;IACT,IAAIK,OAAO,EAAE;MACX,IAAIL,KAAK,CAACS,QAAQ,CAACF,GAAG,CAAC,EAAE;QACvB,IAAMG,QAAQ,GAAGV,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEW,KAAK,CAACJ,GAAG,CAAC;QAClCC,OAAO,GAAGE,QAAQ,CAACE,GAAG,CAAC,UAACC,GAAG,EAAEC,CAAC;UAAA;YAAA;YAC5B;YACAlB,KAAA,CAACJ,QAAQ;cAAAuB,QAAA,GACNF,GAAG,EACHC,CAAC,KAAKJ,QAAQ,CAACM,MAAM,GAAG,CAAC,iBAAItB,IAAA,SAAK,CAAC;YAAA,MAAAuB,MAAA,CAFpBJ,GAAG,OAAAI,MAAA,CAAIH,CAAC,CAGhB;UAAC;QAAA,CACZ,CAAC;MACJ,CAAC,MAAM;QACLN,OAAO,GAAGR,KAAK;MACjB;IACF,CAAC,MAAM;MACLQ,OAAO,GAAGR,KAAK;IACjB;EACF,CAAC,MAAM;IACLQ,OAAO,GAAGR,KAAK;EACjB;EAEA,IAAIG,OAAO,EAAE;IACX,oBAAOZ,aAAa,CAACY,OAAO,EAAE;MAAEF,SAAS,EAATA;IAAU,CAAC,EAAEO,OAAO,CAAC;EACvD,CAAC,MAAM;IACL,oBAAOd,IAAA,CAAAG,SAAA;MAAAkB,QAAA,EAAGP;IAAO,CAAG,CAAC;EACvB;AACF,CAAC;AAED,eAAeV,UAAU"}
1
+ {"version":3,"names":["createElement","Fragment","jsx","_jsx","jsxs","_jsxs","_Fragment","BreakLines","props","value","className","_props$tagName","tagName","_props$enabled","enabled","_props$EOL","EOL","content","includes","segments","split","map","str","i","children","length","concat"],"sources":["../../../src/components/BreakLines/index.tsx"],"sourcesContent":["import { createElement, type FC, Fragment, type ReactNode } from 'react';\n\nexport interface BreakLinesProps {\n /**\n * - **EN:** Text content\n * - **CN:** 文本内容\n */\n value: string | undefined;\n /**\n * - **EN:** Whether to enable line breaking\n * - **CN:** 是否启用换行功能\n *\n * @default true\n */\n enabled?: boolean;\n /**\n * - **EN:** Line break character\n * - **CN:** 换行符\n *\n * @default '\\n'\n */\n EOL?: string;\n /**\n * - **CN:** 渲染dom节点的标签名\n * - **EN:** Render the tag name of the DOM node\n *\n * @default false\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n tagName?: 'span' | 'div' | 'i' | 'pre' | (string & {}) | false;\n /**\n * - **EN:** The CSS class name of the dom node, if `tagName` is set to false, this property is\n * invalid\n * - **CN:** dom节点的css类名,如果`tagName`设置为false,则此属性无效\n */\n className?: string;\n}\n\n/**\n * - **EN:** Output a piece of text, keeping line breaks\n * - **CN:** 输出一段文本,保留换行符\n *\n * @example\n * <BreakLines value=\"hello \\n world\" />;\n * // hello <br/> world\n */\nconst BreakLines: FC<BreakLinesProps> = (props) => {\n const { value, className, tagName = false, enabled = true, EOL = '\\n' } = props;\n\n let content: ReactNode;\n if (value) {\n if (enabled) {\n if (value.includes(EOL)) {\n const segments = value?.split(EOL);\n content = segments.map((str, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={`${str}:${i}`}>\n {str}\n {i !== segments.length - 1 && <br />}\n </Fragment>\n ));\n } else {\n content = value;\n }\n } else {\n content = value;\n }\n } else {\n content = value;\n }\n\n if (tagName) {\n return createElement(tagName, { className }, content);\n } else {\n return <>{content}</>;\n }\n};\n\nexport default BreakLines;\n"],"mappings":"AAAA,SAASA,aAAa,EAAWC,QAAQ,QAAwB,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAJ,QAAA,IAAAK,SAAA;AAsCzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,UAA+B,GAAG,SAAlCA,UAA+BA,CAAIC,KAAK,EAAK;EACjD,IAAQC,KAAK,GAA6DD,KAAK,CAAvEC,KAAK;IAAEC,SAAS,GAAkDF,KAAK,CAAhEE,SAAS;IAAAC,cAAA,GAAkDH,KAAK,CAArDI,OAAO;IAAPA,OAAO,GAAAD,cAAA,cAAG,KAAK,GAAAA,cAAA;IAAAE,cAAA,GAAiCL,KAAK,CAApCM,OAAO;IAAPA,OAAO,GAAAD,cAAA,cAAG,IAAI,GAAAA,cAAA;IAAAE,UAAA,GAAiBP,KAAK,CAApBQ,GAAG;IAAHA,GAAG,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;EAErE,IAAIE,OAAkB;EACtB,IAAIR,KAAK,EAAE;IACT,IAAIK,OAAO,EAAE;MACX,IAAIL,KAAK,CAACS,QAAQ,CAACF,GAAG,CAAC,EAAE;QACvB,IAAMG,QAAQ,GAAGV,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEW,KAAK,CAACJ,GAAG,CAAC;QAClCC,OAAO,GAAGE,QAAQ,CAACE,GAAG,CAAC,UAACC,GAAG,EAAEC,CAAC;UAAA;YAAA;YAC5B;YACAlB,KAAA,CAACJ,QAAQ;cAAAuB,QAAA,GACNF,GAAG,EACHC,CAAC,KAAKJ,QAAQ,CAACM,MAAM,GAAG,CAAC,iBAAItB,IAAA,SAAK,CAAC;YAAA,MAAAuB,MAAA,CAFpBJ,GAAG,OAAAI,MAAA,CAAIH,CAAC,CAGhB;UAAC;QAAA,CACZ,CAAC;MACJ,CAAC,MAAM;QACLN,OAAO,GAAGR,KAAK;MACjB;IACF,CAAC,MAAM;MACLQ,OAAO,GAAGR,KAAK;IACjB;EACF,CAAC,MAAM;IACLQ,OAAO,GAAGR,KAAK;EACjB;EAEA,IAAIG,OAAO,EAAE;IACX,oBAAOZ,aAAa,CAACY,OAAO,EAAE;MAAEF,SAAS,EAATA;IAAU,CAAC,EAAEO,OAAO,CAAC;EACvD,CAAC,MAAM;IACL,oBAAOd,IAAA,CAAAG,SAAA;MAAAkB,QAAA,EAAGP;IAAO,CAAG,CAAC;EACvB;AACF,CAAC;AAED,eAAeV,UAAU"}
@@ -2,47 +2,41 @@ import { type ReactNode } from 'react';
2
2
  import type { Langs } from '../../locales';
3
3
  export interface ReactEasyContextProps {
4
4
  /**
5
- * **EN:** Language of the component, used for global configuration, can be 'en-US' or 'zh-CN'
6
- *
7
- * **CN:** 组件的语言,用于全局配置,可以是'en-US'或'zh-CN'
5
+ * - **EN:** Language of the component, used for global configuration, can be 'en-US' or 'zh-CN'
6
+ * - **CN:** 组件的语言,用于全局配置,可以是'en-US'或'zh-CN'
8
7
  */
9
8
  lang?: Langs;
10
9
  /**
11
- * **EN:** Default title of the confirm dialog, used for global configuration, can be normal text
12
- * or the key of localized resources, the key of localized resources will be converted into
13
- * localized text through the `localize` method
14
- *
15
- * **CN:** 确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
10
+ * - **EN:** Default title of the confirm dialog, used for global configuration, can be normal text
11
+ * or the key of localized resources, the key of localized resources will be converted into
12
+ * localized text through the `localize` method
13
+ * - **CN:** 确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
16
14
  */
17
15
  defaultConfirmTitle?: ReactNode;
18
16
  /**
19
- * **EN:** Default content of the confirm dialog, used for global configuration, can be normal
20
- * text or the key of localized resources, the key of localized resources will be converted into
21
- * localized text through the `localize` method
22
- *
23
- * **CN:** 确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
17
+ * - **EN:** Default content of the confirm dialog, used for global configuration, can be normal
18
+ * text or the key of localized resources, the key of localized resources will be converted into
19
+ * localized text through the `localize` method
20
+ * - **CN:** 确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
24
21
  */
25
22
  defaultConfirmContent?: ReactNode;
26
23
  /**
27
- * **EN:** Default title of the deletion confirmation dialog, used for global configuration, can
28
- * be normal text or the key of localized resources, the key of localized resources will be
29
- * converted into localized text through the `localize` method
30
- *
31
- * **CN:** 删除确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
24
+ * - **EN:** Default title of the deletion confirmation dialog, used for global configuration, can
25
+ * be normal text or the key of localized resources, the key of localized resources will be
26
+ * converted into localized text through the `localize` method
27
+ * - **CN:** 删除确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
32
28
  */
33
29
  defaultDeletionConfirmTitle?: ReactNode;
34
30
  /**
35
- * **EN:** Default content of the deletion confirmation dialog, used for global configuration, can
36
- * be normal text or the key of localized resources, the key of localized resources will be
37
- * converted into localized text through the `localize` method
38
- *
39
- * **CN:** 删除确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
31
+ * - **EN:** Default content of the deletion confirmation dialog, used for global configuration, can
32
+ * be normal text or the key of localized resources, the key of localized resources will be
33
+ * converted into localized text through the `localize` method
34
+ * - **CN:** 删除确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
40
35
  */
41
36
  defaultDeletionConfirmContent?: ReactNode;
42
37
  /**
43
- * **EN:** Get localized text
44
- *
45
- * **CN:** 获取本地化文本
38
+ * - **EN:** Get localized text
39
+ * - **CN:** 获取本地化文本
46
40
  *
47
41
  * @param key Normal text or key of local resource | 普通文本或本地资源的键值
48
42
  * @param args Parameters of the localized text | 本地化文本的参数
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","defaultContextValue","lang","ReactEasyContext"],"sources":["../../../src/components/ConfigProvider/context.tsx"],"sourcesContent":["import { createContext, type ReactNode } from 'react';\nimport type { Langs } from '../../locales';\n\nexport interface ReactEasyContextProps {\n /**\n * **EN:** Language of the component, used for global configuration, can be 'en-US' or 'zh-CN'\n *\n * **CN:** 组件的语言,用于全局配置,可以是'en-US'或'zh-CN'\n */\n lang?: Langs;\n /**\n * **EN:** Default title of the confirm dialog, used for global configuration, can be normal text\n * or the key of localized resources, the key of localized resources will be converted into\n * localized text through the `localize` method\n *\n * **CN:** 确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultConfirmTitle?: ReactNode;\n /**\n * **EN:** Default content of the confirm dialog, used for global configuration, can be normal\n * text or the key of localized resources, the key of localized resources will be converted into\n * localized text through the `localize` method\n *\n * **CN:** 确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultConfirmContent?: ReactNode;\n\n /**\n * **EN:** Default title of the deletion confirmation dialog, used for global configuration, can\n * be normal text or the key of localized resources, the key of localized resources will be\n * converted into localized text through the `localize` method\n *\n * **CN:** 删除确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultDeletionConfirmTitle?: ReactNode;\n\n /**\n * **EN:** Default content of the deletion confirmation dialog, used for global configuration, can\n * be normal text or the key of localized resources, the key of localized resources will be\n * converted into localized text through the `localize` method\n *\n * **CN:** 删除确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultDeletionConfirmContent?: ReactNode;\n\n // /** 获取本地化文本 */\n /**\n * **EN:** Get localized text\n *\n * **CN:** 获取本地化文本\n *\n * @param key Normal text or key of local resource | 普通文本或本地资源的键值\n * @param args Parameters of the localized text | 本地化文本的参数\n *\n * @returns Localized text | 本地化文本\n */\n localize?: <T>(key: T, args?: Record<string, unknown>) => ReactNode;\n}\n\nexport const defaultContextValue: ReactEasyContextProps = {\n lang: 'en',\n};\n\nconst ReactEasyContext = createContext<ReactEasyContextProps>(defaultContextValue);\n\nexport default ReactEasyContext;\n"],"mappings":"AAAA,SAASA,aAAa,QAAwB,OAAO;AA2DrD,OAAO,IAAMC,mBAA0C,GAAG;EACxDC,IAAI,EAAE;AACR,CAAC;AAED,IAAMC,gBAAgB,gBAAGH,aAAa,CAAwBC,mBAAmB,CAAC;AAElF,eAAeE,gBAAgB"}
1
+ {"version":3,"names":["createContext","defaultContextValue","lang","ReactEasyContext"],"sources":["../../../src/components/ConfigProvider/context.tsx"],"sourcesContent":["import { createContext, type ReactNode } from 'react';\nimport type { Langs } from '../../locales';\n\nexport interface ReactEasyContextProps {\n /**\n * - **EN:** Language of the component, used for global configuration, can be 'en-US' or 'zh-CN'\n * - **CN:** 组件的语言,用于全局配置,可以是'en-US'或'zh-CN'\n */\n lang?: Langs;\n /**\n * - **EN:** Default title of the confirm dialog, used for global configuration, can be normal text\n * or the key of localized resources, the key of localized resources will be converted into\n * localized text through the `localize` method\n * - **CN:** 确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultConfirmTitle?: ReactNode;\n /**\n * - **EN:** Default content of the confirm dialog, used for global configuration, can be normal\n * text or the key of localized resources, the key of localized resources will be converted into\n * localized text through the `localize` method\n * - **CN:** 确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultConfirmContent?: ReactNode;\n\n /**\n * - **EN:** Default title of the deletion confirmation dialog, used for global configuration, can\n * be normal text or the key of localized resources, the key of localized resources will be\n * converted into localized text through the `localize` method\n * - **CN:** 删除确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultDeletionConfirmTitle?: ReactNode;\n\n /**\n * - **EN:** Default content of the deletion confirmation dialog, used for global configuration, can\n * be normal text or the key of localized resources, the key of localized resources will be\n * converted into localized text through the `localize` method\n * - **CN:** 删除确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本\n */\n defaultDeletionConfirmContent?: ReactNode;\n\n /**\n * - **EN:** Get localized text\n * - **CN:** 获取本地化文本\n *\n * @param key Normal text or key of local resource | 普通文本或本地资源的键值\n * @param args Parameters of the localized text | 本地化文本的参数\n *\n * @returns Localized text | 本地化文本\n */\n localize?: <T>(key: T, args?: Record<string, unknown>) => ReactNode;\n}\n\nexport const defaultContextValue: ReactEasyContextProps = {\n lang: 'en',\n};\n\nconst ReactEasyContext = createContext<ReactEasyContextProps>(defaultContextValue);\n\nexport default ReactEasyContext;\n"],"mappings":"AAAA,SAASA,aAAa,QAAwB,OAAO;AAoDrD,OAAO,IAAMC,mBAA0C,GAAG;EACxDC,IAAI,EAAE;AACR,CAAC;AAED,IAAMC,gBAAgB,gBAAGH,aAAa,CAAwBC,mBAAmB,CAAC;AAElF,eAAeE,gBAAgB"}
@@ -3,18 +3,16 @@ import type localesEn from '../../locales/langs/en';
3
3
  import { type ReactEasyContextProps } from './context';
4
4
  export interface ConfigProviderProps extends ReactEasyContextProps {
5
5
  /**
6
- * **EN:** Custom localization resources, if `lang` exists, it will override the localization
7
- * resources of that language, otherwise, it will add a new language
8
- *
9
- * **CN:** 自定义本地化资源,如果`lang`存在,则会覆盖该语言的本地化资源,否则,会添加一种新的语言
6
+ * - **EN:** Custom localization resources, if `lang` exists, it will override the localization
7
+ * resources of that language, otherwise, it will add a new language
8
+ * - **CN:** 自定义本地化资源,如果`lang`存在,则会覆盖该语言的本地化资源,否则,会添加一种新的语言
10
9
  */
11
10
  locales?: Partial<typeof localesEn>;
12
11
  children: ReactNode;
13
12
  }
14
13
  /**
15
- * **EN:** Provide global configuration for AntdHelper
16
- *
17
- * **CN:** 提供AntdHelper的全局配置
14
+ * - **EN:** Provide global configuration for AntdHelper
15
+ * - **CN:** 提供AntdHelper的全局配置
18
16
  */
19
17
  declare const ConfigProvider: FC<ConfigProviderProps>;
20
18
  export default ConfigProvider;
@@ -12,9 +12,8 @@ import locales, { langs, resources } from "../../locales";
12
12
  import ReactEasyContext from "./context";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  /**
15
- * **EN:** Provide global configuration for AntdHelper
16
- *
17
- * **CN:** 提供AntdHelper的全局配置
15
+ * - **EN:** Provide global configuration for AntdHelper
16
+ * - **CN:** 提供AntdHelper的全局配置
18
17
  */
19
18
  var ConfigProvider = function ConfigProvider(props) {
20
19
  var children = props.children,
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","locales","langs","resources","ReactEasyContext","jsx","_jsx","ConfigProvider","props","children","userLocales","restProps","_objectWithoutProperties","_excluded","langInProps","lang","includes","removeResourceBundle","addResourceBundle","_objectSpread","translation","en","changeLanguage","Provider","value"],"sources":["../../../src/components/ConfigProvider/index.tsx"],"sourcesContent":["import { type FC, type ReactNode, useEffect } from 'react';\nimport locales, { langs, resources } from '../../locales';\nimport type localesEn from '../../locales/langs/en';\nimport ReactEasyContext, { type ReactEasyContextProps } from './context';\n\nexport interface ConfigProviderProps extends ReactEasyContextProps {\n /**\n * **EN:** Custom localization resources, if `lang` exists, it will override the localization\n * resources of that language, otherwise, it will add a new language\n *\n * **CN:** 自定义本地化资源,如果`lang`存在,则会覆盖该语言的本地化资源,否则,会添加一种新的语言\n */\n locales?: Partial<typeof localesEn>;\n children: ReactNode;\n}\n\n/**\n * **EN:** Provide global configuration for AntdHelper\n *\n * **CN:** 提供AntdHelper的全局配置\n */\nconst ConfigProvider: FC<ConfigProviderProps> = (props) => {\n const { children, locales: userLocales, ...restProps } = props;\n const { lang: langInProps } = restProps;\n\n useEffect(() => {\n // Dynamically add language pack\n if (userLocales) {\n const lang = langInProps || 'en';\n if (lang && langs.includes(lang)) {\n locales.removeResourceBundle(lang, 'translation');\n locales.addResourceBundle(lang, 'translation', { ...resources[lang].translation, ...userLocales });\n } else {\n locales.addResourceBundle(lang, 'translation', { ...resources.en.translation, ...userLocales });\n }\n }\n }, [langInProps, userLocales]);\n\n useEffect(() => {\n // Set the language of the component\n locales.changeLanguage(langInProps || 'en');\n }, [langInProps]);\n\n return <ReactEasyContext.Provider value={restProps}>{children}</ReactEasyContext.Provider>;\n};\n\nexport default ConfigProvider;\n"],"mappings":";;;;;;;;;AAAA,SAAkCA,SAAS,QAAQ,OAAO;AAC1D,OAAOC,OAAO,IAAIC,KAAK,EAAEC,SAAS;AAElC,OAAOC,gBAAgB;AAAkD,SAAAC,GAAA,IAAAC,IAAA;AAazE;AACA;AACA;AACA;AACA;AACA,IAAMC,cAAuC,GAAG,SAA1CA,cAAuCA,CAAIC,KAAK,EAAK;EACzD,IAAQC,QAAQ,GAAyCD,KAAK,CAAtDC,QAAQ;IAAWC,WAAW,GAAmBF,KAAK,CAA5CP,OAAO;IAAkBU,SAAS,GAAAC,wBAAA,CAAKJ,KAAK,EAAAK,SAAA;EAC9D,IAAcC,WAAW,GAAKH,SAAS,CAA/BI,IAAI;EAEZf,SAAS,CAAC,YAAM;IACd;IACA,IAAIU,WAAW,EAAE;MACf,IAAMK,IAAI,GAAGD,WAAW,IAAI,IAAI;MAChC,IAAIC,IAAI,IAAIb,KAAK,CAACc,QAAQ,CAACD,IAAI,CAAC,EAAE;QAChCd,OAAO,CAACgB,oBAAoB,CAACF,IAAI,EAAE,aAAa,CAAC;QACjDd,OAAO,CAACiB,iBAAiB,CAACH,IAAI,EAAE,aAAa,EAAAI,aAAA,CAAAA,aAAA,KAAOhB,SAAS,CAACY,IAAI,CAAC,CAACK,WAAW,GAAKV,WAAW,CAAE,CAAC;MACpG,CAAC,MAAM;QACLT,OAAO,CAACiB,iBAAiB,CAACH,IAAI,EAAE,aAAa,EAAAI,aAAA,CAAAA,aAAA,KAAOhB,SAAS,CAACkB,EAAE,CAACD,WAAW,GAAKV,WAAW,CAAE,CAAC;MACjG;IACF;EACF,CAAC,EAAE,CAACI,WAAW,EAAEJ,WAAW,CAAC,CAAC;EAE9BV,SAAS,CAAC,YAAM;IACd;IACAC,OAAO,CAACqB,cAAc,CAACR,WAAW,IAAI,IAAI,CAAC;EAC7C,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAEjB,oBAAOR,IAAA,CAACF,gBAAgB,CAACmB,QAAQ;IAACC,KAAK,EAAEb,SAAU;IAAAF,QAAA,EAAEA;EAAQ,CAA4B,CAAC;AAC5F,CAAC;AAED,eAAeF,cAAc"}
1
+ {"version":3,"names":["useEffect","locales","langs","resources","ReactEasyContext","jsx","_jsx","ConfigProvider","props","children","userLocales","restProps","_objectWithoutProperties","_excluded","langInProps","lang","includes","removeResourceBundle","addResourceBundle","_objectSpread","translation","en","changeLanguage","Provider","value"],"sources":["../../../src/components/ConfigProvider/index.tsx"],"sourcesContent":["import { type FC, type ReactNode, useEffect } from 'react';\nimport locales, { langs, resources } from '../../locales';\nimport type localesEn from '../../locales/langs/en';\nimport ReactEasyContext, { type ReactEasyContextProps } from './context';\n\nexport interface ConfigProviderProps extends ReactEasyContextProps {\n /**\n * - **EN:** Custom localization resources, if `lang` exists, it will override the localization\n * resources of that language, otherwise, it will add a new language\n * - **CN:** 自定义本地化资源,如果`lang`存在,则会覆盖该语言的本地化资源,否则,会添加一种新的语言\n */\n locales?: Partial<typeof localesEn>;\n children: ReactNode;\n}\n\n/**\n * - **EN:** Provide global configuration for AntdHelper\n * - **CN:** 提供AntdHelper的全局配置\n */\nconst ConfigProvider: FC<ConfigProviderProps> = (props) => {\n const { children, locales: userLocales, ...restProps } = props;\n const { lang: langInProps } = restProps;\n\n useEffect(() => {\n // Dynamically add language pack\n if (userLocales) {\n const lang = langInProps || 'en';\n if (lang && langs.includes(lang)) {\n locales.removeResourceBundle(lang, 'translation');\n locales.addResourceBundle(lang, 'translation', { ...resources[lang].translation, ...userLocales });\n } else {\n locales.addResourceBundle(lang, 'translation', { ...resources.en.translation, ...userLocales });\n }\n }\n }, [langInProps, userLocales]);\n\n useEffect(() => {\n // Set the language of the component\n locales.changeLanguage(langInProps || 'en');\n }, [langInProps]);\n\n return <ReactEasyContext.Provider value={restProps}>{children}</ReactEasyContext.Provider>;\n};\n\nexport default ConfigProvider;\n"],"mappings":";;;;;;;;;AAAA,SAAkCA,SAAS,QAAQ,OAAO;AAC1D,OAAOC,OAAO,IAAIC,KAAK,EAAEC,SAAS;AAElC,OAAOC,gBAAgB;AAAkD,SAAAC,GAAA,IAAAC,IAAA;AAYzE;AACA;AACA;AACA;AACA,IAAMC,cAAuC,GAAG,SAA1CA,cAAuCA,CAAIC,KAAK,EAAK;EACzD,IAAQC,QAAQ,GAAyCD,KAAK,CAAtDC,QAAQ;IAAWC,WAAW,GAAmBF,KAAK,CAA5CP,OAAO;IAAkBU,SAAS,GAAAC,wBAAA,CAAKJ,KAAK,EAAAK,SAAA;EAC9D,IAAcC,WAAW,GAAKH,SAAS,CAA/BI,IAAI;EAEZf,SAAS,CAAC,YAAM;IACd;IACA,IAAIU,WAAW,EAAE;MACf,IAAMK,IAAI,GAAGD,WAAW,IAAI,IAAI;MAChC,IAAIC,IAAI,IAAIb,KAAK,CAACc,QAAQ,CAACD,IAAI,CAAC,EAAE;QAChCd,OAAO,CAACgB,oBAAoB,CAACF,IAAI,EAAE,aAAa,CAAC;QACjDd,OAAO,CAACiB,iBAAiB,CAACH,IAAI,EAAE,aAAa,EAAAI,aAAA,CAAAA,aAAA,KAAOhB,SAAS,CAACY,IAAI,CAAC,CAACK,WAAW,GAAKV,WAAW,CAAE,CAAC;MACpG,CAAC,MAAM;QACLT,OAAO,CAACiB,iBAAiB,CAACH,IAAI,EAAE,aAAa,EAAAI,aAAA,CAAAA,aAAA,KAAOhB,SAAS,CAACkB,EAAE,CAACD,WAAW,GAAKV,WAAW,CAAE,CAAC;MACjG;IACF;EACF,CAAC,EAAE,CAACI,WAAW,EAAEJ,WAAW,CAAC,CAAC;EAE9BV,SAAS,CAAC,YAAM;IACd;IACAC,OAAO,CAACqB,cAAc,CAACR,WAAW,IAAI,IAAI,CAAC;EAC7C,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAEjB,oBAAOR,IAAA,CAACF,gBAAgB,CAACmB,QAAQ;IAACC,KAAK,EAAEb,SAAU;IAAAF,QAAA,EAAEA;EAAQ,CAA4B,CAAC;AAC5F,CAAC;AAED,eAAeF,cAAc"}
@@ -6,91 +6,76 @@ import type { LinkProps } from 'antd/es/typography/Link';
6
6
  import type { TextProps } from 'antd/es/typography/Text';
7
7
  export type ConfirmActionProps<TP extends object, E extends keyof TP> = Omit<ModalFuncProps, 'onOk'> & ConfirmActionTrigger<TP, E> & {
8
8
  /**
9
- * **EN:** Whether to display in red danger mode, which will automatically affect the color of
10
- * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the
11
- * defaults is `true`.
12
- *
9
+ * - **EN:** Whether to display in red danger mode, which will automatically affect the color of
10
+ * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the
11
+ * defaults is `true`.
13
12
  * - You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override
14
- *
15
- * **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。
16
- *
13
+ * - **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。
17
14
  * - 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖
18
15
  */
19
16
  danger?: boolean;
20
17
  /**
21
- * **EN:** The color of confirm box title, default is `warning`
22
- *
23
- * **CN:** 弹框标题颜色,默认`warning`
18
+ * - **EN:** The color of confirm box title, default is `warning`
19
+ * - **CN:** 弹框标题颜色,默认`warning`
24
20
  */
25
21
  titleColor?: TextProps['type'] | 'primary';
26
22
  /**
27
- * **EN:** The color of confirm box content
28
- *
29
- * **CN:** 弹框内容文本颜色
23
+ * - **EN:** The color of confirm box content
24
+ * - **CN:** 弹框内容文本颜色
30
25
  */
31
26
  contentColor?: TextProps['type'] | 'primary';
32
27
  /**
33
- * **EN:** The color of confirm box title icon, default is the same as `titleColor`
34
- *
35
- * **CN:** 弹框标题图标颜色,默认与`titleColor`相同
28
+ * - **EN:** The color of confirm box title icon, default is the same as `titleColor`
29
+ * - **CN:** 弹框标题图标颜色,默认与`titleColor`相同
36
30
  */
37
31
  iconColor?: TextProps['type'] | 'primary';
38
32
  /**
39
- * **EN:** Callback when click confirm button
40
- *
41
- * **CN:** 点击确认按钮的回调
33
+ * - **EN:** Callback when click confirm button
34
+ * - **CN:** 点击确认按钮的回调
42
35
  */
43
36
  onOk?: (...args: Parameters<TP[E]>) => unknown | Promise<unknown>;
44
37
  /**
45
- * **EN:** Callback after confirm event, won't trigger if failed, the argument is the return
46
- * value of `onOk`
47
- *
48
- * **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
38
+ * - **EN:** Callback after confirm event, won't trigger if failed, the argument is the return
39
+ * value of `onOk`
40
+ * - **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
49
41
  */
50
42
  afterOk?: (data?: any) => void;
51
43
  };
52
44
  export interface ConfirmActionTrigger<TP extends object, E extends keyof TP> {
53
45
  /**
54
- * **EN:** Trigger component, trigger to show confirm box
55
- *
56
- * **CN:** 触发器组件,触发显示确认弹框
46
+ * - **EN:** Trigger component, trigger to show confirm box
47
+ * - **CN:** 触发器组件,触发显示确认弹框
57
48
  */
58
49
  triggerComponent?: ComponentType<TP>;
59
50
  /**
60
- * **EN:** Props of trigger component
61
- *
62
- * **CN:** 触发器组件的Props属性
51
+ * - **EN:** Props of trigger component
52
+ * - **CN:** 触发器组件的Props属性
63
53
  */
64
54
  triggerProps?: TP;
65
55
  /**
66
- * **EN:** The event name that triggers the dialog
67
- *
68
- * **CN:** 触发弹窗的事件名称
69
- *
56
+ * - **EN:** The event name that triggers the dialog
57
+ * - **CN:** 触发弹窗的事件名称
70
58
  * - `Button`: 'onClick'
71
59
  * - `Switch`: 'onChange'
72
60
  * - `Link`: 'onClick'
73
61
  */
74
62
  triggerEvent?: E;
75
63
  /**
76
- * **EN:** Custom trigger content
77
- *
78
- * **CN:** 自定义触发器内容
64
+ * - **EN:** Custom trigger content
65
+ * - **CN:** 自定义触发器内容
79
66
  */
80
67
  children?: ReactNode;
81
68
  }
82
69
  export type ConfirmActionRef = ReturnType<typeof confirm> & {
83
70
  /**
84
- * **EN:** Show confirm box
85
- *
86
- * **CN:** 显示确认弹框
71
+ * - **EN:** Show confirm box
72
+ * - **CN:** 显示确认弹框
87
73
  */
88
74
  show: (props?: Parameters<ModalFunc>[0]) => ReturnType<ModalFunc>;
89
75
  };
90
76
  /**
91
- * **EN:** Generate a confirm box component
92
- *
93
- * **CN:** 生成一个确认弹框组件
77
+ * - **EN:** Generate a confirm box component
78
+ * - **CN:** 生成一个确认弹框组件
94
79
  *
95
80
  * @param defaultProps Default props | 默认属性
96
81
  *
@@ -103,100 +88,92 @@ export declare const genRenderer: (defaultProps: Partial<ConfirmActionProps<any,
103
88
  displayName: string;
104
89
  };
105
90
  /**
106
- * **EN:** Add default properties to the ConfirmAction component
107
- *
108
- * **CN:** 给ConfirmAction组件添加默认属性
91
+ * - **EN:** Add default properties to the ConfirmAction component
92
+ * - **CN:** 给ConfirmAction组件添加默认属性
109
93
  *
110
94
  * @param WrappedComponent ConfirmAction component | ConfirmAction组件
111
95
  * @param defaultProps Default properties | 默认属性
112
96
  */
113
97
  export declare const withDefaultConfirmActionProps: <TP extends object, E extends keyof TP>(WrappedComponent: ComponentType<PropsWithoutRef<ConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>>, defaultProps?: Partial<ConfirmActionProps<TP, E>>) => import("react").ForwardRefExoticComponent<Omit<ModalFuncProps, "onOk"> & ConfirmActionTrigger<TP, E> & {
114
98
  /**
115
- * **EN:** Whether to display in red danger mode, which will automatically affect the color of
116
- * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the
117
- * defaults is `true`.
118
- *
99
+ * - **EN:** Whether to display in red danger mode, which will automatically affect the color of
100
+ * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the
101
+ * defaults is `true`.
119
102
  * - You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override
120
- *
121
- * **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。
122
- *
103
+ * - **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。
123
104
  * - 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖
124
105
  */
125
106
  danger?: boolean | undefined;
126
107
  /**
127
- * **EN:** The color of confirm box title, default is `warning`
128
- *
129
- * **CN:** 弹框标题颜色,默认`warning`
108
+ * - **EN:** The color of confirm box title, default is `warning`
109
+ * - **CN:** 弹框标题颜色,默认`warning`
130
110
  */
131
111
  titleColor?: TextProps['type'] | 'primary';
132
112
  /**
133
- * **EN:** The color of confirm box content
134
- *
135
- * **CN:** 弹框内容文本颜色
113
+ * - **EN:** The color of confirm box content
114
+ * - **CN:** 弹框内容文本颜色
136
115
  */
137
116
  contentColor?: TextProps['type'] | 'primary';
138
117
  /**
139
- * **EN:** The color of confirm box title icon, default is the same as `titleColor`
140
- *
141
- * **CN:** 弹框标题图标颜色,默认与`titleColor`相同
118
+ * - **EN:** The color of confirm box title icon, default is the same as `titleColor`
119
+ * - **CN:** 弹框标题图标颜色,默认与`titleColor`相同
142
120
  */
143
121
  iconColor?: TextProps['type'] | 'primary';
144
122
  /**
145
- * **EN:** Callback when click confirm button
146
- *
147
- * **CN:** 点击确认按钮的回调
123
+ * - **EN:** Callback when click confirm button
124
+ * - **CN:** 点击确认按钮的回调
148
125
  */
149
126
  onOk?: ((...args: Parameters<TP[E]>) => unknown | Promise<unknown>) | undefined;
150
127
  /**
151
- * **EN:** Callback after confirm event, won't trigger if failed, the argument is the return
152
- * value of `onOk`
153
- *
154
- * **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
128
+ * - **EN:** Callback after confirm event, won't trigger if failed, the argument is the return
129
+ * value of `onOk`
130
+ * - **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
155
131
  */
156
132
  afterOk?: ((data?: any) => void) | undefined;
157
133
  } & RefAttributes<ConfirmActionRef>>;
158
134
  /**
159
- * **EN:** Interface of generic type component
160
- *
161
- * **CN:** 泛型组件的接口
135
+ * - **EN:** Interface of generic type component
136
+ * - **CN:** 泛型组件的接口
162
137
  */
163
138
  export type GenericConfirmActionInterface = <TP extends object, E extends keyof TP>(props: PropsWithoutRef<TypedConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>) => ReactElement;
164
139
  /**
165
- * **EN:** Interface of specific type component
166
- *
167
- * **CN:** 具体类型组件的接口
140
+ * - **EN:** Interface of specific type component
141
+ * - **CN:** 具体类型组件的接口
168
142
  */
169
143
  export type TypedConfirmActionInterface<TP extends object, E extends keyof TP> = ComponentType<PropsWithoutRef<TypedConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>>;
170
144
  /**
171
- * **EN:** Props definition of specific type component
172
- *
173
- * **CN:** 具体类型组件的Props定义
145
+ * - **EN:** Props definition of specific type component
146
+ * - **CN:** 具体类型组件的Props定义
174
147
  */
175
148
  type TypedConfirmActionProps<TP extends object, E extends keyof TP> = Omit<ConfirmActionProps<TP, E>, 'triggerComponent' | 'triggerEvent'>;
176
149
  export type ConfirmActionWithStatic = GenericConfirmActionInterface & {
177
150
  /**
178
- * **EN:** Confirm box with button trigger
179
- *
180
- * **CN:** 按钮类型的确认框
151
+ * - **EN:** Confirm box with button trigger
152
+ * - **CN:** 按钮类型的确认框
181
153
  */
182
154
  Button: TypedConfirmActionInterface<ButtonProps, 'onClick'>;
183
155
  /**
184
- * **EN:** Confirm box with switch trigger
185
- *
186
- * **CN:** 开关类型的确认框
156
+ * - **EN:** Confirm box with switch trigger
157
+ * - **CN:** 开关类型的确认框
187
158
  */
188
159
  Switch: TypedConfirmActionInterface<SwitchProps, 'onChange'>;
189
160
  /**
190
- * **EN:** Confirm box with link trigger
191
- *
192
- * **CN:** 链接类型的确认框
161
+ * - **EN:** Confirm box with link trigger
162
+ * - **CN:** 链接类型的确认框
193
163
  */
194
164
  Link: TypedConfirmActionInterface<LinkProps, 'onClick'>;
195
165
  };
196
166
  /**
197
- * **EN:** Confirm box component with trigger
198
- *
199
- * **CN:** 带触发器的确认框组件
167
+ * - **EN:** Confirm box component with trigger
168
+ * - **CN:** 带触发器的确认框组件
200
169
  */
201
170
  declare const ConfirmAction: ConfirmActionWithStatic;
171
+ /**
172
+ * - **EN:** Generate a confirm box component with custom trigger and default props
173
+ * - **CN:** 基于自定义触发器和默认属性生成一个确认弹框组件
174
+ *
175
+ * @param actionComponent Custom trigger component | 自定义触发器组件
176
+ * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性
177
+ */
178
+ export declare function withConfirmAction<TP extends object, E extends keyof TP>(actionComponent: ComponentType<TP>, defaultProps?: Partial<ConfirmActionProps<TP, E>> | (() => Partial<ConfirmActionProps<TP, E>>)): ComponentType<Omit<ConfirmActionProps<TP, E>, "triggerComponent"> & RefAttributes<ConfirmActionRef>>;
202
179
  export default ConfirmAction;
@@ -30,9 +30,8 @@ import useRefFunction from "../../hooks/useRefFunction";
30
30
  import ReactEasyContext from "../ConfigProvider/context";
31
31
  import { jsx as _jsx } from "react/jsx-runtime";
32
32
  /**
33
- * **EN:** Generate a confirm box component
34
- *
35
- * **CN:** 生成一个确认弹框组件
33
+ * - **EN:** Generate a confirm box component
34
+ * - **CN:** 生成一个确认弹框组件
36
35
  *
37
36
  * @param defaultProps Default props | 默认属性
38
37
  *
@@ -205,9 +204,8 @@ export var genRenderer = function genRenderer(defaultProps) {
205
204
  };
206
205
 
207
206
  /**
208
- * **EN:** Add default properties to the ConfirmAction component
209
- *
210
- * **CN:** 给ConfirmAction组件添加默认属性
207
+ * - **EN:** Add default properties to the ConfirmAction component
208
+ * - **CN:** 给ConfirmAction组件添加默认属性
211
209
  *
212
210
  * @param WrappedComponent ConfirmAction component | ConfirmAction组件
213
211
  * @param defaultProps Default properties | 默认属性
@@ -231,27 +229,23 @@ var forwarded = /*#__PURE__*/forwardRef(renderConfirmAction);
231
229
  forwarded.displayName = 'ForwardedRef(ConfirmAction)';
232
230
 
233
231
  /**
234
- * **EN:** Interface of generic type component
235
- *
236
- * **CN:** 泛型组件的接口
232
+ * - **EN:** Interface of generic type component
233
+ * - **CN:** 泛型组件的接口
237
234
  */
238
235
 
239
236
  /**
240
- * **EN:** Interface of specific type component
241
- *
242
- * **CN:** 具体类型组件的接口
237
+ * - **EN:** Interface of specific type component
238
+ * - **CN:** 具体类型组件的接口
243
239
  */
244
240
 
245
241
  /**
246
- * **EN:** Props definition of specific type component
247
- *
248
- * **CN:** 具体类型组件的Props定义
242
+ * - **EN:** Props definition of specific type component
243
+ * - **CN:** 具体类型组件的Props定义
249
244
  */
250
245
 
251
246
  /**
252
- * **EN:** Confirm box component with trigger
253
- *
254
- * **CN:** 带触发器的确认框组件
247
+ * - **EN:** Confirm box component with trigger
248
+ * - **CN:** 带触发器的确认框组件
255
249
  */
256
250
  var ConfirmAction = forwarded;
257
251
  // Type of button
@@ -279,5 +273,20 @@ ConfirmAction.Link = withDefaultConfirmActionProps(forwarded, {
279
273
  }
280
274
  }
281
275
  });
276
+
277
+ // todo: 实现hoc
278
+ /**
279
+ * - **EN:** Generate a confirm box component with custom trigger and default props
280
+ * - **CN:** 基于自定义触发器和默认属性生成一个确认弹框组件
281
+ *
282
+ * @param actionComponent Custom trigger component | 自定义触发器组件
283
+ * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性
284
+ */
285
+ export function withConfirmAction(actionComponent, defaultProps) {
286
+ var withTrigger = withDefaultConfirmActionProps(forwarded, _objectSpread({
287
+ triggerComponent: actionComponent
288
+ }, typeof defaultProps === 'function' ? defaultProps() : defaultProps));
289
+ return withTrigger;
290
+ }
282
291
  export default ConfirmAction;
283
292
  //# sourceMappingURL=index.js.map