@aloudata/aloudata-design 0.3.1 → 0.3.4

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 (264) hide show
  1. package/README.md +15 -5
  2. package/es/Breadcrumb/index.d.ts +1 -0
  3. package/es/Button/index.js +3 -2
  4. package/es/Button/style/index.less +135 -126
  5. package/es/Button/style/variables.less +53 -53
  6. package/es/Card/index.d.ts +3 -0
  7. package/es/Card/index.js +3 -0
  8. package/es/Card/style/index.d.ts +2 -0
  9. package/es/Card/style/index.js +2 -0
  10. package/es/Card/style/index.less +1 -0
  11. package/es/Checkbox/index.d.ts +1 -0
  12. package/es/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
  13. package/es/ConfigProvider/defaultRenderEmpty.js +37 -0
  14. package/es/ConfigProvider/sizeContext.d.ts +9 -0
  15. package/es/ConfigProvider/sizeContext.js +12 -0
  16. package/es/Dropdown/Button.js +4 -3
  17. package/es/Empty/image/Authority.d.ts +1 -0
  18. package/es/Empty/image/Dataspace.d.ts +1 -0
  19. package/es/Empty/image/Search.d.ts +1 -0
  20. package/es/Empty/image/Simple.d.ts +1 -0
  21. package/es/Empty/image/Worksheet.d.ts +1 -0
  22. package/es/Empty/image/empty.d.ts +1 -0
  23. package/es/Icon/icons/CheckLine.d.ts +13 -0
  24. package/es/Icon/icons/CheckLine.js +73 -0
  25. package/es/Icon/icons.json +410 -0
  26. package/es/Input/components/Group/index.d.ts +3 -1
  27. package/es/Input/components/Group/index.js +6 -12
  28. package/es/Input/components/Input/index.d.ts +3 -2
  29. package/es/Input/components/Input/index.js +11 -23
  30. package/es/Input/components/Password/index.js +11 -16
  31. package/es/Input/components/TextArea/index.d.ts +8 -1
  32. package/es/Input/components/TextArea/index.js +8 -1
  33. package/es/Input/style/index.less +180 -102
  34. package/es/InputNumber/index.d.ts +1 -0
  35. package/es/InputNumber/style/index.less +69 -69
  36. package/es/Menu/Divider.d.ts +1 -0
  37. package/es/Modal/index.js +20 -16
  38. package/es/Modal/locale.d.ts +7 -0
  39. package/es/Modal/locale.js +20 -0
  40. package/es/Modal/style/index.less +48 -45
  41. package/es/Navigator/components/Header/index.d.ts +1 -0
  42. package/es/Navigator/components/Menu/index.d.ts +1 -0
  43. package/es/Navigator/components/MenuItem/index.d.ts +1 -1
  44. package/es/Navigator/index.d.ts +1 -1
  45. package/es/PageHeader/index.d.ts +3 -0
  46. package/es/PageHeader/index.js +3 -0
  47. package/es/PageHeader/style/index.d.ts +2 -0
  48. package/es/PageHeader/style/index.js +2 -0
  49. package/es/PageHeader/style/index.less +1 -0
  50. package/es/Popover/index.d.ts +1 -0
  51. package/es/Radio/components/Group/index.d.ts +6 -0
  52. package/es/Radio/components/Group/index.js +72 -0
  53. package/es/Radio/components/Radio/index.d.ts +3 -0
  54. package/es/Radio/components/Radio/index.js +95 -0
  55. package/es/Radio/index.d.ts +9 -2
  56. package/es/Radio/index.js +5 -3
  57. package/es/Radio/interface/radio.d.ts +24 -0
  58. package/es/Radio/interface/radio.js +1 -0
  59. package/es/Radio/interface/radioGroup.d.ts +42 -0
  60. package/es/Radio/interface/radioGroup.js +1 -0
  61. package/es/Radio/style/index.less +348 -0
  62. package/es/Select/index.js +1 -1
  63. package/es/Select/rc-select/OptionList.js +4 -4
  64. package/es/Select/rc-select/Selector/MultipleSelector.js +11 -1
  65. package/es/Select/rc-select/hooks/useOptions.d.ts +1 -1
  66. package/es/Select/style/index.less +70 -45
  67. package/es/Select/style/variables.less +45 -45
  68. package/es/Select/utils/iconUtil.d.ts +2 -2
  69. package/es/Select/utils/iconUtil.js +9 -5
  70. package/es/Steps/components/ProcessIcon/index.d.ts +6 -0
  71. package/es/Steps/components/ProcessIcon/index.js +8 -0
  72. package/es/Steps/components/Step/index.d.ts +20 -0
  73. package/es/Steps/components/Step/index.js +45 -0
  74. package/es/Steps/index.d.ts +36 -2
  75. package/es/Steps/index.js +30 -1
  76. package/es/Steps/matchMedia.mock.d.ts +1 -0
  77. package/es/Steps/matchMedia.mock.js +17 -0
  78. package/es/Steps/style/index.less +251 -0
  79. package/es/Switch/index.d.ts +46 -2
  80. package/es/Switch/index.js +71 -1
  81. package/es/Switch/style/index.less +129 -0
  82. package/es/Table/Table.d.ts +2 -1
  83. package/es/Table/Table.js +223 -330
  84. package/es/Table/components/Empty/index.d.ts +3 -0
  85. package/es/Table/components/Empty/index.js +17 -0
  86. package/es/Table/components/Loading/index.d.ts +3 -0
  87. package/es/Table/components/Loading/index.js +19 -0
  88. package/es/Table/components/TableBodyRowList/index.d.ts +13 -0
  89. package/es/Table/components/TableBodyRowList/index.js +89 -0
  90. package/es/Table/components/TableHead/index.d.ts +23 -0
  91. package/es/Table/components/TableHead/index.js +262 -0
  92. package/es/Table/constant.d.ts +1 -0
  93. package/es/Table/constant.js +1 -0
  94. package/es/Table/hooks/useFrame.d.ts +7 -0
  95. package/es/Table/hooks/useFrame.js +90 -0
  96. package/es/Table/hooks/useTableColumn.d.ts +28 -0
  97. package/es/Table/hooks/useTableColumn.js +53 -0
  98. package/es/Table/interface.d.ts +3 -2
  99. package/es/Table/style/index.less +33 -30
  100. package/es/Table/utils.d.ts +15 -0
  101. package/es/Table/utils.js +131 -0
  102. package/es/Tabs/index.js +7 -9
  103. package/es/Tabs/style/index.less +57 -25
  104. package/es/_utils/hooks/useId.d.ts +4 -0
  105. package/es/_utils/hooks/useId.js +23 -0
  106. package/es/index.d.ts +9 -5
  107. package/es/index.js +3 -1
  108. package/es/locale/default.d.ts +2 -0
  109. package/es/locale/default.js +2 -0
  110. package/es/locale/en_US.d.ts +3 -0
  111. package/es/locale/en_US.js +132 -0
  112. package/es/locale/zh_CN.d.ts +3 -2
  113. package/es/locale/zh_CN.js +131 -2
  114. package/es/locale-provider/LocaleReceiver.d.ts +4 -0
  115. package/es/locale-provider/LocaleReceiver.js +3 -0
  116. package/es/locale-provider/context.d.ts +7 -0
  117. package/es/locale-provider/context.js +3 -0
  118. package/es/locale-provider/default.d.ts +2 -0
  119. package/es/locale-provider/default.js +2 -0
  120. package/es/locale-provider/en_US.d.ts +2 -0
  121. package/es/locale-provider/en_US.js +2 -0
  122. package/es/locale-provider/index.d.ts +65 -0
  123. package/es/locale-provider/index.js +102 -0
  124. package/es/locale-provider/style/index.d.ts +1 -0
  125. package/es/locale-provider/style/index.js +1 -0
  126. package/es/locale-provider/style/index.less +2 -0
  127. package/es/locale-provider/zh_CN.d.ts +2 -0
  128. package/es/locale-provider/zh_CN.js +2 -0
  129. package/es/style/index.d.ts +0 -1
  130. package/es/style/index.js +0 -1
  131. package/es/style/index.less +2 -2
  132. package/es/style/themes/default/index.less +30 -30
  133. package/lib/Breadcrumb/index.d.ts +1 -0
  134. package/lib/Button/index.js +5 -3
  135. package/lib/Button/style/index.less +135 -126
  136. package/lib/Button/style/variables.less +53 -53
  137. package/lib/Card/index.d.ts +3 -0
  138. package/lib/Card/index.js +15 -0
  139. package/lib/Card/style/index.d.ts +2 -0
  140. package/lib/Card/style/index.js +5 -0
  141. package/lib/Card/style/index.less +1 -0
  142. package/lib/Checkbox/index.d.ts +1 -0
  143. package/lib/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
  144. package/lib/ConfigProvider/defaultRenderEmpty.js +55 -0
  145. package/lib/ConfigProvider/sizeContext.d.ts +9 -0
  146. package/lib/ConfigProvider/sizeContext.js +30 -0
  147. package/lib/Dropdown/Button.js +8 -6
  148. package/lib/Empty/image/Authority.d.ts +1 -0
  149. package/lib/Empty/image/Dataspace.d.ts +1 -0
  150. package/lib/Empty/image/Search.d.ts +1 -0
  151. package/lib/Empty/image/Simple.d.ts +1 -0
  152. package/lib/Empty/image/Worksheet.d.ts +1 -0
  153. package/lib/Empty/image/empty.d.ts +1 -0
  154. package/lib/Icon/icons/CheckLine.d.ts +13 -0
  155. package/lib/Icon/icons/CheckLine.js +90 -0
  156. package/lib/Icon/icons.json +410 -0
  157. package/lib/Input/components/Group/index.d.ts +3 -1
  158. package/lib/Input/components/Group/index.js +7 -12
  159. package/lib/Input/components/Input/index.d.ts +3 -2
  160. package/lib/Input/components/Input/index.js +13 -23
  161. package/lib/Input/components/Password/index.js +13 -17
  162. package/lib/Input/components/TextArea/index.d.ts +8 -1
  163. package/lib/Input/components/TextArea/index.js +10 -1
  164. package/lib/Input/style/index.less +180 -102
  165. package/lib/InputNumber/index.d.ts +1 -0
  166. package/lib/InputNumber/style/index.less +69 -69
  167. package/lib/Menu/Divider.d.ts +1 -0
  168. package/lib/Modal/index.js +25 -18
  169. package/lib/Modal/locale.d.ts +7 -0
  170. package/lib/Modal/locale.js +31 -0
  171. package/lib/Modal/style/index.less +48 -45
  172. package/lib/Navigator/components/Header/index.d.ts +1 -0
  173. package/lib/Navigator/components/Menu/index.d.ts +1 -0
  174. package/lib/Navigator/components/MenuItem/index.d.ts +1 -1
  175. package/lib/Navigator/index.d.ts +1 -1
  176. package/lib/PageHeader/index.d.ts +3 -0
  177. package/lib/PageHeader/index.js +15 -0
  178. package/lib/PageHeader/style/index.d.ts +2 -0
  179. package/lib/PageHeader/style/index.js +5 -0
  180. package/lib/PageHeader/style/index.less +1 -0
  181. package/lib/Popover/index.d.ts +1 -0
  182. package/lib/Radio/components/Group/index.d.ts +6 -0
  183. package/lib/Radio/components/Group/index.js +93 -0
  184. package/lib/Radio/components/Radio/index.d.ts +3 -0
  185. package/lib/Radio/components/Radio/index.js +115 -0
  186. package/lib/Radio/index.d.ts +9 -2
  187. package/lib/Radio/index.js +5 -3
  188. package/lib/Radio/interface/radio.d.ts +24 -0
  189. package/lib/Radio/interface/radio.js +5 -0
  190. package/lib/Radio/interface/radioGroup.d.ts +42 -0
  191. package/lib/Radio/interface/radioGroup.js +5 -0
  192. package/lib/Radio/style/index.less +348 -0
  193. package/lib/Select/index.js +1 -1
  194. package/lib/Select/rc-select/OptionList.js +8 -7
  195. package/lib/Select/rc-select/Selector/MultipleSelector.js +11 -1
  196. package/lib/Select/rc-select/hooks/useOptions.d.ts +1 -1
  197. package/lib/Select/style/index.less +70 -45
  198. package/lib/Select/style/variables.less +45 -45
  199. package/lib/Select/utils/iconUtil.d.ts +2 -2
  200. package/lib/Select/utils/iconUtil.js +13 -7
  201. package/lib/Steps/components/ProcessIcon/index.d.ts +6 -0
  202. package/lib/Steps/components/ProcessIcon/index.js +19 -0
  203. package/lib/Steps/components/Step/index.d.ts +20 -0
  204. package/lib/Steps/components/Step/index.js +61 -0
  205. package/lib/Steps/index.d.ts +36 -2
  206. package/lib/Steps/index.js +34 -1
  207. package/lib/Steps/matchMedia.mock.d.ts +1 -0
  208. package/lib/Steps/matchMedia.mock.js +17 -0
  209. package/lib/Steps/style/index.less +251 -0
  210. package/lib/Switch/index.d.ts +46 -2
  211. package/lib/Switch/index.js +78 -1
  212. package/lib/Switch/style/index.less +129 -0
  213. package/lib/Table/Table.d.ts +2 -1
  214. package/lib/Table/Table.js +228 -332
  215. package/lib/Table/components/Empty/index.d.ts +3 -0
  216. package/lib/Table/components/Empty/index.js +30 -0
  217. package/lib/Table/components/Loading/index.d.ts +3 -0
  218. package/lib/Table/components/Loading/index.js +33 -0
  219. package/lib/Table/components/TableBodyRowList/index.d.ts +13 -0
  220. package/lib/Table/components/TableBodyRowList/index.js +108 -0
  221. package/lib/Table/components/TableHead/index.d.ts +23 -0
  222. package/lib/Table/components/TableHead/index.js +286 -0
  223. package/lib/Table/constant.d.ts +1 -0
  224. package/lib/Table/constant.js +1 -0
  225. package/lib/Table/hooks/useFrame.d.ts +7 -0
  226. package/lib/Table/hooks/useFrame.js +98 -0
  227. package/lib/Table/hooks/useTableColumn.d.ts +28 -0
  228. package/lib/Table/hooks/useTableColumn.js +66 -0
  229. package/lib/Table/interface.d.ts +3 -2
  230. package/lib/Table/style/index.less +33 -30
  231. package/lib/Table/utils.d.ts +15 -0
  232. package/lib/Table/utils.js +147 -0
  233. package/lib/Tabs/index.js +9 -11
  234. package/lib/Tabs/style/index.less +57 -25
  235. package/lib/_utils/hooks/useId.d.ts +4 -0
  236. package/lib/_utils/hooks/useId.js +36 -0
  237. package/lib/index.d.ts +9 -5
  238. package/lib/index.js +16 -0
  239. package/lib/locale/default.d.ts +2 -0
  240. package/lib/locale/default.js +13 -0
  241. package/lib/locale/en_US.d.ts +3 -0
  242. package/lib/locale/en_US.js +146 -0
  243. package/lib/locale/zh_CN.d.ts +3 -2
  244. package/lib/locale/zh_CN.js +134 -2
  245. package/lib/locale-provider/LocaleReceiver.d.ts +4 -0
  246. package/lib/locale-provider/LocaleReceiver.js +23 -0
  247. package/lib/locale-provider/context.d.ts +7 -0
  248. package/lib/locale-provider/context.js +12 -0
  249. package/lib/locale-provider/default.d.ts +2 -0
  250. package/lib/locale-provider/default.js +13 -0
  251. package/lib/locale-provider/en_US.d.ts +2 -0
  252. package/lib/locale-provider/en_US.js +13 -0
  253. package/lib/locale-provider/index.d.ts +65 -0
  254. package/lib/locale-provider/index.js +116 -0
  255. package/lib/locale-provider/style/index.d.ts +1 -0
  256. package/lib/locale-provider/style/index.js +3 -0
  257. package/lib/locale-provider/style/index.less +2 -0
  258. package/lib/locale-provider/zh_CN.d.ts +2 -0
  259. package/lib/locale-provider/zh_CN.js +13 -0
  260. package/lib/style/index.d.ts +0 -1
  261. package/lib/style/index.js +0 -2
  262. package/lib/style/index.less +2 -2
  263. package/lib/style/themes/default/index.less +30 -30
  264. package/package.json +11 -8
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.RadioGroupContext = void 0;
9
+ exports.default = RadioGroup;
10
+
11
+ var _react = _interopRequireWildcard(require("react"));
12
+
13
+ var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
14
+
15
+ var _classnames = _interopRequireDefault(require("classnames"));
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+
23
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
+
25
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
26
+
27
+ 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."); }
28
+
29
+ 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); }
30
+
31
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
32
+
33
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
34
+
35
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
36
+
37
+ var RadioGroupContext = /*#__PURE__*/(0, _react.createContext)({});
38
+ exports.RadioGroupContext = RadioGroupContext;
39
+
40
+ function RadioGroup(props) {
41
+ var children = props.children,
42
+ _props$radioGroupStyl = props.radioGroupStyle,
43
+ radioGroupStyle = _props$radioGroupStyl === void 0 ? 'border' : _props$radioGroupStyl,
44
+ _props$size = props.size,
45
+ size = _props$size === void 0 ? 'middle' : _props$size,
46
+ _props$type = props.type,
47
+ type = _props$type === void 0 ? 'radio' : _props$type,
48
+ className = props.className; // 滑块的ref
49
+
50
+ var sliderRef = (0, _react.useRef)(null); // 该hooks与useState相同,但是当props中有value值时,优先使用value的值
51
+
52
+ var _useMergedState = (0, _useMergedState3.default)(props.defaultValue, {
53
+ value: props === null || props === void 0 ? void 0 : props.value
54
+ }),
55
+ _useMergedState2 = _slicedToArray(_useMergedState, 2),
56
+ value = _useMergedState2[0],
57
+ setValue = _useMergedState2[1];
58
+
59
+ var onRadioChange = function onRadioChange(ev) {
60
+ var lastValue = value;
61
+ var val = ev.target.value;
62
+ setValue(val);
63
+ var onChange = props.onChange;
64
+
65
+ if (onChange && val !== lastValue) {
66
+ onChange(ev);
67
+ }
68
+ };
69
+
70
+ var getWrapperClass = function getWrapperClass() {
71
+ var _classNames;
72
+
73
+ var isButton = ['button', 'iconButton'].includes(type);
74
+ var tempType = type === 'iconButton' ? 'icon-button' : type;
75
+ return (0, _classnames.default)('ald-radio-group', className, "ald-radio-group-".concat(tempType), (_classNames = {}, _defineProperty(_classNames, "ald-radio-group-".concat(radioGroupStyle), isButton), _defineProperty(_classNames, "ald-radio-group-".concat(size), isButton), _classNames));
76
+ };
77
+
78
+ return /*#__PURE__*/_react.default.createElement(RadioGroupContext.Provider, {
79
+ value: {
80
+ onChange: onRadioChange,
81
+ value: value,
82
+ radioGroupStyle: radioGroupStyle,
83
+ size: size,
84
+ type: type,
85
+ sliderRef: sliderRef
86
+ }
87
+ }, /*#__PURE__*/_react.default.createElement("div", {
88
+ className: getWrapperClass()
89
+ }, children, radioGroupStyle === 'filled' && type !== 'radio' ? /*#__PURE__*/_react.default.createElement("div", {
90
+ className: "ald-radio-filled-slider",
91
+ ref: sliderRef
92
+ }) : null));
93
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IRadioProps } from '../../interface/radio';
3
+ export default function Radio(props: IRadioProps): JSX.Element;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = Radio;
9
+
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _lodash = _interopRequireDefault(require("lodash"));
15
+
16
+ var _Group = require("../Group");
17
+
18
+ var _useId = require("../../../_utils/hooks/useId");
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
+
28
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
+
30
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
+
32
+ function Radio(props) {
33
+ var _props$value;
34
+
35
+ var groupContext = (0, _react.useContext)(_Group.RadioGroupContext);
36
+ var labelRef = (0, _react.useRef)(null);
37
+ var id = (0, _useId.getUUID)().toString();
38
+
39
+ var radioProps = _objectSpread({}, props);
40
+
41
+ if (!_lodash.default.isEmpty(groupContext)) {
42
+ radioProps.disabled = props.disabled;
43
+ radioProps.checked = !props.disabled && groupContext.value === props.value;
44
+ } else {
45
+ radioProps.checked = !('checked' in props) ? props.defaultChecked : radioProps.checked;
46
+ } // 设置input外层盒子的class
47
+
48
+
49
+ var aldRadioClass = (0, _classnames.default)('ald-radio', {
50
+ 'ald-radio-checked': radioProps.checked,
51
+ 'ald-radio-disabled': radioProps.disabled
52
+ }); // 根据属性设置最外层的class
53
+
54
+ var getWrapperClass = function getWrapperClass() {
55
+ var otherClass = '';
56
+
57
+ if (groupContext.type === 'button') {
58
+ if (groupContext.radioGroupStyle === 'filled') {
59
+ otherClass = 'ald-radio-button-wrapper-filled';
60
+ } else {
61
+ otherClass = 'ald-radio-button-wrapper-border';
62
+ }
63
+ } else if (groupContext.type === 'iconButton') {
64
+ if (groupContext.radioGroupStyle === 'filled') {
65
+ otherClass = 'ald-radio-icon-button-wrapper-filled';
66
+ } else {
67
+ otherClass = 'ald-radio-icon-button-wrapper-border';
68
+ }
69
+ } else {
70
+ // 当type未设置或者是radio时
71
+ otherClass = 'ald-radio-wrapper';
72
+ }
73
+
74
+ return (0, _classnames.default)('ald-radio-label', otherClass, {
75
+ 'ald-radio-wrapper-checked': radioProps.checked,
76
+ 'ald-radio-wrapper-disabled': radioProps.disabled
77
+ });
78
+ }; // filled button模式下,更改滑块的位置
79
+
80
+
81
+ (0, _react.useEffect)(function () {
82
+ var _groupContext$sliderR;
83
+
84
+ if (radioProps.checked && (groupContext === null || groupContext === void 0 ? void 0 : (_groupContext$sliderR = groupContext.sliderRef) === null || _groupContext$sliderR === void 0 ? void 0 : _groupContext$sliderR.current) && (labelRef === null || labelRef === void 0 ? void 0 : labelRef.current)) {
85
+ groupContext.sliderRef.current.style.left = "".concat(labelRef.current.offsetLeft, "px");
86
+ groupContext.sliderRef.current.style.width = "".concat(labelRef.current.offsetWidth, "px");
87
+ }
88
+ }, [groupContext.sliderRef, radioProps.checked]);
89
+
90
+ var onChange = function onChange(e) {
91
+ if (groupContext === null || groupContext === void 0 ? void 0 : groupContext.onChange) {
92
+ groupContext.onChange(e);
93
+ }
94
+ };
95
+
96
+ return /*#__PURE__*/_react.default.createElement("label", {
97
+ className: getWrapperClass(),
98
+ htmlFor: id,
99
+ ref: labelRef
100
+ }, /*#__PURE__*/_react.default.createElement("span", {
101
+ className: aldRadioClass
102
+ }, /*#__PURE__*/_react.default.createElement("input", {
103
+ id: id,
104
+ type: "radio",
105
+ className: "ald-radio-input",
106
+ checked: radioProps.checked,
107
+ disabled: radioProps.disabled,
108
+ value: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.toString(),
109
+ onChange: onChange
110
+ }), /*#__PURE__*/_react.default.createElement("span", {
111
+ className: "ald-radio-inner"
112
+ })), /*#__PURE__*/_react.default.createElement("span", {
113
+ className: "ald-radio-desc"
114
+ }, props.children));
115
+ }
@@ -1,3 +1,10 @@
1
- import { Radio } from 'antd';
2
- export { RadioGroupButtonStyle, RadioGroupOptionType, RadioGroupProps, RadioGroupContextProps, RadioProps, RadioChangeEventTarget, RadioChangeEvent, } from 'antd/lib/radio';
1
+ /// <reference types="react" />
2
+ import RadioGroup from './components/Group';
3
+ import { IRadioProps } from './interface/radio';
4
+ export type { IRadioProps as RadioProps } from './interface/radio';
5
+ export type { IRadioGroupProps as RadioGroupProps } from './interface/radioGroup';
6
+ interface IRadioType extends React.FC<IRadioProps> {
7
+ Group: typeof RadioGroup;
8
+ }
9
+ declare const Radio: IRadioType;
3
10
  export default Radio;
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- require("antd/es/radio/style");
8
+ var _Radio = _interopRequireDefault(require("./components/Radio"));
9
9
 
