@cccsaurora/howler-ui 2.13.0-dev.132 → 2.13.0-dev.137
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/components/elements/hit/related/PivotLink.js +1 -2
- package/components/elements/hit/related/RelatedIcon.d.ts +8 -0
- package/components/elements/hit/related/RelatedIcon.js +32 -0
- package/components/elements/hit/related/RelatedLink.js +4 -25
- package/components/routes/advanced/QueryEditor.js +8 -13
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Icon } from '@iconify/react/dist/iconify.js';
|
|
3
2
|
import { Skeleton } from '@mui/material';
|
|
4
3
|
import Handlebars from 'handlebars';
|
|
5
4
|
import { isEmpty } from 'lodash-es';
|
|
@@ -32,7 +31,7 @@ const PivotLink = ({ pivot, hit, compact = false }) => {
|
|
|
32
31
|
return Handlebars.compile(pivot.value)(templateObject);
|
|
33
32
|
}, [flatHit, pivot]);
|
|
34
33
|
if (href) {
|
|
35
|
-
return
|
|
34
|
+
return _jsx(RelatedLink, { title: pivot.label[i18n.language], href: href, compact: compact, icon: pivot.icon });
|
|
36
35
|
}
|
|
37
36
|
try {
|
|
38
37
|
const pluginPivot = pluginStore.executeFunction(`pivot.${pivot.format}`, { pivot, hit, compact });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Icon, iconExists } from '@iconify/react/dist/iconify.js';
|
|
3
|
+
import Avatar from '@mui/material/Avatar';
|
|
4
|
+
import { useAppTheme } from '@cccsaurora/howler-ui/commons/components/app/hooks';
|
|
5
|
+
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
const RelatedIcon = ({ icon, title, href, compact = false }) => {
|
|
8
|
+
const { config } = useContext(ApiConfigContext);
|
|
9
|
+
const { isDark } = useAppTheme();
|
|
10
|
+
if (!icon) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (iconExists(icon)) {
|
|
14
|
+
return _jsx(Icon, { fontSize: "1.5rem", icon: icon });
|
|
15
|
+
}
|
|
16
|
+
const app = config.configuration.ui.apps.find(a => a.name.toLowerCase() === icon?.toLowerCase());
|
|
17
|
+
if (app) {
|
|
18
|
+
// use the image link for the configured related application instead
|
|
19
|
+
icon = app[`img_${isDark ? 'd' : 'l'}`];
|
|
20
|
+
}
|
|
21
|
+
return (_jsx(Avatar, { variant: "rounded", alt: title ?? href, src: icon, sx: [
|
|
22
|
+
theme => ({
|
|
23
|
+
width: theme.spacing(compact ? 4 : 6),
|
|
24
|
+
height: theme.spacing(compact ? 4 : 6),
|
|
25
|
+
'& img': {
|
|
26
|
+
objectFit: 'contain'
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
!icon && { backgroundColor: 'transparent' }
|
|
30
|
+
], children: icon }));
|
|
31
|
+
};
|
|
32
|
+
export default RelatedIcon;
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useAppTheme } from '@cccsaurora/howler-ui/commons/components/app/hooks';
|
|
4
|
-
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
2
|
+
import { Stack, Typography } from '@mui/material';
|
|
5
3
|
import HowlerCard from '@cccsaurora/howler-ui/components/elements/display/HowlerCard';
|
|
6
|
-
import React, {
|
|
4
|
+
import React, {} from 'react';
|
|
7
5
|
import { Link } from 'react-router-dom';
|
|
6
|
+
import RelatedIcon from './RelatedIcon';
|
|
8
7
|
const RelatedLink = ({ icon, title, href, compact = false, children }) => {
|
|
9
|
-
const { config } = useContext(ApiConfigContext);
|
|
10
|
-
const { isDark } = useAppTheme();
|
|
11
|
-
const _icon = useMemo(() => {
|
|
12
|
-
if (icon) {
|
|
13
|
-
const app = config.configuration.ui.apps.find(a => a.name.toLowerCase() === icon?.toLowerCase());
|
|
14
|
-
if (app) {
|
|
15
|
-
return app[`img_${isDark ? 'd' : 'l'}`];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return icon;
|
|
19
|
-
}, [config.configuration.ui.apps, icon, isDark]);
|
|
20
8
|
return (_jsx(HowlerCard, { variant: compact ? 'outlined' : 'elevation', onClick: () => window.open(href), sx: [
|
|
21
9
|
theme => ({
|
|
22
10
|
cursor: 'pointer',
|
|
@@ -29,15 +17,6 @@ const RelatedLink = ({ icon, title, href, compact = false, children }) => {
|
|
|
29
17
|
'& a': { textDecoration: 'none', color: 'text.primary' }
|
|
30
18
|
}),
|
|
31
19
|
!compact && { border: 'thin solid', borderColor: 'transparent' }
|
|
32
|
-
], children: _jsxs(Stack, { direction: "row", p: compact ? 0.5 : 1, spacing: 1, alignItems: "center", children: [children ||
|
|
33
|
-
theme => ({
|
|
34
|
-
width: theme.spacing(compact ? 4 : 6),
|
|
35
|
-
height: theme.spacing(compact ? 4 : 6),
|
|
36
|
-
'& img': {
|
|
37
|
-
objectFit: 'contain'
|
|
38
|
-
}
|
|
39
|
-
}),
|
|
40
|
-
!_icon && { backgroundColor: 'transparent' }
|
|
41
|
-
], children: _icon })), _jsx(Typography, { component: Link, to: href, onClick: e => e.stopPropagation(), children: title ?? href })] }) }, href));
|
|
20
|
+
], children: _jsxs(Stack, { direction: "row", p: compact ? 0.5 : 1, spacing: 1, alignItems: "center", children: [children || _jsx(RelatedIcon, { icon: icon, title: title, href: href, compact: compact }), _jsx(Typography, { component: Link, to: href, onClick: e => e.stopPropagation(), children: title ?? href })] }) }, href));
|
|
42
21
|
};
|
|
43
22
|
export default RelatedLink;
|
|
@@ -26,18 +26,6 @@ const QueryEditor = ({ query, setQuery, onMount, language = 'lucene', fontSize =
|
|
|
26
26
|
_monaco.languages.register({ id: 'lucene' });
|
|
27
27
|
_monaco.languages.register({ id: 'eql' });
|
|
28
28
|
}, []);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
const handleKeyPress = event => {
|
|
31
|
-
if (setFzfSearch && event.ctrlKey && event.key == 'r') {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
setFzfSearch(!fzfSearch);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
window.addEventListener('keydown', handleKeyPress);
|
|
37
|
-
return () => {
|
|
38
|
-
window.removeEventListener('keydown', handleKeyPress);
|
|
39
|
-
};
|
|
40
|
-
}, [fzfSearch, setFzfSearch]);
|
|
41
29
|
useEffect(() => {
|
|
42
30
|
if (!monaco) {
|
|
43
31
|
return;
|
|
@@ -90,6 +78,13 @@ const QueryEditor = ({ query, setQuery, onMount, language = 'lucene', fontSize =
|
|
|
90
78
|
fontSize,
|
|
91
79
|
...editorOptions
|
|
92
80
|
}), [setQuery, fontSize, editorOptions]);
|
|
93
|
-
|
|
81
|
+
const handleKeyPress = useCallback((event) => {
|
|
82
|
+
if (setFzfSearch && event.ctrlKey && event.key == 'r') {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
setFzfSearch(!fzfSearch);
|
|
86
|
+
}
|
|
87
|
+
}, [fzfSearch, setFzfSearch]);
|
|
88
|
+
return (_jsx(Box, { sx: { flex: 1 }, onKeyDownCapture: handleKeyPress, children: _jsx(ThemedEditor, { height: height, width: width, theme: theme.palette.mode === 'light' ? 'howler' : 'howler-dark', value: query, onChange: value => setQuery(value), beforeMount: beforeEditorMount, onMount: onMount, options: options }) }));
|
|
94
89
|
};
|
|
95
90
|
export default memo(QueryEditor);
|