@bento-core/facet-filter 1.0.1-ccdihub.23 → 1.0.1-ccdihub.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FacetFilterController.js +11 -5
- package/dist/components/facet/FacetView.js +8 -8
- package/dist/components/facet/ReduxFacetView.js +7 -9
- package/dist/components/inputs/checkbox/ReduxCheckbox.js +1 -4
- package/package.json +1 -1
- package/src/FacetFilterController.js +12 -6
- package/src/components/facet/FacetView.js +7 -9
- package/src/components/facet/ReduxFacetView.js +5 -6
- package/src/components/inputs/checkbox/ReduxCheckbox.js +1 -5
|
@@ -26,11 +26,20 @@ const FacetFilterController = props => {
|
|
|
26
26
|
* 2. subject state
|
|
27
27
|
*/
|
|
28
28
|
const {
|
|
29
|
-
|
|
29
|
+
activeFilters,
|
|
30
30
|
data,
|
|
31
31
|
facetsConfig,
|
|
32
32
|
facetSectionConfig
|
|
33
33
|
} = props;
|
|
34
|
+
const filterState = {};
|
|
35
|
+
for (const [key, value] of Object.entries(activeFilters)) {
|
|
36
|
+
if (key !== 'participant_ids') {
|
|
37
|
+
filterState[key] = {};
|
|
38
|
+
value.forEach(item => {
|
|
39
|
+
filterState[key][item] = true;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
34
43
|
const updateFacetState = filterSections => {
|
|
35
44
|
const updateSections = [...filterSections];
|
|
36
45
|
if (!_lodash.default.isEmpty(filterState)) {
|
|
@@ -169,8 +178,5 @@ const FacetFilterController = props => {
|
|
|
169
178
|
sideBarSections: facetSections
|
|
170
179
|
})));
|
|
171
180
|
};
|
|
172
|
-
|
|
173
|
-
filterState: state.statusReducer.filterState
|
|
174
|
-
});
|
|
175
|
-
var _default = (0, _reactRedux.connect)(mapStateToProps, null)(FacetFilterController);
|
|
181
|
+
var _default = (0, _reactRedux.connect)(null, null)(FacetFilterController);
|
|
176
182
|
exports.default = _default;
|
|
@@ -27,9 +27,7 @@ const FacetView = _ref => {
|
|
|
27
27
|
facet,
|
|
28
28
|
onClearFacetSection,
|
|
29
29
|
onClearSliderSection,
|
|
30
|
-
CustomView
|
|
31
|
-
autoComplete,
|
|
32
|
-
upload
|
|
30
|
+
CustomView
|
|
33
31
|
} = _ref;
|
|
34
32
|
const [expand, setExpand] = (0, _react.useState)(false);
|
|
35
33
|
const onExpandFacet = () => setExpand(!expand);
|
|
@@ -37,11 +35,13 @@ const FacetView = _ref => {
|
|
|
37
35
|
/**
|
|
38
36
|
* expand section incase of active local search
|
|
39
37
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
38
|
+
// useEffect(() => {
|
|
39
|
+
// if ((autoComplete && autoComplete.length > 0)
|
|
40
|
+
// || (upload && upload.length > 0)) {
|
|
41
|
+
// setExpand(true);
|
|
42
|
+
// }
|
|
43
|
+
// }, [autoComplete, upload]);
|
|
44
|
+
|
|
45
45
|
const [sortBy, setSortBy] = (0, _react.useState)(null);
|
|
46
46
|
const onSortFacet = type => {
|
|
47
47
|
setSortBy(type);
|
|
@@ -10,14 +10,12 @@ var _Actions = require("../../store/actions/Actions");
|
|
|
10
10
|
var _FacetView = _interopRequireDefault(require("./FacetView"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
const ReduxFacetView = props => /*#__PURE__*/_react.default.createElement(_FacetView.default, props);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
};
|
|
13
|
+
|
|
14
|
+
// const mapStateToProps = (state) => ({
|
|
15
|
+
// autoComplete: state?.localFind?.autocomplete || [],
|
|
16
|
+
// upload: state?.localFind?.upload || [],
|
|
17
|
+
// });
|
|
18
|
+
|
|
21
19
|
const mapDispatchToProps = dispatch => ({
|
|
22
20
|
onClearFacetSection: facet => {
|
|
23
21
|
dispatch((0, _Actions.clearFacetSection)(facet));
|
|
@@ -26,5 +24,5 @@ const mapDispatchToProps = dispatch => ({
|
|
|
26
24
|
dispatch((0, _Actions.clearSliderSection)(facet));
|
|
27
25
|
}
|
|
28
26
|
});
|
|
29
|
-
var _default = (0, _reactRedux.connect)(
|
|
27
|
+
var _default = (0, _reactRedux.connect)(null, mapDispatchToProps)(ReduxFacetView);
|
|
30
28
|
exports.default = _default;
|
|
@@ -10,11 +10,8 @@ var _Actions = require("../../../store/actions/Actions");
|
|
|
10
10
|
var _CheckboxView = _interopRequireDefault(require("./CheckboxView"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
const ReduxCheckbox = props => /*#__PURE__*/_react.default.createElement(_CheckboxView.default, props);
|
|
13
|
-
const mapStateToProps = state => ({
|
|
14
|
-
filterState: state.statusReducer.filterState
|
|
15
|
-
});
|
|
16
13
|
const mapDispatchToProps = dispatch => ({
|
|
17
14
|
onToggle: view => dispatch((0, _Actions.toggleCheckBox)(view))
|
|
18
15
|
});
|
|
19
|
-
var _default = (0, _reactRedux.connect)(
|
|
16
|
+
var _default = (0, _reactRedux.connect)(null, mapDispatchToProps)(ReduxCheckbox);
|
|
20
17
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -21,12 +21,22 @@ const FacetFilterController = (props) => {
|
|
|
21
21
|
* 2. subject state
|
|
22
22
|
*/
|
|
23
23
|
const {
|
|
24
|
-
|
|
24
|
+
activeFilters,
|
|
25
25
|
data,
|
|
26
26
|
facetsConfig,
|
|
27
27
|
facetSectionConfig,
|
|
28
28
|
} = props;
|
|
29
29
|
|
|
30
|
+
const filterState = {};
|
|
31
|
+
for (const [key, value] of Object.entries(activeFilters)) {
|
|
32
|
+
if (key !== 'participant_ids') {
|
|
33
|
+
filterState[key] = {};
|
|
34
|
+
value.forEach((item) => {
|
|
35
|
+
filterState[key][item] = true;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
const updateFacetState = (filterSections) => {
|
|
31
41
|
const updateSections = [...filterSections];
|
|
32
42
|
if (!_.isEmpty(filterState)) {
|
|
@@ -161,8 +171,4 @@ const FacetFilterController = (props) => {
|
|
|
161
171
|
);
|
|
162
172
|
};
|
|
163
173
|
|
|
164
|
-
|
|
165
|
-
filterState: state.statusReducer.filterState,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
export default connect(mapStateToProps, null)(FacetFilterController);
|
|
174
|
+
export default connect(null, null)(FacetFilterController);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Accordion,
|
|
4
4
|
List,
|
|
@@ -19,8 +19,6 @@ const FacetView = ({
|
|
|
19
19
|
onClearFacetSection,
|
|
20
20
|
onClearSliderSection,
|
|
21
21
|
CustomView,
|
|
22
|
-
autoComplete,
|
|
23
|
-
upload,
|
|
24
22
|
}) => {
|
|
25
23
|
const [expand, setExpand] = useState(false);
|
|
26
24
|
const onExpandFacet = () => setExpand(!expand);
|
|
@@ -28,12 +26,12 @@ const FacetView = ({
|
|
|
28
26
|
/**
|
|
29
27
|
* expand section incase of active local search
|
|
30
28
|
*/
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [autoComplete, upload]);
|
|
29
|
+
// useEffect(() => {
|
|
30
|
+
// if ((autoComplete && autoComplete.length > 0)
|
|
31
|
+
// || (upload && upload.length > 0)) {
|
|
32
|
+
// setExpand(true);
|
|
33
|
+
// }
|
|
34
|
+
// }, [autoComplete, upload]);
|
|
37
35
|
|
|
38
36
|
const [sortBy, setSortBy] = useState(null);
|
|
39
37
|
const onSortFacet = (type) => {
|
|
@@ -5,15 +5,14 @@ import FacetView from './FacetView';
|
|
|
5
5
|
|
|
6
6
|
const ReduxFacetView = ((props) => <FacetView {...props} />);
|
|
7
7
|
|
|
8
|
-
const mapStateToProps = (state) => ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
8
|
+
// const mapStateToProps = (state) => ({
|
|
9
|
+
// autoComplete: state?.localFind?.autocomplete || [],
|
|
10
|
+
// upload: state?.localFind?.upload || [],
|
|
11
|
+
// });
|
|
13
12
|
|
|
14
13
|
const mapDispatchToProps = (dispatch) => ({
|
|
15
14
|
onClearFacetSection: (facet) => { dispatch(clearFacetSection(facet)); },
|
|
16
15
|
onClearSliderSection: (facet) => { dispatch(clearSliderSection(facet)); },
|
|
17
16
|
});
|
|
18
17
|
|
|
19
|
-
export default connect(
|
|
18
|
+
export default connect(null, mapDispatchToProps)(ReduxFacetView);
|
|
@@ -5,12 +5,8 @@ import CheckboxView from './CheckboxView';
|
|
|
5
5
|
|
|
6
6
|
const ReduxCheckbox = ((props) => <CheckboxView {...props} />);
|
|
7
7
|
|
|
8
|
-
const mapStateToProps = (state) => ({
|
|
9
|
-
filterState: state.statusReducer.filterState,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
8
|
const mapDispatchToProps = (dispatch) => ({
|
|
13
9
|
onToggle: (view) => dispatch(toggleCheckBox(view)),
|
|
14
10
|
});
|
|
15
11
|
|
|
16
|
-
export default connect(
|
|
12
|
+
export default connect(null, mapDispatchToProps)(ReduxCheckbox);
|