@cccsaurora/howler-ui 3.2.0-dev.1791.1 → 3.2.0-dev.1797.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.
Files changed (82) hide show
  1. package/components/app/App.js +33 -0
  2. package/components/elements/display/DocumentationButton.js +9 -2
  3. package/components/elements/display/DocumentationButton.test.js +12 -2
  4. package/components/elements/display/Markdown.js +6 -0
  5. package/components/elements/hit/HitBanner.js +23 -2
  6. package/components/elements/hit/HitBanner.test.js +31 -0
  7. package/components/hooks/useMyPreferences.js +21 -0
  8. package/components/routes/advanced/QueryBuilder.js +3 -24
  9. package/components/routes/advanced/QueryBuilderControls.d.ts +51 -0
  10. package/components/routes/advanced/QueryBuilderControls.js +50 -0
  11. package/components/routes/cases/detail/CaseDetailControls.d.ts +16 -0
  12. package/components/routes/cases/detail/CaseDetailControls.js +19 -0
  13. package/components/routes/cases/detail/CaseDetails.js +4 -20
  14. package/components/routes/cases/detail/CaseRuleRow.d.ts +10 -0
  15. package/components/routes/cases/detail/CaseRuleRow.js +11 -0
  16. package/components/routes/cases/detail/CaseRules.js +4 -7
  17. package/components/routes/cases/detail/CaseSidebar.js +45 -89
  18. package/components/routes/cases/detail/CaseSidebarActions.d.ts +10 -0
  19. package/components/routes/cases/detail/CaseSidebarActions.js +18 -0
  20. package/components/routes/cases/detail/CaseSidebarNavigation.d.ts +49 -0
  21. package/components/routes/cases/detail/CaseSidebarNavigation.js +44 -0
  22. package/components/routes/cases/modals/AddRecordToCaseModal.js +3 -7
  23. package/components/routes/cases/modals/AddToCaseModal.js +3 -10
  24. package/components/routes/cases/modals/CaseItemTypeSelect.d.ts +15 -0
  25. package/components/routes/cases/modals/CaseItemTypeSelect.js +16 -0
  26. package/components/routes/cases/modals/CaseSelector.d.ts +9 -0
  27. package/components/routes/cases/modals/CaseSelector.js +11 -0
  28. package/components/routes/help/AdvancedDocumentation.d.ts +3 -0
  29. package/components/routes/help/AdvancedDocumentation.js +66 -0
  30. package/components/routes/help/AdvancedDocumentation.test.d.ts +1 -0
  31. package/components/routes/help/AdvancedDocumentation.test.js +95 -0
  32. package/components/routes/help/CaseDocumentation.d.ts +3 -0
  33. package/components/routes/help/CaseDocumentation.js +76 -0
  34. package/components/routes/help/CaseDocumentation.test.d.ts +1 -0
  35. package/components/routes/help/CaseDocumentation.test.js +127 -0
  36. package/components/routes/help/DossierDocumentation.d.ts +3 -0
  37. package/components/routes/help/DossierDocumentation.js +94 -0
  38. package/components/routes/help/DossierDocumentation.test.d.ts +1 -0
  39. package/components/routes/help/DossierDocumentation.test.js +90 -0
  40. package/components/routes/help/Help.js +4 -1
  41. package/components/routes/help/Help.test.js +17 -2
  42. package/components/routes/help/components/CaseDocumentationPreviews.d.ts +12 -0
  43. package/components/routes/help/components/CaseDocumentationPreviews.js +127 -0
  44. package/components/routes/help/markdown/en/advancedLanguages.md.js +1 -0
  45. package/components/routes/help/markdown/en/advancedLucene.md.js +1 -0
  46. package/components/routes/help/markdown/en/advancedOverview.md.js +1 -0
  47. package/components/routes/help/markdown/en/advancedResults.md.js +1 -0
  48. package/components/routes/help/markdown/en/casesFolders.md.js +1 -0
  49. package/components/routes/help/markdown/en/casesInvestigation.md.js +1 -0
  50. package/components/routes/help/markdown/en/casesItems.md.js +1 -0
  51. package/components/routes/help/markdown/en/casesOverview.md.js +1 -0
  52. package/components/routes/help/markdown/en/casesRecords.md.js +1 -0
  53. package/components/routes/help/markdown/en/casesRules.md.js +1 -0
  54. package/components/routes/help/markdown/en/casesSidebar.md.js +1 -0
  55. package/components/routes/help/markdown/en/casesSummary.md.js +1 -0
  56. package/components/routes/help/markdown/en/dossiersLeads.md.js +1 -0
  57. package/components/routes/help/markdown/en/dossiersOverview.md.js +1 -0
  58. package/components/routes/help/markdown/en/dossiersPivots.md.js +1 -0
  59. package/components/routes/help/markdown/en/dossiersQuery.md.js +1 -0
  60. package/components/routes/help/markdown/en/dossiersUsage.md.js +1 -0
  61. package/components/routes/help/markdown/fr/advancedLanguages.md.js +1 -0
  62. package/components/routes/help/markdown/fr/advancedLucene.md.js +1 -0
  63. package/components/routes/help/markdown/fr/advancedOverview.md.js +1 -0
  64. package/components/routes/help/markdown/fr/advancedResults.md.js +1 -0
  65. package/components/routes/help/markdown/fr/casesFolders.md.js +1 -0
  66. package/components/routes/help/markdown/fr/casesInvestigation.md.js +1 -0
  67. package/components/routes/help/markdown/fr/casesItems.md.js +1 -0
  68. package/components/routes/help/markdown/fr/casesOverview.md.js +1 -0
  69. package/components/routes/help/markdown/fr/casesRecords.md.js +1 -0
  70. package/components/routes/help/markdown/fr/casesRules.md.js +1 -0
  71. package/components/routes/help/markdown/fr/casesSidebar.md.js +1 -0
  72. package/components/routes/help/markdown/fr/casesSummary.md.js +1 -0
  73. package/components/routes/help/markdown/fr/dossiersLeads.md.js +1 -0
  74. package/components/routes/help/markdown/fr/dossiersOverview.md.js +1 -0
  75. package/components/routes/help/markdown/fr/dossiersPivots.md.js +1 -0
  76. package/components/routes/help/markdown/fr/dossiersQuery.md.js +1 -0
  77. package/components/routes/help/markdown/fr/dossiersUsage.md.js +1 -0
  78. package/locales/en/help/main.json +3 -0
  79. package/locales/en/translation.json +27 -0
  80. package/locales/fr/help/main.json +3 -0
  81. package/locales/fr/translation.json +27 -0
  82. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { DndContext, DragOverlay, MouseSensor, pointerWithin, TouchSensor, useSensor, useSensors } from '@dnd-kit/core';
