@aloudata/aloudata-design 0.2.0-beta.6 → 0.2.0-beta.9

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.
@@ -2,9 +2,9 @@
2
2
 
3
3
  @ald-prefix:ant;
4
4
  @ald-iconfont-css-prefix:anticon;
5
- .@{ald-prefix}-btn {
6
5
 
7
- &.@{ald-prefix}-btn {
6
+ .ant-btn {
7
+ &.ant-btn {
8
8
  // &-loading::before{
9
9
  // // display: none !important;
10
10
  // }
@@ -43,10 +43,11 @@
43
43
  box-shadow: none;
44
44
  border-radius: @border-radius-base;
45
45
  text-shadow: @text-shadow;
46
+
46
47
  &:hover,
47
48
  &:focus,
48
49
  &:active,
49
- &.@{ald-prefix}-btn-loading {
50
+ &.ant-btn-loading {
50
51
  background-color: @B20;
51
52
  border-color: @B20;
52
53
  color: @ND0;
@@ -66,7 +67,8 @@
66
67
  }
67
68
  }
68
69
  }
69
- &-dangerous.@{ald-prefix}-btn-primary {
70
+
71
+ &-dangerous.ant-btn-primary {
70
72
  background-color: @SC40;
71
73
  border-color: @SC40;
72
74
  color: @ND0;
@@ -78,9 +80,10 @@
78
80
  border-color: @SC20;
79
81
  color: @ND0;
80
82
  }
83
+
81
84
  &:focus,
82
85
  &:active,
83
- &.@{ald-prefix}-btn-loading {
86
+ &.ant-btn-loading {
84
87
  background-color: @SC20;
85
88
  border-color: @SC20;
86
89
  color: @ND0;
@@ -112,7 +115,7 @@
112
115
  &:hover,
113
116
  &:focus,
114
117
  &:active,
115
- &.@{ald-prefix}-btn-loading {
118
+ &.ant-btn-loading {
116
119
  background-color: @NL97;
117
120
  border-color: @NL90;
118
121
  color: @NL30;
@@ -140,10 +143,11 @@
140
143
  box-shadow: none;
141
144
  border-radius: @border-radius-base;
142
145
  text-shadow: @text-shadow;
146
+
143
147
  &:hover,
144
148
  &:focus,
145
149
  &:active,
146
- &.@{ald-prefix}-btn-loading {
150
+ &.ant-btn-loading {
147
151
  background-color: @NL97;
148
152
  // border-color: @NL97;
149
153
  color: @NL30;
@@ -172,10 +176,11 @@
172
176
  box-shadow: none;
173
177
  border-radius: @border-radius-base;
174
178
  text-shadow: @text-shadow;
179
+
175
180
  &:hover,
176
181
  &:focus,
177
182
  &:active,
178
- &.@{ald-prefix}-btn-loading {
183
+ &.ant-btn-loading {
179
184
  background-color: @BG100;
180
185
  border-color: @BG100;
181
186
  color: @B20;
@@ -202,7 +207,8 @@
202
207
  vertical-align: bottom;
203
208
  height: @height-base;
204
209
  width: @height-base;
205
- &.@{ald-prefix}-btn-loading-icon {
210
+
211
+ &.ant-btn-loading-icon {
206
212
  vertical-align: baseline;
207
213
  }
208
214
  .@{ald-iconfont-css-prefix} {
@@ -225,12 +231,14 @@
225
231
  height: 32px;
226
232
  font-size: 14px;
227
233
  min-width: auto;
228
- &.@{ald-prefix}-btn-icon-only {
234
+
235
+ &.ant-btn-icon-only {
229
236
  height: 32px;
230
237
  width: 32px;
231
238
  min-width: auto;
232
239
  }
233
- &.@{ald-prefix}-btn-circle {
240
+
241
+ &.ant-btn-circle {
234
242
  width: 32px;
235
243
  height: 32px;
236
244
  border-radius: 50%;
@@ -240,12 +248,14 @@
240
248
  &-sm {
241
249
  height: 24px;
242
250
  border-radius: @border-radius-sm;
243
- &.@{ald-prefix}-btn-icon-only {
251
+
252
+ &.ant-btn-icon-only {
244
253
  height: 24px;
245
254
  width: 24px;
246
255
  border-radius: @border-radius-sm;
247
256
  }
248
- &.@{ald-prefix}-btn-circle {
257
+
258
+ &.ant-btn-circle {
249
259
  width: 32px;
250
260
  height: 32px;
251
261
  border-radius: 50%;
@@ -2,7 +2,8 @@
2
2
 
3
3
  @ald-prefix:ant;
4
4
  @ald-iconfont-css-prefix:anticon;
5
- .@{ald-prefix}-empty {
5
+
6
+ .ant-empty {
6
7
  display: flex;
7
8
  align-items: center;
8
9
  justify-content: center;
package/es/Icon/index.js CHANGED
@@ -6,8 +6,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import React from 'react';
8
8
  import { createFromIconfontCN } from '@ant-design/icons'; // @ts-ignore iconfont.js 没有ts类型定义
9
+ // import iconfontJs from './iconfont/iconfont';
10
+
11
+ var iconfontJs = require('./iconfont/iconfont');
9
12
 
10
- import iconfontJs from './iconfont/iconfont';
11
13
  var IconFont = createFromIconfontCN({
12
14
  scriptUrl: iconfontJs
13
15
  });
@@ -4,7 +4,8 @@
4
4
  @ald-prefix:ant;
5
5
 
6
6
  @ald-iconfont-css-prefix:anticon;
7
- .@{ald-prefix}-input {
7
+
8
+ .ant-input {
8
9
  color: @NL0;
9
10
  border-radius: @border-radius-base;
10
11
 
@@ -48,7 +49,8 @@
48
49
  &:hover {
49
50
  box-shadow: unset;
50
51
  }
51
- .@{ald-prefix}-input {
52
+
53
+ .ant-input {
52
54
  border-radius: 0;
53
55
  caret-color: @B40;
54
56
  }
@@ -59,7 +61,7 @@
59
61
  }
60
62
  }
61
63
  .@{ald-iconfont-css-prefix} {
62
- &.@{ald-iconfont-css-prefix}-close-circle, &.@{ald-prefix}-clear-icon {
64
+ &.@{ald-iconfont-css-prefix}-close-circle, &.ant-clear-icon {
63
65
  .ald-iconfont('\e616');
64
66
  }
65
67
  }
@@ -1,4 +1,4 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ITableProps } from './interface';
3
- declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight, scrollY, onRowSelected, loadMore, hasNextPage, loading, sortable, defaultSort, resizeColumn, sortDirections: allSortDirections, onChange, }: ITableProps<T>): ReactElement;
3
+ declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight, scrollY, onRowSelected, loadMore, hasNextPage, loading, sortable, defaultSort, resizeColumn, sortDirections: allSortDirections, showHeader, onChange, }: ITableProps<T>): ReactElement;
4
4
  export default Table;
package/es/Table/index.js CHANGED
@@ -5,6 +5,12 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
5
5
 
6
6
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
7
 
8
+ 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; }
9
+
10
+ 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; }
11
+
12
+ 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; }
13
+
8
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
15
 
10
16
  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."); }
@@ -17,12 +23,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
17
23
 
18
24
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
25
 
20
- 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; }
21
-
22
- 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; }
23
-
24
- 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; }
25
-
26
26
  /// <reference types ='./react-table-config' />
27
27
  import React, { useCallback, useMemo } from 'react';
28
28
  import { useTable, useBlockLayout, useRowSelect, useSortBy, useResizeColumns } from 'react-table';
@@ -55,8 +55,16 @@ function Table(_ref) {
55
55
  _ref$resizeColumn = _ref.resizeColumn,
56
56
  resizeColumn = _ref$resizeColumn === void 0 ? false : _ref$resizeColumn,
57
57
  allSortDirections = _ref.sortDirections,
58
+ _ref$showHeader = _ref.showHeader,
59
+ showHeader = _ref$showHeader === void 0 ? true : _ref$showHeader,
58
60
  _ref$onChange = _ref.onChange,
59
61
  onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange;
62
+
63
+ var _React$useState = React.useState(null),
64
+ _React$useState2 = _slicedToArray(_React$useState, 2),
65
+ selectedRowId = _React$useState2[0],
66
+ setSelectedRowId = _React$useState2[1];
67
+
60
68
  var newColumns = useMemo(function () {
61
69
  return columns.map(function (column) {
62
70
  return _objectSpread(_objectSpread({}, column), {}, {
@@ -72,13 +80,28 @@ function Table(_ref) {
72
80
  });
73
81
  }, [columns, sortable]);
74
82
 
75
- var _React$useState = React.useState({
76
- id: (defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.id) || sortable ? newColumns[ARRAY_FIRST_INDEX].dataIndex : '',
77
- desc: (defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.desc) || false
78
- }),
79
- _React$useState2 = _slicedToArray(_React$useState, 2),
80
- sortDirection = _React$useState2[0],
81
- setSortDirection = _React$useState2[1];
83
+ var getInitialSortDirection = function getInitialSortDirection() {
84
+ if (defaultSort && defaultSort.id) {
85
+ return defaultSort;
86
+ }
87
+
88
+ if (sortable) {
89
+ return {
90
+ id: newColumns[ARRAY_FIRST_INDEX].accessor,
91
+ desc: false
92
+ };
93
+ }
94
+
95
+ return {
96
+ id: '',
97
+ desc: false
98
+ };
99
+ };
100
+
101
+ var _React$useState3 = React.useState(getInitialSortDirection()),
102
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
103
+ sortDirection = _React$useState4[0],
104
+ setSortDirection = _React$useState4[1];
82
105
 
83
106
  var _useTable = useTable({
84
107
  columns: newColumns,
@@ -86,10 +109,7 @@ function Table(_ref) {
86
109
  disableMultiSort: true,
87
110
  disableSortBy: !sortable,
88
111
  initialState: {
89
- sortBy: [{
90
- id: sortDirection.id,
91
- desc: sortDirection.desc
92
- }]
112
+ sortBy: sortDirection.id ? [sortDirection] : []
93
113
  }
94
114
  }, useBlockLayout, useSortBy, useRowSelect, useResizeColumns),
95
115
  getTableProps = _useTable.getTableProps,
@@ -99,11 +119,6 @@ function Table(_ref) {
99
119
  prepareRow = _useTable.prepareRow,
100
120
  setSortBy = _useTable.setSortBy;
101
121
 
102
- var _React$useState3 = React.useState(null),
103
- _React$useState4 = _slicedToArray(_React$useState3, 2),
104
- selectedRowId = _React$useState4[0],
105
- setSelectedRowId = _React$useState4[1];
106
-
107
122
  var theadRowWidthRef = React.useRef(DEFAULT_ROW_WIDTH);
108
123
  var prefixCls = usePrefixCls('block-table');
109
124
 
@@ -225,7 +240,7 @@ function Table(_ref) {
225
240
  id: typeof desc === 'undefined' ? '' : id,
226
241
  desc: desc
227
242
  };
228
- setSortBy([sortBy]);
243
+ setSortBy(typeof desc === 'undefined' ? [] : [sortBy]);
229
244
  setSortDirection(sortBy);
230
245
  onChange(sortBy);
231
246
  }
@@ -280,7 +295,7 @@ function Table(_ref) {
280
295
 
281
296
  return /*#__PURE__*/React.createElement("div", {
282
297
  className: prefixCls
283
- }, renderHeader(data.length), /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
298
+ }, showHeader && renderHeader(data.length), /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
284
299
  className: classnames(_defineProperty({}, "".concat(prefixCls, "-column-resizable"), resizeColumn))
285
300
  }), /*#__PURE__*/React.createElement("div", {
286
301
  className: "".concat(prefixCls, "-thead")
@@ -8,12 +8,13 @@ export interface ISort<T> {
8
8
  export interface IColumn<T extends object> {
9
9
  title: string;
10
10
  dataIndex: string;
11
- render?: (value: unknown, row: Record<string, T>, index: number) => React.ReactNode;
11
+ render?: (value: any, row: Record<string, T>, index: number) => React.ReactNode;
12
12
  width?: number;
13
13
  minWidth?: number;
14
14
  sorter?: boolean | 'string' | 'number' | 'basic' | 'datetime' | 'alphanumeric' | ((rowA: Row<T>, rowB: Row<T>, columnId: IdType<T>, desc?: boolean) => number);
15
15
  sortOrder?: TSortOrder;
16
16
  sortDirections?: Array<'ascend' | 'descend'>;
17
+ selected?: boolean;
17
18
  }
18
19
  export interface ITableProps<T extends object> {
19
20
  columns: IColumn<T>[];
@@ -31,4 +32,5 @@ export interface ITableProps<T extends object> {
31
32
  defaultSort?: ISort<T>;
32
33
  sortDirections?: Array<'ascend' | 'descend'>;
33
34
  resizeColumn?: boolean;
35
+ showHeader?: boolean;
34
36
  }
@@ -3,11 +3,30 @@
3
3
  @ald-prefix:ant;
4
4
  @ald-iconfont-css-prefix:anticon;
5
5
  @table-row-height:40px;
6
- .@{ald-prefix}-block-table {
6
+
7
+ .ant-block-table {
7
8
  overflow: hidden;
9
+ user-select: none;
10
+
11
+ &-cell {
12
+ padding: 0 12px;
13
+ height: @table-row-height;
14
+ line-height: @table-row-height;
15
+ border-bottom: 1px solid @NL95;
16
+ text-align: left;
17
+ color: @NL0;
18
+ overflow: hidden;
19
+ white-space: nowrap;
20
+ text-overflow: ellipsis;
21
+ flex-grow: 1;
22
+ }
23
+
24
+ &-row {
25
+ max-width: 100%;
26
+ }
8
27
 
9
28
  &-thead {
10
- .@{ald-prefix}-block-table-cell {
29
+ .ant-block-table-cell {
11
30
  position: relative;
12
31
  color: @NL50;
13
32
 
@@ -16,7 +35,7 @@
16
35
  }
17
36
  // border: 1px solid red;
18
37
 
19
- .@{ald-prefix}-block-table-bar {
38
+ .ant-block-table-bar {
20
39
  display: inline-block;
21
40
  background: blue;
22
41
  width: 1px;
@@ -31,7 +50,7 @@
31
50
  }
32
51
 
33
52
  &:last-child {
34
- .@{ald-prefix}-block-table-bar {
53
+ .ant-block-table-bar {
35
54
  display: none;
36
55
  }
37
56
  }
@@ -45,7 +64,8 @@
45
64
  overflow-y: scroll;
46
65
  overflow-y: overlay;
47
66
  }
48
- .@{ald-prefix}-block-table-row {
67
+
68
+ .ant-block-table-row {
49
69
  &:hover {
50
70
  background-color: @NL97;
51
71
  }
@@ -59,30 +79,13 @@
59
79
  }
60
80
 
61
81
  &:last-of-type {
62
- .@{ald-prefix}-block-table-cell {
82
+ .ant-block-table-cell {
63
83
  border-bottom: 1px solid transparent;
64
84
  }
65
85
  }
66
86
  }
67
87
  }
68
88
 
69
- &-row {
70
- max-width: 100%;
71
- }
72
-
73
- &-cell {
74
- padding: 0 12px;
75
- height: @table-row-height;
76
- line-height: @table-row-height;
77
- border-bottom: 1px solid @NL95;
78
- text-align: left;
79
- color: @NL0;
80
- overflow: hidden;
81
- white-space: nowrap;
82
- text-overflow: ellipsis;
83
- flex-grow: 1;
84
- }
85
-
86
89
  &-loading {
87
90
  text-align: center;
88
91
  line-height: @table-row-height;
@@ -104,6 +107,7 @@
104
107
 
105
108
  &-right {
106
109
  display: flex;
110
+ justify-content: flex-end;
107
111
  height: 28px;
108
112
  align-items: center;
109
113
  font-size: 14px;
@@ -122,20 +126,26 @@
122
126
 
123
127
  &-column-resizable {
124
128
  overflow: overlay;
125
- .@{ald-prefix}-block-table {
126
- &-cell {
127
- flex: none;
128
- }
129
129
 
130
- &-thead {
131
- &::-webkit-scrollbar {
132
- display: none;
130
+ .ant-block-table-thead,
131
+ .ant-block-table-tbody {
132
+ .ant-block-table-row {
133
+ .ant-block-table {
134
+ &-cell {
135
+ flex: none;
136
+ }
137
+
138
+ &-thead {
139
+ &::-webkit-scrollbar {
140
+ display: none;
141
+ }
142
+ }
143
+
144
+ &-tbody {
145
+ overflow: initial;
146
+ }
133
147
  }
134
148
  }
135
-
136
- &-tbody {
137
- overflow: initial;
138
- }
139
149
  }
140
150
  }
141
151
  }
@@ -1,6 +1,6 @@
1
1
  @import './themeColor.module.less';
2
2
  @font-family:sans-serif,-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol','Noto Color Emoji';
3
- @ald-prefix: 'ald';
3
+ @ald-prefix: ant;
4
4
 
5
5
 
6
6
  // height rules
@@ -2,9 +2,9 @@
2
2
 
3
3
  @ald-prefix:ant;
4
4
  @ald-iconfont-css-prefix:anticon;
5
- .@{ald-prefix}-btn {
6
5
 
7
- &.@{ald-prefix}-btn {
6
+ .ant-btn {
7
+ &.ant-btn {
8
8
  // &-loading::before{
9
9
  // // display: none !important;
10
10
  // }
@@ -43,10 +43,11 @@
43
43
  box-shadow: none;
44
44
  border-radius: @border-radius-base;
45
45
  text-shadow: @text-shadow;
46
+
46
47
  &:hover,
47
48
  &:focus,
48
49
  &:active,
49
- &.@{ald-prefix}-btn-loading {
50
+ &.ant-btn-loading {
50
51
  background-color: @B20;
51
52
  border-color: @B20;
52
53
  color: @ND0;
@@ -66,7 +67,8 @@
66
67
  }
67
68
  }
68
69
  }
69
- &-dangerous.@{ald-prefix}-btn-primary {
70
+
71
+ &-dangerous.ant-btn-primary {
70
72
  background-color: @SC40;
71
73
  border-color: @SC40;
72
74
  color: @ND0;
@@ -78,9 +80,10 @@
78
80
  border-color: @SC20;
79
81
  color: @ND0;
80
82
  }
83
+
81
84
  &:focus,
82
85
  &:active,
83
- &.@{ald-prefix}-btn-loading {
86
+ &.ant-btn-loading {
84
87
  background-color: @SC20;
85
88
  border-color: @SC20;
86
89
  color: @ND0;
@@ -112,7 +115,7 @@
112
115
  &:hover,
113
116
  &:focus,
114
117
  &:active,
115
- &.@{ald-prefix}-btn-loading {
118
+ &.ant-btn-loading {
116
119
  background-color: @NL97;
117
120
  border-color: @NL90;
118
121
  color: @NL30;
@@ -140,10 +143,11 @@
140
143
  box-shadow: none;
141
144
  border-radius: @border-radius-base;
142
145
  text-shadow: @text-shadow;
146
+
143
147
  &:hover,
144
148
  &:focus,
145
149
  &:active,
146
- &.@{ald-prefix}-btn-loading {
150
+ &.ant-btn-loading {
147
151
  background-color: @NL97;
148
152
  // border-color: @NL97;
149
153
  color: @NL30;
@@ -172,10 +176,11 @@
172
176
  box-shadow: none;
173
177
  border-radius: @border-radius-base;
174
178
  text-shadow: @text-shadow;
179
+
175
180
  &:hover,
176
181
  &:focus,
177
182
  &:active,
178
- &.@{ald-prefix}-btn-loading {
183
+ &.ant-btn-loading {
179
184
  background-color: @BG100;
180
185
  border-color: @BG100;
181
186
  color: @B20;
@@ -202,7 +207,8 @@
202
207
  vertical-align: bottom;
203
208
  height: @height-base;
204
209
  width: @height-base;
205
- &.@{ald-prefix}-btn-loading-icon {
210
+
211
+ &.ant-btn-loading-icon {
206
212
  vertical-align: baseline;
207
213
  }
208
214
  .@{ald-iconfont-css-prefix} {
@@ -225,12 +231,14 @@
225
231
  height: 32px;
226
232
  font-size: 14px;
227
233
  min-width: auto;
228
- &.@{ald-prefix}-btn-icon-only {
234
+
235
+ &.ant-btn-icon-only {
229
236
  height: 32px;
230
237
  width: 32px;
231
238
  min-width: auto;
232
239
  }
233
- &.@{ald-prefix}-btn-circle {
240
+
241
+ &.ant-btn-circle {
234
242
  width: 32px;
235
243
  height: 32px;
236
244
  border-radius: 50%;
@@ -240,12 +248,14 @@
240
248
  &-sm {
241
249
  height: 24px;
242
250
  border-radius: @border-radius-sm;
243
- &.@{ald-prefix}-btn-icon-only {
251
+
252
+ &.ant-btn-icon-only {
244
253
  height: 24px;
245
254
  width: 24px;
246
255
  border-radius: @border-radius-sm;
247
256
  }
248
- &.@{ald-prefix}-btn-circle {
257
+
258
+ &.ant-btn-circle {
249
259
  width: 32px;
250
260
  height: 32px;
251
261
  border-radius: 50%;
@@ -2,7 +2,8 @@
2
2
 
3
3
  @ald-prefix:ant;
4
4
  @ald-iconfont-css-prefix:anticon;
5
- .@{ald-prefix}-empty {
5
+
6
+ .ant-empty {
6
7
  display: flex;
7
8
  align-items: center;
8
9
  justify-content: center;
package/lib/Icon/index.js CHANGED
@@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _icons = require("@ant-design/icons");
11
11
 
12
- var _iconfont = _interopRequireDefault(require("./iconfont/iconfont"));
13
-
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
13
 
16
14
  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; }
@@ -19,8 +17,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
19
17
 
20
18
  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; }
21
19
 
20
+ // @ts-ignore iconfont.js 没有ts类型定义
21
+ // import iconfontJs from './iconfont/iconfont';
22
+ var iconfontJs = require('./iconfont/iconfont');
23
+
22
24
  var IconFont = (0, _icons.createFromIconfontCN)({
23
- scriptUrl: _iconfont.default
25
+ scriptUrl: iconfontJs
24
26
  });
25
27
  var DEFAULT_SIZE = 16;
26
28
 
@@ -4,7 +4,8 @@
4
4
  @ald-prefix:ant;
5
5
 
6
6
  @ald-iconfont-css-prefix:anticon;
7
- .@{ald-prefix}-input {
7
+
8
+ .ant-input {
8
9
  color: @NL0;
9
10
  border-radius: @border-radius-base;
10
11
 
@@ -48,7 +49,8 @@
48
49
  &:hover {
49
50
  box-shadow: unset;
50
51
  }
51
- .@{ald-prefix}-input {
52
+
53
+ .ant-input {
52
54
  border-radius: 0;
53
55
  caret-color: @B40;
54
56
  }
@@ -59,7 +61,7 @@
59
61
  }
60
62
  }
61
63
  .@{ald-iconfont-css-prefix} {
62
- &.@{ald-iconfont-css-prefix}-close-circle, &.@{ald-prefix}-clear-icon {
64
+ &.@{ald-iconfont-css-prefix}-close-circle, &.ant-clear-icon {
63
65
  .ald-iconfont('\e616');
64
66
  }
65
67
  }
@@ -1,4 +1,4 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ITableProps } from './interface';
3
- declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight, scrollY, onRowSelected, loadMore, hasNextPage, loading, sortable, defaultSort, resizeColumn, sortDirections: allSortDirections, onChange, }: ITableProps<T>): ReactElement;
3
+ declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight, scrollY, onRowSelected, loadMore, hasNextPage, loading, sortable, defaultSort, resizeColumn, sortDirections: allSortDirections, showHeader, onChange, }: ITableProps<T>): ReactElement;
4
4
  export default Table;
@@ -38,6 +38,12 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
38
38
 
39
39
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
40
40
 
41
+ 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; }
42
+
43
+ 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; }
44
+
45
+ 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; }
46
+
41
47
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
42
48
 
43
49
  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."); }
@@ -50,12 +56,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
50
56
 
51
57
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
52
58
 
53
- 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; }
54
-
55
- 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; }
56
-
57
- 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; }
58
-
59
59
  var DEFAULT_ROW_HEIGHT = 40;
60
60
  var ARRAY_FIRST_INDEX = 0;
61
61
  var DEFAULT_ROW_WIDTH = 0;
@@ -78,8 +78,16 @@ function Table(_ref) {
78
78
  _ref$resizeColumn = _ref.resizeColumn,
79
79
  resizeColumn = _ref$resizeColumn === void 0 ? false : _ref$resizeColumn,
80
80
  allSortDirections = _ref.sortDirections,
81
+ _ref$showHeader = _ref.showHeader,
82
+ showHeader = _ref$showHeader === void 0 ? true : _ref$showHeader,
81
83
  _ref$onChange = _ref.onChange,
82
84
  onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange;
85
+
86
+ var _React$useState = _react.default.useState(null),
87
+ _React$useState2 = _slicedToArray(_React$useState, 2),
88
+ selectedRowId = _React$useState2[0],
89
+ setSelectedRowId = _React$useState2[1];
90
+
83
91
  var newColumns = (0, _react.useMemo)(function () {
84
92
  return columns.map(function (column) {
85
93
  return _objectSpread(_objectSpread({}, column), {}, {
@@ -95,13 +103,28 @@ function Table(_ref) {
95
103
  });
96
104
  }, [columns, sortable]);
97
105
 
98
- var _React$useState = _react.default.useState({
99
- id: (defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.id) || sortable ? newColumns[ARRAY_FIRST_INDEX].dataIndex : '',
100
- desc: (defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.desc) || false
101
- }),
102
- _React$useState2 = _slicedToArray(_React$useState, 2),
103
- sortDirection = _React$useState2[0],
104
- setSortDirection = _React$useState2[1];
106
+ var getInitialSortDirection = function getInitialSortDirection() {
107
+ if (defaultSort && defaultSort.id) {
108
+ return defaultSort;
109
+ }
110
+
111
+ if (sortable) {
112
+ return {
113
+ id: newColumns[ARRAY_FIRST_INDEX].accessor,
114
+ desc: false
115
+ };
116
+ }
117
+
118
+ return {
119
+ id: '',
120
+ desc: false
121
+ };
122
+ };
123
+
124
+ var _React$useState3 = _react.default.useState(getInitialSortDirection()),
125
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
126
+ sortDirection = _React$useState4[0],
127
+ setSortDirection = _React$useState4[1];
105
128
 
106
129
  var _useTable = (0, _reactTable.useTable)({
107
130
  columns: newColumns,
@@ -109,10 +132,7 @@ function Table(_ref) {
109
132
  disableMultiSort: true,
110
133
  disableSortBy: !sortable,
111
134
  initialState: {
112
- sortBy: [{
113
- id: sortDirection.id,
114
- desc: sortDirection.desc
115
- }]
135
+ sortBy: sortDirection.id ? [sortDirection] : []
116
136
  }
117
137
  }, _reactTable.useBlockLayout, _reactTable.useSortBy, _reactTable.useRowSelect, _reactTable.useResizeColumns),
118
138
  getTableProps = _useTable.getTableProps,
@@ -122,11 +142,6 @@ function Table(_ref) {
122
142
  prepareRow = _useTable.prepareRow,
123
143
  setSortBy = _useTable.setSortBy;
124
144
 
125
- var _React$useState3 = _react.default.useState(null),
126
- _React$useState4 = _slicedToArray(_React$useState3, 2),
127
- selectedRowId = _React$useState4[0],
128
- setSelectedRowId = _React$useState4[1];
129
-
130
145
  var theadRowWidthRef = _react.default.useRef(DEFAULT_ROW_WIDTH);
131
146
 
132
147
  var prefixCls = (0, _usePrefixCls.default)('block-table');
@@ -249,7 +264,7 @@ function Table(_ref) {
249
264
  id: typeof desc === 'undefined' ? '' : id,
250
265
  desc: desc
251
266
  };
252
- setSortBy([sortBy]);
267
+ setSortBy(typeof desc === 'undefined' ? [] : [sortBy]);
253
268
  setSortDirection(sortBy);
254
269
  onChange(sortBy);
255
270
  }
@@ -304,7 +319,7 @@ function Table(_ref) {
304
319
 
305
320
  return /*#__PURE__*/_react.default.createElement("div", {
306
321
  className: prefixCls
307
- }, renderHeader(data.length), /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
322
+ }, showHeader && renderHeader(data.length), /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
308
323
  className: (0, _classnames6.default)(_defineProperty({}, "".concat(prefixCls, "-column-resizable"), resizeColumn))
309
324
  }), /*#__PURE__*/_react.default.createElement("div", {
310
325
  className: "".concat(prefixCls, "-thead")
@@ -8,12 +8,13 @@ export interface ISort<T> {
8
8
  export interface IColumn<T extends object> {
9
9
  title: string;
10
10
  dataIndex: string;
11
- render?: (value: unknown, row: Record<string, T>, index: number) => React.ReactNode;
11
+ render?: (value: any, row: Record<string, T>, index: number) => React.ReactNode;
12
12
  width?: number;
13
13
  minWidth?: number;
14
14
  sorter?: boolean | 'string' | 'number' | 'basic' | 'datetime' | 'alphanumeric' | ((rowA: Row<T>, rowB: Row<T>, columnId: IdType<T>, desc?: boolean) => number);
15
15
  sortOrder?: TSortOrder;
16
16
  sortDirections?: Array<'ascend' | 'descend'>;
17
+ selected?: boolean;
17
18
  }
18
19
  export interface ITableProps<T extends object> {
19
20
  columns: IColumn<T>[];
@@ -31,4 +32,5 @@ export interface ITableProps<T extends object> {
31
32
  defaultSort?: ISort<T>;
32
33
  sortDirections?: Array<'ascend' | 'descend'>;
33
34
  resizeColumn?: boolean;
35
+ showHeader?: boolean;
34
36
  }
@@ -3,11 +3,30 @@
3
3
  @ald-prefix:ant;
4
4
  @ald-iconfont-css-prefix:anticon;
5
5
  @table-row-height:40px;
6
- .@{ald-prefix}-block-table {
6
+
7
+ .ant-block-table {
7
8
  overflow: hidden;
9
+ user-select: none;
10
+
11
+ &-cell {
12
+ padding: 0 12px;
13
+ height: @table-row-height;
14
+ line-height: @table-row-height;
15
+ border-bottom: 1px solid @NL95;
16
+ text-align: left;
17
+ color: @NL0;
18
+ overflow: hidden;
19
+ white-space: nowrap;
20
+ text-overflow: ellipsis;
21
+ flex-grow: 1;
22
+ }
23
+
24
+ &-row {
25
+ max-width: 100%;
26
+ }
8
27
 
9
28
  &-thead {
10
- .@{ald-prefix}-block-table-cell {
29
+ .ant-block-table-cell {
11
30
  position: relative;
12
31
  color: @NL50;
13
32
 
@@ -16,7 +35,7 @@
16
35
  }
17
36
  // border: 1px solid red;
18
37
 
19
- .@{ald-prefix}-block-table-bar {
38
+ .ant-block-table-bar {
20
39
  display: inline-block;
21
40
  background: blue;
22
41
  width: 1px;
@@ -31,7 +50,7 @@
31
50
  }
32
51
 
33
52
  &:last-child {
34
- .@{ald-prefix}-block-table-bar {
53
+ .ant-block-table-bar {
35
54
  display: none;
36
55
  }
37
56
  }
@@ -45,7 +64,8 @@
45
64
  overflow-y: scroll;
46
65
  overflow-y: overlay;
47
66
  }
48
- .@{ald-prefix}-block-table-row {
67
+
68
+ .ant-block-table-row {
49
69
  &:hover {
50
70
  background-color: @NL97;
51
71
  }
@@ -59,30 +79,13 @@
59
79
  }
60
80
 
61
81
  &:last-of-type {
62
- .@{ald-prefix}-block-table-cell {
82
+ .ant-block-table-cell {
63
83
  border-bottom: 1px solid transparent;
64
84
  }
65
85
  }
66
86
  }
67
87
  }
68
88
 
69
- &-row {
70
- max-width: 100%;
71
- }
72
-
73
- &-cell {
74
- padding: 0 12px;
75
- height: @table-row-height;
76
- line-height: @table-row-height;
77
- border-bottom: 1px solid @NL95;
78
- text-align: left;
79
- color: @NL0;
80
- overflow: hidden;
81
- white-space: nowrap;
82
- text-overflow: ellipsis;
83
- flex-grow: 1;
84
- }
85
-
86
89
  &-loading {
87
90
  text-align: center;
88
91
  line-height: @table-row-height;
@@ -104,6 +107,7 @@
104
107
 
105
108
  &-right {
106
109
  display: flex;
110
+ justify-content: flex-end;
107
111
  height: 28px;
108
112
  align-items: center;
109
113
  font-size: 14px;
@@ -122,20 +126,26 @@
122
126
 
123
127
  &-column-resizable {
124
128
  overflow: overlay;
125
- .@{ald-prefix}-block-table {
126
- &-cell {
127
- flex: none;
128
- }
129
129
 
130
- &-thead {
131
- &::-webkit-scrollbar {
132
- display: none;
130
+ .ant-block-table-thead,
131
+ .ant-block-table-tbody {
132
+ .ant-block-table-row {
133
+ .ant-block-table {
134
+ &-cell {
135
+ flex: none;
136
+ }
137
+
138
+ &-thead {
139
+ &::-webkit-scrollbar {
140
+ display: none;
141
+ }
142
+ }
143
+
144
+ &-tbody {
145
+ overflow: initial;
146
+ }
133
147
  }
134
148
  }
135
-
136
- &-tbody {
137
- overflow: initial;
138
- }
139
149
  }
140
150
  }
141
151
  }
@@ -1,6 +1,6 @@
1
1
  @import './themeColor.module.less';
2
2
  @font-family:sans-serif,-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol','Noto Color Emoji';
3
- @ald-prefix: 'ald';
3
+ @ald-prefix: ant;
4
4
 
5
5
 
6
6
  // height rules
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "0.2.0-beta.6",
3
+ "version": "0.2.0-beta.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -17,7 +17,15 @@
17
17
  "release": "npm publish --access public",
18
18
  "postpublish": "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags"
19
19
  },
20
+ "sideEffects": [
21
+ "dist/*",
22
+ "esm/**/style/*",
23
+ "lib/**/style/*",
24
+ "*.less",
25
+ "./src/**/style/**"
26
+ ],
20
27
  "module": "es/index.js",
28
+ "main": "lib/index.js",
21
29
  "typings": "es/index.d.ts",
22
30
  "husky": {
23
31
  "hooks": {