tntd 2.7.9 → 2.7.12

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 (126) hide show
  1. package/es/button/button.js +4 -4
  2. package/es/button/button.js.map +1 -1
  3. package/es/card/card.js +25 -0
  4. package/es/card/card.js.map +1 -0
  5. package/es/card/index.js +2 -2
  6. package/es/card/index.js.map +1 -1
  7. package/es/form/form.js +45 -35
  8. package/es/form/form.js.map +1 -1
  9. package/es/handle/index.js +9 -7
  10. package/es/handle/index.js.map +1 -1
  11. package/es/table/table.js.map +1 -1
  12. package/es/tabs/tabs.js +4 -4
  13. package/es/tabs/tabs.js.map +1 -1
  14. package/es/title/index.js +2 -1
  15. package/es/title/index.js.map +1 -1
  16. package/es/utils/index.js +1 -0
  17. package/es/utils/index.js.map +1 -1
  18. package/es/utils/lang.js +118 -0
  19. package/es/utils/lang.js.map +1 -0
  20. package/lib/button/button.d.ts +4 -3
  21. package/lib/button/button.d.ts.map +1 -1
  22. package/lib/button/button.js +17 -6
  23. package/lib/button/button.js.map +1 -1
  24. package/lib/card/card.d.ts +10 -0
  25. package/lib/card/card.d.ts.map +1 -0
  26. package/lib/card/card.js +57 -0
  27. package/lib/card/card.js.map +1 -0
  28. package/lib/card/index.d.ts +2 -2
  29. package/lib/card/index.d.ts.map +1 -1
  30. package/lib/card/index.js +3 -6
  31. package/lib/card/index.js.map +1 -1
  32. package/lib/form/form.d.ts +10 -6
  33. package/lib/form/form.d.ts.map +1 -1
  34. package/lib/form/form.js +59 -38
  35. package/lib/form/form.js.map +1 -1
  36. package/lib/handle/index.d.ts.map +1 -1
  37. package/lib/handle/index.js +9 -7
  38. package/lib/handle/index.js.map +1 -1
  39. package/lib/mention/index.d.ts +5 -0
  40. package/lib/mention/index.d.ts.map +1 -0
  41. package/lib/mention/index.js.map +1 -0
  42. package/lib/query-form/Field/AloneSearch.d.ts +2 -0
  43. package/lib/query-form/Field/AloneSearch.d.ts.map +1 -0
  44. package/lib/query-form/Field/AloneSearch.js +22 -0
  45. package/lib/query-form/Field/AloneSearch.js.map +1 -0
  46. package/lib/segmented/index.d.ts +1 -1
  47. package/lib/svg-components/illustration-403.d.ts +1 -1
  48. package/lib/svg-components/illustration-404.d.ts +1 -1
  49. package/lib/svg-components/illustration-500.d.ts +1 -1
  50. package/lib/svg-components/illustration-empty.d.ts +1 -1
  51. package/lib/svg-components/illustration-failure.d.ts +1 -1
  52. package/lib/svg-components/illustration-no-access.d.ts +1 -1
  53. package/lib/svg-components/illustration-no-chart.d.ts +1 -1
  54. package/lib/svg-components/illustration-no-result.d.ts +1 -1
  55. package/lib/svg-components/illustration-offline.d.ts +1 -1
  56. package/lib/svg-components/illustration-success.d.ts +1 -1
  57. package/lib/table/assets/image-loading-background.d.ts +1 -1
  58. package/lib/table/assets/image-loading.d.ts +1 -1
  59. package/lib/table/table.js.map +1 -1
  60. package/lib/tabs/tabs.d.ts +6 -5
  61. package/lib/tabs/tabs.d.ts.map +1 -1
  62. package/lib/tabs/tabs.js +17 -6
  63. package/lib/tabs/tabs.js.map +1 -1
  64. package/lib/tag/tag.less +61 -0
  65. package/lib/title/index.d.ts.map +1 -1
  66. package/lib/title/index.js +2 -1
  67. package/lib/title/index.js.map +1 -1
  68. package/lib/tnt-second-page/index.d.ts +17 -0
  69. package/lib/tnt-second-page/index.d.ts.map +1 -0
  70. package/lib/tnt-second-page/index.js +59 -0
  71. package/lib/tnt-second-page/index.js.map +1 -0
  72. package/lib/tntd-form/TntdForm/components/Item.d.ts +5 -0
  73. package/lib/tntd-form/TntdForm/components/Item.d.ts.map +1 -0
  74. package/lib/tntd-form/TntdForm/components/Item.js.map +1 -0
  75. package/lib/tntd-form/TntdForm/components/ItemComp.d.ts +5 -0
  76. package/lib/tntd-form/TntdForm/components/ItemComp.d.ts.map +1 -0
  77. package/lib/tntd-form/TntdForm/components/ItemComp.js.map +1 -0
  78. package/lib/tntd-form/TntdForm/components/List.d.ts +5 -0
  79. package/lib/tntd-form/TntdForm/components/List.d.ts.map +1 -0
  80. package/lib/tntd-form/TntdForm/components/List.js.map +1 -0
  81. package/lib/tntd-form/TntdForm/index.d.ts +10 -0
  82. package/lib/tntd-form/TntdForm/index.d.ts.map +1 -0
  83. package/lib/tntd-form/TntdForm/index.js.map +1 -0
  84. package/lib/tntd-form/TntdForm/interface.d.ts +93 -0
  85. package/lib/tntd-form/TntdForm/interface.d.ts.map +1 -0
  86. package/lib/tntd-form/TntdForm/store.d.ts +4 -0
  87. package/lib/tntd-form/TntdForm/store.d.ts.map +1 -0
  88. package/lib/tntd-form/TntdForm/store.js.map +1 -0
  89. package/lib/tntd-form/TntdForm/utils.d.ts +48 -0
  90. package/lib/tntd-form/TntdForm/utils.d.ts.map +1 -0
  91. package/lib/tntd-form/TntdForm/utils.js.map +1 -0
  92. package/lib/tntd-layout/tntdLayout.stories.d.ts +5 -0
  93. package/lib/tntd-layout/tntdLayout.stories.d.ts.map +1 -0
  94. package/lib/tntd-layout/tntdLayout.stories.js +326 -0
  95. package/lib/tntd-layout/tntdLayout.stories.js.map +1 -0
  96. package/lib/utils/index.d.ts +1 -0
  97. package/lib/utils/index.d.ts.map +1 -1
  98. package/lib/utils/index.js +1 -0
  99. package/lib/utils/index.js.map +1 -1
  100. package/lib/utils/lang.d.ts +2 -0
  101. package/lib/utils/lang.d.ts.map +1 -0
  102. package/lib/utils/lang.js +122 -0
  103. package/lib/utils/lang.js.map +1 -0
  104. package/package.json +1 -1
  105. package/es/handle/handle.js +0 -102
  106. package/es/handle/handle.js.map +0 -1
  107. package/es/mention/index.js +0 -4
  108. package/es/mention/index.js.map +0 -1
  109. package/es/tntd-form/TntdForm/components/Item.js +0 -55
  110. package/es/tntd-form/TntdForm/components/Item.js.map +0 -1
  111. package/es/tntd-form/TntdForm/components/ItemComp.js +0 -186
  112. package/es/tntd-form/TntdForm/components/ItemComp.js.map +0 -1
  113. package/es/tntd-form/TntdForm/components/List.js +0 -102
  114. package/es/tntd-form/TntdForm/components/List.js.map +0 -1
  115. package/es/tntd-form/TntdForm/index.js +0 -55
  116. package/es/tntd-form/TntdForm/index.js.map +0 -1
  117. package/es/tntd-form/TntdForm/interface.js +0 -1
  118. package/es/tntd-form/TntdForm/store.js +0 -2
  119. package/es/tntd-form/TntdForm/store.js.map +0 -1
  120. package/es/tntd-form/TntdForm/utils.js +0 -219
  121. package/es/tntd-form/TntdForm/utils.js.map +0 -1
  122. package/lib/handle/handle.d.ts +0 -3
  123. package/lib/handle/handle.d.ts.map +0 -1
  124. package/lib/handle/handle.js +0 -130
  125. package/lib/handle/handle.js.map +0 -1
  126. /package/{es → lib}/tntd-form/TntdForm/interface.js.map +0 -0
