@bento-core/facet-filter 1.0.1-icdc.1 → 1.0.1-icdc.3

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/README.md CHANGED
@@ -72,12 +72,17 @@ import FacetFilter from 'bento-core';
72
72
  ```
73
73
  import { InputTypes } from 'bento-core';
74
74
 
75
+ // fields for labelds and counts
76
+ const GROUP = 'group'; // access labels
77
+ const COUNT = 'subjects'; // access count value
78
+
75
79
  export const facetsConfig = [{
76
80
  section: CASES,
77
81
  label: 'Program',
78
82
  apiForFiltering: 'filterSubjectCountByProgram',
79
83
  datafield: 'programs',
80
- field: GROUP,
84
+ field: GROUP,
85
+ count: COUNT,
81
86
  type: InputTypes.CHECKBOX,
82
87
  sort_type: sortType.ALPHABET,
83
88
  show: true,
@@ -265,11 +270,29 @@ const CustomClearAllFiltersBtn = ({ onClearAllFilters, disable }) => {
265
270
  ```
266
271
  // response
267
272
  // filterCaseCountByProgram: [{group: "COP", subjects: 301}]
273
+
274
+ // facet = {
275
+ // section: CASES,
276
+ // label: 'Program',
277
+ // apiForFiltering: 'filterSubjectCountByProgram',
278
+ // datafield: 'programs',
279
+ // field: GROUP,
280
+ // count: COUNT,
281
+ // type: InputTypes.CHECKBOX,
282
+ // sort_type: sortType.ALPHABET,
283
+ // show: true,
284
+ // customCount = (text) => `(${text})`,
285
+ // }
286
+
287
+ const {
288
+ field = 'group',
289
+ count = 'subjects',
290
+ customCount = (text) => `(${text})`,
291
+ } = facet;
268
292
  const {
269
- name,
270
- customName,
271
- subjects,
272
- customSubjects,
293
+ isChecked = false,
294
+ index,
295
+ section,
273
296
  tooltip,
274
297
  } = checkboxItem;
275
298
 
@@ -17,7 +17,8 @@ const BentoFacetFilter = _ref => {
17
17
  let {
18
18
  sideBarSections,
19
19
  CustomFacetSection,
20
- CustomFacetView
20
+ CustomFacetView,
21
+ enableClearSection
21
22
  } = _ref;
22
23
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sideBarSections.map((section, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Divider, {
23
24
  variant: "middle",
@@ -27,7 +28,8 @@ const BentoFacetFilter = _ref => {
27
28
  CustomSection: CustomFacetSection
28
29
  }, section.items.map(facet => /*#__PURE__*/_react.default.createElement(_ReduxFacetView.default, {
29
30
  facet: facet,
30
- CustomView: CustomFacetView
31
+ CustomView: CustomFacetView,
32
+ enableClearSection: enableClearSection
31
33
  }))))));
32
34
  };
33
35
  var _default = (0, _core.withStyles)(_FacetFilterStyle.default)(BentoFacetFilter);
@@ -20,6 +20,13 @@ var _default = () => ({
20
20
  position: 'initial'
21
21
  }
22
22
  },
