@bento-core/facet-filter 1.0.1-ccdihub.35 → 1.0.1-ccdihub.37
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 +4 -1
- package/dist/NewFacetFilterController.js +11 -2
- package/dist/components/facet/FacetView.js +20 -2
- package/dist/components/facet/NewFacetStyle.js +83 -1
- package/dist/components/facet/NewFacetView.js +57 -4
- package/dist/components/facet/NewSearchFacetView.js +20 -2
- package/dist/components/facet/ReduxFacetView.js +10 -7
- package/dist/components/facet/ReduxNewFacetView.js +14 -7
- package/dist/components/facet/ReduxNewSearchFacetView.js +6 -2
- package/dist/components/facet/ReduxSearchFacetView.js +6 -2
- package/dist/components/facet/SearchFacetView.js +20 -2
- package/dist/components/inputs/FilterItems.js +4 -2
- package/dist/components/inputs/slider/InputMinMaxStyle.js +16 -0
- package/dist/components/inputs/slider/InputMinMaxView.js +3 -1
- package/dist/components/inputs/slider/ReduxSlider.js +9 -4
- package/dist/components/inputs/slider/SliderStyle.js +23 -0
- package/dist/components/inputs/slider/SliderView.js +260 -28
- package/dist/index.js +12 -0
- package/dist/store/actions/ActionTypes.js +3 -1
- package/dist/store/actions/Actions.js +18 -2
- package/dist/store/reducers/SideBarReducer.js +48 -4
- package/dist/utils/filter.js +21 -7
- package/package.json +4 -2
- package/src/FacetFilterController.js +3 -0
- package/src/NewFacetFilterController.js +8 -1
- package/src/components/facet/FacetView.js +20 -1
- package/src/components/facet/NewFacetStyle.js +88 -0
- package/src/components/facet/NewFacetView.js +67 -1
- package/src/components/facet/NewSearchFacetView.js +20 -1
- package/src/components/facet/ReduxFacetView.js +8 -6
- package/src/components/facet/ReduxNewFacetView.js +15 -6
- package/src/components/facet/ReduxNewSearchFacetView.js +5 -0
- package/src/components/facet/ReduxSearchFacetView.js +5 -0
- package/src/components/facet/SearchFacetView.js +20 -1
- package/src/components/inputs/FilterItems.js +2 -1
- package/src/components/inputs/slider/InputMinMaxStyle.js +16 -0
- package/src/components/inputs/slider/InputMinMaxView.js +2 -0
- package/src/components/inputs/slider/ReduxSlider.js +5 -1
- package/src/components/inputs/slider/SliderStyle.js +23 -0
- package/src/components/inputs/slider/SliderView.js +294 -35
- package/src/index.js +2 -1
- package/src/store/actions/ActionTypes.js +2 -0
- package/src/store/actions/Actions.js +16 -0
- package/src/store/reducers/SideBarReducer.js +42 -0
- package/src/utils/filter.js +18 -0
|
@@ -29,7 +29,8 @@ const FacetFilterController = props => {
|
|
|
29
29
|
activeFilters,
|
|
30
30
|
data,
|
|
31
31
|
facetsConfig,
|
|
32
|
-
facetSectionConfig
|
|
32
|
+
facetSectionConfig,
|
|
33
|
+
unknownAgesState
|
|
33
34
|
} = props;
|
|
34
35
|
const filterState = {};
|
|
35
36
|
// console.log(activeFilters);
|
|
@@ -152,8 +153,10 @@ const FacetFilterController = props => {
|
|
|
152
153
|
if (facet.type === _Types.InputTypes.SLIDER) {
|
|
153
154
|
const lowerBound = data[apiForFiltering][ApiLowerBoundName];
|
|
154
155
|
const upperBound = data[apiForFiltering][ApiUpperBoundName];
|
|
156
|
+
const unknownAges = (unknownAgesState === null || unknownAgesState === void 0 ? void 0 : unknownAgesState[facet.datafield]) || 'include';
|
|
155
157
|
updateFacet.minLowerBound = lowerBound;
|
|
156
158
|
updateFacet.maxUpperBound = upperBound;
|
|
159
|
+
updateFacet.unknownAges = unknownAges;
|
|
157
160
|
updateFacet.facetValues = [lowerBound, upperBound];
|
|
158
161
|
updateFacet.style = facet.style;
|
|
159
162
|
}
|
|
@@ -30,7 +30,8 @@ const NewFacetFilterController = props => {
|
|
|
30
30
|
data,
|
|
31
31
|
facetsConfig,
|
|
32
32
|
facetSectionConfig,
|
|
33
|
-
selectedSection
|
|
33
|
+
selectedSection,
|
|
34
|
+
unknownAgesState
|
|
34
35
|
} = props;
|
|
35
36
|
const filterState = {};
|
|
36
37
|
// console.log(activeFilters);
|
|
@@ -153,8 +154,10 @@ const NewFacetFilterController = props => {
|
|
|
153
154
|
if (facet.type === _Types.InputTypes.SLIDER) {
|
|
154
155
|
const lowerBound = data[apiForFiltering][ApiLowerBoundName];
|
|
155
156
|
const upperBound = data[apiForFiltering][ApiUpperBoundName];
|
|
157
|
+
const unknownAges = (unknownAgesState === null || unknownAgesState === void 0 ? void 0 : unknownAgesState[facet.datafield]) || 'include';
|
|
156
158
|
updateFacet.minLowerBound = lowerBound;
|
|
157
159
|
updateFacet.maxUpperBound = upperBound;
|
|
160
|
+
updateFacet.unknownAges = unknownAges;
|
|
158
161
|
updateFacet.facetValues = [lowerBound, upperBound];
|
|
159
162
|
updateFacet.style = facet.style;
|
|
160
163
|
}
|
|
@@ -179,5 +182,11 @@ const NewFacetFilterController = props => {
|
|
|
179
182
|
facetSection: facetSection
|
|
180
183
|
})));
|
|
181
184
|
};
|
|
182
|
-
|
|
185
|
+
const mapStateToProps = state => {
|
|
186
|
+
var _state$statusReducer;
|
|
187
|
+
return {
|
|
188
|
+
unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.unknownAgesState) || {}
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
var _default = (0, _reactRedux.connect)(mapStateToProps, null)(NewFacetFilterController);
|
|
183
192
|
exports.default = _default;
|
|
@@ -29,8 +29,10 @@ const FacetView = _ref => {
|
|
|
29
29
|
facet,
|
|
30
30
|
onClearFacetSection,
|
|
31
31
|
onClearSliderSection,
|
|
32
|
+
onUnknownAgesChange,
|
|
32
33
|
CustomView,
|
|
33
|
-
queryParams
|
|
34
|
+
queryParams,
|
|
35
|
+
unknownAgesState
|
|
34
36
|
} = _ref;
|
|
35
37
|
const [expand, setExpand] = (0, _react.useState)(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
|
|
36
38
|
const onExpandFacet = () => setExpand(!expand);
|
|
@@ -55,11 +57,22 @@ const FacetView = _ref => {
|
|
|
55
57
|
const field = facet.datafield;
|
|
56
58
|
const paramValue = {};
|
|
57
59
|
paramValue[field] = '';
|
|
60
|
+
|
|
61
|
+
// Also clear the corresponding unknownAges parameter if it exists
|
|
62
|
+
const unknownAgesField = "".concat(field, "_unknownAges");
|
|
63
|
+
if (queryParams.includes(unknownAgesField)) {
|
|
64
|
+
paramValue[unknownAgesField] = '';
|
|
65
|
+
}
|
|
58
66
|
const queryStr = (0, _util.generateQueryStr)(query, queryParams, paramValue);
|
|
59
67
|
navigate("/explore".concat(queryStr), {
|
|
60
68
|
replace: true
|
|
61
69
|
});
|
|
62
70
|
setSortBy(null);
|
|
71
|
+
|
|
72
|
+
// Reset the corresponding unknownAges parameter in Redux state
|
|
73
|
+
if (queryParams.includes(unknownAgesField) && onUnknownAgesChange) {
|
|
74
|
+
onUnknownAgesChange(field, 'include');
|
|
75
|
+
}
|
|
63
76
|
if (facet.type === _Types.InputTypes.SLIDER) {
|
|
64
77
|
onClearSliderSection(facet);
|
|
65
78
|
} else {
|
|
@@ -76,7 +89,12 @@ const FacetView = _ref => {
|
|
|
76
89
|
const selectedItems = facetValues && facetValues.filter(item => item.isChecked);
|
|
77
90
|
const displayFacet = _objectSpread({}, facet);
|
|
78
91
|
displayFacet.facetValues = selectedItems;
|
|
79
|
-
|
|
92
|
+
|
|
93
|
+
// Check if facet is active based on selected items or unknown ages selection
|
|
94
|
+
const hasSelectedItems = [...selectedItems].length > 0;
|
|
95
|
+
const unknownAges = (unknownAgesState === null || unknownAgesState === void 0 ? void 0 : unknownAgesState[facet.datafield]) || 'include';
|
|
96
|
+
const hasUnknownAgesSelection = unknownAges !== 'include';
|
|
97
|
+
const isActiveFacet = hasSelectedItems || type === _Types.InputTypes.SLIDER && hasUnknownAgesSelection;
|
|
80
98
|
const limitCheckBoxCount = (facet === null || facet === void 0 ? void 0 : facet.showCheckboxCount) || 5;
|
|
81
99
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Accordion, {
|
|
82
100
|
square: true,
|
|
@@ -33,7 +33,9 @@ var _default = () => ({
|
|
|
33
33
|
marginBottom: '5px',
|
|
34
34
|
textAlign: 'left',
|
|
35
35
|
marginLeft: '-5px',
|
|
36
|
-
borderTop: 'none'
|
|
36
|
+
borderTop: 'none',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center'
|
|
37
39
|
},
|
|
38
40
|
sortGroupIcon: {
|
|
39
41
|
cursor: 'pointer',
|
|
@@ -123,6 +125,86 @@ var _default = () => ({
|
|
|
123
125
|
position: 'absolute',
|
|
124
126
|
right: '14px',
|
|
125
127
|
top: '14px'
|
|
128
|
+
},
|
|
129
|
+
timeUnitToggle: {
|
|
130
|
+
marginLeft: '8px',
|
|
131
|
+
marginRight: '20px',
|
|
132
|
+
height: '32px',
|
|
133
|
+
'& .MuiToggleButtonGroup-grouped': {
|
|
134
|
+
borderRadius: '8px',
|
|
135
|
+
'&:not(:first-child)': {
|
|
136
|
+
marginLeft: '0px',
|
|
137
|
+
borderLeft: '1px solid #D3D3D3',
|
|
138
|
+
borderTopLeftRadius: '0px',
|
|
139
|
+
borderBottomLeftRadius: '0px'
|
|
140
|
+
},
|
|
141
|
+
'&:not(:last-child)': {
|
|
142
|
+
borderTopRightRadius: '0px',
|
|
143
|
+
borderBottomRightRadius: '0px'
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
toggleButton: props => {
|
|
148
|
+
const primaryColor = props.facet && props.facet.style && props.facet.style.colorPrimary ? props.facet.style.colorPrimary.color : '#3f51b5';
|
|
149
|
+
return {
|
|
150
|
+
fontFamily: 'Poppins !important',
|
|
151
|
+
fontSize: '11px !important',
|
|
152
|
+
fontWeight: '400 !important',
|
|
153
|
+
fontStyle: 'normal !important',
|
|
154
|
+
lineHeight: '100% !important',
|
|
155
|
+
letterSpacing: '0.02em !important',
|
|
156
|
+
padding: '6px 24px',
|
|
157
|
+
textTransform: 'uppercase !important',
|
|
158
|
+
border: '1px solid #D3D3D3',
|
|
159
|
+
borderRadius: '8px',
|
|
160
|
+
backgroundColor: '#EDEDED',
|
|
161
|
+
color: '#000000',
|
|
162
|
+
'& .MuiToggleButton-label': {
|
|
163
|
+
fontFamily: 'Poppins !important',
|
|
164
|
+
fontSize: '11px !important',
|
|
165
|
+
fontWeight: '400 !important',
|
|
166
|
+
lineHeight: '100% !important',
|
|
167
|
+
letterSpacing: '0.02em !important',
|
|
168
|
+
textTransform: 'uppercase !important'
|
|
169
|
+
},
|
|
170
|
+
'&:hover': {
|
|
171
|
+
backgroundColor: '#E0E0E0'
|
|
172
|
+
},
|
|
173
|
+
'&.Mui-disabled': {
|
|
174
|
+
backgroundColor: '#F5F5F5',
|
|
175
|
+
color: '#BDBDBD',
|
|
176
|
+
border: '1px solid #E0E0E0',
|
|
177
|
+
cursor: 'not-allowed',
|
|
178
|
+
'& .MuiToggleButton-label': {
|
|
179
|
+
color: '#BDBDBD'
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
'&.Mui-selected': {
|
|
183
|
+
backgroundColor: primaryColor,
|
|
184
|
+
color: '#FFFFFF',
|
|
185
|
+
'& .MuiToggleButton-label': {
|
|
186
|
+
fontFamily: 'Poppins !important',
|
|
187
|
+
fontSize: '11px !important',
|
|
188
|
+
fontWeight: '400 !important',
|
|
189
|
+
lineHeight: '100% !important',
|
|
190
|
+
letterSpacing: '0.02em !important',
|
|
191
|
+
textTransform: 'uppercase !important'
|
|
192
|
+
},
|
|
193
|
+
'&:hover': {
|
|
194
|
+
backgroundColor: primaryColor
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
toggleButtonSelected: props => {
|
|
200
|
+
const primaryColor = props.facet && props.facet.style && props.facet.style.colorPrimary ? props.facet.style.colorPrimary.color : '#3f51b5';
|
|
201
|
+
return {
|
|
202
|
+
backgroundColor: primaryColor,
|
|
203
|
+
color: '#FFFFFF !important',
|
|
204
|
+
'&:hover': {
|
|
205
|
+
backgroundColor: primaryColor
|
|
206
|
+
}
|
|
207
|
+
};
|
|
126
208
|
}
|
|
127
209
|
});
|
|
128
210
|
exports.default = _default;
|
|
@@ -8,6 +8,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactRouterDom = require("react-router-dom");
|
|
9
9
|
var _util = require("@bento-core/util");
|
|
10
10
|
var _core = require("@material-ui/core");
|
|
11
|
+
var _ToggleButton = _interopRequireDefault(require("@material-ui/lab/ToggleButton"));
|
|
12
|
+
var _ToggleButtonGroup = _interopRequireDefault(require("@material-ui/lab/ToggleButtonGroup"));
|
|
11
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
14
|
var _AccordionSummaryView = _interopRequireDefault(require("../summary/AccordionSummaryView"));
|
|
13
15
|
var _Types = require("../inputs/Types");
|
|
@@ -29,8 +31,12 @@ const NewFacetView = _ref => {
|
|
|
29
31
|
facet,
|
|
30
32
|
onClearFacetSection,
|
|
31
33
|
onClearSliderSection,
|
|
34
|
+
onUnknownAgesChange,
|
|
32
35
|
CustomView,
|
|
33
|
-
queryParams
|
|
36
|
+
queryParams,
|
|
37
|
+
timeUnitState,
|
|
38
|
+
onTimeUnitChange,
|
|
39
|
+
unknownAgesState
|
|
34
40
|
} = _ref;
|
|
35
41
|
const [expand, setExpand] = (0, _react.useState)(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
|
|
36
42
|
const onExpandFacet = () => setExpand(!expand);
|
|
@@ -48,18 +54,37 @@ const NewFacetView = _ref => {
|
|
|
48
54
|
// }, [autoComplete, upload]);
|
|
49
55
|
|
|
50
56
|
const [sortBy, setSortBy] = (0, _react.useState)(null);
|
|
57
|
+
const timeUnit = timeUnitState[facet.datafield] || 'days';
|
|
58
|
+
const unknownAges = (unknownAgesState === null || unknownAgesState === void 0 ? void 0 : unknownAgesState[facet.datafield]) || 'include';
|
|
59
|
+
const isOnlyUnknownAges = unknownAges === 'only';
|
|
51
60
|
const onSortFacet = type => {
|
|
52
61
|
setSortBy(type);
|
|
53
62
|
};
|
|
63
|
+
const handleTimeUnitChange = (event, newUnit) => {
|
|
64
|
+
if (newUnit !== null) {
|
|
65
|
+
onTimeUnitChange(facet.datafield, newUnit);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
54
68
|
const onClearSection = () => {
|
|
55
69
|
const field = facet.datafield;
|
|
56
70
|
const paramValue = {};
|
|
57
71
|
paramValue[field] = '';
|
|
72
|
+
|
|
73
|
+
// Also clear the corresponding unknownAges parameter if it exists
|
|
74
|
+
const unknownAgesField = "".concat(field, "_unknownAges");
|
|
75
|
+
if (queryParams.includes(unknownAgesField)) {
|
|
76
|
+
paramValue[unknownAgesField] = '';
|
|
77
|
+
}
|
|
58
78
|
const queryStr = (0, _util.generateQueryStr)(query, queryParams, paramValue);
|
|
59
79
|
navigate("/explore".concat(queryStr), {
|
|
60
80
|
replace: true
|
|
61
81
|
});
|
|
62
82
|
setSortBy(null);
|
|
83
|
+
|
|
84
|
+
// Reset the corresponding unknownAges parameter in Redux state
|
|
85
|
+
if (queryParams.includes(unknownAgesField) && onUnknownAgesChange) {
|
|
86
|
+
onUnknownAgesChange(field, 'include');
|
|
87
|
+
}
|
|
63
88
|
if (facet.type === _Types.InputTypes.SLIDER) {
|
|
64
89
|
onClearSliderSection(facet);
|
|
65
90
|
} else {
|
|
@@ -76,7 +101,11 @@ const NewFacetView = _ref => {
|
|
|
76
101
|
const selectedItems = facetValues && facetValues.filter(item => item.isChecked);
|
|
77
102
|
const displayFacet = _objectSpread({}, facet);
|
|
78
103
|
displayFacet.facetValues = selectedItems;
|
|
79
|
-
|
|
104
|
+
|
|
105
|
+
// Check if facet is active based on selected items or unknown ages selection
|
|
106
|
+
const hasSelectedItems = [...selectedItems].length > 0;
|
|
107
|
+
const hasUnknownAgesSelection = unknownAges !== 'include';
|
|
108
|
+
const isActiveFacet = hasSelectedItems || type === _Types.InputTypes.SLIDER && hasUnknownAgesSelection;
|
|
80
109
|
const limitCheckBoxCount = (facet === null || facet === void 0 ? void 0 : facet.showCheckboxCount) || 5;
|
|
81
110
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Accordion, {
|
|
82
111
|
square: true,
|
|
@@ -112,7 +141,30 @@ const NewFacetView = _ref => {
|
|
|
112
141
|
height: 12,
|
|
113
142
|
width: 12,
|
|
114
143
|
alt: "clear-icon"
|
|
115
|
-
}))), facet.type === _Types.InputTypes.
|
|
144
|
+
}))), facet.type === _Types.InputTypes.SLIDER && /*#__PURE__*/_react.default.createElement(_ToggleButtonGroup.default, {
|
|
145
|
+
value: timeUnit,
|
|
146
|
+
exclusive: true,
|
|
147
|
+
disabled: isOnlyUnknownAges,
|
|
148
|
+
onChange: handleTimeUnitChange,
|
|
149
|
+
"aria-label": "time unit",
|
|
150
|
+
className: classes.timeUnitToggle
|
|
151
|
+
}, /*#__PURE__*/_react.default.createElement(_ToggleButton.default, {
|
|
152
|
+
value: "days",
|
|
153
|
+
"aria-label": "days",
|
|
154
|
+
disabled: isOnlyUnknownAges,
|
|
155
|
+
classes: {
|
|
156
|
+
root: classes.toggleButton,
|
|
157
|
+
selected: classes.toggleButtonSelected
|
|
158
|
+
}
|
|
159
|
+
}, "DAYS"), /*#__PURE__*/_react.default.createElement(_ToggleButton.default, {
|
|
160
|
+
value: "years",
|
|
161
|
+
"aria-label": "years",
|
|
162
|
+
disabled: isOnlyUnknownAges,
|
|
163
|
+
classes: {
|
|
164
|
+
root: classes.toggleButton,
|
|
165
|
+
selected: classes.toggleButtonSelected
|
|
166
|
+
}
|
|
167
|
+
}, "YEARS")), facet.type === _Types.InputTypes.CHECKBOX && facetValues.length > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
116
168
|
className: (0, _clsx.default)(classes.sortGroupItem, {
|
|
117
169
|
[classes.highlight]: sortBy === _Sort.sortType.ALPHABET
|
|
118
170
|
}),
|
|
@@ -129,7 +181,8 @@ const NewFacetView = _ref => {
|
|
|
129
181
|
}, "Sort by count"))), /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
|
|
130
182
|
facet: facet,
|
|
131
183
|
queryParams: queryParams,
|
|
132
|
-
sortBy: sortBy
|
|
184
|
+
sortBy: sortBy,
|
|
185
|
+
timeUnit: timeUnit
|
|
133
186
|
})), !expand && type === _Types.InputTypes.CHECKBOX && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.List, {
|
|
134
187
|
id: "filter_Items"
|
|
135
188
|
}, /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
|
|
@@ -53,10 +53,12 @@ const SearchFacetView = _ref => {
|
|
|
53
53
|
searchText,
|
|
54
54
|
sortBy,
|
|
55
55
|
onClearFacetSection,
|
|
56
|
+
onUnknownAgesChange,
|
|
56
57
|
onSearchTextChange,
|
|
57
58
|
onSortChange,
|
|
58
59
|
CustomView,
|
|
59
|
-
queryParams
|
|
60
|
+
queryParams,
|
|
61
|
+
unknownAgesState
|
|
60
62
|
} = _ref;
|
|
61
63
|
const [expand, setExpand] = (0, _react.useState)(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
|
|
62
64
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
@@ -67,11 +69,22 @@ const SearchFacetView = _ref => {
|
|
|
67
69
|
const field = facet.datafield;
|
|
68
70
|
const paramValue = {};
|
|
69
71
|
paramValue[field] = '';
|
|
72
|
+
|
|
73
|
+
// Also clear the corresponding unknownAges parameter if it exists
|
|
74
|
+
const unknownAgesField = "".concat(field, "_unknownAges");
|
|
75
|
+
if (queryParams.includes(unknownAgesField)) {
|
|
76
|
+
paramValue[unknownAgesField] = '';
|
|
77
|
+
}
|
|
70
78
|
const queryStr = (0, _util.generateQueryStr)(query, queryParams, paramValue);
|
|
71
79
|
navigate("/explore".concat(queryStr), {
|
|
72
80
|
replace: true
|
|
73
81
|
});
|
|
74
82
|
onSortChange(facet.datafield, null);
|
|
83
|
+
|
|
84
|
+
// Reset the corresponding unknownAges parameter in Redux state
|
|
85
|
+
if (queryParams.includes(unknownAgesField) && onUnknownAgesChange) {
|
|
86
|
+
onUnknownAgesChange(field, 'include');
|
|
87
|
+
}
|
|
75
88
|
onClearFacetSection(facet);
|
|
76
89
|
};
|
|
77
90
|
|
|
@@ -87,7 +100,12 @@ const SearchFacetView = _ref => {
|
|
|
87
100
|
const selectedItems = facetValues && facetValues.filter(item => item.isChecked);
|
|
88
101
|
const displayFacet = _objectSpread({}, facet);
|
|
89
102
|
displayFacet.facetValues = selectedItems;
|
|
90
|
-
|
|
103
|
+
|
|
104
|
+
// Check if facet is active based on selected items or unknown ages selection
|
|
105
|
+
const hasSelectedItems = [...selectedItems].length > 0;
|
|
106
|
+
const unknownAges = (unknownAgesState === null || unknownAgesState === void 0 ? void 0 : unknownAgesState[facet.datafield]) || 'include';
|
|
107
|
+
const hasUnknownAgesSelection = unknownAges !== 'include';
|
|
108
|
+
const isActiveFacet = hasSelectedItems || type === _Types.InputTypes.SLIDER && hasUnknownAgesSelection;
|
|
91
109
|
const limitCheckBoxCount = (facet === null || facet === void 0 ? void 0 : facet.showCheckboxCount) || 5;
|
|
92
110
|
const sortFilters = (0, _Sort.sortBySection)(_objectSpread(_objectSpread({}, facet), {}, {
|
|
93
111
|
sortBy
|
|
@@ -10,19 +10,22 @@ 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
|
-
|
|
13
|
+
const mapStateToProps = state => {
|
|
14
|
+
var _state$statusReducer;
|
|
15
|
+
return {
|
|
16
|
+
unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.unknownAgesState) || {}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
19
|
const mapDispatchToProps = dispatch => ({
|
|
20
20
|
onClearFacetSection: facet => {
|
|
21
21
|
dispatch((0, _Actions.clearFacetSection)(facet));
|
|
22
22
|
},
|
|
23
23
|
onClearSliderSection: facet => {
|
|
24
24
|
dispatch((0, _Actions.clearSliderSection)(facet));
|
|
25
|
+
},
|
|
26
|
+
onUnknownAgesChange: (datafield, unknownAges) => {
|
|
27
|
+
dispatch((0, _Actions.unknownAgesChange)(datafield, unknownAges));
|
|
25
28
|
}
|
|
26
29
|
});
|
|
27
|
-
var _default = (0, _reactRedux.connect)(
|
|
30
|
+
var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ReduxFacetView);
|
|
28
31
|
exports.default = _default;
|
|
@@ -10,19 +10,26 @@ var _Actions = require("../../store/actions/Actions");
|
|
|
10
10
|
var _NewFacetView = _interopRequireDefault(require("./NewFacetView"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
const ReduxNewFacetView = props => /*#__PURE__*/_react.default.createElement(_NewFacetView.default, props);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const mapStateToProps = state => {
|
|
14
|
+
var _state$statusReducer, _state$statusReducer2;
|
|
15
|
+
return {
|
|
16
|
+
timeUnitState: (state === null || state === void 0 ? void 0 : (_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.timeUnitState) || {},
|
|
17
|
+
unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer2 = state.statusReducer) === null || _state$statusReducer2 === void 0 ? void 0 : _state$statusReducer2.unknownAgesState) || {}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
19
20
|
const mapDispatchToProps = dispatch => ({
|
|
20
21
|
onClearFacetSection: facet => {
|
|
21
22
|
dispatch((0, _Actions.clearFacetSection)(facet));
|
|
22
23
|
},
|
|
23
24
|
onClearSliderSection: facet => {
|
|
24
25
|
dispatch((0, _Actions.clearSliderSection)(facet));
|
|
26
|
+
},
|
|
27
|
+
onTimeUnitChange: (datafield, timeUnit) => {
|
|
28
|
+
dispatch((0, _Actions.timeUnitChange)(datafield, timeUnit));
|
|
29
|
+
},
|
|
30
|
+
onUnknownAgesChange: (datafield, unknownAges) => {
|
|
31
|
+
dispatch((0, _Actions.unknownAgesChange)(datafield, unknownAges));
|
|
25
32
|
}
|
|
26
33
|
});
|
|
27
|
-
var _default = (0, _reactRedux.connect)(
|
|
34
|
+
var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ReduxNewFacetView);
|
|
28
35
|
exports.default = _default;
|
|
@@ -13,10 +13,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
|
|
14
14
|
const ReduxNewSearchFacetView = props => /*#__PURE__*/_react.default.createElement(_NewSearchFacetView.default, props);
|
|
15
15
|
const mapStateToProps = (state, ownProps) => {
|
|
16
|
-
var _state$statusReducer;
|
|
16
|
+
var _state$statusReducer, _state$statusReducer2;
|
|
17
17
|
return {
|
|
18
18
|
searchText: ((_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.searchState[ownProps.facet.datafield]) || '',
|
|
19
|
-
sortBy: state.statusReducer.sortState[ownProps.facet.datafield] || null
|
|
19
|
+
sortBy: state.statusReducer.sortState[ownProps.facet.datafield] || null,
|
|
20
|
+
unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer2 = state.statusReducer) === null || _state$statusReducer2 === void 0 ? void 0 : _state$statusReducer2.unknownAgesState) || {}
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
const mapDispatchToProps = dispatch => ({
|
|
@@ -31,6 +32,9 @@ const mapDispatchToProps = dispatch => ({
|
|
|
31
32
|
},
|
|
32
33
|
onSortChange: (datafield, sortBy) => {
|
|
33
34
|
dispatch((0, _Actions.sortChange)(datafield, sortBy));
|
|
35
|
+
},
|
|
36
|
+
onUnknownAgesChange: (datafield, unknownAges) => {
|
|
37
|
+
dispatch((0, _Actions.unknownAgesChange)(datafield, unknownAges));
|
|
34
38
|
}
|
|
35
39
|
});
|
|
36
40
|
var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ReduxNewSearchFacetView);
|
|
@@ -13,10 +13,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
|
|
14
14
|
const ReduxSearchFacetView = props => /*#__PURE__*/_react.default.createElement(_SearchFacetView.default, props);
|
|
15
15
|
const mapStateToProps = (state, ownProps) => {
|
|
16
|
-
var _state$statusReducer;
|
|
16
|
+
var _state$statusReducer, _state$statusReducer2;
|
|
17
17
|
return {
|
|
18
18
|
searchText: ((_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.searchState[ownProps.facet.datafield]) || '',
|
|
19
|
-
sortBy: state.statusReducer.sortState[ownProps.facet.datafield] || null
|
|
19
|
+
sortBy: state.statusReducer.sortState[ownProps.facet.datafield] || null,
|
|
20
|
+
unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer2 = state.statusReducer) === null || _state$statusReducer2 === void 0 ? void 0 : _state$statusReducer2.unknownAgesState) || {}
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
const mapDispatchToProps = dispatch => ({
|
|
@@ -31,6 +32,9 @@ const mapDispatchToProps = dispatch => ({
|
|
|
31
32
|
},
|
|
32
33
|
onSortChange: (datafield, sortBy) => {
|
|
33
34
|
dispatch((0, _Actions.sortChange)(datafield, sortBy));
|
|
35
|
+
},
|
|
36
|
+
onUnknownAgesChange: (datafield, unknownAges) => {
|
|
37
|
+
dispatch((0, _Actions.unknownAgesChange)(datafield, unknownAges));
|
|
34
38
|
}
|
|
35
39
|
});
|
|
36
40
|
var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ReduxSearchFacetView);
|
|
@@ -53,10 +53,12 @@ const SearchFacetView = _ref => {
|
|
|
53
53
|
searchText,
|
|
54
54
|
sortBy,
|
|
55
55
|
onClearFacetSection,
|
|
56
|
+
onUnknownAgesChange,
|
|
56
57
|
onSearchTextChange,
|
|
57
58
|
onSortChange,
|
|
58
59
|
CustomView,
|
|
59
|
-
queryParams
|
|
60
|
+
queryParams,
|
|
61
|
+
unknownAgesState
|
|
60
62
|
} = _ref;
|
|
61
63
|
const [expand, setExpand] = (0, _react.useState)(facet.expanded !== undefined && typeof facet.expanded === 'boolean' ? facet.expanded : false);
|
|
62
64
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
@@ -67,11 +69,22 @@ const SearchFacetView = _ref => {
|
|
|
67
69
|
const field = facet.datafield;
|
|
68
70
|
const paramValue = {};
|
|
69
71
|
paramValue[field] = '';
|
|
72
|
+
|
|
73
|
+
// Also clear the corresponding unknownAges parameter if it exists
|
|
74
|
+
const unknownAgesField = "".concat(field, "_unknownAges");
|
|
75
|
+
if (queryParams.includes(unknownAgesField)) {
|
|
76
|
+
paramValue[unknownAgesField] = '';
|
|
77
|
+
}
|
|
70
78
|
const queryStr = (0, _util.generateQueryStr)(query, queryParams, paramValue);
|
|
71
79
|
navigate("/explore".concat(queryStr), {
|
|
72
80
|
replace: true
|
|
73
81
|
});
|
|
74
82
|
onSortChange(facet.datafield, null);
|
|
83
|
+
|
|
84
|
+
// Reset the corresponding unknownAges parameter in Redux state
|
|
85
|
+
if (queryParams.includes(unknownAgesField) && onUnknownAgesChange) {
|
|
86
|
+
onUnknownAgesChange(field, 'include');
|
|
87
|
+
}
|
|
75
88
|
onClearFacetSection(facet);
|
|
76
89
|
};
|
|
77
90
|
|
|
@@ -87,7 +100,12 @@ const SearchFacetView = _ref => {
|
|
|
87
100
|
const selectedItems = facetValues && facetValues.filter(item => item.isChecked);
|
|
88
101
|
const displayFacet = _objectSpread({}, facet);
|
|
89
102
|
displayFacet.facetValues = selectedItems;
|
|
90
|
-
|
|
103
|
+
|
|
104
|
+
// Check if facet is active based on selected items or unknown ages selection
|
|
105
|
+
const hasSelectedItems = [...selectedItems].length > 0;
|
|
106
|
+
const unknownAges = (unknownAgesState === null || unknownAgesState === void 0 ? void 0 : unknownAgesState[facet.datafield]) || 'include';
|
|
107
|
+
const hasUnknownAgesSelection = unknownAges !== 'include';
|
|
108
|
+
const isActiveFacet = hasSelectedItems || type === _Types.InputTypes.SLIDER && hasUnknownAgesSelection;
|
|
91
109
|
const limitCheckBoxCount = (facet === null || facet === void 0 ? void 0 : facet.showCheckboxCount) || 5;
|
|
92
110
|
const sortFilters = (0, _Sort.sortBySection)(_objectSpread(_objectSpread({}, facet), {}, {
|
|
93
111
|
sortBy
|
|
@@ -19,7 +19,8 @@ const FilterItems = _ref => {
|
|
|
19
19
|
let {
|
|
20
20
|
facet,
|
|
21
21
|
queryParams,
|
|
22
|
-
sortBy
|
|
22
|
+
sortBy,
|
|
23
|
+
timeUnit
|
|
23
24
|
} = _ref;
|
|
24
25
|
const {
|
|
25
26
|
type,
|
|
@@ -44,7 +45,8 @@ const FilterItems = _ref => {
|
|
|
44
45
|
case _Types.InputTypes.SLIDER:
|
|
45
46
|
return /*#__PURE__*/_react.default.createElement(_ReduxSlider.default, {
|
|
46
47
|
facet: facet,
|
|
47
|
-
queryParams: queryParams
|
|
48
|
+
queryParams: queryParams,
|
|
49
|
+
timeUnit: timeUnit
|
|
48
50
|
});
|
|
49
51
|
default:
|
|
50
52
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
@@ -13,6 +13,14 @@ var _default = () => ({
|
|
|
13
13
|
background: '#F0F0F0',
|
|
14
14
|
'& input': {
|
|
15
15
|
width: '70px'
|
|
16
|
+
},
|
|
17
|
+
'&.Mui-disabled': {
|
|
18
|
+
color: '#BDBDBD',
|
|
19
|
+
background: '#F5F5F5',
|
|
20
|
+
'& input': {
|
|
21
|
+
color: '#BDBDBD',
|
|
22
|
+
cursor: 'not-allowed'
|
|
23
|
+
}
|
|
16
24
|
}
|
|
17
25
|
},
|
|
18
26
|
slider_INPUT_MAX: {
|
|
@@ -23,6 +31,14 @@ var _default = () => ({
|
|
|
23
31
|
background: '#F0F0F0',
|
|
24
32
|
'& input': {
|
|
25
33
|
width: '70px'
|
|
34
|
+
},
|
|
35
|
+
'&.Mui-disabled': {
|
|
36
|
+
color: '#BDBDBD',
|
|
37
|
+
background: '#F5F5F5',
|
|
38
|
+
'& input': {
|
|
39
|
+
color: '#BDBDBD',
|
|
40
|
+
cursor: 'not-allowed'
|
|
41
|
+
}
|
|
26
42
|
}
|
|
27
43
|
}
|
|
28
44
|
});
|
|
@@ -18,7 +18,8 @@ function InputMinMaxView(_ref) {
|
|
|
18
18
|
minLowerBound,
|
|
19
19
|
maxUpperBound,
|
|
20
20
|
onInputChange,
|
|
21
|
-
type
|
|
21
|
+
type,
|
|
22
|
+
disabled = false
|
|
22
23
|
} = _ref;
|
|
23
24
|
const handleInputChange = e => {
|
|
24
25
|
const minMaxRange = [lowerBoundVal, upperBoundVal];
|
|
@@ -34,6 +35,7 @@ function InputMinMaxView(_ref) {
|
|
|
34
35
|
value: vlaue,
|
|
35
36
|
id: "slider_".concat(type),
|
|
36
37
|
className: classes["slider_".concat(type)],
|
|
38
|
+
disabled: disabled,
|
|
37
39
|
onChange: event => handleInputChange(event),
|
|
38
40
|
inputProps: {
|
|
39
41
|
step: 1,
|
|
@@ -10,11 +10,16 @@ var _Actions = require("../../../store/actions/Actions");
|
|
|
10
10
|
var _SliderView = _interopRequireDefault(require("./SliderView"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
const ReduxSlider = props => /*#__PURE__*/_react.default.createElement(_SliderView.default, props);
|
|
13
|
-
const mapStateToProps = state =>
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const mapStateToProps = state => {
|
|
14
|
+
var _state$statusReducer;
|
|
15
|
+
return {
|
|
16
|
+
filterState: state.statusReducer.filterState,
|
|
17
|
+
unknownAgesState: (state === null || state === void 0 ? void 0 : (_state$statusReducer = state.statusReducer) === null || _state$statusReducer === void 0 ? void 0 : _state$statusReducer.unknownAgesState) || {}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
16
20
|
const mapDispatchToProps = dispatch => ({
|
|
17
|
-
onSliderToggle: slider => dispatch((0, _Actions.toggleSilder)(slider))
|
|
21
|
+
onSliderToggle: slider => dispatch((0, _Actions.toggleSilder)(slider)),
|
|
22
|
+
onUnknownAgesChange: (datafield, unknownAges) => dispatch((0, _Actions.unknownAgesChange)(datafield, unknownAges))
|
|
18
23
|
});
|
|
19
24
|
var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(ReduxSlider);
|
|
20
25
|
exports.default = _default;
|
|
@@ -11,6 +11,10 @@ var _default = () => ({
|
|
|
11
11
|
marginRight: 'Auto',
|
|
12
12
|
paddingRight: '20px'
|
|
13
13
|
},
|
|
14
|
+
disabledSliderRoot: {
|
|
15
|
+
opacity: 0.5,
|
|
16
|
+
pointerEvents: 'none'
|
|
17
|
+
},
|
|
14
18
|
minValue: {
|
|
15
19
|
fontFamily: 'Nunito',
|
|
16
20
|
fontSize: '15px',
|
|
@@ -69,6 +73,25 @@ var _default = () => ({
|
|
|
69
73
|
background: '#142D64'
|
|
70
74
|
}
|
|
71
75
|
},
|
|
76
|
+
disabledRail: {
|
|
77
|
+
borderRadius: 4,
|
|
78
|
+
height: 6,
|
|
79
|
+
background: '#E8E8E8'
|
|
80
|
+
},
|
|
81
|
+
disabledThumb: {
|
|
82
|
+
height: 16,
|
|
83
|
+
width: 16,
|
|
84
|
+
cursor: 'not-allowed',
|
|
85
|
+
opacity: 0.4
|
|
86
|
+
},
|
|
87
|
+
disabledTrack: {
|
|
88
|
+
borderRadius: 4,
|
|
89
|
+
height: 6,
|
|
90
|
+
opacity: 0.4,
|
|
91
|
+
'&~&': {
|
|
92
|
+
background: '#E8E8E8'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
72
95
|
upperBound: {
|
|
73
96
|
fontFamily: 'Nunito',
|
|
74
97
|
fontSize: '10px',
|