@bento-core/table 1.0.1-ccdihub.0 → 1.0.1-ccdihub.10
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 +7 -1
- 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 +4 -0
|
@@ -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: "Table-Checkbox-Item"
|
|
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;
|
|
@@ -59,7 +59,13 @@ const CustomPagination = _ref => {
|
|
|
59
59
|
rowsPerPage: rowsPerPage,
|
|
60
60
|
page: page,
|
|
61
61
|
onPageChange: onPageChange,
|
|
62
|
-
onRowsPerPageChange: onRowsPerPageChange
|
|
62
|
+
onRowsPerPageChange: onRowsPerPageChange,
|
|
63
|
+
SelectProps: {
|
|
64
|
+
inputProps: {
|
|
65
|
+
'aria-label': 'Selection dropdown for displaying the number of results per page'
|
|
66
|
+
},
|
|
67
|
+
native: true
|
|
68
|
+
}
|
|
63
69
|
}));
|
|
64
70
|
};
|
|
65
71
|
CustomPagination.propTypes = {
|
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.10",
|
|
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="Table-Checkbox-Item"
|
|
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
|
);
|
|
@@ -50,6 +50,10 @@ const CustomPagination = ({
|
|
|
50
50
|
page={page}
|
|
51
51
|
onPageChange={onPageChange}
|
|
52
52
|
onRowsPerPageChange={onRowsPerPageChange}
|
|
53
|
+
SelectProps={{
|
|
54
|
+
inputProps: { 'aria-label': 'Selection dropdown for displaying the number of results per page' },
|
|
55
|
+
native: true,
|
|
56
|
+
}}
|
|
53
57
|
/>
|
|
54
58
|
</ThemeProvider>
|
|
55
59
|
);
|