@@ -0,0 +1,118 @@
1
+ import { getLanguage } from '../prev-locale';
2
+ const prepositions = [
3
+ 'about',
4
+ 'above',
5
+ 'across',
6
+ 'after',
7
+ 'against',
8
+ 'along',
9
+ 'among',
10
+ 'around',
11
+ 'as',
12
+ 'at',
13
+ 'before',
14
+ 'behind',
15
+ 'below',
16
+ 'beneath',
17
+ 'beside',
18
+ 'between',
19
+ 'beyond',
20
+ 'by',
21
+ 'down',
22
+ 'during',
23
+ 'except',
24
+ 'for',
25
+ 'from',
26
+ 'in',
27
+ 'inside',
28
+ 'into',
29
+ 'like',
30
+ 'near',
31
+ 'of',
32
+ 'off',
33
+ 'on',
34
+ 'onto',
35
+ 'out',
36
+ 'outside',
37
+ 'over',
38
+ 'past',
39
+ 'round',
40
+ 'since',
41
+ 'through',
42
+ 'throughout',
43
+ 'to',
44
+ 'toward',
45
+ 'under',
46
+ 'underneath',
47
+ 'until',
48
+ 'up',
49
+ 'upon',
50
+ 'with',
51
+ 'within',
52
+ 'without',
53
+ 'or'
54
+ ];
55
+ const articles = ['the', 'a', 'an'];
56
+ const titleHandle = (str, upperCaseIgnore) => {
57
+ const words = str.split(' ');
58
+ const capitalizedWords = words.map((word, i) => {
59
+ const lowerCaseWord = word.toLowerCase();
60
+ let ignoreList = prepositions.concat(articles);
61
+ if (upperCaseIgnore === null || upperCaseIgnore === void 0 ? void 0 : upperCaseIgnore.length) {
62
+ ignoreList = ignoreList.concat(upperCaseIgnore);
63
+ ignoreList = Array.from(new Set(ignoreList));
64
+ }
65
+ if (ignoreList.includes(lowerCaseWord) && i !== 0) {
66
+ return lowerCaseWord;
67
+ }
68
+ else {
69
+ return word.charAt(0).toUpperCase() + word.slice(1);
70
+ }
71
+ });
72
+ return capitalizedWords.join(' ');
73
+ };
74
+ // 表头转换为首字母大写
75
+ const titleCaseUpper = (str, upperCaseIgnore) => {
76
+ if (!str) {
77
+ return str;
78
+ }
79
+ if (typeof str === 'string') {
80
+ // 有斜杠根据斜杠划分
81
+ if (str === null || str === void 0 ? void 0 : str.includes('/')) {
82
+ const parWords = str.split('/');
83
+ return parWords
84
+ .map((str1) => {
85
+ return titleHandle(str1, upperCaseIgnore);
86
+ })
87
+ .join('/');
88
+ }
89
+ return titleHandle(str, upperCaseIgnore);
90
+ }
91
+ return str;
92
+ };
93
+ export const doUpperTitle = (label) => {
94
+ var _a, _b, _c, _d, _e, _f;
95
+ if (getLanguage() === 'cn') {
96
+ return title;
97
+ }
98
+ if (!label) {
99
+ return label;
100
+ }
101
+ if (typeof label === 'string') {
102
+ return titleCaseUpper(label);
103
+ }
104
+ else {
105
+ if (React.isValidElement(label)) {
106
+ if (((_a = label === null || label === void 0 ? void 0 : label.props) === null || _a === void 0 ? void 0 : _a.children) && Array.isArray((_b = label === null || label === void 0 ? void 0 : label.props) === null || _b === void 0 ? void 0 : _b.children)) {
107
+ return Object.assign(Object.assign({}, label), { props: Object.assign(Object.assign({}, label.props), { children: (_d = (_c = label === null || label === void 0 ? void 0 : label.props) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((subLabel) => {
108
+ return titleCaseUpper(subLabel);
109
+ }) }) });
110
+ }
111
+ else if (typeof ((_e = label === null || label === void 0 ? void 0 : label.props) === null || _e === void 0 ? void 0 : _e.children) === 'string') {
112
+ label = Object.assign(Object.assign({}, label), { props: Object.assign(Object.assign({}, label.props), { children: titleCaseUpper((_f = label === null || label === void 0 ? void 0 : label.props) === null || _f === void 0 ? void 0 : _f.children) }) });
113
+ }
114
+ }
115
+ }
116
+ return label;
117
+ };
118
+ //# sourceMappingURL=lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang.js","sourceRoot":"","sources":["../../src/utils/lang.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,MAAM,YAAY,GAAG;IACnB,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,MAAM;IACN,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,MAAM;IACN,KAAK;IACL,SAAS;IACT,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;IACT,YAAY;IACZ,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,OAAO;IACP,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,IAAI;CACL,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;AAEnC,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,eAAe,EAAE,EAAE;IAC3C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,aAAa,GA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\n 'against',\n 'along',\n 'among',\n 'around',\n 'as',\n 'at',\n 'before',\n 'behind',\n 'below',\n 'beneath',\n 'beside',\n 'between',\n 'beyond',\n 'by',\n 'down',\n 'during',\n 'except',\n 'for',\n 'from',\n 'in',\n 'inside',\n 'into',\n 'like',\n 'near',\n 'of',\n 'off',\n 'on',\n 'onto',\n 'out',\n 'outside',\n 'over',\n 'past',\n 'round',\n 'since',\n 'through',\n 'throughout',\n 'to',\n 'toward',\n 'under',\n 'underneath',\n 'until',\n 'up',\n 'upon',\n 'with',\n 'within',\n 'without',\n 'or'\n]\n\nconst articles = ['the', 'a', 'an']\n\nconst titleHandle = (str, upperCaseIgnore) => {\n const words = str.split(' ')\n const capitalizedWords = words.map((word, i) => {\n const lowerCaseWord = word.toLowerCase()\n let ignoreList = prepositions.concat(articles)\n if (upperCaseIgnore?.length) {\n ignoreList = ignoreList.concat(upperCaseIgnore)\n ignoreList = Array.from(new Set(ignoreList))\n }\n if (ignoreList.includes(lowerCaseWord) && i !== 0) {\n return lowerCaseWord\n } else {\n return word.charAt(0).toUpperCase() + word.slice(1)\n }\n })\n return capitalizedWords.join(' ')\n}\n\n// 表头转换为首字母大写\nconst titleCaseUpper = (str, upperCaseIgnore) => {\n if (!str) {\n return str\n }\n if (typeof str === 'string') {\n // 有斜杠根据斜杠划分\n if (str?.includes('/')) {\n const parWords = str.split('/')\n return parWords\n .map((str1) => {\n return titleHandle(str1, upperCaseIgnore)\n })\n .join('/')\n }\n return titleHandle(str, upperCaseIgnore)\n }\n return str\n}\n\nexport const doUpperTitle = (label) => {\n if (getLanguage() === 'cn') {\n return title\n }\n if (!label) {\n return label\n }\n if (typeof label === 'string') {\n return titleCaseUpper(label);\n } else {\n if (React.isValidElement(label)) {\n if (label?.props?.children && Array.isArray(label?.props?.children)) {\n return {\n ...label,\n props: {\n ...label.props,\n children: label?.props?.children?.map((subLabel) => {\n return titleCaseUpper(subLabel)\n }),\n },\n }\n } else if (typeof label?.props?.children === 'string') {\n label = {\n ...label,\n props: {\n ...label.props,\n children: titleCaseUpper(label?.props?.children),\n },\n }\n }\n }\n }\n return label\n};\n"]}
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { ButtonProps as AntdButtonProps } from 'antd/es/button';
3
+ import { default as AntdButton } from 'antd/es/button';
3
4
  export * from 'antd/es/button';
4
5
  export { ButtonShape, ButtonSize, ButtonType, ButtonGroupProps } from 'antd/es/button';
5
- export declare function Button({ children, ...rest }: AntdButtonProps): JSX.Element;
6
- export declare namespace Button {
7
- var Group: React.SFC<import("antd/es/button").ButtonGroupProps>;
6
+ interface ButtonComponent extends React.ForwardRefExoticComponent<AntdButtonProps & React.RefAttributes<AntdButton>> {
7
+ Group: typeof AntdButton.Group;
8
8
  }
9
+ export declare const Button: ButtonComponent;
9
10
  //# sourceMappingURL=button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAKpE,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtF,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CA+B1E;yBA/Be,MAAM"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEtD,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtF,UAAU,eACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,eAAe,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1F,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAC/B;AAED,eAAO,MAAM,MAAM,iBA+BE,CAAA"}
@@ -10,6 +10,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
13
25
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
27
  };
@@ -29,12 +41,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
41
  };