3
- import { AddCircle, CalendarMonth, Circle, Dashboard, Dataset, Description, Event as EventIcon, Folder, Refresh, Rule, Search, UnfoldLess } from '@mui/icons-material';
4
- import { alpha, Box, Card, Chip, IconButton, LinearProgress, Skeleton, Stack, Tooltip, Typography, useTheme } from '@mui/material';
3
+ import { Circle } from '@mui/icons-material';
4
+ import { Box, Card, Chip, LinearProgress, Skeleton, Stack, Typography, useTheme } from '@mui/material';
5
5
  import api from '@cccsaurora/howler-ui/api';
6
6
  import { ModalContext } from '@cccsaurora/howler-ui/components/app/providers/ModalProvider';
7
7
  import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
@@ -10,15 +10,15 @@ import AddToCaseModal from '@cccsaurora/howler-ui/components/routes/cases/modals
10
10
  import dayjs from 'dayjs';
11
11
  import { useCallback, useContext, useReducer, useState } from 'react';
12
12
  import { useTranslation } from 'react-i18next';
13
- import { Link, useLocation } from 'react-router';
14
13
  import { ESCALATION_COLOR_MAP } from '../constants';
14
+ import CaseSidebarActions from './CaseSidebarActions';
15
+ import CaseSidebarNavigation from './CaseSidebarNavigation';
15
16
  import CaseFolder from './sidebar/CaseFolder';
16
17
  import FolderEntry from './sidebar/FolderEntry';
17
18
  import RootDropZone from './sidebar/RootDropZone';
