@bento-core/query-bar 1.0.1-CDS.2 → 1.0.1-CDS.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.
@@ -0,0 +1,42 @@
1
+ # DQB copy URL button Configuration
2
+
3
+ ```
4
+ DashTemplateController.js
5
+
6
+ export const setActiveFilterByPathQuery = (match) => {
7
+ const query = decodeURI(match.params.filterQuery || '');
8
+ const filterObject = JSON.parse(query);
9
+ const { autocomplete = [], upload = [], uploadMetadata } = filterObject;
10
+
11
+ const activeFilterValues = Object.keys(filterObject).reduce((curr, key) => {
12
+ if (Array.isArray(filterObject[key])) {
13
+ const activeFilters = filterObject[key].reduce((value, item) => ({
14
+ ...value,
15
+ [item]: true,
16
+ }), {});
17
+ return {
18
+ ...curr,
19
+ [key]: activeFilters,
20
+ };
21
+ }
22
+ return curr;
23
+ }, {});
24
+ store.dispatch(clearAllAndSelectFacet(activeFilterValues));
25
+ store.dispatch(updateAutocompleteData(autocomplete));
26
+ store.dispatch(updateUploadData(upload));
27
+ store.dispatch(updateUploadMetadata(uploadMetadata));
28
+ };
29
+
30
+
31
+ // redirect
32
+ if (match.params.filterQuery) {
33
+ setActiveFilterByPathQuery(match);
34
+ const redirectUrl = '/explore';
35
+ history.push(redirectUrl);
36
+ }
37
+
38
+ ```
39
+
40
+ # DQB copy URL button theme style
41
+
42
+ ``` https://github.com/CBIIT/bento-icdc-frontend/tree/v4.0.1/src/pages/dashboard/filterQueryBar```
package/README.md CHANGED
@@ -63,6 +63,16 @@ const CONFIG = {
63
63
  * @var {boolean}
64
64
  */
65
65
  displayAllActiveFilters: false,
66
+ /**
67
+ * set root path for copy url (COPYURL_README)
68
+ * @var {boolean}
69
+ */
70
+ rootPath: `${window.location.href}/`,
71
+ /**
72
+ * display copy url button (COPYURL_README)
73
+ * @var {boolean}
74
+ */
75
+ viewQueryURL: true,
66
76
  /**
67
77
  * key to access label text
68
78
  * @var {boolean}
@@ -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,143 @@
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 _clsx = _interopRequireDefault(require("clsx"));
9
+ var _core = require("@material-ui/core");
10
+ var _CopyIcon = _interopRequireDefault(require("../assets/CopyIcon.svg"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ 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); }
13
+ 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; }
14
+ 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; }
15
+ 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; }
16
+ 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; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
+ 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); }
19
+ const QueryUrl = _ref => {
20
+ let {
21
+ classes,
22
+ filterItems,
23
+ localFind = {},
24
+ rootPath
25
+ } = _ref;
26
+ const [display, setDisplay] = (0, _react.useState)(false);
27
+ const toggleDisplay = () => setDisplay(prevDisplay => !prevDisplay);
28
+ const [open, setOpen] = (0, _react.useState)(false);
29
+ const toggleOpen = () => setOpen(prevOpen => !prevOpen);
30
+ const pathFilterParams = filterItems.reduce((acc, item) => {
31
+ const {
32
+ datafield,
33
+ items = []
34
+ } = item;
35
+ acc[datafield] = items;
36
+ return acc;
37
+ }, {});
38
+ const query = JSON.stringify(_objectSpread(_objectSpread({}, pathFilterParams), localFind));
39
+ const url = rootPath.concat(encodeURIComponent(query));
40
+ const copyUrl = async () => {
41
+ toggleOpen();
42
+ await navigator.clipboard.writeText(url);
43
+ };
44
+ const queryRef = (0, _react.useRef)(null);
45
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
46
+ ref: queryRef,
47
+ className: classes.urlContainer
48
+ }, /*#__PURE__*/_react.default.createElement(_core.Button, {
49
+ onClick: toggleDisplay,
50
+ className: classes.viewLinkToggleBtn
51
+ }, display ? 'Hide Query URL' : 'Show Query URL'), display && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
52
+ type: "button",
53
+ className: (0, _clsx.default)(classes.viewLink)
54
+ }, url), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
55
+ arrow: true,
56
+ title: "Copy to Clipboard"
57
+ }, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
58
+ onClick: copyUrl,
59
+ className: classes.copyIconBtn
60
+ }, /*#__PURE__*/_react.default.createElement("img", {
61
+ src: _CopyIcon.default,
62
+ alt: "copy icon"
63
+ }))))), /*#__PURE__*/_react.default.createElement(_core.Dialog, {
64
+ open: open,
65
+ onClose: () => toggleOpen(),
66
+ "aria-labelledby": "alert-dialog-title",
67
+ "aria-describedby": "alert-dialog-description",
68
+ className: (0, _clsx.default)(classes.dialogBox, 'dialogBox')
69
+ }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, {
70
+ className: classes.okText
71
+ }, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
72
+ id: "alert-dialog-description"
73
+ }, "Your query URL has been copied!")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
74
+ onClick: () => toggleOpen()
75
+ }, "OK"))));
76
+ };
77
+ const styles = () => ({
78
+ urlContainer: {
79
+ display: 'flex',
80
+ marginTop: '3px',
81
+ minHeight: '10px'
82
+ },
83
+ viewLink: {
84
+ overflow: 'hidden',
85
+ textOverflow: 'ellipsis',
86
+ fontFamily: 'Nunito',
87
+ fontSize: '12px',
88
+ fontWeight: '500',
89
+ lineHeight: '16px',
90
+ letterSpacing: '0em',
91
+ padding: '2px 5px',
92
+ borderRadius: '5px',
93
+ float: 'left',
94
+ color: '#1D79A8',
95
+ backgroundColor: '#fff',
96
+ margin: '0',
97
+ whiteSpace: 'nowrap',
98
+ wordBreak: 'break-all',
99
+ '@media (max-width: 2560px)': {
100
+ maxWidth: '1800px'
101
+ },
102
+ '@media (max-width: 2000px)': {
103
+ maxWidth: '1500px'
104
+ },
105
+ '@media (max-width: 1600px)': {
106
+ maxWidth: '1100px'
107
+ },
108
+ '@media (max-width: 1300px)': {
109
+ maxWidth: '900px'
110
+ }
111
+ },
112
+ urlViewBtn: {
113
+ cursor: 'pointer'
114
+ },
115
+ viewLinkToggleBtn: {
116
+ padding: '5px 10px 5px 10px',
117
+ height: '20px',
118
+ fontFamily: 'Nunito',
119
+ fontSize: '12px',
120
+ fontWeight: '500',
121
+ lineHeight: '16px',
122
+ letterSpacing: '0em',
123
+ textAlign: 'left',
124
+ backgroundColor: '#1D79A8',
125
+ textTransform: 'none',
126
+ color: '#fff',
127
+ float: 'left',
128
+ margin: '0px 10px 0px 0px',
129
+ whiteSpace: 'nowrap',
130
+ '&:hover': {
131
+ backgroundColor: '#1D79A8',
132
+ color: '#fff'
133
+ }
134
+ },
135
+ copyIconBtn: {
136
+ padding: '0px',
137
+ height: '20px',
138
+ marginLeft: '10px',
139
+ float: 'left'
140
+ }
141
+ });
142
+ var _default = (0, _core.withStyles)(styles)(QueryUrl);
143
+ 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
  const caseIDLabel = config && typeof config.caseIDLabel === 'string' ? config.caseIDLabel : _config.default.config.caseIDLabel;
