@aloudata/aloudata-design 0.3.2 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/es/Breadcrumb/index.d.ts +1 -0
  2. package/es/Button/index.js +3 -2
  3. package/es/Button/style/index.less +135 -126
  4. package/es/Button/style/variables.less +53 -53
  5. package/es/Checkbox/index.d.ts +1 -0
  6. package/es/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
  7. package/es/ConfigProvider/defaultRenderEmpty.js +37 -0
  8. package/es/ConfigProvider/sizeContext.d.ts +9 -0
  9. package/es/ConfigProvider/sizeContext.js +12 -0
  10. package/es/Dropdown/Button.js +3 -2
  11. package/es/Empty/image/Authority.d.ts +1 -0
  12. package/es/Empty/image/Dataspace.d.ts +1 -0
  13. package/es/Empty/image/Search.d.ts +1 -0
  14. package/es/Empty/image/Simple.d.ts +1 -0
  15. package/es/Empty/image/Worksheet.d.ts +1 -0
  16. package/es/Empty/image/empty.d.ts +1 -0
  17. package/es/Icon/icons.json +418 -0
  18. package/es/Input/components/Group/index.d.ts +3 -1
  19. package/es/Input/components/Group/index.js +6 -12
  20. package/es/Input/components/Input/index.d.ts +3 -2
  21. package/es/Input/components/Input/index.js +11 -23
  22. package/es/Input/components/Password/index.js +11 -16
  23. package/es/Input/components/TextArea/index.d.ts +8 -1
  24. package/es/Input/components/TextArea/index.js +8 -1
  25. package/es/Input/style/index.less +180 -102
  26. package/es/InputNumber/index.d.ts +1 -0
  27. package/es/InputNumber/style/index.less +69 -69
  28. package/es/Menu/Divider.d.ts +1 -0
  29. package/es/Modal/index.js +4 -7
  30. package/es/Modal/style/index.less +48 -45
  31. package/es/Navigator/components/Header/index.d.ts +1 -0
  32. package/es/Navigator/components/Menu/index.d.ts +1 -0
  33. package/es/PageHeader/index.d.ts +3 -0
  34. package/es/PageHeader/index.js +3 -0
  35. package/es/PageHeader/style/index.d.ts +2 -0
  36. package/es/PageHeader/style/index.js +2 -0
  37. package/es/PageHeader/style/index.less +1 -0
  38. package/es/Popover/index.d.ts +1 -0
  39. package/es/Radio/components/Group/index.d.ts +6 -0
  40. package/es/Radio/components/Group/index.js +74 -0
  41. package/es/Radio/components/Radio/index.d.ts +3 -0
  42. package/es/Radio/components/Radio/index.js +95 -0
  43. package/es/Radio/index.d.ts +9 -2
  44. package/es/Radio/index.js +5 -3
  45. package/es/Radio/interface/radio.d.ts +24 -0
  46. package/es/Radio/interface/radio.js +1 -0
  47. package/es/Radio/interface/radioGroup.d.ts +42 -0
  48. package/es/Radio/interface/radioGroup.js +1 -0
  49. package/es/Radio/style/index.less +348 -0
  50. package/es/Select/index.js +1 -1
  51. package/es/Select/rc-select/OptionList.js +3 -2
  52. package/es/Select/rc-select/hooks/useOptions.d.ts +1 -1
  53. package/es/Select/style/index.less +50 -49
  54. package/es/Select/style/variables.less +45 -45
  55. package/es/Select/utils/iconUtil.d.ts +2 -2
  56. package/es/Select/utils/iconUtil.js +6 -4
  57. package/es/Steps/components/ProcessIcon/index.d.ts +6 -0
  58. package/es/Steps/components/ProcessIcon/index.js +8 -0
  59. package/es/Steps/components/Step/index.d.ts +20 -0
  60. package/es/Steps/components/Step/index.js +45 -0
  61. package/es/Steps/index.d.ts +36 -2
  62. package/es/Steps/index.js +30 -1
  63. package/es/Steps/matchMedia.mock.d.ts +1 -0
  64. package/es/Steps/matchMedia.mock.js +17 -0
  65. package/es/Steps/style/index.less +251 -0
  66. package/es/Switch/index.d.ts +46 -2
  67. package/es/Switch/index.js +71 -1
  68. package/es/Switch/style/index.less +129 -0
  69. package/es/Table/Table.d.ts +2 -1
  70. package/es/Table/Table.js +223 -330
  71. package/es/Table/components/Empty/index.d.ts +3 -0
  72. package/es/Table/components/Empty/index.js +16 -0
  73. package/es/Table/components/Loading/index.d.ts +3 -0
  74. package/es/Table/components/Loading/index.js +18 -0
  75. package/es/Table/components/TableBodyRowList/index.d.ts +13 -0
  76. package/es/Table/components/TableBodyRowList/index.js +91 -0
  77. package/es/Table/components/TableHead/index.d.ts +23 -0
  78. package/es/Table/components/TableHead/index.js +262 -0
  79. package/es/Table/constant.d.ts +1 -0
  80. package/es/Table/constant.js +1 -0
  81. package/es/Table/hooks/useFrame.d.ts +7 -0
  82. package/es/Table/hooks/useFrame.js +90 -0
  83. package/es/Table/hooks/useTableColumn.d.ts +28 -0
  84. package/es/Table/hooks/useTableColumn.js +53 -0
  85. package/es/Table/interface.d.ts +3 -2
  86. package/es/Table/style/index.less +41 -37
  87. package/es/Table/style/index.less.d.ts +126 -0
  88. package/es/Table/style/variable.less +10 -0
  89. package/es/Table/style/variable.less.d.ts +7 -0
  90. package/es/Table/utils.d.ts +15 -0
  91. package/es/Table/utils.js +131 -0
  92. package/es/Tabs/index.js +3 -2
  93. package/es/Tabs/style/index.less +25 -25
  94. package/es/_utils/hooks/useId.d.ts +4 -0
  95. package/es/_utils/hooks/useId.js +23 -0
  96. package/es/index.d.ts +7 -5
  97. package/es/index.js +2 -1
  98. package/es/locale-provider/index.d.ts +5 -1
  99. package/es/style/index.d.ts +0 -1
  100. package/es/style/index.js +0 -1
  101. package/es/style/index.less +2 -2
  102. package/es/style/themes/default/index.less +30 -30
  103. package/lib/Breadcrumb/index.d.ts +1 -0
  104. package/lib/Button/index.js +5 -3
  105. package/lib/Button/style/index.less +135 -126
  106. package/lib/Button/style/variables.less +53 -53
  107. package/lib/Checkbox/index.d.ts +1 -0
  108. package/lib/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
  109. package/lib/ConfigProvider/defaultRenderEmpty.js +55 -0
  110. package/lib/ConfigProvider/sizeContext.d.ts +9 -0
  111. package/lib/ConfigProvider/sizeContext.js +30 -0
  112. package/lib/Dropdown/Button.js +7 -5
  113. package/lib/Empty/image/Authority.d.ts +1 -0
  114. package/lib/Empty/image/Dataspace.d.ts +1 -0
  115. package/lib/Empty/image/Search.d.ts +1 -0
  116. package/lib/Empty/image/Simple.d.ts +1 -0
  117. package/lib/Empty/image/Worksheet.d.ts +1 -0
  118. package/lib/Empty/image/empty.d.ts +1 -0
  119. package/lib/Icon/icons.json +418 -0
  120. package/lib/Input/components/Group/index.d.ts +3 -1
  121. package/lib/Input/components/Group/index.js +7 -12
  122. package/lib/Input/components/Input/index.d.ts +3 -2
  123. package/lib/Input/components/Input/index.js +13 -23
  124. package/lib/Input/components/Password/index.js +13 -17
  125. package/lib/Input/components/TextArea/index.d.ts +8 -1
  126. package/lib/Input/components/TextArea/index.js +10 -1
  127. package/lib/Input/style/index.less +180 -102
  128. package/lib/InputNumber/index.d.ts +1 -0
  129. package/lib/InputNumber/style/index.less +69 -69
  130. package/lib/Menu/Divider.d.ts +1 -0
  131. package/lib/Modal/index.js +8 -10
  132. package/lib/Modal/style/index.less +48 -45
  133. package/lib/Navigator/components/Header/index.d.ts +1 -0
  134. package/lib/Navigator/components/Menu/index.d.ts +1 -0
  135. package/lib/PageHeader/index.d.ts +3 -0
  136. package/lib/PageHeader/index.js +15 -0
  137. package/lib/PageHeader/style/index.d.ts +2 -0
  138. package/lib/PageHeader/style/index.js +5 -0
  139. package/lib/PageHeader/style/index.less +1 -0
  140. package/lib/Popover/index.d.ts +1 -0
  141. package/lib/Radio/components/Group/index.d.ts +6 -0
  142. package/lib/Radio/components/Group/index.js +95 -0
  143. package/lib/Radio/components/Radio/index.d.ts +3 -0
  144. package/lib/Radio/components/Radio/index.js +115 -0
  145. package/lib/Radio/index.d.ts +9 -2
  146. package/lib/Radio/index.js +5 -3
  147. package/lib/Radio/interface/radio.d.ts +24 -0
  148. package/lib/Radio/interface/radio.js +5 -0
  149. package/lib/Radio/interface/radioGroup.d.ts +42 -0
  150. package/lib/Radio/interface/radioGroup.js +5 -0
  151. package/lib/Radio/style/index.less +348 -0
  152. package/lib/Select/index.js +1 -1
  153. package/lib/Select/rc-select/OptionList.js +7 -5
  154. package/lib/Select/rc-select/hooks/useOptions.d.ts +1 -1
  155. package/lib/Select/style/index.less +50 -49
  156. package/lib/Select/style/variables.less +45 -45
  157. package/lib/Select/utils/iconUtil.d.ts +2 -2
  158. package/lib/Select/utils/iconUtil.js +10 -8
  159. package/lib/Steps/components/ProcessIcon/index.d.ts +6 -0
  160. package/lib/Steps/components/ProcessIcon/index.js +19 -0
  161. package/lib/Steps/components/Step/index.d.ts +20 -0
  162. package/lib/Steps/components/Step/index.js +61 -0
  163. package/lib/Steps/index.d.ts +36 -2
  164. package/lib/Steps/index.js +34 -1
  165. package/lib/Steps/matchMedia.mock.d.ts +1 -0
  166. package/lib/Steps/matchMedia.mock.js +17 -0
  167. package/lib/Steps/style/index.less +251 -0
  168. package/lib/Switch/index.d.ts +46 -2
  169. package/lib/Switch/index.js +78 -1
  170. package/lib/Switch/style/index.less +129 -0
  171. package/lib/Table/Table.d.ts +2 -1
  172. package/lib/Table/Table.js +229 -332
  173. package/lib/Table/components/Empty/index.d.ts +3 -0
  174. package/lib/Table/components/Empty/index.js +28 -0
  175. package/lib/Table/components/Loading/index.d.ts +3 -0
  176. package/lib/Table/components/Loading/index.js +31 -0
  177. package/lib/Table/components/TableBodyRowList/index.d.ts +13 -0
  178. package/lib/Table/components/TableBodyRowList/index.js +110 -0
  179. package/lib/Table/components/TableHead/index.d.ts +23 -0
  180. package/lib/Table/components/TableHead/index.js +286 -0
  181. package/lib/Table/constant.d.ts +1 -0
  182. package/lib/Table/constant.js +1 -0
  183. package/lib/Table/hooks/useFrame.d.ts +7 -0
  184. package/lib/Table/hooks/useFrame.js +98 -0
  185. package/lib/Table/hooks/useTableColumn.d.ts +28 -0
  186. package/lib/Table/hooks/useTableColumn.js +66 -0
  187. package/lib/Table/interface.d.ts +3 -2
  188. package/lib/Table/style/index.less +41 -37
  189. package/lib/Table/style/index.less.d.ts +126 -0
  190. package/lib/Table/style/variable.less +10 -0
  191. package/lib/Table/style/variable.less.d.ts +7 -0
  192. package/lib/Table/utils.d.ts +15 -0
  193. package/lib/Table/utils.js +147 -0
  194. package/lib/Tabs/index.js +5 -3
  195. package/lib/Tabs/style/index.less +25 -25
  196. package/lib/_utils/hooks/useId.d.ts +4 -0
  197. package/lib/_utils/hooks/useId.js +36 -0
  198. package/lib/index.d.ts +7 -5
  199. package/lib/index.js +8 -0
  200. package/lib/locale-provider/index.d.ts +5 -1
  201. package/lib/style/index.d.ts +0 -1
  202. package/lib/style/index.js +0 -2
  203. package/lib/style/index.less +2 -2
  204. package/lib/style/themes/default/index.less +30 -30
  205. package/package.json +2 -1
