@aloudata/aloudata-design 2.6.3 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,18 @@
1
- import { Badge, BadgeProps } from 'antd';
2
- export type { BadgeProps };
3
- export default Badge;
1
+ import React from 'react';
2
+ export interface BadgeProps {
3
+ /**
4
+ * 展示的文本内容
5
+ */
6
+ count: string | number;
7
+ /**
8
+ * 状态
9
+ */
10
+ status?: 'success' | 'error' | 'default' | 'info' | 'warning';
11
+ /**
12
+ * 大小
13
+ */
14
+ size?: 'default' | 'large';
15
+ className?: string;
16
+ onClick?: React.MouseEventHandler;
17
+ }
18
+ export default function Badge(props: BadgeProps): React.JSX.Element;
@@ -1,2 +1,45 @@
1
- import { Badge } from 'antd';
2
- export default Badge;
1
+ 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); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ import classNames from 'classnames';
6
+ import React from 'react';
7
+ export default function Badge(props) {
8
+ var _classNames;
9
+ var count = props.count,
10
+ _props$status = props.status,
11
+ status = _props$status === void 0 ? 'default' : _props$status,
12
+ size = props.size,
13
+ className = props.className,
14
+ onClick = props.onClick;
15
+ var status2ColorMap = {
16
+ success: {
17
+ color: '#15803D',
18
+ backgroundColor: '#BBF7D0'
19
+ },
20
+ error: {
21
+ color: '#B91C1C',
22
+ backgroundColor: '#FECACA'
23
+ },
24
+ default: {
25
+ color: '#374151',
26
+ backgroundColor: '#E5E7EB'
27
+ },
28
+ info: {
29
+ color: '#0F59B1',
30
+ backgroundColor: '#A9CFFB'
31
+ },
32
+ warning: {
33
+ color: '#A16207',
34
+ backgroundColor: '#FEF08A'
35
+ }
36
+ };
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ className: classNames('ald-badge', (_classNames = {}, _defineProperty(_classNames, 'ald-badge-large', size === 'large'), _defineProperty(_classNames, 'ald-badge-clickable', typeof onClick === 'function'), _classNames), className),
39
+ style: {
40
+ color: status2ColorMap[status].color,
41
+ backgroundColor: status2ColorMap[status].backgroundColor
42
+ },
43
+ onClick: onClick
44
+ }, count);
45
+ }
@@ -1 +1,24 @@
1
1
  @import '../../style/index.less';