10
- var _radio = _interopRequireDefault(require("antd/es/radio"));
10
+ var _Group = _interopRequireDefault(require("./components/Group"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
- var _default = _radio.default;
14
+ var Radio = _Radio.default;
15
+ Radio.Group = _Group.default;
16
+ var _default = Radio;
15
17
  exports.default = _default;
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ export interface IRadioProps {
3
+ /**
4
+ * @description 当前元素是否选中
5
+ * @default false
6
+ */
7
+ checked?: boolean;
8
+ /**
9
+ * @description 当前元素是否默认选中
10
+ * @default false
11
+ */
12
+ defaultChecked?: boolean;
13
+ /**
14
+ * @description 当前元素是否禁用
15
+ * @default false
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * @description 当前元素的value值,与Group中的value匹配
20
+ * @default -
21
+ */
22
+ value?: string | number | boolean;
23
+ children?: ReactNode[] | ReactNode;
24
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,42 @@
1
+ import { ReactNode } from 'react';
2
+ export declare type TRadioGroupStyle = 'border' | 'filled';
3
+ export declare type TRadioSize = 'large' | 'middle' | 'small' | 'default';
4
+ export declare type TRadioType = 'radio' | 'button' | 'iconButton';
5
+ export interface IRadioGroupProps {
6
+ /**
7
+ * @description 按钮组的样式 'border' | 'filled'
8
+ * @default 'border'
9
+ */
10
+ radioGroupStyle?: TRadioGroupStyle;
11
+ /**
12
+ * @description 按钮组的默认选项,按钮组为非受控组件请勿使用value设置默认值
13
+ * @default -
14
+ */
15
+ defaultValue?: string | number | boolean;
16
+ /**
17
+ * @description 设置按钮组的大小,有'large' | 'middle'('default') | 'small
18
+ * @default 'middle'
19
+ */
20
+ size?: TRadioSize;
21
+ /**
22
+ * @description 当按钮组为受控组件时,设置按钮组的当前选中的值
23
+ * @default -
24
+ */
25
+ value?: string | number | boolean;
26
+ /**
27
+ * @description 当按钮组选中值变化时的回调函数
28
+ * @default -
29
+ */
30
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
31
+ /**
32
+ * @description 设置按钮组的类型 'radio' | 'button' | 'iconButton'
33
+ * @default 'radio'
34
+ */
35
+ type?: TRadioType;
36
+ /**
37
+ * @description 按钮组最外层盒子的类名
38
+ * @default -
39
+ */
40
+ className?: string;
41
+ children?: ReactNode[] | ReactNode;
42
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1 +1,349 @@
1
1
  @import '../../style/index.less';
2
+
3
+ @radio-icon-button-padding-large: 10px;
4
+ @radio-icon-button-padding-middle: 9px;
5
+ @radio-icon-button-padding-small: 8px;
6
+ @radio-group-height-large: 36px;
7
+ @radio-group-height-middle: 32px;
8
+ @radio-group-height-small: 28px;
9
+ @radio-button-padding: 12px;
10
+
11
+ // Radio组件基础样式
12
+ .ald-radio-wrapper {
13
+ display: inline-flex;
14
+ gap: 8px;
15
+ align-items: center;
16
+ justify-content: start;
17
+ height: 20px;
18
+ padding: 0;
19
+ cursor: pointer;
20
+ }
21
+
22
+ .ald-radio {
23
+ position: relative;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ width: 20px;
28
+ height: 20px;
29
+ }
30
+
31
+ .ald-radio-input {
32
+ position: absolute;
33
+ z-index: 1;
34
+ width: 1px;
35
+ height: 1px;
36
+ cursor: pointer;
37
+ opacity: 0;
38
+ inset: 0;
39
+ }
40
+
41
+ .ald-radio-inner {
42
+ position: relative;
43
+ display: inline-block;
44
+ width: 17px;
45
+ height: 17px;
46
+ border: 1px solid @NL90;
47
+ border-radius: 50%;
48
+ }
49
+
50
+ .ald-radio-desc {
51
+ z-index: 2;
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ color: @NL0;
56
+ font-weight: 400;
57
+ }
58
+ // 绘制选中时的圆圈样式
59
+ .ald-radio-checked > .ald-radio-inner {
60
+ background-color: @B60;
61
+ border: 0;
62
+ transform: background 0.5s ease;
63
+
64
+ &::after {
65
+ position: absolute;
66
+ top: 50%;
67
+ left: 50%;
68
+ width: 6px;
69
+ height: 6px;
70
+ background-color: @ND0;
71
+ border-radius: 50%;
72
+ transform: translate(-50%, -50%);
73
+ content: '';
74
+ }
75
+ }
76
+ // 禁用状态下的样式
77
+ .ald-radio-disabled > .ald-radio-inner {
78
+ background-color: @NL90;
79
+ border: 0;
80
+ }
81
+
82
+ .ald-radio-disabled.ald-radio-checked > .ald-radio-inner::after {
83
+ position: absolute;
84
+ top: 50%;
85
+ left: 50%;
86
+ width: 6px;
87
+ height: 6px;
88
+ background: @NL90;
89
+ border-radius: 50%;
90
+ transform: translate(-50%, -50%);
91
+ content: '';
92
+ }
93
+ // 禁用的样式
94
+ .ald-radio-label.ald-radio-wrapper-disabled {
95
+ cursor: default;
96
+
97
+ .ald-radio-desc {
98
+ color: @NL60;
99
+ }
100
+ }
101
+ // RadioGroup基础样式
102
+ .ald-radio-group {
103
+ position: relative;
104
+
105
+ .ald-radio-label .ald-radio-desc {
106
+ color: @NL30;
107
+ font-weight: 500;
108
+ font-size: @font-size-middle;
109
+ font-style: normal;
110
+ }
111
+
112
+ &.ald-radio-group-radio {
113
+ .ald-radio-desc {
114
+ color: @NL0;
115
+ font-weight: 400;
116
+ }
117
+ }
118
+
119
+ .ald-radio-wrapper:not(:first-child) {
120
+ margin-left: 16px;
121
+ }
122
+ }
123
+
124
+ // filled填充样式下的滑块样式
125
+ .ald-radio-filled-slider {
126
+ position: absolute;
127
+ top: 0;
128
+ left: 0;
129
+ z-index: 1;
130
+ width: 0;
131
+ height: 100%;
132
+ background: @BG100;
133
+ border: 1px solid @NL90;
134
+ border-radius: @border-radius-middle;
135
+ transition: width, left, height 0.3s, 0.3s, 0.3s ease;
136
+ }
137
+
138
+ // button状态下的样式
139
+ .ald-radio-group-button,
140
+ .ald-radio-group-icon-button {
141
+ display: flex;
142
+ align-items: flex-start;
143
+ box-sizing: border-box;
144
+ width: min-content;
145
+ width: auto;
146
+ padding: 0;
147
+ overflow: hidden;
148
+
149
+ .ald-radio-label {
150
+ color: @NL30;
151
+ font-size: @font-size-middle;
152
+ }
153
+ // 按钮样式禁用的文字颜色
154
+ .ald-radio-wrapper-disabled {
155
+ .ald-radio-desc {
156
+ color: @NL80;
157
+ }
158
+ }
159
+ // border的样式
160
+ .ald-radio-button-wrapper-border {
161
+ padding: 0 @radio-button-padding - 1;
162
+ }
163
+
164
+ .ald-radio-button-wrapper-border,
165
+ .ald-radio-icon-button-wrapper-border {
166
+ position: relative;
167
+ display: flex;
168
+ align-items: center;
169
+ justify-content: center;
170
+ height: 100%;
171
+ background: @BG100;
172
+ border: 1px solid @NL90;
173
+ border-right: 1px solid transparent;
174
+ cursor: pointer;
175
+
176
+ &:first-child {
177
+ border-radius: 6px 0 0 6px;
178
+ }
179
+
180
+ &:last-child {
181
+ border-right: 1px solid @NL90;
182
+ border-radius: 0 6px 6px 0;
183
+ }
184
+
185
+ .ald-radio {
186
+ width: 0;
187
+
188
+ .ald-radio-input,
189
+ .ald-radio-inner {
190
+ width: 0;
191
+ border: 0;
192
+ }
193
+ }
194
+
195
+ .ald-radio-checked > .ald-radio-inner::after {
196
+ width: 0;
197
+ }
198
+ }
199
+
200
+ // button选中状态下的样式
201
+ .ald-radio-wrapper-checked.ald-radio-button-wrapper-border,
202
+ .ald-radio-wrapper-checked.ald-radio-icon-button-wrapper-border {
203
+ background: @B98;
204
+ transition: background 0.5s ease;
205
+
206
+ .ald-radio-desc {
207
+ position: relative;
208
+ color: @NL0;
209
+ transition: text-shadow 0.5s ease;
210
+ }
211
+ }
212
+
213
+ // filled样式的button
214
+ .ald-radio-button-wrapper-filled {
215
+ padding: 0 @radio-button-padding;
216
+ }
217
+
218
+ .ald-radio-button-wrapper-filled,
219
+ .ald-radio-icon-button-wrapper-filled {
220
+ position: relative;
221
+ display: flex;
222
+ align-items: center;
223
+ justify-content: center;
224
+ height: 100%;
225
+ background-color: @BG90;
226
+ cursor: pointer;
227
+
228
+ &:first-of-type {
229
+ border-radius: @border-radius-middle 0 0 @border-radius-middle;
230
+ }
231
+
232
+ &:last-of-type {
233
+ border-radius: 0 @border-radius-middle @border-radius-middle 0;
234
+ }
235
+
236
+ .ald-radio {
237
+ width: 0;
238
+
239
+ .ald-radio-input,
240
+ .ald-radio-inner {
241
+ width: 0;
242
+ border: 0;
243
+ }
244
+ }
245
+
246
+ .ald-radio-checked > .ald-radio-inner::after {
247
+ width: 0;
248
+ }
249
+ }
250
+
251
+ .ald-radio-wrapper-checked.ald-radio-button-wrapper-filled,
252
+ .ald-radio-wrapper-checked.ald-radio-icon-button-wrapper-filled {
253
+ position: relative;
254
+
255
+ .ald-radio-desc {
256
+ position: relative;
257
+ z-index: 2;
258
+ color: @NL0;
259
+ }
260
+ }
261
+ // 各种大小
262
+ &.ald-radio-group-middle {
263
+ height: @radio-group-height-middle;
264
+
265
+ .ald-radio-icon-button-wrapper-filled {
266
+ padding: 0 @radio-icon-button-padding-middle;
267
+ }
268
+
269
+ .ald-radio-icon-button-wrapper-border {
270
+ padding: 0 @radio-icon-button-padding-middle - 1;
271
+ }
272
+
273
+ .ald-radio-label {
274
+ .ald-radio-desc {
275
+ font-size: @font-size-middle;
276
+ }
277
+ }
278
+ }
279
+
280
+ &.ald-radio-group-small {
281
+ height: @radio-group-height-small;
282
+
283
+ .ald-radio-icon-button-wrapper-filled {
284
+ padding: 0 @radio-icon-button-padding-small;
285
+ }
286
+
287
+ .ald-radio-icon-button-wrapper-border {
288
+ padding: 0 @radio-icon-button-padding-small - 1;
289
+ }
290
+
291
+ .ald-radio-label {
292
+ .ald-radio-desc {
293
+ font-size: @font-size-small;
294
+ }
295
+ }
296
+
297
+ .ald-radio-button-wrapper-border,
298
+ .ald-radio-icon-button-wrapper-border,
299
+ .ald-radio-button-wrapper-filled,
300
+ .ald-radio-icon-button-wrapper-filled {
301
+ &:first-of-type {
302
+ border-radius: @border-radius-small 0 0 @border-radius-small;
303
+ }
304
+
305
+ &:last-of-type {
306
+ border-radius: 0 @border-radius-small 0 @border-radius-small 0;
307
+ }
308
+ }
309
+
310
+ .ald-radio-filled-slider {
311
+ border-radius: @border-radius-small;
312
+ }
313
+ }
314
+
315
+ &.ald-radio-group.ald-radio-group-large {
316
+ height: @radio-group-height-large;
317
+
318
+ .ald-radio-icon-button-wrapper-filled {
319
+ padding: 0 @radio-icon-button-padding-large;
320
+ }
321
+
322
+ .ald-radio-icon-button-wrapper-border {
323
+ padding: 0 @radio-icon-button-padding-large - 1;
324
+ }
325
+
326
+ .ald-radio-label {
327
+ .ald-radio-desc {
328
+ font-size: @font-size-large;
329
+ }
330
+ }
331
+
332
+ .ald-radio-button-wrapper-border,
333
+ .ald-radio-icon-button-wrapper-border,
334
+ .ald-radio-button-wrapper-filled,
335
+ .ald-radio-icon-button-wrapper-filled {
336
+ &:first-of-type {
337
+ border-radius: @border-radius-large 0 0 @border-radius-large;
338
+ }
339
+
340
+ &:last-of-type {
341
+ border-radius: 0 @border-radius-large @border-radius-large 0;
342
+ }
343
+ }
344
+
345
+ .ald-radio-filled-slider {
346
+ border-radius: @border-radius-large;
347
+ }
348
+ }
349
+ }
@@ -27,7 +27,7 @@ var _motion = require("antd/lib/_util/motion");
27
27
 
28
28
  var _statusUtils = require("antd/lib/_util/statusUtils");
29
29
 
30
- var _defaultRenderEmpty = _interopRequireDefault(require("antd/lib/config-provider/defaultRenderEmpty"));
30
+ var _defaultRenderEmpty = _interopRequireDefault(require("../ConfigProvider/defaultRenderEmpty"));
31
31
 
32
32
  var _iconUtil = _interopRequireDefault(require("./utils/iconUtil"));
33
33