@@ -1 +1,252 @@
1
1
  @import '../../style/index.less';
2
+
3
+ .ant-steps-item-icon {
4
+ width: 24px;
5
+ height: 24px;
6
+ margin: 6px 8px -2px 0;
7
+ font-size: 12px;
8
+ line-height: 24px;
9
+ text-align: center;
10
+ border-radius: 24px;
11
+ transition: background-color 0.3s, border-color 0.3s;
12
+ }
13
+
14
+ // 水平状态下
15
+ .ant-steps.ald-steps {
16
+ padding: 24px;
17
+
18
+ .ant-steps-item-content {
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ margin: 0 -4px;
23
+ }
24
+
25
+ .ant-steps-item-custom > .ant-steps-item-container > .ant-steps-item-icon > .ant-steps-icon {
26
+ top: 2px;
27
+ left: 0.5px;
28
+ width: 16px;
29
+ height: 16px;
30
+ font-size: 16px;
31
+ line-height: 16px;
32
+ }
33
+
34
+ // 常规step
35
+ .ant-steps-item {
36
+ .ant-steps-item-tail {
37
+ margin-left: 50px;
38
+ padding: 3.5px 7px;
39
+
40
+ &::after {
41
+ height: 2px;
42
+ background-color: @NL90;
43
+ }
44
+ }
45
+
46
+ .ant-steps-item-title {
47
+ height: 20px;
48
+ font-weight: 400;
49
+ font-size: 14px;
50
+ font-style: normal;
51
+ line-height: 20px;
52
+ }
53
+
54
+ .ant-steps-item-description {
55
+ max-width: 264px;
56
+ max-height: 32px;
57
+ margin-top: 3px;
58
+ overflow: hidden;
59
+ color: @NL50;
60
+ font-weight: 400;
61
+ font-size: 12px;
62
+ font-style: normal;
63
+ line-height: 16px;
64
+ word-break: break-all;
65
+ }
66
+ }
67
+ // 已完成的step
68
+ .ant-steps-item-finish {
69
+ .ant-steps-item-tail::after {
70
+ height: 2px;
71
+ background-color: @B60;
72
+ }
73
+
74
+ .ant-steps-item-title {
75
+ color: @NL50;
76
+ }
77
+ }
78
+ // 正在进行中的step
79
+ .ant-steps-item-active {
80
+ .ant-steps-item-title {
81
+ color: @B60;
82
+ font-weight: 500;
83
+ }
84
+ }
85
+ // 等待中step
86
+ .ant-steps-item-wait {
87
+ .ant-steps-item-title {
88
+ color: @NL0;
89
+ }
90
+ }
91
+ // 错误状态下的step
92
+ .ant-steps-item-error {
93
+ .ant-steps-item-title {
94
+ color: @SC60;
95
+ }
96
+ }
97
+ }
98
+ // 竖直状态下
99
+ .ant-steps.ald-steps.ant-steps-vertical {
100
+ height: 100%;
101
+
102
+ .ant-steps-item-container {
103
+ display: flex;
104
+ align-items: center;
105
+
106
+ .ant-steps-item-content {
107
+ display: flex;
108
+ flex-direction: column;
109
+ align-items: flex-start;
110
+ justify-content: center;
111
+ margin-left: 5px;
112
+
113
+ .ant-steps-item-title {
114
+ height: 20px;
115
+ margin-top: 1px;
116
+ font-size: 14px;
117
+ line-height: 20px;
118
+ }
119
+
120
+ .ant-steps-item-description {
121
+ max-width: 264px;
122
+ // height: 16px;
123
+ max-height: 32px;
124
+ margin-top: 4px;
125
+ padding: 0;
126
+ overflow: hidden;
127
+ font-size: 12px;
128
+ line-height: 16px;
129
+ text-overflow: ellipsis;
130
+ word-wrap: break-word;
131
+ -webkit-line-clamp: 2;
132
+ }
133
+ }
134
+
135
+ .ant-steps-item-icon {
136
+ width: 16px;
137
+ height: 16px;
138
+ margin-top: 0;
139
+ margin-right: 0;
140
+
141
+ & .ant-steps-icon {
142
+ top: 0;
143
+ left: 0.5px;
144
+ width: 16px;
145
+ height: 16px;
146
+ font-size: 16px;
147
+ line-height: 16px;
148
+ }
149
+ }
150
+ }
151
+
152
+ // 常规step
153
+ .ant-steps-item {
154
+ &:last-child {
155
+ flex: 0 0 auto;
156
+ }
157
+
158
+ .ant-steps-item-tail {
159
+ position: absolute;
160
+ top: 18px;
161
+ left: 8px;
162
+ width: 2px;
163
+ height: 100%;
164
+ margin: 0;
165
+ padding: 14px 0 0;
166
+
167
+ &::after {
168
+ width: 2px;
169
+ height: 100%;
170
+ background-color: @NL90;
171
+ }
172
+ }
173
+ }
174
+ // 已完成的step
175
+ .ant-steps-item-finish {
176
+ .ant-steps-item-tail::after {
177
+ width: 2px;
178
+ height: 100%;
179
+ background-color: @B60;
180
+ }
181
+
182
+ &.ant-steps-item-title {
183
+ color: @NL50;
184
+ }
185
+ }
186
+ }
187
+
188
+ .ant-steps.ald-steps
189
+ .ant-steps-item:not(.ant-steps-item-active)
190
+ > .ant-steps-item-container[role='button'] {
191
+ cursor: pointer;
192
+
193
+ &:hover {
194
+ .ant-steps-item-title,
195
+ .ant-steps-item-description {
196
+ color: #0f62fe;
197
+ }
198
+ }
199
+ }
200
+ // 自定义Icon的样式
201
+ .icon-box {
202
+ display: flex;
203
+ align-items: center;
204
+ justify-content: center;
205
+ width: 16px;
206
+ height: 16px;
207
+ margin-bottom: 9px;
208
+ background-color: #fff;
209
+ border-radius: 50%;
210
+ }
211
+
212
+ .error-icon-box {
213
+ color: @SC60;
214
+ }
215
+
216
+ .check-icon-box {
217
+ color: @B60;
218
+ }
219
+ // 提升该类名的优先级,不然会被.iconBox覆盖掉
220
+ .ald-steps .process-icon-box {
221
+ position: relative;
222
+ background-color: @B60;
223
+
224
+ &::after {
225
+ position: absolute;
226
+ top: 50%;
227
+ left: 50%;
228
+ width: 6px;
229
+ height: 6px;
230
+ background-color: @ND0;
231
+ border-radius: 50%;
232
+ transform: translate(-50%, -50%);
233
+ content: '';
234
+ }
235
+ }
236
+
237
+ .ald-steps .wait-icon-box {
238
+ position: relative;
239
+ background-color: @BG90;
240
+
241
+ &::after {
242
+ position: absolute;
243
+ top: 50%;
244
+ left: 50%;
245
+ width: 6px;
246
+ height: 6px;
247
+ background-color: @BG80;
248
+ border-radius: 50%;
249
+ transform: translate(-50%, -50%);
250
+ content: '';
251
+ }
252
+ }
@@ -1,4 +1,48 @@
1
- import Switch, { SwitchProps } from 'antd/es/switch';
1
+ import { SwitchChangeEventHandler } from 'antd/es/switch';
2
+ import React from 'react';
2
3
  export type { SwitchSize, SwitchChangeEventHandler, SwitchClickEventHandler } from 'antd/es/switch';