18
19
  const CaseSidebar = ({ case: _case, update }) => {
19
20
  const { dispatchApi } = useMyApi();
20
21
  const { t } = useTranslation();
21
- const location = useLocation();
22
22
  const theme = useTheme();
23
23
  const { showModal } = useContext(ModalContext);
24
24
  const sensors = useSensors(useSensor(MouseSensor, {
@@ -37,31 +37,6 @@ const CaseSidebar = ({ case: _case, update }) => {
37
37
  const data = event.active.data.current;
38
38
  setActiveDragData({ type: data.type, label: data.label ?? '' });
39
39
  }, []);
40
- const navItemSx = useCallback((isActive) => [
41
- {
42
- cursor: 'pointer',
43
- px: 0.5,
44
- py: 0.5,
45
- transition: theme.transitions.create('background', { duration: 100 }),
46
- color: `${theme.palette.text.primary} !important`,
47
- textDecoration: 'none',
48
- background: 'transparent',
49
- borderRight: `thin solid ${theme.palette.divider}`,
50
- '&:hover': {
51
- background: alpha(theme.palette.grey[600], 0.25)
52
- }
53
- },
54
- isActive && {
55
- background: alpha(theme.palette.grey[600], 0.15),
56
- borderRight: `3px solid ${theme.palette.primary.main}`
57
- }
58
- ], [
59
- theme.palette.divider,
60
- theme.palette.grey,
61
- theme.palette.primary.main,
62
- theme.palette.text.primary,
63
- theme.transitions
64
- ]);
65
40
  const handleDragEnd = useCallback(async (event) => {
66
41
  setActiveDragData(null);
67
42
  if (!_case?.case_id) {
@@ -91,6 +66,46 @@ const CaseSidebar = ({ case: _case, update }) => {
91
66
  setLoading(false);
92
67
  }
93
68
  }, [_case, dispatchApi, update]);
69
+ const handleAddEvent = useCallback(() => {
70
+ showModal(_jsx(AddEventModal, { case: _case, onUpdated: update }), { maxHeight: '90vh', height: 'unset' });
71
+ }, [_case, showModal, update]);
72
+ const handleAddItem = useCallback(() => {
73
+ showModal(_jsx(AddToCaseModal, { case: _case, onUpdated: update }), { maxHeight: '90vh', height: 'unset' });
74
+ }, [_case, showModal, update]);
75
+ const handleAddFolder = useCallback(async () => {
76
+ if (!_case?.case_id) {
77
+ return;
78
+ }
79
+ try {
80
+ setLoading(true);
81
+ const updatedCase = await dispatchApi(api.v2.case.items.post(_case.case_id, {
82
+ type: 'folder',
83
+ name: t('page.cases.sidebar.new_folder'),
84
+ value: t('page.cases.sidebar.new_folder')
85
+ }));
86
+ if (updatedCase) {
87
+ update(updatedCase);
88
+ }
89
+ }
90
+ finally {
91
+ setLoading(false);
92
+ }
93
+ }, [_case, dispatchApi, t, update]);
94
+ const handleRefresh = useCallback(async () => {
95
+ if (!_case?.case_id) {
96
+ return;
97
+ }
98
+ try {
99
+ setLoading(true);
100
+ const refreshedCase = await dispatchApi(api.v2.case.get(_case.case_id));
101
+ if (refreshedCase) {
102
+ update(refreshedCase);
103
+ }
104
+ }
105
+ finally {
106
+ setLoading(false);
107
+ }
108
+ }, [_case, dispatchApi, update]);
94
109
  if (!_case) {
95
110
  return null;
96
111
  }
@@ -100,66 +115,7 @@ const CaseSidebar = ({ case: _case, update }) => {
100
115
  maxHeight: 'calc(100vh - 64px)',
101
116
  display: 'flex',
102
117
  flexDirection: 'column'
103
- }, children: [_jsxs(Card, { sx: { borderRadius: 0, px: 2, py: 1 }, children: [_case?.title ? _jsx(Typography, { variant: "body1", children: _case.title }) : _jsx(Skeleton, { height: 24 }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", divider: _jsx(Circle, { color: "disabled", sx: { fontSize: '8px' } }), children: [_jsxs(Typography, { variant: "caption", color: "textSecondary", children: [t('started'), ": ", _case?.created ? dayjs(_case.created).toString() : _jsx(Skeleton, { height: 14 })] }), _case?.escalation ? (_jsx(Chip, { color: ESCALATION_COLOR_MAP[_case.escalation], label: t(_case.escalation) })) : (_jsx(Skeleton, { height: 24 }))] })] }), _case ? (_jsxs(_Fragment, { children: [_jsxs(Stack, { direction: "row", alignItems: "center", sx: navItemSx(location.pathname.endsWith(_case.case_id)), component: Link, to: `/cases/${_case.case_id}`, children: [_jsx(Dashboard, { fontSize: "small" }), _jsx(Typography, { variant: "body2", sx: { pl: 1, textWrap: 'nowrap' }, children: t('page.cases.dashboard') })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: navItemSx(location.pathname.endsWith('search')), component: Link, to: `/cases/${_case.case_id}/search`, children: [_jsx(Search, { fontSize: "small" }), _jsx(Typography, { variant: "body2", sx: { userSelect: 'none', pl: 1, textWrap: 'nowrap' }, children: t('page.cases.search') })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: navItemSx(location.pathname.endsWith('observables')), component: Link, to: `/cases/${_case.case_id}/observables`, children: [_jsx(Dataset, { fontSize: "small" }), _jsx(Typography, { variant: "body2", sx: { userSelect: 'none', pl: 1, textWrap: 'nowrap' }, children: t('page.cases.observables') })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: navItemSx(location.pathname.endsWith('timeline')), component: Link, to: `/cases/${_case.case_id}/timeline`, children: [_jsx(CalendarMonth, { fontSize: "small" }), _jsx(Typography, { variant: "body2", sx: { userSelect: 'none', pl: 1, textWrap: 'nowrap' }, children: t('page.cases.timeline') })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: navItemSx(location.pathname.endsWith('rules')), component: Link, to: `/cases/${_case.case_id}/rules`, children: [_jsx(Rule, {}), _jsx(Typography, { variant: "body2", sx: { userSelect: 'none', pl: 1, textWrap: 'nowrap' }, children: t('page.cases.rules') })] })] })) : (_jsxs(_Fragment, { children: [_jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 })] })), _jsx(Card, { sx: { borderRadius: 0, p: 0.25 }, children: _jsxs(Stack, { direction: "row", spacing: 0.25, children: [_jsx("div", { style: { flex: 1 } }), _jsx(Tooltip, { title: t('page.cases.sidebar.add_event'), children: _jsxs(IconButton, { size: "small", sx: { position: 'relative' }, onClick: () => {
104
- if (_case) {
105
- showModal(_jsx(AddEventModal, { case: _case, onUpdated: update }), { maxHeight: '90vh', height: 'unset' });
106
- }
107
- }, children: [_jsx(EventIcon, { sx: { fontSize: '18px' } }), _jsx(AddCircle, { sx: {
108
- fontSize: '12px',
109
- position: 'absolute',
110
- bottom: 2,
111
- right: 2,
112
- backgroundColor: theme.palette.background.paper,
113
- borderRadius: '100%'
114
- }, htmlColor: "grey" })] }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.add_item'), children: _jsxs(IconButton, { size: "small", sx: { position: 'relative' }, onClick: () => {
115
- if (_case) {
116
- showModal(_jsx(AddToCaseModal, { case: _case, onUpdated: update }), { maxHeight: '90vh', height: 'unset' });
117
- }
118
- }, children: [_jsx(Description, { sx: { fontSize: '18px' } }), _jsx(AddCircle, { sx: {
119
- fontSize: '12px',
120
- position: 'absolute',
121
- bottom: 2,
122
- right: 2,
123
- backgroundColor: theme.palette.background.paper,
124
- borderRadius: '100%'
125
- }, htmlColor: "grey" })] }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.add_folder'), children: _jsxs(IconButton, { size: "small", sx: { position: 'relative' }, onClick: async () => {
126
- if (_case?.case_id) {
127
- try {
128
- setLoading(true);
129
- const updatedCase = await dispatchApi(api.v2.case.items.post(_case.case_id, {
130
- type: 'folder',
131
- name: t('page.cases.sidebar.new_folder'),
132
- value: t('page.cases.sidebar.new_folder')
133
- }));
134
- if (updatedCase) {
135
- update(updatedCase);
136
- }
137
- }
138
- finally {
139
- setLoading(false);
140
- }
141
- }
142
- }, children: [_jsx(Folder, { sx: { fontSize: '18px' } }), _jsx(AddCircle, { sx: {
143
- fontSize: '12px',
144
- position: 'absolute',
145
- bottom: 2,
146
- right: 2,
147
- backgroundColor: theme.palette.background.paper,
148
- borderRadius: '100%'
149
- }, htmlColor: "grey" })] }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.refresh'), children: _jsx(IconButton, { size: "small", onClick: async () => {
150
- if (_case?.case_id) {
151
- try {
152
- setLoading(true);
153
- const refreshedCase = await dispatchApi(api.v2.case.get(_case.case_id));
154
- if (refreshedCase) {
155
- update(refreshedCase);
156
- }
157
- }
158
- finally {
159
- setLoading(false);
160
- }
161
- }
162
- }, children: _jsx(Refresh, { sx: { fontSize: '18px' } }) }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.collapse_all'), children: _jsx(IconButton, { size: "small", onClick: collapse, children: _jsx(UnfoldLess, { sx: { fontSize: '18px' } }) }) })] }) }), _case && (_jsx(Box, { flex: 1, overflow: "auto", width: "100%", sx: {
118
+ }, children: [_jsxs(Card, { sx: { borderRadius: 0, px: 2, py: 1 }, children: [_case?.title ? _jsx(Typography, { variant: "body1", children: _case.title }) : _jsx(Skeleton, { height: 24 }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", divider: _jsx(Circle, { color: "disabled", sx: { fontSize: '8px' } }), children: [_jsxs(Typography, { variant: "caption", color: "textSecondary", children: [t('started'), ": ", _case?.created ? dayjs(_case.created).toString() : _jsx(Skeleton, { height: 14 })] }), _case?.escalation ? (_jsx(Chip, { color: ESCALATION_COLOR_MAP[_case.escalation], label: t(_case.escalation) })) : (_jsx(Skeleton, { height: 24 }))] })] }), _case ? (_jsx(_Fragment, { children: _jsx(CaseSidebarNavigation, { caseId: _case.case_id }) })) : (_jsxs(_Fragment, { children: [_jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 }), _jsx(Skeleton, { height: 28 })] })), _jsx(CaseSidebarActions, { onAddEvent: handleAddEvent, onAddItem: handleAddItem, onAddFolder: handleAddFolder, onRefresh: handleRefresh, onCollapseAll: collapse }), _case && (_jsx(Box, { flex: 1, overflow: "auto", width: "100%", sx: {
163
119
  position: 'relative',
164
120
  borderRight: `thin solid ${theme.palette.divider}`
165
121
  }, children: _jsxs(Box, { position: "absolute", sx: { left: 0, right: 0 }, children: [_jsx(LinearProgress, { sx: { mb: 0.5, opacity: +loading } }), _jsxs(DndContext, { sensors: sensors, collisionDetection: pointerWithin, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: [_jsx(CaseFolder, { case: _case, onItemUpdated: update, collapseKey: collapseKey }), _jsx(RootDropZone, { caseId: _case.case_id }), _jsx(DragOverlay, { dropAnimation: null, children: activeDragData && (_jsx(FolderEntry, { caseId: _case.case_id, indent: 0, label: activeDragData.label, entry: undefined })) })] })] }) }))] }));