30
42
  Object.defineProperty(exports, "__esModule", { value: true });
31
43
  exports.Button = void 0;
32
- const react_1 = __importDefault(require("react"));
44
+ const react_1 = __importStar(require("react"));
33
45
  const config_provider_1 = require("antd/es/config-provider");
34
46
  const button_1 = __importDefault(require("antd/es/button"));
35
47
  __exportStar(require("antd/es/button"), exports);
36
48
  var button_2 = require("antd/es/button");
37
- function Button(_a) {
49
+ exports.Button = (0, react_1.forwardRef)((_a, ref) => {
38
50
  var { children } = _a, rest = __rest(_a, ["children"]);
39
51
  const titleHandle = (str) => {
40
52
  if (!str) {
@@ -59,9 +71,8 @@ function Button(_a) {
59
71
  }
60
72
  }
61
73
  return (react_1.default.createElement(config_provider_1.ConfigConsumer, null, ({ getPrefixCls }) => {
62
- return react_1.default.createElement(button_1.default, Object.assign({}, rest, { children: newChildren }));
74
+ return react_1.default.createElement(button_1.default, Object.assign({}, rest, { children: newChildren, ref: ref }));
63
75
  }));
64
- }
65
- exports.Button = Button;
66
- Button.Group = button_1.default.Group;
76
+ });
77
+ exports.Button.Group = button_1.default.Group;
67
78
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AAEzB,6DAAwD;AAExD,4DAAsD;AAEtD,iDAA8B;AAC9B,yCAAsF;AAEtF,SAAgB,MAAM,CAAC,EAAsC;QAAtC,EAAE,QAAQ,OAA4B,EAAvB,IAAI,cAAnB,YAAqB,CAAF;IACxC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;QAClC,IAAI,CAAC,GAAG,EAAE;YACR,OAAM;SACP;QACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,MAAM,KAAK,GAAa,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACtC,MAAM,gBAAgB,GAAa,KAAK,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;gBAC5D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACrD,CAAC,CAAC,CAAA;YACF,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SACjC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAA;IAED,IAAI,WAAW,GAAG,QAAQ,CAAA;IAC1B,IAAI,WAAW,EAAE;QACf,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACnC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,CAAA;SACvC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YACrC,WAAW,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAA;SACxE;KACF;IAED,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,gBAAU,oBAAK,IAAI,IAAE,QAAQ,EAAE,WAAW,IAAI,CAAA;IACxD,CAAC,CACc,CAClB,CAAA;AACH,CAAC;AA/BD,wBA+BC;AAED,MAAM,CAAC,KAAK,GAAG,gBAAU,CAAC,KAAK,CAAA","sourcesContent":["import React from 'react'\nimport type { ButtonProps as AntdButtonProps } from 'antd/es/button'\nimport { ConfigConsumer } from 'antd/es/config-provider'\n\nimport { default as AntdButton } from 'antd/es/button'\n\nexport * from 'antd/es/button'\nexport { ButtonShape, ButtonSize, ButtonType, ButtonGroupProps } from 'antd/es/button'\n\nexport function Button({ children, ...rest }: AntdButtonProps): JSX.Element {\n const titleHandle = (str: string) => {\n if (!str) {\n return\n }\n if (typeof str === 'string') {\n const words: string[] = str.split(' ')\n const capitalizedWords: string[] = words.map((word: string) => {\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n str = capitalizedWords.join(' ')\n }\n return str\n }\n\n let newChildren = children\n if (newChildren) {\n if (typeof newChildren === 'string') {\n newChildren = titleHandle(newChildren)\n } else if (Array.isArray(newChildren)) {\n newChildren = [...newChildren].map((subChild) => titleHandle(subChild))\n }\n }\n\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdButton {...rest} children={newChildren} />\n }}\n </ConfigConsumer>\n )\n}\n\nButton.Group = AntdButton.Group\n"]}
1
+ {"version":3,"file":"button.js","sourceRoot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YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,gBAAU,oBAAK,IAAI,IAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAClE,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAoB,CAAA;AAErB,cAAM,CAAC,KAAK,GAAG,gBAAU,CAAC,KAAK,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport type { ButtonProps as AntdButtonProps } from 'antd/es/button'\nimport { ConfigConsumer } from 'antd/es/config-provider'\nimport { default as AntdButton } from 'antd/es/button'\n\nexport * from 'antd/es/button'\nexport { ButtonShape, ButtonSize, ButtonType, ButtonGroupProps } from 'antd/es/button'\n\ninterface ButtonComponent\n extends React.ForwardRefExoticComponent<AntdButtonProps & React.RefAttributes<AntdButton>> {\n Group: typeof AntdButton.Group\n}\n\nexport const Button = forwardRef<AntdButton, AntdButtonProps>(({ children, ...rest }, ref) => {\n const titleHandle = (str: string) => {\n if (!str) {\n return\n }\n if (typeof str === 'string') {\n const words: string[] = str.split(' ')\n const capitalizedWords: string[] = words.map((word: string) => {\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n str = capitalizedWords.join(' ')\n }\n return str\n }\n\n let newChildren = children\n if (newChildren) {\n if (typeof newChildren === 'string') {\n newChildren = titleHandle(newChildren)\n } else if (Array.isArray(newChildren)) {\n newChildren = [...newChildren].map((subChild) => titleHandle(subChild))\n }\n }\n\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdButton {...rest} children={newChildren} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as ButtonComponent\n\nButton.Group = AntdButton.Group\n"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { CardProps as AntdCardProps } from 'antd/es/card';
3
+ import { default as AntdCard } from 'antd/es/card';
4
+ export * from 'antd/es/card';
5
+ interface CardComponent extends React.ForwardRefExoticComponent<AntdCardProps & React.RefAttributes<AntdCard>> {
6
+ Grid: typeof AntdCard.Grid;
7
+ Meta: typeof AntdCard.Meta;
8
+ }
9
+ export declare const Card: CardComponent;
10
+ //# sourceMappingURL=card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGlD,cAAc,cAAc,CAAA;AAE5B,UAAU,aACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtF,IAAI,EAAE,OAAO,QAAQ,CAAC,IAAI,CAAA;IAC1B,IAAI,EAAE,OAAO,QAAQ,CAAC,IAAI,CAAA;CAC3B;AAED,eAAO,MAAM,IAAI,eAQE,CAAA"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
+ };
28
+ var __rest = (this && this.__rest) || function (s, e) {
29
+ var t = {};
30
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
31
+ t[p] = s[p];
32
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
33
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
34
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
35
+ t[p[i]] = s[p[i]];
36
+ }
37
+ return t;
38
+ };
39
+ var __importDefault = (this && this.__importDefault) || function (mod) {
40
+ return (mod && mod.__esModule) ? mod : { "default": mod };
41
+ };
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.Card = void 0;
44
+ const react_1 = __importStar(require("react"));
45
+ const config_provider_1 = require("antd/es/config-provider");
46
+ const card_1 = __importDefault(require("antd/es/card"));
47
+ const utils_1 = require("../utils");
48
+ __exportStar(require("antd/es/card"), exports);
49
+ exports.Card = (0, react_1.forwardRef)((_a, ref) => {
50
+ var { title } = _a, rest = __rest(_a, ["title"]);
51
+ return (react_1.default.createElement(config_provider_1.ConfigConsumer, null, ({ getPrefixCls }) => {
52
+ return react_1.default.createElement(card_1.default, Object.assign({}, rest, { title: (0, utils_1.doUpperTitle)(title), ref: ref }));
53
+ }));
54
+ });
55
+ exports.Card.Grid = card_1.default.Grid;
56
+ exports.Card.Meta = card_1.default.Meta;
57
+ //# sourceMappingURL=card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.js","sourceRoot":"","sources":["../../src/card/card.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAyC;AAEzC,6DAAwD;AACxD,wDAAkD;AAClD,oCAAuC;AAEvC,+CAA4B;AAQf,QAAA,IAAI,GAAG,IAAA,kBAAU,EAA0B,CAAC,EAAkB,EAAE,GAAG,EAAE,EAAE;QAA3B,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;IACvE,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,cAAQ,oBAAK,IAAI,IAAE,KAAK,EAAE,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IACrE,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAkB,CAAA;AAEnB,YAAI,CAAC,IAAI,GAAG,cAAQ,CAAC,IAAI,CAAA;AACzB,YAAI,CAAC,IAAI,GAAG,cAAQ,CAAC,IAAI,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport type { CardProps as AntdCardProps } from 'antd/es/card'\nimport { ConfigConsumer } from 'antd/es/config-provider'\nimport { default as AntdCard } from 'antd/es/card'\nimport { doUpperTitle } from '../utils'\n\nexport * from 'antd/es/card'\n\ninterface CardComponent\n extends React.ForwardRefExoticComponent<AntdCardProps & React.RefAttributes<AntdCard>> {\n Grid: typeof AntdCard.Grid\n Meta: typeof AntdCard.Meta\n}\n\nexport const Card = forwardRef<AntdCard, AntdCardProps>(({ title, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdCard {...rest} title={doUpperTitle(title)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as CardComponent\n\nCard.Grid = AntdCard.Grid\nCard.Meta = AntdCard.Meta\n"]}
@@ -1,5 +1,5 @@
1
- import Card from 'antd/es/card';
2
1
  import 'antd/es/card/style';
