@bento-core/table 1.0.1-icdc.14 → 1.0.1-icdc.15

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.
@@ -21,7 +21,10 @@ const CheckboxView = _ref => {
21
21
  }, /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
22
22
  disableRipple: true,
23
23
  onClick: event => onRowSelectChange(event, row),
24
- checked: row.isChecked
24
+ checked: row.isChecked,
25
+ inputProps: {
26
+ 'aria-label': 'checkbox'
27
+ }
25
28
  })));
26
29
  };
27
30
  var _default = CheckboxView;
@@ -23,6 +23,7 @@ const DeleteCellView = _ref => {
23
23
  }, customCellRender ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customCellRender(row, onDeleteRow)) : /*#__PURE__*/_react.default.createElement(_core.IconButton, {
24
24
  disableRipple: true,
25
25
  className: "del_row_btn",
26
+ "aria-label": "delete",
26
27
  onClick: () => column.cellEventHandler(row)
27
28
  }, /*#__PURE__*/_react.default.createElement(_icons.DeleteOutline, {
28
29
  className: "del_row_btn_icon",
@@ -26,7 +26,8 @@ const ActionHeaderCell = _ref => {
26
26
  return /*#__PURE__*/_react.default.createElement(_CheckBoxView.default, {
27
27
  includeSelectedIds: includeSelectedIds,
28
28
  toggleSelectAll: toggleSelectAll,
29
- Ids: Ids
29
+ Ids: Ids,
30
+ rows: rows
30
31
  });
31
32
  }
32
33
  if (_Types.cellTypes.DELETE === cellType) {
@@ -42,7 +42,8 @@ const ColumnGrouping = _ref => {
42
42
  if (colSpan > 0) {
43
43
  return /*#__PURE__*/_react.default.createElement(_core.TableCell, {
44
44
  colSpan: colSpan,
45
- className: clsName
45
+ className: clsName,
46
+ component: !title || !customViewRender ? 'td' : 'th'
46
47
  }, customViewRender ? customViewRender() : title);
47
48
  }
48
49
  return null;
@@ -7,20 +7,37 @@ 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
+ const useStyles = (0, _core.makeStyles)({
11
+ label: {
12
+ opacity: '0'
13
+ }
14
+ });
10
15
  const CheckboxView = _ref => {
11
16
  let {
12
17
  includeSelectedIds,
13
18
  toggleSelectAll,
14
- Ids
19
+ Ids,
20
+ rows
15
21
  } = _ref;
22
+ const {
23
+ label
24
+ } = useStyles();
16
25
  return /*#__PURE__*/_react.default.createElement(_core.TableCell, {
17
- padding: "checkbox"
26
+ padding: "checkbox",
27
+ component: "td"
18
28
  }, /*#__PURE__*/_react.default.createElement(_core.FormControlLabel, {
29
+ label: "checkbox",
30
+ classes: {
31
+ label
32
+ },
19
33
  control: /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
20
34
  color: "primary",
21
35
  indeterminate: includeSelectedIds,
22
36
  checked: includeSelectedIds,
23
- onChange: event => toggleSelectAll(event, Ids, includeSelectedIds)
37
+ inputProps: {
38
+ 'aria-label': 'checkbox'
39
+ },
40
+ onChange: event => toggleSelectAll(event, Ids, includeSelectedIds, rows)
24
41
  })
25
42
  }));
26
43
  };
@@ -55,6 +55,12 @@ const CustomPagination = _ref => {
55
55
  }, /*#__PURE__*/_react.default.createElement(_core.TablePagination, {
56
56
  rowsPerPageOptions: rowsPerPageOptions,
57
57
  component: "div",
58
+ SelectProps: {
59
+ inputProps: {
60
+ title: 'checkbox',
61
+ 'aria-label': 'checkbox'
62
+ }
63
+ },
58
64
  count: count,
59
65
  rowsPerPage: rowsPerPage,
60
66
  page: page,
@@ -29,6 +29,13 @@ const SearchInputView = _ref => {
29
29
  onSearchQueryChange('');
30
30
  setSearchText('');
31
31
  };
32
+
33
+ // update input search query
34
+ (0, _react.useEffect)(() => {
35
+ if (table !== null && table !== void 0 && table.searchQuery) {
36
+ setSearchText(table === null || table === void 0 ? void 0 : table.searchQuery);
37
+ }
38
+ }, [table === null || table === void 0 ? void 0 : table.searchQuery]);
32
39
  return /*#__PURE__*/_react.default.createElement(_core.Box, {
33
40
  id: "table_serach_input"
34
41
  }, /*#__PURE__*/_react.default.createElement(_core.TextField, {
@@ -36,7 +43,7 @@ const SearchInputView = _ref => {
36
43
  variant: "outlined",
37
44
  onChange: handleChange,
38
45
  onKeyDown: handleChange,
39
- value: searchText || (table === null || table === void 0 ? void 0 : table.searchQuery),
46
+ value: searchText,
40
47
  InputProps: {
41
48
  endAdornment: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (table === null || table === void 0 ? void 0 : table.searchQuery) && /*#__PURE__*/_react.default.createElement(_core.InputAdornment, {
42
49
  position: "end",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-icdc.14",
3
+ "version": "1.0.1-icdc.15",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,4 +25,4 @@
25
25
  },
26
26
  "author": "CTOS Bento Team",
27
27
  "license": "ISC"
28
- }
28
+ }
@@ -23,6 +23,9 @@ const CheckboxView = ({
23
23
  disableRipple
24
24
  onClick={(event) => onRowSelectChange(event, row)}
25
25
  checked={row.isChecked}
26
+ inputProps={{
27
+ 'aria-label': 'checkbox',
28
+ }}
26
29
  />
27
30
  </TableCell>
28
31
  )
@@ -27,6 +27,7 @@ const DeleteCellView = ({
27
27
  <IconButton
28
28
  disableRipple
29
29
  className="del_row_btn"
30
+ aria-label="delete"
30
31
  onClick={() => column.cellEventHandler(row)}
31
32
  >
32
33
  <DeleteOutlineIcon
@@ -20,6 +20,7 @@ const ActionHeaderCell = ({
20
20
  includeSelectedIds={includeSelectedIds}
21
21
  toggleSelectAll={toggleSelectAll}
22
22
  Ids={Ids}
23
+ rows={rows}
23
24
  />
24
25
  );
25
26
  }
@@ -41,7 +41,7 @@ const ColumnGrouping = ({
41
41
  const colSpan = getColSpan(columnIndexes);
42
42
  if (colSpan > 0) {
43
43
  return (
44
- <TableCell colSpan={colSpan} className={clsName}>
44
+ <TableCell colSpan={colSpan} className={clsName} component={!title || !customViewRender ? 'td' : 'th'}>
45
45
  {customViewRender ? customViewRender() : title}
46
46
  </TableCell>
47
47
  );
@@ -3,25 +3,44 @@ import {
3
3
  TableCell,
4
4
  Checkbox,
5
5
  FormControlLabel,
6
+ makeStyles,
6
7
  } from '@material-ui/core';
7
8
 
9
+ const useStyles = makeStyles({
10
+ label: {
11
+ opacity: '0',
12
+ },
13
+ });
14
+
8
15
  const CheckboxView = ({
9
16
  includeSelectedIds,
10
17
  toggleSelectAll,
11
18
  Ids,
12
- }) => (
13
- <TableCell padding="checkbox">
14
- <FormControlLabel
15
- control={(
16
- <Checkbox
17
- color="primary"
18
- indeterminate={includeSelectedIds}
19
- checked={includeSelectedIds}
20
- onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds)}
21
- />
22
- )}
23
- />
24
- </TableCell>
25
- );
19
+ rows,
20
+ }) => {
21
+ const { label } = useStyles();
22
+
23
+ return (
24
+ <TableCell padding="checkbox" component="td">
25
+ <FormControlLabel
26
+ label="checkbox"
27
+ classes={{
28
+ label,
29
+ }}
30
+ control={(
31
+ <Checkbox
32
+ color="primary"
33
+ indeterminate={includeSelectedIds}
34
+ checked={includeSelectedIds}
35
+ inputProps={{
36
+ 'aria-label': 'checkbox',
37
+ }}
38
+ onChange={(event) => toggleSelectAll(event, Ids, includeSelectedIds, rows)}
39
+ />
40
+ )}
41
+ />
42
+ </TableCell>
43
+ );
44
+ };
26
45
 
27
46
  export default CheckboxView;
@@ -45,6 +45,12 @@ const CustomPagination = ({
45
45
  <TablePagination
46
46
  rowsPerPageOptions={rowsPerPageOptions}
47
47
  component="div"
48
+ SelectProps={{
49
+ inputProps: {
50
+ title: 'checkbox',
51
+ 'aria-label': 'checkbox',
52
+ },
53
+ }}
48
54
  count={count}
49
55
  rowsPerPage={rowsPerPage}
50
56
  page={page}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable jsx-quotes */
2
- import React, { useState } from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import {
4
4
  InputAdornment,
5
5
  TextField,
@@ -25,6 +25,13 @@ const SearchInputView = ({
25
25
  setSearchText('');
26
26
  };
27
27
 
28
+ // update input search query
29
+ useEffect(() => {
30
+ if (table?.searchQuery) {
31
+ setSearchText(table?.searchQuery);
32
+ }
33
+ }, [table?.searchQuery]);
34
+
28
35
  return (
29
36
  <Box id='table_serach_input'>
30
37
  <TextField
@@ -32,7 +39,7 @@ const SearchInputView = ({
32
39
  variant='outlined'
33
40
  onChange={handleChange}
34
41
  onKeyDown={handleChange}
35
- value={searchText || table?.searchQuery}
42
+ value={searchText}
36
43
  InputProps={{
37
44
  endAdornment: (
38
45
  <>