3
- export { SwitchProps };
4
+ export interface ISwitchProps {
5
+ /**
6
+ * @description class类名
7
+ * @default -
8
+ */
9
+ className?: string;
10
+ /**
11
+ * @description 指定当前是否选中
12
+ * @default false
13
+ */
14
+ checked?: boolean;
15
+ /**
16
+ * @description 初始是否选中
17
+ * @default false
18
+ */
19
+ defaultChecked?: boolean;
20
+ /**
21
+ * @description 是否禁用
22
+ * @default false
23
+ */
24
+ disabled?: boolean;
25
+ /**
26
+ * @description 加载中的开关
27
+ * @default false
28
+ */
29
+ loading?: boolean;
30
+ /**
31
+ * @description 尺寸大小
32
+ * @default middle
33
+ */
34
+ size?: 'middle' | 'small';
35
+ /**
36
+ * @description 点击时的回调
37
+ * @type (checked: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
38
+ */
39
+ onClick?: SwitchChangeEventHandler;
40
+ /**
41
+ * @description 变时的回调
42
+ * @type (checked: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
43
+ */
44
+ onChange?: SwitchChangeEventHandler;
45
+ children?: React.ReactNode;
46
+ }
47
+ declare const Switch: React.FC<ISwitchProps>;
4
48
  export default Switch;