3
- export * from 'antd/es/card';
2
+ import { Card } from './card';
3
+ export * from './card';
4
4
  export default Card;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,cAAc,CAAA;AAE/B,OAAO,oBAAoB,CAAA;AAE3B,cAAc,cAAc,CAAA;AAE5B,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,cAAc,QAAQ,CAAA;AAEtB,eAAe,IAAI,CAAA"}
package/lib/card/index.js CHANGED
@@ -13,12 +13,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
16
  Object.defineProperty(exports, "__esModule", { value: true });
20
- const card_1 = __importDefault(require("antd/es/card"));
21
17
  require("antd/es/card/style");
22
- __exportStar(require("antd/es/card"), exports);
23
- exports.default = card_1.default;
18
+ const card_1 = require("./card");
19
+ __exportStar(require("./card"), exports);
20
+ exports.default = card_1.Card;
24
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/card/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,wDAA+B;AAE/B,8BAA2B;AAE3B,+CAA4B;AAE5B,kBAAe,cAAI,CAAA","sourcesContent":["import Card from 'antd/es/card'\n\nimport 'antd/es/card/style'\n\nexport * from 'antd/es/card'\n\nexport default Card\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/card/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8BAA2B;AAC3B,iCAA6B;AAE7B,yCAAsB;AAEtB,kBAAe,WAAI,CAAA","sourcesContent":["import 'antd/es/card/style'\nimport { Card } from './card'\n\nexport * from './card'\n\nexport default Card\n"]}
@@ -1,11 +1,15 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { FormProps as AntdFormProps } from 'antd/es/form';
3
3
  import type { FormItemProps as AntdFormItemProps } from 'antd/es/form';