@@ -0,0 +1,10 @@
1
+ import type { FC } from 'react';
2
+ interface CaseSidebarActionsProps {
3
+ onAddEvent: () => void;
4
+ onAddItem: () => void;
5
+ onAddFolder: () => void;
6
+ onRefresh: () => void;
7
+ onCollapseAll: () => void;
8
+ }
9
+ declare const CaseSidebarActions: FC<CaseSidebarActionsProps>;
10
+ export default CaseSidebarActions;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AddCircle, Description, Event as EventIcon, Folder, Refresh, UnfoldLess } from '@mui/icons-material';
3
+ import { Card, IconButton, Stack, Tooltip, useTheme } from '@mui/material';
4
+ import { useTranslation } from 'react-i18next';
5
+ const CaseSidebarActions = ({ onAddEvent, onAddItem, onAddFolder, onRefresh, onCollapseAll }) => {
6
+ const { t } = useTranslation();
7
+ const theme = useTheme();
8
+ const addIconSx = {
9
+ fontSize: '12px',
10
+ position: 'absolute',
11
+ bottom: 2,
12
+ right: 2,
13
+ backgroundColor: theme.palette.background.paper,
14
+ borderRadius: '100%'
15
+ };
16
+ return (_jsx(Card, { sx: { borderRadius: 0, p: 0.25 }, children: _jsxs(Stack, { direction: "row", spacing: 0.25, children: [_jsx("div", { style: { flex: 1 } }), _jsx(Tooltip, { title: t('page.cases.sidebar.add_event'), children: _jsxs(IconButton, { size: "small", sx: { position: 'relative' }, onClick: onAddEvent, children: [_jsx(EventIcon, { sx: { fontSize: '18px' } }), _jsx(AddCircle, { sx: addIconSx, htmlColor: "grey" })] }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.add_item'), children: _jsxs(IconButton, { size: "small", sx: { position: 'relative' }, onClick: onAddItem, children: [_jsx(Description, { sx: { fontSize: '18px' } }), _jsx(AddCircle, { sx: addIconSx, htmlColor: "grey" })] }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.add_folder'), children: _jsxs(IconButton, { size: "small", sx: { position: 'relative' }, onClick: onAddFolder, children: [_jsx(Folder, { sx: { fontSize: '18px' } }), _jsx(AddCircle, { sx: addIconSx, htmlColor: "grey" })] }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.refresh'), children: _jsx(IconButton, { size: "small", onClick: onRefresh, children: _jsx(Refresh, { sx: { fontSize: '18px' } }) }) }), _jsx(Tooltip, { title: t('page.cases.sidebar.collapse_all'), children: _jsx(IconButton, { size: "small", onClick: onCollapseAll, children: _jsx(UnfoldLess, { sx: { fontSize: '18px' } }) }) })] }) }));
17
+ };
18
+ export default CaseSidebarActions;
@@ -0,0 +1,49 @@
1
+ import type { FC } from 'react';
2
+ declare const NAV_ITEMS: readonly [{
3
+ readonly id: 'dashboard';
4
+ readonly Icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
5
+ muiName: string;
6
+ };
7
+ readonly label: 'page.cases.dashboard';
8
+ readonly path: '';
9
+ readonly fontSize: 'small';
10
+ }, {
11
+ readonly id: 'search';
12
+ readonly Icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
13
+ muiName: string;
14
+ };
15
+ readonly label: 'page.cases.search';
16
+ readonly path: 'search';
17
+ readonly fontSize: 'small';
18
+ }, {
19
+ readonly id: 'observables';
20
+ readonly Icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
21
+ muiName: string;
22
+ };
23
+ readonly label: 'page.cases.observables';
24
+ readonly path: 'observables';
25
+ readonly fontSize: 'small';
26
+ }, {
27
+ readonly id: 'timeline';
28
+ readonly Icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
29
+ muiName: string;
30
+ };
31
+ readonly label: 'page.cases.timeline';
32
+ readonly path: 'timeline';
33
+ readonly fontSize: 'small';
34
+ }, {
35
+ readonly id: 'rules';
36
+ readonly Icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
37
+ muiName: string;
38
+ };
39
+ readonly label: 'page.cases.rules';
40
+ readonly path: 'rules';
41
+ readonly fontSize: 'medium';
42
+ }];
43
+ export type CaseNavigationSection = (typeof NAV_ITEMS)[number]['id'];
44
+ interface CaseSidebarNavigationProps {
45
+ caseId?: string;
46
+ sections?: CaseNavigationSection[];
47
+ }
48
+ declare const CaseSidebarNavigation: FC<CaseSidebarNavigationProps>;
49
+ export default CaseSidebarNavigation;
@@ -0,0 +1,44 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CalendarMonth, Dashboard, Dataset, Rule, Search } from '@mui/icons-material';
3
+ import { alpha, Stack, Typography, useTheme } from '@mui/material';
4
+ import { useCallback } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Link, useLocation } from 'react-router';
7
+ const NAV_ITEMS = [
8
+ { id: 'dashboard', Icon: Dashboard, label: 'page.cases.dashboard', path: '', fontSize: 'small' },
9
+ { id: 'search', Icon: Search, label: 'page.cases.search', path: 'search', fontSize: 'small' },
10
+ { id: 'observables', Icon: Dataset, label: 'page.cases.observables', path: 'observables', fontSize: 'small' },
11
+ { id: 'timeline', Icon: CalendarMonth, label: 'page.cases.timeline', path: 'timeline', fontSize: 'small' },
12
+ { id: 'rules', Icon: Rule, label: 'page.cases.rules', path: 'rules', fontSize: 'medium' }
13
+ ];
14
+ const CaseSidebarNavigation = ({ caseId, sections = NAV_ITEMS.map(item => item.id) }) => {
15
+ const { t } = useTranslation();
16
+ const location = useLocation();
17
+ const theme = useTheme();
18
+ const navItemSx = useCallback((isActive) => [
19
+ {
20
+ cursor: caseId ? 'pointer' : 'default',
21
+ px: 0.5,
22
+ py: 0.5,
23
+ transition: theme.transitions.create('background', { duration: 100 }),
24
+ color: `${theme.palette.text.primary} !important`,
25
+ textDecoration: 'none',
26
+ background: 'transparent',
27
+ borderRight: `thin solid ${theme.palette.divider}`,
28
+ '&:hover': {
29
+ background: alpha(theme.palette.grey[600], 0.25)
30
+ }
31
+ },
32
+ isActive && {
33
+ background: alpha(theme.palette.grey[600], 0.15),
34
+ borderRight: `3px solid ${theme.palette.primary.main}`
35
+ }
36
+ ], [caseId, theme]);
37
+ return (_jsx(Stack, { children: NAV_ITEMS.filter(item => sections.includes(item.id)).map(({ id, Icon, label, path, fontSize }) => {
38
+ const active = !!caseId && (path ? location.pathname.endsWith(path) : location.pathname.endsWith(caseId));
39
+ const child = (_jsxs(_Fragment, { children: [_jsx(Icon, { fontSize: fontSize }), _jsx(Typography, { variant: "body2", sx: { pl: 1, textWrap: 'nowrap', ...(id !== 'dashboard' && { userSelect: 'none' }) }, children: t(label) })] }));
40
+ const sx = navItemSx(active);
41
+ return caseId ? (_jsx(Stack, { direction: "row", alignItems: "center", sx: sx, component: Link, to: `/cases/${caseId}${path ? `/${path}` : ''}`, children: child }, id)) : (_jsx(Stack, { direction: "row", alignItems: "center", sx: sx, children: child }, id));
42
+ }) }));
43
+ };
44
+ export default CaseSidebarNavigation;
@@ -1,12 +1,11 @@
1
- import { createElement as _createElement } from "react";
2
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Autocomplete, Button, CircularProgress, Divider, Stack, TextField, Typography } from '@mui/material';
2
+ import { Button, CircularProgress, Divider, Stack, Typography } from '@mui/material';
4
3
  import api from '@cccsaurora/howler-ui/api';
5
4
  import { ModalContext } from '@cccsaurora/howler-ui/components/app/providers/ModalProvider';
6
- import CaseCard from '@cccsaurora/howler-ui/components/elements/case/CaseCard';
7
5
  import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
8
6
  import { useContext, useEffect, useMemo, useState } from 'react';
9
7
  import { useTranslation } from 'react-i18next';
8
+ import CaseSelector from './CaseSelector';
10
9
  import CaseRecordRow from './CaseRecordRow';
11
10
  import { useFolderOptions, useRecordEntries } from './hooks';
12
11
  // ---------------------------------------------------------------------------
@@ -49,9 +48,6 @@ const AddRecordToCaseModal = ({ records }) => {
49
48
  setSubmitting(false);
50
49
  }
51
50
  };
