@bento-core/query-bar 1.0.1-icdc.1 → 1.0.1-icdc.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.
package/README.md
CHANGED
|
@@ -58,6 +58,16 @@ const CONFIG = {
|
|
|
58
58
|
* @var {number}
|
|
59
59
|
*/
|
|
60
60
|
maxItems: 2,
|
|
61
|
+
/**
|
|
62
|
+
* overirdes maxItems to display all the active filter items
|
|
63
|
+
* @var {boolean}
|
|
64
|
+
*/
|
|
65
|
+
displayAllActiveFilters: false,
|
|
66
|
+
/**
|
|
67
|
+
* key to access label text
|
|
68
|
+
* @var {boolean}
|
|
69
|
+
*/
|
|
70
|
+
group: 'group',
|
|
61
71
|
},
|
|
62
72
|
|
|
63
73
|
/* Component Helper Functions */
|
|
@@ -38,6 +38,10 @@ 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
|
+
|
|
42
|
+
// const group = config && typeof config.group === 'string'
|
|
43
|
+
// ? config.group : DEFAULT_CONFIG.config.group;
|
|
44
|
+
|
|
41
45
|
const clearAll = functions && typeof functions.clearAll === 'function' ? functions.clearAll : _config.default.functions.clearAll;
|
|
42
46
|
const clearUpload = functions && typeof functions.clearUpload === 'function' ? functions.clearUpload : _config.default.functions.clearUpload;
|
|
43
47
|
const clearAutocomplete = functions && typeof functions.clearAutocomplete === 'function' ? functions.clearAutocomplete : _config.default.functions.clearAutocomplete;
|
|
@@ -76,7 +80,6 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
76
80
|
return facet;
|
|
77
81
|
}
|
|
78
82
|
const {
|
|
79
|
-
data,
|
|
80
83
|
items
|
|
81
84
|
} = facet;
|
|
82
85
|
const itemKeys = Object.keys(items);
|
|
@@ -84,28 +87,19 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
84
87
|
|
|
85
88
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
86
89
|
* and remove them from the list of selected checkboxes artificially */
|
|
87
|
-
itemKeys.forEach(item => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
});
|
|
92
|
-
|
|
90
|
+
// itemKeys.forEach((item) => {
|
|
91
|
+
// if (data.findIndex((d) => d.group === item) < 0) {
|
|
92
|
+
// itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
93
|
+
// }
|
|
94
|
+
// });
|
|
95
|
+
|
|
93
96
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* behavior similar to filter component
|
|
97
|
+
* commenting out line 89-93
|
|
98
|
+
* to display all the active filters in the query bar
|
|
99
|
+
* ICDC-3287
|
|
98
100
|
*/
|
|
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
101
|
return _objectSpread(_objectSpread({}, facet), {}, {
|
|
108
|
-
items:
|
|
102
|
+
items: itemKeys
|
|
109
103
|
});
|
|
110
104
|
}).filter(facet => facet.items.length > 0);
|
|
111
105
|
if ((mappedInputs.length || autocomplete.length || upload.length) <= 0) {
|
|
@@ -17,7 +17,12 @@ var _default = {
|
|
|
17
17
|
* overirdes maxItems to display all the active filter items
|
|
18
18
|
* @var {boolean}
|
|
19
19
|
*/
|
|
20
|
-
displayAllActiveFilters: false
|
|
20
|
+
displayAllActiveFilters: false,
|
|
21
|
+
/**
|
|
22
|
+
* key to access label text
|
|
23
|
+
* @var {boolean}
|
|
24
|
+
*/
|
|
25
|
+
group: 'group'
|
|
21
26
|
},
|
|
22
27
|
/* Component Helper Functions */
|
|
23
28
|
functions: {
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/query-bar",
|
|
3
|
-
"version": "1.0.1-icdc.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.1-icdc.3",
|
|
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,10 +24,5 @@
|
|
|
27
24
|
"lodash": "^4.17.20"
|
|
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",
|
|
35
|
-
"devDependencies": {}
|
|
27
|
+
"license": "ISC"
|
|
36
28
|
}
|
|
@@ -27,6 +27,9 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
27
27
|
? config.displayAllActiveFilters
|
|
28
28
|
: DEFAULT_CONFIG.config.displayAllActiveFilters;
|
|
29
29
|
|
|
30
|
+
// const group = config && typeof config.group === 'string'
|
|
31
|
+
// ? config.group : DEFAULT_CONFIG.config.group;
|
|
32
|
+
|
|
30
33
|
const clearAll = functions && typeof functions.clearAll === 'function'
|
|
31
34
|
? functions.clearAll
|
|
32
35
|
: DEFAULT_CONFIG.functions.clearAll;
|
|
@@ -77,34 +80,24 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
77
80
|
.map((facet) => {
|
|
78
81
|
if (facet.type !== CHECKBOX) { return facet; }
|
|
79
82
|
|
|
80
|
-
const {
|
|
83
|
+
const { items } = facet;
|
|
81
84
|
const itemKeys = Object.keys(items);
|
|
82
85
|
itemKeys.sort((a, b) => a.localeCompare(b));
|
|
83
86
|
|
|
84
87
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
85
88
|
* and remove them from the list of selected checkboxes artificially */
|
|
86
|
-
itemKeys.forEach((item) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
|
|
89
|
+
// itemKeys.forEach((item) => {
|
|
90
|
+
// if (data.findIndex((d) => d.group === item) < 0) {
|
|
91
|
+
// itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
92
|
+
// }
|
|
93
|
+
// });
|
|
94
|
+
|
|
92
95
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* behavior similar to filter component
|
|
96
|
+
* commenting out line 89-93
|
|
97
|
+
* to display all the active filters in the query bar
|
|
98
|
+
* ICDC-3287
|
|
97
99
|
*/
|
|
98
|
-
|
|
99
|
-
const itemList = data.filter((d) => (d.group === item && d.count > 0)) || [];
|
|
100
|
-
if (itemList.length > 0) {
|
|
101
|
-
const labels = itemList.map((filter) => filter.group);
|
|
102
|
-
accumulator.push(labels);
|
|
103
|
-
}
|
|
104
|
-
return accumulator;
|
|
105
|
-
}, []);
|
|
106
|
-
|
|
107
|
-
return { ...facet, items: displayItems };
|
|
100
|
+
return { ...facet, items: itemKeys };
|
|
108
101
|
})
|
|
109
102
|
.filter((facet) => facet.items.length > 0);
|
|
110
103
|
|