4
+ import { default as AntdForm } from 'antd/es/form';
5
+ import type AntdFormItem from 'antd/es/form/FormItem';
4
6
  export * from 'antd/es/form';
5
- export declare function Form({ ...rest }: AntdFormProps): JSX.Element;
6
- export declare namespace Form {
7
- var Item: ({ label, ...rest }: AntdFormItemProps) => JSX.Element;
8
- var createFormField: any;
9
- var create: <TOwnProps extends import("antd/es/form").FormComponentProps<any>>(options?: import("antd/es/form").FormCreateOption<TOwnProps> | undefined) => import("antd/es/form/interface").FormWrappedProps<TOwnProps>;
7
+ interface FormItemComponent extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {
10
8
  }
9
+ interface FormComponent extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {
10
+ Item: FormItemComponent;
11
+ create: typeof AntdForm.create;
12
+ createFormField: typeof AntdForm.createFormField;
13
+ }
14
+ export declare const Form: FormComponent;
11
15
  //# sourceMappingURL=form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAKtE,cAAc,cAAc,CAAA;AAE5B,wBAAgB,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAQ5D;yBARe,IAAI"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGtE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAA;AAIrD,cAAc,cAAc,CAAA;AAE5B,UAAU,iBACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;CAAG;AACnG,UAAU,aACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtF,IAAI,EAAE,iBAAiB,CAAA;IACvB,MAAM,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAA;IAC9B,eAAe,EAAE,OAAO,QAAQ,CAAC,eAAe,CAAA;CACjD;AAED,eAAO,MAAM,IAAI,eAQE,CAAA"}
package/lib/form/form.js CHANGED
@@ -10,6 +10,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
13
25
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
27
  };
@@ -29,51 +41,60 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
41
  };
30
42
  Object.defineProperty(exports, "__esModule", { value: true });
31
43
  exports.Form = void 0;
32
- const react_1 = __importDefault(require("react"));
44
+ const react_1 = __importStar(require("react"));
33
45
  const config_provider_1 = require("antd/es/config-provider");
34
46
  const form_1 = __importDefault(require("antd/es/form"));
47
+ const utils_1 = require("../utils");
35
48
  __exportStar(require("antd/es/form"), exports);