52
- return (_jsxs(Stack, { spacing: 2, p: 2, sx: { minWidth: 'min(800px, 60vw)', maxHeight: '90vh', height: '100%' }, children: [_jsx(Typography, { variant: "h4", children: t('modal.cases.add_to_case') }), _jsx(Autocomplete, { options: cases, getOptionLabel: option => option.title ?? option.case_id ?? '', isOptionEqualToValue: (option, value) => option.case_id === value.case_id, value: selectedCase, disablePortal: true, onChange: (_ev, newVal) => {
53
- setSelectedCase(newVal);
54
- }, renderOption: (props, option) => (_createElement("li", { ...props, key: option.case_id, style: { ...props.style, display: 'flex', justifyContent: 'stretch', alignItems: 'stretch' } },
55
- _jsx(CaseCard, { case: option, slotProps: { card: { sx: { width: '100%' } } } }))), renderInput: params => (_jsx(TextField, { ...params, size: "small", placeholder: t('modal.cases.add_to_case.select_case'), fullWidth: true })) }), selectedCase && entries.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Divider, { children: _jsx(Typography, { variant: "caption", color: "textSecondary", children: t('modal.cases.add_to_case.items_section') }) }), _jsx(Stack, { spacing: 1, overflow: "auto", flex: 1, children: entries.map((entry, i) => (_jsx(CaseRecordRow, { entry: entry, folderOptions: folderOptions, onNameChange: val => updateEntry(i, 'name', val), onParentChange: val => updateEntry(i, 'parent', val) }, entry.record.howler.id))) })] })) : (_jsx("div", { style: { flex: 1, maxHeight: '100px' } })), _jsxs(Stack, { direction: "row", spacing: 1, alignSelf: "end", children: [_jsx(Button, { variant: "outlined", color: "error", onClick: close, disabled: submitting, children: t('cancel') }), _jsx(Button, { variant: "outlined", color: "success", disabled: !isValid || submitting, startIcon: submitting ? _jsx(CircularProgress, { size: 16, color: "inherit" }) : undefined, onClick: onSubmit, children: t('confirm') })] })] }));
51
+ return (_jsxs(Stack, { spacing: 2, p: 2, sx: { minWidth: 'min(800px, 60vw)', maxHeight: '90vh', height: '100%' }, children: [_jsx(Typography, { variant: "h4", children: t('modal.cases.add_to_case') }), _jsx(CaseSelector, { options: cases, value: selectedCase, onChange: setSelectedCase }), selectedCase && entries.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Divider, { children: _jsx(Typography, { variant: "caption", color: "textSecondary", children: t('modal.cases.add_to_case.items_section') }) }), _jsx(Stack, { spacing: 1, overflow: "auto", flex: 1, children: entries.map((entry, i) => (_jsx(CaseRecordRow, { entry: entry, folderOptions: folderOptions, onNameChange: val => updateEntry(i, 'name', val), onParentChange: val => updateEntry(i, 'parent', val) }, entry.record.howler.id))) })] })) : (_jsx("div", { style: { flex: 1, maxHeight: '100px' } })), _jsxs(Stack, { direction: "row", spacing: 1, alignSelf: "end", children: [_jsx(Button, { variant: "outlined", color: "error", onClick: close, disabled: submitting, children: t('cancel') }), _jsx(Button, { variant: "outlined", color: "success", disabled: !isValid || submitting, startIcon: submitting ? _jsx(CircularProgress, { size: 16, color: "inherit" }) : undefined, onClick: onSubmit, children: t('confirm') })] })] }));
56
52
  };
57
53
  export default AddRecordToCaseModal;
@@ -7,18 +7,15 @@ import ThemedEditor from '@cccsaurora/howler-ui/components/elements/ThemedEditor
7
7
  import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
8
8
  import { useContext, useEffect, useMemo, useState } from 'react';
9
9
  import { useTranslation } from 'react-i18next';
10
+ import CaseItemTypeSelect, { CASE_ITEM_TYPES } from './CaseItemTypeSelect';
10
11
  import { useFolderOptions } from './hooks';
