@bento-core/facet-filter 1.0.1-icdc.6 → 1.0.1-ins.0
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 +5 -28
- package/dist/FacetFilterView.js +2 -4
- package/dist/components/facet/FacetStyle.js +10 -23
- package/dist/components/facet/FacetView.js +4 -18
- package/dist/components/facet/ReduxFacetView.js +0 -1
- package/dist/components/inputs/slider/SliderView.js +4 -5
- package/dist/components/summary/AccordionSummaryView.js +0 -1
- package/dist/utils/Sort.js +2 -2
- package/package.json +11 -4
- package/src/FacetFilterView.js +25 -19
- package/src/components/facet/FacetStyle.js +7 -17
- package/src/components/facet/FacetView.js +102 -89
- package/src/components/facet/ReduxFacetView.js +4 -13
- package/src/components/inputs/checkbox/CheckboxView.js +17 -11
- package/src/components/inputs/checkbox/ReduxCheckbox.js +1 -1
- package/src/components/inputs/slider/SliderView.js +4 -5
- package/src/components/summary/AccordionSummaryView.js +11 -4
- package/src/utils/Sort.js +2 -2
package/README.md
CHANGED
|
@@ -72,17 +72,12 @@ 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
|
-
|
|
79
75
|
export const facetsConfig = [{
|
|
80
76
|
section: CASES,
|
|
81
77
|
label: 'Program',
|
|
82
78
|
apiForFiltering: 'filterSubjectCountByProgram',
|
|
83
79
|
datafield: 'programs',
|
|
84
|
-
field: GROUP,
|
|
85
|
-
count: COUNT,
|
|
80
|
+
field: GROUP,
|
|
86
81
|
type: InputTypes.CHECKBOX,
|
|
87
82
|
sort_type: sortType.ALPHABET,
|
|
88
83
|
show: true,
|
|
@@ -270,29 +265,11 @@ const CustomClearAllFiltersBtn = ({ onClearAllFilters, disable }) => {
|
|
|
270
265
|
```
|
|
271
266
|
// response
|
|
272
267
|
// 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;
|
|
292
268
|
const {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
269
|
+
name,
|
|
270
|
+
customName,
|
|
271
|
+
subjects,
|
|
272
|
+
customSubjects,
|
|
296
273
|
tooltip,
|
|
297
274
|
} = checkboxItem;
|
|
298
275
|
|
package/dist/FacetFilterView.js
CHANGED
|
@@ -17,8 +17,7 @@ const BentoFacetFilter = _ref => {
|
|
|
17
17
|
let {
|
|
18
18
|
sideBarSections,
|
|
19
19
|
CustomFacetSection,
|
|
20
|
-
CustomFacetView
|
|
21
|
-
enableClearSection
|
|
20
|
+
CustomFacetView
|
|
22
21
|
} = _ref;
|
|
23
22
|
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, {
|
|
24
23
|
variant: "middle",
|
|
@@ -28,8 +27,7 @@ const BentoFacetFilter = _ref => {
|
|
|
28
27
|
CustomSection: CustomFacetSection
|
|
29
28
|
}, section.items.map(facet => /*#__PURE__*/_react.default.createElement(_ReduxFacetView.default, {
|
|
30
29
|
facet: facet,
|
|
31
|
-
CustomView: CustomFacetView
|
|
32
|
-
enableClearSection: enableClearSection
|
|
30
|
+
CustomView: CustomFacetView
|
|
33
31
|
}))))));
|
|
34
32
|
};
|
|
35
33
|
var _default = (0, _core.withStyles)(_FacetFilterStyle.default)(BentoFacetFilter);
|
|
@@ -20,13 +20,6 @@ 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
|
-
},
|
|
30
23
|
subSectionSummaryText: {
|
|
31
24
|
marginLeft: '10px',
|
|
32
25
|
lineHeight: 0,
|
|
@@ -41,26 +34,21 @@ var _default = () => ({
|
|
|
41
34
|
marginBottom: '5px',
|
|
42
35
|
borderTop: '1px solid #B1B1B1',
|
|
43
36
|
textAlign: 'left',
|
|
44
|
-
|
|
45
|
-
display: 'flex',
|
|
46
|
-
alignItems: 'center',
|
|
47
|
-
justifyContent: 'space-around'
|
|
37
|
+
marginLeft: '-5px'
|
|
48
38
|
},
|
|
49
39
|
sortGroupIcon: {
|
|
50
40
|
cursor: 'pointer',
|
|
51
41
|
fontFamily: 'Nunito',
|
|
52
|
-
fontSize: '10px'
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
fontSize: '10px',
|
|
43
|
+
marginRight: '12px',
|
|
44
|
+
marginLeft: '16px'
|
|
55
45
|
},
|
|
56
|
-
|
|
57
46
|
sortGroupItem: {
|
|
58
47
|
cursor: 'pointer',
|
|
59
48
|
fontFamily: 'Nunito',
|
|
60
|
-
fontSize: '10px'
|
|
61
|
-
|
|
49
|
+
fontSize: '10px',
|
|
50
|
+
marginRight: '32px'
|
|
62
51
|
},
|
|
63
|
-
|
|
64
52
|
NonSortGroup: {
|
|
65
53
|
marginBottom: '5px',
|
|
66
54
|
borderTop: '1px solid #B1B1B1',
|
|
@@ -75,12 +63,11 @@ var _default = () => ({
|
|
|
75
63
|
sortGroupItemCounts: {
|
|
76
64
|
cursor: 'pointer',
|
|
77
65
|
fontFamily: 'Nunito',
|
|
78
|
-
fontSize: '10px'
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
fontSize: '10px',
|
|
67
|
+
float: 'right',
|
|
68
|
+
marginRight: '10px',
|
|
69
|
+
marginTop: '5px'
|
|
82
70
|
},
|
|
83
|
-
|
|
84
71
|
highlight: {
|
|
85
72
|
color: '#b2c6d6'
|
|
86
73
|
},
|
|
@@ -7,8 +7,6 @@ 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"));
|
|
12
10
|
var _AccordionSummaryView = _interopRequireDefault(require("../summary/AccordionSummaryView"));
|
|
13
11
|
var _Types = require("../inputs/Types");
|
|
14
12
|
var _FacetStyle = _interopRequireDefault(require("./FacetStyle"));
|
|
@@ -27,7 +25,6 @@ const FacetView = _ref => {
|
|
|
27
25
|
let {
|
|
28
26
|
classes,
|
|
29
27
|
facet,
|
|
30
|
-
enableClearSection,
|
|
31
28
|
onClearFacetSection,
|
|
32
29
|
onClearSliderSection,
|
|
33
30
|
CustomView,
|
|
@@ -38,8 +35,8 @@ const FacetView = _ref => {
|
|
|
38
35
|
const onExpandFacet = () => setExpand(!expand);
|
|
39
36
|
|
|
40
37
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
* expand section incase of active local search
|
|
39
|
+
*/
|
|
43
40
|
(0, _react.useEffect)(() => {
|
|
44
41
|
if (autoComplete && autoComplete.length > 0 || upload && upload.length > 0) {
|
|
45
42
|
setExpand(true);
|
|
@@ -78,25 +75,14 @@ const FacetView = _ref => {
|
|
|
78
75
|
},
|
|
79
76
|
id: facet.section
|
|
80
77
|
}, CustomView ? /*#__PURE__*/_react.default.createElement(CustomView, {
|
|
81
|
-
clearFacetSectionValues: onClearSection,
|
|
82
|
-
hasSelections: selectedItems.length,
|
|
83
78
|
facet: facet,
|
|
84
79
|
facetClasses: isActiveFacet ? "activeFacet".concat(facet.section) : "inactiveFacet".concat(facet.section)
|
|
85
|
-
}) : /*#__PURE__*/_react.default.createElement(_AccordionSummaryView.default, null,
|
|
86
|
-
id: "filterGroup_ ".concat(facet.datafield, "\n ").concat(facet.label),
|
|
87
|
-
className: (0, _clsx.default)(classes.subSectionSummaryText, {
|
|
88
|
-
["activeFacet".concat(facet.section)]: isActiveFacet
|
|
89
|
-
})
|
|
90
|
-
}, facet.label) : /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
-
className: classes.subSectionSummaryTextWrapper
|
|
92
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
+
}) : /*#__PURE__*/_react.default.createElement(_AccordionSummaryView.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
81
|
id: "filterGroup_ ".concat(facet.datafield, "\n ").concat(facet.label),
|
|
94
82
|
className: (0, _clsx.default)(classes.subSectionSummaryText, {
|
|
95
83
|
["activeFacet".concat(facet.section)]: isActiveFacet
|
|
96
84
|
})
|
|
97
|
-
}, facet.label),
|
|
98
|
-
onClick: onClearSection
|
|
99
|
-
}, /*#__PURE__*/_react.default.createElement(_Refresh.default, null)) : null)), (facet.type === _Types.InputTypes.SLIDER || facetValues.length === 0) && /*#__PURE__*/_react.default.createElement("div", {
|
|
85
|
+
}, facet.label)), (facet.type === _Types.InputTypes.SLIDER || facetValues.length === 0) && /*#__PURE__*/_react.default.createElement("div", {
|
|
100
86
|
className: classes.NonSortGroup
|
|
101
87
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
102
88
|
className: classes.NonSortGroupItem
|
|
@@ -6,7 +6,6 @@ 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"));
|
|
10
9
|
var _SliderStyle = _interopRequireDefault(require("./SliderStyle"));
|
|
11
10
|
var _Types = require("../Types");
|
|
12
11
|
var _InputMinMaxView = _interopRequireDefault(require("./InputMinMaxView"));
|
|
@@ -64,9 +63,9 @@ const SliderView = _ref => {
|
|
|
64
63
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
64
|
className: classes.sliderRoot
|
|
66
65
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
-
className:
|
|
66
|
+
className: classes.minMaxInputs
|
|
68
67
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
-
className:
|
|
68
|
+
className: classes.minValue
|
|
70
69
|
}, /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
71
70
|
className: classes.minInputLabel
|
|
72
71
|
}, "Min:"), /*#__PURE__*/_react.default.createElement(_InputMinMaxView.default, {
|
|
@@ -77,7 +76,7 @@ const SliderView = _ref => {
|
|
|
77
76
|
type: _Types.silderTypes.INPUT_MIN,
|
|
78
77
|
onInputChange: handleChangeCommittedSlider
|
|
79
78
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
-
className:
|
|
79
|
+
className: classes.maxValue
|
|
81
80
|
}, /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
82
81
|
className: classes.maxInputLabel
|
|
83
82
|
}, "Max:"), /*#__PURE__*/_react.default.createElement(_InputMinMaxView.default, {
|
|
@@ -88,7 +87,7 @@ const SliderView = _ref => {
|
|
|
88
87
|
type: _Types.silderTypes.INPUT_MAX,
|
|
89
88
|
onInputChange: handleChangeCommittedSlider
|
|
90
89
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
-
className:
|
|
90
|
+
className: classes.slider
|
|
92
91
|
}, /*#__PURE__*/_react.default.createElement(_core.Slider, {
|
|
93
92
|
disableSwap: true,
|
|
94
93
|
getAriaValueText: valuetext,
|
|
@@ -11,7 +11,6 @@ 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',
|
|
15
14
|
marginBottom: -1,
|
|
16
15
|
minHeight: 48,
|
|
17
16
|
paddingLeft: 14,
|
package/dist/utils/Sort.js
CHANGED
|
@@ -74,7 +74,7 @@ const sortBySection = _ref => {
|
|
|
74
74
|
/**
|
|
75
75
|
* Display checked item always on top
|
|
76
76
|
*/
|
|
77
|
-
const sortedValues = sortByCheckedItem([...sortfacetValues]);
|
|
78
|
-
return
|
|
77
|
+
// const sortedValues = sortByCheckedItem([...sortfacetValues]);
|
|
78
|
+
return sortfacetValues;
|
|
79
79
|
};
|
|
80
80
|
exports.sortBySection = sortBySection;
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/facet-filter",
|
|
3
|
-
"version": "1.0.1-
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.0.1-ins.0",
|
|
4
|
+
"description": "### Bento core sidebar design:",
|
|
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":
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/CBIIT/bento-frontend.git"
|
|
14
|
+
},
|
|
12
15
|
"publishConfig": {
|
|
13
16
|
"access": "public"
|
|
14
17
|
},
|
|
@@ -24,5 +27,9 @@
|
|
|
24
27
|
"react-redux": "^7.2.1"
|
|
25
28
|
},
|
|
26
29
|
"author": "CTOS Bento Team",
|
|
27
|
-
"license": "ISC"
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/CBIIT/bento-frontend/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/CBIIT/bento-frontend#readme"
|
|
28
35
|
}
|
package/src/FacetFilterView.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/* eslint-disable arrow-body-style */
|
|
2
2
|
/* eslint-disable padded-blocks */
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Divider,
|
|
6
|
+
withStyles,
|
|
7
|
+
} from '@material-ui/core';
|
|
5
8
|
import styles from './FacetFilterStyle';
|
|
6
9
|
import FacetSectionView from './components/section/FacetSectionView';
|
|
7
10
|
import FacetView from './components/facet/ReduxFacetView';
|
|
@@ -10,27 +13,30 @@ const BentoFacetFilter = ({
|
|
|
10
13
|
sideBarSections,
|
|
11
14
|
CustomFacetSection,
|
|
12
15
|
CustomFacetView,
|
|
13
|
-
enableClearSection,
|
|
14
16
|
}) => {
|
|
15
17
|
return (
|
|
16
18
|
<>
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
}
|
|
34
40
|
</>
|
|
35
41
|
);
|
|
36
42
|
};
|
|
@@ -14,13 +14,6 @@ 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
|
-
},
|
|
24
17
|
subSectionSummaryText: {
|
|
25
18
|
marginLeft: '10px',
|
|
26
19
|
lineHeight: 0,
|
|
@@ -35,23 +28,20 @@ export default () => ({
|
|
|
35
28
|
marginBottom: '5px',
|
|
36
29
|
borderTop: '1px solid #B1B1B1',
|
|
37
30
|
textAlign: 'left',
|
|
38
|
-
|
|
39
|
-
display: 'flex',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
justifyContent: 'space-around',
|
|
31
|
+
marginLeft: '-5px',
|
|
42
32
|
},
|
|
43
33
|
sortGroupIcon: {
|
|
44
34
|
cursor: 'pointer',
|
|
45
35
|
fontFamily: 'Nunito',
|
|
46
36
|
fontSize: '10px',
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
marginRight: '12px',
|
|
38
|
+
marginLeft: '16px',
|
|
49
39
|
},
|
|
50
40
|
sortGroupItem: {
|
|
51
41
|
cursor: 'pointer',
|
|
52
42
|
fontFamily: 'Nunito',
|
|
53
43
|
fontSize: '10px',
|
|
54
|
-
|
|
44
|
+
marginRight: '32px',
|
|
55
45
|
},
|
|
56
46
|
NonSortGroup: {
|
|
57
47
|
marginBottom: '5px',
|
|
@@ -68,9 +58,9 @@ export default () => ({
|
|
|
68
58
|
cursor: 'pointer',
|
|
69
59
|
fontFamily: 'Nunito',
|
|
70
60
|
fontSize: '10px',
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
float: 'right',
|
|
62
|
+
marginRight: '10px',
|
|
63
|
+
marginTop: '5px',
|
|
74
64
|
},
|
|
75
65
|
highlight: {
|
|
76
66
|
color: '#b2c6d6',
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Accordion,
|
|
3
|
+
Accordion,
|
|
4
|
+
List,
|
|
5
|
+
withStyles,
|
|
6
|
+
Icon,
|
|
4
7
|
} from '@material-ui/core';
|
|
5
8
|
import clsx from 'clsx';
|
|
6
|
-
import RefreshIcon from '@material-ui/icons/Refresh';
|
|
7
|
-
import IconButton from '@material-ui/core/IconButton';
|
|
8
9
|
import CustomAccordionSummary from '../summary/AccordionSummaryView';
|
|
9
10
|
import { InputTypes } from '../inputs/Types';
|
|
10
11
|
import styles from './FacetStyle';
|
|
@@ -15,7 +16,6 @@ import clearIcon from './assets/clearIcon.svg';
|
|
|
15
16
|
const FacetView = ({
|
|
16
17
|
classes,
|
|
17
18
|
facet,
|
|
18
|
-
enableClearSection,
|
|
19
19
|
onClearFacetSection,
|
|
20
20
|
onClearSliderSection,
|
|
21
21
|
CustomView,
|
|
@@ -26,13 +26,11 @@ const FacetView = ({
|
|
|
26
26
|
const onExpandFacet = () => setExpand(!expand);
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
* expand section incase of active local search
|
|
30
|
+
*/
|
|
31
31
|
useEffect(() => {
|
|
32
|
-
if (
|
|
33
|
-
(
|
|
34
|
-
|| (upload && upload.length > 0)
|
|
35
|
-
) {
|
|
32
|
+
if ((autoComplete && autoComplete.length > 0)
|
|
33
|
+
|| (upload && upload.length > 0)) {
|
|
36
34
|
setExpand(true);
|
|
37
35
|
}
|
|
38
36
|
}, [autoComplete, upload]);
|
|
@@ -59,7 +57,6 @@ const FacetView = ({
|
|
|
59
57
|
displayFacet.facetValues = selectedItems;
|
|
60
58
|
const isActiveFacet = [...selectedItems].length > 0;
|
|
61
59
|
const limitCheckBoxCount = facet?.showCheckboxCount || 5;
|
|
62
|
-
|
|
63
60
|
return (
|
|
64
61
|
<>
|
|
65
62
|
<Accordion
|
|
@@ -71,103 +68,119 @@ const FacetView = ({
|
|
|
71
68
|
}}
|
|
72
69
|
id={facet.section}
|
|
73
70
|
>
|
|
74
|
-
{CustomView ? (
|
|
71
|
+
{ CustomView ? (
|
|
75
72
|
<CustomView
|
|
76
|
-
clearFacetSectionValues={onClearSection}
|
|
77
|
-
hasSelections={selectedItems.length}
|
|
78
73
|
facet={facet}
|
|
79
74
|
facetClasses={
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
: `inactiveFacet${facet.section}`
|
|
75
|
+
isActiveFacet ? `activeFacet${facet.section}`
|
|
76
|
+
: `inactiveFacet${facet.section}`
|
|
83
77
|
}
|
|
84
78
|
/>
|
|
85
79
|
) : (
|
|
86
80
|
<CustomAccordionSummary>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
${facet.label}`
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<div className={classes.subSectionSummaryTextWrapper}>
|
|
99
|
-
<div
|
|
100
|
-
id={`filterGroup_ ${facet.datafield}
|
|
101
|
-
${facet.label}`}
|
|
102
|
-
className={clsx(classes.subSectionSummaryText, {
|
|
103
|
-
[`activeFacet${facet.section}`]: isActiveFacet,
|
|
104
|
-
})}
|
|
105
|
-
>
|
|
106
|
-
{facet.label}
|
|
107
|
-
</div>
|
|
108
|
-
{selectedItems.length ? (
|
|
109
|
-
<IconButton onClick={onClearSection}>
|
|
110
|
-
<RefreshIcon />
|
|
111
|
-
</IconButton>
|
|
112
|
-
) : null}
|
|
113
|
-
</div>
|
|
114
|
-
)}
|
|
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>
|
|
115
92
|
</CustomAccordionSummary>
|
|
116
93
|
)}
|
|
117
|
-
{
|
|
94
|
+
{
|
|
95
|
+
(facet.type === InputTypes.SLIDER || facetValues.length === 0)
|
|
96
|
+
&& (
|
|
118
97
|
<div className={classes.NonSortGroup}>
|
|
119
|
-
<span
|
|
98
|
+
<span
|
|
99
|
+
className={classes.NonSortGroupItem}
|
|
100
|
+
>
|
|
120
101
|
No data for this field
|
|
121
102
|
</span>
|
|
122
103
|
</div>
|
|
123
|
-
|
|
124
|
-
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
{
|
|
107
|
+
(facet.type === InputTypes.SLIDER || facetValues.length > 0)
|
|
108
|
+
&& (
|
|
125
109
|
<div className={classes.sortGroup}>
|
|
126
110
|
<span className={classes.sortGroupIcon}>
|
|
127
|
-
<Icon
|
|
128
|
-
|
|
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
|
+
/>
|
|
129
121
|
</Icon>
|
|
130
122
|
</span>
|
|
131
|
-
{facet.type === InputTypes.CHECKBOX && facetValues.length > 0
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
+
)}
|
|
155
152
|
</div>
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
{(expand)
|
|
156
|
+
&& (
|
|
157
|
+
<FilterItems
|
|
158
|
+
facet={facet}
|
|
159
|
+
sortBy={sortBy}
|
|
160
|
+
/>
|
|
161
|
+
)}
|
|
158
162
|
</Accordion>
|
|
159
|
-
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
184
|
</>
|
|
172
185
|
);
|
|
173
186
|
};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { connect } from 'react-redux';
|
|
3
|
-
import {
|
|
4
|
-
clearFacetSection,
|
|
5
|
-
clearSliderSection,
|
|
6
|
-
toggleCheckBox,
|
|
7
|
-
} from '../../store/actions/Actions';
|
|
3
|
+
import { clearFacetSection, clearSliderSection } from '../../store/actions/Actions';
|
|
8
4
|
import FacetView from './FacetView';
|
|
9
5
|
|
|
10
|
-
const ReduxFacetView = (props) => <FacetView {...props}
|
|
6
|
+
const ReduxFacetView = ((props) => <FacetView {...props} />);
|
|
11
7
|
|
|
12
8
|
const mapStateToProps = (state) => ({
|
|
13
9
|
filterState: state.statusReducer.filterState,
|
|
@@ -16,13 +12,8 @@ const mapStateToProps = (state) => ({
|
|
|
16
12
|
});
|
|
17
13
|
|
|
18
14
|
const mapDispatchToProps = (dispatch) => ({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
dispatch(clearFacetSection(facet));
|
|
22
|
-
},
|
|
23
|
-
onClearSliderSection: (facet) => {
|
|
24
|
-
dispatch(clearSliderSection(facet));
|
|
25
|
-
},
|
|
15
|
+
onClearFacetSection: (facet) => { dispatch(clearFacetSection(facet)); },
|
|
16
|
+
onClearSliderSection: (facet) => { dispatch(clearSliderSection(facet)); },
|
|
26
17
|
});
|
|
27
18
|
|
|
28
19
|
export default connect(mapStateToProps, mapDispatchToProps)(ReduxFacetView);
|
|
@@ -20,8 +20,7 @@ import {
|
|
|
20
20
|
} from '@material-ui/core';
|
|
21
21
|
import clsx from 'clsx';
|
|
22
22
|
import {
|
|
23
|
-
CheckBox as CheckBoxIcon,
|
|
24
|
-
CheckBoxOutlineBlank as CheckBoxBlankIcon,
|
|
23
|
+
CheckBox as CheckBoxIcon, CheckBoxOutlineBlank as CheckBoxBlankIcon,
|
|
25
24
|
} from '@material-ui/icons';
|
|
26
25
|
import styles from './CheckboxStyle';
|
|
27
26
|
|
|
@@ -32,7 +31,12 @@ const CheckBoxView = ({
|
|
|
32
31
|
onToggle,
|
|
33
32
|
facet,
|
|
34
33
|
}) => {
|
|
35
|
-
const {
|
|
34
|
+
const {
|
|
35
|
+
isChecked = false,
|
|
36
|
+
index,
|
|
37
|
+
section,
|
|
38
|
+
tooltip,
|
|
39
|
+
} = checkboxItem;
|
|
36
40
|
const {
|
|
37
41
|
field = 'group',
|
|
38
42
|
count = 'subjects',
|
|
@@ -61,7 +65,9 @@ const CheckBoxView = ({
|
|
|
61
65
|
[`${checkedSection}NameChecked`]: isChecked,
|
|
62
66
|
})}
|
|
63
67
|
>
|
|
64
|
-
<Typography className={classes.checkboxName}>
|
|
68
|
+
<Typography className={classes.checkboxName}>
|
|
69
|
+
{name}
|
|
70
|
+
</Typography>
|
|
65
71
|
</Box>
|
|
66
72
|
);
|
|
67
73
|
|
|
@@ -73,9 +79,7 @@ const CheckBoxView = ({
|
|
|
73
79
|
alignItems="flex-start"
|
|
74
80
|
onClick={handleToggle}
|
|
75
81
|
classes={{ gutters: classes.listItemGutters }}
|
|
76
|
-
className={clsx({
|
|
77
|
-
[`${checkedSection}Checked${indexType}`]: isChecked,
|
|
78
|
-
})}
|
|
82
|
+
className={clsx({ [`${checkedSection}Checked${indexType}`]: isChecked })}
|
|
79
83
|
>
|
|
80
84
|
<Checkbox
|
|
81
85
|
id={`checkbox_${facet.label}_${name}`}
|
|
@@ -87,21 +91,23 @@ const CheckBoxView = ({
|
|
|
87
91
|
}
|
|
88
92
|
onClick={handleToggle}
|
|
89
93
|
checked={isChecked}
|
|
90
|
-
checkedIcon={
|
|
94
|
+
checkedIcon={(
|
|
91
95
|
<CheckBoxIcon
|
|
92
96
|
style={{
|
|
93
97
|
fontSize: 18,
|
|
94
98
|
}}
|
|
95
99
|
className={`${checkedSection}CheckedIcon`}
|
|
96
100
|
/>
|
|
97
|
-
}
|
|
101
|
+
)}
|
|
98
102
|
disableRipple
|
|
99
103
|
color="secondary"
|
|
100
104
|
classes={{ root: classes.checkboxRoot }}
|
|
101
105
|
/>
|
|
102
|
-
{tooltip ? (
|
|
106
|
+
{ tooltip ? (
|
|
103
107
|
<Tooltip id={datafield} title={tooltip}>
|
|
104
|
-
<div className={datafield}>
|
|
108
|
+
<div className={datafield}>
|
|
109
|
+
{name}
|
|
110
|
+
</div>
|
|
105
111
|
</Tooltip>
|
|
106
112
|
) : (
|
|
107
113
|
<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,7 +4,6 @@
|
|
|
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';
|
|
8
7
|
import styles from './SliderStyle';
|
|
9
8
|
import { silderTypes } from '../Types';
|
|
10
9
|
import InputMinMaxView from './InputMinMaxView';
|
|
@@ -54,8 +53,8 @@ const SliderView = ({
|
|
|
54
53
|
return (
|
|
55
54
|
<>
|
|
56
55
|
<div className={classes.sliderRoot}>
|
|
57
|
-
<div className={
|
|
58
|
-
<div className={
|
|
56
|
+
<div className={classes.minMaxInputs}>
|
|
57
|
+
<div className={classes.minValue}>
|
|
59
58
|
<Typography className={classes.minInputLabel}>
|
|
60
59
|
Min:
|
|
61
60
|
</Typography>
|
|
@@ -68,7 +67,7 @@ const SliderView = ({
|
|
|
68
67
|
onInputChange={handleChangeCommittedSlider}
|
|
69
68
|
/>
|
|
70
69
|
</div>
|
|
71
|
-
<div className={
|
|
70
|
+
<div className={classes.maxValue}>
|
|
72
71
|
<Typography className={classes.maxInputLabel}>
|
|
73
72
|
Max:
|
|
74
73
|
</Typography>
|
|
@@ -82,7 +81,7 @@ const SliderView = ({
|
|
|
82
81
|
/>
|
|
83
82
|
</div>
|
|
84
83
|
</div>
|
|
85
|
-
<div className={
|
|
84
|
+
<div className={classes.slider}>
|
|
86
85
|
{/* Change to red if invalid range */}
|
|
87
86
|
<Slider
|
|
88
87
|
disableSwap
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
AccordionSummary,
|
|
4
|
+
withStyles,
|
|
5
|
+
} from '@material-ui/core';
|
|
6
|
+
import {
|
|
7
|
+
ExpandMore as ExpandMoreIcon,
|
|
8
|
+
} from '@material-ui/icons';
|
|
4
9
|
import style from './AccordionSummaryStyle';
|
|
5
10
|
|
|
6
11
|
const Summary = withStyles({
|
|
7
12
|
root: {
|
|
8
|
-
width: '307px',
|
|
9
13
|
marginBottom: -1,
|
|
10
14
|
minHeight: 48,
|
|
11
15
|
paddingLeft: 14,
|
|
@@ -23,7 +27,10 @@ const Summary = withStyles({
|
|
|
23
27
|
expanded: {},
|
|
24
28
|
})(AccordionSummary);
|
|
25
29
|
|
|
26
|
-
const CustomAccordionSummary = ({
|
|
30
|
+
const CustomAccordionSummary = ({
|
|
31
|
+
children,
|
|
32
|
+
classes,
|
|
33
|
+
}) => (
|
|
27
34
|
<Summary
|
|
28
35
|
expandIcon={(
|
|
29
36
|
<ExpandMoreIcon
|
package/src/utils/Sort.js
CHANGED
|
@@ -72,6 +72,6 @@ export const sortBySection = ({
|
|
|
72
72
|
/**
|
|
73
73
|
* Display checked item always on top
|
|
74
74
|
*/
|
|
75
|
-
const sortedValues = sortByCheckedItem([...sortfacetValues]);
|
|
76
|
-
return
|
|
75
|
+
// const sortedValues = sortByCheckedItem([...sortfacetValues]);
|
|
76
|
+
return sortfacetValues;
|
|
77
77
|
};
|