@tiny-codes/react-easy 1.6.3 → 1.6.5

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 (34) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/es/components/ConfigProvider/index.js +3 -2
  3. package/es/components/ConfigProvider/index.js.map +1 -1
  4. package/es/components/ConfigProvider/style/index.js +9 -72
  5. package/es/components/ConfigProvider/style/index.js.map +1 -1
  6. package/es/components/OverflowTags/index.d.ts +11 -13
  7. package/es/components/OverflowTags/index.js +25 -15
  8. package/es/components/OverflowTags/index.js.map +1 -1
  9. package/es/hooks/useValidatorBuilder.js +3 -1
  10. package/es/hooks/useValidatorBuilder.js.map +1 -1
  11. package/es/locales/index.d.ts +6 -0
  12. package/es/locales/langs/en-US.d.ts +2 -0
  13. package/es/locales/langs/en-US.js +2 -0
  14. package/es/locales/langs/en-US.js.map +1 -1
  15. package/es/locales/langs/zh-CN.d.ts +2 -0
  16. package/es/locales/langs/zh-CN.js +2 -0
  17. package/es/locales/langs/zh-CN.js.map +1 -1
  18. package/lib/components/ConfigProvider/index.js +2 -2
  19. package/lib/components/ConfigProvider/index.js.map +2 -2
  20. package/lib/components/ConfigProvider/style/index.js +15 -5
  21. package/lib/components/ConfigProvider/style/index.js.map +2 -2
  22. package/lib/components/OverflowTags/index.d.ts +11 -13
  23. package/lib/components/OverflowTags/index.js +22 -10
  24. package/lib/components/OverflowTags/index.js.map +2 -2
  25. package/lib/hooks/useValidatorBuilder.js +5 -1
  26. package/lib/hooks/useValidatorBuilder.js.map +2 -2
  27. package/lib/locales/index.d.ts +6 -0
  28. package/lib/locales/langs/en-US.d.ts +2 -0
  29. package/lib/locales/langs/en-US.js +2 -0
  30. package/lib/locales/langs/en-US.js.map +2 -2
  31. package/lib/locales/langs/zh-CN.d.ts +2 -0
  32. package/lib/locales/langs/zh-CN.js +2 -0
  33. package/lib/locales/langs/zh-CN.js.map +2 -2
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,9 +2,29 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## 1.6.5
6
+
7
+ 2026-2-4
8
+
9
+ ### Features
10
+
11
+ - **useValidatorBuilder**
12
+ - ✨ Improve `useValidatorBuilder` for better format of special characters in validation messages.
13
+ - **OverflowTags**
14
+ - ✨ Enhance `tagProps` and `ellipsisTagProps` to provide more context in the function parameters.
15
+ - ✨ Support any data types
16
+
17
+ ## 1.6.4
18
+
19
+ 2026-1-15
20
+
21
+ ### Features
22
+
23
+ - 🛠️ improve `easy-full-height-table` class styles
24
+
5
25
  ## 1.6.3
6
26
 
7
- 2026-1-2
27
+ 2026-1-7
8
28
 
9
29
  ### Features
10
30
 
@@ -16,6 +36,15 @@
16
36
 
17
37
  - 🐞 Fix Tooltip not accepting custom `ellipsis.tooltip` props issue.
18
38
 
39
+ ## 1.6.2
40
+
41
+ 2026-1-2
42
+
43
+ ### Features
44
+
45
+ - **withEllipsisTypography**
46
+ - 🛠️ accept custom `ellipsis.tooltip` props.
47
+
19
48
  ## 1.6.1
20
49
 
21
50
  2026-1-1