@@ -1,13 +1,90 @@
1
1
  "use strict";
2
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
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = void 0;
7
9
 
10
+ require("antd/es/switch/style");
11
+
8
12
  var _switch = _interopRequireDefault(require("antd/es/switch"));
9
13
 
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _classnames = _interopRequireDefault(require("classnames"));
17
+
18
+ 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); }
19
+
20
+ 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; }
21
+
10
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
23
 
12
- var _default = _switch.default;
24
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
+
26
+ 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."); }
27
+
28
+ 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); }
29
+
30
+ 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; }
31
+
32
+ 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; }
33
+
34
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
+
36
+ var Switch = function Switch(_ref) {
37
+ var _ref$className = _ref.className,
38
+ className = _ref$className === void 0 ? '' : _ref$className,
39
+ _ref$disabled = _ref.disabled,
40
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
41
+ _ref$loading = _ref.loading,
42
+ loading = _ref$loading === void 0 ? false : _ref$loading,
43
+ _ref$size = _ref.size,
44
+ size = _ref$size === void 0 ? 'middle' : _ref$size,
45
+ checked = _ref.checked,
46
+ _ref$defaultChecked = _ref.defaultChecked,
47
+ defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
48
+ onChange = _ref.onChange,
49
+ onClick = _ref.onClick,
50
+ children = _ref.children;
51
+
52
+ var _useState = (0, _react.useState)(typeof checked === 'undefined' ? defaultChecked : checked),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ userChecked = _useState2[0],
55
+ setUserChecked = _useState2[1];
56
+
57
+ var onChangeCB = function onChangeCB(isChecked, event) {
58
+ setUserChecked(isChecked);
59
+
60
+ if (typeof onChange === 'function') {
61
+ onChange(isChecked, event);
62
+ }
63
+ };
64
+
65
+ var currentDisabled = loading ? true : disabled;
66
+ (0, _react.useEffect)(function () {
67
+ if (typeof checked === 'boolean') {
68
+ setUserChecked(checked);
69
+ }
70
+ }, [checked]);
71
+ return /*#__PURE__*/_react.default.createElement("span", {
72
+ className: (0, _classnames.default)(className, 'ald-switch', "ald-switch-".concat(size), {
73
+ 'ald-switch-disabled': currentDisabled,
74
+ 'ald-switch-checked': userChecked
75
+ })
76
+ }, /*#__PURE__*/_react.default.createElement(_switch.default, {
77
+ disabled: currentDisabled,
78
+ loading: loading,
79
+ onChange: onChangeCB,
80
+ onClick: onClick,
81
+ checked: userChecked,
82
+ className: "ald-switch-btn",
83
+ defaultChecked: defaultChecked
84
+ }), children && /*#__PURE__*/_react.default.createElement("span", {
85
+ className: "ald-switch-text"
86
+ }, children));
87
+ };
88
+
89
+ var _default = Switch;
13
90
  exports.default = _default;
