@bento-core/table 1.0.1-ccdihub.2 → 1.0.1-ccdihub.21
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/dist/body/components/CheckBoxView.js +11 -9
- package/dist/header/CustomCell.js +7 -1
- package/dist/header/components/CheckBoxView.js +16 -8
- package/dist/pagination/CustomPagination.js +24 -2
- package/package.json +1 -1
- package/src/body/components/CheckBoxView.js +7 -10
- package/src/header/CustomCell.js +11 -0
- package/src/header/components/CheckBoxView.js +9 -10
- package/src/pagination/CustomPagination.js +36 -9
|
@@ -6,8 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
|
-
var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
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); }
|
|
11
|
+
const label = {
|
|
12
|
+
inputProps: {
|
|
13
|
+
'aria-label': 'Checkbox item'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
11
16
|
const CheckboxView = _ref => {
|
|
12
17
|
let {
|
|
13
18
|
row,
|
|
@@ -15,14 +20,11 @@ const CheckboxView = _ref => {
|
|
|
15
20
|
} = _ref;
|
|
16
21
|
return /*#__PURE__*/_react.default.createElement(_core.TableCell, {
|
|
17
22
|
padding: "checkbox"
|
|
18
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}),
|
|
24
|
-
label: ""
|
|
25
|
-
}));
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Checkbox, _extends({}, label, {
|
|
24
|
+
disableRipple: true,
|
|
25
|
+
onClick: event => onRowSelectChange(event, row),
|
|
26
|
+
checked: row.isChecked
|
|
27
|
+
})));
|
|
26
28
|
};
|
|
27
29
|
var _default = CheckboxView;
|
|
28
30
|
exports.default = _default;
|
|
@@ -29,7 +29,8 @@ const CustomHeaderCell = _ref => {
|
|
|
29
29
|
tooltipText,
|
|
30
30
|
header,
|
|
31
31
|
headerType,
|
|
32
|
-
customColHeaderRender
|
|
32
|
+
customColHeaderRender,
|
|
33
|
+
sortable
|
|
33
34
|
} = column;
|
|
34
35
|
const Tooltip = (0, _react.useCallback)(_ref2 => {
|
|
35
36
|
let {
|
|
@@ -50,6 +51,11 @@ const CustomHeaderCell = _ref => {
|
|
|
50
51
|
// return default view
|
|
51
52
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
52
53
|
}, []);
|
|
54
|
+
if (sortable !== undefined && !sortable) {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
56
|
+
scope: "col"
|
|
57
|
+
}, header);
|
|
58
|
+
}
|
|
53
59
|
return /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
54
60
|
scope: "col",
|
|
55
61
|
active: sortBy === dataField,
|
|
@@ -7,6 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
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); }
|
|
11
|
+
const label = {
|
|
12
|
+
inputProps: {
|
|
13
|
+
'aria-label': 'Select all checkbox'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
10
16
|
const CheckboxView = _ref => {
|
|
11
17
|
let {
|
|
12
18
|
includeSelectedIds,
|
|
@@ -15,14 +21,16 @@ const CheckboxView = _ref => {
|
|
|
15
21
|
} = _ref;
|
|
16
22
|
return /*#__PURE__*/_react.default.createElement(_core.TableCell, {
|
|
17
23
|
padding: "checkbox"
|
|
18
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
25
|
+
style: {
|
|
26
|
+
display: 'none'
|
|
27
|
+
}
|
|
28
|
+
}, "Select all"), /*#__PURE__*/_react.default.createElement(_core.Checkbox, _extends({}, label, {
|
|
29
|
+
color: "primary",
|
|
30
|
+
indeterminate: includeSelectedIds,
|
|
31
|
+
checked: includeSelectedIds,
|
|
32
|
+
onChange: event => toggleSelectAll(event, Ids, includeSelectedIds)
|
|
33
|
+
})));
|
|
26
34
|
};
|
|
27
35
|
var _default = CheckboxView;
|
|
28
36
|
exports.default = _default;
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _core = require("@material-ui/core");
|
|
10
|
+
var _icons = require("@material-ui/icons");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
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; }
|
|
12
13
|
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; }
|
|
@@ -38,6 +39,12 @@ const defaultTheme = {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
};
|
|
42
|
+
const downloadAreaStyle = {
|
|
43
|
+
display: 'flex',
|
|
44
|
+
borderTop: '1px solid #8A7F7C',
|
|
45
|
+
borderBottom: '1px solid #8A7F7C',
|
|
46
|
+
paddingRight: '41px'
|
|
47
|
+
};
|
|
41
48
|
const CustomPagination = _ref => {
|
|
42
49
|
let {
|
|
43
50
|
rowsPerPageOptions,
|
|
@@ -52,6 +59,9 @@ const CustomPagination = _ref => {
|
|
|
52
59
|
theme: (0, _core.createTheme)({
|
|
53
60
|
overrides: _objectSpread(_objectSpread({}, defaultTheme), customTheme)
|
|
54
61
|
})
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: "downloadArea",
|
|
64
|
+
style: downloadAreaStyle
|
|
55
65
|
}, /*#__PURE__*/_react.default.createElement(_core.TablePagination, {
|
|
56
66
|
rowsPerPageOptions: rowsPerPageOptions,
|
|
57
67
|
component: "div",
|
|
@@ -59,8 +69,20 @@ const CustomPagination = _ref => {
|
|
|
59
69
|
rowsPerPage: rowsPerPage,
|
|
60
70
|
page: page,
|
|
61
71
|
onPageChange: onPageChange,
|
|
62
|
-
onRowsPerPageChange: onRowsPerPageChange
|
|
63
|
-
|
|
72
|
+
onRowsPerPageChange: onRowsPerPageChange,
|
|
73
|
+
SelectProps: {
|
|
74
|
+
inputProps: {
|
|
75
|
+
'aria-label': 'Selection dropdown for displaying the number of results per page'
|
|
76
|
+
},
|
|
77
|
+
native: true
|
|
78
|
+
}
|
|
79
|
+
}), count > 0 ? /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
80
|
+
title: "Download filtered results as a CSV"
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, null, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null))) : /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, {
|
|
82
|
+
style: {
|
|
83
|
+
color: '#d1d2d3'
|
|
84
|
+
}
|
|
85
|
+
})));
|
|
64
86
|
};
|
|
65
87
|
CustomPagination.propTypes = {
|
|
66
88
|
rowsPerPageOptions: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/table",
|
|
3
|
-
"version": "1.0.1-ccdihub.
|
|
3
|
+
"version": "1.0.1-ccdihub.21",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
@@ -3,22 +3,19 @@ import {
|
|
|
3
3
|
Checkbox,
|
|
4
4
|
TableCell,
|
|
5
5
|
} from '@material-ui/core';
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
const label = { inputProps: { 'aria-label': 'Checkbox item' } };
|
|
7
8
|
|
|
8
9
|
const CheckboxView = ({
|
|
9
10
|
row,
|
|
10
11
|
onRowSelectChange,
|
|
11
12
|
}) => (
|
|
12
13
|
<TableCell padding="checkbox">
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
checked={row.isChecked}
|
|
19
|
-
/>
|
|
20
|
-
)}
|
|
21
|
-
label=""
|
|
14
|
+
<Checkbox
|
|
15
|
+
{...label}
|
|
16
|
+
disableRipple
|
|
17
|
+
onClick={(event) => onRowSelectChange(event, row)}
|
|
18
|
+
checked={row.isChecked}
|
|
22
19
|
/>
|
|
23
20
|
</TableCell>
|
|
24
21
|
);
|
package/src/header/CustomCell.js
CHANGED
|
@@ -21,6 +21,7 @@ const CustomHeaderCell = ({
|
|
|
21
21
|
header,
|
|
22
22
|
headerType,
|
|
23
23
|
customColHeaderRender,
|
|
24
|
+
sortable,
|
|
24
25
|
} = column;
|
|
25
26
|
|
|
26
27
|
const Tooltip = useCallback(({ children }) => {
|
|
@@ -45,6 +46,16 @@ const CustomHeaderCell = ({
|
|
|
45
46
|
return <>{children}</>;
|
|
46
47
|
}, []);
|
|
47
48
|
|
|
49
|
+
if (sortable !== undefined && !sortable) {
|
|
50
|
+
return (
|
|
51
|
+
<TableCell
|
|
52
|
+
scope="col"
|
|
53
|
+
>
|
|
54
|
+
{header}
|
|
55
|
+
</TableCell>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
48
59
|
return (
|
|
49
60
|
<TableCell
|
|
50
61
|
scope="col"
|
|
@@ -2,24 +2,23 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
TableCell,
|
|
4
4
|
Checkbox,
|
|
5
|
-
FormControlLabel,
|
|
6
5
|
} from '@material-ui/core';
|
|
7
6
|
|
|
7
|
+
const label = { inputProps: { 'aria-label': 'Select all checkbox' } };
|
|
8
|
+
|
|
8
9
|
const CheckboxView = ({
|
|
9
10
|
includeSelectedIds,
|
|
10
11
|
toggleSelectAll,
|
|
11
12
|
Ids,
|
|
12
13
|
}) => (
|
|
13
14
|
<TableCell padding="checkbox">
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/>
|
|
22
|
-
)}
|
|
15
|
+
<span style={{ display: 'none' }}>Select all</span>
|
|
16
|
+
<Checkbox
|
|
17
|
+
{...label}
|
|
18
|
+
color="primary"
|
|
19
|
+
indeterminate={includeSelectedIds}
|
|
20
|
+
checked={includeSelectedIds}
|
|
21
|
+
onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds)}
|
|
23
22
|
/>
|
|
24
23
|
</TableCell>
|
|
25
24
|
);
|
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
createTheme,
|
|
5
5
|
TablePagination,
|
|
6
6
|
ThemeProvider,
|
|
7
|
+
IconButton,
|
|
8
|
+
Tooltip,
|
|
7
9
|
} from '@material-ui/core';
|
|
10
|
+
import { CloudDownload } from '@material-ui/icons';
|
|
8
11
|
|
|
9
12
|
const defaultTheme = {
|
|
10
13
|
MuiTablePagination: {
|
|
@@ -32,6 +35,13 @@ const defaultTheme = {
|
|
|
32
35
|
},
|
|
33
36
|
};
|
|
34
37
|
|
|
38
|
+
const downloadAreaStyle = {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
borderTop: '1px solid #8A7F7C',
|
|
41
|
+
borderBottom: '1px solid #8A7F7C',
|
|
42
|
+
paddingRight: '41px',
|
|
43
|
+
};
|
|
44
|
+
|
|
35
45
|
const CustomPagination = ({
|
|
36
46
|
rowsPerPageOptions,
|
|
37
47
|
count,
|
|
@@ -42,15 +52,32 @@ const CustomPagination = ({
|
|
|
42
52
|
customTheme = {},
|
|
43
53
|
}) => (
|
|
44
54
|
<ThemeProvider theme={createTheme({ overrides: { ...defaultTheme, ...customTheme } })}>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
<div className="downloadArea" style={downloadAreaStyle}>
|
|
56
|
+
<TablePagination
|
|
57
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
58
|
+
component="div"
|
|
59
|
+
count={count}
|
|
60
|
+
rowsPerPage={rowsPerPage}
|
|
61
|
+
page={page}
|
|
62
|
+
onPageChange={onPageChange}
|
|
63
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
64
|
+
SelectProps={{
|
|
65
|
+
inputProps: { 'aria-label': 'Selection dropdown for displaying the number of results per page' },
|
|
66
|
+
native: true,
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
{
|
|
70
|
+
count > 0
|
|
71
|
+
? (
|
|
72
|
+
<Tooltip title="Download filtered results as a CSV">
|
|
73
|
+
<IconButton>
|
|
74
|
+
<CloudDownload />
|
|
75
|
+
</IconButton>
|
|
76
|
+
</Tooltip>
|
|
77
|
+
)
|
|
78
|
+
: <CloudDownload style={{ color: '#d1d2d3' }} />
|
|
79
|
+
}
|
|
80
|
+
</div>
|
|
54
81
|
</ThemeProvider>
|
|
55
82
|
);
|
|
56
83
|
|