@bento-core/facet-filter 1.0.1-ctdc.1 → 1.0.1-ctdc.3
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.
|
@@ -59,7 +59,8 @@ const FacetView = _ref => {
|
|
|
59
59
|
*/
|
|
60
60
|
const {
|
|
61
61
|
type,
|
|
62
|
-
facetValues
|
|
62
|
+
facetValues,
|
|
63
|
+
displayFacetCount = true
|
|
63
64
|
} = facet;
|
|
64
65
|
const selectedItems = facetValues && facetValues.filter(item => item.isChecked);
|
|
65
66
|
const displayFacet = _objectSpread({}, facet);
|
|
@@ -107,7 +108,7 @@ const FacetView = _ref => {
|
|
|
107
108
|
onClick: () => {
|
|
108
109
|
onSortFacet(_Sort.sortType.ALPHABET);
|
|
109
110
|
}
|
|
110
|
-
}, "Sort alphabetically"), /*#__PURE__*/_react.default.createElement("span", {
|
|
111
|
+
}, "Sort alphabetically"), displayFacetCount && /*#__PURE__*/_react.default.createElement("span", {
|
|
111
112
|
className: (0, _clsx.default)(classes.sortGroupItemCounts, {
|
|
112
113
|
[classes.highlight]: sortBy === _Sort.sortType.NUMERIC
|
|
113
114
|
}),
|
|
@@ -37,11 +37,13 @@ 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 = '',
|
|
42
|
+
displayFacetCount = true
|
|
41
43
|
} = facet;
|
|
42
44
|
const indexType = index % 2 === 0 ? 'Even' : 'Odd';
|
|
43
45
|
const checkedSection = "".concat(section).toLowerCase().replace(/\ /g, '_');
|
|
44
|
-
const name = checkboxItem[field] || 'N/A';
|
|
46
|
+
const name = checkboxItem[field] || defaultValue || 'N/A';
|
|
45
47
|
const handleToggle = () => {
|
|
46
48
|
const toggleCheckBoxItem = {
|
|
47
49
|
name: checkboxItem[field],
|
|
@@ -101,7 +103,7 @@ const CheckBoxView = _ref => {
|
|
|
101
103
|
className: datafield
|
|
102
104
|
}, name)) : /*#__PURE__*/_react.default.createElement(LabelComponent, null), /*#__PURE__*/_react.default.createElement(_core.ListItemText, {
|
|
103
105
|
className: "".concat(checkedSection, "_md_space")
|
|
104
|
-
}), /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
106
|
+
}), displayFacetCount && /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
105
107
|
className: (0, _clsx.default)("".concat(checkedSection, "Subjects"), {
|
|
106
108
|
["".concat(checkedSection, "SubjectUnChecked")]: !isChecked,
|
|
107
109
|
["".concat(checkedSection, "SubjectChecked")]: isChecked
|
package/package.json
CHANGED
|
@@ -51,7 +51,7 @@ const FacetView = ({
|
|
|
51
51
|
/**
|
|
52
52
|
* display checked items on facet collapse
|
|
53
53
|
*/
|
|
54
|
-
const { type, facetValues } = facet;
|
|
54
|
+
const { type, facetValues, displayFacetCount = true } = facet;
|
|
55
55
|
const selectedItems = facetValues && facetValues.filter((item) => item.isChecked);
|
|
56
56
|
const displayFacet = { ...facet };
|
|
57
57
|
displayFacet.facetValues = selectedItems;
|
|
@@ -135,18 +135,20 @@ const FacetView = ({
|
|
|
135
135
|
>
|
|
136
136
|
Sort alphabetically
|
|
137
137
|
</span>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
{ displayFacetCount && (
|
|
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
|
+
)}
|
|
150
152
|
</>
|
|
151
153
|
)}
|
|
152
154
|
</div>
|
|
@@ -41,12 +41,14 @@ const CheckBoxView = ({
|
|
|
41
41
|
field = 'group',
|
|
42
42
|
count = 'subjects',
|
|
43
43
|
customCount = (text) => `(${text})`,
|
|
44
|
+
defaultValue = '',
|
|
45
|
+
displayFacetCount = true,
|
|
44
46
|
} = facet;
|
|
45
47
|
|
|
46
48
|
const indexType = index % 2 === 0 ? 'Even' : 'Odd';
|
|
47
49
|
const checkedSection = `${section}`.toLowerCase().replace(/\ /g, '_');
|
|
48
50
|
|
|
49
|
-
const name = checkboxItem[field] || 'N/A';
|
|
51
|
+
const name = checkboxItem[field] || defaultValue || 'N/A';
|
|
50
52
|
|
|
51
53
|
const handleToggle = () => {
|
|
52
54
|
const toggleCheckBoxItem = {
|
|
@@ -114,14 +116,16 @@ const CheckBoxView = ({
|
|
|
114
116
|
<LabelComponent />
|
|
115
117
|
)}
|
|
116
118
|
<ListItemText className={`${checkedSection}_md_space`} />
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
{ displayFacetCount && (
|
|
120
|
+
<Typography
|
|
121
|
+
className={clsx(`${checkedSection}Subjects`, {
|
|
122
|
+
[`${checkedSection}SubjectUnChecked`]: !isChecked,
|
|
123
|
+
[`${checkedSection}SubjectChecked`]: isChecked,
|
|
124
|
+
})}
|
|
125
|
+
>
|
|
126
|
+
{customCount(checkboxItem[count] || 0)}
|
|
127
|
+
</Typography>
|
|
128
|
+
)}
|
|
125
129
|
</ListItem>
|
|
126
130
|
<Divider
|
|
127
131
|
style={{
|