11
- const ITEM_TYPES = [
12
- { value: 'reference', labelKey: 'modal.cases.add_item.type.link' },
13
- { value: 'markdown', labelKey: 'modal.cases.add_item.type.markdown' }
14
- ];
15
12
  const AddToCaseModal = ({ case: _case, parentId, onUpdated }) => {
16
13
  const { t } = useTranslation();
17
14
  const theme = useTheme();
18
15
  const monaco = useMonaco();
19
16
  const { dispatchApi } = useMyApi();
20
17
  const { close } = useContext(ModalContext);
21
- const [itemType, setItemType] = useState(ITEM_TYPES[0]);
18
+ const [itemType, setItemType] = useState(CASE_ITEM_TYPES[0]);
22
19
  const [title, setTitle] = useState('');
23
20
  const [value, setValue] = useState('');
24
21
  const [selectedParent, setSelectedParent] = useState(parentId);
@@ -63,10 +60,6 @@ const AddToCaseModal = ({ case: _case, parentId, onUpdated }) => {
63
60
  setSubmitting(false);
64
61
  }
65
62
  };
66
- return (_jsxs(Stack, { spacing: 2, p: 2, sx: { minWidth: 'min(1000px, 60vw)' }, children: [_jsx(Typography, { variant: "h4", children: t('modal.cases.add_item') }), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Autocomplete, { value: itemType, onChange: (_, option) => {
67
- if (option) {
68
- setItemType(option);
69
- }
70
- }, options: ITEM_TYPES, getOptionLabel: opt => t(opt.labelKey), isOptionEqualToValue: (option, choice) => option.value === choice.value, disablePortal: true, disableClearable: true, renderInput: params => (_jsx(TextField, { ...params, size: "small", label: t('modal.cases.add_item.type'), sx: { minWidth: '175px' } })) }), _jsx(TextField, { size: "small", label: t('modal.cases.add_item.title'), value: title, onChange: ev => setTitle(ev.target.value), fullWidth: true })] }), itemType.value === 'reference' && (_jsx(TextField, { size: "small", label: t('modal.cases.add_item.url'), value: value, onChange: ev => setValue(ev.target.value), fullWidth: true, placeholder: "https://example.com" })), itemType.value === 'markdown' && (_jsx(Box, { sx: { border: 'thin solid', borderColor: theme.palette.divider }, children: _jsx(ThemedEditor, { id: "add-item-markdown", height: "240px", width: "100%", language: "markdown", theme: theme.palette.mode === 'light' ? 'howler' : 'howler-dark', value: value, onChange: content => setValue(content ?? ''), options: {} }) })), folderOptions.length > 0 && (_jsx(Autocomplete, { options: folderOptions, getOptionLabel: opt => opt.label, isOptionEqualToValue: (opt, val) => opt.id === val.id, value: folderOptions.find(f => f.id === selectedParent), disablePortal: true, onChange: (_ev, newVal) => setSelectedParent(newVal?.id), renderInput: params => (_jsx(TextField, { ...params, size: "small", label: t('modal.cases.add_item.folder'), placeholder: t('modal.cases.add_item.root'), fullWidth: true })) })), _jsxs(Stack, { direction: "row", spacing: 1, alignSelf: "end", children: [_jsx(Button, { variant: "outlined", color: "error", onClick: close, disabled: submitting, children: t('cancel') }), _jsx(Button, { variant: "outlined", color: "success", disabled: !isValid || submitting, startIcon: submitting ? _jsx(CircularProgress, { size: 16, color: "inherit" }) : undefined, onClick: onSubmit, children: t('confirm') })] })] }));
63
+ return (_jsxs(Stack, { spacing: 2, p: 2, sx: { minWidth: 'min(1000px, 60vw)' }, children: [_jsx(Typography, { variant: "h4", children: t('modal.cases.add_item') }), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(CaseItemTypeSelect, { value: itemType, onChange: setItemType }), _jsx(TextField, { size: "small", label: t('modal.cases.add_item.title'), value: title, onChange: ev => setTitle(ev.target.value), fullWidth: true })] }), itemType.value === 'reference' && (_jsx(TextField, { size: "small", label: t('modal.cases.add_item.url'), value: value, onChange: ev => setValue(ev.target.value), fullWidth: true, placeholder: "https://example.com" })), itemType.value === 'markdown' && (_jsx(Box, { sx: { border: 'thin solid', borderColor: theme.palette.divider }, children: _jsx(ThemedEditor, { id: "add-item-markdown", height: "240px", width: "100%", language: "markdown", theme: theme.palette.mode === 'light' ? 'howler' : 'howler-dark', value: value, onChange: content => setValue(content ?? ''), options: {} }) })), folderOptions.length > 0 && (_jsx(Autocomplete, { options: folderOptions, getOptionLabel: opt => opt.label, isOptionEqualToValue: (opt, val) => opt.id === val.id, value: folderOptions.find(f => f.id === selectedParent), disablePortal: true, onChange: (_ev, newVal) => setSelectedParent(newVal?.id), renderInput: params => (_jsx(TextField, { ...params, size: "small", label: t('modal.cases.add_item.folder'), placeholder: t('modal.cases.add_item.root'), fullWidth: true })) })), _jsxs(Stack, { direction: "row", spacing: 1, alignSelf: "end", children: [_jsx(Button, { variant: "outlined", color: "error", onClick: close, disabled: submitting, children: t('cancel') }), _jsx(Button, { variant: "outlined", color: "success", disabled: !isValid || submitting, startIcon: submitting ? _jsx(CircularProgress, { size: 16, color: "inherit" }) : undefined, onClick: onSubmit, children: t('confirm') })] })] }));
71
64
  };
72
65
  export default AddToCaseModal;
