@cccsaurora/howler-ui 2.18.0-dev.799 → 2.18.0-dev.822
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/api/index.d.ts +0 -4
- package/api/index.js +2 -10
- package/api/search/facet/hit.d.ts +3 -1
- package/api/search/facet/index.d.ts +1 -3
- package/api/search/index.d.ts +1 -2
- package/api/search/index.js +1 -2
- package/commons/components/leftnav/LeftNavDrawer.js +1 -1
- package/components/app/App.js +8 -36
- package/components/app/hooks/useMatchers.d.ts +1 -1
- package/components/app/hooks/useMatchers.js +11 -23
- package/components/app/hooks/useMatchers.test.js +22 -22
- package/components/app/hooks/useTitle.js +5 -5
- package/components/app/providers/FavouritesProvider.js +2 -2
- package/components/app/providers/HitProvider.d.ts +22 -0
- package/components/app/providers/{RecordProvider.js → HitProvider.js} +41 -41
- package/components/app/providers/{RecordSearchProvider.d.ts → HitSearchProvider.d.ts} +6 -6
- package/components/app/providers/{RecordSearchProvider.js → HitSearchProvider.js} +17 -12
- package/components/app/providers/{RecordSearchProvider.test.js → HitSearchProvider.test.js} +71 -52
- package/components/app/providers/ModalProvider.d.ts +0 -1
- package/components/app/providers/ParameterProvider.d.ts +2 -9
- package/components/app/providers/ParameterProvider.js +240 -165
- package/components/app/providers/ParameterProvider.test.js +94 -346
- package/components/app/providers/SocketProvider.d.ts +2 -11
- package/components/app/providers/SocketProvider.js +5 -18
- package/components/app/providers/UserListProvider.js +8 -28
- package/components/elements/PluginTypography.d.ts +1 -2
- package/components/elements/PluginTypography.js +2 -3
- package/components/elements/UserList.d.ts +2 -5
- package/components/elements/UserList.js +8 -18
- package/components/elements/addons/search/phrase/Phrase.js +1 -1
- package/components/elements/display/ChipPopper.d.ts +1 -1
- package/components/elements/display/HowlerCard.js +1 -1
- package/components/elements/display/Modal.js +0 -2
- package/components/elements/display/icons/BundleButton.d.ts +6 -0
- package/components/elements/display/icons/BundleButton.js +32 -0
- package/components/elements/hit/HitActions.js +4 -4
- package/components/elements/hit/HitBanner.d.ts +0 -1
- package/components/elements/hit/HitBanner.js +49 -29
- package/components/elements/hit/HitCard.d.ts +0 -2
- package/components/elements/hit/HitCard.js +7 -7
- package/components/elements/{record/RecordComments.d.ts → hit/HitComments.d.ts} +4 -5
- package/components/elements/{record/RecordComments.js → hit/HitComments.js} +28 -29
- package/components/elements/{ObjectDetails.js → hit/HitDetails.js} +17 -17
- package/components/elements/hit/HitLabels.js +2 -2
- package/components/elements/hit/HitLinks.js +1 -1
- package/components/elements/hit/HitOutline.d.ts +0 -1
- package/components/elements/hit/HitOutline.js +3 -3
- package/components/elements/hit/{HitPreview.d.ts → HitQuickSearch.d.ts} +3 -3
- package/components/elements/hit/{HitPreview.js → HitQuickSearch.js} +4 -10
- package/components/elements/hit/HitRelated.d.ts +6 -0
- package/components/elements/hit/HitRelated.js +7 -0
- package/components/elements/hit/HitSummary.d.ts +1 -2
- package/components/elements/hit/HitSummary.js +5 -6
- package/components/elements/{record/RecordWorklog.d.ts → hit/HitWorklog.d.ts} +3 -4
- package/components/elements/{record/RecordWorklog.js → hit/HitWorklog.js} +13 -15
- package/components/elements/hit/aggregate/HitGraph.js +8 -8
- package/components/elements/hit/elements/Assigned.js +3 -6
- package/components/elements/hit/outlines/DefaultOutline.js +1 -1
- package/components/elements/view/ViewTitle.d.ts +0 -1
- package/components/elements/view/ViewTitle.js +2 -9
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +4 -4
- package/components/hooks/{useRecordSelection.d.ts → useHitSelection.d.ts} +2 -2
- package/components/hooks/{useRecordSelection.js → useHitSelection.js} +33 -12
- package/components/hooks/useMyPreferences.js +1 -10
- package/components/hooks/useMySearch.js +2 -2
- package/components/hooks/useMySitemap.js +1 -4
- package/components/hooks/useMyTheme.js +2 -9
- package/components/routes/action/edit/ActionEditor.js +2 -2
- package/components/routes/action/useMyActionFunctions.js +22 -4
- package/components/routes/action/view/ActionSearch.js +1 -1
- package/components/routes/advanced/QueryBuilder.js +1 -1
- package/components/routes/advanced/QueryEditor.js +3 -3
- package/components/routes/advanced/historyCompletionProvider.js +3 -3
- package/components/routes/analytics/AnalyticDetails.js +2 -2
- package/components/routes/analytics/AnalyticSearch.js +1 -1
- package/components/routes/dossiers/DossierEditor.js +2 -2
- package/components/routes/dossiers/DossierEditor.test.js +1 -1
- package/components/routes/help/ApiDocumentation.js +1 -1
- package/components/routes/help/BundleDocumentation.d.ts +3 -0
- package/components/routes/help/BundleDocumentation.js +12 -0
- package/components/routes/help/HitBannerDocumentation.js +0 -1
- package/components/routes/help/HitDocumentation.js +3 -1
- package/components/routes/help/markdown/en/bundles.md.js +1 -0
- package/components/routes/help/markdown/fr/bundles.md.js +1 -0
- package/components/routes/hits/search/BundleParentMenu.d.ts +6 -0
- package/components/routes/hits/search/BundleParentMenu.js +32 -0
- package/components/routes/hits/search/BundleScroller.d.ts +2 -0
- package/components/routes/hits/search/BundleScroller.js +6 -0
- package/components/routes/hits/search/{RecordBrowser.js → HitBrowser.js} +9 -9
- package/components/{elements/record/RecordContextMenu.d.ts → routes/hits/search/HitContextMenu.d.ts} +3 -3
- package/components/routes/hits/search/HitContextMenu.js +229 -0
- package/components/{elements/record/RecordContextMenu.test.js → routes/hits/search/HitContextMenu.test.js} +39 -94
- package/components/routes/hits/search/{RecordQuery.d.ts → HitQuery.d.ts} +2 -2
- package/components/routes/hits/search/{RecordQuery.js → HitQuery.js} +6 -6
- package/components/routes/hits/search/InformationPane.d.ts +0 -1
- package/components/routes/hits/search/InformationPane.js +63 -50
- package/components/routes/hits/search/LayoutSettings.js +3 -3
- package/components/routes/hits/search/QuerySettings.js +1 -2
- package/components/routes/hits/search/QuerySettings.test.js +9 -14
- package/components/routes/hits/search/SearchPane.js +49 -26
- package/components/routes/hits/search/ViewLink.js +3 -3
- package/components/routes/hits/search/ViewLink.test.js +8 -8
- package/components/routes/hits/search/grid/AddColumnModal.js +4 -5
- package/components/routes/hits/search/grid/EnhancedCell.d.ts +1 -2
- package/components/routes/hits/search/grid/EnhancedCell.js +2 -2
- package/components/routes/hits/search/grid/HitGrid.js +18 -20
- package/components/routes/hits/search/grid/{RecordRow.d.ts → HitRow.d.ts} +2 -3
- package/components/routes/hits/search/grid/{RecordRow.js → HitRow.js} +8 -10
- package/components/routes/hits/view/HitViewer.js +13 -12
- package/components/routes/home/ViewCard.js +41 -47
- package/components/{elements/MarkdownEditor.js → routes/overviews/OverviewEditor.js} +3 -3
- package/components/routes/overviews/OverviewViewer.js +2 -2
- package/components/routes/views/ViewComposer.js +19 -46
- package/locales/en/translation.json +5 -110
- package/locales/fr/translation.json +5 -108
- package/models/WithMetadata.d.ts +1 -2
- package/models/entities/generated/{ThreatEnrichment.d.ts → Enrichment.d.ts} +1 -1
- package/models/entities/generated/Hit.d.ts +0 -1
- package/models/entities/generated/Howler.d.ts +5 -0
- package/models/entities/generated/Rule.d.ts +10 -2
- package/models/entities/generated/Threat.d.ts +2 -2
- package/models/entities/generated/View.d.ts +0 -1
- package/package.json +6 -26
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/utils.d.ts +1 -2
- package/tests/mocks.d.ts +1 -11
- package/tests/mocks.js +7 -12
- package/tests/server-handlers.js +1 -6
- package/tests/utils.d.ts +0 -4
- package/tests/utils.js +0 -20
- package/utils/constants.d.ts +3 -4
- package/utils/constants.js +0 -6
- package/utils/hitFunctions.d.ts +1 -2
- package/utils/hitFunctions.js +4 -4
- package/utils/socketUtils.d.ts +0 -14
- package/utils/socketUtils.js +1 -17
- package/utils/viewUtils.js +0 -3
- package/api/search/case.d.ts +0 -4
- package/api/search/case.js +0 -8
- package/api/socket/index.d.ts +0 -3
- package/api/socket/index.js +0 -6
- package/api/socket/viewers.d.ts +0 -2
- package/api/socket/viewers.js +0 -8
- package/api/socket/viewers.test.js +0 -44
- package/api/v2/case/index.d.ts +0 -8
- package/api/v2/case/index.js +0 -20
- package/api/v2/case/items.d.ts +0 -6
- package/api/v2/case/items.js +0 -18
- package/api/v2/index.d.ts +0 -4
- package/api/v2/index.js +0 -6
- package/api/v2/search/facet.d.ts +0 -3
- package/api/v2/search/facet.js +0 -12
- package/api/v2/search/index.d.ts +0 -5
- package/api/v2/search/index.js +0 -24
- package/components/app/providers/RecordProvider.d.ts +0 -23
- package/components/elements/ContextMenu.d.ts +0 -56
- package/components/elements/ContextMenu.js +0 -109
- package/components/elements/ContextMenu.test.d.ts +0 -1
- package/components/elements/ContextMenu.test.js +0 -215
- package/components/elements/ObjectDetails.d.ts +0 -6
- package/components/elements/case/CaseCard.d.ts +0 -12
- package/components/elements/case/CaseCard.js +0 -42
- package/components/elements/case/CasePreview.d.ts +0 -6
- package/components/elements/case/CasePreview.js +0 -17
- package/components/elements/case/StatusIcon.d.ts +0 -5
- package/components/elements/case/StatusIcon.js +0 -13
- package/components/elements/hit/elements/AnalyticLink.d.ts +0 -9
- package/components/elements/hit/elements/AnalyticLink.js +0 -22
- package/components/elements/hit/elements/Assigned.test.d.ts +0 -1
- package/components/elements/hit/elements/Assigned.test.js +0 -65
- package/components/elements/hit/related/RelatedRecords.js +0 -63
- package/components/elements/observable/ObservableCard.d.ts +0 -6
- package/components/elements/observable/ObservableCard.js +0 -22
- package/components/elements/observable/ObservablePreview.d.ts +0 -6
- package/components/elements/observable/ObservablePreview.js +0 -12
- package/components/elements/record/RecordContextMenu.js +0 -256
- package/components/elements/record/RecordContextMenu.test.d.ts +0 -1
- package/components/elements/record/RecordRelated.d.ts +0 -7
- package/components/elements/record/RecordRelated.js +0 -34
- package/components/hooks/useRelatedRecords.d.ts +0 -13
- package/components/hooks/useRelatedRecords.js +0 -32
- package/components/routes/cases/CaseViewer.d.ts +0 -2
- package/components/routes/cases/CaseViewer.js +0 -44
- package/components/routes/cases/CaseViewer.test.d.ts +0 -1
- package/components/routes/cases/CaseViewer.test.js +0 -133
- package/components/routes/cases/Cases.d.ts +0 -2
- package/components/routes/cases/Cases.js +0 -148
- package/components/routes/cases/constants.d.ts +0 -6
- package/components/routes/cases/constants.js +0 -6
- package/components/routes/cases/detail/AlertPanel.d.ts +0 -6
- package/components/routes/cases/detail/AlertPanel.js +0 -33
- package/components/routes/cases/detail/CaseAssets.d.ts +0 -11
- package/components/routes/cases/detail/CaseAssets.js +0 -104
- package/components/routes/cases/detail/CaseAssets.test.d.ts +0 -1
- package/components/routes/cases/detail/CaseAssets.test.js +0 -167
- package/components/routes/cases/detail/CaseDashboard.d.ts +0 -7
- package/components/routes/cases/detail/CaseDashboard.js +0 -66
- package/components/routes/cases/detail/CaseDetails.d.ts +0 -6
- package/components/routes/cases/detail/CaseDetails.js +0 -70
- package/components/routes/cases/detail/CaseOverview.d.ts +0 -7
- package/components/routes/cases/detail/CaseOverview.js +0 -43
- package/components/routes/cases/detail/CaseSidebar.d.ts +0 -8
- package/components/routes/cases/detail/CaseSidebar.js +0 -107
- package/components/routes/cases/detail/CaseSidebar.test.d.ts +0 -1
- package/components/routes/cases/detail/CaseSidebar.test.js +0 -246
- package/components/routes/cases/detail/CaseTask.d.ts +0 -11
- package/components/routes/cases/detail/CaseTask.js +0 -66
- package/components/routes/cases/detail/CaseTimeline.d.ts +0 -12
- package/components/routes/cases/detail/CaseTimeline.js +0 -106
- package/components/routes/cases/detail/CaseTimeline.test.d.ts +0 -1
- package/components/routes/cases/detail/CaseTimeline.test.js +0 -320
- package/components/routes/cases/detail/ItemPage.d.ts +0 -6
- package/components/routes/cases/detail/ItemPage.js +0 -95
- package/components/routes/cases/detail/RelatedCasePanel.d.ts +0 -6
- package/components/routes/cases/detail/RelatedCasePanel.js +0 -34
- package/components/routes/cases/detail/TaskPanel.d.ts +0 -7
- package/components/routes/cases/detail/TaskPanel.js +0 -52
- package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +0 -11
- package/components/routes/cases/detail/aggregates/CaseAggregate.js +0 -24
- package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +0 -6
- package/components/routes/cases/detail/aggregates/SourceAggregate.js +0 -26
- package/components/routes/cases/detail/assets/Asset.d.ts +0 -14
- package/components/routes/cases/detail/assets/Asset.js +0 -12
- package/components/routes/cases/detail/assets/Asset.test.d.ts +0 -1
- package/components/routes/cases/detail/assets/Asset.test.js +0 -72
- package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +0 -20
- package/components/routes/cases/detail/sidebar/CaseFolder.js +0 -83
- package/components/routes/cases/detail/sidebar/CaseFolder.test.d.ts +0 -1
- package/components/routes/cases/detail/sidebar/CaseFolder.test.js +0 -295
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.d.ts +0 -34
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +0 -103
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.d.ts +0 -1
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +0 -363
- package/components/routes/cases/detail/sidebar/FolderEntry.d.ts +0 -25
- package/components/routes/cases/detail/sidebar/FolderEntry.js +0 -88
- package/components/routes/cases/detail/sidebar/FolderEntry.test.d.ts +0 -1
- package/components/routes/cases/detail/sidebar/FolderEntry.test.js +0 -206
- package/components/routes/cases/detail/sidebar/RootDropZone.d.ts +0 -5
- package/components/routes/cases/detail/sidebar/RootDropZone.js +0 -33
- package/components/routes/cases/detail/sidebar/types.d.ts +0 -9
- package/components/routes/cases/detail/sidebar/utils.d.ts +0 -3
- package/components/routes/cases/detail/sidebar/utils.js +0 -29
- package/components/routes/cases/detail/sidebar/utils.test.d.ts +0 -1
- package/components/routes/cases/detail/sidebar/utils.test.js +0 -82
- package/components/routes/cases/hooks/useCase.d.ts +0 -13
- package/components/routes/cases/hooks/useCase.js +0 -69
- package/components/routes/cases/hooks/useCase.test.d.ts +0 -1
- package/components/routes/cases/hooks/useCase.test.js +0 -141
- package/components/routes/cases/modals/AddToCaseModal.d.ts +0 -7
- package/components/routes/cases/modals/AddToCaseModal.js +0 -59
- package/components/routes/cases/modals/AddToCaseModal.test.d.ts +0 -1
- package/components/routes/cases/modals/AddToCaseModal.test.js +0 -313
- package/components/routes/cases/modals/CaseRecordRow.d.ts +0 -9
- package/components/routes/cases/modals/CaseRecordRow.js +0 -15
- package/components/routes/cases/modals/CreateCaseModal.d.ts +0 -7
- package/components/routes/cases/modals/CreateCaseModal.js +0 -55
- package/components/routes/cases/modals/CreateCaseModal.test.d.ts +0 -1
- package/components/routes/cases/modals/CreateCaseModal.test.js +0 -358
- package/components/routes/cases/modals/RenameItemModal.d.ts +0 -9
- package/components/routes/cases/modals/RenameItemModal.js +0 -48
- package/components/routes/cases/modals/ResolveModal.d.ts +0 -7
- package/components/routes/cases/modals/ResolveModal.js +0 -115
- package/components/routes/cases/modals/ResolveModal.test.d.ts +0 -1
- package/components/routes/cases/modals/ResolveModal.test.js +0 -384
- package/components/routes/cases/modals/hooks.d.ts +0 -7
- package/components/routes/cases/modals/hooks.js +0 -44
- package/components/routes/cases/modals/types.d.ts +0 -5
- package/components/routes/cases/search/CaseAssigneeFilter.d.ts +0 -6
- package/components/routes/cases/search/CaseAssigneeFilter.js +0 -33
- package/components/routes/cases/search/CaseAssigneeFilter.test.d.ts +0 -1
- package/components/routes/cases/search/CaseAssigneeFilter.test.js +0 -127
- package/components/routes/cases/search/CaseDateFilter.d.ts +0 -13
- package/components/routes/cases/search/CaseDateFilter.js +0 -26
- package/components/routes/cases/search/CaseDateFilter.test.d.ts +0 -1
- package/components/routes/cases/search/CaseDateFilter.test.js +0 -115
- package/components/routes/cases/search/CaseStatusFilter.d.ts +0 -6
- package/components/routes/cases/search/CaseStatusFilter.js +0 -13
- package/components/routes/cases/search/CaseStatusFilter.test.d.ts +0 -1
- package/components/routes/cases/search/CaseStatusFilter.test.js +0 -86
- package/components/routes/hits/search/shared/IndexPicker.d.ts +0 -2
- package/components/routes/hits/search/shared/IndexPicker.js +0 -20
- package/components/routes/observables/ObservableViewer.d.ts +0 -7
- package/components/routes/observables/ObservableViewer.js +0 -27
- package/models/entities/generated/AttachmentsFile.d.ts +0 -12
- package/models/entities/generated/Case.d.ts +0 -28
- package/models/entities/generated/DestinationOriginal.d.ts +0 -19
- package/models/entities/generated/EmailAttachment.d.ts +0 -8
- package/models/entities/generated/EmailParent.d.ts +0 -19
- package/models/entities/generated/Enrichments.d.ts +0 -7
- package/models/entities/generated/EnrichmentsIndicator.d.ts +0 -21
- package/models/entities/generated/HttpResponse.d.ts +0 -11
- package/models/entities/generated/Item.d.ts +0 -9
- package/models/entities/generated/Observable.d.ts +0 -85
- package/models/entities/generated/ObservableCloud.d.ts +0 -20
- package/models/entities/generated/ObservableDestination.d.ts +0 -23
- package/models/entities/generated/ObservableEmail.d.ts +0 -30
- package/models/entities/generated/ObservableFile.d.ts +0 -36
- package/models/entities/generated/ObservableHowler.d.ts +0 -42
- package/models/entities/generated/ObservableHttp.d.ts +0 -11
- package/models/entities/generated/ObservableObserver.d.ts +0 -21
- package/models/entities/generated/ObservableOrganization.d.ts +0 -7
- package/models/entities/generated/ObservableProcess.d.ts +0 -34
- package/models/entities/generated/ObservableSource.d.ts +0 -23
- package/models/entities/generated/ObservableThreat.d.ts +0 -21
- package/models/entities/generated/ObservableTls.d.ts +0 -12
- package/models/entities/generated/ObserverIngress.d.ts +0 -9
- package/models/entities/generated/Task.d.ts +0 -10
- package/models/socket/CaseUpdate.d.ts +0 -5
- package/models/socket/ViewersUpdate.d.ts +0 -4
- package/utils/socketUtils.test.d.ts +0 -1
- package/utils/socketUtils.test.js +0 -59
- package/utils/typeUtils.d.ts +0 -7
- package/utils/typeUtils.js +0 -27
- /package/{api/socket/viewers.test.d.ts → components/app/providers/HitSearchProvider.test.d.ts} +0 -0
- /package/components/elements/hit/{related/RelatedRecords.d.ts → HitDetails.d.ts} +0 -0
- /package/components/routes/hits/search/{RecordBrowser.d.ts → HitBrowser.d.ts} +0 -0
- /package/components/{app/providers/RecordSearchProvider.test.d.ts → routes/hits/search/HitContextMenu.test.d.ts} +0 -0
- /package/components/{elements/MarkdownEditor.d.ts → routes/overviews/OverviewEditor.d.ts} +0 -0
package/utils/constants.js
CHANGED
|
@@ -104,12 +104,6 @@ export const DATE_RANGES = [
|
|
|
104
104
|
'date.range.all',
|
|
105
105
|
'date.range.custom'
|
|
106
106
|
];
|
|
107
|
-
export const DATE_RANGE_LUCENE = {
|
|
108
|
-
'date.range.1.day': 'now-1d/d',
|
|
109
|
-
'date.range.3.day': 'now-3d/d',
|
|
110
|
-
'date.range.1.week': 'now-7d/d',
|
|
111
|
-
'date.range.1.month': 'now-1M/M'
|
|
112
|
-
};
|
|
113
107
|
export const LABEL_TYPES = {
|
|
114
108
|
insight: { icon: _jsx(PsychologyAlt, { fontSize: "small" }), color: '#FFFFFF' }, //brain icon
|
|
115
109
|
mitigation: { icon: _jsx(LocalPolice, { fontSize: "small" }), color: blue[600] }, //police badge
|
package/utils/hitFunctions.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
2
|
-
|
|
3
|
-
export declare const getUserList: (record: Hit | Observable) => Set<string>;
|
|
2
|
+
export declare const getUserList: (hit: Hit) => Set<string>;
|
package/utils/hitFunctions.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const getUserList = (
|
|
1
|
+
export const getUserList = (hit) => {
|
|
2
2
|
const ids = new Set();
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
if (hit) {
|
|
4
|
+
hit.howler?.log?.forEach(l => ids.add(l.user));
|
|
5
|
+
hit.howler?.comment?.forEach(c => ids.add(c.user), ids);
|
|
6
6
|
}
|
|
7
7
|
return ids;
|
|
8
8
|
};
|
package/utils/socketUtils.d.ts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import type { RecievedDataType } from '@cccsaurora/howler-ui/components/app/providers/SocketProvider';
|
|
2
|
-
import type { CaseUpdate } from '@cccsaurora/howler-ui/models/socket/CaseUpdate';
|
|
3
2
|
import type { HitUpdate } from '@cccsaurora/howler-ui/models/socket/HitUpdate';
|
|
4
|
-
import type { ViewersUpdate } from '@cccsaurora/howler-ui/models/socket/ViewersUpdate';
|
|
5
3
|
/**
|
|
6
4
|
* Checks to see if the data recieved from the socket is a hit update
|
|
7
5
|
* @param data The data recieved from the socket
|
|
8
6
|
* @returns whether the data is a hit update
|
|
9
7
|
*/
|
|
10
8
|
export declare const isHitUpdate: (data: any) => data is RecievedDataType<HitUpdate>;
|
|
11
|
-
/**
|
|
12
|
-
* Checks to see if the data received from the socket is a case update
|
|
13
|
-
* @param data The data received from the socket
|
|
14
|
-
* @returns whether the data is a case update
|
|
15
|
-
*/
|
|
16
|
-
export declare const isCaseUpdate: (data: any) => data is RecievedDataType<CaseUpdate>;
|
|
17
|
-
/**
|
|
18
|
-
* Checks to see if the data received from the socket is a viewers update
|
|
19
|
-
* @param data The data received from the socket
|
|
20
|
-
* @returns whether the data is a viewers update
|
|
21
|
-
*/
|
|
22
|
-
export declare const isViewersUpdate: (data: any) => data is RecievedDataType<ViewersUpdate>;
|
package/utils/socketUtils.js
CHANGED
|
@@ -4,21 +4,5 @@
|
|
|
4
4
|
* @returns whether the data is a hit update
|
|
5
5
|
*/
|
|
6
6
|
export const isHitUpdate = (data) => {
|
|
7
|
-
return
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Checks to see if the data received from the socket is a case update
|
|
11
|
-
* @param data The data received from the socket
|
|
12
|
-
* @returns whether the data is a case update
|
|
13
|
-
*/
|
|
14
|
-
export const isCaseUpdate = (data) => {
|
|
15
|
-
return !!(data.type === 'cases' && data.case);
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Checks to see if the data received from the socket is a viewers update
|
|
19
|
-
* @param data The data received from the socket
|
|
20
|
-
* @returns whether the data is a viewers update
|
|
21
|
-
*/
|
|
22
|
-
export const isViewersUpdate = (data) => {
|
|
23
|
-
return !!(data.type === 'viewers_update' && data.viewers && data.id);
|
|
7
|
+
return data.version && data.hit;
|
|
24
8
|
};
|
package/utils/viewUtils.js
CHANGED
package/api/search/case.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { HowlerSearchRequest, HowlerSearchResponse } from '@cccsaurora/howler-ui/api/search';
|
|
2
|
-
import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
|
|
3
|
-
export declare const uri: () => string;
|
|
4
|
-
export declare const post: (request?: HowlerSearchRequest) => Promise<HowlerSearchResponse<Case>>;
|
package/api/search/case.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { hpost, joinUri } from '@cccsaurora/howler-ui/api';
|
|
2
|
-
import { uri as parentUri } from '@cccsaurora/howler-ui/api/search';
|
|
3
|
-
export const uri = () => {
|
|
4
|
-
return joinUri(parentUri(), 'case');
|
|
5
|
-
};
|
|
6
|
-
export const post = (request) => {
|
|
7
|
-
return hpost(uri(), { ...(request || {}), query: request?.query || 'case_id:*' });
|
|
8
|
-
};
|
package/api/socket/index.d.ts
DELETED
package/api/socket/index.js
DELETED
package/api/socket/viewers.d.ts
DELETED
package/api/socket/viewers.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { hget, joinAllUri } from '@cccsaurora/howler-ui/api';
|
|
2
|
-
import { uri as parentUri } from '@cccsaurora/howler-ui/api/socket';
|
|
3
|
-
export const uri = (entityId) => {
|
|
4
|
-
return entityId ? joinAllUri(parentUri(), 'viewers', entityId) : joinAllUri(parentUri(), 'viewers');
|
|
5
|
-
};
|
|
6
|
-
export const get = async (entityId) => {
|
|
7
|
-
return hget(uri(entityId));
|
|
8
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
// ---------------------------------------------------------------------------
|
|
3
|
-
// Hoisted mocks
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
const mockHget = vi.hoisted(() => vi.fn());
|
|
6
|
-
vi.mock('api', async () => {
|
|
7
|
-
const urlJoin = (await import('url-join')).default;
|
|
8
|
-
return {
|
|
9
|
-
hget: mockHget,
|
|
10
|
-
joinAllUri: (...parts) => urlJoin(...parts)
|
|
11
|
-
};
|
|
12
|
-
});
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// Import after mocks
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// eslint-disable-next-line
|
|
17
|
-
import { get } from './viewers';
|
|
18
|
-
// ---------------------------------------------------------------------------
|
|
19
|
-
// Setup
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
mockHget.mockReset();
|
|
23
|
-
});
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
// Tests
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
describe('viewers API', () => {
|
|
28
|
-
describe('get', () => {
|
|
29
|
-
it('calls hget with the correct URI', async () => {
|
|
30
|
-
mockHget.mockResolvedValue(['alice', 'bob']);
|
|
31
|
-
await get('entity-1');
|
|
32
|
-
expect(mockHget).toHaveBeenCalledWith('/socket/v1/viewers/entity-1');
|
|
33
|
-
});
|
|
34
|
-
it('returns the result from hget', async () => {
|
|
35
|
-
mockHget.mockResolvedValue(['alice', 'bob']);
|
|
36
|
-
const result = await get('entity-1');
|
|
37
|
-
expect(result).toEqual(['alice', 'bob']);
|
|
38
|
-
});
|
|
39
|
-
it('propagates errors from hget', async () => {
|
|
40
|
-
mockHget.mockRejectedValue(new Error('not found'));
|
|
41
|
-
await expect(get('entity-1')).rejects.toThrow('not found');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
package/api/v2/case/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as items from '@cccsaurora/howler-ui/api/v2/case/items';
|
|
2
|
-
import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
|
|
3
|
-
export declare const uri: (id?: string) => string;
|
|
4
|
-
export declare const get: (id: string) => Promise<Case>;
|
|
5
|
-
export declare const post: (newData: Partial<Case>) => Promise<Case>;
|
|
6
|
-
export declare const put: (id: string, _case: Partial<Case>) => Promise<Case>;
|
|
7
|
-
export declare const del: (id: string) => Promise<void>;
|
|
8
|
-
export { items };
|
package/api/v2/case/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-cycle
|
|
2
|
-
import { hdelete, hget, hpost, hput, joinAllUri, joinUri } from '@cccsaurora/howler-ui/api';
|
|
3
|
-
import { uri as parentUri } from '@cccsaurora/howler-ui/api/v2';
|
|
4
|
-
import * as items from '@cccsaurora/howler-ui/api/v2/case/items';
|
|
5
|
-
export const uri = (id) => {
|
|
6
|
-
return id ? joinAllUri(parentUri(), 'case', id) : joinUri(parentUri(), 'case');
|
|
7
|
-
};
|
|
8
|
-
export const get = (id) => {
|
|
9
|
-
return hget(uri(id));
|
|
10
|
-
};
|
|
11
|
-
export const post = (newData) => {
|
|
12
|
-
return hpost(uri(), newData);
|
|
13
|
-
};
|
|
14
|
-
export const put = (id, _case) => {
|
|
15
|
-
return hput(uri(id), _case);
|
|
16
|
-
};
|
|
17
|
-
export const del = (id) => {
|
|
18
|
-
return hdelete(uri(id));
|
|
19
|
-
};
|
|
20
|
-
export { items };
|
package/api/v2/case/items.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Case } from '@cccsaurora/howler-ui/models/entities/generated/Case';
|
|
2
|
-
import type { Item } from '@cccsaurora/howler-ui/models/entities/generated/Item';
|
|
3
|
-
export declare const uri: (id: string) => string;
|
|
4
|
-
export declare const post: (id: string, newData: Item) => Promise<Case>;
|
|
5
|
-
export declare const del: (id: string, values: string | string[]) => Promise<Case>;
|
|
6
|
-
export declare const patch: (id: string, value: string, newPath: string) => Promise<Case>;
|
package/api/v2/case/items.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-cycle
|
|
2
|
-
import { hdelete, hpatch, hpost, joinUri } from '@cccsaurora/howler-ui/api';
|
|
3
|
-
import { uri as parentUri } from '@cccsaurora/howler-ui/api/v2/case';
|
|
4
|
-
export const uri = (id) => {
|
|
5
|
-
return joinUri(parentUri(id), 'items');
|
|
6
|
-
};
|
|
7
|
-
export const post = (id, newData) => {
|
|
8
|
-
return hpost(uri(id), newData);
|
|
9
|
-
};
|
|
10
|
-
export const del = (id, values) => {
|
|
11
|
-
if (!Array.isArray(values)) {
|
|
12
|
-
values = [values];
|
|
13
|
-
}
|
|
14
|
-
return hdelete(uri(id), { values });
|
|
15
|
-
};
|
|
16
|
-
export const patch = (id, value, newPath) => {
|
|
17
|
-
return hpatch(uri(id), { value, new_path: newPath });
|
|
18
|
-
};
|
package/api/v2/index.d.ts
DELETED
package/api/v2/index.js
DELETED
package/api/v2/search/facet.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { HowlerFacetSearchRequest, HowlerFacetSearchResponse } from '@cccsaurora/howler-ui/api/search/facet';
|
|
2
|
-
export declare const uri: (indexes: string[]) => string;
|
|
3
|
-
export declare const post: (indexes: string | string[], request?: HowlerFacetSearchRequest) => Promise<HowlerFacetSearchResponse>;
|
package/api/v2/search/facet.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-cycle
|
|
2
|
-
import { hpost, joinAllUri } from '@cccsaurora/howler-ui/api';
|
|
3
|
-
import { uri as parentUri } from '@cccsaurora/howler-ui/api/v2';
|
|
4
|
-
export const uri = (indexes) => {
|
|
5
|
-
return joinAllUri(parentUri(), 'search', 'facet', indexes.join(','));
|
|
6
|
-
};
|
|
7
|
-
export const post = (indexes, request) => {
|
|
8
|
-
if (typeof indexes === 'string') {
|
|
9
|
-
indexes = indexes.split(',');
|
|
10
|
-
}
|
|
11
|
-
return hpost(uri(indexes), { ...(request || {}), query: request?.query || 'howler.id:*' });
|
|
12
|
-
};
|
package/api/v2/search/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { HowlerSearchRequest, HowlerSearchResponse } from '@cccsaurora/howler-ui/api/search';
|
|
2
|
-
import * as facet from './facet';
|
|
3
|
-
export declare const uri: (indexes: string[]) => string;
|
|
4
|
-
export declare const post: <T = any>(indexes: string | string[], request?: HowlerSearchRequest) => Promise<HowlerSearchResponse<T>>;
|
|
5
|
-
export { facet };
|
package/api/v2/search/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-cycle
|
|
2
|
-
import { hpost, joinAllUri } from '@cccsaurora/howler-ui/api';
|
|
3
|
-
import { uri as parentUri } from '@cccsaurora/howler-ui/api/v2';
|
|
4
|
-
import { identity, isNil } from 'lodash-es';
|
|
5
|
-
import * as facet from './facet';
|
|
6
|
-
export const uri = (indexes) => {
|
|
7
|
-
return joinAllUri(parentUri(), 'search', indexes.join(','));
|
|
8
|
-
};
|
|
9
|
-
export const post = (indexes, request) => {
|
|
10
|
-
if (isNil(indexes)) {
|
|
11
|
-
throw new Error('Indexes cannot be null or undefined.');
|
|
12
|
-
}
|
|
13
|
-
if (typeof indexes === 'string') {
|
|
14
|
-
indexes = indexes.split(',').filter(identity);
|
|
15
|
-
}
|
|
16
|
-
if (indexes.some(index => !['hit', 'observable', 'case'].includes(index))) {
|
|
17
|
-
throw new Error('Only hit, case, and observable indexes should be used currently.');
|
|
18
|
-
}
|
|
19
|
-
if (indexes.length < 1) {
|
|
20
|
-
throw new Error('indexes must have length of at least 1.');
|
|
21
|
-
}
|
|
22
|
-
return hpost(uri(indexes), { ...(request || {}), query: request?.query || 'howler.id:*' });
|
|
23
|
-
};
|
|
24
|
-
export { facet };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
2
|
-
import type { Observable } from '@cccsaurora/howler-ui/models/entities/generated/Observable';
|
|
3
|
-
import type { WithMetadata } from '@cccsaurora/howler-ui/models/WithMetadata';
|
|
4
|
-
import type { FC, PropsWithChildren } from 'react';
|
|
5
|
-
export interface RecordContextType {
|
|
6
|
-
records: {
|
|
7
|
-
[index: string]: Hit | Observable;
|
|
8
|
-
};
|
|
9
|
-
selectedRecords: (Hit | Observable)[];
|
|
10
|
-
addRecordToSelection: (id: string) => void;
|
|
11
|
-
removeRecordFromSelection: (id: string) => void;
|
|
12
|
-
clearSelectedRecords: (except?: string) => void;
|
|
13
|
-
loadRecords: (hits: (Hit | Observable)[]) => void;
|
|
14
|
-
updateRecord: (newHit: Hit | Observable) => void;
|
|
15
|
-
getRecord: (id: string, force?: boolean) => Promise<WithMetadata<Hit | Observable>>;
|
|
16
|
-
}
|
|
17
|
-
export declare const RecordContext: import("use-context-selector").Context<RecordContextType>;
|
|
18
|
-
/**
|
|
19
|
-
* Central repository for storing individual hit data across the application. Allows efficient retrieval of hits across componenents.
|
|
20
|
-
*/
|
|
21
|
-
declare const RecordProvider: FC<PropsWithChildren>;
|
|
22
|
-
export declare const useHitContextSelector: <Selected>(selector: (value: RecordContextType) => Selected) => Selected;
|
|
23
|
-
export default RecordProvider;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type SxProps } from '@mui/material';
|
|
2
|
-
import type { ElementType, FC, MouseEventHandler, PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
export type ContextMenuDivider = {
|
|
4
|
-
kind: 'divider';
|
|
5
|
-
id: string;
|
|
6
|
-
sx?: SxProps;
|
|
7
|
-
};
|
|
8
|
-
export type ContextMenuLeafItem = {
|
|
9
|
-
kind: 'item';
|
|
10
|
-
id: string;
|
|
11
|
-
icon?: ReactNode;
|
|
12
|
-
label: ReactNode;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
onClick?: () => void;
|
|
15
|
-
/** When provided the item renders as a router Link instead of a button. */
|
|
16
|
-
to?: string;
|
|
17
|
-
};
|
|
18
|
-
export type ContextMenuSubItem = {
|
|
19
|
-
key: string;
|
|
20
|
-
label: ReactNode;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
onClick?: () => void;
|
|
23
|
-
};
|
|
24
|
-
export type ContextMenuSubmenuItem = {
|
|
25
|
-
kind: 'submenu';
|
|
26
|
-
/**
|
|
27
|
-
* Identifier for this submenu. Used to derive:
|
|
28
|
-
* - the MenuItem's DOM id (`${id}-menu-item`)
|
|
29
|
-
* - the submenu Paper's DOM id (`${id}-submenu`)
|
|
30
|
-
*/
|
|
31
|
-
id: string;
|
|
32
|
-
icon?: ReactNode;
|
|
33
|
-
label: ReactNode;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
items: ContextMenuSubItem[];
|
|
36
|
-
};
|
|
37
|
-
export type ContextMenuEntry = ContextMenuDivider | ContextMenuLeafItem | ContextMenuSubmenuItem;
|
|
38
|
-
interface ContextMenuProps {
|
|
39
|
-
items: ContextMenuEntry[];
|
|
40
|
-
/** Called after the menu opens, with the triggering event. */
|
|
41
|
-
onOpen?: MouseEventHandler<HTMLElement>;
|
|
42
|
-
/** Called when the menu closes. */
|
|
43
|
-
onClose?: () => void;
|
|
44
|
-
/** Wraps children + menu in this element. Defaults to Box. */
|
|
45
|
-
Component?: ElementType;
|
|
46
|
-
/** id applied to the wrapper element */
|
|
47
|
-
id?: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Generic context menu component that renders a MUI Menu from a declarative
|
|
51
|
-
* items structure supporting leaf items, dividers, and single-level submenus.
|
|
52
|
-
*
|
|
53
|
-
* Submenus appear on hover and are positioned to avoid screen overflow.
|
|
54
|
-
*/
|
|
55
|
-
declare const ContextMenu: FC<PropsWithChildren<ContextMenuProps>>;
|
|
56
|
-
export default ContextMenu;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { KeyboardArrowRight } from '@mui/icons-material';
|
|
3
|
-
import { Box, Divider, Fade, ListItemIcon, ListItemText, Menu, MenuItem, MenuList, Paper, useTheme } from '@mui/material';
|
|
4
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
-
import { Link } from 'react-router-dom';
|
|
6
|
-
/**
|
|
7
|
-
* The margin at the bottom of the screen by which a submenu should be inverted.
|
|
8
|
-
* If hovering within this many pixels of the bottom, the submenu renders upward.
|
|
9
|
-
*/
|
|
10
|
-
const CONTEXTMENU_MARGIN = 350;
|
|
11
|
-
/**
|
|
12
|
-
* Generic context menu component that renders a MUI Menu from a declarative
|
|
13
|
-
* items structure supporting leaf items, dividers, and single-level submenus.
|
|
14
|
-
*
|
|
15
|
-
* Submenus appear on hover and are positioned to avoid screen overflow.
|
|
16
|
-
*/
|
|
17
|
-
const ContextMenu = ({ items, onOpen, onClose, Component = Box, id, children }) => {
|
|
18
|
-
const theme = useTheme();
|
|
19
|
-
const [show, setShow] = useState({});
|
|
20
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
21
|
-
const [transformProps, setTransformProps] = useState({});
|
|
22
|
-
const handleClose = useCallback(() => {
|
|
23
|
-
setAnchorEl(null);
|
|
24
|
-
onClose?.();
|
|
25
|
-
}, [onClose]);
|
|
26
|
-
const handleContextMenu = useCallback(event => {
|
|
27
|
-
if (anchorEl) {
|
|
28
|
-
event.preventDefault();
|
|
29
|
-
handleClose();
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
if (window.innerHeight - event.clientY < 300) {
|
|
34
|
-
setTransformProps({
|
|
35
|
-
position: 'fixed',
|
|
36
|
-
bottom: `${window.innerHeight - event.clientY}px !important`,
|
|
37
|
-
top: 'unset !important',
|
|
38
|
-
left: `${event.clientX}px !important`
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
setTransformProps({
|
|
43
|
-
position: 'fixed',
|
|
44
|
-
top: `${event.clientY}px !important`,
|
|
45
|
-
left: `${event.clientX}px !important`
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
setAnchorEl(event.target);
|
|
49
|
-
onOpen?.(event);
|
|
50
|
-
}, [anchorEl, handleClose, onOpen]);
|
|
51
|
-
/**
|
|
52
|
-
* Calculates positioning styles for a submenu based on the parent element's
|
|
53
|
-
* position relative to the viewport bottom.
|
|
54
|
-
*/
|
|
55
|
-
const calculateSubMenuStyles = useCallback((parent) => {
|
|
56
|
-
const baseStyles = { position: 'absolute', maxHeight: '300px', overflow: 'auto' };
|
|
57
|
-
const defaultStyles = { ...baseStyles, top: 0, left: '100%' };
|
|
58
|
-
if (!parent) {
|
|
59
|
-
return defaultStyles;
|
|
60
|
-
}
|
|
61
|
-
const parentBounds = parent.getBoundingClientRect();
|
|
62
|
-
if (window.innerHeight - parentBounds.y < CONTEXTMENU_MARGIN) {
|
|
63
|
-
return { ...baseStyles, bottom: 0, left: '100%' };
|
|
64
|
-
}
|
|
65
|
-
return defaultStyles;
|
|
66
|
-
}, []);
|
|
67
|
-
// Reset submenu visibility whenever the menu is closed
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (!anchorEl) {
|
|
70
|
-
setShow({});
|
|
71
|
-
}
|
|
72
|
-
}, [anchorEl]);
|
|
73
|
-
return (_jsxs(Component, { id: id, onContextMenu: handleContextMenu, children: [children, _jsx(Menu, { id: "record-menu", open: !!anchorEl, anchorEl: anchorEl, onClose: handleClose, slotProps: {
|
|
74
|
-
paper: {
|
|
75
|
-
sx: {
|
|
76
|
-
...transformProps,
|
|
77
|
-
overflow: 'visible !important'
|
|
78
|
-
},
|
|
79
|
-
elevation: 2
|
|
80
|
-
}
|
|
81
|
-
}, MenuListProps: {
|
|
82
|
-
dense: true,
|
|
83
|
-
sx: {
|
|
84
|
-
minWidth: '250px',
|
|
85
|
-
paddingY: '0 !important',
|
|
86
|
-
'& > :first-child': {
|
|
87
|
-
borderTopLeftRadius: theme.shape.borderRadius,
|
|
88
|
-
borderTopRightRadius: theme.shape.borderRadius
|
|
89
|
-
},
|
|
90
|
-
'& > :last-child': {
|
|
91
|
-
borderBottomLeftRadius: theme.shape.borderRadius,
|
|
92
|
-
borderBottomRightRadius: theme.shape.borderRadius
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, anchorOrigin: { vertical: 'top', horizontal: 'left' }, onClick: handleClose, children: items.map(entry => {
|
|
96
|
-
if (entry.kind === 'divider') {
|
|
97
|
-
return _jsx(Divider, { sx: { my: '0 !important' } }, entry.id);
|
|
98
|
-
}
|
|
99
|
-
if (entry.kind === 'item') {
|
|
100
|
-
if (entry.to) {
|
|
101
|
-
return (_jsxs(MenuItem, { component: Link, to: entry.to, disabled: entry.disabled, children: [entry.icon && _jsx(ListItemIcon, { children: entry.icon }), _jsx(ListItemText, { children: entry.label })] }, entry.id));
|
|
102
|
-
}
|
|
103
|
-
return (_jsxs(MenuItem, { disabled: entry.disabled, onClick: entry.onClick, children: [entry.icon && _jsx(ListItemIcon, { children: entry.icon }), _jsx(ListItemText, { children: entry.label })] }, entry.id));
|
|
104
|
-
}
|
|
105
|
-
const { id: entryId, icon, label, disabled, items: subItems } = entry;
|
|
106
|
-
return (_jsxs(MenuItem, { id: `${entryId}-menu-item`, sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, [entryId]: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, [entryId]: null })), disabled: disabled, children: [icon && _jsx(ListItemIcon, { children: icon }), _jsx(ListItemText, { sx: { flex: 1 }, children: label }), !disabled && _jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } }), _jsx(Fade, { in: !!show[entryId], unmountOnExit: true, children: _jsx(Paper, { id: `${entryId}-submenu`, sx: calculateSubMenuStyles(show[entryId]), elevation: 2, children: _jsx(MenuList, { sx: { p: 0, borderTopLeftRadius: 0 }, dense: true, role: "group", children: subItems.map(subItem => (_jsx(MenuItem, { onClick: subItem.onClick, disabled: subItem.disabled, children: _jsx(ListItemText, { children: subItem.label }) }, subItem.key))) }) }) })] }, entryId));
|
|
107
|
-
}) })] }));
|
|
108
|
-
};
|
|
109
|
-
export default ContextMenu;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|