36
- function Form(_a) {
49
+ exports.Form = (0, react_1.forwardRef)((_a, ref) => {
37
50
  var rest = __rest(_a, []);
38
51
  return (react_1.default.createElement(config_provider_1.ConfigConsumer, null, ({ getPrefixCls }) => {
39
- return react_1.default.createElement(form_1.default, Object.assign({}, rest));
52
+ return react_1.default.createElement(form_1.default, Object.assign({}, rest, { ref: ref }));
40
53
  }));
41
- }
42
- exports.Form = Form;
43
- Form.Item = function (_a) {
54
+ });
55
+ exports.Form.Item = (0, react_1.forwardRef)((_a, ref) => {
56
+ // const titleHandle = (label: string | React.ReactNode): undefined | React.ReactNode => {
57
+ // if (!label) {
58
+ // return label
59
+ // }
60
+ // if (typeof label === 'string') {
61
+ // const words: string[] = label.split(' ')
62
+ // const capitalizedWords: string[] = words.map((word: string) => {
63
+ // const lowerCaseWord: string = word?.toLowerCase()
64
+ // return lowerCaseWord.charAt(0).toUpperCase() + lowerCaseWord.slice(1)
65
+ // })
66
+ // label = capitalizedWords.join(' ')
67
+ // } else {
68
+ // if (React.isValidElement(label)) {
69
+ // if (label?.props?.children && Array.isArray(label?.props?.children)) {
70
+ // return {
71
+ // ...label,
72
+ // props: {
73
+ // ...label.props,
74
+ // children: label?.props?.children?.map((subLabel: string | React.ReactNode) => {
75
+ // return titleHandle(subLabel)
76
+ // }),
77
+ // },
78
+ // }
79
+ // } else if (typeof label?.props?.children === 'string') {
80
+ // label = {
81
+ // ...label,
82
+ // props: {
83
+ // ...label.props,
84
+ // children: titleHandle(label?.props?.children),
85
+ // },
86
+ // }
87
+ // }
88
+ // }
89
+ // }
90
+ // return label
91
+ // }
44
92
  var { label } = _a, rest = __rest(_a, ["label"]);
45
- const titleHandle = (label) => {
46
- var _a, _b, _c, _d, _e, _f;
47
- if (!label) {
48
- return label;
49
- }
50
- if (typeof label === 'string') {
51
- const words = label.split(' ');
52
- const capitalizedWords = words.map((word) => {
53
- const lowerCaseWord = word === null || word === void 0 ? void 0 : word.toLowerCase();
54
- return lowerCaseWord.charAt(0).toUpperCase() + lowerCaseWord.slice(1);
55
- });
56
- label = capitalizedWords.join(' ');
57
- }
58
- else {
59
- if (react_1.default.isValidElement(label)) {
60
- if (((_a = label === null || label === void 0 ? void 0 : label.props) === null || _a === void 0 ? void 0 : _a.children) && Array.isArray((_b = label === null || label === void 0 ? void 0 : label.props) === null || _b === void 0 ? void 0 : _b.children)) {
61
- return Object.assign(Object.assign({}, label), { props: Object.assign(Object.assign({}, label.props), { children: (_d = (_c = label === null || label === void 0 ? void 0 : label.props) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((subLabel) => {
62
- return titleHandle(subLabel);
63
- }) }) });
64
- }
65
- else if (typeof ((_e = label === null || label === void 0 ? void 0 : label.props) === null || _e === void 0 ? void 0 : _e.children) === 'string') {
66
- label = Object.assign(Object.assign({}, label), { props: Object.assign(Object.assign({}, label.props), { children: titleHandle((_f = label === null || label === void 0 ? void 0 : label.props) === null || _f === void 0 ? void 0 : _f.children) }) });
67
- }
68
- }
69
- }
70
- return label;
71
- };
72
- const curLabel = titleHandle(label);
93
+ // const curLabel = titleHandle(label)
73
94
  return (react_1.default.createElement(config_provider_1.ConfigConsumer, null, ({ getPrefixCls }) => {
74
- return react_1.default.createElement(form_1.default.Item, Object.assign({}, rest, { label: curLabel }));
95
+ return react_1.default.createElement(form_1.default.Item, Object.assign({}, rest, { label: (0, utils_1.doUpperTitle)(label), ref: ref }));
75
96
  }));
76
- };
77
- Form.createFormField = form_1.default.createFormField;
78
- Form.create = form_1.default.create;
97
+ });
98
+ exports.Form.createFormField = form_1.default.createFormField;
99
+ exports.Form.create = form_1.default.create;
79
100
  //# sourceMappingURL=form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AAGzB,6DAAwD;AAExD,wDAAkD;AAElD,+CAA4B;AAE5B,SAAgB,IAAI,CAAC,EAA0B;QAArB,IAAI,cAAT,EAAW,CAAF;IAC5B,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,cAAQ,oBAAK,IAAI,EAAI,CAAA;IAC/B,CAAC,CACc,CAClB,CAAA;AACH,CAAC;AARD,oBAQC;AAED,IAAI,CAAC,IAAI,GAAG,UAAU,EAAqC;QAArC,EAAE,KAAK,OAA8B,EAAzB,IAAI,cAAhB,SAAkB,CAAF;IACpC,MAAM,WAAW,GAAG,CAAC,KAA+B,EAA+B,EAAE;;QACnF,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,KAAK,CAAA;SACb;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,KAAK,GAAa,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACxC,MAAM,gBAAgB,GAAa,KAAK,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;gBAC5D,MAAM,aAAa,GAAW,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,EAAE,CAAA;gBACjD,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACvE,CAAC,CAAC,CAAA;YACF,KAAK,GAAG,gBAAgB,CAAC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AM,GAAG,cAAQ,CAAC,MAAM,CAAA","sourcesContent":["import React from 'react'\nimport type { FormProps as AntdFormProps } from 'antd/es/form'\nimport type { FormItemProps as AntdFormItemProps } from 'antd/es/form'\nimport { ConfigConsumer } from 'antd/es/config-provider'\n\nimport { default as AntdForm } from 'antd/es/form'\n\nexport * from 'antd/es/form'\n\nexport function Form({ ...rest }: AntdFormProps): JSX.Element {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} />\n }}\n </ConfigConsumer>\n )\n}\n\nForm.Item = function ({ label, ...rest }: AntdFormItemProps) {\n const titleHandle = (label: string | React.ReactNode): undefined | React.ReactNode => {\n if (!label) {\n return label\n }\n if (typeof label === 'string') {\n const words: string[] = label.split(' ')\n const capitalizedWords: string[] = words.map((word: string) => {\n const lowerCaseWord: string = word?.toLowerCase()\n return lowerCaseWord.charAt(0).toUpperCase() + lowerCaseWord.slice(1)\n })\n label = capitalizedWords.join(' ')\n } else {\n if (React.isValidElement(label)) {\n if (label?.props?.children && Array.isArray(label?.props?.children)) {\n return {\n ...label,\n props: {\n ...label.props,\n children: label?.props?.children?.map((subLabel: string | React.ReactNode) => {\n return titleHandle(subLabel)\n }),\n },\n }\n } else if (typeof label?.props?.children === 'string') {\n label = {\n ...label,\n props: {\n ...label.props,\n children: titleHandle(label?.props?.children),\n },\n }\n }\n }\n }\n return label\n }\n\n const curLabel = titleHandle(label)\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={curLabel} />\n }}\n </ConfigConsumer>\n )\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = AntdForm.create\n"]}
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAyC;AAGzC,6DAAwD;AAExD,wDAAkD;AAGlD,oCAAuC;AAEvC,+CAA4B;AAWf,QAAA,IA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I,CAAC,eAAe,GAAG,cAAQ,CAAC,eAAe,CAAA;AAC/C,YAAI,CAAC,MAAM,GAAG,cAAQ,CAAC,MAAM,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport type { FormProps as AntdFormProps } from 'antd/es/form'\nimport type { FormItemProps as AntdFormItemProps } from 'antd/es/form'\nimport { ConfigConsumer } from 'antd/es/config-provider'\n\nimport { default as AntdForm } from 'antd/es/form'\nimport type AntdFormItem from 'antd/es/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\n\nexport * from 'antd/es/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n // const titleHandle = (label: string | React.ReactNode): undefined | React.ReactNode => {\n // if (!label) {\n // return label\n // }\n // if (typeof label === 'string') {\n // const words: string[] = label.split(' ')\n // const capitalizedWords: string[] = words.map((word: string) => {\n // const lowerCaseWord: string = word?.toLowerCase()\n // return lowerCaseWord.charAt(0).toUpperCase() + lowerCaseWord.slice(1)\n // })\n // label = capitalizedWords.join(' ')\n // } else {\n // if (React.isValidElement(label)) {\n // if (label?.props?.children && Array.isArray(label?.props?.children)) {\n // return {\n // ...label,\n // props: {\n // ...label.props,\n // children: label?.props?.children?.map((subLabel: string | React.ReactNode) => {\n // return titleHandle(subLabel)\n // }),\n // },\n // }\n // } else if (typeof label?.props?.children === 'string') {\n // label = {\n // ...label,\n // props: {\n // ...label.props,\n // children: titleHandle(label?.props?.children),\n // },\n // }\n // }\n // }\n // }\n // return label\n // }\n\n // const curLabel = titleHandle(label)\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\nForm.createFormField = AntdForm.createFormField\nForm.create = AntdForm.create\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handle/index.js"],"names":[],"mappings":"AAUe,mDAkMd"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handle/index.js"],"names":[],"mappings":"AAUe,mDAqMd"}
@@ -63,7 +63,7 @@ exports.default = (props) => {
63
63
  // 非中文 且非 icon图标
64
64
  if (!isCn && !isIconBtn) {
65
65
  const titleHandle = (handle) => {
66
- var _a, _b, _c, _d, _e, _f;
66
+ var _a, _b;
67
67
  if (!handle) {
68
68
  return handle;
69
69
  }
@@ -75,14 +75,16 @@ exports.default = (props) => {
75
75
  handle = capitalizedWords.join(' ');
76
76
  }
77
77
  if (react_1.default.isValidElement(handle)) {
78
- if (((_a = handle === null || handle === void 0 ? void 0 : handle.props) === null || _a === void 0 ? void 0 : _a.children) && Array.isArray((_b = handle === null || handle === void 0 ? void 0 : handle.props) === null || _b === void 0 ? void 0 : _b.children)) {
79
- return Object.assign(Object.assign({}, handle), { props: Object.assign(Object.assign({}, handle.props), { children: (_d = (_c = handle === null || handle === void 0 ? void 0 : handle.props) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((subHandle) => {
80
- return titleHandle(subHandle);
81
- }) }) });
78
+ let children = (_a = handle === null || handle === void 0 ? void 0 : handle.props) === null || _a === void 0 ? void 0 : _a.children;
79
+ if (typeof children === 'string') {
80
+ children = titleHandle((_b = handle === null || handle === void 0 ? void 0 : handle.props) === null || _b === void 0 ? void 0 : _b.children);
82
81
  }
83
- else if (typeof ((_e = handle === null || handle === void 0 ? void 0 : handle.props) === null || _e === void 0 ? void 0 : _e.children) === 'string') {
84
- handle = titleHandle((_f = handle === null || handle === void 0 ? void 0 : handle.props) === null || _f === void 0 ? void 0 : _f.children);
82
+ else if (children && Array.isArray(children)) {
83
+ children = children === null || children === void 0 ? void 0 : children.map((subHandle) => {
84
+ return titleHandle(subHandle);
85
+ });
85
86
  }
87
+ return Object.assign(Object.assign({}, handle), { props: Object.assign(Object.assign({}, handle.props), { children }) });
86
88
  }
87
89
  return handle;
88
90
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,4FAAmE;AACnE,6DAA+B;AAE/B,yDAAgC;AAChC,2DAAkC;AAClC,mDAA0B;AAC1B,wBAAqB;AAErB,MAAM,SAAS,GAAG,iBAAiB,CAAA;AACnC,kBAAe,CAAC,KAAK,EAAE,EAAE;IAGvB,OAAO,CACL,8BAAC,wBAAc,IAAC,aAAa,EAAC,QAAQ,IACnC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACtB,MAAM,KAWF,KAAK,IAAI,EAAE,EAXT,EACF,QAAQ,GAAG,EAAE,EACb,IAAI,EACJ,GAAG,GAAG,CAAC,EACP,IAAI,EACJ,OAAO,GAAG,IAAI,EACd,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,eAAe,GAAC,IAAI,OAET,EADR,IAAI,cAVL,oHAWL,CAAc,CAAA;QAEf,MAAM;QACN,IAAI,IAAI,GAAG,IAAI,KAAK,IAAI,CAAA;QACxB,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,GAAG,UAAU,KAAK,OAAO,CAAA;SAC9B;QAID,IAAI,WAAW,GAAG,EAAE,CAAA;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,WAAW,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAA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AM,GAAG,CACpB,CACJ,CAEL,CACd,CAAC;SACL;QAED,OAAO,CACL,qDACE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACX,IAAG,eAAe,EAAC;oBACf,CAAC,CAAC,eAAe,EAAE,CAAA;iBACtB;YACL,CAAC,IACG,IAAI;YAEP,YAAY;YACZ,CAAC,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,CAAA,IAAI,CAC1B,8BAAC,kBAAQ,IAAC,OAAO,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE,KAAK,UAChD,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACjB,8BAAC,mBAAI,IAAC,IAAI,EAAC,MAAM,GAAG,CACrB,CAAC,CAAC,CAAC,CACF,qCAAG,SAAS,EAAC,mBAAmB,IAC7B,MAAM,aAAN,MAAM;gBAAN,MAAM,CAAE,IAAI;gBACb,qCAAG,SAAS,EAAE,GAAG,SAAS,gBAAgB;oBACxC,8BAAC,mBAAI,IAAC,IAAI,EAAC,MAAM,GAAG,CAClB,CACF,CACL,CACQ,CACZ,CACG,CACP,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { Fragment } from 'react'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport Icon from '../tntd-icon'\n\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Menu from '../menu'\nimport './index.less'\n\nconst clsPrefix = 'tntd-more-menus'\nexport default (props) => {\n \n \n return (\n <LocaleReceiver componentName=\"Handle\">\n {(locale, localeCode) => {\n const {\n children = [],\n type,\n num = 3,\n lang,\n divider = true,\n lessOneMoreFit,\n popConfirmHandle,\n isIconBtn,\n stopPropagation=true,\n ...rest\n } = props || {}\n\n // 非中文\n let isCn = lang === 'cn'\n if (!lang) {\n isCn = localeCode === 'zh-cn'\n }\n\n \n\n let newChildren = []\n if (Array.isArray(children)) {\n newChildren = children?.filter((item) => !!item) || []\n } else if (children) {\n newChildren.push(children)\n }\n\n \n // 非中文 且非 icon图标\n if(!isCn && !isIconBtn){\n const titleHandle = (handle) => {\n if (!handle) {\n return handle\n }\n if (typeof handle === 'string') {\n const words = handle.split(' ')\n const capitalizedWords= words.map((word) => {\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n handle = capitalizedWords.join(' ')\n }\n if (React.isValidElement(handle)) {\n if (handle?.props?.children && Array.isArray(handle?.props?.children)) {\n return {\n ...handle,\n props: {\n ...handle.props,\n children: handle?.props?.children?.map((subHandle) => {\n return titleHandle(subHandle)\n }),\n },\n }\n }else if(typeof handle?.props?.children === 'string' ){\n handle = titleHandle(handle?.props?.children);\n }\n }\n return handle\n };\n\n newChildren?.forEach((v,i)=>{\n newChildren[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n children:titleHandle(v.props.children)\n })\n })\n }\n\n // 子元素大于1个,且不是 icon元素\n const specialSceneDefaultShow = newChildren?.length > 1 && !isIconBtn\n\n if (specialSceneDefaultShow && (!isCn || popConfirmHandle)) {\n newChildren?.forEach((v, i) => {\n const { type, props } = v\n if (\n type?.name === 'Popconfirm' ||\n (props.hasOwnProperty('onConfirm') && typeof props?.onConfirm === 'function')\n ) {\n let placement = {}\n if (\n !isCn ||\n (num &&\n !isNaN(num) &&\n i + 1 > num &&\n !(lessOneMoreFit && newChildren.length - num === 1))\n ) {\n placement = {\n placement: 'left',\n }\n }\n newChildren[i] = React.cloneElement(v, {\n overlayStyle: { width: 180 },\n ...(v?.props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n })\n }\n })\n }\n\n let [preChildPart, lastChildPart] = [newChildren, null]\n\n // 只有1个时不适配\n if (lessOneMoreFit && newChildren.length - num === 1) {\n preChildPart = newChildren\n } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {\n preChildPart = newChildren.slice(0, num)\n lastChildPart = newChildren.slice(num)\n }\n\n if (divider && preChildPart) {\n const preChildLen = preChildPart.length\n preChildPart = preChildPart.map((dom, i) => (\n <Fragment key={i}>\n {dom}\n {!(\n (i === preChildLen - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </Fragment>\n ))\n }\n const menu = (childArr)=>(\n <Menu className=\"org-pop-opera-btn\">\n {\n childArr?.map(\n (child,i) => (\n <Menu.Item key={i}>\n {child}\n </Menu.Item>\n )\n )\n }\n </Menu>\n );\n\n\n if(!isCn && specialSceneDefaultShow ){\n return (\n <Dropdown overlay={menu(newChildren||[])} arrow onClick={(e)=>{\n if(stopPropagation){\n e.stopPropagation()\n }\n }}>\n {\n type === 'icon' ?\n <Icon type=\"more\" /> :\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n }\n </Dropdown>\n );\n }\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown overlay={menu(lastChildPart || [])} arrow>\n {type === 'icon' ? (\n <Icon type=\"more\" />\n ) : (\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n )}\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,4FAAmE;AACnE,6DAA+B;AAE/B,yDAAgC;AAChC,2DAAkC;AAClC,mDAA0B;AAC1B,wBAAqB;AAErB,MAAM,SAAS,GAAG,iBAAiB,CAAA;AACnC,kBAAe,CAAC,KAAK,EAAE,EAAE;IAGvB,OAAO,CACL,8BAAC,wB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CAAA","sourcesContent":["import React, { Fragment } from 'react'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport Icon from '../tntd-icon'\n\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Menu from '../menu'\nimport './index.less'\n\nconst clsPrefix = 'tntd-more-menus'\nexport default (props) => {\n\n\n return (\n <LocaleReceiver componentName=\"Handle\">\n {(locale, localeCode) => {\n const {\n children = [],\n type,\n num = 3,\n lang,\n divider = true,\n lessOneMoreFit,\n popConfirmHandle,\n isIconBtn,\n stopPropagation=true,\n ...rest\n } = props || {}\n\n // 非中文\n let isCn = lang === 'cn'\n if (!lang) {\n isCn = localeCode === 'zh-cn'\n }\n\n\n\n let newChildren = []\n if (Array.isArray(children)) {\n newChildren = children?.filter((item) => !!item) || []\n } else if (children) {\n newChildren.push(children)\n }\n\n\n // 非中文 且非 icon图标\n if(!isCn && !isIconBtn){\n const titleHandle = (handle) => {\n if (!handle) {\n return handle\n }\n if (typeof handle === 'string') {\n const words = handle.split(' ')\n const capitalizedWords= words.map((word) => {\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n handle = capitalizedWords.join(' ')\n }\n if (React.isValidElement(handle)) {\n let children = handle?.props?.children\n if(typeof children === 'string' ){\n children = titleHandle(handle?.props?.children);\n }else if (children && Array.isArray(children)) {\n children= children?.map((subHandle) => {\n return titleHandle(subHandle)\n })\n }\n return {\n ...handle,\n props: {\n ...handle.props,\n children\n }\n }\n \n }\n return handle\n };\n\n newChildren?.forEach((v,i)=>{\n newChildren[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n children:titleHandle(v.props.children)\n })\n })\n }\n\n // 子元素大于1个,且不是 icon元素\n const specialSceneDefaultShow = newChildren?.length > 1 && !isIconBtn\n\n if (specialSceneDefaultShow && (!isCn || popConfirmHandle)) {\n newChildren?.forEach((v, i) => {\n const { type, props } = v\n if (\n type?.name === 'Popconfirm' ||\n (props.hasOwnProperty('onConfirm') && typeof props?.onConfirm === 'function')\n ) {\n let placement = {}\n if (\n !isCn ||\n (num &&\n !isNaN(num) &&\n i + 1 > num &&\n !(lessOneMoreFit && newChildren.length - num === 1))\n ) {\n placement = {\n placement: 'left',\n }\n }\n newChildren[i] = React.cloneElement(v, {\n overlayStyle: { width: 180 },\n ...(v?.props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n })\n }\n })\n }\n\n let [preChildPart, lastChildPart] = [newChildren, null]\n\n // 只有1个时不适配\n if (lessOneMoreFit && newChildren.length - num === 1) {\n preChildPart = newChildren\n } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {\n preChildPart = newChildren.slice(0, num)\n lastChildPart = newChildren.slice(num)\n }\n\n if (divider && preChildPart) {\n const preChildLen = preChildPart.length\n preChildPart = preChildPart.map((dom, i) => (\n <Fragment key={i}>\n {dom}\n {!(\n (i === preChildLen - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </Fragment>\n ))\n }\n const menu = (childArr)=>(\n <Menu className=\"org-pop-opera-btn\">\n {\n childArr?.map(\n (child,i) => (\n <Menu.Item key={i}>\n {child}\n </Menu.Item>\n )\n )\n }\n </Menu>\n );\n\n\n if(!isCn && specialSceneDefaultShow ){\n return (\n <Dropdown overlay={menu(newChildren||[])} arrow onClick={(e)=>{\n if(stopPropagation){\n e.stopPropagation()\n }\n }}>\n {\n type === 'icon' ?\n <Icon type=\"more\" /> :\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n }\n </Dropdown>\n );\n }\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown overlay={menu(lastChildPart || [])} arrow>\n {type === 'icon' ? (\n <Icon type=\"more\" />\n ) : (\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n )}\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import Mention from 'antd/lib/mention';
2
+ import 'antd/lib/mention/style';
3
+ export * from 'antd/lib/mention';
4
+ export default Mention;
5
+ //# sourceMappingURL=index.d.ts.map