@@ -0,0 +1,15 @@
1
+ import type { FC } from 'react';
2
+ export declare const CASE_ITEM_TYPES: readonly [{
3
+ readonly value: 'reference';
4
+ readonly labelKey: 'modal.cases.add_item.type.link';
5
+ }, {
6
+ readonly value: 'markdown';
7
+ readonly labelKey: 'modal.cases.add_item.type.markdown';
8
+ }];
9
+ export type CaseItemType = (typeof CASE_ITEM_TYPES)[number];
10
+ interface CaseItemTypeSelectProps {
11
+ value: CaseItemType;
12
+ onChange: (itemType: CaseItemType) => void;
13
+ }
14
+ declare const CaseItemTypeSelect: FC<CaseItemTypeSelectProps>;
15
+ export default CaseItemTypeSelect;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Autocomplete, TextField } from '@mui/material';
3
+ import { useTranslation } from 'react-i18next';
4
+ export const CASE_ITEM_TYPES = [
5
+ { value: 'reference', labelKey: 'modal.cases.add_item.type.link' },
6
+ { value: 'markdown', labelKey: 'modal.cases.add_item.type.markdown' }
7
+ ];
8
+ const CaseItemTypeSelect = ({ value, onChange }) => {
9
+ const { t } = useTranslation();
10
+ return (_jsx(Autocomplete, { value: value, onChange: (_, option) => {
11
+ if (option) {
12
+ onChange(option);
13
+ }
14
+ }, options: CASE_ITEM_TYPES, getOptionLabel: option => t(option.labelKey), isOptionEqualToValue: (option, choice) => option.value === choice.value, disablePortal: true, disableClearable: true, renderInput: params => (_jsx(TextField, { ...params, size: "small", label: t('modal.cases.add_item.type'), sx: { minWidth: '175px' } })) }));
15
+ };
16
+ export default CaseItemTypeSelect;
@@ -0,0 +1,9 @@
1
+ import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
2
+ import type { FC } from 'react';
3
+ interface CaseSelectorProps {
4
+ options: Case[];
5
+ value: Case | null;
6
+ onChange: (selectedCase: Case | null) => void;
7
+ }
8
+ declare const CaseSelector: FC<CaseSelectorProps>;
9
+ export default CaseSelector;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createElement as _createElement } from "react";
3
+ import { Autocomplete, TextField } from '@mui/material';
4
+ import CaseCard from '@cccsaurora/howler-ui/components/elements/case/CaseCard';
5
+ import { useTranslation } from 'react-i18next';
6
+ const CaseSelector = ({ options, value, onChange }) => {
7
+ const { t } = useTranslation();
8
+ return (_jsx(Autocomplete, { options: options, getOptionLabel: option => option.title ?? option.case_id ?? '', isOptionEqualToValue: (option, selected) => option.case_id === selected.case_id, value: value, disablePortal: true, onChange: (_ev, nextCase) => onChange(nextCase), renderOption: (props, option) => (_createElement("li", { ...props, key: option.case_id, style: { ...props.style, display: 'flex', justifyContent: 'stretch', alignItems: 'stretch' } },
9
+ _jsx(CaseCard, { case: option, slotProps: { card: { sx: { width: '100%' } } } }))), renderInput: params => (_jsx(TextField, { ...params, size: "small", placeholder: t('modal.cases.add_to_case.select_case'), fullWidth: true })) }));
10
+ };
11
+ export default CaseSelector;
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const AdvancedDocumentation: FC;
3
+ export default AdvancedDocumentation;
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Stack, Tab, Typography, useMediaQuery, useTheme } from '@mui/material';
3
+ import { PageCenter } from '@tui/core';
4
+ import Markdown from '@cccsaurora/howler-ui/components/elements/display/Markdown';
5
+ import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
6
+ import { useCallback, useMemo, useState } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { useSearchParams } from 'react-router';
9
+ import { ExecuteQueryButton, FieldsControl, GroupByFieldSelect, LuceneQueryTypeSelect, OpenInSearchButton, QueryLanguageSelect, RowsControl } from '../advanced/QueryBuilderControls';
10
+ import HelpTabs from './components/HelpTabs';
11
+ import LANGUAGES_EN from './markdown/en/advancedLanguages.md';
12
+ import LUCENE_EN from './markdown/en/advancedLucene.md';
13
+ import OVERVIEW_EN from './markdown/en/advancedOverview.md';
14
+ import RESULTS_EN from './markdown/en/advancedResults.md';
15
+ import LANGUAGES_FR from './markdown/fr/advancedLanguages.md';
16
+ import LUCENE_FR from './markdown/fr/advancedLucene.md';
17
+ import OVERVIEW_FR from './markdown/fr/advancedOverview.md';
18
+ import RESULTS_FR from './markdown/fr/advancedResults.md';
19
+ const AdvancedDocumentation = () => {
20
+ const { i18n, t } = useTranslation();
21
+ const theme = useTheme();
22
+ const useHorizontal = useMediaQuery(theme.breakpoints.down(1700));
23
+ const compactLayout = useMediaQuery('(max-width:870px)');
24
+ useScrollRestoration();
25
+ const [queryLanguage, setQueryLanguage] = useState('lucene');
26
+ const [queryType, setQueryType] = useState('default');
27
+ const [groupByField, setGroupByField] = useState('howler.id');
28
+ const [rows, setRows] = useState(1);
29
+ const [allFields, setAllFields] = useState(true);
30
+ const [fields, setFields] = useState(['howler.id']);
31
+ const onQueryLanguageChange = useCallback((language) => {
32
+ setQueryLanguage(language);
33
+ if (language !== 'lucene') {
34
+ setQueryType('default');
35
+ }
36
+ }, []);
37
+ const sections = ['overview', 'languages', 'lucene', 'results'];
38
+ const [searchParams, setSearchParams] = useSearchParams();
39
+ const tab = sections.find(section => section === searchParams.get('tab')) ?? 'overview';
40
+ const onChange = useCallback((nextTab) => {
41
+ const nextParams = new URLSearchParams(searchParams);
42
+ nextParams.set('tab', nextTab);
43
+ setSearchParams(nextParams);
44
+ }, [searchParams, setSearchParams]);
45
+ const documentation = useMemo(() => i18n.language === 'en'
46
+ ? {
47
+ overview: OVERVIEW_EN,
48
+ languages: LANGUAGES_EN,
49
+ lucene: LUCENE_EN,
50
+ results: RESULTS_EN
51
+ }
52
+ : {
53
+ overview: OVERVIEW_FR,
54
+ languages: LANGUAGES_FR,
55
+ lucene: LUCENE_FR,
56
+ results: RESULTS_FR
57
+ }, [i18n.language]);
58
+ const documentationComponents = {
59
+ advanced_languages: (_jsx(QueryLanguageSelect, { value: queryLanguage, onChange: onQueryLanguageChange, compactLayout: compactLayout })),
60
+ advanced_execute: (_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(ExecuteQueryButton, { loading: false, searchDisabled: queryType === 'groupby' && !groupByField, onExecute: () => { } }), _jsx(Typography, { variant: "caption", color: "text.secondary", children: t('help.advanced.shortcut') })] })),
61
+ advanced_modes: (_jsxs(Stack, { direction: compactLayout ? 'column' : 'row', spacing: 1, flexWrap: "wrap", children: [_jsx(LuceneQueryTypeSelect, { value: queryType, onChange: setQueryType }), queryType === 'groupby' && (_jsx(GroupByFieldSelect, { options: ['howler.id', 'howler.status', 'howler.analytic'], value: groupByField, onChange: setGroupByField }))] })),
62
+ advanced_results: (_jsxs(Stack, { direction: compactLayout ? 'column' : 'row', spacing: 1, alignItems: "center", flexWrap: "wrap", children: [_jsx(RowsControl, { value: rows, onChange: setRows }), _jsx(FieldsControl, { allFields: allFields, onAllFieldsChange: setAllFields, queryType: queryType, fieldOptions: ['howler.id', 'howler.status', 'howler.analytic'], fields: fields, onFieldsChange: setFields }), _jsx(OpenInSearchButton, { query: "howler.status:open", hasResponse: true })] }))
63
+ };
64
+ return (_jsx(PageCenter, { margin: 4, width: "100%", maxWidth: "1750px", textAlign: "left", children: _jsxs(Stack, { sx: { flexDirection: useHorizontal ? 'column' : 'row', '& h1': { mt: 0 } }, children: [_jsx(HelpTabs, { value: tab, children: sections.map(section => (_jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t(`help.advanced.${section}.title`) }), value: section, onClick: () => onChange(section) }, section))) }), _jsx(Box, { children: tab in documentation && _jsx(Markdown, { md: documentation[tab], components: documentationComponents }) })] }) }));
65
+ };
66
+ export default AdvancedDocumentation;
@@ -0,0 +1,95 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /// <reference types="vitest" />
3
+ import { render, screen } from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
5
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
6
+ const mockUseMediaQuery = vi.hoisted(() => vi.fn(() => false));
7
+ const mockSetSearchParams = vi.hoisted(() => vi.fn());
8
+ const mockSearchParams = vi.hoisted(() => ({ value: new URLSearchParams() }));
9
+ const mockLanguage = vi.hoisted(() => ({ value: 'en' }));
10
+ vi.mock('@mui/material', async (importOriginal) => {
11
+ const actual = await importOriginal();
12
+ return {
13
+ ...actual,
14
+ useMediaQuery: mockUseMediaQuery
15
+ };
16
+ });
17
+ vi.mock('@tui/core', () => ({
18
+ PageCenter: ({ children }) => _jsx("div", { children: children }),
19
+ useAppTheme: () => ({ isDark: false })
20
+ }));
21
+ vi.mock('mermaid', () => ({
22
+ default: {
23
+ initialize: vi.fn(),
24
+ run: vi.fn()
25
+ }
26
+ }));
27
+ vi.mock('components/elements/display/Notebook', () => ({
28
+ Notebook: () => null
29
+ }));
30
+ vi.mock('components/hooks/useScrollRestoration', () => ({
31
+ useScrollRestoration: vi.fn()
32
+ }));
33
+ vi.mock('react-i18next', () => ({
34
+ useTranslation: () => ({
35
+ i18n: { language: mockLanguage.value },
36
+ t: (key) => key === 'route.advanced.query.lucene' ? (mockLanguage.value === 'fr' ? 'Requête Lucene' : 'Lucene Query') : key
37
+ })
38
+ }));
39
+ vi.mock('react-router', () => ({
40
+ Link: ({ children, to }) => _jsx("a", { href: to, children: children }),
41
+ useSearchParams: () => [mockSearchParams.value, mockSetSearchParams]
42
+ }));
43
+ vi.mock('./components/HelpTabs', () => ({
44
+ default: ({ children }) => _jsx("div", { children: children })
45
+ }));
46
+ import AdvancedDocumentation from './AdvancedDocumentation';
47
+ describe('AdvancedDocumentation', () => {
48
+ beforeEach(() => {
49
+ mockLanguage.value = 'en';
50
+ mockSearchParams.value = new URLSearchParams({ tab: 'languages', keep: 'value' });
51
+ mockSetSearchParams.mockClear();
52
+ });
53
+ it('renders the query-selected tab and updates the query string when navigating', async () => {
54
+ const user = userEvent.setup();
55
+ render(_jsx(AdvancedDocumentation, {}));
56
+ expect(screen.getByRole('heading', { name: 'Choose a query language' })).toBeInTheDocument();
57
+ await user.click(screen.getByRole('tab', { name: 'help.advanced.lucene.title' }));
58
+ expect(mockSetSearchParams).toHaveBeenCalledTimes(1);
59
+ const nextParams = mockSetSearchParams.mock.calls[0][0];
60
+ expect(nextParams.get('tab')).toBe('lucene');
61
+ expect(nextParams.get('keep')).toBe('value');
62
+ });
63
+ it('renders localized Markdown and translated preview components', () => {
64
+ mockLanguage.value = 'fr';
65
+ render(_jsx(AdvancedDocumentation, {}));
66
+ expect(screen.getByRole('heading', { name: 'Choisir un langage de requête' })).toBeInTheDocument();
67
+ expect(screen.getByDisplayValue('Requête Lucene')).toBeInTheDocument();
68
+ expect(screen.queryByText('Requête Lucene', { selector: '.MuiChip-label' })).not.toBeInTheDocument();
69
+ });
70
+ it('renders the actual rows and field-selection controls in the results guide', () => {
71
+ mockSearchParams.value = new URLSearchParams({ tab: 'results' });
72
+ render(_jsx(AdvancedDocumentation, {}));
73
+ expect(screen.getByRole('slider')).toBeInTheDocument();
74
+ expect(screen.getByRole('checkbox')).toBeInTheDocument();
75
+ });
76
+ it.each([
77
+ { language: 'en', heading: 'Explain' },
78
+ { language: 'fr', heading: 'Expliquer' }
79
+ ])('renders the query validation guide and JSON example in $language', async ({ language, heading }) => {
80
+ mockLanguage.value = language;
81
+ mockSearchParams.value = new URLSearchParams({ tab: 'lucene' });
82
+ render(_jsx(AdvancedDocumentation, {}));
83
+ expect(screen.getByRole('heading', { name: heading })).toBeInTheDocument();
84
+ expect(await screen.findByText('explanations')).toBeInTheDocument();
85
+ });
86
+ it.each([
87
+ { language: 'en', exception: 'EQL is an exception:' },
88
+ { language: 'fr', exception: 'EQL fait exception :' }
89
+ ])('renders the EQL field-selection exception in $language', ({ language, exception }) => {
90
+ mockLanguage.value = language;
91
+ mockSearchParams.value = new URLSearchParams({ tab: 'results' });
92
+ render(_jsx(AdvancedDocumentation, {}));
93
+ expect(screen.getByText(exception, { selector: 'strong' })).toBeInTheDocument();
94
+ });
95
+ });
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const CaseDocumentation: FC;
3
+ export default CaseDocumentation;