@bento-core/query-bar 0.2.0 → 0.3.0
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
|
@@ -25,14 +25,14 @@ See below for usage instructions.
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
// Use the component (e.g. In dashTemplateView.js)
|
|
28
|
-
const Layout = (
|
|
28
|
+
const Layout = ({ classes, data, states, /* ... */}) => {
|
|
29
29
|
return (
|
|
30
30
|
{/* other components */}
|
|
31
31
|
<div className={classes.rightContent}>
|
|
32
32
|
<div className={classes.widgetsContainer}>
|
|
33
33
|
{/* other components */}
|
|
34
34
|
|
|
35
|
-
<QueryBar />
|
|
35
|
+
<QueryBar statusReducer={null} localFind={null} />
|
|
36
36
|
|
|
37
37
|
{/* other components */}
|
|
38
38
|
</div>
|
|
@@ -42,6 +42,7 @@ See below for usage instructions.
|
|
|
42
42
|
};
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
> **Warning**: The `statusReducer` prop requires the dashboard API data merged with the `facetsConfig` property. Please see the example in the demo implementation [here](https://github.com/CBIIT/bento-frontend/blob/7efd62cd3da0c29326e523055d30118244dc2f2f/packages/bento-frontend/src/pages/dashTemplate/filterQueryBar/QueryBarView.js#LL20C14-L20C14).
|
|
45
46
|
</details>
|
|
46
47
|
|
|
47
48
|
## Generator Configuration
|
|
@@ -137,3 +138,5 @@ This component, which is generated by the provided generator, accepts the follow
|
|
|
137
138
|
classes={undefined} // {object} - The Material UI classes object. Overrides default styling for provided classes.
|
|
138
139
|
/>
|
|
139
140
|
```
|
|
141
|
+
|
|
142
|
+
> **Warning**: The `statusReducer` prop requires the dashboard API data merged with the `facetsConfig` property. Please see the example in the demo implementation [here](https://github.com/CBIIT/bento-frontend/blob/7efd62cd3da0c29326e523055d30118244dc2f2f/packages/bento-frontend/src/pages/dashTemplate/filterQueryBar/QueryBarView.js#LL20C14-L20C14).
|
|
@@ -59,10 +59,22 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
59
59
|
if (facet.type !== CHECKBOX) {
|
|
60
60
|
return facet;
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
return _objectSpread(_objectSpread({}, facet), {}, {
|
|
62
|
+
const {
|
|
63
|
+
data,
|
|
65
64
|
items
|
|
65
|
+
} = facet;
|
|
66
|
+
const itemKeys = Object.keys(items);
|
|
67
|
+
itemKeys.sort((a, b) => a.localeCompare(b));
|
|
68
|
+
|
|
69
|
+
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
70
|
+
* and remove them from the list of selected checkboxes artificially */
|
|
71
|
+
itemKeys.forEach(item => {
|
|
72
|
+
if (data.findIndex(d => d.group === item) < 0) {
|
|
73
|
+
itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return _objectSpread(_objectSpread({}, facet), {}, {
|
|
77
|
+
items: itemKeys
|
|
66
78
|
});
|
|
67
79
|
}).filter(facet => facet.items.length > 0);
|
|
68
80
|
if ((mappedInputs.length || autocomplete.length || upload.length) <= 0) {
|
package/package.json
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/query-bar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
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
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"lint": "eslint src"
|
|
9
10
|
},
|
|
10
11
|
"repository": "https://github.com/CBIIT/bento-frontend",
|
|
11
12
|
"publishConfig": {
|
|
12
13
|
"access": "public"
|
|
13
14
|
},
|
|
14
15
|
"peerDependencies": {
|
|
15
|
-
"@bento-core/facet-filter": "*",
|
|
16
16
|
"@material-ui/core": "^4.10.0",
|
|
17
|
-
"clsx": "
|
|
17
|
+
"clsx": "^1.2.1",
|
|
18
18
|
"react": "^17.0.2",
|
|
19
19
|
"react-dom": "^17.0.0",
|
|
20
20
|
"react-redux": "^7.2.1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@bento-core/facet-filter": "^0.3.0",
|
|
23
24
|
"lodash": "^4.17.20"
|
|
24
25
|
},
|
|
25
26
|
"author": "CTOS Bento Team",
|
|
26
27
|
"license": "ISC",
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "9b75062e5092b403db02b167870ea4331361c26f"
|
|
28
29
|
}
|
|
@@ -59,10 +59,19 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
59
59
|
.map((facet) => {
|
|
60
60
|
if (facet.type !== CHECKBOX) { return facet; }
|
|
61
61
|
|
|
62
|
-
const items =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const { data, items } = facet;
|
|
63
|
+
const itemKeys = Object.keys(items);
|
|
64
|
+
itemKeys.sort((a, b) => a.localeCompare(b));
|
|
65
|
+
|
|
66
|
+
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
67
|
+
* and remove them from the list of selected checkboxes artificially */
|
|
68
|
+
itemKeys.forEach((item) => {
|
|
69
|
+
if (data.findIndex((d) => d.group === item) < 0) {
|
|
70
|
+
itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return { ...facet, items: itemKeys };
|
|
66
75
|
})
|
|
67
76
|
.filter((facet) => facet.items.length > 0);
|
|
68
77
|
|