@@ -33,9 +33,10 @@ var ConfigProvider = function ConfigProvider(props) {
33
33
  restProps = _objectWithoutProperties(props, _excluded);
34
34
  var langInProps = restProps.lang;
35
35
  var _useContext = useContext(ReactConfigProvider.ConfigContext),
36
- getPrefixCls = _useContext.getPrefixCls;
36
+ getPrefixCls = _useContext.getPrefixCls,
37
+ rootPrefixCls = _useContext.rootPrefixCls;
37
38
  var prefixCls = getPrefixCls('react-easy', prefixClsInProps);
38
- var _useStyle = useStyle(prefixCls),
39
+ var _useStyle = useStyle(prefixCls, rootPrefixCls),
39
40
  _useStyle2 = _slicedToArray(_useStyle, 3),
40
41
  wrapCSSVar = _useStyle2[0],
41
42
  hashId = _useStyle2[1],
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useEffect","ConfigProvider","ReactConfigProvider","classNames","locales","langs","resources","ReactEasyContext","useStyle","jsx","_jsx","props","children","userLocales","prefixClsInProps","prefixCls","className","style","restProps","_objectWithoutProperties","_excluded","langInProps","lang","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","includes","removeResourceBundle","addResourceBundle","_objectSpread","translation","en","changeLanguage","Provider","value","displayName"],"sources":["../../../src/components/ConfigProvider/index.tsx"],"sourcesContent":["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect } from 'react';\nimport { ConfigProvider as ReactConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport locales, { langs, resources } from '../../locales';\nimport type localesEn from '../../locales/langs/en';\nimport ReactEasyContext, { type ReactEasyContextProps } from './context';\nimport useStyle from './style';\n\nexport interface ConfigProviderProps extends ReactEasyContextProps {\n prefixCls?: string;\n className?: string;\n style?: CSSProperties;\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, prefixCls: prefixClsInProps, className, style, ...restProps } = props;\n const { lang: langInProps } = restProps;\n const { getPrefixCls } = useContext(ReactConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('react-easy', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\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 wrapCSSVar(\n <ReactEasyContext.Provider value={restProps}>\n <div className={classNames(hashId, cssVarCls, prefixCls, className)} style={style}>\n {children}\n </div>\n </ReactEasyContext.Provider>\n );\n};\nConfigProvider.displayName = 'ReactEasyConfigProvider';\n\nexport default ConfigProvider;\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,cAAc,IAAIC,mBAAmB,QAAQ,MAAM;AAC5D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,IAAIC,KAAK,EAAEC,SAAS;AAElC,OAAOC,gBAAgB;AACvB,OAAOC,QAAQ;AAAgB,SAAAC,GAAA,IAAAC,IAAA;AAe/B;AACA;AACA;AACA;AACA,IAAMT,cAAuC,GAAG,SAA1CA,cAAuCA,CAAIU,KAAK,EAAK;EACzD,IAAQC,QAAQ,GAAwFD,KAAK,CAArGC,QAAQ;IAAWC,WAAW,GAAkEF,KAAK,CAA3FP,OAAO;IAA0BU,gBAAgB,GAAqCH,KAAK,CAArEI,SAAS;IAAoBC,SAAS,GAA0BL,KAAK,CAAxCK,SAAS;IAAEC,KAAK,GAAmBN,KAAK,CAA7BM,KAAK;IAAKC,SAAS,GAAAC,wBAAA,CAAKR,KAAK,EAAAS,SAAA;EAC7G,IAAcC,WAAW,GAAKH,SAAS,CAA/BI,IAAI;EACZ,IAAAC,WAAA,GAAyBxB,UAAU,CAACG,mBAAmB,CAACsB,aAAa,CAAC;IAA9DC,YAAY,GAAAF,WAAA,CAAZE,YAAY;EACpB,IAAMV,SAAS,GAAGU,YAAY,CAAC,YAAY,EAAEX,gBAAgB,CAAC;EAC9D,IAAAY,SAAA,GAAwClB,QAAQ,CAACO,SAAS,CAAC;IAAAY,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAApDG,UAAU,GAAAF,UAAA;IAAEG,MAAM,GAAAH,UAAA;IAAEI,SAAS,GAAAJ,UAAA;EAEpC3B,SAAS,CAAC,YAAM;IACd;IACA,IAAIa,WAAW,EAAE;MACf,IAAMS,IAAI,GAAGD,WAAW,IAAI,IAAI;MAChC,IAAIC,IAAI,IAAIjB,KAAK,CAAC2B,QAAQ,CAACV,IAAI,CAAC,EAAE;QAChClB,OAAO,CAAC6B,oBAAoB,CAACX,IAAI,EAAE,aAAa,CAAC;QACjDlB,OAAO,CAAC8B,iBAAiB,CAACZ,IAAI,EAAE,aAAa,EAAAa,aAAA,CAAAA,aAAA,KAAO7B,SAAS,CAACgB,IAAI,CAAC,CAACc,WAAW,GAAKvB,WAAW,CAAE,CAAC;MACpG,CAAC,MAAM;QACLT,OAAO,CAAC8B,iBAAiB,CAACZ,IAAI,EAAE,aAAa,EAAAa,aAAA,CAAAA,aAAA,KAAO7B,SAAS,CAAC+B,EAAE,CAACD,WAAW,GAAKvB,WAAW,CAAE,CAAC;MACjG;IACF;EACF,CAAC,EAAE,CAACQ,WAAW,EAAER,WAAW,CAAC,CAAC;EAE9Bb,SAAS,CAAC,YAAM;IACd;IACAI,OAAO,CAACkC,cAAc,CAACjB,WAAW,IAAI,IAAI,CAAC;EAC7C,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAEjB,OAAOQ,UAAU,eACfnB,IAAA,CAACH,gBAAgB,CAACgC,QAAQ;IAACC,KAAK,EAAEtB,SAAU;IAAAN,QAAA,eAC1CF,IAAA;MAAKM,SAAS,EAAEb,UAAU,CAAC2B,MAAM,EAAEC,SAAS,EAAEhB,SAAS,EAAEC,SAAS,CAAE;MAACC,KAAK,EAAEA,KAAM;MAAAL,QAAA,EAC/EA;IAAQ,CACN;EAAC,CACmB,CAC7B,CAAC;AACH,CAAC;AACDX,cAAc,CAACwC,WAAW,GAAG,yBAAyB;AAEtD,eAAexC,cAAc"}
1
+ {"version":3,"names":["useContext","useEffect","ConfigProvider","ReactConfigProvider","classNames","locales","langs","resources","ReactEasyContext","useStyle","jsx","_jsx","props","children","userLocales","prefixClsInProps","prefixCls","className","style","restProps","_objectWithoutProperties","_excluded","langInProps","lang","_useContext","ConfigContext","getPrefixCls","rootPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","includes","removeResourceBundle","addResourceBundle","_objectSpread","translation","en","changeLanguage","Provider","value","displayName"],"sources":["../../../src/components/ConfigProvider/index.tsx"],"sourcesContent":["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect } from 'react';\nimport { ConfigProvider as ReactConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport locales, { langs, resources } from '../../locales';\nimport type localesEn from '../../locales/langs/en';\nimport ReactEasyContext, { type ReactEasyContextProps } from './context';\nimport useStyle from './style';\n\nexport interface ConfigProviderProps extends ReactEasyContextProps {\n prefixCls?: string;\n className?: string;\n style?: CSSProperties;\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, prefixCls: prefixClsInProps, className, style, ...restProps } = props;\n const { lang: langInProps } = restProps;\n const { getPrefixCls, rootPrefixCls } = useContext(ReactConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('react-easy', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootPrefixCls);\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 wrapCSSVar(\n <ReactEasyContext.Provider value={restProps}>\n <div className={classNames(hashId, cssVarCls, prefixCls, className)} style={style}>\n {children}\n </div>\n </ReactEasyContext.Provider>\n );\n};\nConfigProvider.displayName = 'ReactEasyConfigProvider';\n\nexport default ConfigProvider;\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,cAAc,IAAIC,mBAAmB,QAAQ,MAAM;AAC5D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,IAAIC,KAAK,EAAEC,SAAS;AAElC,OAAOC,gBAAgB;AACvB,OAAOC,QAAQ;AAAgB,SAAAC,GAAA,IAAAC,IAAA;AAe/B;AACA;AACA;AACA;AACA,IAAMT,cAAuC,GAAG,SAA1CA,cAAuCA,CAAIU,KAAK,EAAK;EACzD,IAAQC,QAAQ,GAAwFD,KAAK,CAArGC,QAAQ;IAAWC,WAAW,GAAkEF,KAAK,CAA3FP,OAAO;IAA0BU,gBAAgB,GAAqCH,KAAK,CAArEI,SAAS;IAAoBC,SAAS,GAA0BL,KAAK,CAAxCK,SAAS;IAAEC,KAAK,GAAmBN,KAAK,CAA7BM,KAAK;IAAKC,SAAS,GAAAC,wBAAA,CAAKR,KAAK,EAAAS,SAAA;EAC7G,IAAcC,WAAW,GAAKH,SAAS,CAA/BI,IAAI;EACZ,IAAAC,WAAA,GAAwCxB,UAAU,CAACG,mBAAmB,CAACsB,aAAa,CAAC;IAA7EC,YAAY,GAAAF,WAAA,CAAZE,YAAY;IAAEC,aAAa,GAAAH,WAAA,CAAbG,aAAa;EACnC,IAAMX,SAAS,GAAGU,YAAY,CAAC,YAAY,EAAEX,gBAAgB,CAAC;EAC9D,IAAAa,SAAA,GAAwCnB,QAAQ,CAACO,SAAS,EAAEW,aAAa,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AAc"}
@@ -3,73 +3,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
3
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
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
5
  import { genStyleHooks } from 'antd/es/theme/internal';
6
- // .full-height-table(@fullHeight:true, @depth: 1) when(@depth <= 2) {
7
- // /* stylelint-disable-next-line function-no-unknown */
8
- // height: if((@fullHeight = true), 100%, auto);
9
-
10
- // .@{ant-prefix}-spin-nested-loading {
11
- // /* stylelint-disable-next-line function-no-unknown */
12
- // height: if((@fullHeight = true), 100%, auto);
13
-
14
- // .@{ant-prefix}-spin-container {
15
- // /* stylelint-disable-next-line function-no-unknown */
16
- // display: if((@fullHeight = true), flex, block);
17
- // flex-direction: column;
18
- // /* stylelint-disable-next-line function-no-unknown */
19
- // height: if((@fullHeight = true), 100%, auto);
20
-
21
- // .@{ant-prefix}-table:not(.@{ant-prefix}-table-empty) {
22
- // display: flex;
23
- // flex: auto;
24
- // flex-direction: column;
25
- // width: 100%;
26
- // min-height: 0;
27
-
28
- // .@{ant-prefix}-table-container {
29
- // flex: auto;
30
- // min-height: 0;
31
-
32
- // .@{ant-prefix}-table-content {
33
- // /* stylelint-disable-next-line function-no-unknown */
34
- // max-height: if((@fullHeight = true), 100%, auto);
35
- // // 把容器再多撑高1px,否则会始终显示纵向滚动条
36
- // padding-bottom: 1px;
37
- // // 自动显示纵向滚动条
38
- // // stylelint-disable-next-line declaration-no-important
39
- // overflow: auto !important;
40
-
41
- // & > table {
42
- // /* stylelint-disable-next-line function-no-unknown */
43
- // height: if((@fullHeight = true), 100%, auto);
44
-
45
- // .@{ant-prefix}-table-thead {
46
- // position: sticky;
47
- // top: 0;
48
- // z-index: 10;
49
- // }
50
-
51
- // td {
52
- // // 当嵌套表格时,还原所有full-height样式,防止子表格受影响
53
- // .full-height-table(false, @depth + 1);
54
- // }
55
- // }
56
- // }
57
- // }
58
- // }
59
-
60
- // & > .@{ant-prefix}-table-pagination {
61
- // flex: none;
62
- // margin-bottom: 0;
63
- // }
64
- // }
65
- // }
66
- // }
67
-
68
- // .full-height-table-container {
69
- // .@{ant-prefix}-table-wrapper {
70
- // .full-height-table();
71
- // }
72
- // }
73
6
  var genStyle = function genStyle(token) {
74
7
  var componentCls = token.componentCls;
75
8
  return _defineProperty({}, componentCls, {
@@ -80,22 +13,24 @@ var genStyle = function genStyle(token) {
80
13
  minHeight: 0,
81
14
  '.easy-full-height-table': _defineProperty({
82
15
  height: '100%'
83
- }, "".concat(token.antCls, "-spin-nested-loading"), _defineProperty({
16
+ }, "& > ".concat(token.antCls, "-spin-nested-loading"), _defineProperty(_defineProperty({
84
17
  height: '100%'
85
- }, "".concat(token.antCls, "-spin-container"), _defineProperty(_defineProperty({
18
+ }, "& > div > ".concat(token.antCls, "-spin"), {
19
+ maxHeight: '100%'
20
+ }), "& > ".concat(token.antCls, "-spin-container"), _defineProperty(_defineProperty(_defineProperty({
86
21
  display: 'flex',
87
22
  flexDirection: 'column',
88
23
  height: '100%'
89
- }, "".concat(token.antCls, "-table:not(").concat(token.antCls, "-table-empty)"), _defineProperty({
24
+ }, "& > ".concat(token.antCls, "-table"), _defineProperty({
90
25
  display: 'flex',
91
26
  flex: 'auto',
92
27
  flexDirection: 'column',
93
28
  width: '100%',
94
29
  minHeight: 0
95
- }, "".concat(token.antCls, "-table-container"), _defineProperty({
30
+ }, "& > ".concat(token.antCls, "-table-container"), _defineProperty({
96
31
  flex: 'auto',
97
32
  minHeight: 0
98
- }, "".concat(token.antCls, "-table-content"), {
33
+ }, "& > ".concat(token.antCls, "-table-content"), {
99
34
  maxHeight: '100%',
100
35
  // 把容器再多撑高1px,否则会始终显示纵向滚动条
101
36
  paddingBottom: 1,
@@ -114,6 +49,8 @@ var genStyle = function genStyle(token) {
114
49
  height: 'auto'
115
50
  }
116
51
  })
52
+ }))), "& > ".concat(token.antCls, "-table").concat(token.antCls, "-table-empty"), _defineProperty({}, "& > ".concat(token.antCls, "-table-container"), _defineProperty({}, "& > ".concat(token.antCls, "-table-content"), {
53
+ height: '100%'
117
54
  }))), "& > ".concat(token.antCls, "-table-pagination"), {
118
55
  flex: 'none',
119
56
  marginBottom: 0
@@ -1 +1 @@
1
- {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","width","height","flex","minWidth","minHeight","concat","antCls","display","flexDirection","maxHeight","paddingBottom","overflow","position","top","zIndex","marginBottom"],"sources":["../../../../src/components/ConfigProvider/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\n// .full-height-table(@fullHeight:true, @depth: 1) when(@depth <= 2) {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-spin-nested-loading {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-spin-container {\n// /* stylelint-disable-next-line function-no-unknown */\n// display: if((@fullHeight = true), flex, block);\n// flex-direction: column;\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-table:not(.@{ant-prefix}-table-empty) {\n// display: flex;\n// flex: auto;\n// flex-direction: column;\n// width: 100%;\n// min-height: 0;\n\n// .@{ant-prefix}-table-container {\n// flex: auto;\n// min-height: 0;\n\n// .@{ant-prefix}-table-content {\n// /* stylelint-disable-next-line function-no-unknown */\n// max-height: if((@fullHeight = true), 100%, auto);\n// // 把容器再多撑高1px,否则会始终显示纵向滚动条\n// padding-bottom: 1px;\n// // 自动显示纵向滚动条\n// // stylelint-disable-next-line declaration-no-important\n// overflow: auto !important;\n\n// & > table {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-table-thead {\n// position: sticky;\n// top: 0;\n// z-index: 10;\n// }\n\n// td {\n// // 当嵌套表格时,还原所有full-height样式,防止子表格受影响\n// .full-height-table(false, @depth + 1);\n// }\n// }\n// }\n// }\n// }\n\n// & > .@{ant-prefix}-table-pagination {\n// flex: none;\n// margin-bottom: 0;\n// }\n// }\n// }\n// }\n\n// .full-height-table-container {\n// .@{ant-prefix}-table-wrapper {\n// .full-height-table();\n// }\n// }\nconst genStyle: GenerateStyle<OverflowTagsToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n width: '100%',\n height: '100%',\n flex: 'auto',\n minWidth: 0,\n minHeight: 0,\n\n '.easy-full-height-table': {\n height: '100%',\n\n [`${token.antCls}-spin-nested-loading`]: {\n height: '100%',\n\n [`${token.antCls}-spin-container`]: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n\n [`${token.antCls}-table:not(${token.antCls}-table-empty)`]: {\n display: 'flex',\n flex: 'auto',\n flexDirection: 'column',\n width: '100%',\n minHeight: 0,\n\n [`${token.antCls}-table-container`]: {\n flex: 'auto',\n minHeight: 0,\n\n [`${token.antCls}-table-content`]: {\n maxHeight: '100%',\n // 把容器再多撑高1px,否则会始终显示纵向滚动条\n paddingBottom: 1,\n // 自动显示纵向滚动条\n // stylelint-disable-next-line declaration-no-important\n overflow: 'auto !important',\n\n '& > table': {\n height: '100%',\n\n [`${token.antCls}-table-thead`]: {\n position: 'sticky',\n top: 0,\n zIndex: 10,\n },\n\n td: {\n // 当嵌套表格时,还原所有full-height样式,防止子表格受影响\n '.easy-full-height-table': {\n height: 'auto',\n },\n },\n },\n },\n },\n },\n [`& > ${token.antCls}-table-pagination`]: {\n flex: 'none',\n marginBottom: 0,\n },\n },\n },\n },\n },\n };\n};\n\nexport default genStyleHooks('EasyConfigProvider' as never, genStyle);\n"],"mappings":";;;;AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAOtD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAMC,QAA0C,GAAG,SAA7CA,QAA0CA,CAAIC,KAAK,EAAgB;EACvE,IAAQC,YAAY,GAAKD,KAAK,CAAtBC,YAAY;EACpB,OAAAC,eAAA,KACGD,YAAY,EAAG;IACdE,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE,CAAC;IACXC,SAAS,EAAE,CAAC;IAEZ,yBAAyB,EAAAL,eAAA;MACvBE,MAAM,EAAE;IAAM,MAAAI,MAAA,CAEVR,KAAK,CAACS,MAAM,2BAAAP,eAAA;MACdE,MAAM,EAAE;IAAM,MAAAI,MAAA,CAEVR,KAAK,CAACS,MAAM,sBAAAP,eAAA,CAAAA,eAAA;MACdQ,OAAO,EAAE,MAAM;MACfC,aAAa,EAAE,QAAQ;MACvBP,MAAM,EAAE;IAAM,MAAAI,MAAA,CAEVR,KAAK,CAACS,MAAM,iBAAAD,MAAA,CAAcR,KAAK,CAACS,MAAM,oBAAAP,eAAA;MACxCQ,OAAO,EAAE,MAAM;MACfL,IAAI,EAAE,MAAM;MACZM,aAAa,EAAE,QAAQ;MACvBR,KAAK,EAAE,MAAM;MACbI,SAAS,EAAE;IAAC,MAAAC,MAAA,CAERR,KAAK,CAACS,MAAM,uBAAAP,eAAA;MACdG,IAAI,EAAE,MAAM;MACZE,SAAS,EAAE;IAAC,MAAAC,MAAA,CAERR,KAAK,CAACS,MAAM,qBAAmB;MACjCG,SAAS,EAAE,MAAM;MACjB;MACAC,aAAa,EAAE,CAAC;MAChB;MACA;MACAC,QAAQ,EAAE,iBAAiB;MAE3B,WAAW,EAAAZ,eAAA,CAAAA,eAAA;QACTE,MAAM,EAAE;MAAM,MAAAI,MAAA,CAEVR,KAAK,CAACS,MAAM,mBAAiB;QAC/BM,QAAQ,EAAE,QAAQ;QAClBC,GAAG,EAAE,CAAC;QACNC,MAAM,EAAE;MACV,CAAC,SAEG;QACF;QACA,yBAAyB,EAAE;UACzBb,MAAM,EAAE;QACV;MACF,CAAC;IAEL,CAAC,YAAAI,MAAA,CAGGR,KAAK,CAACS,MAAM,wBAAsB;MACxCJ,IAAI,EAAE,MAAM;MACZa,YAAY,EAAE;IAChB,CAAC;EAIT,CAAC;AAEL,CAAC;AAED,eAAepB,aAAa,CAAC,oBAAoB,EAAWC,QAAQ,CAAC"}
1
+ {"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","width","height","flex","minWidth","minHeight","concat","antCls","maxHeight","display","flexDirection","paddingBottom","overflow","position","top","zIndex","marginBottom"],"sources":["../../../../src/components/ConfigProvider/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 width: '100%',\n height: '100%',\n flex: 'auto',\n minWidth: 0,\n minHeight: 0,\n\n '.easy-full-height-table': {\n height: '100%',\n\n [`& > ${token.antCls}-spin-nested-loading`]: {\n height: '100%',\n\n [`& > div > ${token.antCls}-spin`]: {\n maxHeight: '100%',\n },\n\n [`& > ${token.antCls}-spin-container`]: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n\n [`& > ${token.antCls}-table`]: {\n display: 'flex',\n flex: 'auto',\n flexDirection: 'column',\n width: '100%',\n minHeight: 0,\n\n [`& > ${token.antCls}-table-container`]: {\n flex: 'auto',\n minHeight: 0,\n\n [`& > ${token.antCls}-table-content`]: {\n maxHeight: '100%',\n // 把容器再多撑高1px,否则会始终显示纵向滚动条\n paddingBottom: 1,\n // 自动显示纵向滚动条\n // stylelint-disable-next-line declaration-no-important\n overflow: 'auto !important',\n\n '& > table': {\n height: '100%',\n\n [`${token.antCls}-table-thead`]: {\n position: 'sticky',\n top: 0,\n zIndex: 10,\n },\n\n td: {\n // 当嵌套表格时,还原所有full-height样式,防止子表格受影响\n '.easy-full-height-table': {\n height: 'auto',\n },\n },\n },\n },\n },\n },\n [`& > ${token.antCls}-table${token.antCls}-table-empty`]: {\n [`& > ${token.antCls}-table-container`]: {\n [`& > ${token.antCls}-table-content`]: {\n height: '100%',\n },\n },\n },\n\n [`& > ${token.antCls}-table-pagination`]: {\n flex: 'none',\n marginBottom: 0,\n },\n },\n },\n },\n },\n };\n};\n\nexport default genStyleHooks('EasyConfigProvider' 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,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE,CAAC;IACXC,SAAS,EAAE,CAAC;IAEZ,yBAAyB,EAAAL,eAAA;MACvBE,MAAM,EAAE;IAAM,UAAAI,MAAA,CAENR,KAAK,CA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ACS,MAAM,wBAAsB;MACxCJ,IAAI,EAAE,MAAM;MACZa,YAAY,EAAE;IAChB,CAAC;EAIT,CAAC;AAEL,CAAC;AAED,eAAepB,aAAa,CAAC,oBAAoB,EAAWC,QAAQ,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { TagProps } from 'antd';
3
3
  import type { OverflowProps } from 'rc-overflow';
4
- export interface OverflowTagsProps<T extends Record<string, unknown> = Record<string, unknown>> extends Omit<OverflowProps<T>, 'renderItem'> {
4
+ export interface OverflowTagsProps<T> extends Omit<OverflowProps<T>, 'renderItem'> {
5
5
  /**
6
6
  * **CN**: 标签集合的数据
7
7
  *
@@ -27,25 +27,23 @@ export interface OverflowTagsProps<T extends Record<string, unknown> = Record<st
27
27
  */
28
28
  renderTag?: OverflowProps<T>['renderItem'];
29
29
  /**
30
- * **EN**: Custom properties for the default tag rendering function, returning `TagProps`
30
+ * **EN**: Custom properties for the tag component
31
31
  *
32
- * **CN**: 对于默认的标签渲染函数,自定义标签的属性,返回`TagProps`
32
+ * **CN**: 自定义标签的组件属性
33
33
  */
34
- getTagProps?: (tag: T, tags: T[]) => TagProps;
35
- /**
36
- * **EN**: Custom properties for the tag component, if `renderTag` is also specified, the latter
37
- * will override the former
38
- *
39
- * **CN**: 自定义标签的组件属性,如果同时指定了`renderTag`,则后者会覆盖前者
40
- */
41
- tagProps?: TagProps;
34
+ tagProps?: TagProps | ((tag: T, options: {
35
+ tags: T[];
36
+ }) => TagProps);
42
37
  /**
43
38
  * **EN**: When the number of tags exceeds the maximum display count, an ellipsis tag will be
44
39
  * shown. This property is used to set the style of the ellipsis tag.
45
40
  *
46
41
  * **CN**: 当标签数量超过最大显示数量时,会显示省略号的标签,此属性用于设置省略号标签的样式
47
42
  */
48
- ellipsisTagProps?: TagProps;
43
+ ellipsisTagProps?: TagProps | ((tag: T, options: {
44
+ omittedItems: T[];
45
+ allTags: T[];
46
+ }) => TagProps);
49
47
  /**
50
48
  * **EN**: Whether to use random colors, default is `false`. Note that the tag object can also
51
49
  * contain a `color` property to specify the color, and the latter takes precedence.
@@ -70,5 +68,5 @@ export interface OverflowTagsProps<T extends Record<string, unknown> = Record<st
70
68
  * ellipsisTagProps={{ color: 'grey' }}
71
69
  * />;
72
70
  */
73
- declare const OverflowTags: <T extends Record<string, any>>(props: OverflowTagsProps<T>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
71
+ declare const OverflowTags: <T>(props: OverflowTagsProps<T>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
74
72
  export default OverflowTags;
@@ -1,10 +1,10 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["tags", "randomColors", "getTagName", "getTagKey", "getTagProps", "tagProps", "ellipsisTagProps", "className", "prefixCls"];
1
+ var _excluded = ["tags", "randomColors", "getTagName", "getTagKey", "tagProps", "ellipsisTagProps", "className", "prefixCls"];
3
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
6
  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); }
7
+ 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); }
8
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
9
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
10
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -45,7 +45,6 @@ var OverflowTags = function OverflowTags(props) {
45
45
  randomColors = props.randomColors,
46
46
  getTagNameInProps = props.getTagName,
47
47
  getTagKey = props.getTagKey,
48
- getTagPropsInProps = props.getTagProps,
49
48
  tagProps = props.tagProps,
50
49
  ellipsisTagProps = props.ellipsisTagProps,
51
50
  className = props.className,
@@ -68,17 +67,25 @@ var OverflowTags = function OverflowTags(props) {
68
67
  return token["".concat(color, "-3")];
69
68
  });
70
69
  }, [token]);
70
+ var getValue = useCallback(function (tag, field) {
71
+ if (tag != null && _typeof(tag) === 'object') {
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ var record = tag;
74
+ return record[field];
75
+ }
76
+ return undefined;
77
+ }, []);
71
78
  var getTagName = useCallback(function (tag) {
72
- var _tag$label;
73
- return getTagNameInProps ? getTagNameInProps(tag) : (_tag$label = tag.label) !== null && _tag$label !== void 0 ? _tag$label : tag.name;
74
- }, [getTagNameInProps]);
79
+ var _ref, _getValue;
80
+ return getTagNameInProps ? getTagNameInProps(tag) : (_ref = (_getValue = getValue(tag, 'label')) !== null && _getValue !== void 0 ? _getValue : getValue(tag, 'name')) !== null && _ref !== void 0 ? _ref : tag === null || tag === void 0 ? void 0 : tag.toString();
81
+ }, [getTagNameInProps, getValue]);
75
82
  var renderTag = function renderTag(item) {
76
- var _item$color;
77
- var customProps = getTagPropsInProps === null || getTagPropsInProps === void 0 ? void 0 : getTagPropsInProps(item, tags);
78
- return /*#__PURE__*/_jsx(Tag, _objectSpread(_objectSpread(_objectSpread({}, tagProps), {}, {
79
- icon: item.icon,
80
- color: randomColors ? colors[random(0, colors.length - 1)] : (_item$color = item.color) !== null && _item$color !== void 0 ? _item$color : 'default'
81
- }, customProps), {}, {
83
+ return /*#__PURE__*/_jsx(Tag, _objectSpread(_objectSpread({
84
+ icon: getValue(item, 'icon'),
85
+ color: randomColors ? colors[random(0, colors.length - 1)] : getValue(item, 'color') || 'default'
86
+ }, typeof tagProps === 'function' ? tagProps(item, {
87
+ tags: tags
88
+ }) : tagProps), {}, {
82
89
  children: getTagName(item)
83
90
  }));
84
91
  };
@@ -91,15 +98,18 @@ var OverflowTags = function OverflowTags(props) {
91
98
  return /*#__PURE__*/_jsx(Dropdown, {
92
99
  menu: {
93
100
  items: omittedItems.map(function (tag) {
94
- var _ref, _tag$value;
101
+ var _ref2, _getValue2;
95
102
  return {
96
103
  type: 'item',
97
- key: getTagKey ? getTagKey(tag) : (_ref = (_tag$value = tag.value) !== null && _tag$value !== void 0 ? _tag$value : tag.id) !== null && _ref !== void 0 ? _ref : getTagName(tag),
104
+ key: getTagKey ? getTagKey(tag) : (_ref2 = (_getValue2 = getValue(tag, 'value')) !== null && _getValue2 !== void 0 ? _getValue2 : getValue(tag, 'id')) !== null && _ref2 !== void 0 ? _ref2 : getTagName(tag),
98
105
  label: getTagName(tag)
99
106
  };
100
107
  })
101
108
  },
102
- children: /*#__PURE__*/_jsxs(Tag, _objectSpread(_objectSpread({}, ellipsisTagProps), {}, {
109
+ children: /*#__PURE__*/_jsxs(Tag, _objectSpread(_objectSpread({}, typeof ellipsisTagProps === 'function' ? ellipsisTagProps(omittedItems[0], {
110
+ omittedItems: omittedItems,
111
+ allTags: tags
112
+ }) : ellipsisTagProps), {}, {
103
113
  children: ["+ ", omittedItems.length, "..."]
104
114
  }))
105
115
  });
@@ -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","getTagPropsInProps","getTagProps","tagProps","ellipsisTagProps","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","tag","_tag$label","label","name","renderTag","item","_item$color","customProps","_objectSpread","icon","length","children","data","maxCount","renderItem","renderRest","omittedItems","menu","items","_ref","_tag$value","type","key","value","id"],"sources":["../../../src/components/OverflowTags/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useContext, useMemo } from 'react';\nimport type { TagProps } from 'antd';\nimport { ConfigProvider, Dropdown, Tag, theme } from 'antd';\nimport { PresetColors } from 'antd/es/theme/internal';\nimport classNames from 'classnames';\nimport type { OverflowProps } from 'rc-overflow';\nimport Overflow from 'rc-overflow';\nimport { random } from '../../utils/math';\nimport useStyle from './style';\n\nexport interface OverflowTagsProps<T extends Record<string, unknown> = Record<string, unknown>>\n extends 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 default tag rendering function, returning `TagProps`\n *\n * **CN**: 对于默认的标签渲染函数,自定义标签的属性,返回`TagProps`\n */\n getTagProps?: (tag: T, tags: T[]) => TagProps;\n /**\n * **EN**: Custom properties for the tag component, if `renderTag` is also specified, the latter\n * will override the former\n *\n * **CN**: 自定义标签的组件属性,如果同时指定了`renderTag`,则后者会覆盖前者\n */\n tagProps?: TagProps;\n /**\n * **EN**: When the number of tags exceeds the maximum display count, an ellipsis tag will be\n * shown. This property is used to set the style of the ellipsis tag.\n *\n * **CN**: 当标签数量超过最大显示数量时,会显示省略号的标签,此属性用于设置省略号标签的样式\n */\n ellipsisTagProps?: TagProps;\n /**\n * **EN**: Whether to use random colors, default is `false`. Note that the tag object can also\n * contain a `color` property to specify the color, and the latter takes precedence.\n *\n * **CN**: 是否使用随机颜色,默认`false`。注意,tag对象还可以包含`color`属性来指定颜色,而且后者优先级更高。\n */\n randomColors?: boolean;\n}\n\n/**\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 extends Record<string, any>>(props: OverflowTagsProps<T>) => {\n const {\n tags = [],\n randomColors,\n getTagName: getTagNameInProps,\n getTagKey,\n getTagProps: getTagPropsInProps,\n tagProps,\n ellipsisTagProps,\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 getTagName = useCallback(\n (tag: T) => {\n return getTagNameInProps ? getTagNameInProps(tag) : (tag.label ?? tag.name);\n },\n [getTagNameInProps]\n );\n const renderTag = (item: T) => {\n const customProps = getTagPropsInProps?.(item, tags);\n return (\n <Tag\n {...tagProps}\n icon={item.icon}\n color={randomColors ? colors[random(0, colors.length - 1)] : (item.color ?? 'default')}\n {...customProps}\n >\n {getTagName(item)}\n </Tag>\n );\n };\n\n return wrapCSSVar(\n <Overflow<T>\n className={classNames(hashId, cssVarCls, prefixCls, className)}\n data={tags}\n maxCount=\"responsive\"\n renderItem={renderTag}\n renderRest={(omittedItems) => (\n <Dropdown\n menu={{\n items: omittedItems.map((tag) => ({\n type: 'item',\n key: getTagKey ? getTagKey(tag) : (tag.value ?? tag.id ?? getTagName(tag)),\n label: getTagName(tag),\n })),\n }}\n >\n <Tag {...ellipsisTagProps}>+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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","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 { 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**: 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 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 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 }}\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;A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AAwC,QAAA,GACrB,IACG,EAACK,YAAY,CAACN,MAAM,EAAC,KACzB;QAAA,EAAK;MAAC,CACE,CAAC;IAAA;EACX,GACEnC,SAAS,CACd,CACH,CAAC;AACH,CAAC;AAED,eAAeb,YAAY"}
@@ -155,7 +155,9 @@ function buildRuleMeta(options) {
155
155
  return !excludeSpecials.includes(v);
156
156
  });
157
157
  symbols.push(escape(specials.join('')));
158
- messages.push(specials.join(t(nameSeparator)));
158
+ messages.push(t('validation.rule.buildRule.token.specialChars', {
159
+ value: specials.join(t('validation.rule.buildRule.token.delimiter'))
160
+ }));
159
161
  }
160
162
  return {
161
163
  symbols: symbols,
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","escape","useT","nameSeparator","useValidatorBuilder","t","props","buildRule","_objectSpread","options","allowed","startsWith","flags","Object","values","some","v","Error","symbols","messages","push","meta","buildRuleMeta","concat","join","prefix","_allowed$min","_allowed$max","min","max","cMin","cMax","length","unshift","message","slice","pattern","RegExp","content","allowedOptions","startsWithOptions","chineseCharacter","chinesePunctuation","letter","lowerLetter","upperLetter","number","excludeSpecials","hyphen","underscore","special","specials","filter","includes"],"sources":["../../src/hooks/useValidatorBuilder.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport escape from 'escape-string-regexp';\nimport useT from './useT';\n\nconst nameSeparator = 'validation.rule.buildRule.token.separator';\n\n/**\n * - **EN:** Get a validation rule builder to build validation rules\n * - **CN:** 获取一个校验规则生成器,用来构建校验规则\n */\nconst useValidatorBuilder = () => {\n const t = useT();\n return useMemo(() => (props: BuilderOptions) => buildRule({ ...props, t }), [t]);\n};\n\n/**\n * - **EN:** Build regular expression rules dynamically, compatible with ant-design rules\n * - **CN:** 动态构建正则表达式规则,与 ant-design 的规则兼容\n */\nfunction buildRule(\n options: BuilderOptions & {\n /**\n * - **EN:** Internationalization function\n * - **CN:** 国际化函数\n */\n t: ReturnType<typeof useT>;\n }\n): ValidatorRule {\n const { allowed, startsWith, flags, t } = options;\n if (!Object.values(allowed).some((v) => v === true)) {\n throw new Error(t('validation.rule.buildRule.includeMandatory'));\n }\n\n const symbols: string[] = [];\n const messages: string[] = [];\n symbols.push(`^`);\n\n // Process startsWith rules\n if (startsWith) {\n const meta = buildRuleMeta({\n flags: startsWith,\n t,\n });\n symbols.push(`[${meta.symbols.join('')}]`);\n messages.push(\n t('validation.rule.buildRule.startsWithFormat', {\n prefix: meta.messages.join(t(nameSeparator)),\n })\n );\n }\n\n // Process allowed rules\n {\n const meta = buildRuleMeta({ flags: allowed, t });\n\n const min = allowed.min ?? 0;\n const max = allowed.max ?? 0; // 0 means unlimited\n\n // If there is startWith in the regular expression, the limited data amount needs to be reduced by 1\n const cMin = min && startsWith ? min - 1 : min;\n const cMax = max && startsWith ? max - 1 : max;\n\n symbols.push(`[${meta.symbols.join('')}]{${cMin},${cMax || ''}}`);\n if (meta.messages.length === 0) {\n messages.unshift(``);\n } else if (meta.messages.length === 1) {\n messages.unshift(`${meta.messages.join(t(nameSeparator))}`);\n } else {\n messages.unshift(`${meta.messages.join(t(nameSeparator))}`);\n }\n if (min && max) {\n messages.push(\n t('validation.rule.buildRule.rangeLength', {\n min,\n max,\n })\n );\n } else {\n if (min > 1) {\n messages.push(t('validation.rule.buildRule.minLength', { min }));\n }\n if (max) {\n messages.push(t('validation.rule.buildRule.maxLength', { max }));\n }\n }\n }\n symbols.push(`$`);\n\n let message = messages.join('');\n if (message.startsWith(t(nameSeparator))) {\n message = message.slice(1);\n }\n return {\n pattern: new RegExp(symbols.join(''), flags),\n message: t('validation.rule.buildRule.messageFormat', { content: message }),\n allowedOptions: allowed,\n startsWithOptions: startsWith,\n flags,\n };\n}\n\nfunction buildRuleMeta(options: { flags: RuleRegExpFlags; t: ReturnType<typeof useT> }): RuleMeta {\n const { flags, t } = options;\n const symbols: string[] = [];\n const messages: string[] = [];\n if (flags.chineseCharacter) {\n // Chinese characters\n symbols.push(`\\u4e00-\\u9fa5`);\n messages.push(t('validation.rule.buildRule.token.chinese'));\n }\n if (flags.chinesePunctuation) {\n // Chinese punctuation\n symbols.push(`\\u3000-\\u301e`);\n symbols.push(`\\u3021-\\u303f`);\n symbols.push(`\\uff00-\\uffef`);\n messages.push(t('validation.rule.buildRule.token.chinesePunctuation'));\n }\n if (flags.letter) {\n symbols.push(`a-zA-Z`);\n messages.push(t('validation.rule.buildRule.token.letter'));\n } else if (flags.lowerLetter) {\n symbols.push(`a-z`);\n messages.push(t('validation.rule.buildRule.token.lowerLetter'));\n } else if (flags.upperLetter) {\n symbols.push(`A-Z`);\n messages.push(t('validation.rule.buildRule.token.upperLetter'));\n }\n if (flags.number) {\n symbols.push(`0-9`);\n messages.push(t('validation.rule.buildRule.token.number'));\n }\n const excludeSpecials: string[] = [];\n if (flags.hyphen) {\n symbols.push(`\\\\-`);\n messages.push(`-`);\n excludeSpecials.push('-');\n }\n if (flags.underscore) {\n symbols.push(`_`);\n messages.push(`_`);\n excludeSpecials.push('_');\n }\n if (flags.special) {\n const specials = flags.special.filter((v) => !excludeSpecials.includes(v));\n symbols.push(escape(specials.join('')));\n messages.push(specials.join(t(nameSeparator)));\n }\n return {\n symbols,\n messages,\n };\n}\n\nexport interface BuilderOptions {\n /**\n * - **EN:** The rule of allowed characters\n * - **CN:** 允许字符的规则\n */\n allowed: RuleRegExpFlags;\n /**\n * - **EN:** The rule of the starting character\n * - **CN:** 开头字符的规则\n */\n startsWith?: Omit<RuleRegExpFlags, 'min' | 'max'>;\n /**\n * - **EN:** Regular expression flags\n * - **CN:** 正则表达式的标志\n */\n flags?: string;\n}\n\nexport interface RuleRegExpFlags {\n /**\n * - **EN:** Include lowercase and uppercase Latin characters. If set to true, `lowerLetter` and\n * `upperLetter` option are not effective\n * - **CN:**: 包含大小写拉丁字符。如果设置为true,则`lowerLetter`和`upperLetter`属性不生效\n */\n\n letter?: boolean;\n /**\n * - **EN:** Include lowercase English letters\n * - **CN:**: 包含小写英文字符\n */\n lowerLetter?: boolean;\n /**\n * - **EN:** Include uppercase English letters\n * - **CN:**: 包含大写英文字符\n */\n upperLetter?: boolean;\n /**\n * - **EN:** Include Chinese characters\n * - **CN:** 包含中文字符\n */\n chineseCharacter?: boolean;\n /**\n * - **EN:** Include Chinese (full-width) punctuation\n * - **CN:** 包含中文(全角)标点符号\n */\n chinesePunctuation?: boolean;\n /**\n * - **EN:** Include numbers\n * - **CN:** 包含数字\n */\n number?: boolean;\n /**\n * - **EN:** Include hyphens (-)\n * - **CN:** 包含连字符(-)\n */\n hyphen?: boolean;\n /**\n * - **EN:** Include underscores (_)\n * - **CN:** 包含下划线(_)\n */\n underscore?: boolean;\n /**\n * - **EN:** Include specified special characters\n * - **CN:** 包含指定的特殊字符\n */\n special?: string[];\n /**\n * - **EN:** Minimum number of characters\n * - **CN:** 最小字符数量\n *\n * @default 1\n */\n min?: number;\n /**\n * - **EN:** Maximum number of characters\n * - **CN:** 最大字符数量\n */\n max?: number;\n}\n\nexport type StartsWithRegExpFlags = RuleRegExpFlags;\n\nexport interface ValidatorRule extends Validator {\n /**\n * - **EN:** The options of allowed characters\n * - **CN:** 允许字符的规则设置\n */\n allowedOptions: RuleRegExpFlags;\n /**\n * - **EN:** The options of the starting character\n * - **CN:** 开头字符的规则设置\n */\n startsWithOptions?: StartsWithRegExpFlags;\n /**\n * - **EN:** Regular expression flags\n * - **CN:** 正则表达式的标志\n */\n flags?: string;\n}\n\ninterface RuleMeta {\n symbols: string[];\n messages: string[];\n}\n\nexport interface Validator {\n /**\n * - **EN:** Regular expression for verification\n * - **CN:** 校验正则表达式\n */\n pattern: RegExp;\n /**\n * - **EN:** Prompt message when verification fails\n * - **CN:** 校验失败时的提示信息\n */\n message: string;\n}\n\nexport default useValidatorBuilder;\n"],"mappings":";;;;;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,OAAOC,MAAM,MAAM,sBAAsB;AACzC,OAAOC,IAAI;AAEX,IAAMC,aAAa,GAAG,2CAA2C;;AAEjE;AACA;AACA;AACA;AACA,IAAMC,mBAAmB,GAAG,SAAtB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Ae,CAAC3B,IAAI,CAAC,GAAG,CAAC;EAC3B;EACA,IAAIR,KAAK,CAACsC,OAAO,EAAE;IACjB,IAAMC,QAAQ,GAAGvC,KAAK,CAACsC,OAAO,CAACE,MAAM,CAAC,UAACpC,CAAC;MAAA,OAAK,CAAC+B,eAAe,CAACM,QAAQ,CAACrC,CAAC,CAAC;IAAA,EAAC;IAC1EE,OAAO,CAACE,IAAI,CAACnB,MAAM,CAACkD,QAAQ,CAAC3B,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACvCL,QAAQ,CAACC,IAAI,CAAC+B,QAAQ,CAAC3B,IAAI,CAACnB,CAAC,CAACF,aAAa,CAAC,CAAC,CAAC;EAChD;EACA,OAAO;IACLe,OAAO,EAAPA,OAAO;IACPC,QAAQ,EAARA;EACF,CAAC;AACH;AAwHA,eAAef,mBAAmB"}
1
+ {"version":3,"names":["useMemo","escape","useT","nameSeparator","useValidatorBuilder","t","props","buildRule","_objectSpread","options","allowed","startsWith","flags","Object","values","some","v","Error","symbols","messages","push","meta","buildRuleMeta","concat","join","prefix","_allowed$min","_allowed$max","min","max","cMin","cMax","length","unshift","message","slice","pattern","RegExp","content","allowedOptions","startsWithOptions","chineseCharacter","chinesePunctuation","letter","lowerLetter","upperLetter","number","excludeSpecials","hyphen","underscore","special","specials","filter","includes","value"],"sources":["../../src/hooks/useValidatorBuilder.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport escape from 'escape-string-regexp';\nimport useT from './useT';\n\nconst nameSeparator = 'validation.rule.buildRule.token.separator';\n\n/**\n * - **EN:** Get a validation rule builder to build validation rules\n * - **CN:** 获取一个校验规则生成器,用来构建校验规则\n */\nconst useValidatorBuilder = () => {\n const t = useT();\n return useMemo(() => (props: BuilderOptions) => buildRule({ ...props, t }), [t]);\n};\n\n/**\n * - **EN:** Build regular expression rules dynamically, compatible with ant-design rules\n * - **CN:** 动态构建正则表达式规则,与 ant-design 的规则兼容\n */\nfunction buildRule(\n options: BuilderOptions & {\n /**\n * - **EN:** Internationalization function\n * - **CN:** 国际化函数\n */\n t: ReturnType<typeof useT>;\n }\n): ValidatorRule {\n const { allowed, startsWith, flags, t } = options;\n if (!Object.values(allowed).some((v) => v === true)) {\n throw new Error(t('validation.rule.buildRule.includeMandatory'));\n }\n\n const symbols: string[] = [];\n const messages: string[] = [];\n symbols.push(`^`);\n\n // Process startsWith rules\n if (startsWith) {\n const meta = buildRuleMeta({\n flags: startsWith,\n t,\n });\n symbols.push(`[${meta.symbols.join('')}]`);\n messages.push(\n t('validation.rule.buildRule.startsWithFormat', {\n prefix: meta.messages.join(t(nameSeparator)),\n })\n );\n }\n\n // Process allowed rules\n {\n const meta = buildRuleMeta({ flags: allowed, t });\n\n const min = allowed.min ?? 0;\n const max = allowed.max ?? 0; // 0 means unlimited\n\n // If there is startWith in the regular expression, the limited data amount needs to be reduced by 1\n const cMin = min && startsWith ? min - 1 : min;\n const cMax = max && startsWith ? max - 1 : max;\n\n symbols.push(`[${meta.symbols.join('')}]{${cMin},${cMax || ''}}`);\n if (meta.messages.length === 0) {\n messages.unshift(``);\n } else if (meta.messages.length === 1) {\n messages.unshift(`${meta.messages.join(t(nameSeparator))}`);\n } else {\n messages.unshift(`${meta.messages.join(t(nameSeparator))}`);\n }\n if (min && max) {\n messages.push(\n t('validation.rule.buildRule.rangeLength', {\n min,\n max,\n })\n );\n } else {\n if (min > 1) {\n messages.push(t('validation.rule.buildRule.minLength', { min }));\n }\n if (max) {\n messages.push(t('validation.rule.buildRule.maxLength', { max }));\n }\n }\n }\n symbols.push(`$`);\n\n let message = messages.join('');\n if (message.startsWith(t(nameSeparator))) {\n message = message.slice(1);\n }\n return {\n pattern: new RegExp(symbols.join(''), flags),\n message: t('validation.rule.buildRule.messageFormat', { content: message }),\n allowedOptions: allowed,\n startsWithOptions: startsWith,\n flags,\n };\n}\n\nfunction buildRuleMeta(options: { flags: RuleRegExpFlags; t: ReturnType<typeof useT> }): RuleMeta {\n const { flags, t } = options;\n const symbols: string[] = [];\n const messages: string[] = [];\n if (flags.chineseCharacter) {\n // Chinese characters\n symbols.push(`\\u4e00-\\u9fa5`);\n messages.push(t('validation.rule.buildRule.token.chinese'));\n }\n if (flags.chinesePunctuation) {\n // Chinese punctuation\n symbols.push(`\\u3000-\\u301e`);\n symbols.push(`\\u3021-\\u303f`);\n symbols.push(`\\uff00-\\uffef`);\n messages.push(t('validation.rule.buildRule.token.chinesePunctuation'));\n }\n if (flags.letter) {\n symbols.push(`a-zA-Z`);\n messages.push(t('validation.rule.buildRule.token.letter'));\n } else if (flags.lowerLetter) {\n symbols.push(`a-z`);\n messages.push(t('validation.rule.buildRule.token.lowerLetter'));\n } else if (flags.upperLetter) {\n symbols.push(`A-Z`);\n messages.push(t('validation.rule.buildRule.token.upperLetter'));\n }\n if (flags.number) {\n symbols.push(`0-9`);\n messages.push(t('validation.rule.buildRule.token.number'));\n }\n const excludeSpecials: string[] = [];\n if (flags.hyphen) {\n symbols.push(`\\\\-`);\n messages.push(`-`);\n excludeSpecials.push('-');\n }\n if (flags.underscore) {\n symbols.push(`_`);\n messages.push(`_`);\n excludeSpecials.push('_');\n }\n if (flags.special) {\n const specials = flags.special.filter((v) => !excludeSpecials.includes(v));\n symbols.push(escape(specials.join('')));\n messages.push(\n t('validation.rule.buildRule.token.specialChars', {\n value: specials.join(t('validation.rule.buildRule.token.delimiter')),\n })\n );\n }\n return {\n symbols,\n messages,\n };\n}\n\nexport interface BuilderOptions {\n /**\n * - **EN:** The rule of allowed characters\n * - **CN:** 允许字符的规则\n */\n allowed: RuleRegExpFlags;\n /**\n * - **EN:** The rule of the starting character\n * - **CN:** 开头字符的规则\n */\n startsWith?: Omit<RuleRegExpFlags, 'min' | 'max'>;\n /**\n * - **EN:** Regular expression flags\n * - **CN:** 正则表达式的标志\n */\n flags?: string;\n}\n\nexport interface RuleRegExpFlags {\n /**\n * - **EN:** Include lowercase and uppercase Latin characters. If set to true, `lowerLetter` and\n * `upperLetter` option are not effective\n * - **CN:**: 包含大小写拉丁字符。如果设置为true,则`lowerLetter`和`upperLetter`属性不生效\n */\n\n letter?: boolean;\n /**\n * - **EN:** Include lowercase English letters\n * - **CN:**: 包含小写英文字符\n */\n lowerLetter?: boolean;\n /**\n * - **EN:** Include uppercase English letters\n * - **CN:**: 包含大写英文字符\n */\n upperLetter?: boolean;\n /**\n * - **EN:** Include Chinese characters\n * - **CN:** 包含中文字符\n */\n chineseCharacter?: boolean;\n /**\n * - **EN:** Include Chinese (full-width) punctuation\n * - **CN:** 包含中文(全角)标点符号\n */\n chinesePunctuation?: boolean;\n /**\n * - **EN:** Include numbers\n * - **CN:** 包含数字\n */\n number?: boolean;\n /**\n * - **EN:** Include hyphens (-)\n * - **CN:** 包含连字符(-)\n */\n hyphen?: boolean;\n /**\n * - **EN:** Include underscores (_)\n * - **CN:** 包含下划线(_)\n */\n underscore?: boolean;\n /**\n * - **EN:** Include specified special characters\n * - **CN:** 包含指定的特殊字符\n */\n special?: string[];\n /**\n * - **EN:** Minimum number of characters\n * - **CN:** 最小字符数量\n *\n * @default 1\n */\n min?: number;\n /**\n * - **EN:** Maximum number of characters\n * - **CN:** 最大字符数量\n */\n max?: number;\n}\n\nexport type StartsWithRegExpFlags = RuleRegExpFlags;\n\nexport interface ValidatorRule extends Validator {\n /**\n * - **EN:** The options of allowed characters\n * - **CN:** 允许字符的规则设置\n */\n allowedOptions: RuleRegExpFlags;\n /**\n * - **EN:** The options of the starting character\n * - **CN:** 开头字符的规则设置\n */\n startsWithOptions?: StartsWithRegExpFlags;\n /**\n * - **EN:** Regular expression flags\n * - **CN:** 正则表达式的标志\n */\n flags?: string;\n}\n\ninterface RuleMeta {\n symbols: string[];\n messages: string[];\n}\n\nexport interface Validator {\n /**\n * - **EN:** Regular expression for verification\n * - **CN:** 校验正则表达式\n */\n pattern: RegExp;\n /**\n * - **EN:** Prompt message when verification fails\n * - **CN:** 校验失败时的提示信息\n */\n message: string;\n}\n\nexport default useValidatorBuilder;\n"],"mappings":";;;;;;AAAA,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Ae,CAAC3B,IAAI,CAAC,GAAG,CAAC;EAC3B;EACA,IAAIR,KAAK,CAACqC,UAAU,EAAE;IACpB/B,OAAO,CAACE,IAAI,IAAI,CAAC;IACjBD,QAAQ,CAACC,IAAI,IAAI,CAAC;IAClB2B,eAAe,CAAC3B,IAAI,CAAC,GAAG,CAAC;EAC3B;EACA,IAAIR,KAAK,CAACsC,OAAO,EAAE;IACjB,IAAMC,QAAQ,GAAGvC,KAAK,CAACsC,OAAO,CAACE,MAAM,CAAC,UAACpC,CAAC;MAAA,OAAK,CAAC+B,eAAe,CAACM,QAAQ,CAACrC,CAAC,CAAC;IAAA,EAAC;IAC1EE,OAAO,CAACE,IAAI,CAACnB,MAAM,CAACkD,QAAQ,CAAC3B,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACvCL,QAAQ,CAACC,IAAI,CACXf,CAAC,CAAC,8CAA8C,EAAE;MAChDiD,KAAK,EAAEH,QAAQ,CAAC3B,IAAI,CAACnB,CAAC,CAAC,2CAA2C,CAAC;IACrE,CAAC,CACH,CAAC;EACH;EACA,OAAO;IACLa,OAAO,EAAPA,OAAO;IACPC,QAAQ,EAARA;EACF,CAAC;AACH;AAwHA,eAAef,mBAAmB"}
@@ -25,12 +25,14 @@ export declare const resources: {
25
25
  readonly 'validation.rule.buildRule.maxLength': ", up to {{max}} characters";
26
26
  readonly 'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters";
27
27
  readonly 'validation.rule.buildRule.token.separator': ", ";
28
+ readonly 'validation.rule.buildRule.token.delimiter': "";
28
29
  readonly 'validation.rule.buildRule.token.chinese': "Chinese characters";
29
30
  readonly 'validation.rule.buildRule.token.chinesePunctuation': "Chinese punctuation";
30
31
  readonly 'validation.rule.buildRule.token.letter': "letter";
31
32
  readonly 'validation.rule.buildRule.token.lowerLetter': "lowercase letter";
32
33
  readonly 'validation.rule.buildRule.token.upperLetter': "uppercase letter";
33
34
  readonly 'validation.rule.buildRule.token.number': "number";
35
+ readonly 'validation.rule.buildRule.token.specialChars': "special characters ({{-value}})";
34
36
  readonly 'hooks.useUserMedia.microphone': "Microphone";
35
37
  readonly 'hooks.useUserMedia.camera': "Camera";
36
38
  readonly 'hooks.featureName.microphone': "Speech";
@@ -75,12 +77,14 @@ export declare const resources: {
75
77
  readonly 'validation.rule.buildRule.maxLength': ", up to {{max}} characters";
76
78
  readonly 'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters";
77
79
  readonly 'validation.rule.buildRule.token.separator': ", ";
80
+ readonly 'validation.rule.buildRule.token.delimiter': "";
78
81
  readonly 'validation.rule.buildRule.token.chinese': "Chinese characters";
79
82
  readonly 'validation.rule.buildRule.token.chinesePunctuation': "Chinese punctuation";
80
83
  readonly 'validation.rule.buildRule.token.letter': "letter";
81
84
  readonly 'validation.rule.buildRule.token.lowerLetter': "lowercase letter";
82
85
  readonly 'validation.rule.buildRule.token.upperLetter': "uppercase letter";
83
86
  readonly 'validation.rule.buildRule.token.number': "number";
87
+ readonly 'validation.rule.buildRule.token.specialChars': "special characters ({{-value}})";
84
88
  readonly 'hooks.useUserMedia.microphone': "Microphone";
85
89
  readonly 'hooks.useUserMedia.camera': "Camera";
86
90
  readonly 'hooks.featureName.microphone': "Speech";
@@ -125,12 +129,14 @@ export declare const resources: {
125
129
  readonly 'validation.rule.buildRule.maxLength': ",{{max}}字符以内";
126
130
  readonly 'validation.rule.buildRule.rangeLength': ",{{min}}~{{max}}个字符";
127
131
  readonly 'validation.rule.buildRule.token.separator': "、";
132
+ readonly 'validation.rule.buildRule.token.delimiter': "";
128
133
  readonly 'validation.rule.buildRule.token.chinese': "汉字";
129
134
  readonly 'validation.rule.buildRule.token.chinesePunctuation': "中文标点";
130
135
  readonly 'validation.rule.buildRule.token.letter': "字母";
131
136
  readonly 'validation.rule.buildRule.token.lowerLetter': "小写字母";
132
137
  readonly 'validation.rule.buildRule.token.upperLetter': "大写字母";
133
138
  readonly 'validation.rule.buildRule.token.number': "数字";
139
+ readonly 'validation.rule.buildRule.token.specialChars': "特殊字符{{-value}}";
134
140
  readonly 'hooks.useUserMedia.microphone': "麦克风";
135
141
  readonly 'hooks.useUserMedia.camera': "摄像头";
136
142
  readonly 'hooks.featureName.microphone': "语音";
@@ -20,12 +20,14 @@ declare const enUS: {
20
20
  readonly 'validation.rule.buildRule.maxLength': ", up to {{max}} characters";
21
21
  readonly 'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters";
22
22
  readonly 'validation.rule.buildRule.token.separator': ", ";
23
+ readonly 'validation.rule.buildRule.token.delimiter': "";
23
24
  readonly 'validation.rule.buildRule.token.chinese': "Chinese characters";
24
25
  readonly 'validation.rule.buildRule.token.chinesePunctuation': "Chinese punctuation";
25
26
  readonly 'validation.rule.buildRule.token.letter': "letter";
26
27
  readonly 'validation.rule.buildRule.token.lowerLetter': "lowercase letter";
27
28
  readonly 'validation.rule.buildRule.token.upperLetter': "uppercase letter";
28
29
  readonly 'validation.rule.buildRule.token.number': "number";
30
+ readonly 'validation.rule.buildRule.token.specialChars': "special characters ({{-value}})";
29
31
  readonly 'hooks.useUserMedia.microphone': "Microphone";
30
32
  readonly 'hooks.useUserMedia.camera': "Camera";
31
33
  readonly 'hooks.featureName.microphone': "Speech";
@@ -20,12 +20,14 @@ var enUS = {
20
20
  'validation.rule.buildRule.maxLength': ", up to {{max}} characters",
21
21
  'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters",
22
22
  'validation.rule.buildRule.token.separator': ', ',
23
+ 'validation.rule.buildRule.token.delimiter': '',
23
24
  'validation.rule.buildRule.token.chinese': 'Chinese characters',
24
25
  'validation.rule.buildRule.token.chinesePunctuation': 'Chinese punctuation',
25
26
  'validation.rule.buildRule.token.letter': 'letter',
26
27
  'validation.rule.buildRule.token.lowerLetter': 'lowercase letter',
27
28
  'validation.rule.buildRule.token.upperLetter': 'uppercase letter',
28
29
  'validation.rule.buildRule.token.number': 'number',
30
+ 'validation.rule.buildRule.token.specialChars': 'special characters ({{-value}})',
29
31
  'hooks.useUserMedia.microphone': 'Microphone',
30
32
  'hooks.useUserMedia.camera': 'Camera',
31
33
  'hooks.featureName.microphone': 'Speech',