@bento-core/query-bar 1.0.1-icdc.3 → 1.0.1-icdc.4
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/dist/assets/CopyIcon.svg +3 -0
- package/dist/components/QueryUrl.js +68 -0
- package/dist/generators/QueryBarGenerator.js +10 -2
- package/dist/generators/config.js +11 -1
- package/dist/generators/styles.js +36 -0
- package/package.json +3 -2
- package/src/assets/CopyIcon.svg +3 -0
- package/src/components/QueryUrl.js +73 -0
- package/src/generators/QueryBarGenerator.js +134 -113
- package/src/generators/config.js +10 -0
- package/src/generators/styles.js +36 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="19" viewBox="0 0 16 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M13 9.75715C13 10.0452 12.78 10.2714 12.5 10.2714H7.5C7.22 10.2714 7 10.0452 7 9.75715C7 9.46915 7.22 9.24287 7.5 9.24287H12.5C12.78 9.24287 13 9.46915 13 9.75715ZM12.5 11.3H7.5C7.22 11.3 7 11.5263 7 11.8143C7 12.1023 7.22 12.3286 7.5 12.3286H12.5C12.78 12.3286 13 12.1023 13 11.8143C13 11.5263 12.78 11.3 12.5 11.3ZM12.5 13.3572H7.5C7.22 13.3572 7 13.5834 7 13.8714C7 14.1594 7.22 14.3857 7.5 14.3857H12.5C12.78 14.3857 13 14.1594 13 13.8714C13 13.5834 12.78 13.3572 12.5 13.3572ZM16 8.21429V16.4429C16 17.5743 15.1 18.5 14 18.5H6C4.9 18.5 4 17.5743 4 16.4429V15.4143H2C0.9 15.4143 0 14.4886 0 13.3572V4.10001C0 2.96858 0.9 2.04286 2 2.04286H4.5C4.5 1.18915 5.17 0.500008 6 0.500008C6.83 0.500008 7.5 1.18915 7.5 2.04286H10C11.1 2.04286 12 2.96858 12 4.10001V6.15715H14C15.1 6.15715 16 7.08287 16 8.21429ZM6 6.15715H11V4.10001C11 3.53429 10.55 3.07144 10 3.07144H9V4.10001H3V3.07144H2C1.45 3.07144 1 3.53429 1 4.10001V13.3572C1 13.9229 1.45 14.3857 2 14.3857H4V8.21429C4 7.08287 4.9 6.15715 6 6.15715ZM15 8.21429C15 7.64858 14.55 7.18572 14 7.18572H6C5.45 7.18572 5 7.64858 5 8.21429V16.4429C5 17.0086 5.45 17.4714 6 17.4714H14C14.55 17.4714 15 17.0086 15 16.4429V8.21429Z" fill="#142D64"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _core = require("@material-ui/core");
|
|
9
|
+
var _CopyIcon = _interopRequireDefault(require("../assets/CopyIcon.svg"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
|
+
const QueryUrl = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
classes,
|
|
21
|
+
filterItems,
|
|
22
|
+
localFind,
|
|
23
|
+
rootPath
|
|
24
|
+
} = _ref;
|
|
25
|
+
const [expand, setExpand] = (0, _react.useState)(false);
|
|
26
|
+
const toggleExpand = () => setExpand(!expand);
|
|
27
|
+
const {
|
|
28
|
+
autocomplete = [],
|
|
29
|
+
upload
|
|
30
|
+
} = localFind;
|
|
31
|
+
const pathFilterParams = filterItems.reduce((acc, item) => {
|
|
32
|
+
const {
|
|
33
|
+
datafield,
|
|
34
|
+
items = []
|
|
35
|
+
} = item;
|
|
36
|
+
acc[datafield] = items;
|
|
37
|
+
return acc;
|
|
38
|
+
}, {});
|
|
39
|
+
const query = JSON.stringify(_objectSpread(_objectSpread({}, pathFilterParams), {}, {
|
|
40
|
+
autocomplete,
|
|
41
|
+
upload
|
|
42
|
+
}));
|
|
43
|
+
const url = encodeURI(rootPath.concat(query));
|
|
44
|
+
const copyUrl = async () => {
|
|
45
|
+
await navigator.clipboard.writeText(url);
|
|
46
|
+
};
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
+
className: classes.urlContainer
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
50
|
+
onClick: toggleExpand,
|
|
51
|
+
className: classes.viewLinkToggleBtn
|
|
52
|
+
}, expand ? 'Hide Query URL' : 'Show Query URL'), expand && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Link, {
|
|
53
|
+
target: "_blank",
|
|
54
|
+
href: url,
|
|
55
|
+
className: classes.link
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, url)), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
57
|
+
title: "Copy to Clipboard",
|
|
58
|
+
className: classes.Tooltip
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
60
|
+
onClick: copyUrl,
|
|
61
|
+
className: classes.copyIconBtn
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
63
|
+
src: _CopyIcon.default,
|
|
64
|
+
alt: "copy icon"
|
|
65
|
+
})))));
|
|
66
|
+
};
|
|
67
|
+
var _default = QueryUrl;
|
|
68
|
+
exports.default = _default;
|
|
@@ -11,6 +11,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
11
11
|
var _FilterMap = require("../components/FilterMap");
|
|
12
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
13
|
var _config = _interopRequireDefault(require("./config"));
|
|
14
|
+
var _QueryUrl = _interopRequireDefault(require("../components/QueryUrl"));
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -37,6 +38,8 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
37
38
|
} = _facetFilter.InputTypes;
|
|
38
39
|
const styles = () => _objectSpread(_objectSpread({}, (0, _styles.default)()), customStyles);
|
|
39
40
|
const maxItems = config && typeof config.maxItems === 'number' ? config.maxItems : _config.default.config.maxItems;
|
|
41
|
+
const queryURLRootPath = config && typeof config.rootPath === 'string' ? config.rootPath : _config.default.config.rootPath;
|
|
42
|
+
const viewQueryURL = config && typeof config.viewQueryURL === 'boolean' ? config.viewQueryURL : _config.default.config.viewQueryURL;
|
|
40
43
|
const displayAllActiveFilters = config && typeof config.displayAllActiveFilters === 'boolean' ? config.displayAllActiveFilters : _config.default.config.displayAllActiveFilters;
|
|
41
44
|
|
|
42
45
|
// const group = config && typeof config.group === 'string'
|
|
@@ -105,7 +108,7 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
105
108
|
if ((mappedInputs.length || autocomplete.length || upload.length) <= 0) {
|
|
106
109
|
return null;
|
|
107
110
|
}
|
|
108
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
111
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
109
112
|
className: classes.queryWrapper
|
|
110
113
|
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
111
114
|
className: classes.clearQueryButton,
|
|
@@ -154,7 +157,12 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
154
157
|
classes: classes,
|
|
155
158
|
onSectionClick: filter.type === CHECKBOX ? resetFacetSection : resetFacetSlider,
|
|
156
159
|
onItemClick: filter.type === CHECKBOX ? resetFacetCheckbox : resetFacetSlider
|
|
157
|
-
}))))
|
|
160
|
+
})))), viewQueryURL && queryURLRootPath && /*#__PURE__*/_react.default.createElement(_QueryUrl.default, {
|
|
161
|
+
classes: classes,
|
|
162
|
+
localFind: localFind,
|
|
163
|
+
filterItems: mappedInputs,
|
|
164
|
+
rootPath: queryURLRootPath
|
|
165
|
+
})));
|
|
158
166
|
})
|
|
159
167
|
};
|
|
160
168
|
};
|
|
@@ -22,7 +22,17 @@ var _default = {
|
|
|
22
22
|
* key to access label text
|
|
23
23
|
* @var {boolean}
|
|
24
24
|
*/
|
|
25
|
-
group: 'group'
|
|
25
|
+
group: 'group',
|
|
26
|
+
/**
|
|
27
|
+
* root path of bento app
|
|
28
|
+
* @var {boolean}
|
|
29
|
+
*/
|
|
30
|
+
rootPath: null,
|
|
31
|
+
/**
|
|
32
|
+
* display query URL
|
|
33
|
+
* @var {boolean}
|
|
34
|
+
*/
|
|
35
|
+
viewQueryURL: false
|
|
26
36
|
},
|
|
27
37
|
/* Component Helper Functions */
|
|
28
38
|
functions: {
|
|
@@ -119,6 +119,42 @@ var _default = () => ({
|
|
|
119
119
|
'&:hover': {
|
|
120
120
|
cursor: 'pointer'
|
|
121
121
|
}
|
|
122
|
+
},
|
|
123
|
+
urlContainer: {
|
|
124
|
+
marginTop: '10px'
|
|
125
|
+
},
|
|
126
|
+
link: {
|
|
127
|
+
lineBreak: 'anywhere',
|
|
128
|
+
fontFamily: 'Nunito',
|
|
129
|
+
fontSize: '12px',
|
|
130
|
+
fontWeight: '500',
|
|
131
|
+
lineHeight: '16px',
|
|
132
|
+
letterSpacing: '0em',
|
|
133
|
+
color: '#1D79A8',
|
|
134
|
+
backgroundColor: '#fff',
|
|
135
|
+
padding: '5px',
|
|
136
|
+
borderRadius: '5px',
|
|
137
|
+
marginLeft: '10px'
|
|
138
|
+
},
|
|
139
|
+
viewLinkToggleBtn: {
|
|
140
|
+
height: '20px',
|
|
141
|
+
fontFamily: 'Nunito',
|
|
142
|
+
fontSize: '12px',
|
|
143
|
+
fontWeight: '500',
|
|
144
|
+
lineHeight: '16px',
|
|
145
|
+
letterSpacing: '0em',
|
|
146
|
+
textAlign: 'left',
|
|
147
|
+
backgroundColor: '#1D79A8',
|
|
148
|
+
textTransform: 'none',
|
|
149
|
+
color: '#fff',
|
|
150
|
+
'&:hover': {
|
|
151
|
+
backgroundColor: '#1D79A8',
|
|
152
|
+
color: '#fff'
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
copyIconBtn: {
|
|
156
|
+
padding: '0px',
|
|
157
|
+
marginLeft: '10px'
|
|
122
158
|
}
|
|
123
159
|
});
|
|
124
160
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/query-bar",
|
|
3
|
-
"version": "1.0.1-icdc.
|
|
3
|
+
"version": "1.0.1-icdc.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"clsx": "^1.2.1",
|
|
18
18
|
"react": "^17.0.2",
|
|
19
19
|
"react-dom": "^17.0.0",
|
|
20
|
-
"react-redux": "^7.2.1"
|
|
20
|
+
"react-redux": "^7.2.1",
|
|
21
|
+
"@material-ui/icons": "^4.11.3"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@bento-core/facet-filter": "^1.0.0",
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="19" viewBox="0 0 16 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M13 9.75715C13 10.0452 12.78 10.2714 12.5 10.2714H7.5C7.22 10.2714 7 10.0452 7 9.75715C7 9.46915 7.22 9.24287 7.5 9.24287H12.5C12.78 9.24287 13 9.46915 13 9.75715ZM12.5 11.3H7.5C7.22 11.3 7 11.5263 7 11.8143C7 12.1023 7.22 12.3286 7.5 12.3286H12.5C12.78 12.3286 13 12.1023 13 11.8143C13 11.5263 12.78 11.3 12.5 11.3ZM12.5 13.3572H7.5C7.22 13.3572 7 13.5834 7 13.8714C7 14.1594 7.22 14.3857 7.5 14.3857H12.5C12.78 14.3857 13 14.1594 13 13.8714C13 13.5834 12.78 13.3572 12.5 13.3572ZM16 8.21429V16.4429C16 17.5743 15.1 18.5 14 18.5H6C4.9 18.5 4 17.5743 4 16.4429V15.4143H2C0.9 15.4143 0 14.4886 0 13.3572V4.10001C0 2.96858 0.9 2.04286 2 2.04286H4.5C4.5 1.18915 5.17 0.500008 6 0.500008C6.83 0.500008 7.5 1.18915 7.5 2.04286H10C11.1 2.04286 12 2.96858 12 4.10001V6.15715H14C15.1 6.15715 16 7.08287 16 8.21429ZM6 6.15715H11V4.10001C11 3.53429 10.55 3.07144 10 3.07144H9V4.10001H3V3.07144H2C1.45 3.07144 1 3.53429 1 4.10001V13.3572C1 13.9229 1.45 14.3857 2 14.3857H4V8.21429C4 7.08287 4.9 6.15715 6 6.15715ZM15 8.21429C15 7.64858 14.55 7.18572 14 7.18572H6C5.45 7.18572 5 7.64858 5 8.21429V16.4429C5 17.0086 5.45 17.4714 6 17.4714H14C14.55 17.4714 15 17.0086 15 16.4429V8.21429Z" fill="#142D64"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
IconButton,
|
|
5
|
+
Link,
|
|
6
|
+
Tooltip,
|
|
7
|
+
} from '@material-ui/core';
|
|
8
|
+
import CopyIcon from '../assets/CopyIcon.svg';
|
|
9
|
+
|
|
10
|
+
const QueryUrl = ({
|
|
11
|
+
classes,
|
|
12
|
+
filterItems,
|
|
13
|
+
localFind,
|
|
14
|
+
rootPath,
|
|
15
|
+
}) => {
|
|
16
|
+
const [expand, setExpand] = useState(false);
|
|
17
|
+
const toggleExpand = () => setExpand(!expand);
|
|
18
|
+
|
|
19
|
+
const { autocomplete = [], upload } = localFind;
|
|
20
|
+
|
|
21
|
+
const pathFilterParams = filterItems.reduce((acc, item) => {
|
|
22
|
+
const { datafield, items = [] } = item;
|
|
23
|
+
acc[datafield] = items;
|
|
24
|
+
return acc;
|
|
25
|
+
}, {});
|
|
26
|
+
|
|
27
|
+
const query = JSON.stringify({
|
|
28
|
+
...pathFilterParams,
|
|
29
|
+
autocomplete,
|
|
30
|
+
upload,
|
|
31
|
+
});
|
|
32
|
+
const url = encodeURI(rootPath.concat(query));
|
|
33
|
+
|
|
34
|
+
const copyUrl = async () => {
|
|
35
|
+
await navigator.clipboard.writeText(url);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={classes.urlContainer}>
|
|
40
|
+
<Button
|
|
41
|
+
onClick={toggleExpand}
|
|
42
|
+
className={classes.viewLinkToggleBtn}
|
|
43
|
+
>
|
|
44
|
+
{ (expand) ? 'Hide Query URL' : 'Show Query URL'}
|
|
45
|
+
</Button>
|
|
46
|
+
{
|
|
47
|
+
(expand) && (
|
|
48
|
+
<>
|
|
49
|
+
<Link
|
|
50
|
+
target="_blank"
|
|
51
|
+
href={url}
|
|
52
|
+
className={classes.link}
|
|
53
|
+
>
|
|
54
|
+
<span>
|
|
55
|
+
{url}
|
|
56
|
+
</span>
|
|
57
|
+
</Link>
|
|
58
|
+
<Tooltip
|
|
59
|
+
title="Copy to Clipboard"
|
|
60
|
+
className={classes.Tooltip}
|
|
61
|
+
>
|
|
62
|
+
<IconButton onClick={copyUrl} className={classes.copyIconBtn}>
|
|
63
|
+
<img src={CopyIcon} alt="copy icon" />
|
|
64
|
+
</IconButton>
|
|
65
|
+
</Tooltip>
|
|
66
|
+
</>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default QueryUrl;
|
|
@@ -5,6 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { Filter } from '../components/FilterMap';
|
|
6
6
|
import DEFAULT_STYLES from './styles';
|
|
7
7
|
import DEFAULT_CONFIG from './config';
|
|
8
|
+
import QueryUrl from '../components/QueryUrl';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Generate a pre-configured Explore Query Bar component
|
|
@@ -23,6 +24,14 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
23
24
|
? config.maxItems
|
|
24
25
|
: DEFAULT_CONFIG.config.maxItems;
|
|
25
26
|
|
|
27
|
+
const queryURLRootPath = config && typeof config.rootPath === 'string'
|
|
28
|
+
? config.rootPath
|
|
29
|
+
: DEFAULT_CONFIG.config.rootPath;
|
|
30
|
+
|
|
31
|
+
const viewQueryURL = config && typeof config.viewQueryURL === 'boolean'
|
|
32
|
+
? config.viewQueryURL
|
|
33
|
+
: DEFAULT_CONFIG.config.viewQueryURL;
|
|
34
|
+
|
|
26
35
|
const displayAllActiveFilters = config && typeof config.displayAllActiveFilters === 'boolean'
|
|
27
36
|
? config.displayAllActiveFilters
|
|
28
37
|
: DEFAULT_CONFIG.config.displayAllActiveFilters;
|
|
@@ -106,131 +115,143 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
return (
|
|
109
|
-
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
{/* Standalone case set button */}
|
|
125
|
-
{(upload.length && !autocomplete.length)
|
|
126
|
-
? (
|
|
127
|
-
<span
|
|
128
|
-
className={clsx(classes.filterCheckboxes, classes.localFindBackground)}
|
|
129
|
-
onClick={clearUpload}
|
|
130
|
-
>
|
|
131
|
-
INPUT CASE SET
|
|
132
|
-
</span>
|
|
133
|
-
) : null}
|
|
134
|
-
{autocomplete.length
|
|
135
|
-
? (
|
|
136
|
-
<span>
|
|
137
|
-
{' '}
|
|
138
|
-
<span
|
|
139
|
-
className={clsx(classes.filterName, classes.localFindBackground)}
|
|
140
|
-
onClick={clearAutocomplete}
|
|
141
|
-
>
|
|
142
|
-
Case IDs
|
|
143
|
-
</span>
|
|
144
|
-
{' '}
|
|
145
|
-
{' '}
|
|
146
|
-
<span className={classes.operators}>
|
|
147
|
-
{(autocomplete.length === 1 && !upload.length) ? 'IS ' : 'IN '}
|
|
148
|
-
</span>
|
|
149
|
-
</span>
|
|
150
|
-
) : null}
|
|
118
|
+
<>
|
|
119
|
+
<div className={classes.queryWrapper}>
|
|
120
|
+
<Button
|
|
121
|
+
className={classes.clearQueryButton}
|
|
122
|
+
color="primary"
|
|
123
|
+
variant="outlined"
|
|
124
|
+
onClick={clearAll}
|
|
125
|
+
>
|
|
126
|
+
Clear Query
|
|
127
|
+
</Button>
|
|
128
|
+
<span className={classes.divider} />
|
|
129
|
+
<span className={classes.queryContainer}>
|
|
130
|
+
{/* Local Find Selections */}
|
|
131
|
+
{/* TODO: Refactor this into a separate component */}
|
|
132
|
+
{(autocomplete.length || upload.length) ? (
|
|
151
133
|
<span>
|
|
152
|
-
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
{upload.length && autocomplete.length ? (
|
|
156
|
-
<>
|
|
157
|
-
{' '}
|
|
134
|
+
{/* Standalone case set button */}
|
|
135
|
+
{(upload.length && !autocomplete.length)
|
|
136
|
+
? (
|
|
158
137
|
<span
|
|
159
|
-
className={clsx(classes.filterCheckboxes, classes.
|
|
138
|
+
className={clsx(classes.filterCheckboxes, classes.localFindBackground)}
|
|
160
139
|
onClick={clearUpload}
|
|
161
140
|
>
|
|
162
141
|
INPUT CASE SET
|
|
163
142
|
</span>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
143
|
+
) : null}
|
|
144
|
+
{autocomplete.length
|
|
145
|
+
? (
|
|
146
|
+
<span>
|
|
147
|
+
{' '}
|
|
148
|
+
<span
|
|
149
|
+
className={clsx(classes.filterName, classes.localFindBackground)}
|
|
150
|
+
onClick={clearAutocomplete}
|
|
151
|
+
>
|
|
152
|
+
Case IDs
|
|
153
|
+
</span>
|
|
154
|
+
{' '}
|
|
155
|
+
{' '}
|
|
156
|
+
<span className={classes.operators}>
|
|
157
|
+
{(autocomplete.length === 1 && !upload.length) ? 'IS ' : 'IN '}
|
|
158
|
+
</span>
|
|
159
|
+
</span>
|
|
160
|
+
) : null}
|
|
161
|
+
<span>
|
|
162
|
+
{(((upload.length > 0 ? 1 : 0) + autocomplete.length) > 1)
|
|
163
|
+
? <span className={classes.bracketsOpen}>(</span>
|
|
164
|
+
: null}
|
|
165
|
+
{upload.length && autocomplete.length ? (
|
|
166
|
+
<>
|
|
167
|
+
{' '}
|
|
168
|
+
<span
|
|
169
|
+
className={clsx(classes.filterCheckboxes, classes.localFind)}
|
|
170
|
+
onClick={clearUpload}
|
|
171
|
+
>
|
|
172
|
+
INPUT CASE SET
|
|
173
|
+
</span>
|
|
174
|
+
{' '}
|
|
175
|
+
</>
|
|
176
|
+
) : null}
|
|
177
|
+
{autocomplete.slice(0, noOfItems).map((d, idx) => (
|
|
178
|
+
<>
|
|
179
|
+
<span
|
|
180
|
+
className={clsx(classes.filterCheckboxes, classes.facetSectionCases)}
|
|
181
|
+
key={idx}
|
|
182
|
+
onClick={() => deleteAutocompleteItem(d.title)}
|
|
183
|
+
>
|
|
184
|
+
{d.title}
|
|
185
|
+
</span>
|
|
186
|
+
{idx === (noOfItems - 1) ? null : ' '}
|
|
187
|
+
</>
|
|
188
|
+
))}
|
|
189
|
+
{autocomplete.length > maxItems && (
|
|
190
|
+
<>
|
|
191
|
+
{
|
|
192
|
+
displayAllActiveFilters
|
|
193
|
+
? (
|
|
194
|
+
<span
|
|
195
|
+
className={classes.expandBtn}
|
|
196
|
+
onClick={() => setExpand(!expand)}
|
|
197
|
+
>
|
|
198
|
+
...
|
|
199
|
+
</span>
|
|
200
|
+
)
|
|
201
|
+
: '...'
|
|
202
|
+
}
|
|
203
|
+
</>
|
|
204
|
+
)}
|
|
205
|
+
{(expand && autocomplete.length > maxItems) && (
|
|
169
206
|
<span
|
|
170
|
-
className={
|
|
171
|
-
|
|
172
|
-
onClick={() => deleteAutocompleteItem(d.title)}
|
|
207
|
+
className={classes.collapseBtn}
|
|
208
|
+
onClick={() => setExpand(!expand)}
|
|
173
209
|
>
|
|
174
|
-
{
|
|
210
|
+
{' LESS'}
|
|
175
211
|
</span>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
? <span className={classes.bracketsClose}>)</span>
|
|
205
|
-
: null}
|
|
212
|
+
)}
|
|
213
|
+
{(((upload.length > 0 ? 1 : 0) + autocomplete.length) > 1)
|
|
214
|
+
? <span className={classes.bracketsClose}>)</span>
|
|
215
|
+
: null}
|
|
216
|
+
</span>
|
|
217
|
+
</span>
|
|
218
|
+
) : null}
|
|
219
|
+
|
|
220
|
+
{/* Facet Sidebar Selections */}
|
|
221
|
+
{((autocomplete.length || upload.length) && mappedInputs.length)
|
|
222
|
+
? <span className={classes.operators}> AND </span>
|
|
223
|
+
: null}
|
|
224
|
+
{mappedInputs.map((filter, index) => (
|
|
225
|
+
<span className={clsName(filter.section)}>
|
|
226
|
+
<Filter
|
|
227
|
+
index={index}
|
|
228
|
+
type={filter.type}
|
|
229
|
+
data={filter}
|
|
230
|
+
maxItems={maxItems}
|
|
231
|
+
displayAllActiveFilters={displayAllActiveFilters}
|
|
232
|
+
classes={classes}
|
|
233
|
+
onSectionClick={filter.type === CHECKBOX
|
|
234
|
+
? resetFacetSection
|
|
235
|
+
: resetFacetSlider}
|
|
236
|
+
onItemClick={filter.type === CHECKBOX
|
|
237
|
+
? resetFacetCheckbox
|
|
238
|
+
: resetFacetSlider}
|
|
239
|
+
/>
|
|
206
240
|
</span>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
? <span className={classes.operators}> AND </span>
|
|
213
|
-
: null}
|
|
214
|
-
{mappedInputs.map((filter, index) => (
|
|
215
|
-
<span className={clsName(filter.section)}>
|
|
216
|
-
<Filter
|
|
217
|
-
index={index}
|
|
218
|
-
type={filter.type}
|
|
219
|
-
data={filter}
|
|
220
|
-
maxItems={maxItems}
|
|
221
|
-
displayAllActiveFilters={displayAllActiveFilters}
|
|
241
|
+
))}
|
|
242
|
+
</span>
|
|
243
|
+
{
|
|
244
|
+
(viewQueryURL && queryURLRootPath) && (
|
|
245
|
+
<QueryUrl
|
|
222
246
|
classes={classes}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
onItemClick={filter.type === CHECKBOX
|
|
227
|
-
? resetFacetCheckbox
|
|
228
|
-
: resetFacetSlider}
|
|
247
|
+
localFind={localFind}
|
|
248
|
+
filterItems={mappedInputs}
|
|
249
|
+
rootPath={queryURLRootPath}
|
|
229
250
|
/>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
</
|
|
233
|
-
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
</div>
|
|
254
|
+
</>
|
|
234
255
|
);
|
|
235
256
|
}),
|
|
236
257
|
};
|
package/src/generators/config.js
CHANGED
|
@@ -17,6 +17,16 @@ export default {
|
|
|
17
17
|
* @var {boolean}
|
|
18
18
|
*/
|
|
19
19
|
group: 'group',
|
|
20
|
+
/**
|
|
21
|
+
* root path of bento app
|
|
22
|
+
* @var {boolean}
|
|
23
|
+
*/
|
|
24
|
+
rootPath: null,
|
|
25
|
+
/**
|
|
26
|
+
* display query URL
|
|
27
|
+
* @var {boolean}
|
|
28
|
+
*/
|
|
29
|
+
viewQueryURL: false,
|
|
20
30
|
},
|
|
21
31
|
|
|
22
32
|
/* Component Helper Functions */
|
package/src/generators/styles.js
CHANGED
|
@@ -114,4 +114,40 @@ export default () => ({
|
|
|
114
114
|
cursor: 'pointer',
|
|
115
115
|
},
|
|
116
116
|
},
|
|
117
|
+
urlContainer: {
|
|
118
|
+
marginTop: '10px',
|
|
119
|
+
},
|
|
120
|
+
link: {
|
|
121
|
+
lineBreak: 'anywhere',
|
|
122
|
+
fontFamily: 'Nunito',
|
|
123
|
+
fontSize: '12px',
|
|
124
|
+
fontWeight: '500',
|
|
125
|
+
lineHeight: '16px',
|
|
126
|
+
letterSpacing: '0em',
|
|
127
|
+
color: '#1D79A8',
|
|
128
|
+
backgroundColor: '#fff',
|
|
129
|
+
padding: '5px',
|
|
130
|
+
borderRadius: '5px',
|
|
131
|
+
marginLeft: '10px',
|
|
132
|
+
},
|
|
133
|
+
viewLinkToggleBtn: {
|
|
134
|
+
height: '20px',
|
|
135
|
+
fontFamily: 'Nunito',
|
|
136
|
+
fontSize: '12px',
|
|
137
|
+
fontWeight: '500',
|
|
138
|
+
lineHeight: '16px',
|
|
139
|
+
letterSpacing: '0em',
|
|
140
|
+
textAlign: 'left',
|
|
141
|
+
backgroundColor: '#1D79A8',
|
|
142
|
+
textTransform: 'none',
|
|
143
|
+
color: '#fff',
|
|
144
|
+
'&:hover': {
|
|
145
|
+
backgroundColor: '#1D79A8',
|
|
146
|
+
color: '#fff',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
copyIconBtn: {
|
|
150
|
+
padding: '0px',
|
|
151
|
+
marginLeft: '10px',
|
|
152
|
+
},
|
|
117
153
|
});
|