2
+
3
+ .ald-badge {
4
+ display: inline-flex;
5
+ padding: var(--alias-padding-25, 2px) var(--alias-padding-75, 6px);
6
+ align-items: center;
7
+ min-width: 20px;
8
+ height: 20px;
9
+ border-radius: 99px;
10
+ font-size: 12px;
11
+ line-height: 16px;
12
+ font-weight: 500;
13
+
14
+ &.ald-badge-large {
15
+ font-size: 14px;
16
+ line-height: 20px;
17
+ min-width: 24px;
18
+ height: 24px;
19
+ }
20
+
21
+ &.ald-badge-clickable {
22
+ cursor: pointer;
23
+ }
24
+ }
@@ -3,6 +3,14 @@
3
3
  .ant-form {
4
4
  &.ant-form {
5
5
  font-size: 14px;
6
+
7
+ &.ant-form-vertical {
8
+ .ant-form-item {
9
+ .ant-form-item-label label {
10
+ font-size: 12px;
11
+ }
12
+ }
13
+ }
6
14
  }
7
15
 
8
16
  .ant-form-item {
@@ -33,9 +41,7 @@
33
41
  margin-left: var(--alias-spacing-25, 2px);
34
42
  }
35
43
 
36
- &.ant-form-item-required:not(
37
- .ant-form-item-required-mark-optional
38
- )::before {
44
+ &.ant-form-item-required::before {
39
45
  width: 8px;
40
46
  margin-right: var(--alias-spacing-25, 2px);
41
47
  color: var(--alias-colors-text-danger, #b91c1c);
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { BadgeProps } from '../Badge';
3
+ interface OverflowCountProps<T> {
4
+ /**
5
+ * 数据
6
+ */
7
+ data: T[];
8
+ /**
9
+ * 渲染单条数据的方法
10
+ */
11
+ renderItem: (item: T) => React.ReactNode;
12
+ /**
13
+ * 徽标样式
14
+ */
15
+ badge?: Omit<BadgeProps, 'count'>;
16
+ /**
17
+ * 浮窗样式
18
+ */
19
+ popupClassName?: string;
20
+ /**
21
+ * 后缀元素
22
+ */
23
+ suffix?: React.ReactNode;
24
+ size?: 'small' | 'default';
25
+ }
26
+ declare function OverflowCount<T = unknown>(props: OverflowCountProps<T>): React.JSX.Element;
27
+ export default OverflowCount;
28
+ export declare function prefixCls(className: string): string;
@@ -0,0 +1,77 @@
1
+ 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); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ 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."); }
8
+ 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); }
9
+ 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; }
10
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ import classNames from 'classnames';
13
+ import Overflow from 'rc-overflow';
14
+ import React, { useCallback, useState } from 'react';
15
+ import Badge from "../Badge";
16
+ import Popover from "../Popover";
17
+ function OverflowCount(props) {
18
+ var data = props.data,
19
+ propsRenderItem = props.renderItem,
20
+ _props$popupClassName = props.popupClassName,
21
+ popupClassName = _props$popupClassName === void 0 ? '' : _props$popupClassName,
22
+ badge = props.badge,
23
+ size = props.size,
24
+ suffix = props.suffix;
25
+ var _useState = useState(false),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ isPopupOpen = _useState2[0],
28
+ setIsPopupOpen = _useState2[1];
29
+ var itemClassName = classNames(prefixCls('item'), _defineProperty({}, prefixCls('item-small'), size === 'small'));
30
+ var renderItem = useCallback(function (item) {
31
+ return /*#__PURE__*/React.createElement("div", {
32
+ className: itemClassName
33
+ }, propsRenderItem(item));
34
+ }, [propsRenderItem, itemClassName]);
35
+ var renderRest = useCallback(function (omittedItems) {
36
+ var itemNodes = omittedItems.map(function (item, index) {
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ key: index,
39
+ className: itemClassName
40
+ }, propsRenderItem(item));
41
+ });
42
+ if (omittedItems.length === 0) {
43
+ // 因为没有其他 api 监听超过的量的变化,只能在 render 阶段处理
44
+ setIsPopupOpen(false);
45
+ }
46
+ return /*#__PURE__*/React.createElement(Popover, {
47
+ content: /*#__PURE__*/React.createElement("div", {
48
+ className: classNames(prefixCls('popup-container'), _defineProperty({}, prefixCls('popup-container-small'), size === 'small'), popupClassName)
49
+ }, itemNodes),
50
+ trigger: 'hover',
51
+ open: isPopupOpen,
52
+ onOpenChange: function onOpenChange(open) {
53
+ return setIsPopupOpen(open);
54
+ }
55
+ }, /*#__PURE__*/React.createElement("div", {
56
+ className: prefixCls('rest-btn')
57
+ }, /*#__PURE__*/React.createElement(Badge, _extends({
58
+ count: "+".concat(omittedItems.length),
59
+ status: "info"
60
+ }, badge))));
61
+ }, [badge, popupClassName, propsRenderItem, itemClassName, size, isPopupOpen]);
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ className: classNames(prefixCls('container'))
64
+ }, /*#__PURE__*/React.createElement(Overflow, {
65
+ data: data,
66
+ renderItem: renderItem,
67
+ renderRest: renderRest,
68
+ maxCount: "responsive",
69
+ className: prefixCls('overflow'),
70
+ suffix: suffix
71
+ }));
72
+ }
73
+ export default OverflowCount;
74
+ var ALD_PREFIX = 'ald-overflow-count';
75
+ export function prefixCls(className) {
76
+ return "".concat(ALD_PREFIX, "-").concat(className);
77
+ }
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style";
2
+ import "./index.less";
@@ -0,0 +1,51 @@
1
+ @import '../../style/index.less';
2
+ @import '../../Badge/style/index.less';
3
+ @import '../../Popover/style/index.less';
4
+
5
+ .ald-overflow-count-container {
6
+ width: 100%;
7
+
8
+ .ald-overflow-count-overflow {
9
+ display: flex;
10
+ position: relative;
11
+ flex-wrap: wrap;
12
+ max-width: 100%;
13
+ align-items: center;
14
+ }
15
+
16
+ .ald-overflow-count-rest-btn {
17
+ cursor: pointer;
18
+ display: flex;
19
+ align-items: center;
20
+ }
21
+
22
+ .rc-overflow-item,
23
+ .rc-overflow-item-rest,
24
+ .rc-overflow-item-suffix {
25
+ display: flex;
26
+ height: 100%;
27
+ align-items: center;
28
+ }
29
+ }
30
+
31
+ .ald-overflow-count-item {
32
+ padding-right: 6px;
33
+
34
+ &.ald-overflow-count-small {
35
+ padding-right: 4px;
36
+ }
37
+ }
38
+
39
+ .ald-overflow-count-popup-container {
40
+ width: 360px;
41
+ max-height: 300px;
42
+ overflow: hidden;
43
+ overflow-y: auto;
44
+ display: flex;
45
+ flex-wrap: wrap;
46
+ row-gap: 6px;
47
+
48
+ &.ald-overflow-count-popup-container-small {
49
+ row-gap: 4px;
50
+ }
51
+ }
@@ -68,6 +68,10 @@
68
68
  cursor: initial;