@@ -1 +1,130 @@
1
1
  @import '../../style/index.less';
2
+
3
+ @switch-handle-middle: @font-size-middle;
4
+ @switch-handle-height-middle: @line-height-middle;
5
+ @switch-handle-small: @font-size-small;
6
+ @switch-handle-height-small: @line-height-small;
7
+ @switch-handle-gap-middle: 3px;
8
+ @switch-handle-gap-small: 2px;
9
+ @switch-text-margin-left: 8px;
10
+ @switch-aspect-ratio: 2; //宽高比
11
+ @switch-height-radius-ratio: 2; //高度和边框圆角比
12
+
13
+ .ald-switch {
14
+ display: inline-block;
15
+ font-size: 0;
16
+
17
+ .ald-switch-btn {
18
+ background: @NL90;
19
+
20
+ &:focus {
21
+ box-shadow: none;
22
+ }
23
+ }
24
+
25
+ .ald-switch-text {
26
+ display: inline-flex;
27
+ align-items: center;
28
+ margin-left: @switch-text-margin-left;
29
+ color: @NL0;
30
+ vertical-align: middle;
31
+ }
32
+
33
+ &.ald-switch-checked {
34
+ .ald-switch-btn {
35
+ background-color: @B60;
36
+ }
37
+ }
38
+
39
+ &.ald-switch-disabled {
40
+ cursor: initial;
41
+
42
+ .ald-switch-btn {
43
+ cursor: initial;
44
+ opacity: 0.5;
45
+
46
+ * {
47
+ cursor: initial;
48
+ }
49
+ }
50
+
51
+ .ald-switch-text {
52
+ color: @NL60;
53
+ }
54
+ }
55
+
56
+ &.ald-switch-middle {
57
+ .ald-switch-btn {
58
+ width: @switch-handle-height-middle * @switch-aspect-ratio;
59
+ min-width: @switch-handle-height-middle * @switch-aspect-ratio;
60
+ height: @switch-handle-height-middle;
61
+ line-height: @switch-handle-height-middle;
62
+ border-radius: @switch-handle-height-middle / @switch-height-radius-ratio;
63
+
64
+ .ant-switch-handle {
65
+ top: @switch-handle-gap-middle;
66
+ left: @switch-handle-gap-middle;
67
+ width: @switch-handle-middle;
68
+ height: @switch-handle-middle;
69
+
70
+ .ant-switch-loading-icon {
71
+ width: @switch-handle-middle - 4px;
72
+ height: @switch-handle-middle - 4px;
73
+ font-size: @switch-handle-middle - 4px;
74
+ }
75
+ }
76
+ }
77
+
78
+ .ald-switch-text {
79
+ height: @switch-handle-height-middle;
80
+ font-size: @font-size-middle;
81
+ line-height: @switch-handle-height-middle;
82
+ }
83
+
84
+ &.ald-switch-checked {
85
+ .ant-switch-handle {
86
+ top: 3px;
87
+ left: calc(100% - @switch-handle-middle - @switch-handle-gap-middle);
88
+ width: @switch-handle-middle;
89
+ height: @switch-handle-middle;
90
+ }
91
+ }
92
+ }
93
+
94
+ &.ald-switch-small {
95
+ .ald-switch-btn {
96
+ width: @switch-handle-height-small * @switch-aspect-ratio;
97
+ min-width: @switch-handle-height-small * @switch-aspect-ratio;
98
+ height: @switch-handle-height-small;
99
+ line-height: @switch-handle-height-small;
100
+ border-radius: @switch-handle-height-small / @switch-height-radius-ratio;
101
+
102
+ .ant-switch-handle {
103
+ top: @switch-handle-gap-small;
104
+ left: @switch-handle-gap-small;
105
+ width: @switch-handle-small;
106
+ height: @switch-handle-small;
107
+
108
+ .ant-switch-loading-icon {
109
+ width: @switch-handle-small - 4px;
110
+ height: @switch-handle-small - 4px;
111
+ font-size: @switch-handle-small - 4px;
112
+ }
113
+ }
114
+ }
115
+
116
+ .ald-switch-text {
117
+ height: @switch-handle-height-small;
118
+ font-size: @font-size-small;
119
+ line-height: @switch-handle-height-small;
120
+ }
121
+
122
+ &.ald-switch-checked {
123
+ .ant-switch-handle {
124
+ left: calc(100% - @switch-handle-small - @switch-handle-gap-small);
125
+ width: @switch-handle-small;
126
+ height: @switch-handle-small;
127
+ }
128
+ }
129
+ }
130
+ }
@@ -1,5 +1,6 @@
1
1
  import React, { ReactElement } from 'react';
2
2
  import { ITableProps } from './interface';
3
- declare function Table<RecordType extends object = any>(props: ITableProps<RecordType>, ref?: React.Ref<unknown>): ReactElement;
3
+ import './style/index';
4
+ declare function Table<RecordType extends object = {}>(props: ITableProps<RecordType>, ref?: React.Ref<unknown>): ReactElement;
4
5
  declare const _default: typeof Table;
5
6
  export default _default;