@aloudata/aloudata-design 0.1.0-beta.4 → 0.2.0-beta.2
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.
- package/es/Empty/index.d.ts +8 -0
- package/es/Empty/index.js +57 -0
- package/es/Empty/style/index.d.ts +1 -0
- package/es/Empty/style/index.js +1 -0
- package/es/Empty/style/index.less +23 -0
- package/es/Icon/iconfont/demo_index.html +3 -3
- package/es/Icon/iconfont/iconfont.css +3 -3
- package/es/Icon/iconfont/iconfont.ttf +0 -0
- package/es/Icon/iconfont/iconfont.woff +0 -0
- package/es/Icon/iconfont/iconfont.woff2 +0 -0
- package/es/Icon/index.less +2 -2
- package/es/Input/components/Group/index.d.ts +0 -1
- package/es/Input/components/Password/index.d.ts +3 -3
- package/es/Input/components/Password/index.js +1 -1
- package/es/Input/demo/basic/index.less +8 -0
- package/es/Menu/Divider.d.ts +0 -1
- package/es/Menu/style/index.less +4 -0
- package/es/Navigator/components/Menu/index.d.ts +19 -0
- package/es/Navigator/components/Menu/index.js +187 -0
- package/es/Navigator/demo/basic/index.d.ts +4 -0
- package/es/Navigator/demo/basic/index.js +45 -0
- package/es/Navigator/demo/basic/index.less +3 -0
- package/es/Navigator/demo/example/index.d.ts +4 -0
- package/es/Navigator/demo/example/index.js +153 -0
- package/es/Navigator/demo/example/index.less +10 -0
- package/es/Navigator/demo/logo.png +0 -0
- package/es/Navigator/demo/menuWithFooter/index.d.ts +4 -0
- package/es/Navigator/demo/menuWithFooter/index.js +73 -0
- package/es/Navigator/demo/menuWithFooter/index.less +3 -0
- package/es/Navigator/demo/subMenu/index.d.ts +4 -0
- package/es/Navigator/demo/subMenu/index.js +71 -0
- package/es/Navigator/demo/subMenu/index.less +3 -0
- package/es/Navigator/index.d.ts +41 -0
- package/es/Navigator/index.js +45 -0
- package/es/Navigator/style/index.d.ts +2 -0
- package/es/Navigator/style/index.js +2 -0
- package/es/Navigator/style/index.less +224 -0
- package/es/Table/demo/basic/createData.d.ts +9 -0
- package/es/Table/demo/basic/createData.js +18 -0
- package/es/Table/demo/basic/index.d.ts +2 -0
- package/es/Table/demo/basic/index.js +64 -0
- package/es/Table/demo/editCell/index.d.ts +2 -0
- package/es/Table/demo/editCell/index.js +39 -0
- package/es/Table/demo/renderHeaderRight/index.d.ts +2 -0
- package/es/Table/demo/renderHeaderRight/index.js +37 -0
- package/es/Table/demo/rowSelect/index.d.ts +2 -0
- package/es/Table/demo/rowSelect/index.js +40 -0
- package/es/Table/demo/sort/index.d.ts +2 -0
- package/es/Table/demo/sort/index.js +32 -0
- package/es/Table/demo/virtualList/index.d.ts +2 -0
- package/es/Table/demo/virtualList/index.js +88 -0
- package/es/Table/index.d.ts +5 -0
- package/es/Table/index.js +201 -0
- package/es/Table/interface.d.ts +14 -0
- package/es/Table/interface.js +1 -0
- package/es/Table/style/index.d.ts +2 -0
- package/es/Table/style/index.js +2 -0
- package/es/Table/style/index.less +111 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/lib/Empty/index.d.ts +8 -0
- package/lib/Empty/index.js +71 -0
- package/lib/Empty/style/index.d.ts +1 -0
- package/lib/Empty/style/index.js +3 -0
- package/lib/Empty/style/index.less +23 -0
- package/lib/Icon/iconfont/demo_index.html +3 -3
- package/lib/Icon/iconfont/iconfont.css +3 -3
- package/lib/Icon/iconfont/iconfont.ttf +0 -0
- package/lib/Icon/iconfont/iconfont.woff +0 -0
- package/lib/Icon/iconfont/iconfont.woff2 +0 -0
- package/lib/Icon/index.less +2 -2
- package/lib/Input/components/Group/index.d.ts +0 -1
- package/lib/Input/components/Password/index.d.ts +3 -3
- package/lib/Input/components/Password/index.js +2 -2
- package/lib/Input/demo/basic/index.less +8 -0
- package/lib/Menu/Divider.d.ts +0 -1
- package/lib/Menu/style/index.less +4 -0
- package/lib/Navigator/components/Menu/index.d.ts +19 -0
- package/lib/Navigator/components/Menu/index.js +205 -0
- package/lib/Navigator/demo/basic/index.d.ts +4 -0
- package/lib/Navigator/demo/basic/index.js +62 -0
- package/lib/Navigator/demo/basic/index.less +3 -0
- package/lib/Navigator/demo/example/index.d.ts +4 -0
- package/lib/Navigator/demo/example/index.js +179 -0
- package/lib/Navigator/demo/example/index.less +10 -0
- package/lib/Navigator/demo/logo.png +0 -0
- package/lib/Navigator/demo/menuWithFooter/index.d.ts +4 -0
- package/lib/Navigator/demo/menuWithFooter/index.js +92 -0
- package/lib/Navigator/demo/menuWithFooter/index.less +3 -0
- package/lib/Navigator/demo/subMenu/index.d.ts +4 -0
- package/lib/Navigator/demo/subMenu/index.js +88 -0
- package/lib/Navigator/demo/subMenu/index.less +3 -0
- package/lib/Navigator/index.d.ts +41 -0
- package/lib/Navigator/index.js +64 -0
- package/lib/Navigator/style/index.d.ts +2 -0
- package/lib/Navigator/style/index.js +5 -0
- package/lib/Navigator/style/index.less +224 -0
- package/lib/Table/demo/basic/createData.d.ts +9 -0
- package/lib/Table/demo/basic/createData.js +23 -0
- package/lib/Table/demo/basic/index.d.ts +2 -0
- package/lib/Table/demo/basic/index.js +80 -0
- package/lib/Table/demo/editCell/index.d.ts +2 -0
- package/lib/Table/demo/editCell/index.js +54 -0
- package/lib/Table/demo/renderHeaderRight/index.d.ts +2 -0
- package/lib/Table/demo/renderHeaderRight/index.js +52 -0
- package/lib/Table/demo/rowSelect/index.d.ts +2 -0
- package/lib/Table/demo/rowSelect/index.js +55 -0
- package/lib/Table/demo/sort/index.d.ts +2 -0
- package/lib/Table/demo/sort/index.js +47 -0
- package/lib/Table/demo/virtualList/index.d.ts +2 -0
- package/lib/Table/demo/virtualList/index.js +103 -0
- package/lib/Table/index.d.ts +5 -0
- package/lib/Table/index.js +225 -0
- package/lib/Table/interface.d.ts +14 -0
- package/lib/Table/interface.js +5 -0
- package/lib/Table/style/index.d.ts +2 -0
- package/lib/Table/style/index.js +5 -0
- package/lib/Table/style/index.less +111 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +16 -0
- package/package.json +10 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import "antd/es/radio/style";
|
|
2
|
+
import _Radio from "antd/es/radio";
|
|
3
|
+
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
|
|
6
|
+
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."); }
|
|
7
|
+
|
|
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
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { Table } from '@aloudata/aloudata-design';
|
|
18
|
+
import { makeData } from './createData';
|
|
19
|
+
// import Table from '../../Example'
|
|
20
|
+
var columns = [{
|
|
21
|
+
Header: 'First Name',
|
|
22
|
+
accessor: 'firstName',
|
|
23
|
+
width: 150
|
|
24
|
+
}, {
|
|
25
|
+
Header: 'Last Name',
|
|
26
|
+
accessor: 'lastName'
|
|
27
|
+
}, {
|
|
28
|
+
Header: 'Age',
|
|
29
|
+
accessor: 'age'
|
|
30
|
+
}, {
|
|
31
|
+
Header: 'Visits',
|
|
32
|
+
accessor: 'visits'
|
|
33
|
+
}, {
|
|
34
|
+
Header: 'Status',
|
|
35
|
+
accessor: 'status'
|
|
36
|
+
}, {
|
|
37
|
+
Header: 'Profile Progress',
|
|
38
|
+
accessor: 'progress'
|
|
39
|
+
}];
|
|
40
|
+
export default (function () {
|
|
41
|
+
var _React$useState = React.useState(0),
|
|
42
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
43
|
+
scrollY = _React$useState2[0],
|
|
44
|
+
setScrollY = _React$useState2[1];
|
|
45
|
+
|
|
46
|
+
var handleChange = function handleChange(e) {
|
|
47
|
+
setScrollY(e.target.value);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "ald-table-demo"
|
|
52
|
+
}, /*#__PURE__*/React.createElement(_Radio.Group, {
|
|
53
|
+
value: scrollY,
|
|
54
|
+
onChange: handleChange
|
|
55
|
+
}, /*#__PURE__*/React.createElement(_Radio.Button, {
|
|
56
|
+
value: 0
|
|
57
|
+
}, "\u65E0\u6EDA\u52A8"), /*#__PURE__*/React.createElement(_Radio.Button, {
|
|
58
|
+
value: 200
|
|
59
|
+
}, "\u5185\u90E8\u6EDA\u52A8")), /*#__PURE__*/React.createElement(Table, {
|
|
60
|
+
columns: columns,
|
|
61
|
+
scrollY: scrollY,
|
|
62
|
+
data: makeData(10)
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table } from '@aloudata/aloudata-design';
|
|
3
|
+
import { makeData } from '../basic/createData'; // import Table from '../../Example'
|
|
4
|
+
|
|
5
|
+
var columns = [{
|
|
6
|
+
Header: 'First Name',
|
|
7
|
+
accessor: 'firstName',
|
|
8
|
+
width: 150
|
|
9
|
+
}, {
|
|
10
|
+
Header: 'Last Name',
|
|
11
|
+
accessor: 'lastName'
|
|
12
|
+
}, {
|
|
13
|
+
Header: 'Age',
|
|
14
|
+
accessor: 'age'
|
|
15
|
+
}, {
|
|
16
|
+
Header: 'Visits',
|
|
17
|
+
accessor: 'visits'
|
|
18
|
+
}, {
|
|
19
|
+
Header: 'Status',
|
|
20
|
+
accessor: 'status'
|
|
21
|
+
}, {
|
|
22
|
+
Header: 'Profile Progress',
|
|
23
|
+
accessor: 'progress',
|
|
24
|
+
Cell: function Cell(row) {
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
style: {
|
|
27
|
+
color: 'red'
|
|
28
|
+
}
|
|
29
|
+
}, "\u8FDB\u5EA6\uFF1A", row.progress);
|
|
30
|
+
}
|
|
31
|
+
}];
|
|
32
|
+
export default (function () {
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "ald-table-demo"
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
36
|
+
columns: columns,
|
|
37
|
+
data: makeData(10)
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table, Input } from '@aloudata/aloudata-design';
|
|
3
|
+
import { makeData } from '../basic/createData'; // import Table from '../../Example'
|
|
4
|
+
|
|
5
|
+
var columns = [{
|
|
6
|
+
Header: 'First Name',
|
|
7
|
+
accessor: 'firstName',
|
|
8
|
+
width: 150
|
|
9
|
+
}, {
|
|
10
|
+
Header: 'Last Name',
|
|
11
|
+
accessor: 'lastName'
|
|
12
|
+
}, {
|
|
13
|
+
Header: 'Age',
|
|
14
|
+
accessor: 'age'
|
|
15
|
+
}, {
|
|
16
|
+
Header: 'Visits',
|
|
17
|
+
accessor: 'visits'
|
|
18
|
+
}, {
|
|
19
|
+
Header: 'Status',
|
|
20
|
+
accessor: 'status'
|
|
21
|
+
}, {
|
|
22
|
+
Header: 'Profile Progress',
|
|
23
|
+
accessor: 'progress'
|
|
24
|
+
}];
|
|
25
|
+
export default (function () {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "ald-table-demo"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
29
|
+
columns: columns,
|
|
30
|
+
data: makeData(10),
|
|
31
|
+
renderHeaderRight: function renderHeaderRight() {
|
|
32
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
33
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table, Input } from '@aloudata/aloudata-design';
|
|
3
|
+
import { makeData } from '../basic/createData'; // import Table from '../../Example'
|
|
4
|
+
|
|
5
|
+
var columns = [{
|
|
6
|
+
Header: 'First Name',
|
|
7
|
+
accessor: 'firstName',
|
|
8
|
+
width: 150
|
|
9
|
+
}, {
|
|
10
|
+
Header: 'Last Name',
|
|
11
|
+
accessor: 'lastName'
|
|
12
|
+
}, {
|
|
13
|
+
Header: 'Age',
|
|
14
|
+
accessor: 'age'
|
|
15
|
+
}, {
|
|
16
|
+
Header: 'Visits',
|
|
17
|
+
accessor: 'visits'
|
|
18
|
+
}, {
|
|
19
|
+
Header: 'Status',
|
|
20
|
+
accessor: 'status'
|
|
21
|
+
}, {
|
|
22
|
+
Header: 'Profile Progress',
|
|
23
|
+
accessor: 'progress'
|
|
24
|
+
}];
|
|
25
|
+
export default (function () {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "ald-table-demo"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
29
|
+
columns: columns,
|
|
30
|
+
onRowSelected: function onRowSelected(record) {
|
|
31
|
+
console.log(record);
|
|
32
|
+
},
|
|
33
|
+
data: makeData(10),
|
|
34
|
+
renderHeaderRight: function renderHeaderRight() {
|
|
35
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
36
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table } from '@aloudata/aloudata-design';
|
|
3
|
+
import { makeData } from '../basic/createData'; // import Table from '../../Example'
|
|
4
|
+
|
|
5
|
+
var columns = [{
|
|
6
|
+
Header: 'First Name',
|
|
7
|
+
accessor: 'firstName',
|
|
8
|
+
width: 150
|
|
9
|
+
}, {
|
|
10
|
+
Header: 'Last Name',
|
|
11
|
+
accessor: 'lastName'
|
|
12
|
+
}, {
|
|
13
|
+
Header: 'Age',
|
|
14
|
+
accessor: 'age'
|
|
15
|
+
}, {
|
|
16
|
+
Header: 'Visits',
|
|
17
|
+
accessor: 'visits'
|
|
18
|
+
}, {
|
|
19
|
+
Header: 'Status',
|
|
20
|
+
accessor: 'status'
|
|
21
|
+
}, {
|
|
22
|
+
Header: 'Profile Progress',
|
|
23
|
+
accessor: 'progress'
|
|
24
|
+
}];
|
|
25
|
+
export default (function () {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "ald-table-demo"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
29
|
+
columns: columns,
|
|
30
|
+
data: makeData(10)
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { Table } from '@aloudata/aloudata-design';
|
|
15
|
+
import { makeData } from '../basic/createData';
|
|
16
|
+
var columns = [{
|
|
17
|
+
Header: 'First Name',
|
|
18
|
+
accessor: 'firstName',
|
|
19
|
+
width: 150
|
|
20
|
+
}, {
|
|
21
|
+
Header: 'Last Name',
|
|
22
|
+
accessor: 'lastName'
|
|
23
|
+
}, {
|
|
24
|
+
Header: 'Age',
|
|
25
|
+
accessor: 'age'
|
|
26
|
+
}, {
|
|
27
|
+
Header: 'Visits',
|
|
28
|
+
accessor: 'visits'
|
|
29
|
+
}, {
|
|
30
|
+
Header: 'Status',
|
|
31
|
+
accessor: 'status'
|
|
32
|
+
}, {
|
|
33
|
+
Header: 'Profile Progress',
|
|
34
|
+
accessor: 'progress'
|
|
35
|
+
}];
|
|
36
|
+
export default (function () {
|
|
37
|
+
var _React$useState = React.useState([]),
|
|
38
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
39
|
+
data = _React$useState2[0],
|
|
40
|
+
setData = _React$useState2[1];
|
|
41
|
+
|
|
42
|
+
var _React$useState3 = React.useState(false),
|
|
43
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
44
|
+
loading = _React$useState4[0],
|
|
45
|
+
setLoading = _React$useState4[1];
|
|
46
|
+
|
|
47
|
+
var _React$useState5 = React.useState(true),
|
|
48
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
49
|
+
hasNextPage = _React$useState6[0],
|
|
50
|
+
setHasNextPage = _React$useState6[1];
|
|
51
|
+
|
|
52
|
+
var _React$useState7 = React.useState(1),
|
|
53
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
54
|
+
currentPage = _React$useState8[0],
|
|
55
|
+
setCurrentPage = _React$useState8[1];
|
|
56
|
+
|
|
57
|
+
var pageSize = 10;
|
|
58
|
+
|
|
59
|
+
var loadMoreItems = function loadMoreItems() {
|
|
60
|
+
return new Promise(function (resolve) {
|
|
61
|
+
setLoading(true);
|
|
62
|
+
setTimeout(function () {
|
|
63
|
+
var newData = makeData(pageSize * currentPage);
|
|
64
|
+
setCurrentPage(currentPage + 1);
|
|
65
|
+
setLoading(false);
|
|
66
|
+
|
|
67
|
+
if (newData.length > 100) {
|
|
68
|
+
setHasNextPage(false);
|
|
69
|
+
} else {
|
|
70
|
+
setData(newData);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
resolve();
|
|
74
|
+
}, 1000);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "ald-input-demo"
|
|
80
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
81
|
+
columns: columns,
|
|
82
|
+
scrollY: 450,
|
|
83
|
+
loading: loading,
|
|
84
|
+
data: data,
|
|
85
|
+
loadMore: loadMoreItems,
|
|
86
|
+
hasNextPage: hasNextPage
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import './style';
|
|
3
|
+
import { ITableProps } from './interface';
|
|
4
|
+
declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight, scrollY, onRowSelected, loadMore, hasNextPage, loading, }: ITableProps<T>): ReactElement;
|
|
5
|
+
export default Table;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
var _excluded = ["style"],
|
|
2
|
+
_excluded2 = ["style"];
|
|
3
|
+
|
|
4
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
|
+
|
|
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
|
+
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
10
|
+
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."); }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
|
|
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
|
+
// @ts-nocheck
|
|
27
|
+
import React, { useCallback, useMemo } from 'react';
|
|
28
|
+
import { useTable, useBlockLayout, useRowSelect } from 'react-table';
|
|
29
|
+
import usePrefixCls from '../_utils/hooks/usePrefixCls';
|
|
30
|
+
import { FixedSizeList } from 'react-window';
|
|
31
|
+
import InfiniteLoader from 'react-window-infinite-loader';
|
|
32
|
+
import classnames from 'classnames';
|
|
33
|
+
import './style';
|
|
34
|
+
import Icon from '../Icon';
|
|
35
|
+
import Empty from '../Empty';
|
|
36
|
+
var DEFAULT_ROW_HEIGHT = 40;
|
|
37
|
+
|
|
38
|
+
function Table(_ref) {
|
|
39
|
+
var columns = _ref.columns,
|
|
40
|
+
data = _ref.data,
|
|
41
|
+
total = _ref.total,
|
|
42
|
+
renderHeaderLeft = _ref.renderHeaderLeft,
|
|
43
|
+
renderHeaderRight = _ref.renderHeaderRight,
|
|
44
|
+
scrollY = _ref.scrollY,
|
|
45
|
+
onRowSelected = _ref.onRowSelected,
|
|
46
|
+
_ref$loadMore = _ref.loadMore,
|
|
47
|
+
loadMore = _ref$loadMore === void 0 ? function () {} : _ref$loadMore,
|
|
48
|
+
hasNextPage = _ref.hasNextPage,
|
|
49
|
+
loading = _ref.loading;
|
|
50
|
+
var newColumns = useMemo(function () {
|
|
51
|
+
return columns.map(function (column) {
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
if (column.Cell) {
|
|
54
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
Cell: function Cell(instance) {
|
|
57
|
+
// eslint-disable-next-line
|
|
58
|
+
return column.Cell(instance.row.original);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return column;
|
|
64
|
+
});
|
|
65
|
+
}, [columns]);
|
|
66
|
+
|
|
67
|
+
var _useTable = useTable({
|
|
68
|
+
columns: newColumns,
|
|
69
|
+
data: data
|
|
70
|
+
}, useBlockLayout, useRowSelect),
|
|
71
|
+
getTableProps = _useTable.getTableProps,
|
|
72
|
+
getTableBodyProps = _useTable.getTableBodyProps,
|
|
73
|
+
headerGroups = _useTable.headerGroups,
|
|
74
|
+
rows = _useTable.rows,
|
|
75
|
+
prepareRow = _useTable.prepareRow;
|
|
76
|
+
|
|
77
|
+
var _React$useState = React.useState(null),
|
|
78
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
79
|
+
selectedRowId = _React$useState2[0],
|
|
80
|
+
setSelectedRowId = _React$useState2[1];
|
|
81
|
+
|
|
82
|
+
var prefixCls = usePrefixCls('blockTable');
|
|
83
|
+
|
|
84
|
+
function getTbodyStyle() {
|
|
85
|
+
if (scrollY) {
|
|
86
|
+
return {
|
|
87
|
+
height: "".concat(scrollY, "px")
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var onRowClick = useCallback(function (row) {
|
|
95
|
+
if (!onRowSelected) {
|
|
96
|
+
return;
|
|
97
|
+
} // @ts-ignore
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
setSelectedRowId(row.id);
|
|
101
|
+
onRowSelected(row.original);
|
|
102
|
+
}, [onRowSelected]);
|
|
103
|
+
var itemCount = hasNextPage ? data.length + 1 : data.length;
|
|
104
|
+
var loadMoreItems = loading ? function () {} : loadMore;
|
|
105
|
+
|
|
106
|
+
var isItemLoaded = function isItemLoaded(index) {
|
|
107
|
+
return !hasNextPage || index < data.length;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
var RenderRow = function RenderRow(_ref2) {
|
|
111
|
+
var index = _ref2.index,
|
|
112
|
+
style = _ref2.style;
|
|
113
|
+
|
|
114
|
+
if (!isItemLoaded(index)) {
|
|
115
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
style: style,
|
|
117
|
+
className: classnames("".concat(prefixCls, "-loading"))
|
|
118
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
119
|
+
type: "waiting",
|
|
120
|
+
size: 16
|
|
121
|
+
}), "Loading");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var row = rows[index];
|
|
125
|
+
prepareRow(row);
|
|
126
|
+
|
|
127
|
+
var _row$getRowProps = row.getRowProps(),
|
|
128
|
+
rowStyle = _row$getRowProps.style,
|
|
129
|
+
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
|
130
|
+
|
|
131
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, rowProps), {}, {
|
|
132
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
133
|
+
display: rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.display
|
|
134
|
+
}),
|
|
135
|
+
className: classnames("".concat(prefixCls, "-row"), _defineProperty({}, "".concat(prefixCls, "-row-selected"), row.id === selectedRowId)),
|
|
136
|
+
onClick: function onClick() {
|
|
137
|
+
return onRowClick(row);
|
|
138
|
+
}
|
|
139
|
+
}), row.cells.map(function (cell) {
|
|
140
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, cell.getCellProps()), {}, {
|
|
141
|
+
className: classnames("".concat(prefixCls, "-cell"))
|
|
142
|
+
}), cell.render('Cell'));
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
var renderHeader = function renderHeader(len) {
|
|
147
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
className: classnames("".concat(prefixCls, "-header"))
|
|
149
|
+
}, renderHeaderLeft ? renderHeaderLeft() : /*#__PURE__*/React.createElement("span", {
|
|
150
|
+
className: classnames("".concat(prefixCls, "-header-left"))
|
|
151
|
+
}, "\u5171", total || len, "\u6761"), /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: classnames("".concat(prefixCls, "-header-right"))
|
|
153
|
+
}, renderHeaderRight ? renderHeaderRight() : null));
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: prefixCls
|
|
158
|
+
}, renderHeader(data.length), /*#__PURE__*/React.createElement("div", _objectSpread({}, getTableProps()), /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: classnames("".concat(prefixCls, "-thead"))
|
|
160
|
+
}, headerGroups.map(function (headerGroup) {
|
|
161
|
+
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
|
|
162
|
+
style = _headerGroup$getHeade.style,
|
|
163
|
+
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded2);
|
|
164
|
+
|
|
165
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, headerGroupProps), {}, {
|
|
166
|
+
style: {
|
|
167
|
+
display: style === null || style === void 0 ? void 0 : style.display
|
|
168
|
+
},
|
|
169
|
+
className: classnames("".concat(prefixCls, "-row"))
|
|
170
|
+
}), headerGroup.headers.map(function (column) {
|
|
171
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, column.getHeaderProps()), {}, {
|
|
172
|
+
className: classnames("".concat(prefixCls, "-cell"))
|
|
173
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
174
|
+
className: classnames("".concat(prefixCls, "-dragBar"))
|
|
175
|
+
}), column.render('Header'));
|
|
176
|
+
}));
|
|
177
|
+
})), /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableBodyProps()), {}, {
|
|
178
|
+
className: classnames("".concat(prefixCls, "-tbody"), _defineProperty({}, "".concat(prefixCls, "-tbody-scroll"), !loadMoreItems)),
|
|
179
|
+
style: getTbodyStyle()
|
|
180
|
+
}), !loading && !rows.length && /*#__PURE__*/React.createElement(Empty, {
|
|
181
|
+
description: "\u5F53\u524D\u65E0\u6570\u636E"
|
|
182
|
+
}), /*#__PURE__*/React.createElement(InfiniteLoader, {
|
|
183
|
+
isItemLoaded: isItemLoaded,
|
|
184
|
+
itemCount: itemCount,
|
|
185
|
+
loadMoreItems: loadMoreItems
|
|
186
|
+
}, function (_ref3) {
|
|
187
|
+
var onItemsRendered = _ref3.onItemsRendered,
|
|
188
|
+
ref = _ref3.ref;
|
|
189
|
+
return /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
190
|
+
itemCount: itemCount,
|
|
191
|
+
onItemsRendered: onItemsRendered,
|
|
192
|
+
height: scrollY || data.length * DEFAULT_ROW_HEIGHT,
|
|
193
|
+
itemSize: DEFAULT_ROW_HEIGHT,
|
|
194
|
+
width: "100%",
|
|
195
|
+
ref: ref,
|
|
196
|
+
className: classnames("".concat(prefixCls, "-list"))
|
|
197
|
+
}, RenderRow);
|
|
198
|
+
}))));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export default Table;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Column } from 'react-table';
|
|
3
|
+
export interface ITableProps<T extends object> {
|
|
4
|
+
columns: Column<T>[];
|
|
5
|
+
data: T[];
|
|
6
|
+
total?: number;
|
|
7
|
+
scrollY?: number;
|
|
8
|
+
onRowSelected?: (row: T) => void;
|
|
9
|
+
loadMore?: (startIndex: number, stopIndex: number) => void | Promise<void>;
|
|
10
|
+
hasNextPage: boolean;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
renderHeaderLeft: () => React.ReactNode;
|
|
13
|
+
renderHeaderRight: () => React.ReactNode;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
2
|
+
|
|
3
|
+
@ald-prefix:ant;
|
|
4
|
+
@ald-iconfont-css-prefix:anticon;
|
|
5
|
+
@table-row-height:40px;
|
|
6
|
+
.@{ald-prefix}-blockTable {
|
|
7
|
+
&-thead {
|
|
8
|
+
.@{ald-prefix}-blockTable-cell {
|
|
9
|
+
position: relative;
|
|
10
|
+
color: @NL50;
|
|
11
|
+
// border: 1px solid red;
|
|
12
|
+
|
|
13
|
+
.@{ald-prefix}-blockTable-dragBar {
|
|
14
|
+
display: inline-block;
|
|
15
|
+
background: blue;
|
|
16
|
+
width: 1px;
|
|
17
|
+
height: 12px;
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 50%;
|
|
20
|
+
left: 0;
|
|
21
|
+
transform: translateY(-50%);
|
|
22
|
+
z-index: 1;
|
|
23
|
+
touch-action: none;
|
|
24
|
+
background-color: @NL95;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:first-child {
|
|
28
|
+
.@{ald-prefix}-blockTable-dragBar {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-tbody {
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
|
|
38
|
+
&-scroll {
|
|
39
|
+
overflow-y: scroll;
|
|
40
|
+
overflow-y: overlay;
|
|
41
|
+
}
|
|
42
|
+
.@{ald-prefix}-blockTable-row {
|
|
43
|
+
&:hover {
|
|
44
|
+
background-color: @NL97;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&-selected {
|
|
48
|
+
background-color: @BBG97;
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
background-color: @BBG97;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:last-of-type {
|
|
56
|
+
.@{ald-prefix}-blockTable-cell {
|
|
57
|
+
border-bottom: 1px solid transparent;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&-row {
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&-cell {
|
|
68
|
+
padding: 0 12px;
|
|
69
|
+
height: @table-row-height;
|
|
70
|
+
line-height: @table-row-height;
|
|
71
|
+
border-bottom: 1px solid @NL95;
|
|
72
|
+
text-align: left;
|
|
73
|
+
color: @NL0;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
text-overflow: ellipsis;
|
|
77
|
+
flex-grow: 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&-loading {
|
|
81
|
+
text-align: center;
|
|
82
|
+
line-height: @table-row-height;
|
|
83
|
+
color: @NL80;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&-header {
|
|
87
|
+
display: flex;
|
|
88
|
+
justify-content: space-between;
|
|
89
|
+
padding: 0 10px;
|
|
90
|
+
align-items: center;
|
|
91
|
+
margin-bottom: 24px;
|
|
92
|
+
|
|
93
|
+
&-left {
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
font-size: 14px;
|
|
96
|
+
color: @NL0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&-right {
|
|
100
|
+
display: flex;
|
|
101
|
+
height: 28px;
|
|
102
|
+
align-items: center;
|
|
103
|
+
font-size: 14px;
|
|
104
|
+
color: @NL0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-list {
|
|
109
|
+
overflow: overlay !important;
|
|
110
|
+
}
|
|
111
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export { default as Input } from './Input';
|
|
|
6
6
|
export { default as Tabs } from './Tabs';
|
|
7
7
|
export { default as Tooltip } from './Tooltip';
|
|
8
8
|
export { default as Select } from './Select';
|
|
9
|
+
export { default as Table } from './Table';
|
|
10
|
+
export { default as Navigator } from './Navigator';
|