@bento-core/query-bar 1.0.1-ccdihub.11 → 1.0.1-ccdihub.13
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 +133 -0
- package/dist/generators/QueryBarGenerator.js +11 -1
- package/dist/generators/config.js +16 -1
- package/dist/generators/styles.js +33 -12
- package/package.json +1 -1
- package/src/assets/CopyIcon.svg +3 -0
- package/src/components/QueryUrl.js +153 -0
- package/src/generators/QueryBarGenerator.js +24 -0
- package/src/generators/config.js +22 -7
- package/src/generators/styles.js +33 -12
|
@@ -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,133 @@
|
|
|
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
|
+
const QueryUrl = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
classes,
|
|
17
|
+
rootPath,
|
|
18
|
+
queryUrlCharacterLimit = 70
|
|
19
|
+
} = _ref;
|
|
20
|
+
const [display, setDisplay] = (0, _react.useState)(false);
|
|
21
|
+
const toggleDisplay = () => setDisplay(prevDisplay => !prevDisplay);
|
|
22
|
+
const [open, setOpen] = (0, _react.useState)(false);
|
|
23
|
+
const toggleOpen = () => setOpen(prevOpen => !prevOpen);
|
|
24
|
+
const url = rootPath.slice(0, rootPath.length - 1);
|
|
25
|
+
const copyUrl = async () => {
|
|
26
|
+
toggleOpen();
|
|
27
|
+
await navigator.clipboard.writeText(url);
|
|
28
|
+
};
|
|
29
|
+
const queryRef = (0, _react.useRef)(null);
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
+
style: {
|
|
32
|
+
position: 'relative',
|
|
33
|
+
right: '6px'
|
|
34
|
+
}
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
+
ref: queryRef,
|
|
37
|
+
className: classes.urlContainer
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
39
|
+
onClick: toggleDisplay,
|
|
40
|
+
className: classes.viewLinkToggleBtn
|
|
41
|
+
}, display ? 'Hide Query URL' : 'Show Query URL'), display && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
42
|
+
type: "button",
|
|
43
|
+
className: (0, _clsx.default)(classes.viewLink)
|
|
44
|
+
}, url.length > queryUrlCharacterLimit ? "".concat(url.substring(0, queryUrlCharacterLimit), "...") : url), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
45
|
+
arrow: true,
|
|
46
|
+
title: "Copy to Clipboard"
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
48
|
+
onClick: copyUrl,
|
|
49
|
+
className: classes.copyIconBtn
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
51
|
+
src: _CopyIcon.default,
|
|
52
|
+
alt: "copy icon"
|
|
53
|
+
}))))), /*#__PURE__*/_react.default.createElement(_core.Dialog, {
|
|
54
|
+
open: open,
|
|
55
|
+
onClose: () => toggleOpen(),
|
|
56
|
+
"aria-labelledby": "alert-dialog-title",
|
|
57
|
+
"aria-describedby": "alert-dialog-description",
|
|
58
|
+
className: (0, _clsx.default)(classes.dialogBox, 'dialogBox')
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, {
|
|
60
|
+
className: classes.okText
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
|
|
62
|
+
id: "alert-dialog-description"
|
|
63
|
+
}, "Your query URL has been copied!")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
64
|
+
onClick: () => toggleOpen()
|
|
65
|
+
}, "OK"))));
|
|
66
|
+
};
|
|
67
|
+
const styles = () => ({
|
|
68
|
+
urlContainer: {
|
|
69
|
+
display: 'flex',
|
|
70
|
+
marginTop: '3px',
|
|
71
|
+
minHeight: '10px'
|
|
72
|
+
},
|
|
73
|
+
viewLink: {
|
|
74
|
+
overflow: 'hidden',
|
|
75
|
+
textOverflow: 'ellipsis',
|
|
76
|
+
fontFamily: 'Nunito',
|
|
77
|
+
fontSize: '12px',
|
|
78
|
+
fontWeight: '500',
|
|
79
|
+
lineHeight: '16px',
|
|
80
|
+
letterSpacing: '0em',
|
|
81
|
+
padding: '2px 5px',
|
|
82
|
+
borderRadius: '5px',
|
|
83
|
+
float: 'left',
|
|
84
|
+
color: '#1D79A8',
|
|
85
|
+
backgroundColor: '#fff',
|
|
86
|
+
margin: '0',
|
|
87
|
+
whiteSpace: 'nowrap',
|
|
88
|
+
wordBreak: 'break-all',
|
|
89
|
+
'@media (max-width: 2560px)': {
|
|
90
|
+
maxWidth: '1800px'
|
|
91
|
+
},
|
|
92
|
+
'@media (max-width: 2000px)': {
|
|
93
|
+
maxWidth: '1500px'
|
|
94
|
+
},
|
|
95
|
+
'@media (max-width: 1600px)': {
|
|
96
|
+
maxWidth: '1100px'
|
|
97
|
+
},
|
|
98
|
+
'@media (max-width: 1300px)': {
|
|
99
|
+
maxWidth: '900px'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
urlViewBtn: {
|
|
103
|
+
cursor: 'pointer'
|
|
104
|
+
},
|
|
105
|
+
viewLinkToggleBtn: {
|
|
106
|
+
padding: '5px 10px 5px 10px',
|
|
107
|
+
height: '20px',
|
|
108
|
+
fontFamily: 'Nunito',
|
|
109
|
+
fontSize: '12px',
|
|
110
|
+
fontWeight: '500',
|
|
111
|
+
lineHeight: '16px',
|
|
112
|
+
letterSpacing: '0em',
|
|
113
|
+
textAlign: 'left',
|
|
114
|
+
backgroundColor: '#1D79A8',
|
|
115
|
+
textTransform: 'none',
|
|
116
|
+
color: '#fff',
|
|
117
|
+
float: 'left',
|
|
118
|
+
margin: '0px 10px 0px 0px',
|
|
119
|
+
whiteSpace: 'nowrap',
|
|
120
|
+
'&:hover': {
|
|
121
|
+
backgroundColor: '#1D79A8',
|
|
122
|
+
color: '#fff'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
copyIconBtn: {
|
|
126
|
+
padding: '0px',
|
|
127
|
+
height: '20px',
|
|
128
|
+
marginLeft: '10px',
|
|
129
|
+
float: 'left'
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
var _default = (0, _core.withStyles)(styles)(QueryUrl);
|
|
133
|
+
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 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; }
|
|
16
17
|
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; }
|
|
@@ -40,6 +41,9 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
40
41
|
const resetFacetSection = functions && typeof functions.resetFacetSection === 'function' ? functions.resetFacetSection : _config.default.functions.resetFacetSection;
|
|
41
42
|
const resetFacetCheckbox = functions && typeof functions.resetFacetCheckbox === 'function' ? functions.resetFacetCheckbox : _config.default.functions.resetFacetCheckbox;
|
|
42
43
|
const resetFacetSlider = functions && typeof functions.resetFacetSlider === 'function' ? functions.resetFacetSlider : _config.default.functions.resetFacetSlider;
|
|
44
|
+
const queryURLRootPath = config && typeof config.rootPath === 'string' ? config.rootPath : _config.default.config.rootPath;
|
|
45
|
+
const viewQueryURL = config && typeof config.viewQueryURL === 'boolean' ? config.viewQueryURL : _config.default.config.viewQueryURL;
|
|
46
|
+
const queryUrlCharacterLimit = config && typeof config.queryUrlCharacterLimit === 'number' ? config.queryUrlCharacterLimit : _config.default.config.queryUrlCharacterLimit;
|
|
43
47
|
return {
|
|
44
48
|
QueryBar: (0, _core.withStyles)(_styles.default, {
|
|
45
49
|
withTheme: true
|
|
@@ -120,7 +124,13 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
120
124
|
classes: classes,
|
|
121
125
|
onSectionClick: filter.type === CHECKBOX ? resetFacetSection : resetFacetSlider,
|
|
122
126
|
onItemClick: filter.type === CHECKBOX ? resetFacetCheckbox : resetFacetSlider
|
|
123
|
-
})))
|
|
127
|
+
}))), viewQueryURL && queryURLRootPath && /*#__PURE__*/_react.default.createElement(_QueryUrl.default, {
|
|
128
|
+
classes: classes,
|
|
129
|
+
localFind: localFind,
|
|
130
|
+
filterItems: mappedInputs,
|
|
131
|
+
rootPath: queryURLRootPath,
|
|
132
|
+
queryUrlCharacterLimit: queryUrlCharacterLimit
|
|
133
|
+
}));
|
|
124
134
|
})
|
|
125
135
|
};
|
|
126
136
|
};
|
|
@@ -12,7 +12,22 @@ var _default = {
|
|
|
12
12
|
* The maximum number of items to display in a query bar facet section
|
|
13
13
|
* @var {number}
|
|
14
14
|
*/
|
|
15
|
-
maxItems: 2
|
|
15
|
+
maxItems: 2,
|
|
16
|
+
/**
|
|
17
|
+
* set root path for copy url
|
|
18
|
+
* @var {boolean}
|
|
19
|
+
*/
|
|
20
|
+
rootPath: "".concat(window.location.href, "/"),
|
|
21
|
+
/**
|
|
22
|
+
* display copy url button
|
|
23
|
+
* @var {boolean}
|
|
24
|
+
*/
|
|
25
|
+
viewQueryURL: true,
|
|
26
|
+
/**
|
|
27
|
+
* display copy url button
|
|
28
|
+
* @var {boolean}
|
|
29
|
+
*/
|
|
30
|
+
queryUrlCharacterLimit: 70
|
|
16
31
|
},
|
|
17
32
|
/* Component Helper Functions */
|
|
18
33
|
functions: {
|
|
@@ -111,47 +111,68 @@ var _default = () => ({
|
|
|
111
111
|
facetSectionFilesBackground: {
|
|
112
112
|
backgroundColor: '#F5C3F1'
|
|
113
113
|
},
|
|
114
|
-
|
|
114
|
+
facetSectionDiagnosis: {
|
|
115
115
|
color: '#357288'
|
|
116
116
|
},
|
|
117
|
-
|
|
117
|
+
facetSectionDiagnosisBackground: {
|
|
118
118
|
backgroundColor: '#E4ECE9',
|
|
119
119
|
border: '1px solid #646464'
|
|
120
120
|
},
|
|
121
|
-
|
|
121
|
+
facetSectionDemographics: {
|
|
122
122
|
color: '#8C3F8D'
|
|
123
123
|
},
|
|
124
|
-
|
|
124
|
+
facetSectionDemographicsBackground: {
|
|
125
125
|
backgroundColor: '#E1C9E140',
|
|
126
126
|
border: '1px solid #646464'
|
|
127
127
|
},
|
|
128
|
-
|
|
128
|
+
facetSectionTreatment: {
|
|
129
|
+
color: '#4555AB'
|
|
130
|
+
},
|
|
131
|
+
facetSectionTreatmentBackground: {
|
|
132
|
+
backgroundColor: '#4555AB30',
|
|
133
|
+
border: '1px solid #646464'
|
|
134
|
+
},
|
|
135
|
+
facetSectionTreatmentresponse: {
|
|
129
136
|
color: '#907642'
|
|
130
137
|
},
|
|
131
|
-
|
|
138
|
+
facetSectionTreatmentresponseBackground: {
|
|
132
139
|
backgroundColor: '#F0DFBD40',
|
|
133
140
|
border: '1px solid #646464'
|
|
134
141
|
},
|
|
135
|
-
|
|
142
|
+
facetSectionSurvival: {
|
|
136
143
|
color: '#A85348'
|
|
137
144
|
},
|
|
138
|
-
|
|
145
|
+
facetSectionSurvivalBackground: {
|
|
139
146
|
backgroundColor: '#F8D7D240',
|
|
140
147
|
border: '1px solid #646464'
|
|
141
148
|
},
|
|
142
|
-
|
|
149
|
+
facetSectionSamples: {
|
|
143
150
|
color: '#1F6BBF'
|
|
144
151
|
},
|
|
145
|
-
|
|
152
|
+
facetSectionSamplesBackground: {
|
|
146
153
|
backgroundColor: '#CEDEF040',
|
|
147
154
|
border: '1px solid #646464'
|
|
148
155
|
},
|
|
149
|
-
|
|
156
|
+
facetSectionDatacategory: {
|
|
150
157
|
color: '#14A773'
|
|
151
158
|
},
|
|
152
|
-
|
|
159
|
+
facetSectionDatacategoryBackground: {
|
|
153
160
|
backgroundColor: '#DDEAE540',
|
|
154
161
|
border: '1px solid #646464'
|
|
162
|
+
},
|
|
163
|
+
facetSectionStudy: {
|
|
164
|
+
color: '#357288'
|
|
165
|
+
},
|
|
166
|
+
facetSectionStudyBackground: {
|
|
167
|
+
backgroundColor: '#E4ECE9',
|
|
168
|
+
border: '1px solid #646464'
|
|
169
|
+
},
|
|
170
|
+
facetSectionSequencinglibrary: {
|
|
171
|
+
color: '#8C3F8D'
|
|
172
|
+
},
|
|
173
|
+
facetSectionSequencinglibraryBackground: {
|
|
174
|
+
backgroundColor: '#E1C9E140',
|
|
175
|
+
border: '1px solid #646464'
|
|
155
176
|
}
|
|
156
177
|
});
|
|
157
178
|
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-ccdihub.
|
|
3
|
+
"version": "1.0.1-ccdihub.13",
|
|
4
4
|
"description": "This package provides the Query Bar component that displays the current Facet Search and Local Find filters on the Dashboard/Explore page. It also provides the direct ability to reset all or some of the filters with the click of a button. It is designed to be implemented directly with the:",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -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,153 @@
|
|
|
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
|
+
rootPath,
|
|
18
|
+
queryUrlCharacterLimit = 70,
|
|
19
|
+
}) => {
|
|
20
|
+
const [display, setDisplay] = useState(false);
|
|
21
|
+
const toggleDisplay = () => setDisplay((prevDisplay) => !prevDisplay);
|
|
22
|
+
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const toggleOpen = () => setOpen((prevOpen) => !prevOpen);
|
|
25
|
+
|
|
26
|
+
const url = rootPath.slice(0, rootPath.length - 1);
|
|
27
|
+
|
|
28
|
+
const copyUrl = async () => {
|
|
29
|
+
toggleOpen();
|
|
30
|
+
await navigator.clipboard.writeText(url);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const queryRef = useRef(null);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div style={{ position: 'relative', right: '6px' }}>
|
|
37
|
+
<div ref={queryRef} className={classes.urlContainer}>
|
|
38
|
+
<Button
|
|
39
|
+
onClick={toggleDisplay}
|
|
40
|
+
className={classes.viewLinkToggleBtn}
|
|
41
|
+
>
|
|
42
|
+
{ (display) ? 'Hide Query URL' : 'Show Query URL'}
|
|
43
|
+
</Button>
|
|
44
|
+
{
|
|
45
|
+
(display) && (
|
|
46
|
+
<>
|
|
47
|
+
<div
|
|
48
|
+
type="button"
|
|
49
|
+
className={clsx(classes.viewLink)}
|
|
50
|
+
>
|
|
51
|
+
{url.length > queryUrlCharacterLimit ? `${url.substring(0, queryUrlCharacterLimit)}...` : url}
|
|
52
|
+
</div>
|
|
53
|
+
<Tooltip
|
|
54
|
+
arrow
|
|
55
|
+
title="Copy to Clipboard"
|
|
56
|
+
>
|
|
57
|
+
<IconButton onClick={copyUrl} className={classes.copyIconBtn}>
|
|
58
|
+
<img src={CopyIcon} alt="copy icon" />
|
|
59
|
+
</IconButton>
|
|
60
|
+
</Tooltip>
|
|
61
|
+
</>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
</div>
|
|
65
|
+
<Dialog
|
|
66
|
+
open={open}
|
|
67
|
+
onClose={() => toggleOpen()}
|
|
68
|
+
aria-labelledby="alert-dialog-title"
|
|
69
|
+
aria-describedby="alert-dialog-description"
|
|
70
|
+
className={clsx(classes.dialogBox, 'dialogBox')}
|
|
71
|
+
>
|
|
72
|
+
<DialogContent className={classes.okText}>
|
|
73
|
+
<DialogContentText id="alert-dialog-description">
|
|
74
|
+
Your query URL has been copied!
|
|
75
|
+
</DialogContentText>
|
|
76
|
+
</DialogContent>
|
|
77
|
+
<DialogActions>
|
|
78
|
+
<Button onClick={() => toggleOpen()}>
|
|
79
|
+
OK
|
|
80
|
+
</Button>
|
|
81
|
+
</DialogActions>
|
|
82
|
+
</Dialog>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const styles = () => ({
|
|
88
|
+
urlContainer: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
marginTop: '3px',
|
|
91
|
+
minHeight: '10px',
|
|
92
|
+
},
|
|
93
|
+
viewLink: {
|
|
94
|
+
overflow: 'hidden',
|
|
95
|
+
textOverflow: 'ellipsis',
|
|
96
|
+
fontFamily: 'Nunito',
|
|
97
|
+
fontSize: '12px',
|
|
98
|
+
fontWeight: '500',
|
|
99
|
+
lineHeight: '16px',
|
|
100
|
+
letterSpacing: '0em',
|
|
101
|
+
padding: '2px 5px',
|
|
102
|
+
borderRadius: '5px',
|
|
103
|
+
float: 'left',
|
|
104
|
+
color: '#1D79A8',
|
|
105
|
+
backgroundColor: '#fff',
|
|
106
|
+
margin: '0',
|
|
107
|
+
whiteSpace: 'nowrap',
|
|
108
|
+
wordBreak: 'break-all',
|
|
109
|
+
'@media (max-width: 2560px)': {
|
|
110
|
+
maxWidth: '1800px',
|
|
111
|
+
},
|
|
112
|
+
'@media (max-width: 2000px)': {
|
|
113
|
+
maxWidth: '1500px',
|
|
114
|
+
},
|
|
115
|
+
'@media (max-width: 1600px)': {
|
|
116
|
+
maxWidth: '1100px',
|
|
117
|
+
},
|
|
118
|
+
'@media (max-width: 1300px)': {
|
|
119
|
+
maxWidth: '900px',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
urlViewBtn: {
|
|
123
|
+
cursor: 'pointer',
|
|
124
|
+
},
|
|
125
|
+
viewLinkToggleBtn: {
|
|
126
|
+
padding: '5px 10px 5px 10px',
|
|
127
|
+
height: '20px',
|
|
128
|
+
fontFamily: 'Nunito',
|
|
129
|
+
fontSize: '12px',
|
|
130
|
+
fontWeight: '500',
|
|
131
|
+
lineHeight: '16px',
|
|
132
|
+
letterSpacing: '0em',
|
|
133
|
+
textAlign: 'left',
|
|
134
|
+
backgroundColor: '#1D79A8',
|
|
135
|
+
textTransform: 'none',
|
|
136
|
+
color: '#fff',
|
|
137
|
+
float: 'left',
|
|
138
|
+
margin: '0px 10px 0px 0px',
|
|
139
|
+
whiteSpace: 'nowrap',
|
|
140
|
+
'&:hover': {
|
|
141
|
+
backgroundColor: '#1D79A8',
|
|
142
|
+
color: '#fff',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
copyIconBtn: {
|
|
146
|
+
padding: '0px',
|
|
147
|
+
height: '20px',
|
|
148
|
+
marginLeft: '10px',
|
|
149
|
+
float: 'left',
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
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
|
|
@@ -48,6 +49,18 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
48
49
|
? functions.resetFacetSlider
|
|
49
50
|
: DEFAULT_CONFIG.functions.resetFacetSlider;
|
|
50
51
|
|
|
52
|
+
const queryURLRootPath = config && typeof config.rootPath === 'string'
|
|
53
|
+
? config.rootPath
|
|
54
|
+
: DEFAULT_CONFIG.config.rootPath;
|
|
55
|
+
|
|
56
|
+
const viewQueryURL = config && typeof config.viewQueryURL === 'boolean'
|
|
57
|
+
? config.viewQueryURL
|
|
58
|
+
: DEFAULT_CONFIG.config.viewQueryURL;
|
|
59
|
+
|
|
60
|
+
const queryUrlCharacterLimit = config && typeof config.queryUrlCharacterLimit === 'number'
|
|
61
|
+
? config.queryUrlCharacterLimit
|
|
62
|
+
: DEFAULT_CONFIG.config.queryUrlCharacterLimit;
|
|
63
|
+
|
|
51
64
|
return {
|
|
52
65
|
QueryBar: withStyles(DEFAULT_STYLES, { withTheme: true })((props) => {
|
|
53
66
|
const { statusReducer, localFind, classes } = props;
|
|
@@ -178,6 +191,17 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
178
191
|
/>
|
|
179
192
|
))}
|
|
180
193
|
</span>
|
|
194
|
+
{
|
|
195
|
+
(viewQueryURL && queryURLRootPath) && (
|
|
196
|
+
<QueryUrl
|
|
197
|
+
classes={classes}
|
|
198
|
+
localFind={localFind}
|
|
199
|
+
filterItems={mappedInputs}
|
|
200
|
+
rootPath={queryURLRootPath}
|
|
201
|
+
queryUrlCharacterLimit={queryUrlCharacterLimit}
|
|
202
|
+
/>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
181
205
|
</div>
|
|
182
206
|
);
|
|
183
207
|
}),
|
package/src/generators/config.js
CHANGED
|
@@ -7,6 +7,21 @@ export default {
|
|
|
7
7
|
* @var {number}
|
|
8
8
|
*/
|
|
9
9
|
maxItems: 2,
|
|
10
|
+
/**
|
|
11
|
+
* set root path for copy url
|
|
12
|
+
* @var {boolean}
|
|
13
|
+
*/
|
|
14
|
+
rootPath: `${window.location.href}/`,
|
|
15
|
+
/**
|
|
16
|
+
* display copy url button
|
|
17
|
+
* @var {boolean}
|
|
18
|
+
*/
|
|
19
|
+
viewQueryURL: true,
|
|
20
|
+
/**
|
|
21
|
+
* display copy url button
|
|
22
|
+
* @var {boolean}
|
|
23
|
+
*/
|
|
24
|
+
queryUrlCharacterLimit: 70,
|
|
10
25
|
},
|
|
11
26
|
|
|
12
27
|
/* Component Helper Functions */
|
|
@@ -16,21 +31,21 @@ export default {
|
|
|
16
31
|
*
|
|
17
32
|
* @returns {void}
|
|
18
33
|
*/
|
|
19
|
-
clearAll: () => {},
|
|
34
|
+
clearAll: () => { },
|
|
20
35
|
|
|
21
36
|
/**
|
|
22
37
|
* Clear all active Local Find file upload filters
|
|
23
38
|
*
|
|
24
39
|
* @returns {void}
|
|
25
40
|
*/
|
|
26
|
-
clearUpload: () => {},
|
|
41
|
+
clearUpload: () => { },
|
|
27
42
|
|
|
28
43
|
/**
|
|
29
44
|
* Clear all active Local Find searchbox filters
|
|
30
45
|
*
|
|
31
46
|
* @returns {void}
|
|
32
47
|
*/
|
|
33
|
-
clearAutocomplete: () => {},
|
|
48
|
+
clearAutocomplete: () => { },
|
|
34
49
|
|
|
35
50
|
/**
|
|
36
51
|
* Delete a specific Local Find searchbox filter (case)
|
|
@@ -38,7 +53,7 @@ export default {
|
|
|
38
53
|
* @param {string} title
|
|
39
54
|
* @returns {void}
|
|
40
55
|
*/
|
|
41
|
-
deleteAutocompleteItem: (title) => {},
|
|
56
|
+
deleteAutocompleteItem: (title) => { },
|
|
42
57
|
|
|
43
58
|
/**
|
|
44
59
|
* Reset a specific facet section (e.g. Program)
|
|
@@ -46,7 +61,7 @@ export default {
|
|
|
46
61
|
* @param {object} section the configuration object for the section
|
|
47
62
|
* @returns {void}
|
|
48
63
|
*/
|
|
49
|
-
resetFacetSection: (section) => {},
|
|
64
|
+
resetFacetSection: (section) => { },
|
|
50
65
|
|
|
51
66
|
/**
|
|
52
67
|
* Reset a specific facet checkbox (e.g. Program > TAILORx)
|
|
@@ -55,7 +70,7 @@ export default {
|
|
|
55
70
|
* @param {string} checkbox the name of the checkbox
|
|
56
71
|
* @returns {void}
|
|
57
72
|
*/
|
|
58
|
-
resetFacetCheckbox: (section, checkbox) => {},
|
|
73
|
+
resetFacetCheckbox: (section, checkbox) => { },
|
|
59
74
|
|
|
60
75
|
/**
|
|
61
76
|
* Reset a specific slider section (e.g. Age)
|
|
@@ -63,6 +78,6 @@ export default {
|
|
|
63
78
|
* @param {object} section the configuration object for the section
|
|
64
79
|
* @returns {void}
|
|
65
80
|
*/
|
|
66
|
-
resetFacetSlider: (section) => {},
|
|
81
|
+
resetFacetSlider: (section) => { },
|
|
67
82
|
},
|
|
68
83
|
};
|
package/src/generators/styles.js
CHANGED
|
@@ -105,46 +105,67 @@ export default () => ({
|
|
|
105
105
|
facetSectionFilesBackground: {
|
|
106
106
|
backgroundColor: '#F5C3F1',
|
|
107
107
|
},
|
|
108
|
-
|
|
108
|
+
facetSectionDiagnosis: {
|
|
109
109
|
color: '#357288',
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
facetSectionDiagnosisBackground: {
|
|
112
112
|
backgroundColor: '#E4ECE9',
|
|
113
113
|
border: '1px solid #646464',
|
|
114
114
|
},
|
|
115
|
-
|
|
115
|
+
facetSectionDemographics: {
|
|
116
116
|
color: '#8C3F8D',
|
|
117
117
|
},
|
|
118
|
-
|
|
118
|
+
facetSectionDemographicsBackground: {
|
|
119
119
|
backgroundColor: '#E1C9E140',
|
|
120
120
|
border: '1px solid #646464',
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
facetSectionTreatment: {
|
|
123
|
+
color: '#4555AB',
|
|
124
|
+
},
|
|
125
|
+
facetSectionTreatmentBackground: {
|
|
126
|
+
backgroundColor: '#4555AB30',
|
|
127
|
+
border: '1px solid #646464',
|
|
128
|
+
},
|
|
129
|
+
facetSectionTreatmentresponse: {
|
|
123
130
|
color: '#907642',
|
|
124
131
|
},
|
|
125
|
-
|
|
132
|
+
facetSectionTreatmentresponseBackground: {
|
|
126
133
|
backgroundColor: '#F0DFBD40',
|
|
127
134
|
border: '1px solid #646464',
|
|
128
135
|
},
|
|
129
|
-
|
|
136
|
+
facetSectionSurvival: {
|
|
130
137
|
color: '#A85348',
|
|
131
138
|
},
|
|
132
|
-
|
|
139
|
+
facetSectionSurvivalBackground: {
|
|
133
140
|
backgroundColor: '#F8D7D240',
|
|
134
141
|
border: '1px solid #646464',
|
|
135
142
|
},
|
|
136
|
-
|
|
143
|
+
facetSectionSamples: {
|
|
137
144
|
color: '#1F6BBF',
|
|
138
145
|
},
|
|
139
|
-
|
|
146
|
+
facetSectionSamplesBackground: {
|
|
140
147
|
backgroundColor: '#CEDEF040',
|
|
141
148
|
border: '1px solid #646464',
|
|
142
149
|
},
|
|
143
|
-
|
|
150
|
+
facetSectionDatacategory: {
|
|
144
151
|
color: '#14A773',
|
|
145
152
|
},
|
|
146
|
-
|
|
153
|
+
facetSectionDatacategoryBackground: {
|
|
147
154
|
backgroundColor: '#DDEAE540',
|
|
148
155
|
border: '1px solid #646464',
|
|
149
156
|
},
|
|
157
|
+
facetSectionStudy: {
|
|
158
|
+
color: '#357288',
|
|
159
|
+
},
|
|
160
|
+
facetSectionStudyBackground: {
|
|
161
|
+
backgroundColor: '#E4ECE9',
|
|
162
|
+
border: '1px solid #646464',
|
|
163
|
+
},
|
|
164
|
+
facetSectionSequencinglibrary: {
|
|
165
|
+
color: '#8C3F8D',
|
|
166
|
+
},
|
|
167
|
+
facetSectionSequencinglibraryBackground: {
|
|
168
|
+
backgroundColor: '#E1C9E140',
|
|
169
|
+
border: '1px solid #646464',
|
|
170
|
+
},
|
|
150
171
|
});
|