@bento-core/query-bar 1.0.1-ins.5 → 1.0.1-ins.6
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.
|
@@ -38,8 +38,6 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
38
38
|
const styles = () => _objectSpread(_objectSpread({}, (0, _styles.default)()), customStyles);
|
|
39
39
|
const maxItems = config && typeof config.maxItems === 'number' ? config.maxItems : _config.default.config.maxItems;
|
|
40
40
|
const displayAllActiveFilters = config && typeof config.displayAllActiveFilters === 'boolean' ? config.displayAllActiveFilters : _config.default.config.displayAllActiveFilters;
|
|
41
|
-
const group = config && typeof config.group === 'string' ? config.group : _config.default.config.group;
|
|
42
|
-
const count = config && typeof config.count === 'string' ? config.count : _config.default.config.count;
|
|
43
41
|
const clearAll = functions && typeof functions.clearAll === 'function' ? functions.clearAll : _config.default.functions.clearAll;
|
|
44
42
|
const clearUpload = functions && typeof functions.clearUpload === 'function' ? functions.clearUpload : _config.default.functions.clearUpload;
|
|
45
43
|
const clearAutocomplete = functions && typeof functions.clearAutocomplete === 'function' ? functions.clearAutocomplete : _config.default.functions.clearAutocomplete;
|
|
@@ -78,7 +76,6 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
78
76
|
return facet;
|
|
79
77
|
}
|
|
80
78
|
const {
|
|
81
|
-
data,
|
|
82
79
|
items
|
|
83
80
|
} = facet;
|
|
84
81
|
const itemKeys = Object.keys(items);
|
|
@@ -86,11 +83,11 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
86
83
|
|
|
87
84
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
88
85
|
* and remove them from the list of selected checkboxes artificially */
|
|
89
|
-
itemKeys.forEach(item => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
86
|
+
// itemKeys.forEach((item) => {
|
|
87
|
+
// if (data.findIndex((d) => d.group === item) < 0) {
|
|
88
|
+
// itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
89
|
+
// }
|
|
90
|
+
// });
|
|
94
91
|
// return { ...facet, items: itemKeys };
|
|
95
92
|
/**
|
|
96
93
|
* Maintain consistant behavior with facet filter component
|
|
@@ -99,16 +96,17 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
99
96
|
* behavior similar to filter component
|
|
100
97
|
*/
|
|
101
98
|
// const { group, count } = config;
|
|
102
|
-
const displayItems = itemKeys.reduce((accumulator, item) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}, []);
|
|
99
|
+
// const displayItems = itemKeys.reduce((accumulator, item) => {
|
|
100
|
+
// const itemList = data.filter((d) => (d[group] === item && d[count] > 0)) || [];
|
|
101
|
+
// if (itemList.length > 0) {
|
|
102
|
+
// const labels = itemList.map((filter) => filter[group]);
|
|
103
|
+
// accumulator.push(labels);
|
|
104
|
+
// }
|
|
105
|
+
// return accumulator;
|
|
106
|
+
// }, []);
|
|
107
|
+
|
|
110
108
|
return _objectSpread(_objectSpread({}, facet), {}, {
|
|
111
|
-
items:
|
|
109
|
+
items: itemKeys
|
|
112
110
|
});
|
|
113
111
|
}).filter(facet => facet.items.length > 0);
|
|
114
112
|
if ((mappedInputs.length || autocomplete.length || upload.length) <= 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/query-bar",
|
|
3
|
-
"version": "1.0.1-ins.
|
|
3
|
+
"version": "1.0.1-ins.6",
|
|
4
4
|
"description": "This package provides the Query Bar component that displays the current Facet Search and Local Find filters on the Dashboard/Explore page. It also provides the direct ability to reset all or some of the filters with the click of a button. It is designed to be implemented directly with the:",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-redux": "^7.2.1"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@bento-core/facet-filter": "1.0.1-ins.
|
|
26
|
+
"@bento-core/facet-filter": "1.0.1-ins.2",
|
|
27
27
|
"lodash": "^4.17.20"
|
|
28
28
|
},
|
|
29
29
|
"author": "CTOS Bento Team",
|
|
@@ -28,12 +28,6 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
28
28
|
? config.displayAllActiveFilters
|
|
29
29
|
: DEFAULT_CONFIG.config.displayAllActiveFilters;
|
|
30
30
|
|
|
31
|
-
const group = config && typeof config.group === 'string'
|
|
32
|
-
? config.group : DEFAULT_CONFIG.config.group;
|
|
33
|
-
|
|
34
|
-
const count = config && typeof config.count === 'string'
|
|
35
|
-
? config.count : DEFAULT_CONFIG.config.count;
|
|
36
|
-
|
|
37
31
|
const clearAll = functions && typeof functions.clearAll === 'function'
|
|
38
32
|
? functions.clearAll
|
|
39
33
|
: DEFAULT_CONFIG.functions.clearAll;
|
|
@@ -84,17 +78,17 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
84
78
|
.map((facet) => {
|
|
85
79
|
if (facet.type !== CHECKBOX) { return facet; }
|
|
86
80
|
|
|
87
|
-
const {
|
|
81
|
+
const { items } = facet;
|
|
88
82
|
const itemKeys = Object.keys(items);
|
|
89
83
|
itemKeys.sort((a, b) => a.localeCompare(b));
|
|
90
84
|
|
|
91
85
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
92
86
|
* and remove them from the list of selected checkboxes artificially */
|
|
93
|
-
itemKeys.forEach((item) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
87
|
+
// itemKeys.forEach((item) => {
|
|
88
|
+
// if (data.findIndex((d) => d.group === item) < 0) {
|
|
89
|
+
// itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
90
|
+
// }
|
|
91
|
+
// });
|
|
98
92
|
// return { ...facet, items: itemKeys };
|
|
99
93
|
/**
|
|
100
94
|
* Maintain consistant behavior with facet filter component
|
|
@@ -103,16 +97,16 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
103
97
|
* behavior similar to filter component
|
|
104
98
|
*/
|
|
105
99
|
// const { group, count } = config;
|
|
106
|
-
const displayItems = itemKeys.reduce((accumulator, item) => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, []);
|
|
114
|
-
|
|
115
|
-
return { ...facet, items:
|
|
100
|
+
// const displayItems = itemKeys.reduce((accumulator, item) => {
|
|
101
|
+
// const itemList = data.filter((d) => (d[group] === item && d[count] > 0)) || [];
|
|
102
|
+
// if (itemList.length > 0) {
|
|
103
|
+
// const labels = itemList.map((filter) => filter[group]);
|
|
104
|
+
// accumulator.push(labels);
|
|
105
|
+
// }
|
|
106
|
+
// return accumulator;
|
|
107
|
+
// }, []);
|
|
108
|
+
|
|
109
|
+
return { ...facet, items: itemKeys };
|
|
116
110
|
})
|
|
117
111
|
.filter((facet) => facet.items.length > 0);
|
|
118
112
|
|