@bento-core/facet-filter 1.0.1-icdc.10 → 1.0.1-icdc.12
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 +4 -21
- package/dist/components/facet/FacetView.js +10 -58
- package/dist/components/facet/ReduxFacetView.js +0 -2
- package/dist/components/inputs/checkbox/CheckboxView.js +1 -6
- package/dist/components/inputs/slider/SliderView.js +4 -5
- package/dist/components/summary/AccordionSummaryView.js +0 -1
- package/dist/index.js +0 -7
- package/dist/store/reducers/SideBarReducer.js +8 -27
- package/package.json +6 -6
- package/src/FacetFilterView.js +27 -21
- package/src/components/facet/FacetStyle.js +3 -17
- package/src/components/facet/FacetView.js +108 -127
- package/src/components/facet/ReduxFacetView.js +4 -14
- package/src/components/inputs/checkbox/CheckboxView.js +17 -16
- 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/index.js +0 -3
- package/src/store/reducers/SideBarReducer.js +2 -14
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
|
@@ -18,8 +18,7 @@ const BentoFacetFilter = _ref => {
|
|
|
18
18
|
sideBarSections,
|
|
19
19
|
CustomFacetSection,
|
|
20
20
|
CustomFacetView,
|
|
21
|
-
|
|
22
|
-
enableFacetCollapse
|
|
21
|
+
clearIcon
|
|
23
22
|
} = _ref;
|
|
24
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, {
|
|
25
24
|
variant: "middle",
|
|
@@ -30,8 +29,7 @@ const BentoFacetFilter = _ref => {
|
|
|
30
29
|
}, section.items.map(facet => /*#__PURE__*/_react.default.createElement(_ReduxFacetView.default, {
|
|
31
30
|
facet: facet,
|
|
32
31
|
CustomView: CustomFacetView,
|
|
33
|
-
|
|
34
|
-
enableFacetCollapse: enableFacetCollapse
|
|
32
|
+
clearIcon: clearIcon
|
|
35
33
|
}))))));
|
|
36
34
|
};
|
|
37
35
|
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,
|
|
@@ -38,29 +31,22 @@ var _default = () => ({
|
|
|
38
31
|
},
|
|
39
32
|
sortGroup: {
|
|
40
33
|
paddingTop: '10px',
|
|
41
|
-
marginBottom: '5px',
|
|
42
34
|
borderTop: '1px solid #B1B1B1',
|
|
43
|
-
|
|
44
|
-
// marginLeft: '-5px',
|
|
35
|
+
padding: '10px',
|
|
45
36
|
display: 'flex',
|
|
46
37
|
alignItems: 'center',
|
|
47
|
-
justifyContent: 'space-
|
|
38
|
+
justifyContent: 'space-between'
|
|
48
39
|
},
|
|
49
40
|
sortGroupIcon: {
|
|
50
41
|
cursor: 'pointer',
|
|
51
42
|
fontFamily: 'Nunito',
|
|
52
43
|
fontSize: '10px'
|
|
53
|
-
// marginRight: '12px',
|
|
54
|
-
// marginLeft: '16px',
|
|
55
44
|
},
|
|
56
|
-
|
|
57
45
|
sortGroupItem: {
|
|
58
46
|
cursor: 'pointer',
|
|
59
47
|
fontFamily: 'Nunito',
|
|
60
48
|
fontSize: '10px'
|
|
61
|
-
// marginRight: '32px',
|
|
62
49
|
},
|
|
63
|
-
|
|
64
50
|
NonSortGroup: {
|
|
65
51
|
marginBottom: '5px',
|
|
66
52
|
borderTop: '1px solid #B1B1B1',
|
|
@@ -75,12 +61,9 @@ var _default = () => ({
|
|
|
75
61
|
sortGroupItemCounts: {
|
|
76
62
|
cursor: 'pointer',
|
|
77
63
|
fontFamily: 'Nunito',
|
|
78
|
-
fontSize: '10px'
|
|
79
|
-
|
|
80
|
-
// marginRight: '10px',
|
|
81
|
-
// marginTop: '5px',
|
|
64
|
+
fontSize: '10px',
|
|
65
|
+
float: 'right'
|
|
82
66
|
},
|
|
83
|
-
|
|
84
67
|
highlight: {
|
|
85
68
|
color: '#b2c6d6'
|
|
86
69
|
},
|
|
@@ -7,15 +7,12 @@ 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"));
|
|
15
13
|
var _FilterItems = _interopRequireDefault(require("../inputs/FilterItems"));
|
|
16
14
|
var _Sort = require("../../utils/Sort");
|
|
17
15
|
var _clearIcon = _interopRequireDefault(require("./assets/clearIcon.svg"));
|
|
18
|
-
var _ActionTypes = require("../../store/actions/ActionTypes");
|
|
19
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -28,50 +25,19 @@ const FacetView = _ref => {
|
|
|
28
25
|
let {
|
|
29
26
|
classes,
|
|
30
27
|
facet,
|
|
31
|
-
enableClearSection,
|
|
32
28
|
onClearFacetSection,
|
|
33
29
|
onClearSliderSection,
|
|
34
30
|
CustomView,
|
|
35
31
|
autoComplete,
|
|
36
32
|
upload,
|
|
37
|
-
|
|
38
|
-
currentActionType = {},
|
|
39
|
-
enableFacetCollapse
|
|
33
|
+
clearIcon
|
|
40
34
|
} = _ref;
|
|
41
35
|
const [expand, setExpand] = (0, _react.useState)(false);
|
|
42
36
|
const onExpandFacet = () => setExpand(!expand);
|
|
43
|
-
const {
|
|
44
|
-
datafield
|
|
45
|
-
} = facet;
|
|
46
|
-
/**
|
|
47
|
-
* Collapse expanded facet or facets
|
|
48
|
-
* 1. on clear facet section
|
|
49
|
-
* 2. on clear all
|
|
50
|
-
* 3. on uncheck facet from DQB
|
|
51
|
-
*/
|
|
52
|
-
(0, _react.useEffect)(() => {
|
|
53
|
-
if (enableFacetCollapse) {
|
|
54
|
-
const actionType = currentActionType[datafield];
|
|
55
|
-
// collapse facet if uncheck from DQB
|
|
56
|
-
if (actionType && actionType === _ActionTypes.sideBarActionTypes.FACET_VALUE_CHANGED) {
|
|
57
|
-
const {
|
|
58
|
-
isFacetOrigin
|
|
59
|
-
} = currentActionType;
|
|
60
|
-
if (!isFacetOrigin) {
|
|
61
|
-
if (Object.keys(filterState[datafield] || {}).length === 0) {
|
|
62
|
-
setExpand(false);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (actionType && actionType === _ActionTypes.sideBarActionTypes.CLEAR_FACET_SECTION || currentActionType === _ActionTypes.sideBarActionTypes.CLEAR_ALL_FILTERS) {
|
|
67
|
-
setExpand(false);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, [filterState]);
|
|
71
37
|
|
|
72
38
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
39
|
+
* expand section incase of active local search
|
|
40
|
+
*/
|
|
75
41
|
(0, _react.useEffect)(() => {
|
|
76
42
|
if (autoComplete && autoComplete.length > 0 || upload && upload.length > 0) {
|
|
77
43
|
setExpand(true);
|
|
@@ -83,13 +49,10 @@ const FacetView = _ref => {
|
|
|
83
49
|
};
|
|
84
50
|
const onClearSection = () => {
|
|
85
51
|
setSortBy(null);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} else {
|
|
91
|
-
onClearFacetSection(facet);
|
|
92
|
-
}
|
|
52
|
+
if (facet.type === _Types.InputTypes.SLIDER) {
|
|
53
|
+
onClearSliderSection(facet);
|
|
54
|
+
} else {
|
|
55
|
+
onClearFacetSection(facet);
|
|
93
56
|
}
|
|
94
57
|
};
|
|
95
58
|
/**
|
|
@@ -113,25 +76,14 @@ const FacetView = _ref => {
|
|
|
113
76
|
},
|
|
114
77
|
id: facet.section
|
|
115
78
|
}, CustomView ? /*#__PURE__*/_react.default.createElement(CustomView, {
|
|
116
|
-
clearFacetSectionValues: onClearSection,
|
|
117
|
-
hasSelections: selectedItems.length,
|
|
118
79
|
facet: facet,
|
|
119
80
|
facetClasses: isActiveFacet ? "activeFacet".concat(facet.section) : "inactiveFacet".concat(facet.section)
|
|
120
|
-
}) : /*#__PURE__*/_react.default.createElement(_AccordionSummaryView.default, null,
|
|
121
|
-
id: "filterGroup_ ".concat(facet.datafield, "\n ").concat(facet.label),
|
|
122
|
-
className: (0, _clsx.default)(classes.subSectionSummaryText, {
|
|
123
|
-
["activeFacet".concat(facet.section)]: isActiveFacet
|
|
124
|
-
})
|
|
125
|
-
}, facet.label) : /*#__PURE__*/_react.default.createElement("div", {
|
|
126
|
-
className: classes.subSectionSummaryTextWrapper
|
|
127
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
+
}) : /*#__PURE__*/_react.default.createElement(_AccordionSummaryView.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
128
82
|
id: "filterGroup_ ".concat(facet.datafield, "\n ").concat(facet.label),
|
|
129
83
|
className: (0, _clsx.default)(classes.subSectionSummaryText, {
|
|
130
84
|
["activeFacet".concat(facet.section)]: isActiveFacet
|
|
131
85
|
})
|
|
132
|
-
}, facet.label),
|
|
133
|
-
onClick: onClearSection
|
|
134
|
-
}, /*#__PURE__*/_react.default.createElement(_Refresh.default, null)) : null)), (facet.type === _Types.InputTypes.SLIDER || facetValues.length === 0) && /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
}, facet.label)), (facet.type === _Types.InputTypes.SLIDER || facetValues.length === 0) && /*#__PURE__*/_react.default.createElement("div", {
|
|
135
87
|
className: classes.NonSortGroup
|
|
136
88
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
137
89
|
className: classes.NonSortGroupItem
|
|
@@ -145,7 +97,7 @@ const FacetView = _ref => {
|
|
|
145
97
|
},
|
|
146
98
|
onClick: onClearSection
|
|
147
99
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
148
|
-
src: _clearIcon.default,
|
|
100
|
+
src: clearIcon || _clearIcon.default,
|
|
149
101
|
height: 12,
|
|
150
102
|
width: 12,
|
|
151
103
|
alt: "clear-icon"
|
|
@@ -14,13 +14,11 @@ const mapStateToProps = state => {
|
|
|
14
14
|
var _state$localFind, _state$localFind2;
|
|
15
15
|
return {
|
|
16
16
|
filterState: state.statusReducer.filterState,
|
|
17
|
-
currentActionType: state.statusReducer.currentActionType,
|
|
18
17
|
autoComplete: (state === null || state === void 0 ? void 0 : (_state$localFind = state.localFind) === null || _state$localFind === void 0 ? void 0 : _state$localFind.autocomplete) || [],
|
|
19
18
|
upload: (state === null || state === void 0 ? void 0 : (_state$localFind2 = state.localFind) === null || _state$localFind2 === void 0 ? void 0 : _state$localFind2.upload) || []
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
const mapDispatchToProps = dispatch => ({
|
|
23
|
-
onToggle: facet => dispatch((0, _Actions.toggleCheckBox)(facet)),
|
|
24
22
|
onClearFacetSection: facet => {
|
|
25
23
|
dispatch((0, _Actions.clearFacetSection)(facet));
|
|
26
24
|
},
|
|
@@ -10,7 +10,6 @@ var _core = require("@material-ui/core");
|
|
|
10
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
11
|
var _icons = require("@material-ui/icons");
|
|
12
12
|
var _CheckboxStyle = _interopRequireDefault(require("./CheckboxStyle"));
|
|
13
|
-
var _ActionTypes = require("../../../store/actions/ActionTypes");
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
14
|
/* eslint-disable no-unused-vars */
|
|
16
15
|
/* eslint-disable no-unused-vars */
|
|
@@ -47,11 +46,7 @@ const CheckBoxView = _ref => {
|
|
|
47
46
|
const toggleCheckBoxItem = {
|
|
48
47
|
name: name,
|
|
49
48
|
datafield: datafield,
|
|
50
|
-
isChecked: !isChecked
|
|
51
|
-
actionType: {
|
|
52
|
-
[datafield]: _ActionTypes.sideBarActionTypes.FACET_VALUE_CHANGED,
|
|
53
|
-
isFacetOrigin: true
|
|
54
|
-
}
|
|
49
|
+
isChecked: !isChecked
|
|
55
50
|
};
|
|
56
51
|
onToggle(toggleCheckBoxItem);
|
|
57
52
|
};
|
|
@@ -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/index.js
CHANGED
|
@@ -81,12 +81,6 @@ Object.defineProperty(exports, "onToggleStateUpdate", {
|
|
|
81
81
|
return _SideBarReducer.onToggleStateUpdate;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
Object.defineProperty(exports, "sideBarActionTypes", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function get() {
|
|
87
|
-
return _ActionTypes.sideBarActionTypes;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
84
|
Object.defineProperty(exports, "sideBarReducerGenerator", {
|
|
91
85
|
enumerable: true,
|
|
92
86
|
get: function get() {
|
|
@@ -135,7 +129,6 @@ var _filter = require("./utils/filter");
|
|
|
135
129
|
var _Types = require("./components/inputs/Types");
|
|
136
130
|
var _SideBarReducer = require("./store/reducers/SideBarReducer");
|
|
137
131
|
var _Actions = require("./store/actions/Actions");
|
|
138
|
-
var _ActionTypes = require("./store/actions/ActionTypes");
|
|
139
132
|
var _component = require("./generator/component");
|
|
140
133
|
var _ReduxClearAllBtn = _interopRequireDefault(require("./components/reset/ReduxClearAllBtn"));
|
|
141
134
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -44,10 +44,7 @@ const onClearFacetSection = _ref2 => {
|
|
|
44
44
|
if (updatedState[datafield]) {
|
|
45
45
|
updatedState[datafield] = {};
|
|
46
46
|
}
|
|
47
|
-
return
|
|
48
|
-
updatedState,
|
|
49
|
-
datafield
|
|
50
|
-
};
|
|
47
|
+
return updatedState;
|
|
51
48
|
};
|
|
52
49
|
exports.onClearFacetSection = onClearFacetSection;
|
|
53
50
|
const onClearSliderSection = _ref3 => {
|
|
@@ -90,47 +87,31 @@ function sideBarReducerGenerator() {
|
|
|
90
87
|
switch (type) {
|
|
91
88
|
case _ActionTypes.sideBarActionTypes.FACET_VALUE_CHANGED:
|
|
92
89
|
updateState = onToggleStateUpdate(_objectSpread(_objectSpread({}, state), payload));
|
|
93
|
-
const {
|
|
94
|
-
actionType = _ActionTypes.sideBarActionTypes.FACET_VALUE_CHANGED
|
|
95
|
-
} = payload;
|
|
96
90
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
97
|
-
filterState: _objectSpread({}, updateState)
|
|
98
|
-
currentActionType: actionType
|
|
91
|
+
filterState: _objectSpread({}, updateState)
|
|
99
92
|
});
|
|
100
93
|
case _ActionTypes.sideBarActionTypes.ON_TOGGLE_SLIDER:
|
|
101
94
|
updateState = updateSiderValue(_objectSpread(_objectSpread({}, state), payload));
|
|
102
95
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
103
|
-
filterState: _objectSpread({}, updateState)
|
|
104
|
-
currentActionType: _ActionTypes.sideBarActionTypes.ON_TOGGLE_SLIDER
|
|
96
|
+
filterState: _objectSpread({}, updateState)
|
|
105
97
|
});
|
|
106
98
|
case _ActionTypes.sideBarActionTypes.CLEAR_ALL_FILTERS:
|
|
107
99
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
108
|
-
filterState: {}
|
|
109
|
-
currentActionType: _ActionTypes.sideBarActionTypes.CLEAR_ALL_FILTERS
|
|
100
|
+
filterState: {}
|
|
110
101
|
});
|
|
111
102
|
case _ActionTypes.sideBarActionTypes.CLEAR_FACET_SECTION:
|
|
112
|
-
|
|
113
|
-
updatedState: updtState,
|
|
114
|
-
datafield
|
|
115
|
-
} = onClearFacetSection(_objectSpread(_objectSpread({}, payload), state));
|
|
116
|
-
updateState = updtState;
|
|
117
|
-
const currentActionType = {
|
|
118
|
-
[datafield]: _ActionTypes.sideBarActionTypes.CLEAR_FACET_SECTION
|
|
119
|
-
};
|
|
103
|
+
updateState = onClearFacetSection(_objectSpread(_objectSpread({}, payload), state));
|
|
120
104
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
121
|
-
filterState: _objectSpread({}, updateState)
|
|
122
|
-
currentActionType
|
|
105
|
+
filterState: _objectSpread({}, updateState)
|
|
123
106
|
});
|
|
124
107
|
case _ActionTypes.sideBarActionTypes.CLEAR_SLIDER_SECTION:
|
|
125
108
|
updateState = onClearSliderSection(_objectSpread(_objectSpread({}, payload), state));
|
|
126
109
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
127
|
-
filterState: _objectSpread({}, updateState)
|
|
128
|
-
currentActionType: _ActionTypes.sideBarActionTypes.CLEAR_SLIDER_SECTION
|
|
110
|
+
filterState: _objectSpread({}, updateState)
|
|
129
111
|
});
|
|
130
112
|
case _ActionTypes.sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE:
|
|
131
113
|
return {
|
|
132
|
-
filterState: payload
|
|
133
|
-
currentActionType: _ActionTypes.sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE
|
|
114
|
+
filterState: payload
|
|
134
115
|
};
|
|
135
116
|
default:
|
|
136
117
|
return state;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/facet-filter",
|
|
3
|
-
"version": "1.0.1-icdc.
|
|
3
|
+
"version": "1.0.1-icdc.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"lodash": "^4.17.20"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@material-ui/core": "
|
|
20
|
-
"@material-ui/icons": "
|
|
19
|
+
"@material-ui/core": ">= 4.12.4",
|
|
20
|
+
"@material-ui/icons": ">= 4.9.1",
|
|
21
21
|
"clsx": "^1.2.1",
|
|
22
|
-
"react": "
|
|
23
|
-
"react-dom": "
|
|
24
|
-
"react-redux": "
|
|
22
|
+
"react": ">= 17.0.2",
|
|
23
|
+
"react-dom": ">= 17.0.0",
|
|
24
|
+
"react-redux": ">= 7.2.1"
|
|
25
25
|
},
|
|
26
26
|
"author": "CTOS Bento Team",
|
|
27
27
|
"license": "ISC"
|
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,29 +13,32 @@ const BentoFacetFilter = ({
|
|
|
10
13
|
sideBarSections,
|
|
11
14
|
CustomFacetSection,
|
|
12
15
|
CustomFacetView,
|
|
13
|
-
|
|
14
|
-
enableFacetCollapse,
|
|
16
|
+
clearIcon,
|
|
15
17
|
}) => {
|
|
16
18
|
return (
|
|
17
19
|
<>
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
{
|
|
21
|
+
sideBarSections.map((section, index) => (
|
|
22
|
+
<>
|
|
23
|
+
<Divider
|
|
24
|
+
variant="middle"
|
|
25
|
+
className={`divider${index}`}
|
|
26
|
+
/>
|
|
27
|
+
<FacetSectionView
|
|
28
|
+
section={section}
|
|
29
|
+
CustomSection={CustomFacetSection}
|
|
30
|
+
>
|
|
31
|
+
{section.items.map((facet) => (
|
|
32
|
+
<FacetView
|
|
33
|
+
facet={facet}
|
|
34
|
+
CustomView={CustomFacetView}
|
|
35
|
+
clearIcon={clearIcon}
|
|
36
|
+
/>
|
|
37
|
+
))}
|
|
38
|
+
</FacetSectionView>
|
|
39
|
+
</>
|
|
40
|
+
))
|
|
41
|
+
}
|
|
36
42
|
</>
|
|
37
43
|
);
|
|
38
44
|
};
|
|
@@ -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,
|
|
@@ -32,26 +25,21 @@ export default () => ({
|
|
|
32
25
|
},
|
|
33
26
|
sortGroup: {
|
|
34
27
|
paddingTop: '10px',
|
|
35
|
-
marginBottom: '5px',
|
|
36
28
|
borderTop: '1px solid #B1B1B1',
|
|
37
|
-
|
|
38
|
-
// marginLeft: '-5px',
|
|
29
|
+
padding: '10px',
|
|
39
30
|
display: 'flex',
|
|
40
31
|
alignItems: 'center',
|
|
41
|
-
justifyContent: 'space-
|
|
32
|
+
justifyContent: 'space-between',
|
|
42
33
|
},
|
|
43
34
|
sortGroupIcon: {
|
|
44
35
|
cursor: 'pointer',
|
|
45
36
|
fontFamily: 'Nunito',
|
|
46
37
|
fontSize: '10px',
|
|
47
|
-
// marginRight: '12px',
|
|
48
|
-
// marginLeft: '16px',
|
|
49
38
|
},
|
|
50
39
|
sortGroupItem: {
|
|
51
40
|
cursor: 'pointer',
|
|
52
41
|
fontFamily: 'Nunito',
|
|
53
42
|
fontSize: '10px',
|
|
54
|
-
// marginRight: '32px',
|
|
55
43
|
},
|
|
56
44
|
NonSortGroup: {
|
|
57
45
|
marginBottom: '5px',
|
|
@@ -68,9 +56,7 @@ export default () => ({
|
|
|
68
56
|
cursor: 'pointer',
|
|
69
57
|
fontFamily: 'Nunito',
|
|
70
58
|
fontSize: '10px',
|
|
71
|
-
|
|
72
|
-
// marginRight: '10px',
|
|
73
|
-
// marginTop: '5px',
|
|
59
|
+
float: 'right',
|
|
74
60
|
},
|
|
75
61
|
highlight: {
|
|
76
62
|
color: '#b2c6d6',
|
|
@@ -1,68 +1,37 @@
|
|
|
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';
|
|
11
12
|
import FilterItems from '../inputs/FilterItems';
|
|
12
13
|
import { sortType } from '../../utils/Sort';
|
|
13
|
-
import
|
|
14
|
-
import { sideBarActionTypes } from '../../store/actions/ActionTypes';
|
|
14
|
+
import clearIconLocal from './assets/clearIcon.svg';
|
|
15
15
|
|
|
16
16
|
const FacetView = ({
|
|
17
17
|
classes,
|
|
18
18
|
facet,
|
|
19
|
-
enableClearSection,
|
|
20
19
|
onClearFacetSection,
|
|
21
20
|
onClearSliderSection,
|
|
22
21
|
CustomView,
|
|
23
22
|
autoComplete,
|
|
24
23
|
upload,
|
|
25
|
-
|
|
26
|
-
currentActionType = {},
|
|
27
|
-
enableFacetCollapse,
|
|
24
|
+
clearIcon,
|
|
28
25
|
}) => {
|
|
29
26
|
const [expand, setExpand] = useState(false);
|
|
30
27
|
const onExpandFacet = () => setExpand(!expand);
|
|
31
28
|
|
|
32
|
-
const { datafield } = facet;
|
|
33
29
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* 2. on clear all
|
|
37
|
-
* 3. on uncheck facet from DQB
|
|
38
|
-
*/
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (enableFacetCollapse) {
|
|
41
|
-
const actionType = currentActionType[datafield];
|
|
42
|
-
// collapse facet if uncheck from DQB
|
|
43
|
-
if (actionType && actionType === sideBarActionTypes.FACET_VALUE_CHANGED) {
|
|
44
|
-
const { isFacetOrigin } = currentActionType;
|
|
45
|
-
if (!isFacetOrigin) {
|
|
46
|
-
if (Object.keys(filterState[datafield] || {}).length === 0) {
|
|
47
|
-
setExpand(false);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if ((actionType && actionType === sideBarActionTypes.CLEAR_FACET_SECTION)
|
|
52
|
-
|| currentActionType === sideBarActionTypes.CLEAR_ALL_FILTERS) {
|
|
53
|
-
setExpand(false);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, [filterState]);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* expand section incase of active local search
|
|
60
|
-
*/
|
|
30
|
+
* expand section incase of active local search
|
|
31
|
+
*/
|
|
61
32
|
useEffect(() => {
|
|
62
|
-
if (
|
|
63
|
-
(
|
|
64
|
-
|| (upload && upload.length > 0)
|
|
65
|
-
) {
|
|
33
|
+
if ((autoComplete && autoComplete.length > 0)
|
|
34
|
+
|| (upload && upload.length > 0)) {
|
|
66
35
|
setExpand(true);
|
|
67
36
|
}
|
|
68
37
|
}, [autoComplete, upload]);
|
|
@@ -74,13 +43,10 @@ const FacetView = ({
|
|
|
74
43
|
|
|
75
44
|
const onClearSection = () => {
|
|
76
45
|
setSortBy(null);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
onClearFacetSection(facet);
|
|
83
|
-
}
|
|
46
|
+
if (facet.type === InputTypes.SLIDER) {
|
|
47
|
+
onClearSliderSection(facet);
|
|
48
|
+
} else {
|
|
49
|
+
onClearFacetSection(facet);
|
|
84
50
|
}
|
|
85
51
|
};
|
|
86
52
|
/**
|
|
@@ -92,7 +58,6 @@ const FacetView = ({
|
|
|
92
58
|
displayFacet.facetValues = selectedItems;
|
|
93
59
|
const isActiveFacet = [...selectedItems].length > 0;
|
|
94
60
|
const limitCheckBoxCount = facet?.showCheckboxCount || 5;
|
|
95
|
-
|
|
96
61
|
return (
|
|
97
62
|
<>
|
|
98
63
|
<Accordion
|
|
@@ -104,103 +69,119 @@ const FacetView = ({
|
|
|
104
69
|
}}
|
|
105
70
|
id={facet.section}
|
|
106
71
|
>
|
|
107
|
-
{CustomView ? (
|
|
72
|
+
{ CustomView ? (
|
|
108
73
|
<CustomView
|
|
109
|
-
clearFacetSectionValues={onClearSection}
|
|
110
|
-
hasSelections={selectedItems.length}
|
|
111
74
|
facet={facet}
|
|
112
75
|
facetClasses={
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
: `inactiveFacet${facet.section}`
|
|
76
|
+
isActiveFacet ? `activeFacet${facet.section}`
|
|
77
|
+
: `inactiveFacet${facet.section}`
|
|
116
78
|
}
|
|
117
79
|
/>
|
|
118
80
|
) : (
|
|
119
81
|
<CustomAccordionSummary>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
${facet.label}`
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<div className={classes.subSectionSummaryTextWrapper}>
|
|
132
|
-
<div
|
|
133
|
-
id={`filterGroup_ ${facet.datafield}
|
|
134
|
-
${facet.label}`}
|
|
135
|
-
className={clsx(classes.subSectionSummaryText, {
|
|
136
|
-
[`activeFacet${facet.section}`]: isActiveFacet,
|
|
137
|
-
})}
|
|
138
|
-
>
|
|
139
|
-
{facet.label}
|
|
140
|
-
</div>
|
|
141
|
-
{selectedItems.length ? (
|
|
142
|
-
<IconButton onClick={onClearSection}>
|
|
143
|
-
<RefreshIcon />
|
|
144
|
-
</IconButton>
|
|
145
|
-
) : null}
|
|
146
|
-
</div>
|
|
147
|
-
)}
|
|
82
|
+
<div
|
|
83
|
+
id={
|
|
84
|
+
`filterGroup_ ${facet.datafield}
|
|
85
|
+
${facet.label}`
|
|
86
|
+
}
|
|
87
|
+
className={clsx(classes.subSectionSummaryText, {
|
|
88
|
+
[`activeFacet${facet.section}`]: isActiveFacet,
|
|
89
|
+
})}
|
|
90
|
+
>
|
|
91
|
+
{facet.label}
|
|
92
|
+
</div>
|
|
148
93
|
</CustomAccordionSummary>
|
|
149
94
|
)}
|
|
150
|
-
{
|
|
95
|
+
{
|
|
96
|
+
(facet.type === InputTypes.SLIDER || facetValues.length === 0)
|
|
97
|
+
&& (
|
|
151
98
|
<div className={classes.NonSortGroup}>
|
|
152
|
-
<span
|
|
99
|
+
<span
|
|
100
|
+
className={classes.NonSortGroupItem}
|
|
101
|
+
>
|
|
153
102
|
No data for this field
|
|
154
103
|
</span>
|
|
155
104
|
</div>
|
|
156
|
-
|
|
157
|
-
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
{
|
|
108
|
+
(facet.type === InputTypes.SLIDER || facetValues.length > 0)
|
|
109
|
+
&& (
|
|
158
110
|
<div className={classes.sortGroup}>
|
|
159
111
|
<span className={classes.sortGroupIcon}>
|
|
160
|
-
<Icon
|
|
161
|
-
|
|
112
|
+
<Icon
|
|
113
|
+
style={{ fontSize: 10 }}
|
|
114
|
+
onClick={onClearSection}
|
|
115
|
+
>
|
|
116
|
+
<img
|
|
117
|
+
src={clearIcon || clearIconLocal}
|
|
118
|
+
height={12}
|
|
119
|
+
width={12}
|
|
120
|
+
alt="clear-icon"
|
|
121
|
+
/>
|
|
162
122
|
</Icon>
|
|
163
123
|
</span>
|
|
164
|
-
{facet.type === InputTypes.CHECKBOX && facetValues.length > 0
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
124
|
+
{ (facet.type === InputTypes.CHECKBOX && facetValues.length > 0)
|
|
125
|
+
&& (
|
|
126
|
+
<>
|
|
127
|
+
<span
|
|
128
|
+
className={
|
|
129
|
+
clsx(classes.sortGroupItem, {
|
|
130
|
+
[classes.highlight]: sortBy === sortType.ALPHABET,
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
onClick={() => {
|
|
134
|
+
onSortFacet(sortType.ALPHABET);
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
Sort alphabetically
|
|
138
|
+
</span>
|
|
139
|
+
<span
|
|
140
|
+
className={
|
|
141
|
+
clsx(classes.sortGroupItemCounts, {
|
|
142
|
+
[classes.highlight]: sortBy === sortType.NUMERIC,
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
onClick={() => {
|
|
146
|
+
onSortFacet(sortType.NUMERIC);
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
Sort by count
|
|
150
|
+
</span>
|
|
151
|
+
</>
|
|
152
|
+
)}
|
|
188
153
|
</div>
|
|
189
|
-
|
|
190
|
-
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
{(expand)
|
|
157
|
+
&& (
|
|
158
|
+
<FilterItems
|
|
159
|
+
facet={facet}
|
|
160
|
+
sortBy={sortBy}
|
|
161
|
+
/>
|
|
162
|
+
)}
|
|
191
163
|
</Accordion>
|
|
192
|
-
{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
<
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
164
|
+
{
|
|
165
|
+
(!expand && type === InputTypes.CHECKBOX && selectedItems.length > 0) && (
|
|
166
|
+
<>
|
|
167
|
+
<List id="filter_Items">
|
|
168
|
+
<FilterItems
|
|
169
|
+
facet={displayFacet}
|
|
170
|
+
/>
|
|
171
|
+
</List>
|
|
172
|
+
</>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
{
|
|
176
|
+
(!expand && selectedItems.length > limitCheckBoxCount) && (
|
|
177
|
+
<div
|
|
178
|
+
className={classes.showMore}
|
|
179
|
+
onClick={onExpandFacet}
|
|
180
|
+
>
|
|
181
|
+
...expand to see all selections
|
|
182
|
+
</div>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
204
185
|
</>
|
|
205
186
|
);
|
|
206
187
|
};
|
|
@@ -1,29 +1,19 @@
|
|
|
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,
|
|
14
|
-
currentActionType: state.statusReducer.currentActionType,
|
|
15
10
|
autoComplete: state?.localFind?.autocomplete || [],
|
|
16
11
|
upload: state?.localFind?.upload || [],
|
|
17
12
|
});
|
|
18
13
|
|
|
19
14
|
const mapDispatchToProps = (dispatch) => ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
dispatch(clearFacetSection(facet));
|
|
23
|
-
},
|
|
24
|
-
onClearSliderSection: (facet) => {
|
|
25
|
-
dispatch(clearSliderSection(facet));
|
|
26
|
-
},
|
|
15
|
+
onClearFacetSection: (facet) => { dispatch(clearFacetSection(facet)); },
|
|
16
|
+
onClearSliderSection: (facet) => { dispatch(clearSliderSection(facet)); },
|
|
27
17
|
});
|
|
28
18
|
|
|
29
19
|
export default connect(mapStateToProps, mapDispatchToProps)(ReduxFacetView);
|
|
@@ -20,11 +20,9 @@ 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
|
-
import { sideBarActionTypes } from '../../../store/actions/ActionTypes';
|
|
28
26
|
|
|
29
27
|
const CheckBoxView = ({
|
|
30
28
|
classes,
|
|
@@ -33,7 +31,12 @@ const CheckBoxView = ({
|
|
|
33
31
|
onToggle,
|
|
34
32
|
facet,
|
|
35
33
|
}) => {
|
|
36
|
-
const {
|
|
34
|
+
const {
|
|
35
|
+
isChecked = false,
|
|
36
|
+
index,
|
|
37
|
+
section,
|
|
38
|
+
tooltip,
|
|
39
|
+
} = checkboxItem;
|
|
37
40
|
const {
|
|
38
41
|
field = 'group',
|
|
39
42
|
count = 'subjects',
|
|
@@ -50,10 +53,6 @@ const CheckBoxView = ({
|
|
|
50
53
|
name: name,
|
|
51
54
|
datafield: datafield,
|
|
52
55
|
isChecked: !isChecked,
|
|
53
|
-
actionType: {
|
|
54
|
-
[datafield]: sideBarActionTypes.FACET_VALUE_CHANGED,
|
|
55
|
-
isFacetOrigin: true,
|
|
56
|
-
},
|
|
57
56
|
};
|
|
58
57
|
onToggle(toggleCheckBoxItem);
|
|
59
58
|
};
|
|
@@ -66,7 +65,9 @@ const CheckBoxView = ({
|
|
|
66
65
|
[`${checkedSection}NameChecked`]: isChecked,
|
|
67
66
|
})}
|
|
68
67
|
>
|
|
69
|
-
<Typography className={classes.checkboxName}>
|
|
68
|
+
<Typography className={classes.checkboxName}>
|
|
69
|
+
{name}
|
|
70
|
+
</Typography>
|
|
70
71
|
</Box>
|
|
71
72
|
);
|
|
72
73
|
|
|
@@ -78,9 +79,7 @@ const CheckBoxView = ({
|
|
|
78
79
|
alignItems="flex-start"
|
|
79
80
|
onClick={handleToggle}
|
|
80
81
|
classes={{ gutters: classes.listItemGutters }}
|
|
81
|
-
className={clsx({
|
|
82
|
-
[`${checkedSection}Checked${indexType}`]: isChecked,
|
|
83
|
-
})}
|
|
82
|
+
className={clsx({ [`${checkedSection}Checked${indexType}`]: isChecked })}
|
|
84
83
|
>
|
|
85
84
|
<Checkbox
|
|
86
85
|
id={`checkbox_${facet.label}_${name}`}
|
|
@@ -92,21 +91,23 @@ const CheckBoxView = ({
|
|
|
92
91
|
}
|
|
93
92
|
onClick={handleToggle}
|
|
94
93
|
checked={isChecked}
|
|
95
|
-
checkedIcon={
|
|
94
|
+
checkedIcon={(
|
|
96
95
|
<CheckBoxIcon
|
|
97
96
|
style={{
|
|
98
97
|
fontSize: 18,
|
|
99
98
|
}}
|
|
100
99
|
className={`${checkedSection}CheckedIcon`}
|
|
101
100
|
/>
|
|
102
|
-
}
|
|
101
|
+
)}
|
|
103
102
|
disableRipple
|
|
104
103
|
color="secondary"
|
|
105
104
|
classes={{ root: classes.checkboxRoot }}
|
|
106
105
|
/>
|
|
107
|
-
{tooltip ? (
|
|
106
|
+
{ tooltip ? (
|
|
108
107
|
<Tooltip id={datafield} title={tooltip}>
|
|
109
|
-
<div className={datafield}>
|
|
108
|
+
<div className={datafield}>
|
|
109
|
+
{name}
|
|
110
|
+
</div>
|
|
110
111
|
</Tooltip>
|
|
111
112
|
) : (
|
|
112
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/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export const onClearFacetSection = ({
|
|
|
30
30
|
if (updatedState[datafield]) {
|
|
31
31
|
updatedState[datafield] = {};
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return updatedState;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const onClearSliderSection = ({
|
|
@@ -64,48 +64,36 @@ export function sideBarReducerGenerator() {
|
|
|
64
64
|
switch (type) {
|
|
65
65
|
case sideBarActionTypes.FACET_VALUE_CHANGED:
|
|
66
66
|
updateState = onToggleStateUpdate({ ...state, ...payload });
|
|
67
|
-
const { actionType = sideBarActionTypes.FACET_VALUE_CHANGED } = payload;
|
|
68
67
|
return {
|
|
69
68
|
...state,
|
|
70
69
|
filterState: { ...updateState },
|
|
71
|
-
currentActionType: actionType,
|
|
72
70
|
};
|
|
73
71
|
case sideBarActionTypes.ON_TOGGLE_SLIDER:
|
|
74
72
|
updateState = updateSiderValue({ ...state, ...payload });
|
|
75
73
|
return {
|
|
76
74
|
...state,
|
|
77
75
|
filterState: { ...updateState },
|
|
78
|
-
currentActionType: sideBarActionTypes.ON_TOGGLE_SLIDER,
|
|
79
76
|
};
|
|
80
77
|
case sideBarActionTypes.CLEAR_ALL_FILTERS:
|
|
81
78
|
return {
|
|
82
79
|
...state,
|
|
83
80
|
filterState: {},
|
|
84
|
-
currentActionType: sideBarActionTypes.CLEAR_ALL_FILTERS,
|
|
85
81
|
};
|
|
86
82
|
case sideBarActionTypes.CLEAR_FACET_SECTION:
|
|
87
|
-
|
|
88
|
-
updatedState: updtState,
|
|
89
|
-
datafield,
|
|
90
|
-
} = onClearFacetSection({ ...payload, ...state });
|
|
91
|
-
updateState = updtState;
|
|
92
|
-
const currentActionType = { [datafield]: sideBarActionTypes.CLEAR_FACET_SECTION };
|
|
83
|
+
updateState = onClearFacetSection({ ...payload, ...state });
|
|
93
84
|
return {
|
|
94
85
|
...state,
|
|
95
86
|
filterState: { ...updateState },
|
|
96
|
-
currentActionType,
|
|
97
87
|
};
|
|
98
88
|
case sideBarActionTypes.CLEAR_SLIDER_SECTION:
|
|
99
89
|
updateState = onClearSliderSection({ ...payload, ...state });
|
|
100
90
|
return {
|
|
101
91
|
...state,
|
|
102
92
|
filterState: { ...updateState },
|
|
103
|
-
currentActionType: sideBarActionTypes.CLEAR_SLIDER_SECTION,
|
|
104
93
|
};
|
|
105
94
|
case sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE:
|
|
106
95
|
return {
|
|
107
96
|
filterState: payload,
|
|
108
|
-
currentActionType: sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE,
|
|
109
97
|
};
|
|
110
98
|
default:
|
|
111
99
|
return state;
|