@bento-core/query-bar 1.0.1-icdc.2 → 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,8 +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
|
|
41
|
+
|
|
42
|
+
// const group = config && typeof config.group === 'string'
|
|
43
|
+
// ? config.group : DEFAULT_CONFIG.config.group;
|
|
44
|
+
|
|
43
45
|
const clearAll = functions && typeof functions.clearAll === 'function' ? functions.clearAll : _config.default.functions.clearAll;
|
|
44
46
|
const clearUpload = functions && typeof functions.clearUpload === 'function' ? functions.clearUpload : _config.default.functions.clearUpload;
|
|
45
47
|
const clearAutocomplete = functions && typeof functions.clearAutocomplete === 'function' ? functions.clearAutocomplete : _config.default.functions.clearAutocomplete;
|
|
@@ -78,7 +80,6 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
78
80
|
return facet;
|
|
79
81
|
}
|
|
80
82
|
const {
|
|
81
|
-
data,
|
|
82
83
|
items
|
|
83
84
|
} = facet;
|
|
84
85
|
const itemKeys = Object.keys(items);
|
|
@@ -86,29 +87,19 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
86
87
|
|
|
87
88
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
88
89
|
* and remove them from the list of selected checkboxes artificially */
|
|
89
|
-
itemKeys.forEach(item => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
|
|
90
|
+
// itemKeys.forEach((item) => {
|
|
91
|
+
// if (data.findIndex((d) => d.group === item) < 0) {
|
|
92
|
+
// itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
93
|
+
// }
|
|
94
|
+
// });
|
|
95
|
+
|
|
95
96
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* 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
|
|
100
100
|
*/
|
|
101
|
-
// const { group, count } = config;
|
|
102
|
-
const displayItems = itemKeys.reduce((accumulator, item) => {
|
|
103
|
-
const itemList = data.filter(d => d[group] === item && d[count] > 0) || [];
|
|
104
|
-
if (itemList.length > 0) {
|
|
105
|
-
const labels = itemList.map(filter => filter[group]);
|
|
106
|
-
accumulator.push(labels);
|
|
107
|
-
}
|
|
108
|
-
return accumulator;
|
|
109
|
-
}, []);
|
|
110
101
|
return _objectSpread(_objectSpread({}, facet), {}, {
|
|
111
|
-
items:
|
|
102
|
+
items: itemKeys
|
|
112
103
|
});
|
|
113
104
|
}).filter(facet => facet.items.length > 0);
|
|
114
105
|
if ((mappedInputs.length || autocomplete.length || upload.length) <= 0) {
|
|
@@ -22,12 +22,7 @@ var _default = {
|
|
|
22
22
|
* key to access label text
|
|
23
23
|
* @var {boolean}
|
|
24
24
|
*/
|
|
25
|
-
group: 'group'
|
|
26
|
-
/**
|
|
27
|
-
* key to access count value
|
|
28
|
-
* @var {boolean}
|
|
29
|
-
*/
|
|
30
|
-
count: 'subjects'
|
|
25
|
+
group: 'group'
|
|
31
26
|
},
|
|
32
27
|
/* Component Helper Functions */
|
|
33
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,11 +27,8 @@ 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
|
-
|
|
32
|
-
|
|
33
|
-
const count = config && typeof config.count === 'string'
|
|
34
|
-
? config.count : DEFAULT_CONFIG.config.count;
|
|
30
|
+
// const group = config && typeof config.group === 'string'
|
|
31
|
+
// ? config.group : DEFAULT_CONFIG.config.group;
|
|
35
32
|
|
|
36
33
|
const clearAll = functions && typeof functions.clearAll === 'function'
|
|
37
34
|
? functions.clearAll
|
|
@@ -83,35 +80,24 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
83
80
|
.map((facet) => {
|
|
84
81
|
if (facet.type !== CHECKBOX) { return facet; }
|
|
85
82
|
|
|
86
|
-
const {
|
|
83
|
+
const { items } = facet;
|
|
87
84
|
const itemKeys = Object.keys(items);
|
|
88
85
|
itemKeys.sort((a, b) => a.localeCompare(b));
|
|
89
86
|
|
|
90
87
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
91
88
|
* and remove them from the list of selected checkboxes artificially */
|
|
92
|
-
itemKeys.forEach((item) => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
});
|
|
97
|
-
|
|
89
|
+
// itemKeys.forEach((item) => {
|
|
90
|
+
// if (data.findIndex((d) => d.group === item) < 0) {
|
|
91
|
+
// itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
92
|
+
// }
|
|
93
|
+
// });
|
|
94
|
+
|
|
98
95
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* 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
|
|
103
99
|
*/
|
|
104
|
-
|
|
105
|
-
const displayItems = itemKeys.reduce((accumulator, item) => {
|
|
106
|
-
const itemList = data.filter((d) => (d[group] === item && d[count] > 0)) || [];
|
|
107
|
-
if (itemList.length > 0) {
|
|
108
|
-
const labels = itemList.map((filter) => filter[group]);
|
|
109
|
-
accumulator.push(labels);
|
|
110
|
-
}
|
|
111
|
-
return accumulator;
|
|
112
|
-
}, []);
|
|
113
|
-
|
|
114
|
-
return { ...facet, items: displayItems };
|
|
100
|
+
return { ...facet, items: itemKeys };
|
|
115
101
|
})
|
|
116
102
|
.filter((facet) => facet.items.length > 0);
|
|
117
103
|
|