@aloudata/aloudata-design 2.6.0 → 2.6.1

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.
@@ -6,25 +6,27 @@
6
6
 
7
7
  @header-height: 40px;
8
8
 
9
- .ald-table-container {
9
+ @ald: ~'ald-table-';
10
+
11
+ .@{ald}container {
10
12
  display: flex;
11
13
  flex-direction: column;
12
14
  width: 100%;
13
15
  }
14
16
 
15
- .ald-table-main {
17
+ .@{ald}main {
16
18
  width: 100%;
17
19
  font-size: 13px;
18
20
  line-height: 20px;
19
21
  background: #fff;
20
22
  color: var(--alias-colors-text-subtle, #4b5563);
21
23
 
22
- .ald-table-content {
24
+ .@{ald}content {
23
25
  display: flex;
24
26
  flex-direction: column;
25
27
  border-spacing: 0;
26
28
 
27
- .ald-table-spin {
29
+ .@{ald}spin {
28
30
  position: absolute;
29
31
  top: 0;
30
32
  left: 0;
@@ -38,7 +40,7 @@
38
40
  }
39
41
  }
40
42
 
41
- .ald-table-spin-mask {
43
+ .@{ald}spin-mask {
42
44
  position: absolute;
43
45
  top: 0;
44
46
  left: 0;
@@ -50,7 +52,7 @@
50
52
  }
51
53
  }
52
54
 
53
- .ald-table-resizer {
55
+ .@{ald}resizer {
54
56
  position: absolute;
55
57
  right: 0;
56
58
  top: 0;
@@ -63,38 +65,51 @@
63
65
  &::after {
64
66
  content: '';
65
67
  display: block;
66
- height: 20px;
67
- width: 2px;
68
+ height: 100%;
69
+ width: 1px;
68
70
  position: absolute;
69
71
  top: 50%;
70
72
  right: -1px;
73
+ z-index: 1;
71
74
  transform: translateY(-50%);
72
- background-color: var(--alias-colors-border-subtle, #f3f4f6);
75
+ background-color: var(--alias-colors-border-default, #e5e7eb);
73
76
  }
74
77
  }
75
78
 
76
- .ald-table-overflow-x {
79
+ .@{ald}overflow-x {
77
80
  overflow-x: hidden;
78
81
  }
79
82
 
80
- .ald-table-tr {
83
+ .@{ald}tr {
81
84
  display: flex;
82
85
  }
83
86
 
84
- .ald-table-th,
85
- .ald-table-td {
87
+ .@{ald}th,
88
+ .@{ald}td {
86
89
  position: relative;
87
90
  border-bottom: 1px solid var(--alias-colors-border-subtle, #f3f4f6);
88
91
  flex: 0 0 auto;
89
92
 
90
- &.ald-table-fixed-left,
91
- &.ald-table-fixed-right {
93
+ &.@{ald}fixed-left,
94
+ &.@{ald}fixed-right {
92
95
  position: sticky;
93
- background-color: #fff;
94
96
  z-index: 2;
95
97
  }
96
98
  }
97
99
 
100
+ .@{ald}no-border-tr {
101
+ .@{ald}td {
102
+ border-bottom: none;
103
+ }
104
+ }
105
+
106
+ .@{ald}td {
107
+ &.@{ald}fixed-left,
108
+ &.@{ald}fixed-right {
109
+ background-color: #fff;
110
+ }
111
+ }
112
+
98
113
  .fixed-left-shadow {
99
114
  &::after {
100
115
  position: absolute;
@@ -125,37 +140,37 @@
125
140
  }
126
141
  }
127
142
 
128
- &.ald-table-ping-left {
129
- .ald-table-fixed-left {
143
+ &.@{ald}ping-left {
144
+ .@{ald}fixed-left {
130
145
  .fixed-left-shadow();
131
146
  }
132
147
  }
133
148
 
134
- &.ald-table-ping-right {
135
- .ald-table-fixed-right {
149
+ &.@{ald}ping-right {
150
+ .@{ald}fixed-right {
136
151
  .fixed-right-shadow();
137
152
  }
138
153
  }
139
154
 
140
- .ald-table-th {
141
- border-bottom: 1px solid var(--alias-colors-border-subtle, #f3f4f6);
142
- background-color: #fff;
155
+ .@{ald}th {
156
+ background: var(--alias-colors-bg-skeleton-strong, #f3f4f6);
143
157
  }
144
158
 
145
- .ald-table-th-default {
159
+ .@{ald}th-default {
146
160
  font-weight: 500;
147
161
  line-height: 16px;
148
- padding-left: var(--alias-spacing-200, 16px);
162
+ padding: @td-padding-size;
149
163
  font-size: 12px;
150
164
  overflow: hidden;
151
165
  height: @header-height;
152
166
  display: flex;
153
167
  align-items: center;
168
+ color: var(--alias-colors-text-subtle, #4b5563);
154
169
  }
155
170
 
156
- .ald-table-td-default {
171
+ .@{ald}td-default {
157
172
  line-height: 20px;
158
- padding-left: var(--alias-spacing-200, 16px);
173
+ padding-left: @td-padding-size;
159
174
  display: flex;
160
175
  align-items: center;
161
176
  height: 100%;
@@ -164,27 +179,27 @@
164
179
  overflow: hidden;
165
180
  }
166
181
 
167
- .ald-table-td-ellipsis-content {
182
+ .@{ald}td-ellipsis-content {
168
183
  overflow: hidden;
169
184
  text-overflow: ellipsis;
170
185
  white-space: nowrap;
171
186
  }
172
187
 
173
- .ald-table-sticky {
188
+ .@{ald}sticky {
174
189
  position: sticky;
175
190
  top: 0;
176
191
  // 需要大于 Spin 的 z-index,Spin 的 z-index 为4
177
192
  z-index: 5;
178
193
  }
179
194
 
180
- .ald-table-body {
195
+ .@{ald}body {
181
196
  min-height: 96px;
182
197
 
183
- .ald-table-tr {
184
- &.ald-table-row-hover:hover {
198
+ .@{ald}tr {
199
+ &.@{ald}row-hover:hover {
185
200
  cursor: pointer;
186
201
 
187
- .ald-table-td {
202
+ .@{ald}td {
188
203
  background-color: var(
189
204
  --alias-colors-bg-interaction-hover,
190
205
  rgba(0, 0, 0, 0.05)
@@ -193,9 +208,40 @@
193
208
  }
194
209
  }
195
210
  }
211
+
212
+ @td-padding-size: 16px;
213
+
214
+ /** Tree Table **/
215
+ .@{ald}expandable-td {
216
+ display: flex;
217
+ width: 100%;
218
+ align-items: center;
219
+ padding-left: @td-padding-size;
220
+
221
+ .@{ald}indent-list {
222
+ display: flex;
223
+ }
224
+
225
+ .@{ald}indent-item {
226
+ width: 10px;
227
+ }
228
+
229
+ .@{ald}expand-btn {
230
+ width: 16px;
231
+ cursor: pointer;
232
+ margin-right: 6px;
233
+ display: flex;
234
+ height: 100%;
235
+ align-items: center;
236
+ }
237
+
238
+ .@{ald}td-default {
239
+ padding-left: 0;
240
+ }
241
+ }
196
242
  }
197
243
 
198
- .ald-table-align {
244
+ .@{ald}align {
199
245
  &-left {
200
246
  text-align: left;
201
247
  justify-content: left;
@@ -212,51 +258,56 @@
212
258
  }
213
259
  }
214
260
 
215
- .ald-table-pagination {
216
- margin-top: 18px;
261
+ .@{ald}pagination {
262
+ padding-top: 16px;
217
263
  display: flex;
218
264
  justify-content: end;
265
+ border-top: 1px solid var(--alias-colors-border-default, #e5e7eb);
219
266
  }
220
267
 
221
- .ald-table-loading {
268
+ .@{ald}loading {
222
269
  position: absolute;
223
270
  top: 50%;
224
271
  left: 50%;
225
272
  transform: translate(-50%, -50%);
226
273
 
227
- .ald-table-loading-inner {
274
+ .@{ald}loading-inner {
228
275
  width: 100%;
229
276
  }
230
277
  }
231
278
 
232
- .ald-table-overflow-hidden {
279
+ .@{ald}overflow-hidden {
233
280
  overflow: hidden;
234
281
  height: 100%;
235
282
  }
236
283
 
237
- .ald-table-header {
284
+ .@{ald}header {
238
285
  background-color: #fff;
239
286
  }
240
287
 
241
- .ald-table-header-scroll-placeholder {
288
+ .@{ald}header-scroll-placeholder {
242
289
  height: @header-height;
243
290
  position: sticky;
244
291
  right: 0;
245
- background-color: #fff;
292
+ background: var(--alias-colors-bg-skeleton-strong, #f3f4f6);
246
293
  z-index: 2;
247
294
  flex: 0 0 auto;
248
295
  }
249
296
 
250
- .ald-table-body-scroll {
297
+ .@{ald}body-scroll {
251
298
  overflow: auto;
252
299
  height: 100%;
253
300
 
254
- &.ald-table-scroll-y {
301
+ &.@{ald}scroll-y {
255
302
  overflow-y: scroll;
256
303
  }
257
304
  }
258
305
 
259
- .ald-table-empty {
306
+ .@{ald}empty {
260
307
  margin-top: 80px;
261
308
  overflow: hidden;
309
+
310
+ &.@{ald}empty-small {
311
+ margin-top: 20px;
312
+ }
262
313
  }
@@ -3,7 +3,7 @@ import { IPaginationProps } from '../Pagination/types';
3
3
  export interface ITableProps<TDataItem extends object> {
4
4
  columns: ITableColumn<TDataItem>[];
5
5
  data: TDataItem[];
6
- rowKey?: string | ((record: TDataItem) => string | number);
6
+ rowKey?: TRowKey<TDataItem>;
7
7
  columnSizing?: boolean;
8
8
  sticky?: boolean | {
9
9
  offsetHeader: number;
@@ -15,7 +15,9 @@ export interface ITableProps<TDataItem extends object> {
15
15
  rowClassName?: (record: TDataItem, index: number) => string;
16
16
  onRowClick?: (record: TDataItem, index: number) => void;
17
17
  onError?: (errorInfo: ITableCellErrorInfo) => void;
18
+ expandable?: ITableExpandable<TDataItem> | boolean;
18
19
  }
20
+ export type TRowKey<TDataItem extends object> = string | ((record: TDataItem) => string | number);
19
21
  export interface ITableCellErrorInfo {
20
22
  error: Error;
21
23
  stack: React.ErrorInfo['componentStack'];
@@ -44,3 +46,10 @@ export interface ITableColumn<TDataItem = unknown> {
44
46
  export interface IInnerTableColumn<TDataItem = unknown> extends ITableColumn<TDataItem> {
45
47
  columnWidths: number[];
46
48
  }
49
+ export interface ITableExpandable<TDataItem = unknown> {
50
+ childrenColumnName?: string;
51
+ defaultExpandAllRows?: boolean;
52
+ defaultExpandedRowKeys?: string[];
53
+ expandedRowKeys?: string[];
54
+ onExpand?: (record: TDataItem, isExpanded: boolean) => void;
55
+ }
@@ -55,7 +55,7 @@ export interface ITabsProps extends Omit<TabsProps, 'size'> {
55
55
  */
56
56
  padding?: boolean | number;
57
57
  /**
58
- * @description tab和content之间的间距,默认16px,仅在tabPosition为top时生效
58
+ * @description tab和content之间的间距,仅在tabPosition为top时生效
59
59
  * @default false
60
60
  */
61
61
  compact?: boolean;
@@ -21,11 +21,11 @@ export default function Tabs(props) {
21
21
  adaptHeight = props.adaptHeight,
22
22
  _props$style = props.style,
23
23
  style = _props$style === void 0 ? {} : _props$style,
24
- monospace = props.monospace,
24
+ propsMonospace = props.monospace,
25
25
  _props$tabPosition = props.tabPosition,
26
26
  tabPosition = _props$tabPosition === void 0 ? 'top' : _props$tabPosition,
27
27
  _props$padding = props.padding,
28
- padding = _props$padding === void 0 ? false : _props$padding,
28
+ propsPadding = _props$padding === void 0 ? false : _props$padding,
29
29
  compact = props.compact,
30
30
  _props$hasDividing = props.hasDividing,
31
31
  hasDividing = _props$hasDividing === void 0 ? true : _props$hasDividing,
@@ -35,20 +35,20 @@ export default function Tabs(props) {
35
35
  if (size === 'small') {
36
36
  tabsProps.size = size;
37
37
  }
38
- var _monospace = tabPosition !== 'top' ? false : monospace;
39
- var _padding = useMemo(function () {
38
+ var monospace = tabPosition !== 'top' ? false : propsMonospace;
39
+ var padding = useMemo(function () {
40
40
  if (tabPosition !== 'top') return 0;
41
- if (typeof padding === 'number') {
42
- return padding;
41
+ if (typeof propsPadding === 'number') {
42
+ return propsPadding;
43
43
  }
44
- if (typeof padding === 'boolean' && padding) {
44
+ if (typeof propsPadding === 'boolean' && propsPadding) {
45
45
  return 20;
46
46
  }
47
47
  return 0;
48
- }, [padding, tabPosition]);
48
+ }, [propsPadding, tabPosition]);
49
49
  var getTabBarGutter = function getTabBarGutter() {
50
- if (tabPosition === 'top' && !_monospace) {
51
- return 20;
50
+ if (tabPosition === 'top' && !monospace) {
51
+ return 24;
52
52
  }
53
53
  return 0;
54
54
  };
@@ -58,7 +58,7 @@ export default function Tabs(props) {
58
58
  }, /*#__PURE__*/React.createElement(MoreVerticalLine, null)),
59
59
  style: Object.assign(style, {
60
60
  '--header-bg-color': headerBackgroundColor,
61
- '--tabs-padding': "".concat(_padding, "px")
61
+ '--tabs-padding': "".concat(padding, "px")
62
62
  }),
63
63
  tabPosition: tabPosition,
64
64
  tabBarGutter: getTabBarGutter(),
@@ -66,8 +66,8 @@ export default function Tabs(props) {
66
66
  className: classNames('ald-tabs', className, {
67
67
  'ald-adapt-height': adaptHeight,
68
68
  'ald-tabs-default': size !== 'small',
69
- 'ald-tabs-monospace': _monospace,
70
- 'ald-tabs-padding': !!padding,
69
+ 'ald-tabs-monospace': monospace,
70
+ 'ald-tabs-padding': !!propsPadding,
71
71
  'ald-tabs-compact': !!compact,
72
72
  'ald-tabs-no-dividing': !hasDividing
73
73
  })
@@ -22,6 +22,7 @@
22
22
  .ant-tabs.ald-tabs {
23
23
  &.ant-tabs {
24
24
  color: @NL40;
25
+ font-size: 14px;
25
26
 
26
27
  .ant-tabs-nav {
27
28
  background-color: var(--header-bg-color);