69
69
  pointer-events: none;
70
70
 
71
+ .ald-switch-btn {
72
+ opacity: 0.4;
73
+ }
74
+
71
75
  .ald-switch-text {
72
76
  opacity: 0.5;
73
77
  color: #171717;
@@ -6,27 +6,25 @@
6
6
 
7
7
  @header-height: 40px;
8
8
 
9
- @ald: ~'ald-table-';
10
-
11
- .@{ald}container {
9
+ .ald-table-container {
12
10
  display: flex;
13
11
  flex-direction: column;
14
12
  width: 100%;
15
13
  }
16
14
 
17
- .@{ald}main {
15
+ .ald-table-main {
18
16
  width: 100%;
19
17
  font-size: 13px;
20
18
  line-height: 20px;
21
19
  background: #fff;
22
20
  color: var(--alias-colors-text-subtle, #4b5563);
23
21
 
24
- .@{ald}content {
22
+ .ald-table-content {
25
23
  display: flex;
26
24
  flex-direction: column;
27
25
  border-spacing: 0;
28
26
 
29
- .@{ald}spin {
27
+ .ald-table-spin {
30
28
  position: absolute;
31
29
  top: 0;
32
30
  left: 0;
@@ -40,7 +38,7 @@
40
38
  }
41
39
  }
42
40
 
43
- .@{ald}spin-mask {
41
+ .ald-table-spin-mask {
44
42
  position: absolute;
45
43
  top: 0;
46
44
  left: 0;
@@ -52,7 +50,7 @@
52
50
  }
53
51
  }
54
52
 
55
- .@{ald}resizer {
53
+ .ald-table-resizer {
56
54
  position: absolute;
57
55
  right: 0;
58
56
  top: 0;
@@ -76,36 +74,36 @@
76
74
  }
77
75
  }
78
76
 
79
- .@{ald}overflow-x {
77
+ .ald-table-overflow-x {
80
78
  overflow-x: hidden;
81
79
  }
82
80
 
83
- .@{ald}tr {
81
+ .ald-table-tr {
84
82
  display: flex;
85
83
  }
86
84
 
87
- .@{ald}th,
88
- .@{ald}td {
85
+ .ald-table-th,
86
+ .ald-table-td {
89
87
  position: relative;
90
88
  border-bottom: 1px solid var(--alias-colors-border-subtle, #f3f4f6);
91
89
  flex: 0 0 auto;
92
90
 
93
- &.@{ald}fixed-left,
94
- &.@{ald}fixed-right {
91
+ &.ald-table-fixed-left,
92
+ &.ald-table-fixed-right {
95
93
  position: sticky;
96
94
  z-index: 2;
97
95
  }
98
96
  }
99
97
 
100
- .@{ald}no-border-tr {
101
- .@{ald}td {
98
+ .ald-table-no-border-tr {
99
+ .ald-table-td {
102
100
  border-bottom: none;
103
101
  }
104
102
  }
105
103
 
106
- .@{ald}td {
107
- &.@{ald}fixed-left,
108
- &.@{ald}fixed-right {
104
+ .ald-table-td {
105
+ &.ald-table-fixed-left,
106
+ &.ald-table-fixed-right {
109
107
  background-color: #fff;
110
108
  }
111
109
  }
@@ -140,23 +138,23 @@
140
138
  }
141
139
  }
142
140
 
143
- &.@{ald}ping-left {
144
- .@{ald}fixed-left {
141
+ &.ald-table-ping-left {
142
+ .ald-table-fixed-left {
145
143
  .fixed-left-shadow();
146
144
  }
147
145
  }
148
146
 
149
- &.@{ald}ping-right {
150
- .@{ald}fixed-right {
147
+ &.ald-table-ping-right {
148
+ .ald-table-fixed-right {
151
149
  .fixed-right-shadow();
152
150
  }
153
151
  }
154
152
 
155
- .@{ald}th {
153
+ .ald-table-th {
156
154
  background: var(--alias-colors-bg-skeleton-strong, #f3f4f6);
157
155
  }
158
156
 
159
- .@{ald}th-default {
157
+ .ald-table-th-default {
160
158
  font-weight: 500;
161
159
  line-height: 16px;
162
160
  padding: @td-padding-size;
@@ -168,7 +166,7 @@
168
166
  color: var(--alias-colors-text-subtle, #4b5563);
169
167
  }
170
168
 
171
- .@{ald}td-default {
169
+ .ald-table-td-default {
172
170
  line-height: 20px;
173
171
  padding-left: @td-padding-size;
174
172
  display: flex;
@@ -179,27 +177,27 @@
179
177
  overflow: hidden;
180
178
  }
181
179
 
182
- .@{ald}td-ellipsis-content {
180
+ .ald-table-td-ellipsis-content {
183
181
  overflow: hidden;
184
182
  text-overflow: ellipsis;
185
183
  white-space: nowrap;
186
184
  }
187
185
 
188
- .@{ald}sticky {
186
+ .ald-table-sticky {
189
187
  position: sticky;
190
188
  top: 0;
191
189
  // 需要大于 Spin 的 z-index,Spin 的 z-index 为4
192
190
  z-index: 5;
193
191
  }
194
192
 
195
- .@{ald}body {
193
+ .ald-table-body {
196
194
  min-height: 96px;
197
195
 
198
- .@{ald}tr {
199
- &.@{ald}row-hover:hover {
196
+ .ald-table-tr {
197
+ &.ald-table-row-hover:hover {
200
198
  cursor: pointer;
201
199
 
202
- .@{ald}td {
200
+ .ald-table-td {
203
201
  background-color: var(
204
202
  --alias-colors-bg-interaction-hover,
205
203
  rgba(0, 0, 0, 0.05)
@@ -212,21 +210,21 @@
212
210
  @td-padding-size: 16px;
213
211
 
214
212
  /** Tree Table **/
215
- .@{ald}expandable-td {
213
+ .ald-table-expandable-td {
216
214
  display: flex;
217
215
  width: 100%;
218
216
  align-items: center;
219
217
  padding-left: @td-padding-size;
220
218
 
221
- .@{ald}indent-list {
219
+ .ald-table-indent-list {
222
220
  display: flex;
223
221
  }
224
222
 
225
- .@{ald}indent-item {
223
+ .ald-table-indent-item {
226
224
  width: 10px;
227
225
  }
228
226
 
229
- .@{ald}expand-btn {
227
+ .ald-table-expand-btn {
230
228
  width: 16px;
231
229
  cursor: pointer;
232
230
  margin-right: 6px;
@@ -235,13 +233,13 @@
235
233
  align-items: center;
236
234
  }
237
235
 
238
- .@{ald}td-default {
236
+ .ald-table-td-default {
239
237
  padding-left: 0;
240
238
  }
241
239
  }
242
240
  }
243
241
 
244
- .@{ald}align {
242
+ .ald-table-align {
245
243
  &-left {
246
244
  text-align: left;
247
245
  justify-content: left;
@@ -258,34 +256,34 @@
258
256
  }
259
257
  }
260
258
 
261
- .@{ald}pagination {
259
+ .ald-table-pagination {
262
260
  padding-top: 16px;
263
261
  display: flex;
264
262
  justify-content: end;
265
263
  border-top: 1px solid var(--alias-colors-border-default, #e5e7eb);
266
264
  }
267
265
 
268
- .@{ald}loading {
266
+ .ald-table-loading {
269
267
  position: absolute;
270
268
  top: 50%;
271
269
  left: 50%;
272
270
  transform: translate(-50%, -50%);
273
271
 
274
- .@{ald}loading-inner {
272
+ .ald-table-loading-inner {
275
273
  width: 100%;
276
274
  }
277
275
  }
278
276
 
279
- .@{ald}overflow-hidden {
277
+ .ald-table-overflow-hidden {
280
278
  overflow: hidden;
281
279
  height: 100%;
282
280
  }
283
281
 
284
- .@{ald}header {
282
+ .ald-table-header {
285
283
  background-color: #fff;
286
284
  }
287
285
 
288
- .@{ald}header-scroll-placeholder {
286
+ .ald-table-header-scroll-placeholder {
289
287
  height: @header-height;
290
288
  position: sticky;
291
289
  right: 0;
@@ -294,24 +292,24 @@
294
292
  flex: 0 0 auto;
295
293
  }
296
294
 
297
- .@{ald}body-scroll {
295
+ .ald-table-body-scroll {
298
296
  overflow: auto;
299
297
  height: 100%;
300
298
 
301
- &.@{ald}scroll-y {
299
+ &.ald-table-scroll-y {
302
300
  overflow-y: scroll;
303
301
  }
304
302
 
305
- &.@{ald}scroll-hidden {
303
+ &.ald-table-scroll-hidden {
306
304
  overflow: hidden;
307
305
  }
308
306
  }
309
307
 
310
- .@{ald}empty {
308
+ .ald-table-empty {
311
309
  margin-top: 80px;
312
310
  overflow: hidden;
313
311
 
314
- &.@{ald}empty-small {
312
+ &.ald-table-empty-small {
315
313
  margin-top: 20px;
316
314
  }
317
315
  }
@@ -1,3 +1,37 @@
1
- import { Tag, TagProps, TagType } from 'antd';
2
- export type { TagProps, TagType };
3
- export default Tag;
1
+ import React, { MouseEventHandler } from 'react';
2
+ export interface TagProps {
3
+ children: React.ReactNode;
4
+ onClick?: MouseEventHandler;
5
+ /**
6
+ * 是否可关闭
7
+ */
8
+ closable?: boolean;
9
+ /**
10
+ * 关闭回调
11
+ */
12
+ onClose?: MouseEventHandler;
13
+ status?: 'default' | 'info' | 'success' | 'warning' | 'error';
14
+ /**
15
+ * 自定义颜色
16
+ */
17
+ color?: string;
18
+ /**
19
+ * icon 图标
20
+ */
21
+ icon?: React.ReactNode;
22
+ /**
23
+ * 大小
24
+ */
25
+ size?: 'large' | 'default' | 'small';
26
+ /**
27
+ * 风格,填充、默认、线框
28
+ */
29
+ mode?: 'fill' | 'default' | 'border';
30
+ /**
31
+ * 是否禁用
32
+ */
33
+ disabled?: boolean;
34
+ className?: string;
35
+ }
36
+ export default function Tag(props: TagProps): React.JSX.Element;
37
+ export declare function prefixCls(className: string): string;