@bento-core/query-bar 1.0.1-icdc.9 → 1.0.1-ins.1
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 +0 -25
- package/dist/generators/QueryBarGenerator.js +26 -25
- package/dist/generators/config.js +2 -7
- package/dist/generators/styles.js +2 -119
- package/package.json +13 -5
- package/src/generators/QueryBarGenerator.js +141 -147
- package/src/generators/config.js +2 -7
- package/src/generators/styles.js +2 -119
- package/dist/assets/CopyIcon.svg +0 -3
- package/dist/components/QueryUrl.js +0 -127
- package/src/assets/CopyIcon.svg +0 -3
- package/src/components/QueryUrl.js +0 -156
package/README.md
CHANGED
|
@@ -58,30 +58,6 @@ 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',
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* root path of bento app {window.location.href} or react PUBLIC_URL
|
|
74
|
-
* PR (https://github.com/CBIIT/bento-icdc-frontend/pull/953)
|
|
75
|
-
* @var {string}
|
|
76
|
-
*/
|
|
77
|
-
rootPath: null,
|
|
78
|
-
/**
|
|
79
|
-
* display query URL
|
|
80
|
-
* @var {boolean}
|
|
81
|
-
* PR (https://github.com/CBIIT/bento-icdc-frontend/pull/953)
|
|
82
|
-
*/
|
|
83
|
-
viewQueryURL: false,
|
|
84
|
-
|
|
85
61
|
},
|
|
86
62
|
|
|
87
63
|
/* Component Helper Functions */
|
|
@@ -139,7 +115,6 @@ const CONFIG = {
|
|
|
139
115
|
* @returns {void}
|
|
140
116
|
*/
|
|
141
117
|
resetFacetSlider: (section) => {},
|
|
142
|
-
|
|
143
118
|
},
|
|
144
119
|
};
|
|
145
120
|
```
|
|
@@ -11,7 +11,6 @@ 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"));
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
15
|
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); }
|
|
17
16
|
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; }
|
|
@@ -38,13 +37,9 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
38
37
|
} = _facetFilter.InputTypes;
|
|
39
38
|
const styles = () => _objectSpread(_objectSpread({}, (0, _styles.default)()), customStyles);
|
|
40
39
|
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;
|
|
43
40
|
const displayAllActiveFilters = config && typeof config.displayAllActiveFilters === 'boolean' ? config.displayAllActiveFilters : _config.default.config.displayAllActiveFilters;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// ? config.group : DEFAULT_CONFIG.config.group;
|
|
47
|
-
|
|
41
|
+
const group = config && typeof config.group === 'string' ? config.group : _config.default.config.group;
|
|
42
|
+
const count = config && typeof config.count === 'string' ? config.count : _config.default.config.count;
|
|
48
43
|
const clearAll = functions && typeof functions.clearAll === 'function' ? functions.clearAll : _config.default.functions.clearAll;
|
|
49
44
|
const clearUpload = functions && typeof functions.clearUpload === 'function' ? functions.clearUpload : _config.default.functions.clearUpload;
|
|
50
45
|
const clearAutocomplete = functions && typeof functions.clearAutocomplete === 'function' ? functions.clearAutocomplete : _config.default.functions.clearAutocomplete;
|
|
@@ -83,6 +78,7 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
83
78
|
return facet;
|
|
84
79
|
}
|
|
85
80
|
const {
|
|
81
|
+
data,
|
|
86
82
|
items
|
|
87
83
|
} = facet;
|
|
88
84
|
const itemKeys = Object.keys(items);
|
|
@@ -90,25 +86,35 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
90
86
|
|
|
91
87
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
92
88
|
* and remove them from the list of selected checkboxes artificially */
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
89
|
+
itemKeys.forEach(item => {
|
|
90
|
+
if (data.findIndex(d => d.group === item) < 0) {
|
|
91
|
+
itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
// return { ...facet, items: itemKeys };
|
|
99
95
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
96
|
+
* Maintain consistant behavior with facet filter component
|
|
97
|
+
* Display the active filter items based on the count value
|
|
98
|
+
* Display active filter items in query bar only if count is greater than 0
|
|
99
|
+
* behavior similar to filter component
|
|
103
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
|
+
}, []);
|
|
104
110
|
return _objectSpread(_objectSpread({}, facet), {}, {
|
|
105
|
-
items:
|
|
111
|
+
items: displayItems
|
|
106
112
|
});
|
|
107
113
|
}).filter(facet => facet.items.length > 0);
|
|
108
114
|
if ((mappedInputs.length || autocomplete.length || upload.length) <= 0) {
|
|
109
115
|
return null;
|
|
110
116
|
}
|
|
111
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
117
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
112
118
|
className: classes.queryWrapper
|
|
113
119
|
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
114
120
|
className: classes.clearQueryButton,
|
|
@@ -125,7 +131,7 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
125
131
|
}, "INPUT CASE SET") : null, autocomplete.length ? /*#__PURE__*/_react.default.createElement("span", null, ' ', /*#__PURE__*/_react.default.createElement("span", {
|
|
126
132
|
className: (0, _clsx.default)(classes.filterName, classes.localFindBackground),
|
|
127
133
|
onClick: clearAutocomplete
|
|
128
|
-
}, "Case
|
|
134
|
+
}, "Case IDs"), ' ', ' ', /*#__PURE__*/_react.default.createElement("span", {
|
|
129
135
|
className: classes.operators
|
|
130
136
|
}, autocomplete.length === 1 && !upload.length ? 'IS ' : 'IN ')) : null, /*#__PURE__*/_react.default.createElement("span", null, (upload.length > 0 ? 1 : 0) + autocomplete.length > 1 ? /*#__PURE__*/_react.default.createElement("span", {
|
|
131
137
|
className: classes.bracketsOpen
|
|
@@ -157,12 +163,7 @@ const QueryBarGenerator = function QueryBarGenerator() {
|
|
|
157
163
|
classes: classes,
|
|
158
164
|
onSectionClick: filter.type === CHECKBOX ? resetFacetSection : resetFacetSlider,
|
|
159
165
|
onItemClick: filter.type === CHECKBOX ? resetFacetCheckbox : resetFacetSlider
|
|
160
|
-
}))))
|
|
161
|
-
classes: classes,
|
|
162
|
-
localFind: localFind,
|
|
163
|
-
filterItems: mappedInputs,
|
|
164
|
-
rootPath: queryURLRootPath
|
|
165
|
-
})));
|
|
166
|
+
})))));
|
|
166
167
|
})
|
|
167
168
|
};
|
|
168
169
|
};
|
|
@@ -24,15 +24,10 @@ var _default = {
|
|
|
24
24
|
*/
|
|
25
25
|
group: 'group',
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* key to access count value
|
|
28
28
|
* @var {boolean}
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* display query URL
|
|
33
|
-
* @var {boolean}
|
|
34
|
-
*/
|
|
35
|
-
viewQueryURL: true
|
|
30
|
+
count: 'subjects'
|
|
36
31
|
},
|
|
37
32
|
/* Component Helper Functions */
|
|
38
33
|
functions: {
|
|
@@ -92,10 +92,10 @@ var _default = () => ({
|
|
|
92
92
|
localFindBackground: {
|
|
93
93
|
backgroundColor: '#C0E9D7'
|
|
94
94
|
},
|
|
95
|
-
|
|
95
|
+
facetSectionProjects: {
|
|
96
96
|
color: '#10A075'
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
facetSectionProjectsBackground: {
|
|
99
99
|
backgroundColor: '#C0E9D7'
|
|
100
100
|
},
|
|
101
101
|
facetSectionFiles: {
|
|
@@ -119,123 +119,6 @@ var _default = () => ({
|
|
|
119
119
|
'&:hover': {
|
|
120
120
|
cursor: 'pointer'
|
|
121
121
|
}
|
|
122
|
-
},
|
|
123
|
-
urlContainer: {
|
|
124
|
-
marginTop: '10px',
|
|
125
|
-
minHeight: '10px',
|
|
126
|
-
marginBottom: '10px'
|
|
127
|
-
},
|
|
128
|
-
link: {
|
|
129
|
-
lineBreak: 'anywhere',
|
|
130
|
-
overflow: 'hidden',
|
|
131
|
-
fontFamily: 'Nunito',
|
|
132
|
-
fontSize: '12px',
|
|
133
|
-
fontWeight: '500',
|
|
134
|
-
lineHeight: '16px',
|
|
135
|
-
letterSpacing: '0em',
|
|
136
|
-
padding: '5px',
|
|
137
|
-
borderRadius: '5px',
|
|
138
|
-
float: 'left',
|
|
139
|
-
color: '#1D79A8',
|
|
140
|
-
backgroundColor: '#fff',
|
|
141
|
-
maxWidth: '80%'
|
|
142
|
-
},
|
|
143
|
-
viewLink: {
|
|
144
|
-
margin: '0'
|
|
145
|
-
},
|
|
146
|
-
collapseLink: {
|
|
147
|
-
maxHeight: '1em',
|
|
148
|
-
display: 'block',
|
|
149
|
-
// display: '-webkit-box',
|
|
150
|
-
'-webkit-box-orient': 'vertical',
|
|
151
|
-
'-webkit-line-clamp': '1',
|
|
152
|
-
overflow: 'hidden'
|
|
153
|
-
},
|
|
154
|
-
expandLink: {
|
|
155
|
-
cursor: 'pointer'
|
|
156
|
-
},
|
|
157
|
-
expandLinkBtn: {
|
|
158
|
-
float: 'left',
|
|
159
|
-
'&:hover': {
|
|
160
|
-
cursor: 'pointer'
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
viewLinkToggleBtn: {
|
|
164
|
-
height: '20px',
|
|
165
|
-
marginRight: '10px',
|
|
166
|
-
fontFamily: 'Nunito',
|
|
167
|
-
fontSize: '12px',
|
|
168
|
-
fontWeight: '500',
|
|
169
|
-
lineHeight: '16px',
|
|
170
|
-
letterSpacing: '0em',
|
|
171
|
-
textAlign: 'left',
|
|
172
|
-
backgroundColor: '#1D79A8',
|
|
173
|
-
textTransform: 'none',
|
|
174
|
-
color: '#fff',
|
|
175
|
-
float: 'left',
|
|
176
|
-
'&:hover': {
|
|
177
|
-
backgroundColor: '#1D79A8',
|
|
178
|
-
color: '#fff'
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
urlView: {
|
|
182
|
-
float: 'left',
|
|
183
|
-
width: 'calc(100% - 13px)',
|
|
184
|
-
minWidth: '840px',
|
|
185
|
-
'@media (max-width: 2560px)': {
|
|
186
|
-
maxWidth: '1800px'
|
|
187
|
-
},
|
|
188
|
-
'@media (max-width: 2000px)': {
|
|
189
|
-
maxWidth: '1400px'
|
|
190
|
-
},
|
|
191
|
-
'@media (max-width: 1600px)': {
|
|
192
|
-
maxWidth: '1200px'
|
|
193
|
-
},
|
|
194
|
-
'@media (max-width: 1300px)': {
|
|
195
|
-
maxWidth: '1050px'
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
copyIconBtn: {
|
|
199
|
-
padding: '0px',
|
|
200
|
-
marginLeft: '10px',
|
|
201
|
-
float: 'left'
|
|
202
|
-
},
|
|
203
|
-
dialogBox: {
|
|
204
|
-
'& div.MuiBackdrop-root': {
|
|
205
|
-
backgroundColor: 'rgba(0, 0, 0, 0.2)'
|
|
206
|
-
},
|
|
207
|
-
'& div.MuiPaper-root': {
|
|
208
|
-
borderRadius: '20px',
|
|
209
|
-
border: '2px solid #1D79A8',
|
|
210
|
-
width: '430px',
|
|
211
|
-
backgroundColor: '#E8EFEF',
|
|
212
|
-
padding: '20px 0px 30px 0px',
|
|
213
|
-
'& .MuiDialogContent-root': {
|
|
214
|
-
fontFamily: 'Nunito',
|
|
215
|
-
fontSize: '14px',
|
|
216
|
-
fontWeight: '600',
|
|
217
|
-
lineHeight: '20px',
|
|
218
|
-
textAlign: 'center',
|
|
219
|
-
'& .MuiTypography-colorTextSecondary': {
|
|
220
|
-
color: '#000000'
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
'& .MuiDialogActions-root': {
|
|
224
|
-
'& button': {
|
|
225
|
-
width: '125px',
|
|
226
|
-
height: '38px',
|
|
227
|
-
borderRadius: '8px',
|
|
228
|
-
border: '1px solid #1A8CCB',
|
|
229
|
-
backgroundColor: '#1A8CCB',
|
|
230
|
-
color: '#fff',
|
|
231
|
-
fontFamily: 'Lato',
|
|
232
|
-
fontSize: '16px',
|
|
233
|
-
fontWeight: '400',
|
|
234
|
-
lineHeight: '16px',
|
|
235
|
-
margin: 'auto'
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
122
|
}
|
|
240
123
|
});
|
|
241
124
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/query-bar",
|
|
3
|
-
"version": "1.0.1-
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.0.1-ins.1",
|
|
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": {
|
|
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":
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/CBIIT/bento-frontend.git"
|
|
14
|
+
},
|
|
12
15
|
"publishConfig": {
|
|
13
16
|
"access": "public"
|
|
14
17
|
},
|
|
@@ -20,9 +23,14 @@
|
|
|
20
23
|
"react-redux": "^7.2.1"
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@bento-core/facet-filter": "
|
|
26
|
+
"@bento-core/facet-filter": "1.0.1-ins.0",
|
|
24
27
|
"lodash": "^4.17.20"
|
|
25
28
|
},
|
|
26
29
|
"author": "CTOS Bento Team",
|
|
27
|
-
"license": "ISC"
|
|
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": {}
|
|
28
36
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { withStyles, Button } from '@material-ui/core';
|
|
3
|
+
// eslint-disable-next-line import/no-unresolved
|
|
3
4
|
import { InputTypes } from '@bento-core/facet-filter';
|
|
4
5
|
import clsx from 'clsx';
|
|
5
6
|
import { Filter } from '../components/FilterMap';
|
|
6
7
|
import DEFAULT_STYLES from './styles';
|
|
7
8
|
import DEFAULT_CONFIG from './config';
|
|
8
|
-
import QueryUrl from '../components/QueryUrl';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Generate a pre-configured Explore Query Bar component
|
|
@@ -24,20 +24,15 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
24
24
|
? config.maxItems
|
|
25
25
|
: DEFAULT_CONFIG.config.maxItems;
|
|
26
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
|
-
|
|
35
27
|
const displayAllActiveFilters = config && typeof config.displayAllActiveFilters === 'boolean'
|
|
36
28
|
? config.displayAllActiveFilters
|
|
37
29
|
: DEFAULT_CONFIG.config.displayAllActiveFilters;
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const group = config && typeof config.group === 'string'
|
|
32
|
+
? config.group : DEFAULT_CONFIG.config.group;
|
|
33
|
+
|
|
34
|
+
const count = config && typeof config.count === 'string'
|
|
35
|
+
? config.count : DEFAULT_CONFIG.config.count;
|
|
41
36
|
|
|
42
37
|
const clearAll = functions && typeof functions.clearAll === 'function'
|
|
43
38
|
? functions.clearAll
|
|
@@ -89,24 +84,35 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
89
84
|
.map((facet) => {
|
|
90
85
|
if (facet.type !== CHECKBOX) { return facet; }
|
|
91
86
|
|
|
92
|
-
const { items } = facet;
|
|
87
|
+
const { data, items } = facet;
|
|
93
88
|
const itemKeys = Object.keys(items);
|
|
94
89
|
itemKeys.sort((a, b) => a.localeCompare(b));
|
|
95
90
|
|
|
96
91
|
/* Find any SELECTED CHECKBOXES that do NOT have any data
|
|
97
92
|
* and remove them from the list of selected checkboxes artificially */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
itemKeys.forEach((item) => {
|
|
94
|
+
if (data.findIndex((d) => d.group === item) < 0) {
|
|
95
|
+
itemKeys.splice(itemKeys.indexOf(item), 1);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
// return { ...facet, items: itemKeys };
|
|
104
99
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
100
|
+
* Maintain consistant behavior with facet filter component
|
|
101
|
+
* Display the active filter items based on the count value
|
|
102
|
+
* Display active filter items in query bar only if count is greater than 0
|
|
103
|
+
* behavior similar to filter component
|
|
108
104
|
*/
|
|
109
|
-
|
|
105
|
+
// const { group, count } = config;
|
|
106
|
+
const displayItems = itemKeys.reduce((accumulator, item) => {
|
|
107
|
+
const itemList = data.filter((d) => (d[group] === item && d[count] > 0)) || [];
|
|
108
|
+
if (itemList.length > 0) {
|
|
109
|
+
const labels = itemList.map((filter) => filter[group]);
|
|
110
|
+
accumulator.push(labels);
|
|
111
|
+
}
|
|
112
|
+
return accumulator;
|
|
113
|
+
}, []);
|
|
114
|
+
|
|
115
|
+
return { ...facet, items: displayItems };
|
|
110
116
|
})
|
|
111
117
|
.filter((facet) => facet.items.length > 0);
|
|
112
118
|
|
|
@@ -115,143 +121,131 @@ export const QueryBarGenerator = (uiConfig = DEFAULT_CONFIG) => {
|
|
|
115
121
|
}
|
|
116
122
|
|
|
117
123
|
return (
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
<div className={classes.queryWrapper}>
|
|
125
|
+
<Button
|
|
126
|
+
className={classes.clearQueryButton}
|
|
127
|
+
color="primary"
|
|
128
|
+
variant="outlined"
|
|
129
|
+
onClick={clearAll}
|
|
130
|
+
>
|
|
131
|
+
Clear Query
|
|
132
|
+
</Button>
|
|
133
|
+
<span className={classes.divider} />
|
|
134
|
+
<span className={classes.queryContainer}>
|
|
135
|
+
{/* Local Find Selections */}
|
|
136
|
+
{/* TODO: Refactor this into a separate component */}
|
|
137
|
+
{(autocomplete.length || upload.length) ? (
|
|
138
|
+
<span>
|
|
139
|
+
{/* Standalone case set button */}
|
|
140
|
+
{(upload.length && !autocomplete.length)
|
|
141
|
+
? (
|
|
142
|
+
<span
|
|
143
|
+
className={clsx(classes.filterCheckboxes, classes.localFindBackground)}
|
|
144
|
+
onClick={clearUpload}
|
|
145
|
+
>
|
|
146
|
+
INPUT CASE SET
|
|
147
|
+
</span>
|
|
148
|
+
) : null}
|
|
149
|
+
{autocomplete.length
|
|
150
|
+
? (
|
|
151
|
+
<span>
|
|
152
|
+
{' '}
|
|
153
|
+
<span
|
|
154
|
+
className={clsx(classes.filterName, classes.localFindBackground)}
|
|
155
|
+
onClick={clearAutocomplete}
|
|
156
|
+
>
|
|
157
|
+
Case IDs
|
|
158
|
+
</span>
|
|
159
|
+
{' '}
|
|
160
|
+
{' '}
|
|
161
|
+
<span className={classes.operators}>
|
|
162
|
+
{(autocomplete.length === 1 && !upload.length) ? 'IS ' : 'IN '}
|
|
163
|
+
</span>
|
|
164
|
+
</span>
|
|
165
|
+
) : null}
|
|
133
166
|
<span>
|
|
134
|
-
{
|
|
135
|
-
|
|
136
|
-
|
|
167
|
+
{(((upload.length > 0 ? 1 : 0) + autocomplete.length) > 1)
|
|
168
|
+
? <span className={classes.bracketsOpen}>(</span>
|
|
169
|
+
: null}
|
|
170
|
+
{upload.length && autocomplete.length ? (
|
|
171
|
+
<>
|
|
172
|
+
{' '}
|
|
137
173
|
<span
|
|
138
|
-
className={clsx(classes.filterCheckboxes, classes.
|
|
174
|
+
className={clsx(classes.filterCheckboxes, classes.localFind)}
|
|
139
175
|
onClick={clearUpload}
|
|
140
176
|
>
|
|
141
177
|
INPUT CASE SET
|
|
142
178
|
</span>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<span
|
|
149
|
-
className={clsx(classes.filterName, classes.localFindBackground)}
|
|
150
|
-
onClick={clearAutocomplete}
|
|
151
|
-
>
|
|
152
|
-
Case ID
|
|
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) && (
|
|
179
|
+
{' '}
|
|
180
|
+
</>
|
|
181
|
+
) : null}
|
|
182
|
+
{autocomplete.slice(0, noOfItems).map((d, idx) => (
|
|
183
|
+
<>
|
|
206
184
|
<span
|
|
207
|
-
className={classes.
|
|
208
|
-
|
|
185
|
+
className={clsx(classes.filterCheckboxes, classes.facetSectionCases)}
|
|
186
|
+
key={idx}
|
|
187
|
+
onClick={() => deleteAutocompleteItem(d.title)}
|
|
209
188
|
>
|
|
210
|
-
{
|
|
189
|
+
{d.title}
|
|
211
190
|
</span>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
191
|
+
{idx === (noOfItems - 1) ? null : ' '}
|
|
192
|
+
</>
|
|
193
|
+
))}
|
|
194
|
+
{autocomplete.length > maxItems && (
|
|
195
|
+
<>
|
|
196
|
+
{
|
|
197
|
+
displayAllActiveFilters
|
|
198
|
+
? (
|
|
199
|
+
<span
|
|
200
|
+
className={classes.expandBtn}
|
|
201
|
+
onClick={() => setExpand(!expand)}
|
|
202
|
+
>
|
|
203
|
+
...
|
|
204
|
+
</span>
|
|
205
|
+
)
|
|
206
|
+
: '...'
|
|
207
|
+
}
|
|
208
|
+
</>
|
|
209
|
+
)}
|
|
210
|
+
{(expand && autocomplete.length > maxItems) && (
|
|
211
|
+
<span
|
|
212
|
+
className={classes.collapseBtn}
|
|
213
|
+
onClick={() => setExpand(!expand)}
|
|
214
|
+
>
|
|
215
|
+
{' LESS'}
|
|
216
|
+
</span>
|
|
217
|
+
)}
|
|
218
|
+
{(((upload.length > 0 ? 1 : 0) + autocomplete.length) > 1)
|
|
219
|
+
? <span className={classes.bracketsClose}>)</span>
|
|
220
|
+
: null}
|
|
217
221
|
</span>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
onSectionClick={filter.type === CHECKBOX
|
|
234
|
-
? resetFacetSection
|
|
235
|
-
: resetFacetSlider}
|
|
236
|
-
onItemClick={filter.type === CHECKBOX
|
|
237
|
-
? resetFacetCheckbox
|
|
238
|
-
: resetFacetSlider}
|
|
239
|
-
/>
|
|
240
|
-
</span>
|
|
241
|
-
))}
|
|
242
|
-
</span>
|
|
243
|
-
{
|
|
244
|
-
(viewQueryURL && queryURLRootPath) && (
|
|
245
|
-
<QueryUrl
|
|
222
|
+
</span>
|
|
223
|
+
) : null}
|
|
224
|
+
|
|
225
|
+
{/* Facet Sidebar Selections */}
|
|
226
|
+
{((autocomplete.length || upload.length) && mappedInputs.length)
|
|
227
|
+
? <span className={classes.operators}> AND </span>
|
|
228
|
+
: null}
|
|
229
|
+
{mappedInputs.map((filter, index) => (
|
|
230
|
+
<span className={clsName(filter.section)}>
|
|
231
|
+
<Filter
|
|
232
|
+
index={index}
|
|
233
|
+
type={filter.type}
|
|
234
|
+
data={filter}
|
|
235
|
+
maxItems={maxItems}
|
|
236
|
+
displayAllActiveFilters={displayAllActiveFilters}
|
|
246
237
|
classes={classes}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
238
|
+
onSectionClick={filter.type === CHECKBOX
|
|
239
|
+
? resetFacetSection
|
|
240
|
+
: resetFacetSlider}
|
|
241
|
+
onItemClick={filter.type === CHECKBOX
|
|
242
|
+
? resetFacetCheckbox
|
|
243
|
+
: resetFacetSlider}
|
|
250
244
|
/>
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
</
|
|
254
|
-
|
|
245
|
+
</span>
|
|
246
|
+
))}
|
|
247
|
+
</span>
|
|
248
|
+
</div>
|
|
255
249
|
);
|
|
256
250
|
}),
|
|
257
251
|
};
|
package/src/generators/config.js
CHANGED
|
@@ -18,15 +18,10 @@ export default {
|
|
|
18
18
|
*/
|
|
19
19
|
group: 'group',
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* key to access count value
|
|
22
22
|
* @var {boolean}
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* display query URL
|
|
27
|
-
* @var {boolean}
|
|
28
|
-
*/
|
|
29
|
-
viewQueryURL: true,
|
|
24
|
+
count: 'subjects',
|
|
30
25
|
},
|
|
31
26
|
|
|
32
27
|
/* Component Helper Functions */
|
package/src/generators/styles.js
CHANGED
|
@@ -86,10 +86,10 @@ export default () => ({
|
|
|
86
86
|
localFindBackground: {
|
|
87
87
|
backgroundColor: '#C0E9D7',
|
|
88
88
|
},
|
|
89
|
-
|
|
89
|
+
facetSectionProjects: {
|
|
90
90
|
color: '#10A075',
|
|
91
91
|
},
|
|
92
|
-
|
|
92
|
+
facetSectionProjectsBackground: {
|
|
93
93
|
backgroundColor: '#C0E9D7',
|
|
94
94
|
},
|
|
95
95
|
facetSectionFiles: {
|
|
@@ -114,121 +114,4 @@ export default () => ({
|
|
|
114
114
|
cursor: 'pointer',
|
|
115
115
|
},
|
|
116
116
|
},
|
|
117
|
-
urlContainer: {
|
|
118
|
-
marginTop: '10px',
|
|
119
|
-
minHeight: '10px',
|
|
120
|
-
marginBottom: '10px',
|
|
121
|
-
},
|
|
122
|
-
link: {
|
|
123
|
-
lineBreak: 'anywhere',
|
|
124
|
-
overflow: 'hidden',
|
|
125
|
-
fontFamily: 'Nunito',
|
|
126
|
-
fontSize: '12px',
|
|
127
|
-
fontWeight: '500',
|
|
128
|
-
lineHeight: '16px',
|
|
129
|
-
letterSpacing: '0em',
|
|
130
|
-
padding: '5px',
|
|
131
|
-
borderRadius: '5px',
|
|
132
|
-
float: 'left',
|
|
133
|
-
color: '#1D79A8',
|
|
134
|
-
backgroundColor: '#fff',
|
|
135
|
-
maxWidth: '80%',
|
|
136
|
-
},
|
|
137
|
-
viewLink: {
|
|
138
|
-
margin: '0',
|
|
139
|
-
},
|
|
140
|
-
collapseLink: {
|
|
141
|
-
maxHeight: '1em',
|
|
142
|
-
display: 'block',
|
|
143
|
-
// display: '-webkit-box',
|
|
144
|
-
'-webkit-box-orient': 'vertical',
|
|
145
|
-
'-webkit-line-clamp': '1',
|
|
146
|
-
overflow: 'hidden',
|
|
147
|
-
},
|
|
148
|
-
expandLink: {
|
|
149
|
-
cursor: 'pointer',
|
|
150
|
-
},
|
|
151
|
-
expandLinkBtn: {
|
|
152
|
-
float: 'left',
|
|
153
|
-
'&:hover': {
|
|
154
|
-
cursor: 'pointer',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
viewLinkToggleBtn: {
|
|
158
|
-
height: '20px',
|
|
159
|
-
marginRight: '10px',
|
|
160
|
-
fontFamily: 'Nunito',
|
|
161
|
-
fontSize: '12px',
|
|
162
|
-
fontWeight: '500',
|
|
163
|
-
lineHeight: '16px',
|
|
164
|
-
letterSpacing: '0em',
|
|
165
|
-
textAlign: 'left',
|
|
166
|
-
backgroundColor: '#1D79A8',
|
|
167
|
-
textTransform: 'none',
|
|
168
|
-
color: '#fff',
|
|
169
|
-
float: 'left',
|
|
170
|
-
'&:hover': {
|
|
171
|
-
backgroundColor: '#1D79A8',
|
|
172
|
-
color: '#fff',
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
urlView: {
|
|
176
|
-
float: 'left',
|
|
177
|
-
width: 'calc(100% - 13px)',
|
|
178
|
-
minWidth: '840px',
|
|
179
|
-
'@media (max-width: 2560px)': {
|
|
180
|
-
maxWidth: '1800px',
|
|
181
|
-
},
|
|
182
|
-
'@media (max-width: 2000px)': {
|
|
183
|
-
maxWidth: '1400px',
|
|
184
|
-
},
|
|
185
|
-
'@media (max-width: 1600px)': {
|
|
186
|
-
maxWidth: '1200px',
|
|
187
|
-
},
|
|
188
|
-
'@media (max-width: 1300px)': {
|
|
189
|
-
maxWidth: '1050px',
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
copyIconBtn: {
|
|
193
|
-
padding: '0px',
|
|
194
|
-
marginLeft: '10px',
|
|
195
|
-
float: 'left',
|
|
196
|
-
},
|
|
197
|
-
dialogBox: {
|
|
198
|
-
'& div.MuiBackdrop-root': {
|
|
199
|
-
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
200
|
-
},
|
|
201
|
-
'& div.MuiPaper-root': {
|
|
202
|
-
borderRadius: '20px',
|
|
203
|
-
border: '2px solid #1D79A8',
|
|
204
|
-
width: '430px',
|
|
205
|
-
backgroundColor: '#E8EFEF',
|
|
206
|
-
padding: '20px 0px 30px 0px',
|
|
207
|
-
'& .MuiDialogContent-root': {
|
|
208
|
-
fontFamily: 'Nunito',
|
|
209
|
-
fontSize: '14px',
|
|
210
|
-
fontWeight: '600',
|
|
211
|
-
lineHeight: '20px',
|
|
212
|
-
textAlign: 'center',
|
|
213
|
-
'& .MuiTypography-colorTextSecondary': {
|
|
214
|
-
color: '#000000',
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
'& .MuiDialogActions-root': {
|
|
218
|
-
'& button': {
|
|
219
|
-
width: '125px',
|
|
220
|
-
height: '38px',
|
|
221
|
-
borderRadius: '8px',
|
|
222
|
-
border: '1px solid #1A8CCB',
|
|
223
|
-
backgroundColor: '#1A8CCB',
|
|
224
|
-
color: '#fff',
|
|
225
|
-
fontFamily: 'Lato',
|
|
226
|
-
fontSize: '16px',
|
|
227
|
-
fontWeight: '400',
|
|
228
|
-
lineHeight: '16px',
|
|
229
|
-
margin: 'auto',
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
117
|
});
|
package/dist/assets/CopyIcon.svg
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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>
|
|
@@ -1,127 +0,0 @@
|
|
|
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 ViewFullLinkComponent = _ref => {
|
|
20
|
-
let {
|
|
21
|
-
classes,
|
|
22
|
-
url,
|
|
23
|
-
maxWidth = 1200
|
|
24
|
-
} = _ref;
|
|
25
|
-
const linkRef = (0, _react.useRef)(null);
|
|
26
|
-
const [expandLink, setExpand] = (0, _react.useState)(false);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Compute url link width based on the windowsize
|
|
30
|
-
*/
|
|
31
|
-
(0, _react.useEffect)(() => {
|
|
32
|
-
var _linkRef$current;
|
|
33
|
-
const urlWidth = linkRef === null || linkRef === void 0 ? void 0 : (_linkRef$current = linkRef.current) === null || _linkRef$current === void 0 ? void 0 : _linkRef$current.offsetWidth;
|
|
34
|
-
if (urlWidth > maxWidth / 2) {
|
|
35
|
-
setExpand(true);
|
|
36
|
-
}
|
|
37
|
-
}, []);
|
|
38
|
-
const expandUrl = () => {
|
|
39
|
-
setExpand(!expandLink);
|
|
40
|
-
};
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
42
|
-
ref: linkRef,
|
|
43
|
-
className: classes.link
|
|
44
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
45
|
-
className: (0, _clsx.default)(classes.viewLink, {
|
|
46
|
-
[classes.collapseLink]: expandLink
|
|
47
|
-
})
|
|
48
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
49
|
-
className: classes.urlView
|
|
50
|
-
}, url), expandLink && /*#__PURE__*/_react.default.createElement("span", {
|
|
51
|
-
className: classes.expandLinkBtn,
|
|
52
|
-
type: "button",
|
|
53
|
-
onClick: expandUrl
|
|
54
|
-
}, "..."))));
|
|
55
|
-
};
|
|
56
|
-
const QueryUrl = _ref2 => {
|
|
57
|
-
var _queryRef$current;
|
|
58
|
-
let {
|
|
59
|
-
classes,
|
|
60
|
-
filterItems,
|
|
61
|
-
localFind,
|
|
62
|
-
rootPath
|
|
63
|
-
} = _ref2;
|
|
64
|
-
const [display, setDisplay] = (0, _react.useState)(false);
|
|
65
|
-
const toggleDisplay = () => setDisplay(!display);
|
|
66
|
-
const [expand, setExpand] = (0, _react.useState)(false);
|
|
67
|
-
const [open, toggleOpen] = (0, _react.useState)(false);
|
|
68
|
-
const {
|
|
69
|
-
autocomplete = [],
|
|
70
|
-
upload
|
|
71
|
-
} = localFind;
|
|
72
|
-
const pathFilterParams = filterItems.reduce((acc, item) => {
|
|
73
|
-
const {
|
|
74
|
-
datafield,
|
|
75
|
-
items = []
|
|
76
|
-
} = item;
|
|
77
|
-
acc[datafield] = items;
|
|
78
|
-
return acc;
|
|
79
|
-
}, {});
|
|
80
|
-
const query = JSON.stringify(_objectSpread(_objectSpread({}, pathFilterParams), {}, {
|
|
81
|
-
autocomplete,
|
|
82
|
-
upload
|
|
83
|
-
}));
|
|
84
|
-
const url = encodeURI(rootPath.concat(query));
|
|
85
|
-
const copyUrl = async () => {
|
|
86
|
-
toggleOpen(!open);
|
|
87
|
-
await navigator.clipboard.writeText(url);
|
|
88
|
-
};
|
|
89
|
-
const queryRef = (0, _react.useRef)(null);
|
|
90
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
-
ref: queryRef,
|
|
92
|
-
className: classes.urlContainer
|
|
93
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
94
|
-
onClick: toggleDisplay,
|
|
95
|
-
className: classes.viewLinkToggleBtn
|
|
96
|
-
}, display ? 'Hide Query URL' : 'Show Query URL'), display && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, expand ? /*#__PURE__*/_react.default.createElement("span", {
|
|
97
|
-
type: "button",
|
|
98
|
-
onClick: () => setExpand(!expand),
|
|
99
|
-
className: (0, _clsx.default)(classes.link, classes.viewLink, classes.expandLink)
|
|
100
|
-
}, url) : /*#__PURE__*/_react.default.createElement(ViewFullLinkComponent, {
|
|
101
|
-
url: url,
|
|
102
|
-
classes: classes,
|
|
103
|
-
maxWidth: queryRef === null || queryRef === void 0 ? void 0 : (_queryRef$current = queryRef.current) === null || _queryRef$current === void 0 ? void 0 : _queryRef$current.offsetWidth
|
|
104
|
-
}), /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
105
|
-
arrow: true,
|
|
106
|
-
title: "Copy to Clipboard"
|
|
107
|
-
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
108
|
-
onClick: copyUrl,
|
|
109
|
-
className: classes.copyIconBtn
|
|
110
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
111
|
-
src: _CopyIcon.default,
|
|
112
|
-
alt: "copy icon"
|
|
113
|
-
}))))), /*#__PURE__*/_react.default.createElement(_core.Dialog, {
|
|
114
|
-
open: open,
|
|
115
|
-
"aria-labelledby": "alert-dialog-title",
|
|
116
|
-
"aria-describedby": "alert-dialog-description",
|
|
117
|
-
className: classes.dialogBox
|
|
118
|
-
}, /*#__PURE__*/_react.default.createElement(_core.DialogContent, {
|
|
119
|
-
className: classes.okText
|
|
120
|
-
}, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
|
|
121
|
-
id: "alert-dialog-description"
|
|
122
|
-
}, "Your query URL has been copied!")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
123
|
-
onClick: () => toggleOpen(!open)
|
|
124
|
-
}, "OK"))));
|
|
125
|
-
};
|
|
126
|
-
var _default = QueryUrl;
|
|
127
|
-
exports.default = _default;
|
package/src/assets/CopyIcon.svg
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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>
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, 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
|
-
} from '@material-ui/core';
|
|
12
|
-
import CopyIcon from '../assets/CopyIcon.svg';
|
|
13
|
-
|
|
14
|
-
const ViewFullLinkComponent = ({
|
|
15
|
-
classes,
|
|
16
|
-
url,
|
|
17
|
-
maxWidth = 1200,
|
|
18
|
-
}) => {
|
|
19
|
-
const linkRef = useRef(null);
|
|
20
|
-
const [expandLink, setExpand] = useState(false);
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Compute url link width based on the windowsize
|
|
24
|
-
*/
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
const urlWidth = linkRef?.current?.offsetWidth;
|
|
27
|
-
if (urlWidth > maxWidth / 2) {
|
|
28
|
-
setExpand(true);
|
|
29
|
-
}
|
|
30
|
-
}, []);
|
|
31
|
-
|
|
32
|
-
const expandUrl = () => {
|
|
33
|
-
setExpand(!expandLink);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<>
|
|
38
|
-
<span ref={linkRef} className={classes.link}>
|
|
39
|
-
<span
|
|
40
|
-
className={clsx(classes.viewLink,
|
|
41
|
-
{ [classes.collapseLink]: expandLink })}
|
|
42
|
-
>
|
|
43
|
-
<span className={classes.urlView}>
|
|
44
|
-
{url}
|
|
45
|
-
</span>
|
|
46
|
-
{(expandLink) && (
|
|
47
|
-
<span
|
|
48
|
-
className={classes.expandLinkBtn}
|
|
49
|
-
type="button"
|
|
50
|
-
onClick={expandUrl}
|
|
51
|
-
>
|
|
52
|
-
...
|
|
53
|
-
</span>
|
|
54
|
-
)}
|
|
55
|
-
</span>
|
|
56
|
-
</span>
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const QueryUrl = ({
|
|
62
|
-
classes,
|
|
63
|
-
filterItems,
|
|
64
|
-
localFind,
|
|
65
|
-
rootPath,
|
|
66
|
-
}) => {
|
|
67
|
-
const [display, setDisplay] = useState(false);
|
|
68
|
-
const toggleDisplay = () => setDisplay(!display);
|
|
69
|
-
|
|
70
|
-
const [expand, setExpand] = useState(false);
|
|
71
|
-
|
|
72
|
-
const [open, toggleOpen] = useState(false);
|
|
73
|
-
|
|
74
|
-
const { autocomplete = [], upload } = localFind;
|
|
75
|
-
|
|
76
|
-
const pathFilterParams = filterItems.reduce((acc, item) => {
|
|
77
|
-
const { datafield, items = [] } = item;
|
|
78
|
-
acc[datafield] = items;
|
|
79
|
-
return acc;
|
|
80
|
-
}, {});
|
|
81
|
-
|
|
82
|
-
const query = JSON.stringify({
|
|
83
|
-
...pathFilterParams,
|
|
84
|
-
autocomplete,
|
|
85
|
-
upload,
|
|
86
|
-
});
|
|
87
|
-
const url = encodeURI(rootPath.concat(query));
|
|
88
|
-
|
|
89
|
-
const copyUrl = async () => {
|
|
90
|
-
toggleOpen(!open);
|
|
91
|
-
await navigator.clipboard.writeText(url);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const queryRef = useRef(null);
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<>
|
|
98
|
-
<div ref={queryRef} className={classes.urlContainer}>
|
|
99
|
-
<Button
|
|
100
|
-
onClick={toggleDisplay}
|
|
101
|
-
className={classes.viewLinkToggleBtn}
|
|
102
|
-
>
|
|
103
|
-
{ (display) ? 'Hide Query URL' : 'Show Query URL'}
|
|
104
|
-
</Button>
|
|
105
|
-
{
|
|
106
|
-
(display) && (
|
|
107
|
-
<>
|
|
108
|
-
{(expand) ? (
|
|
109
|
-
<span
|
|
110
|
-
type="button"
|
|
111
|
-
onClick={() => setExpand(!expand)}
|
|
112
|
-
className={clsx(classes.link, classes.viewLink, classes.expandLink)}
|
|
113
|
-
>
|
|
114
|
-
{url}
|
|
115
|
-
</span>
|
|
116
|
-
) : (
|
|
117
|
-
<ViewFullLinkComponent
|
|
118
|
-
url={url}
|
|
119
|
-
classes={classes}
|
|
120
|
-
maxWidth={queryRef?.current?.offsetWidth}
|
|
121
|
-
/>
|
|
122
|
-
)}
|
|
123
|
-
<Tooltip
|
|
124
|
-
arrow
|
|
125
|
-
title="Copy to Clipboard"
|
|
126
|
-
>
|
|
127
|
-
<IconButton onClick={copyUrl} className={classes.copyIconBtn}>
|
|
128
|
-
<img src={CopyIcon} alt="copy icon" />
|
|
129
|
-
</IconButton>
|
|
130
|
-
</Tooltip>
|
|
131
|
-
</>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
</div>
|
|
135
|
-
<Dialog
|
|
136
|
-
open={open}
|
|
137
|
-
aria-labelledby="alert-dialog-title"
|
|
138
|
-
aria-describedby="alert-dialog-description"
|
|
139
|
-
className={classes.dialogBox}
|
|
140
|
-
>
|
|
141
|
-
<DialogContent className={classes.okText}>
|
|
142
|
-
<DialogContentText id="alert-dialog-description">
|
|
143
|
-
Your query URL has been copied!
|
|
144
|
-
</DialogContentText>
|
|
145
|
-
</DialogContent>
|
|
146
|
-
<DialogActions>
|
|
147
|
-
<Button onClick={() => toggleOpen(!open)}>
|
|
148
|
-
OK
|
|
149
|
-
</Button>
|
|
150
|
-
</DialogActions>
|
|
151
|
-
</Dialog>
|
|
152
|
-
</>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export default QueryUrl;
|