@bento-core/facet-filter 1.0.1-ccdihub.29 → 1.0.1-ccdihub.30
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/components/facet/FacetStyle.js +21 -3
- package/dist/components/facet/SearchFacetView.js +17 -4
- package/dist/components/inputs/ModalFilterItems.js +5 -10
- package/dist/components/inputs/SearchFilterItems.js +4 -6
- package/package.json +1 -1
- package/src/components/facet/FacetStyle.js +20 -2
- package/src/components/facet/SearchFacetView.js +30 -3
- package/src/components/inputs/ModalFilterItems.js +8 -11
- package/src/components/inputs/SearchFilterItems.js +7 -9
|
@@ -82,21 +82,32 @@ var _default = () => ({
|
|
|
82
82
|
},
|
|
83
83
|
searchContainer: {
|
|
84
84
|
display: 'flex',
|
|
85
|
-
justifyContent: 'center'
|
|
85
|
+
justifyContent: 'center',
|
|
86
|
+
position: 'relative'
|
|
86
87
|
},
|
|
87
88
|
searchBox: {
|
|
88
89
|
fontSize: '11px',
|
|
89
90
|
fontFamily: 'Nunito',
|
|
90
|
-
width: '
|
|
91
|
+
width: 'calc(100% - 26px)',
|
|
91
92
|
height: '24px',
|
|
92
93
|
marginTop: '12px',
|
|
93
|
-
marginBottom: '5px',
|
|
94
94
|
borderRadius: '8px',
|
|
95
95
|
background: "url(".concat(_Search_Icon.default, ") right 5px center no-repeat"),
|
|
96
96
|
marginLeft: '6px',
|
|
97
97
|
border: '1px solid',
|
|
98
98
|
padding: '5px'
|
|
99
99
|
},
|
|
100
|
+
searchBoxWithText: {
|
|
101
|
+
fontSize: '11px',
|
|
102
|
+
fontFamily: 'Nunito',
|
|
103
|
+
width: 'calc(100% - 26px)',
|
|
104
|
+
height: '24px',
|
|
105
|
+
marginTop: '12px',
|
|
106
|
+
borderRadius: '8px',
|
|
107
|
+
marginLeft: '6px',
|
|
108
|
+
border: '1px solid',
|
|
109
|
+
padding: '5px'
|
|
110
|
+
},
|
|
100
111
|
expandedDisplayButton: {
|
|
101
112
|
background: '#4D889E',
|
|
102
113
|
color: 'white',
|
|
@@ -106,6 +117,13 @@ var _default = () => ({
|
|
|
106
117
|
marginBottom: '5px',
|
|
107
118
|
borderRadius: '8px',
|
|
108
119
|
fontSize: '11px'
|
|
120
|
+
},
|
|
121
|
+
clearTextButton: {
|
|
122
|
+
padding: '0px',
|
|
123
|
+
height: '20px',
|
|
124
|
+
position: 'absolute',
|
|
125
|
+
right: '14px',
|
|
126
|
+
top: '14px'
|
|
109
127
|
}
|
|
110
128
|
});
|
|
111
129
|
exports.default = _default;
|
|
@@ -8,6 +8,7 @@ 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 _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
11
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
13
|
var _AccordionSummaryView = _interopRequireDefault(require("../summary/AccordionSummaryView"));
|
|
13
14
|
var _Types = require("../inputs/Types");
|
|
@@ -87,12 +88,24 @@ const SearchFacetView = _ref => {
|
|
|
87
88
|
}, "No data for this field")), /*#__PURE__*/_react.default.createElement("div", {
|
|
88
89
|
className: classes.searchContainer
|
|
89
90
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
90
|
-
className: classes.searchBox,
|
|
91
|
+
className: searchText && searchText.trim() !== '' ? classes.searchBoxWithText : classes.searchBox,
|
|
91
92
|
value: searchText,
|
|
92
93
|
type: "text",
|
|
93
94
|
placeholder: "e.g. Sarcoma, Neoplasm",
|
|
94
95
|
onChange: e => onSearchTextChange(facet.datafield, e.target.value)
|
|
95
|
-
})
|
|
96
|
+
}), searchText && searchText.trim() !== '' && /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
97
|
+
"aria-label": "close",
|
|
98
|
+
onClick: () => onSearchTextChange(facet.datafield, ''),
|
|
99
|
+
className: classes.clearTextButton,
|
|
100
|
+
sx: theme => ({
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
right: 7,
|
|
103
|
+
top: 7,
|
|
104
|
+
color: theme.palette.grey[500]
|
|
105
|
+
})
|
|
106
|
+
}, /*#__PURE__*/_react.default.createElement(_Close.default, {
|
|
107
|
+
fontSize: "small"
|
|
108
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
96
109
|
className: classes.sortGroup
|
|
97
110
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
98
111
|
className: classes.sortGroupIcon
|
|
@@ -111,14 +124,14 @@ const SearchFacetView = _ref => {
|
|
|
111
124
|
[classes.highlight]: sortBy === _Sort.sortType.ALPHABET
|
|
112
125
|
}),
|
|
113
126
|
onClick: () => {
|
|
114
|
-
onSortChange(_Sort.sortType.ALPHABET);
|
|
127
|
+
onSortChange(facet.datafield, _Sort.sortType.ALPHABET);
|
|
115
128
|
}
|
|
116
129
|
}, "Sort alphabetically"), /*#__PURE__*/_react.default.createElement("span", {
|
|
117
130
|
className: (0, _clsx.default)(classes.sortGroupItemCounts, {
|
|
118
131
|
[classes.highlight]: sortBy === _Sort.sortType.NUMERIC
|
|
119
132
|
}),
|
|
120
133
|
onClick: () => {
|
|
121
|
-
onSortChange(_Sort.sortType.NUMERIC);
|
|
134
|
+
onSortChange(facet.datafield, _Sort.sortType.NUMERIC);
|
|
122
135
|
}
|
|
123
136
|
}, "Sort by count"))), /*#__PURE__*/_react.default.createElement(_SearchFilterItems.default, {
|
|
124
137
|
searchText: searchText,
|
|
@@ -53,12 +53,11 @@ const ModalFilterItems = _ref => {
|
|
|
53
53
|
section
|
|
54
54
|
} = facet;
|
|
55
55
|
const initialItemSize = 40;
|
|
56
|
-
const [total, setTotal] = (0, _react.useState)(0);
|
|
57
56
|
const [displayCount, setDisplayCount] = (0, _react.useState)(initialItemSize);
|
|
58
57
|
const contentRef = (0, _react.useRef)(null);
|
|
59
58
|
const [height, setHeight] = (0, _react.useState)(0);
|
|
60
59
|
const scrollableRef = (0, _react.useRef)(null);
|
|
61
|
-
|
|
60
|
+
const sortFilters = (0, _Sort.sortBySection)(_objectSpread(_objectSpread({}, facet), {}, {
|
|
62
61
|
sortBy
|
|
63
62
|
}));
|
|
64
63
|
const checkedItems = sortFilters.filter(item => item.isChecked).map((item, index) => /*#__PURE__*/_react.default.createElement(_ReduxModalCheckbox.default, {
|
|
@@ -79,7 +78,8 @@ const ModalFilterItems = _ref => {
|
|
|
79
78
|
}));
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
|
-
const
|
|
81
|
+
const newUncheckedFullList = searchItems(sortFilters.filter(item => !item.isChecked), searchText);
|
|
82
|
+
const uncheckedItems = newUncheckedFullList.slice(0, displayCount).map((item, index) => /*#__PURE__*/_react.default.createElement(_ReduxModalCheckbox.default, {
|
|
83
83
|
checkboxItem: _objectSpread(_objectSpread({}, item), {}, {
|
|
84
84
|
index,
|
|
85
85
|
section
|
|
@@ -104,15 +104,10 @@ const ModalFilterItems = _ref => {
|
|
|
104
104
|
}, [checkedItems.length]);
|
|
105
105
|
(0, _react.useEffect)(() => {
|
|
106
106
|
scrollableRef.current.scrollTo(0, 0);
|
|
107
|
-
sortFilters = (0, _Sort.sortBySection)(_objectSpread(_objectSpread({}, facet), {}, {
|
|
108
|
-
sortBy
|
|
109
|
-
}));
|
|
110
|
-
const newUncheckedFullList = searchItems(sortFilters.filter(item => !item.isChecked), searchText);
|
|
111
107
|
setDisplayCount(initialItemSize);
|
|
112
|
-
setTotal(newUncheckedFullList.length);
|
|
113
108
|
}, [searchText, sortBy]);
|
|
114
109
|
const handleScroll = e => {
|
|
115
|
-
if (displayCount <
|
|
110
|
+
if (displayCount < newUncheckedFullList.length) {
|
|
116
111
|
const {
|
|
117
112
|
scrollTop,
|
|
118
113
|
scrollHeight,
|
|
@@ -131,7 +126,7 @@ const ModalFilterItems = _ref => {
|
|
|
131
126
|
className: classes.selectionText
|
|
132
127
|
}, "".concat(checkedItems.length, " selections ")), /*#__PURE__*/_react.default.createElement("span", {
|
|
133
128
|
className: classes.totalText
|
|
134
|
-
}, "of ".concat(
|
|
129
|
+
}, "of ".concat(checkedItems.length + newUncheckedFullList.length, " search results"))), /*#__PURE__*/_react.default.createElement("span", {
|
|
135
130
|
className: classes.sortGroupIcon
|
|
136
131
|
}, /*#__PURE__*/_react.default.createElement(_core.Icon, {
|
|
137
132
|
style: {
|
|
@@ -50,7 +50,6 @@ const SearchFilterItems = _ref => {
|
|
|
50
50
|
section
|
|
51
51
|
} = facet;
|
|
52
52
|
const initialItemSize = 20;
|
|
53
|
-
const [total, setTotal] = (0, _react.useState)(0);
|
|
54
53
|
const [displayCount, setDisplayCount] = (0, _react.useState)(initialItemSize);
|
|
55
54
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
56
55
|
const scrollableRef = (0, _react.useRef)(null);
|
|
@@ -66,7 +65,8 @@ const SearchFilterItems = _ref => {
|
|
|
66
65
|
facet: facet,
|
|
67
66
|
queryParams: queryParams
|
|
68
67
|
}));
|
|
69
|
-
const
|
|
68
|
+
const newUncheckedFullList = searchItems(sortFilters.filter(item => !item.isChecked), searchText);
|
|
69
|
+
const uncheckedItems = newUncheckedFullList.slice(0, displayCount).map((item, index) => /*#__PURE__*/_react.default.createElement(_ReduxSearchCheckbox.default, {
|
|
70
70
|
checkboxItem: _objectSpread(_objectSpread({}, item), {}, {
|
|
71
71
|
index,
|
|
72
72
|
section
|
|
@@ -77,12 +77,10 @@ const SearchFilterItems = _ref => {
|
|
|
77
77
|
}));
|
|
78
78
|
(0, _react.useEffect)(() => {
|
|
79
79
|
scrollableRef.current.scrollTo(0, 0);
|
|
80
|
-
const newUncheckedFullList = searchItems(sortFilters.filter(item => !item.isChecked), searchText);
|
|
81
80
|
setDisplayCount(initialItemSize);
|
|
82
|
-
setTotal(newUncheckedFullList.length);
|
|
83
81
|
}, [searchText]);
|
|
84
82
|
const handleScroll = e => {
|
|
85
|
-
if (displayCount <
|
|
83
|
+
if (displayCount < newUncheckedFullList.length) {
|
|
86
84
|
const {
|
|
87
85
|
scrollTop,
|
|
88
86
|
scrollHeight,
|
|
@@ -109,7 +107,7 @@ const SearchFilterItems = _ref => {
|
|
|
109
107
|
variant: "text",
|
|
110
108
|
className: classes.expandedDisplayButton,
|
|
111
109
|
onClick: () => setOpen(!open)
|
|
112
|
-
}, "VIEW EXPANDED DISPLAY (".concat(checkedItems.length +
|
|
110
|
+
}, "VIEW EXPANDED DISPLAY (".concat(checkedItems.length + newUncheckedFullList.length, ")"))));
|
|
113
111
|
};
|
|
114
112
|
var _default = (0, _core.withStyles)(_FilterItemStyle.default)(SearchFilterItems);
|
|
115
113
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -77,20 +77,31 @@ export default () => ({
|
|
|
77
77
|
searchContainer: {
|
|
78
78
|
display: 'flex',
|
|
79
79
|
justifyContent: 'center',
|
|
80
|
+
position: 'relative',
|
|
80
81
|
},
|
|
81
82
|
searchBox: {
|
|
82
83
|
fontSize: '11px',
|
|
83
84
|
fontFamily: 'Nunito',
|
|
84
|
-
width: '
|
|
85
|
+
width: 'calc(100% - 26px)',
|
|
85
86
|
height: '24px',
|
|
86
87
|
marginTop: '12px',
|
|
87
|
-
marginBottom: '5px',
|
|
88
88
|
borderRadius: '8px',
|
|
89
89
|
background: `url(${SearchIcon}) right 5px center no-repeat`,
|
|
90
90
|
marginLeft: '6px',
|
|
91
91
|
border: '1px solid',
|
|
92
92
|
padding: '5px',
|
|
93
93
|
},
|
|
94
|
+
searchBoxWithText: {
|
|
95
|
+
fontSize: '11px',
|
|
96
|
+
fontFamily: 'Nunito',
|
|
97
|
+
width: 'calc(100% - 26px)',
|
|
98
|
+
height: '24px',
|
|
99
|
+
marginTop: '12px',
|
|
100
|
+
borderRadius: '8px',
|
|
101
|
+
marginLeft: '6px',
|
|
102
|
+
border: '1px solid',
|
|
103
|
+
padding: '5px',
|
|
104
|
+
},
|
|
94
105
|
expandedDisplayButton: {
|
|
95
106
|
background: '#4D889E',
|
|
96
107
|
color: 'white',
|
|
@@ -101,4 +112,11 @@ export default () => ({
|
|
|
101
112
|
borderRadius: '8px',
|
|
102
113
|
fontSize: '11px',
|
|
103
114
|
},
|
|
115
|
+
clearTextButton: {
|
|
116
|
+
padding: '0px',
|
|
117
|
+
height: '20px',
|
|
118
|
+
position: 'absolute',
|
|
119
|
+
right: '14px',
|
|
120
|
+
top: '14px',
|
|
121
|
+
},
|
|
104
122
|
});
|
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
List,
|
|
10
10
|
withStyles,
|
|
11
11
|
Icon,
|
|
12
|
+
IconButton,
|
|
12
13
|
} from '@material-ui/core';
|
|
14
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
13
15
|
import clsx from 'clsx';
|
|
14
16
|
import CustomAccordionSummary from '../summary/AccordionSummaryView';
|
|
15
17
|
import { InputTypes } from '../inputs/Types';
|
|
@@ -101,7 +103,32 @@ const SearchFacetView = ({
|
|
|
101
103
|
)
|
|
102
104
|
}
|
|
103
105
|
<div className={classes.searchContainer}>
|
|
104
|
-
<input
|
|
106
|
+
<input
|
|
107
|
+
className={searchText && searchText.trim() !== '' ? classes.searchBoxWithText : classes.searchBox}
|
|
108
|
+
value={searchText}
|
|
109
|
+
type="text"
|
|
110
|
+
placeholder="e.g. Sarcoma, Neoplasm"
|
|
111
|
+
onChange={(e) => onSearchTextChange(facet.datafield, e.target.value)}
|
|
112
|
+
/>
|
|
113
|
+
{
|
|
114
|
+
searchText
|
|
115
|
+
&& searchText.trim() !== ''
|
|
116
|
+
&& (
|
|
117
|
+
<IconButton
|
|
118
|
+
aria-label="close"
|
|
119
|
+
onClick={() => onSearchTextChange(facet.datafield, '')}
|
|
120
|
+
className={classes.clearTextButton}
|
|
121
|
+
sx={(theme) => ({
|
|
122
|
+
position: 'absolute',
|
|
123
|
+
right: 7,
|
|
124
|
+
top: 7,
|
|
125
|
+
color: theme.palette.grey[500],
|
|
126
|
+
})}
|
|
127
|
+
>
|
|
128
|
+
<CloseIcon fontSize="small" />
|
|
129
|
+
</IconButton>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
105
132
|
</div>
|
|
106
133
|
<div className={classes.sortGroup}>
|
|
107
134
|
<span className={classes.sortGroupIcon}>
|
|
@@ -128,7 +155,7 @@ const SearchFacetView = ({
|
|
|
128
155
|
})
|
|
129
156
|
}
|
|
130
157
|
onClick={() => {
|
|
131
|
-
onSortChange(sortType.ALPHABET);
|
|
158
|
+
onSortChange(facet.datafield, sortType.ALPHABET);
|
|
132
159
|
}}
|
|
133
160
|
>
|
|
134
161
|
Sort alphabetically
|
|
@@ -140,7 +167,7 @@ const SearchFacetView = ({
|
|
|
140
167
|
})
|
|
141
168
|
}
|
|
142
169
|
onClick={() => {
|
|
143
|
-
onSortChange(sortType.NUMERIC);
|
|
170
|
+
onSortChange(facet.datafield, sortType.NUMERIC);
|
|
144
171
|
}}
|
|
145
172
|
>
|
|
146
173
|
Sort by count
|
|
@@ -44,12 +44,11 @@ const ModalFilterItems = ({
|
|
|
44
44
|
datafield, section,
|
|
45
45
|
} = facet;
|
|
46
46
|
const initialItemSize = 40;
|
|
47
|
-
const [total, setTotal] = useState(0);
|
|
48
47
|
const [displayCount, setDisplayCount] = useState(initialItemSize);
|
|
49
48
|
const contentRef = useRef(null);
|
|
50
49
|
const [height, setHeight] = useState(0);
|
|
51
50
|
const scrollableRef = useRef(null);
|
|
52
|
-
|
|
51
|
+
const sortFilters = sortBySection({ ...facet, sortBy });
|
|
53
52
|
|
|
54
53
|
const checkedItems = sortFilters.filter((item) => item.isChecked)
|
|
55
54
|
.map((item, index) => (<ReduxModalCheckbox
|
|
@@ -66,9 +65,11 @@ const ModalFilterItems = ({
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
const
|
|
70
|
-
searchText)
|
|
71
|
-
|
|
68
|
+
const newUncheckedFullList = searchItems(sortFilters.filter((item) => !item.isChecked),
|
|
69
|
+
searchText);
|
|
70
|
+
|
|
71
|
+
const uncheckedItems = newUncheckedFullList.slice(0, displayCount)
|
|
72
|
+
.map((item, index) => (<ReduxModalCheckbox
|
|
72
73
|
checkboxItem={{ ...item, index, section }}
|
|
73
74
|
datafield={datafield}
|
|
74
75
|
facet={facet}
|
|
@@ -90,15 +91,11 @@ const ModalFilterItems = ({
|
|
|
90
91
|
|
|
91
92
|
useEffect(() => {
|
|
92
93
|
scrollableRef.current.scrollTo(0, 0);
|
|
93
|
-
sortFilters = sortBySection({ ...facet, sortBy });
|
|
94
|
-
const newUncheckedFullList = searchItems(sortFilters.filter((item) => !item.isChecked),
|
|
95
|
-
searchText);
|
|
96
94
|
setDisplayCount(initialItemSize);
|
|
97
|
-
setTotal(newUncheckedFullList.length);
|
|
98
95
|
}, [searchText, sortBy]);
|
|
99
96
|
|
|
100
97
|
const handleScroll = (e) => {
|
|
101
|
-
if (displayCount <
|
|
98
|
+
if (displayCount < newUncheckedFullList.length) {
|
|
102
99
|
const { scrollTop, scrollHeight, clientHeight } = e.target;
|
|
103
100
|
const position = Math.ceil((scrollTop / (scrollHeight - clientHeight)) * 100);
|
|
104
101
|
// console.log('position:', position);
|
|
@@ -113,7 +110,7 @@ const ModalFilterItems = ({
|
|
|
113
110
|
<div className={classes.sortingContainer}>
|
|
114
111
|
<div>
|
|
115
112
|
<span className={classes.selectionText}>{`${checkedItems.length} selections `}</span>
|
|
116
|
-
<span className={classes.totalText}>{`of ${
|
|
113
|
+
<span className={classes.totalText}>{`of ${checkedItems.length + newUncheckedFullList.length} search results`}</span>
|
|
117
114
|
</div>
|
|
118
115
|
<span className={classes.sortGroupIcon}>
|
|
119
116
|
<Icon
|
|
@@ -41,7 +41,6 @@ const SearchFilterItems = ({
|
|
|
41
41
|
datafield, section,
|
|
42
42
|
} = facet;
|
|
43
43
|
const initialItemSize = 20;
|
|
44
|
-
const [total, setTotal] = useState(0);
|
|
45
44
|
const [displayCount, setDisplayCount] = useState(initialItemSize);
|
|
46
45
|
const [open, setOpen] = useState(false);
|
|
47
46
|
const scrollableRef = useRef(null);
|
|
@@ -55,9 +54,11 @@ const SearchFilterItems = ({
|
|
|
55
54
|
queryParams={queryParams}
|
|
56
55
|
/>));
|
|
57
56
|
|
|
58
|
-
const
|
|
59
|
-
searchText)
|
|
60
|
-
|
|
57
|
+
const newUncheckedFullList = searchItems(sortFilters.filter((item) => !item.isChecked),
|
|
58
|
+
searchText);
|
|
59
|
+
|
|
60
|
+
const uncheckedItems = newUncheckedFullList.slice(0, displayCount)
|
|
61
|
+
.map((item, index) => (<ReduxSearchCheckbox
|
|
61
62
|
checkboxItem={{ ...item, index, section }}
|
|
62
63
|
datafield={datafield}
|
|
63
64
|
facet={facet}
|
|
@@ -66,14 +67,11 @@ const SearchFilterItems = ({
|
|
|
66
67
|
|
|
67
68
|
useEffect(() => {
|
|
68
69
|
scrollableRef.current.scrollTo(0, 0);
|
|
69
|
-
const newUncheckedFullList = searchItems(sortFilters.filter((item) => !item.isChecked),
|
|
70
|
-
searchText);
|
|
71
70
|
setDisplayCount(initialItemSize);
|
|
72
|
-
setTotal(newUncheckedFullList.length);
|
|
73
71
|
}, [searchText]);
|
|
74
72
|
|
|
75
73
|
const handleScroll = (e) => {
|
|
76
|
-
if (displayCount <
|
|
74
|
+
if (displayCount < newUncheckedFullList.length) {
|
|
77
75
|
const { scrollTop, scrollHeight, clientHeight } = e.target;
|
|
78
76
|
const position = Math.ceil((scrollTop / (scrollHeight - clientHeight)) * 100);
|
|
79
77
|
if (position >= 90) {
|
|
@@ -100,7 +98,7 @@ const SearchFilterItems = ({
|
|
|
100
98
|
</div>
|
|
101
99
|
<div className={classes.searchContainer}>
|
|
102
100
|
<Button variant="text" className={classes.expandedDisplayButton} onClick={() => setOpen(!open)}>
|
|
103
|
-
{`VIEW EXPANDED DISPLAY (${checkedItems.length +
|
|
101
|
+
{`VIEW EXPANDED DISPLAY (${checkedItems.length + newUncheckedFullList.length})`}
|
|
104
102
|
</Button>
|
|
105
103
|
</div>
|
|
106
104
|
</>
|