42
45
 
@@ -155,7 +158,12 @@ const QueryBarGenerator = function QueryBarGenerator() {
155
158
  classes: classes,
156
159
  onSectionClick: filter.type === CHECKBOX ? resetFacetSection : resetFacetSlider,
157
160
  onItemClick: filter.type === CHECKBOX ? resetFacetCheckbox : resetFacetSlider
158
- })))));
161
+ })))), viewQueryURL && queryURLRootPath && /*#__PURE__*/_react.default.createElement(_QueryUrl.default, {
162
+ classes: classes,
163
+ localFind: localFind,
164
+ filterItems: mappedInputs,
165
+ rootPath: queryURLRootPath
166
+ }));
159
167
  })
160
168
  };
161
169
  };
@@ -18,6 +18,16 @@ var _default = {
18
18
  * @var {boolean}
19
19
  */
20
20
  displayAllActiveFilters: false,
21
+ /**
22
+ * set root path for copy url
23
+ * @var {boolean}
24
+ */
25
+ rootPath: "".concat(window.location.href, "/"),
26
+ /**
27
+ * display copy url button
28
+ * @var {boolean}
29
+ */
30
+ viewQueryURL: false,
21
31
  /**
22
32
  * key to access label text
23
33
  * @var {string}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/query-bar",
3
- "version": "1.0.1-CDS.2",
3
+ "version": "1.0.1-CDS.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,5 +25,5 @@
25
25
  },
26
26
  "author": "CTOS Bento Team",
27
27
  "license": "ISC",
28
- "gitHead": "7b3aaef031248be613da70582863625cf729fcce"
28
+ "gitHead": "fcf90dacd601550f75a32a940064e74cb7168113"
29
29
  }
@@ -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,164 @@
1
+ import React, { useState, useRef } from 'react';
2
+ import clsx from 'clsx';
3
+ import {
4
+ Button,
5
+ IconButton,
6
+ Tooltip,
7
+ Dialog,
8
+ DialogActions,
9
+ DialogContent,
10
+ DialogContentText,
11
+ withStyles,
12
+ } from '@material-ui/core';
13
+ import CopyIcon from '../assets/CopyIcon.svg';
14
+
15
+ const QueryUrl = ({
16
+ classes,
17
+ filterItems,
18
+ localFind = {},
19
+ rootPath,
20
+ }) => {
21
+ const [display, setDisplay] = useState(false);
22
+ const toggleDisplay = () => setDisplay((prevDisplay) => !prevDisplay);
23
+
24
+ const [open, setOpen] = useState(false);
25
+ const toggleOpen = () => setOpen((prevOpen) => !prevOpen);
26
+
27
+ const pathFilterParams = filterItems.reduce((acc, item) => {
28
+ const { datafield, items = [] } = item;
29
+ acc[datafield] = items;
30
+ return acc;
31
+ }, {});
32
+
33
+ const query = JSON.stringify({
34
+ ...pathFilterParams,
35
+ ...localFind,
36
+ });
37
+ const url = rootPath.concat(encodeURIComponent(query));
38
+
39
+ const copyUrl = async () => {
40
+ toggleOpen();
41
+ await navigator.clipboard.writeText(url);
42
+ };
43
+
44
+ const queryRef = useRef(null);
45
+
46
+ return (
47
+ <>
48
+ <div ref={queryRef} className={classes.urlContainer}>
49
+ <Button
50
+ onClick={toggleDisplay}
51
+ className={classes.viewLinkToggleBtn}
52
+ >
53
+ { (display) ? 'Hide Query URL' : 'Show Query URL'}
54
+ </Button>
55
+ {
56
+ (display) && (
57
+ <>
58
+ <div
59
+ type="button"
60
+ className={clsx(classes.viewLink)}
61
+ >
62
+ {url}
63
+ </div>
64
+ <Tooltip
65
+ arrow
66
+ title="Copy to Clipboard"
67
+ >
68
+ <IconButton onClick={copyUrl} className={classes.copyIconBtn}>
69
+ <img src={CopyIcon} alt="copy icon" />
70
+ </IconButton>
71
+ </Tooltip>
72
+ </>
73
+ )
74
+ }
75
+ </div>
76
+ <Dialog
77
+ open={open}
78
+ onClose={() => toggleOpen()}
79
+ aria-labelledby="alert-dialog-title"
80
+ aria-describedby="alert-dialog-description"
81
+ className={clsx(classes.dialogBox, 'dialogBox')}
82
+ >
83
+ <DialogContent className={classes.okText}>
84
+ <DialogContentText id="alert-dialog-description">
85
+ Your query URL has been copied!
86
+ </DialogContentText>
87
+ </DialogContent>
88
+ <DialogActions>
89
+ <Button onClick={() => toggleOpen()}>
90
+ OK
91
+ </Button>
92
+ </DialogActions>
93
+ </Dialog>
94
+ </>
95
+ );
96
+ };
97
+
98
+ const styles = () => ({
99
+ urlContainer: {
100
+ display: 'flex',
101
+ marginTop: '3px',
102
+ minHeight: '10px',
103
+ },
104
+ viewLink: {
105
+ overflow: 'hidden',
106
+ textOverflow: 'ellipsis',
107
+ fontFamily: 'Nunito',
108
+ fontSize: '12px',
109
+ fontWeight: '500',
110
+ lineHeight: '16px',
111
+ letterSpacing: '0em',
112
+ padding: '2px 5px',
113
+ borderRadius: '5px',
114
+ float: 'left',
115
+ color: '#1D79A8',
116
+ backgroundColor: '#fff',
117
+ margin: '0',
118
+ whiteSpace: 'nowrap',
119
+ wordBreak: 'break-all',
120
+ '@media (max-width: 2560px)': {
121
+ maxWidth: '1800px',
122
+ },
123
+ '@media (max-width: 2000px)': {
124
+ maxWidth: '1500px',
125
+ },
126
+ '@media (max-width: 1600px)': {
127
+ maxWidth: '1100px',
128
+ },
129
+ '@media (max-width: 1300px)': {
130
+ maxWidth: '900px',
131
+ },
132
+ },
133
+ urlViewBtn: {
134
+ cursor: 'pointer',
135
+ },
136
+ viewLinkToggleBtn: {
137
+ padding: '5px 10px 5px 10px',
138
+ height: '20px',
139
+ fontFamily: 'Nunito',
140
+ fontSize: '12px',
141
+ fontWeight: '500',
142
+ lineHeight: '16px',
143
+ letterSpacing: '0em',
144
+ textAlign: 'left',
145
+ backgroundColor: '#1D79A8',
146
+ textTransform: 'none',
147
+ color: '#fff',
148
+ float: 'left',
149
+ margin: '0px 10px 0px 0px',
150
+ whiteSpace: 'nowrap',
151
+ '&:hover': {
152
+ backgroundColor: '#1D79A8',
153
+ color: '#fff',
154
+ },
155
+ },
156
+ copyIconBtn: {
157
+ padding: '0px',
158
+ height: '20px',
159
+ marginLeft: '10px',
160
+ float: 'left',
161
+ },
162
+ });
163
+
164
+ export default withStyles(styles)(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;
@@ -233,6 +242,16 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
233
242
  </span>
234
243
  ))}
235
244
  </span>
245
+ {
246
+ (viewQueryURL && queryURLRootPath) && (
247
+ <QueryUrl
248
+ classes={classes}
249
+ localFind={localFind}
250
+ filterItems={mappedInputs}
251
+ rootPath={queryURLRootPath}
252
+ />
253
+ )
254
+ }
236
255
  </div>
237
256
  );
238
257
  }),
@@ -12,6 +12,16 @@ export default {
12
12
  * @var {boolean}
13
13
  */
14
14
  displayAllActiveFilters: false,
15
+ /**
16
+ * set root path for copy url
17
+ * @var {boolean}
18
+ */
19
+ rootPath: `${window.location.href}/`,
20
+ /**
21
+ * display copy url button
22
+ * @var {boolean}
23
+ */
24
+ viewQueryURL: false,
15
25
  /**
16
26
  * key to access label text
17
27
  * @var {string}