23
+ subSectionSummaryTextWrapper: {
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ justifyContent: 'space-between',
27
+ width: '100%',
28
+ paddingRight: '15px'
29
+ },
23
30
  subSectionSummaryText: {
24
31
  marginLeft: '10px',
25
32
  lineHeight: 0,
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _core = require("@material-ui/core");
9
9
  var _clsx = _interopRequireDefault(require("clsx"));
10
+ var _Refresh = _interopRequireDefault(require("@material-ui/icons/Refresh"));
11
+ var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
10
12
  var _AccordionSummaryView = _interopRequireDefault(require("../summary/AccordionSummaryView"));
11
13
  var _Types = require("../inputs/Types");
12
14
  var _FacetStyle = _interopRequireDefault(require("./FacetStyle"));
@@ -25,18 +27,20 @@ const FacetView = _ref => {
25
27
  let {
26
28
  classes,
27
29
  facet,
30
+ enableClearSection,
28
31
  onClearFacetSection,
29
32
  onClearSliderSection,
30
33
  CustomView,
31
34
  autoComplete,
32
- upload
35
+ upload,
36
+ onToggle
33
37
  } = _ref;
34
38
  const [expand, setExpand] = (0, _react.useState)(false);
35
39
  const onExpandFacet = () => setExpand(!expand);
36
40
 
37
41
  /**
38
- * expand section incase of active local search
39
- */
42
+ * expand section incase of active local search
43
+ */
40
44
  (0, _react.useEffect)(() => {
41
45
  if (autoComplete && autoComplete.length > 0 || upload && upload.length > 0) {
42
46
  setExpand(true);
@@ -59,13 +63,24 @@ const FacetView = _ref => {
59
63
  */
60
64
  const {
61
65
  type,
62
- facetValues
66
+ facetValues,
67
+ datafield
63
68
  } = facet;
64
69
  const selectedItems = facetValues && facetValues.filter(item => item.isChecked);
65
70
  const displayFacet = _objectSpread({}, facet);
66
71
  displayFacet.facetValues = selectedItems;
67
72
  const isActiveFacet = [...selectedItems].length > 0;
68
73
  const limitCheckBoxCount = (facet === null || facet === void 0 ? void 0 : facet.showCheckboxCount) || 5;
74
+ const clearFacetSectionValues = () => {
75
+ facetValues.forEach(item => {
76
+ const toggleCheckBoxItem = {
77
+ name: item.group,
78
+ datafield,
79
+ isChecked: false
80
+ };
81
+ onToggle(toggleCheckBoxItem);
82
+ });
83
+ };
69
84
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Accordion, {
70
85
  square: true,
71
86
  expanded: expand,
@@ -75,14 +90,25 @@ const FacetView = _ref => {
75
90
  },
76
91
  id: facet.section
77
92
  }, CustomView ? /*#__PURE__*/_react.default.createElement(CustomView, {
93
+ clearFacetSectionValues: clearFacetSectionValues,
94
+ hasSelections: selectedItems.length,
78
95
  facet: facet,
79
96
  facetClasses: isActiveFacet ? "activeFacet".concat(facet.section) : "inactiveFacet".concat(facet.section)
80
- }) : /*#__PURE__*/_react.default.createElement(_AccordionSummaryView.default, null, /*#__PURE__*/_react.default.createElement("div", {
97
+ }) : /*#__PURE__*/_react.default.createElement(_AccordionSummaryView.default, null, !enableClearSection ? /*#__PURE__*/_react.default.createElement("div", {
98
+ id: "filterGroup_ ".concat(facet.datafield, "\n ").concat(facet.label),
99
+ className: (0, _clsx.default)(classes.subSectionSummaryText, {
100
+ ["activeFacet".concat(facet.section)]: isActiveFacet
101
+ })
102
+ }, facet.label) : /*#__PURE__*/_react.default.createElement("div", {
103
+ className: classes.subSectionSummaryTextWrapper
104
+ }, /*#__PURE__*/_react.default.createElement("div", {
81
105
  id: "filterGroup_ ".concat(facet.datafield, "\n ").concat(facet.label),
82
106
  className: (0, _clsx.default)(classes.subSectionSummaryText, {
83
107
  ["activeFacet".concat(facet.section)]: isActiveFacet
84
108
  })
85
- }, facet.label)), (facet.type === _Types.InputTypes.SLIDER || facetValues.length === 0) && /*#__PURE__*/_react.default.createElement("div", {
109
+ }, facet.label), selectedItems.length ? /*#__PURE__*/_react.default.createElement(_IconButton.default, {
110
+ onClick: clearFacetSectionValues
111
+ }, /*#__PURE__*/_react.default.createElement(_Refresh.default, null)) : null)), (facet.type === _Types.InputTypes.SLIDER || facetValues.length === 0) && /*#__PURE__*/_react.default.createElement("div", {
86
112
  className: classes.NonSortGroup
87
113
  }, /*#__PURE__*/_react.default.createElement("span", {
88
114
  className: classes.NonSortGroupItem
@@ -19,6 +19,7 @@ const mapStateToProps = state => {
19
19
  };
20
20
  };
21
21
  const mapDispatchToProps = dispatch => ({
22
+ onToggle: facet => dispatch((0, _Actions.toggleCheckBox)(facet)),
22
23
  onClearFacetSection: facet => {
23
24
  dispatch((0, _Actions.clearFacetSection)(facet));
24
25
  },
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _core = require("@material-ui/core");
9
+ var _clsx = _interopRequireDefault(require("clsx"));
9
10
  var _SliderStyle = _interopRequireDefault(require("./SliderStyle"));
10
11
  var _Types = require("../Types");
11
12
  var _InputMinMaxView = _interopRequireDefault(require("./InputMinMaxView"));
@@ -63,9 +64,9 @@ const SliderView = _ref => {
63
64
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
64
65
  className: classes.sliderRoot
65
66
  }, /*#__PURE__*/_react.default.createElement("div", {
66
- className: classes.minMaxInputs
67
+ className: (0, _clsx.default)(classes.minMaxInputs, 'minMaxInputs')
67
68
  }, /*#__PURE__*/_react.default.createElement("div", {
68
- className: classes.minValue
69
+ className: (0, _clsx.default)(classes.minValue, 'min_input_box')
69
70
  }, /*#__PURE__*/_react.default.createElement(_core.Typography, {
70
71
  className: classes.minInputLabel
71
72
  }, "Min:"), /*#__PURE__*/_react.default.createElement(_InputMinMaxView.default, {
@@ -76,7 +77,7 @@ const SliderView = _ref => {
76
77
  type: _Types.silderTypes.INPUT_MIN,
77
78
  onInputChange: handleChangeCommittedSlider
78
79
  })), /*#__PURE__*/_react.default.createElement("div", {
79
- className: classes.maxValue
80
+ className: (0, _clsx.default)(classes.maxValue, 'max_input_box')
80
81
  }, /*#__PURE__*/_react.default.createElement(_core.Typography, {
81
82
  className: classes.maxInputLabel
82
83
  }, "Max:"), /*#__PURE__*/_react.default.createElement(_InputMinMaxView.default, {
@@ -87,7 +88,7 @@ const SliderView = _ref => {
87
88
  type: _Types.silderTypes.INPUT_MAX,
88
89
  onInputChange: handleChangeCommittedSlider
89
90
  }))), /*#__PURE__*/_react.default.createElement("div", {
90
- className: classes.slider
91
+ className: (0, _clsx.default)(classes.slider, 'slider')
91
92
  }, /*#__PURE__*/_react.default.createElement(_core.Slider, {
92
93
  disableSwap: true,
93
94
  getAriaValueText: valuetext,
@@ -11,6 +11,7 @@ var _AccordionSummaryStyle = _interopRequireDefault(require("./AccordionSummaryS
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  const Summary = (0, _core.withStyles)({
13
13
  root: {
14
+ width: '307px',
14
15
  marginBottom: -1,
15
16
  minHeight: 48,
16
17
  paddingLeft: 14,
package/package.json CHANGED
@@ -1,17 +1,14 @@
1
1
  {
2
2
  "name": "@bento-core/facet-filter",
3
- "version": "1.0.1-icdc.1",
4
- "description": "### Bento core sidebar design:",
3
+ "version": "1.0.1-icdc.3",
4
+ "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "lint": "eslint src"
10
10
  },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/CBIIT/bento-frontend.git"
14
- },
11
+ "repository": "https://github.com/CBIIT/bento-frontend",
15
12
  "publishConfig": {
16
13
  "access": "public"
17
14
  },
@@ -27,9 +24,5 @@
27
24
  "react-redux": "^7.2.1"
28
25
  },
29
26
  "author": "CTOS Bento Team",
30
- "license": "ISC",
31
- "bugs": {
32
- "url": "https://github.com/CBIIT/bento-frontend/issues"
33
- },
34
- "homepage": "https://github.com/CBIIT/bento-frontend#readme"
27
+ "license": "ISC"
35
28
  }
@@ -1,10 +1,7 @@
1
1
  /* eslint-disable arrow-body-style */
2
2
  /* eslint-disable padded-blocks */
3
3
  import React from 'react';
4
- import {
5
- Divider,
6
- withStyles,
7
- } from '@material-ui/core';
4
+ import { Divider, withStyles } from '@material-ui/core';
8
5
  import styles from './FacetFilterStyle';
9
6
  import FacetSectionView from './components/section/FacetSectionView';
10
7
  import FacetView from './components/facet/ReduxFacetView';
@@ -13,30 +10,27 @@ const BentoFacetFilter = ({
13
10
  sideBarSections,
14
11
  CustomFacetSection,
15
12
  CustomFacetView,
13
+ enableClearSection,
16
14
  }) => {
17
15
  return (
18
16
  <>
19
- {
20
- sideBarSections.map((section, index) => (
21
- <>
22
- <Divider
23
- variant="middle"
24
- className={`divider${index}`}
25
- />
26
- <FacetSectionView
27
- section={section}
28
- CustomSection={CustomFacetSection}
29
- >
30
- {section.items.map((facet) => (
31
- <FacetView
32
- facet={facet}
33
- CustomView={CustomFacetView}
34
- />
35
- ))}
36
- </FacetSectionView>
37
- </>
38
- ))
39
- }
17
+ {sideBarSections.map((section, index) => (
18
+ <>
19
+ <Divider variant="middle" className={`divider${index}`} />
20
+ <FacetSectionView
21
+ section={section}
22
+ CustomSection={CustomFacetSection}
23
+ >
24
+ {section.items.map((facet) => (
25
+ <FacetView
26
+ facet={facet}
27
+ CustomView={CustomFacetView}
28
+ enableClearSection={enableClearSection}
29
+ />
30
+ ))}
31
+ </FacetSectionView>
32
+ </>
33
+ ))}
40
34
  </>
41
35
  );
42
36
  };
@@ -14,6 +14,13 @@ export default () => ({
14
14
  position: 'initial',
15
15
  },
16
16
  },
17
+ subSectionSummaryTextWrapper: {
18
+ display: 'flex',
19
+ alignItems: 'center',
20
+ justifyContent: 'space-between',
21
+ width: '100%',
22
+ paddingRight: '15px',
23
+ },
17
24
  subSectionSummaryText: {
18
25
  marginLeft: '10px',
19
26
  lineHeight: 0,
@@ -1,11 +1,10 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import {
3
- Accordion,
4
- List,
5
- withStyles,
6
- Icon,
3
+ Accordion, List, withStyles, Icon,
7
4
  } from '@material-ui/core';
8
5
  import clsx from 'clsx';
6
+ import RefreshIcon from '@material-ui/icons/Refresh';
7
+ import IconButton from '@material-ui/core/IconButton';
9
8
  import CustomAccordionSummary from '../summary/AccordionSummaryView';
10
9
  import { InputTypes } from '../inputs/Types';
11
10
  import styles from './FacetStyle';
@@ -16,21 +15,25 @@ import clearIcon from './assets/clearIcon.svg';
16
15
  const FacetView = ({
17
16
  classes,
18
17
  facet,
18
+ enableClearSection,
19
19
  onClearFacetSection,
20
20
  onClearSliderSection,
21
21
  CustomView,
22
22
  autoComplete,
23
23
  upload,
24
+ onToggle,
24
25
  }) => {
25
26
  const [expand, setExpand] = useState(false);
26
27
  const onExpandFacet = () => setExpand(!expand);
27
28
 
28
29
  /**
29
- * expand section incase of active local search
30
- */
30
+ * expand section incase of active local search
31
+ */
31
32
  useEffect(() => {
32
- if ((autoComplete && autoComplete.length > 0)
33
- || (upload && upload.length > 0)) {
33
+ if (
34
+ (autoComplete && autoComplete.length > 0)
35
+ || (upload && upload.length > 0)
36
+ ) {
34
37
  setExpand(true);
35
38
  }
36
39
  }, [autoComplete, upload]);
@@ -51,12 +54,24 @@ const FacetView = ({
51
54
  /**
52
55
  * display checked items on facet collapse
53
56
  */
54
- const { type, facetValues } = facet;
57
+ const { type, facetValues, datafield } = facet;
55
58
  const selectedItems = facetValues && facetValues.filter((item) => item.isChecked);
56
59
  const displayFacet = { ...facet };
57
60
  displayFacet.facetValues = selectedItems;
58
61
  const isActiveFacet = [...selectedItems].length > 0;
59
62
  const limitCheckBoxCount = facet?.showCheckboxCount || 5;
63
+
64
+ const clearFacetSectionValues = () => {
65
+ facetValues.forEach((item) => {
66
+ const toggleCheckBoxItem = {
67
+ name: item.group,
68
+ datafield,
69
+ isChecked: false,
70
+ };
71
+
72
+ onToggle(toggleCheckBoxItem);
73
+ });
74
+ };
60
75
  return (
61
76
  <>
62
77
  <Accordion
@@ -68,119 +83,103 @@ const FacetView = ({
68
83
  }}
69
84
  id={facet.section}
70
85
  >
71
- { CustomView ? (
86
+ {CustomView ? (
72
87
  <CustomView
88
+ clearFacetSectionValues={clearFacetSectionValues}
89
+ hasSelections={selectedItems.length}
73
90
  facet={facet}
74
91
  facetClasses={
75
- isActiveFacet ? `activeFacet${facet.section}`
76
- : `inactiveFacet${facet.section}`
92
+ isActiveFacet
93
+ ? `activeFacet${facet.section}`
94
+ : `inactiveFacet${facet.section}`
77
95
  }
78
96
  />
79
97
  ) : (
80
98
  <CustomAccordionSummary>
81
- <div
82
- id={
83
- `filterGroup_ ${facet.datafield}
84
- ${facet.label}`
85
- }
86
- className={clsx(classes.subSectionSummaryText, {
87
- [`activeFacet${facet.section}`]: isActiveFacet,
88
- })}
89
- >
90
- {facet.label}
91
- </div>
99
+ {!enableClearSection ? (
100
+ <div
101
+ id={`filterGroup_ ${facet.datafield}
102
+ ${facet.label}`}
103
+ className={clsx(classes.subSectionSummaryText, {
104
+ [`activeFacet${facet.section}`]: isActiveFacet,
105
+ })}
106
+ >
107
+ {facet.label}
108
+ </div>
109
+ ) : (
110
+ <div className={classes.subSectionSummaryTextWrapper}>
111
+ <div
112
+ id={`filterGroup_ ${facet.datafield}
113
+ ${facet.label}`}
114
+ className={clsx(classes.subSectionSummaryText, {
115
+ [`activeFacet${facet.section}`]: isActiveFacet,
116
+ })}
117
+ >
118
+ {facet.label}
119
+ </div>
120
+ {selectedItems.length ? (
121
+ <IconButton onClick={clearFacetSectionValues}>
122
+ <RefreshIcon />
123
+ </IconButton>
124
+ ) : null}
125
+ </div>
126
+ )}
92
127
  </CustomAccordionSummary>
93
128
  )}
94
- {
95
- (facet.type === InputTypes.SLIDER || facetValues.length === 0)
96
- && (
129
+ {(facet.type === InputTypes.SLIDER || facetValues.length === 0) && (
97
130
  <div className={classes.NonSortGroup}>
98
- <span
99
- className={classes.NonSortGroupItem}
100
- >
131
+ <span className={classes.NonSortGroupItem}>
101
132
  No data for this field
102
133
  </span>
103
134
  </div>
104
- )
105
- }
106
- {
107
- (facet.type === InputTypes.SLIDER || facetValues.length > 0)
108
- && (
135
+ )}
136
+ {(facet.type === InputTypes.SLIDER || facetValues.length > 0) && (
109
137
  <div className={classes.sortGroup}>
110
138
  <span className={classes.sortGroupIcon}>
111
- <Icon
112
- style={{ fontSize: 10 }}
113
- onClick={onClearSection}
114
- >
115
- <img
116
- src={clearIcon}
117
- height={12}
118
- width={12}
119
- alt="clear-icon"
120
- />
139
+ <Icon style={{ fontSize: 10 }} onClick={onClearSection}>
140
+ <img src={clearIcon} height={12} width={12} alt="clear-icon" />
121
141
  </Icon>
122
142
  </span>
123
- { (facet.type === InputTypes.CHECKBOX && facetValues.length > 0)
124
- && (
125
- <>
126
- <span
127
- className={
128
- clsx(classes.sortGroupItem, {
129
- [classes.highlight]: sortBy === sortType.ALPHABET,
130
- })
131
- }
132
- onClick={() => {
133
- onSortFacet(sortType.ALPHABET);
134
- }}
135
- >
136
- Sort alphabetically
137
- </span>
138
- <span
139
- className={
140
- clsx(classes.sortGroupItemCounts, {
141
- [classes.highlight]: sortBy === sortType.NUMERIC,
142
- })
143
- }
144
- onClick={() => {
145
- onSortFacet(sortType.NUMERIC);
146
- }}
147
- >
148
- Sort by count
149
- </span>
150
- </>
151
- )}
143
+ {facet.type === InputTypes.CHECKBOX && facetValues.length > 0 && (
144
+ <>
145
+ <span
146
+ className={clsx(classes.sortGroupItem, {
147
+ [classes.highlight]: sortBy === sortType.ALPHABET,
148
+ })}
149
+ onClick={() => {
150
+ onSortFacet(sortType.ALPHABET);
151
+ }}
152
+ >
153
+ Sort alphabetically
154
+ </span>
155
+ <span
156
+ className={clsx(classes.sortGroupItemCounts, {
157
+ [classes.highlight]: sortBy === sortType.NUMERIC,
158
+ })}
159
+ onClick={() => {
160
+ onSortFacet(sortType.NUMERIC);
161
+ }}
162
+ >
163
+ Sort by count
164
+ </span>
165
+ </>
166
+ )}
152
167
  </div>
153
- )
154
- }
155
- {(expand)
156
- && (
157
- <FilterItems
158
- facet={facet}
159
- sortBy={sortBy}
160
- />
161
- )}
168
+ )}
169
+ {expand && <FilterItems facet={facet} sortBy={sortBy} />}
162
170
  </Accordion>
163
- {
164
- (!expand && type === InputTypes.CHECKBOX && selectedItems.length > 0) && (
165
- <>
166
- <List id="filter_Items">
167
- <FilterItems
168
- facet={displayFacet}
169
- />
170
- </List>
171
- </>
172
- )
173
- }
174
- {
175
- (!expand && selectedItems.length > limitCheckBoxCount) && (
176
- <div
177
- className={classes.showMore}
178
- onClick={onExpandFacet}
179
- >
180
- ...expand to see all selections
181
- </div>
182
- )
183
- }
171
+ {!expand && type === InputTypes.CHECKBOX && selectedItems.length > 0 && (
172
+ <>
173
+ <List id="filter_Items">
174
+ <FilterItems facet={displayFacet} />
175
+ </List>
176
+ </>
177
+ )}
178
+ {!expand && selectedItems.length > limitCheckBoxCount && (
179
+ <div className={classes.showMore} onClick={onExpandFacet}>
180
+ ...expand to see all selections
181
+ </div>
182
+ )}
184
183
  </>
185
184
  );
186
185
  };
@@ -1,9 +1,13 @@
1
1
  import React from 'react';
2
2
  import { connect } from 'react-redux';
3
- import { clearFacetSection, clearSliderSection } from '../../store/actions/Actions';
3
+ import {
4
+ clearFacetSection,
5
+ clearSliderSection,
6
+ toggleCheckBox,
7
+ } from '../../store/actions/Actions';
4
8
  import FacetView from './FacetView';
5
9
 
6
- const ReduxFacetView = ((props) => <FacetView {...props} />);
10
+ const ReduxFacetView = (props) => <FacetView {...props} />;
7
11
 
8
12
  const mapStateToProps = (state) => ({
9
13
  filterState: state.statusReducer.filterState,
@@ -12,8 +16,13 @@ const mapStateToProps = (state) => ({
12
16
  });
13
17
 
14
18
  const mapDispatchToProps = (dispatch) => ({
15
- onClearFacetSection: (facet) => { dispatch(clearFacetSection(facet)); },
16
- onClearSliderSection: (facet) => { dispatch(clearSliderSection(facet)); },
19
+ onToggle: (facet) => dispatch(toggleCheckBox(facet)),
20
+ onClearFacetSection: (facet) => {
21
+ dispatch(clearFacetSection(facet));
22
+ },
23
+ onClearSliderSection: (facet) => {
24
+ dispatch(clearSliderSection(facet));
25
+ },
17
26
  });
18
27
 
19
28
  export default connect(mapStateToProps, mapDispatchToProps)(ReduxFacetView);
@@ -20,7 +20,8 @@ import {
20
20
  } from '@material-ui/core';
21
21
  import clsx from 'clsx';
22
22
  import {
23
- CheckBox as CheckBoxIcon, CheckBoxOutlineBlank as CheckBoxBlankIcon,
23
+ CheckBox as CheckBoxIcon,
24
+ CheckBoxOutlineBlank as CheckBoxBlankIcon,
24
25
  } from '@material-ui/icons';
25
26
  import styles from './CheckboxStyle';
26
27
 
@@ -31,12 +32,7 @@ const CheckBoxView = ({
31
32
  onToggle,
32
33
  facet,
33
34
  }) => {
34
- const {
35
- isChecked = false,
36
- index,
37
- section,
38
- tooltip,
39
- } = checkboxItem;
35
+ const { isChecked = false, index, section, tooltip } = checkboxItem;
40
36
  const {
41
37
  field = 'group',
42
38
  count = 'subjects',
@@ -65,9 +61,7 @@ const CheckBoxView = ({
65
61
  [`${checkedSection}NameChecked`]: isChecked,
66
62
  })}
67
63
  >
68
- <Typography className={classes.checkboxName}>
69
- {name}
70
- </Typography>
64
+ <Typography className={classes.checkboxName}>{name}</Typography>
71
65
  </Box>
72
66
  );
73
67
 
@@ -79,7 +73,9 @@ const CheckBoxView = ({
79
73
  alignItems="flex-start"
80
74
  onClick={handleToggle}
81
75
  classes={{ gutters: classes.listItemGutters }}
82
- className={clsx({ [`${checkedSection}Checked${indexType}`]: isChecked })}
76
+ className={clsx({
77
+ [`${checkedSection}Checked${indexType}`]: isChecked,
78
+ })}
83
79
  >
84
80
  <Checkbox
85
81
  id={`checkbox_${facet.label}_${name}`}
@@ -91,23 +87,21 @@ const CheckBoxView = ({
91
87
  }
92
88
  onClick={handleToggle}
93
89
  checked={isChecked}
94
- checkedIcon={(
90
+ checkedIcon={
95
91
  <CheckBoxIcon
96
92
  style={{
97
93
  fontSize: 18,
98
94
  }}
99
95
  className={`${checkedSection}CheckedIcon`}
100
96
  />
101
- )}
97
+ }
102
98
  disableRipple
103
99
  color="secondary"
104
100
  classes={{ root: classes.checkboxRoot }}
105
101
  />
106
- { tooltip ? (
102
+ {tooltip ? (
107
103
  <Tooltip id={datafield} title={tooltip}>
108
- <div className={datafield}>
109
- {name}
110
- </div>
104
+ <div className={datafield}>{name}</div>
111
105
  </Tooltip>
112
106
  ) : (
113
107
  <LabelComponent />
@@ -3,7 +3,7 @@ import { connect } from 'react-redux';
3
3
  import { toggleCheckBox } from '../../../store/actions/Actions';
4
4
  import CheckboxView from './CheckboxView';
5
5
 
6
- const ReduxCheckbox = ((props) => <CheckboxView {...props} />);
6
+ const ReduxCheckbox = (props) => <CheckboxView {...props} />;
7
7
 
8
8
  const mapStateToProps = (state) => ({
9
9
  filterState: state.statusReducer.filterState,
@@ -4,6 +4,7 @@
4
4
  /* eslint-disable object-curly-newline */
5
5
  import React, { useEffect, useState } from 'react';
6
6
  import { withStyles, Slider, Typography, Box } from '@material-ui/core';
7
+ import clsx from 'clsx';
7
8
  import styles from './SliderStyle';
8
9
  import { silderTypes } from '../Types';
9
10
  import InputMinMaxView from './InputMinMaxView';
@@ -53,8 +54,8 @@ const SliderView = ({
53
54
  return (
54
55
  <>
55
56
  <div className={classes.sliderRoot}>
56
- <div className={classes.minMaxInputs}>
57
- <div className={classes.minValue}>
57
+ <div className={clsx(classes.minMaxInputs, 'minMaxInputs')}>
58
+ <div className={clsx(classes.minValue, 'min_input_box')}>
58
59
  <Typography className={classes.minInputLabel}>
59
60
  Min:
60
61
  </Typography>
@@ -67,7 +68,7 @@ const SliderView = ({
67
68
  onInputChange={handleChangeCommittedSlider}
68
69
  />
69
70
  </div>
70
- <div className={classes.maxValue}>
71
+ <div className={clsx(classes.maxValue, 'max_input_box')}>
71
72
  <Typography className={classes.maxInputLabel}>
72
73
  Max:
73
74
  </Typography>
@@ -81,7 +82,7 @@ const SliderView = ({
81
82
  />
82
83
  </div>
83
84
  </div>
84
- <div className={classes.slider}>
85
+ <div className={clsx(classes.slider, 'slider')}>
85
86
  {/* Change to red if invalid range */}
86
87
  <Slider
87
88
  disableSwap
@@ -1,15 +1,11 @@
1
1
  import React from 'react';
2
- import {
3
- AccordionSummary,
4
- withStyles,
5
- } from '@material-ui/core';
6
- import {
7
- ExpandMore as ExpandMoreIcon,
8
- } from '@material-ui/icons';
2
+ import { AccordionSummary, withStyles } from '@material-ui/core';
3
+ import { ExpandMore as ExpandMoreIcon } from '@material-ui/icons';
9
4
  import style from './AccordionSummaryStyle';
10
5
 
11
6
  const Summary = withStyles({
12
7
  root: {
8
+ width: '307px',
13
9
  marginBottom: -1,
14
10
  minHeight: 48,
15
11
  paddingLeft: 14,
@@ -27,10 +23,7 @@ const Summary = withStyles({
27
23
  expanded: {},
28
24
  })(AccordionSummary);
29
25
 
30
- const CustomAccordionSummary = ({
31
- children,
32
- classes,
33
- }) => (
26
+ const CustomAccordionSummary = ({ children, classes }) => (
34
27
  <Summary
35
28
  expandIcon={(
36
29
  <ExpandMoreIcon