@bento-core/facet-filter 1.0.1-ins.3 → 1.0.1-popsci.1
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 +2 -0
- package/dist/FacetFilterController.js +23 -43
- package/dist/components/facet/FacetView.js +1 -1
- package/dist/components/inputs/checkbox/CheckboxView.js +7 -3
- package/dist/components/inputs/slider/SliderView.js +16 -3
- package/dist/utils/Sort.js +2 -2
- package/package.json +4 -11
- package/src/FacetFilterController.js +18 -41
- package/src/components/facet/FacetView.js +1 -1
- package/src/components/inputs/checkbox/CheckboxView.js +4 -2
- package/src/components/inputs/slider/SliderView.js +28 -18
- package/src/utils/Sort.js +2 -2
package/README.md
CHANGED
|
@@ -95,6 +95,8 @@ export const facetsConfig = [{
|
|
|
95
95
|
minLowerBound: 0,
|
|
96
96
|
maxUpperBound: 100,
|
|
97
97
|
quantifier: 'Years',
|
|
98
|
+
CustomLowerUpperBound: CustomLowerUpperBound, // Custom component for displaying lower and upper bounds
|
|
99
|
+
CustomSliderValue: CustomSliderValue, // Custom component for displaying slider value
|
|
98
100
|
].
|
|
99
101
|
```
|
|
100
102
|
1. **apiForFiltering** refers to object key for retrieving name and subjects count from query response (DASHBOARD_QUERY)
|
|
@@ -12,13 +12,13 @@ var _FacetFilterView = _interopRequireDefault(require("./FacetFilterView"));
|
|
|
12
12
|
const _excluded = ["section"];
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
20
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
19
21
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
22
|
const FacetFilterController = props => {
|
|
23
23
|
/**
|
|
24
24
|
* update checkbox state
|
|
@@ -26,28 +26,28 @@ const FacetFilterController = props => {
|
|
|
26
26
|
* 2. subject state
|
|
27
27
|
*/
|
|
28
28
|
const {
|
|
29
|
-
|
|
29
|
+
filterState,
|
|
30
30
|
data,
|
|
31
31
|
facetsConfig,
|
|
32
|
-
facetSectionConfig
|
|
32
|
+
facetSectionConfig,
|
|
33
|
+
tooltipText = {}
|
|
33
34
|
} = props;
|
|
34
|
-
const filterState = {};
|
|
35
|
-
// console.log(activeFilters);
|
|
36
|
-
for (const [key, value] of Object.entries(activeFilters)) {
|
|
37
|
-
if (key !== 'program_names') {
|
|
38
|
-
filterState[key] = value;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
35
|
const updateFacetState = filterSections => {
|
|
42
36
|
const updateSections = [...filterSections];
|
|
43
37
|
if (!_lodash.default.isEmpty(filterState)) {
|
|
44
38
|
for (const [key, value] of Object.entries(filterState)) {
|
|
45
39
|
updateSections.forEach(sideBar => {
|
|
46
40
|
if (sideBar.type === _Types.InputTypes.CHECKBOX && sideBar.datafield === key) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
const {
|
|
42
|
+
facetValues = []
|
|
43
|
+
} = sideBar;
|
|
44
|
+
const updateFacetVals = facetValues.map(item => {
|
|
45
|
+
const facetVal = item[sideBar.field];
|
|
46
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
47
|
+
isChecked: value[facetVal] ? value[facetVal] : false
|
|
48
|
+
});
|
|
50
49
|
});
|
|
50
|
+
sideBar.facetValues = updateFacetVals;
|
|
51
51
|
}
|
|
52
52
|
if (sideBar.type === _Types.InputTypes.SLIDER && sideBar.datafield === key) {
|
|
53
53
|
sideBar.facetValues = value;
|
|
@@ -57,9 +57,13 @@ const FacetFilterController = props => {
|
|
|
57
57
|
} else {
|
|
58
58
|
updateSections.forEach(sideBar => {
|
|
59
59
|
if (sideBar.type === _Types.InputTypes.CHECKBOX) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
60
|
+
const {
|
|
61
|
+
facetValues = []
|
|
62
|
+
} = sideBar;
|
|
63
|
+
const updateFacetVals = facetValues.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
64
|
+
isChecked: false
|
|
65
|
+
}));
|
|
66
|
+
sideBar.facetValues = updateFacetVals;
|
|
63
67
|
}
|
|
64
68
|
/**
|
|
65
69
|
* set default value for slider - on clear all filter
|
|
@@ -104,6 +108,7 @@ const FacetFilterController = props => {
|
|
|
104
108
|
* Construct filter object
|
|
105
109
|
* 1. add facet values to facets
|
|
106
110
|
* 2. add 'name' key to each facet value
|
|
111
|
+
* 3. add '
|
|
107
112
|
*/
|
|
108
113
|
const addFacetValues = facets => {
|
|
109
114
|
const updateFacets = [];
|
|
@@ -113,38 +118,13 @@ const FacetFilterController = props => {
|
|
|
113
118
|
facetValues: []
|
|
114
119
|
});
|
|
115
120
|
const {
|
|
116
|
-
field,
|
|
117
121
|
ApiLowerBoundName,
|
|
118
122
|
ApiUpperBoundName,
|
|
119
123
|
apiForFiltering
|
|
120
124
|
} = updateFacet;
|
|
121
125
|
if (data[apiForFiltering]) {
|
|
122
126
|
if (Array.isArray(data[apiForFiltering])) {
|
|
123
|
-
|
|
124
|
-
const updateField = data[apiForFiltering].map(item => {
|
|
125
|
-
const addField = _objectSpread({}, item);
|
|
126
|
-
addField.name = item[field];
|
|
127
|
-
validValues.push(addField.name);
|
|
128
|
-
return addField;
|
|
129
|
-
});
|
|
130
|
-
/**
|
|
131
|
-
* Check if there are orphen filter values and add them to the facet values
|
|
132
|
-
*/
|
|
133
|
-
if (filterState !== undefined) {
|
|
134
|
-
const facetFilter = filterState[facet.datafield];
|
|
135
|
-
if (facetFilter) {
|
|
136
|
-
facetFilter.forEach(item => {
|
|
137
|
-
if (validValues.indexOf(item) === -1) {
|
|
138
|
-
const tmp = {};
|
|
139
|
-
tmp.group = item;
|
|
140
|
-
tmp.name = item;
|
|
141
|
-
tmp.subjects = 0;
|
|
142
|
-
updateField.push(tmp);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
updateFacet.facetValues = updateField;
|
|
127
|
+
updateFacet.facetValues = data[apiForFiltering];
|
|
148
128
|
}
|
|
149
129
|
/**
|
|
150
130
|
* add object to facet values
|
|
@@ -37,14 +37,15 @@ const CheckBoxView = _ref => {
|
|
|
37
37
|
const {
|
|
38
38
|
field = 'group',
|
|
39
39
|
count = 'subjects',
|
|
40
|
-
customCount = text => "(".concat(text, ")")
|
|
40
|
+
customCount = text => "(".concat(text, ")"),
|
|
41
|
+
defaultValue = ''
|
|
41
42
|
} = facet;
|
|
42
43
|
const indexType = index % 2 === 0 ? 'Even' : 'Odd';
|
|
43
44
|
const checkedSection = "".concat(section).toLowerCase().replace(/\ /g, '_');
|
|
44
|
-
const name = checkboxItem[field] || 'N/A';
|
|
45
|
+
const name = checkboxItem[field] || defaultValue || 'N/A';
|
|
45
46
|
const handleToggle = () => {
|
|
46
47
|
const toggleCheckBoxItem = {
|
|
47
|
-
name:
|
|
48
|
+
name: checkboxItem[field],
|
|
48
49
|
datafield: datafield,
|
|
49
50
|
isChecked: !isChecked
|
|
50
51
|
};
|
|
@@ -90,6 +91,9 @@ const CheckBoxView = _ref => {
|
|
|
90
91
|
color: "secondary",
|
|
91
92
|
classes: {
|
|
92
93
|
root: classes.checkboxRoot
|
|
94
|
+
},
|
|
95
|
+
inputProps: {
|
|
96
|
+
'aria-label': 'Select'
|
|
93
97
|
}
|
|
94
98
|
}), tooltip ? /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
95
99
|
id: datafield,
|
|
@@ -29,7 +29,9 @@ const SliderView = _ref => {
|
|
|
29
29
|
maxUpperBound,
|
|
30
30
|
quantifier,
|
|
31
31
|
datafield,
|
|
32
|
-
facetValues
|
|
32
|
+
facetValues,
|
|
33
|
+
CustomLowerUpperBound,
|
|
34
|
+
CustomSliderValue
|
|
33
35
|
} = facet;
|
|
34
36
|
const lowerBoundValue = facetValues[0];
|
|
35
37
|
const upperBoundValue = facetValues[1];
|
|
@@ -102,13 +104,24 @@ const SliderView = _ref => {
|
|
|
102
104
|
thumb: isValid() ? classes.thumb : classes.invalidThumb,
|
|
103
105
|
track: isValid() ? classes.track : classes.invalidTrack
|
|
104
106
|
}
|
|
105
|
-
})),
|
|
107
|
+
})), typeof CustomLowerUpperBound === 'function' ? CustomLowerUpperBound({
|
|
108
|
+
minLowerBound,
|
|
109
|
+
maxUpperBound,
|
|
110
|
+
classes
|
|
111
|
+
}) : /*#__PURE__*/_react.default.createElement(_core.Box, {
|
|
106
112
|
className: classes.lowerUpperBound
|
|
107
113
|
}, /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
108
114
|
className: classes.lowerBound
|
|
109
115
|
}, minLowerBound), /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
110
116
|
className: classes.upperBound
|
|
111
|
-
}, maxUpperBound))),
|
|
117
|
+
}, maxUpperBound))), typeof CustomSliderValue === 'function' ? CustomSliderValue({
|
|
118
|
+
sliderValue,
|
|
119
|
+
minLowerBound,
|
|
120
|
+
maxUpperBound,
|
|
121
|
+
isValid,
|
|
122
|
+
quantifier,
|
|
123
|
+
classes
|
|
124
|
+
}) : (sliderValue[0] > minLowerBound || sliderValue[1] < maxUpperBound) && /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
112
125
|
className: isValid() ? classes.sliderText : classes.invalidSliderText
|
|
113
126
|
}, sliderValue[0], ' - ', sliderValue[1], "\xA0", quantifier));
|
|
114
127
|
};
|
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
|
-
|
|
78
|
-
return
|
|
77
|
+
const sortedValues = sortByCheckedItem([...sortfacetValues]);
|
|
78
|
+
return sortedValues;
|
|
79
79
|
};
|
|
80
80
|
exports.sortBySection = sortBySection;
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/facet-filter",
|
|
3
|
-
"version": "1.0.1-
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.1-popsci.1",
|
|
4
|
+
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"lint": "eslint src"
|
|
10
10
|
},
|
|
11
|
-
"repository":
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/CBIIT/bento-frontend.git"
|
|
14
|
-
},
|
|
11
|
+
"repository": "https://github.com/CBIIT/bento-frontend",
|
|
15
12
|
"publishConfig": {
|
|
16
13
|
"access": "public"
|
|
17
14
|
},
|
|
@@ -27,9 +24,5 @@
|
|
|
27
24
|
"react-redux": "^7.2.1"
|
|
28
25
|
},
|
|
29
26
|
"author": "CTOS Bento Team",
|
|
30
|
-
"license": "ISC"
|
|
31
|
-
"bugs": {
|
|
32
|
-
"url": "https://github.com/CBIIT/bento-frontend/issues"
|
|
33
|
-
},
|
|
34
|
-
"homepage": "https://github.com/CBIIT/bento-frontend#readme"
|
|
27
|
+
"license": "ISC"
|
|
35
28
|
}
|
|
@@ -21,30 +21,28 @@ const FacetFilterController = (props) => {
|
|
|
21
21
|
* 2. subject state
|
|
22
22
|
*/
|
|
23
23
|
const {
|
|
24
|
-
|
|
24
|
+
filterState,
|
|
25
25
|
data,
|
|
26
26
|
facetsConfig,
|
|
27
27
|
facetSectionConfig,
|
|
28
|
+
tooltipText = {},
|
|
28
29
|
} = props;
|
|
29
30
|
|
|
30
|
-
const filterState = {};
|
|
31
|
-
// console.log(activeFilters);
|
|
32
|
-
for (const [key, value] of Object.entries(activeFilters)) {
|
|
33
|
-
if (key !== 'program_names') {
|
|
34
|
-
filterState[key] = value;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
31
|
const updateFacetState = (filterSections) => {
|
|
39
32
|
const updateSections = [...filterSections];
|
|
40
33
|
if (!_.isEmpty(filterState)) {
|
|
41
34
|
for (const [key, value] of Object.entries(filterState)) {
|
|
42
35
|
updateSections.forEach((sideBar) => {
|
|
43
36
|
if (sideBar.type === InputTypes.CHECKBOX && sideBar.datafield === key) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
const { facetValues = [] } = sideBar;
|
|
38
|
+
const updateFacetVals = facetValues.map((item) => {
|
|
39
|
+
const facetVal = item[sideBar.field];
|
|
40
|
+
return {
|
|
41
|
+
...item,
|
|
42
|
+
isChecked: value[facetVal] ? value[facetVal] : false,
|
|
43
|
+
};
|
|
47
44
|
});
|
|
45
|
+
sideBar.facetValues = updateFacetVals;
|
|
48
46
|
}
|
|
49
47
|
if (sideBar.type === InputTypes.SLIDER && sideBar.datafield === key) {
|
|
50
48
|
sideBar.facetValues = value;
|
|
@@ -54,9 +52,12 @@ const FacetFilterController = (props) => {
|
|
|
54
52
|
} else {
|
|
55
53
|
updateSections.forEach((sideBar) => {
|
|
56
54
|
if (sideBar.type === InputTypes.CHECKBOX) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
const { facetValues = [] } = sideBar;
|
|
56
|
+
const updateFacetVals = facetValues.map((item) => ({
|
|
57
|
+
...item,
|
|
58
|
+
isChecked: false,
|
|
59
|
+
}));
|
|
60
|
+
sideBar.facetValues = updateFacetVals;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* set default value for slider - on clear all filter
|
|
@@ -92,6 +93,7 @@ const FacetFilterController = (props) => {
|
|
|
92
93
|
* Construct filter object
|
|
93
94
|
* 1. add facet values to facets
|
|
94
95
|
* 2. add 'name' key to each facet value
|
|
96
|
+
* 3. add '
|
|
95
97
|
*/
|
|
96
98
|
const addFacetValues = (facets) => {
|
|
97
99
|
const updateFacets = [];
|
|
@@ -99,38 +101,13 @@ const FacetFilterController = (props) => {
|
|
|
99
101
|
facets.forEach((facet) => {
|
|
100
102
|
const updateFacet = { ...facet, facetValues: [] };
|
|
101
103
|
const {
|
|
102
|
-
field,
|
|
103
104
|
ApiLowerBoundName,
|
|
104
105
|
ApiUpperBoundName,
|
|
105
106
|
apiForFiltering,
|
|
106
107
|
} = updateFacet;
|
|
107
108
|
if (data[apiForFiltering]) {
|
|
108
109
|
if (Array.isArray(data[apiForFiltering])) {
|
|
109
|
-
|
|
110
|
-
const updateField = data[apiForFiltering].map((item) => {
|
|
111
|
-
const addField = { ...item };
|
|
112
|
-
addField.name = item[field];
|
|
113
|
-
validValues.push(addField.name);
|
|
114
|
-
return addField;
|
|
115
|
-
});
|
|
116
|
-
/**
|
|
117
|
-
* Check if there are orphen filter values and add them to the facet values
|
|
118
|
-
*/
|
|
119
|
-
if (filterState !== undefined) {
|
|
120
|
-
const facetFilter = filterState[facet.datafield];
|
|
121
|
-
if (facetFilter) {
|
|
122
|
-
facetFilter.forEach((item) => {
|
|
123
|
-
if (validValues.indexOf(item) === -1) {
|
|
124
|
-
const tmp = {};
|
|
125
|
-
tmp.group = item;
|
|
126
|
-
tmp.name = item;
|
|
127
|
-
tmp.subjects = 0;
|
|
128
|
-
updateField.push(tmp);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
updateFacet.facetValues = updateField;
|
|
110
|
+
updateFacet.facetValues = data[apiForFiltering];
|
|
134
111
|
}
|
|
135
112
|
/**
|
|
136
113
|
* add object to facet values
|
|
@@ -41,16 +41,17 @@ const CheckBoxView = ({
|
|
|
41
41
|
field = 'group',
|
|
42
42
|
count = 'subjects',
|
|
43
43
|
customCount = (text) => `(${text})`,
|
|
44
|
+
defaultValue = '',
|
|
44
45
|
} = facet;
|
|
45
46
|
|
|
46
47
|
const indexType = index % 2 === 0 ? 'Even' : 'Odd';
|
|
47
48
|
const checkedSection = `${section}`.toLowerCase().replace(/\ /g, '_');
|
|
48
49
|
|
|
49
|
-
const name = checkboxItem[field] || 'N/A';
|
|
50
|
+
const name = checkboxItem[field] || defaultValue || 'N/A';
|
|
50
51
|
|
|
51
52
|
const handleToggle = () => {
|
|
52
53
|
const toggleCheckBoxItem = {
|
|
53
|
-
name:
|
|
54
|
+
name: checkboxItem[field],
|
|
54
55
|
datafield: datafield,
|
|
55
56
|
isChecked: !isChecked,
|
|
56
57
|
};
|
|
@@ -102,6 +103,7 @@ const CheckBoxView = ({
|
|
|
102
103
|
disableRipple
|
|
103
104
|
color="secondary"
|
|
104
105
|
classes={{ root: classes.checkboxRoot }}
|
|
106
|
+
inputProps={{ 'aria-label': 'Select' }}
|
|
105
107
|
/>
|
|
106
108
|
{ tooltip ? (
|
|
107
109
|
<Tooltip id={datafield} title={tooltip}>
|
|
@@ -14,7 +14,15 @@ const SliderView = ({
|
|
|
14
14
|
onSliderToggle,
|
|
15
15
|
filterState,
|
|
16
16
|
}) => {
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
minLowerBound,
|
|
19
|
+
maxUpperBound,
|
|
20
|
+
quantifier,
|
|
21
|
+
datafield,
|
|
22
|
+
facetValues,
|
|
23
|
+
CustomLowerUpperBound,
|
|
24
|
+
CustomSliderValue,
|
|
25
|
+
} = facet;
|
|
18
26
|
const lowerBoundValue = facetValues[0];
|
|
19
27
|
const upperBoundValue = facetValues[1];
|
|
20
28
|
|
|
@@ -99,24 +107,26 @@ const SliderView = ({
|
|
|
99
107
|
}}
|
|
100
108
|
/>
|
|
101
109
|
</div>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
{typeof CustomLowerUpperBound === 'function' ? (
|
|
111
|
+
CustomLowerUpperBound({ minLowerBound, maxUpperBound, classes })
|
|
112
|
+
) : (
|
|
113
|
+
<Box className={classes.lowerUpperBound}>
|
|
114
|
+
<Typography className={classes.lowerBound}>
|
|
115
|
+
{minLowerBound}
|
|
116
|
+
</Typography>
|
|
117
|
+
<Typography className={classes.upperBound}>
|
|
118
|
+
{maxUpperBound}
|
|
119
|
+
</Typography>
|
|
120
|
+
</Box>
|
|
121
|
+
)}
|
|
110
122
|
</div>
|
|
111
123
|
{/* Change to red if invalid range */}
|
|
112
|
-
{
|
|
113
|
-
(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
: classes.invalidSliderText}
|
|
119
|
-
>
|
|
124
|
+
{typeof CustomSliderValue === 'function' ? (
|
|
125
|
+
CustomSliderValue({
|
|
126
|
+
sliderValue, minLowerBound, maxUpperBound, isValid, quantifier, classes })
|
|
127
|
+
) : (
|
|
128
|
+
(sliderValue[0] > minLowerBound || sliderValue[1] < maxUpperBound) && (
|
|
129
|
+
<Typography className={isValid() ? classes.sliderText : classes.invalidSliderText}>
|
|
120
130
|
{sliderValue[0]}
|
|
121
131
|
{' - '}
|
|
122
132
|
{sliderValue[1]}
|
|
@@ -124,7 +134,7 @@ const SliderView = ({
|
|
|
124
134
|
{quantifier}
|
|
125
135
|
</Typography>
|
|
126
136
|
)
|
|
127
|
-
}
|
|
137
|
+
)}
|
|
128
138
|
</>
|
|
129
139
|
);
|
|
130
140
|
};
|
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
|
-
|
|
76
|
-
return
|
|
75
|
+
const sortedValues = sortByCheckedItem([...sortfacetValues]);
|
|
76
|
+
return sortedValues;
|
|
77
77
|
};
|