dbf-mirador 4.2.3
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/LICENSE +203 -0
- package/README.md +133 -0
- package/dist/CommentSharp-B0J_-jEq.js +325 -0
- package/dist/CommentSharp-B0J_-jEq.js.map +1 -0
- package/dist/FailedImageContext-aQXnWSHN.js +318 -0
- package/dist/FailedImageContext-aQXnWSHN.js.map +1 -0
- package/dist/PluginHook-CFw_6P5c.js +54 -0
- package/dist/PluginHook-CFw_6P5c.js.map +1 -0
- package/dist/WindowCanvasNavigationControls-CUX723BQ.js +242 -0
- package/dist/WindowCanvasNavigationControls-CUX723BQ.js.map +1 -0
- package/dist/action-types-DjIbTE-A.js +74 -0
- package/dist/action-types-DjIbTE-A.js.map +1 -0
- package/dist/canvas-C8oHvXFN.js +41 -0
- package/dist/canvas-C8oHvXFN.js.map +1 -0
- package/dist/canvases-gRqhr-IH.js +3154 -0
- package/dist/canvases-gRqhr-IH.js.map +1 -0
- package/dist/createSvgIcon-Cwt8YPfm.js +2 -0
- package/dist/getters-COus7Mvg.js +2066 -0
- package/dist/getters-COus7Mvg.js.map +1 -0
- package/dist/index.module-CbBRf_R8.js +403 -0
- package/dist/index.module-CbBRf_R8.js.map +1 -0
- package/dist/mirador.es.js +39600 -0
- package/dist/mirador.es.js.map +1 -0
- package/dist/mirador.min.js +334 -0
- package/dist/mirador.min.js.map +1 -0
- package/dist/react-error-boundary.esm-B_pT-oCS.js +67 -0
- package/dist/react-error-boundary.esm-B_pT-oCS.js.map +1 -0
- package/dist/visuallyHidden-DmYvwNdU.js +98 -0
- package/dist/visuallyHidden-DmYvwNdU.js.map +1 -0
- package/dist/window-zelwU7wz.js +138 -0
- package/dist/window-zelwU7wz.js.map +1 -0
- package/package.json +138 -0
- package/src/components/AccessTokenSender.jsx +34 -0
- package/src/components/AnnotationSettings.jsx +31 -0
- package/src/components/AnnotationsOverlay.jsx +328 -0
- package/src/components/App.jsx +34 -0
- package/src/components/AppProviders.jsx +129 -0
- package/src/components/AttributionPanel.jsx +78 -0
- package/src/components/AudioViewer.jsx +39 -0
- package/src/components/BackgroundPluginArea.jsx +9 -0
- package/src/components/Branding.jsx +33 -0
- package/src/components/CanvasAnnotations.jsx +125 -0
- package/src/components/CanvasInfo.jsx +46 -0
- package/src/components/CanvasLayers.jsx +367 -0
- package/src/components/ChangeThemeDialog.jsx +65 -0
- package/src/components/CollapsibleSection.jsx +53 -0
- package/src/components/CollectionDialog.jsx +236 -0
- package/src/components/CollectionInfo.jsx +48 -0
- package/src/components/CompanionArea.jsx +140 -0
- package/src/components/CompanionWindow.jsx +228 -0
- package/src/components/CompanionWindowFactory.jsx +38 -0
- package/src/components/CompanionWindowSection.jsx +11 -0
- package/src/components/CustomPanel.jsx +22 -0
- package/src/components/ErrorContent.jsx +65 -0
- package/src/components/ErrorDialog.jsx +47 -0
- package/src/components/FullScreenButton.jsx +47 -0
- package/src/components/GalleryView.jsx +36 -0
- package/src/components/GalleryViewThumbnail.jsx +160 -0
- package/src/components/IIIFAuthentication.jsx +144 -0
- package/src/components/IIIFDropTarget.jsx +168 -0
- package/src/components/IIIFIFrameCommunication.jsx +45 -0
- package/src/components/IIIFResourceLabel.jsx +26 -0
- package/src/components/IIIFThumbnail.jsx +214 -0
- package/src/components/ImageFailureMessage.jsx +42 -0
- package/src/components/LabelValueMetadata.jsx +46 -0
- package/src/components/LanguageSettings.jsx +46 -0
- package/src/components/LayersPanel.jsx +24 -0
- package/src/components/LocalePicker.jsx +56 -0
- package/src/components/ManifestForm.jsx +79 -0
- package/src/components/ManifestInfo.jsx +67 -0
- package/src/components/ManifestListItem.jsx +209 -0
- package/src/components/ManifestListItemError.jsx +53 -0
- package/src/components/ManifestRelatedLinks.jsx +154 -0
- package/src/components/MinimalWindow.jsx +104 -0
- package/src/components/MiradorMenuButton.jsx +71 -0
- package/src/components/MosaicRenderPreview.jsx +16 -0
- package/src/components/NestedMenu.jsx +42 -0
- package/src/components/NewBrowserWindow.jsx +34 -0
- package/src/components/OpenSeadragonComponent.jsx +258 -0
- package/src/components/OpenSeadragonTileSource.jsx +105 -0
- package/src/components/OpenSeadragonViewer.jsx +161 -0
- package/src/components/PluginHook.jsx +27 -0
- package/src/components/PrimaryWindow.jsx +115 -0
- package/src/components/SanitizedHtml.jsx +37 -0
- package/src/components/ScrollIndicatedDialogContent.jsx +60 -0
- package/src/components/ScrollTo.jsx +61 -0
- package/src/components/SearchHit.jsx +220 -0
- package/src/components/SearchPanel.jsx +80 -0
- package/src/components/SearchPanelControls.jsx +174 -0
- package/src/components/SearchPanelNavigation.jsx +84 -0
- package/src/components/SearchResults.jsx +138 -0
- package/src/components/SelectCollection.jsx +44 -0
- package/src/components/SidebarIndexItem.jsx +11 -0
- package/src/components/SidebarIndexList.jsx +73 -0
- package/src/components/SidebarIndexTableOfContents.jsx +170 -0
- package/src/components/SidebarIndexThumbnail.jsx +22 -0
- package/src/components/TextViewer.jsx +37 -0
- package/src/components/ThumbnailCanvasGrouping.jsx +122 -0
- package/src/components/ThumbnailNavigation.jsx +231 -0
- package/src/components/VideoViewer.jsx +35 -0
- package/src/components/ViewerInfo.jsx +55 -0
- package/src/components/ViewerNavigation.jsx +72 -0
- package/src/components/Window.jsx +150 -0
- package/src/components/WindowAuthenticationBar.jsx +176 -0
- package/src/components/WindowCanvasNavigationControls.jsx +91 -0
- package/src/components/WindowList.jsx +71 -0
- package/src/components/WindowListButton.jsx +57 -0
- package/src/components/WindowSideBar.jsx +48 -0
- package/src/components/WindowSideBarAnnotationsPanel.jsx +51 -0
- package/src/components/WindowSideBarButtons.jsx +151 -0
- package/src/components/WindowSideBarCanvasPanel.jsx +165 -0
- package/src/components/WindowSideBarCollectionPanel.jsx +179 -0
- package/src/components/WindowSideBarInfoPanel.jsx +67 -0
- package/src/components/WindowThumbnailSettings.jsx +130 -0
- package/src/components/WindowTopBar.jsx +125 -0
- package/src/components/WindowTopBarPluginArea.jsx +8 -0
- package/src/components/WindowTopBarPluginMenu.jsx +78 -0
- package/src/components/WindowTopBarTitle.jsx +73 -0
- package/src/components/WindowTopMenu.jsx +81 -0
- package/src/components/WindowTopMenuButton.jsx +49 -0
- package/src/components/WindowViewSettings.jsx +95 -0
- package/src/components/WindowViewer.jsx +26 -0
- package/src/components/Workspace.jsx +124 -0
- package/src/components/WorkspaceAdd.jsx +221 -0
- package/src/components/WorkspaceAddButton.jsx +73 -0
- package/src/components/WorkspaceArea.jsx +66 -0
- package/src/components/WorkspaceControlPanel.jsx +85 -0
- package/src/components/WorkspaceControlPanelButtons.jsx +20 -0
- package/src/components/WorkspaceDialog.jsx +11 -0
- package/src/components/WorkspaceElastic.jsx +88 -0
- package/src/components/WorkspaceElasticWindow.jsx +79 -0
- package/src/components/WorkspaceExport.jsx +99 -0
- package/src/components/WorkspaceImport.jsx +89 -0
- package/src/components/WorkspaceMenu.jsx +126 -0
- package/src/components/WorkspaceMenuButton.jsx +42 -0
- package/src/components/WorkspaceMosaic.jsx +149 -0
- package/src/components/WorkspaceOptionsButton.jsx +35 -0
- package/src/components/WorkspaceOptionsMenu.jsx +112 -0
- package/src/components/WorkspaceSelectionDialog.jsx +165 -0
- package/src/components/ZoomControls.jsx +57 -0
- package/src/components/icons/BookViewIcon.jsx +14 -0
- package/src/components/icons/CanvasIndexIcon.jsx +14 -0
- package/src/components/icons/GalleryViewIcon.jsx +17 -0
- package/src/components/icons/MiradorIcon.jsx +14 -0
- package/src/components/icons/RestoreZoomIcon.jsx +15 -0
- package/src/components/icons/ThumbnailNavigationBottomIcon.jsx +15 -0
- package/src/components/icons/ThumbnailNavigationRightIcon.jsx +16 -0
- package/src/components/icons/WindowMaxIcon.jsx +15 -0
- package/src/components/icons/WindowMinIcon.jsx +15 -0
- package/src/components/icons/WindowOptionsIcon.jsx +16 -0
- package/src/components/icons/WorkspaceTypeElasticIcon.jsx +157 -0
- package/src/components/icons/WorkspaceTypeMosaicIcon.jsx +162 -0
- package/src/components/icons/index.js +27 -0
- package/src/components/index.js +108 -0
- package/src/config/css-ns.js +10 -0
- package/src/config/index.js +2 -0
- package/src/config/settings.js +607 -0
- package/src/containers/AnnotationSettings.js +27 -0
- package/src/containers/AnnotationsOverlay.js +51 -0
- package/src/containers/AppProviders.js +20 -0
- package/src/containers/AttributionPanel.js +20 -0
- package/src/containers/AudioViewer.js +16 -0
- package/src/containers/BackgroundPluginArea.js +4 -0
- package/src/containers/Branding.js +4 -0
- package/src/containers/CanvasAnnotations.js +32 -0
- package/src/containers/CanvasInfo.js +20 -0
- package/src/containers/CanvasLayers.js +25 -0
- package/src/containers/ChangeThemeDialog.js +29 -0
- package/src/containers/CollapsibleSection.js +3 -0
- package/src/containers/CollectionDialog.js +48 -0
- package/src/containers/CollectionInfo.js +29 -0
- package/src/containers/CompanionArea.js +22 -0
- package/src/containers/CompanionWindow.js +40 -0
- package/src/containers/CompanionWindowFactory.js +23 -0
- package/src/containers/CustomPanel.js +13 -0
- package/src/containers/ErrorContent.js +20 -0
- package/src/containers/ErrorDialog.js +28 -0
- package/src/containers/FullScreenButton.js +22 -0
- package/src/containers/GalleryView.js +23 -0
- package/src/containers/GalleryViewThumbnail.js +51 -0
- package/src/containers/IIIFAuthentication.js +86 -0
- package/src/containers/IIIFThumbnail.js +17 -0
- package/src/containers/LabelValueMetadata.js +14 -0
- package/src/containers/LanguageSettings.js +26 -0
- package/src/containers/LayersPanel.js +16 -0
- package/src/containers/LocalePicker.js +3 -0
- package/src/containers/ManifestForm.js +16 -0
- package/src/containers/ManifestInfo.js +29 -0
- package/src/containers/ManifestListItem.js +52 -0
- package/src/containers/ManifestListItemError.js +15 -0
- package/src/containers/ManifestRelatedLinks.js +28 -0
- package/src/containers/MinimalWindow.js +25 -0
- package/src/containers/MiradorMenuButton.js +7 -0
- package/src/containers/MosaicRenderPreview.js +14 -0
- package/src/containers/OpenSeadragonViewer.js +59 -0
- package/src/containers/PrimaryWindow.js +27 -0
- package/src/containers/SanitizedHtml.js +3 -0
- package/src/containers/ScrollIndicatedDialogContent.js +3 -0
- package/src/containers/SearchHit.js +71 -0
- package/src/containers/SearchPanel.js +23 -0
- package/src/containers/SearchPanelControls.js +36 -0
- package/src/containers/SearchPanelNavigation.js +39 -0
- package/src/containers/SearchResults.js +38 -0
- package/src/containers/SelectCollection.js +24 -0
- package/src/containers/SidebarIndexItem.js +8 -0
- package/src/containers/SidebarIndexList.js +28 -0
- package/src/containers/SidebarIndexTableOfContents.js +31 -0
- package/src/containers/SidebarIndexThumbnail.js +18 -0
- package/src/containers/TextViewer.js +19 -0
- package/src/containers/ThumbnailCanvasGrouping.js +29 -0
- package/src/containers/ThumbnailNavigation.js +48 -0
- package/src/containers/VideoViewer.js +16 -0
- package/src/containers/ViewerInfo.js +30 -0
- package/src/containers/ViewerNavigation.js +31 -0
- package/src/containers/Window.js +45 -0
- package/src/containers/WindowAuthenticationBar.js +7 -0
- package/src/containers/WindowCanvasNavigationControls.js +15 -0
- package/src/containers/WindowList.js +30 -0
- package/src/containers/WindowListButton.js +15 -0
- package/src/containers/WindowSideBar.js +20 -0
- package/src/containers/WindowSideBarAnnotationsPanel.js +23 -0
- package/src/containers/WindowSideBarButtons.js +75 -0
- package/src/containers/WindowSideBarCanvasPanel.js +50 -0
- package/src/containers/WindowSideBarCollectionPanel.js +48 -0
- package/src/containers/WindowSideBarInfoPanel.js +35 -0
- package/src/containers/WindowThumbnailSettings.js +31 -0
- package/src/containers/WindowTopBar.js +39 -0
- package/src/containers/WindowTopBarPluginArea.js +8 -0
- package/src/containers/WindowTopBarPluginMenu.js +7 -0
- package/src/containers/WindowTopBarTitle.js +17 -0
- package/src/containers/WindowTopMenu.js +28 -0
- package/src/containers/WindowTopMenuButton.js +7 -0
- package/src/containers/WindowViewSettings.js +30 -0
- package/src/containers/WindowViewer.js +10 -0
- package/src/containers/Workspace.js +36 -0
- package/src/containers/WorkspaceAdd.js +27 -0
- package/src/containers/WorkspaceAddButton.js +30 -0
- package/src/containers/WorkspaceArea.js +21 -0
- package/src/containers/WorkspaceControlPanel.js +10 -0
- package/src/containers/WorkspaceControlPanelButtons.js +7 -0
- package/src/containers/WorkspaceElastic.js +41 -0
- package/src/containers/WorkspaceElasticWindow.js +36 -0
- package/src/containers/WorkspaceExport.js +18 -0
- package/src/containers/WorkspaceImport.js +19 -0
- package/src/containers/WorkspaceMenu.js +30 -0
- package/src/containers/WorkspaceMenuButton.js +10 -0
- package/src/containers/WorkspaceMosaic.js +32 -0
- package/src/containers/WorkspaceOptionsButton.js +7 -0
- package/src/containers/WorkspaceOptionsMenu.js +3 -0
- package/src/containers/WorkspaceSelectionDialog.js +26 -0
- package/src/containers/ZoomControls.js +26 -0
- package/src/containers/index.js +94 -0
- package/src/contexts/FailedImageContext.js +8 -0
- package/src/contexts/FailedImageProvider.jsx +34 -0
- package/src/contexts/FullScreenContext.js +5 -0
- package/src/contexts/LocaleContext.js +5 -0
- package/src/contexts/OpenSeadragonViewerContext.js +5 -0
- package/src/contexts/WorkspaceContext.js +5 -0
- package/src/contexts/index.js +4 -0
- package/src/extend/PluginContext.js +5 -0
- package/src/extend/PluginProvider.jsx +22 -0
- package/src/extend/index.js +9 -0
- package/src/extend/pluginMapping.js +44 -0
- package/src/extend/pluginPreprocessing.js +45 -0
- package/src/extend/pluginValidation.js +58 -0
- package/src/extend/usePlugins.js +13 -0
- package/src/extend/withPlugins.jsx +46 -0
- package/src/hooks/index.js +4 -0
- package/src/hooks/useCanvasWorldService.js +10 -0
- package/src/hooks/useThumbnailService.js +8 -0
- package/src/i18n.js +71 -0
- package/src/index.js +18 -0
- package/src/init.js +20 -0
- package/src/lib/AnnotationFactory.js +23 -0
- package/src/lib/AnnotationItem.js +123 -0
- package/src/lib/AnnotationList.js +31 -0
- package/src/lib/AnnotationPage.js +41 -0
- package/src/lib/AnnotationResource.js +122 -0
- package/src/lib/CanvasAnnotationDisplay.js +148 -0
- package/src/lib/CanvasGroupings.js +55 -0
- package/src/lib/CanvasWorld.js +214 -0
- package/src/lib/CompanionWindowRegistry.js +23 -0
- package/src/lib/FullScreenHandle.jsx +76 -0
- package/src/lib/MiradorCanvas.js +211 -0
- package/src/lib/MiradorManifest.js +44 -0
- package/src/lib/MiradorViewer.jsx +53 -0
- package/src/lib/MosaicLayout.js +77 -0
- package/src/lib/OpenSeadragonCanvasOverlay.js +114 -0
- package/src/lib/ThumbnailFactory.js +310 -0
- package/src/lib/TruncatedHit.js +34 -0
- package/src/lib/asArray.js +11 -0
- package/src/lib/htmlRules.js +28 -0
- package/src/lib/iiif.js +12 -0
- package/src/lib/index.js +23 -0
- package/src/lib/readImageMetadata.js +21 -0
- package/src/lib/svgShapesToPath.js +49 -0
- package/src/locales/README.md +60 -0
- package/src/locales/ar/translation.json +141 -0
- package/src/locales/bg/translation.json +164 -0
- package/src/locales/de/translation.json +169 -0
- package/src/locales/en/translation.json +170 -0
- package/src/locales/et/translation.json +164 -0
- package/src/locales/fa/translation.json +164 -0
- package/src/locales/fr/translation.json +158 -0
- package/src/locales/hr/translation.json +164 -0
- package/src/locales/hu/translation.json +166 -0
- package/src/locales/it/translation.json +162 -0
- package/src/locales/ja/translation.json +156 -0
- package/src/locales/kr/translation.json +162 -0
- package/src/locales/lt/translation.json +153 -0
- package/src/locales/nbNo/translation.json +162 -0
- package/src/locales/nl/translation.json +139 -0
- package/src/locales/pl/translation.json +162 -0
- package/src/locales/ptBr/translation.json +133 -0
- package/src/locales/sr/translation.json +155 -0
- package/src/locales/sv/translation.json +157 -0
- package/src/locales/ta/translation.json +167 -0
- package/src/locales/vi/translation.json +156 -0
- package/src/locales/zhCn/translation.json +163 -0
- package/src/locales/zhTw/translation.json +163 -0
- package/src/plugins/OSDReferences.js +15 -0
- package/src/plugins/index.js +1 -0
- package/src/state/actions/action-types.js +76 -0
- package/src/state/actions/annotation.js +123 -0
- package/src/state/actions/auth.js +109 -0
- package/src/state/actions/canvas.js +65 -0
- package/src/state/actions/catalog.js +22 -0
- package/src/state/actions/companionWindow.js +107 -0
- package/src/state/actions/config.js +49 -0
- package/src/state/actions/elasticLayout.js +10 -0
- package/src/state/actions/errors.js +22 -0
- package/src/state/actions/index.js +19 -0
- package/src/state/actions/infoResponse.js +90 -0
- package/src/state/actions/layers.js +14 -0
- package/src/state/actions/manifest.js +65 -0
- package/src/state/actions/search.js +97 -0
- package/src/state/actions/window.js +209 -0
- package/src/state/actions/workspace.js +84 -0
- package/src/state/createPluggableStore.js +24 -0
- package/src/state/createStore.js +33 -0
- package/src/state/index.js +21 -0
- package/src/state/reducers/accessTokens.js +59 -0
- package/src/state/reducers/annotations.js +48 -0
- package/src/state/reducers/auth.js +43 -0
- package/src/state/reducers/catalog.js +30 -0
- package/src/state/reducers/companionWindows.js +49 -0
- package/src/state/reducers/config.js +39 -0
- package/src/state/reducers/elasticLayout.js +29 -0
- package/src/state/reducers/errors.js +51 -0
- package/src/state/reducers/index.js +15 -0
- package/src/state/reducers/infoResponses.js +61 -0
- package/src/state/reducers/layers.js +23 -0
- package/src/state/reducers/manifests.js +52 -0
- package/src/state/reducers/rootReducer.js +44 -0
- package/src/state/reducers/search.js +145 -0
- package/src/state/reducers/utils.js +45 -0
- package/src/state/reducers/viewers.js +42 -0
- package/src/state/reducers/windows.js +185 -0
- package/src/state/reducers/workspace.js +111 -0
- package/src/state/sagas/annotations.js +48 -0
- package/src/state/sagas/app.js +56 -0
- package/src/state/sagas/auth.js +151 -0
- package/src/state/sagas/iiif.js +233 -0
- package/src/state/sagas/index.js +30 -0
- package/src/state/sagas/windows.js +293 -0
- package/src/state/selectors/annotations.js +138 -0
- package/src/state/selectors/auth.js +100 -0
- package/src/state/selectors/canvases.js +260 -0
- package/src/state/selectors/companionWindows.js +182 -0
- package/src/state/selectors/config.js +100 -0
- package/src/state/selectors/getters.js +90 -0
- package/src/state/selectors/index.js +17 -0
- package/src/state/selectors/layers.js +79 -0
- package/src/state/selectors/manifests.js +433 -0
- package/src/state/selectors/ranges.js +147 -0
- package/src/state/selectors/searches.js +249 -0
- package/src/state/selectors/sequences.js +134 -0
- package/src/state/selectors/thumbnails.js +28 -0
- package/src/state/selectors/utils.js +18 -0
- package/src/state/selectors/viewer.js +19 -0
- package/src/state/selectors/windows.js +98 -0
- package/src/state/selectors/workspace.js +52 -0
- package/src/state/selectors/wrappers.js +15 -0
- package/src/styles/react-mosaic-component.js +288 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { useContext, useCallback } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import Paper from '@mui/material/Paper';
|
|
5
|
+
import { MosaicWindowContext } from 'react-mosaic-component';
|
|
6
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import ns from '../config/css-ns';
|
|
9
|
+
import WindowTopBar from '../containers/WindowTopBar';
|
|
10
|
+
import PrimaryWindow from '../containers/PrimaryWindow';
|
|
11
|
+
import CompanionArea from '../containers/CompanionArea';
|
|
12
|
+
import MinimalWindow from '../containers/MinimalWindow';
|
|
13
|
+
import ErrorContent from '../containers/ErrorContent';
|
|
14
|
+
import IIIFAuthentication from '../containers/IIIFAuthentication';
|
|
15
|
+
import { PluginHook } from './PluginHook';
|
|
16
|
+
|
|
17
|
+
const rowMixin = {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flex: '1',
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
minHeight: 0,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const columnMixin = {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flex: '1',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
minHeight: 0,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const Root = styled(Paper, { name: 'Window', slot: 'root' })(({ ownerState, theme }) => ({
|
|
32
|
+
...columnMixin,
|
|
33
|
+
backgroundColor: theme.palette.shades?.dark,
|
|
34
|
+
borderRadius: 0,
|
|
35
|
+
height: '100%',
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
width: '100%',
|
|
38
|
+
...(ownerState?.maximized && {
|
|
39
|
+
left: 0,
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: 0,
|
|
42
|
+
zIndex: theme.zIndex.modal - 1,
|
|
43
|
+
}),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
const ContentRow = styled('div', { name: 'Window', slot: 'row' })(() => ({
|
|
47
|
+
...rowMixin,
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
const ContentColumn = styled('div', { name: 'Window', slot: 'column' })(() => ({
|
|
51
|
+
...columnMixin,
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
const StyledPrimaryWindow = styled(PrimaryWindow, { name: 'Window', slot: 'primary' })(() => ({
|
|
55
|
+
...rowMixin,
|
|
56
|
+
height: '300px',
|
|
57
|
+
position: 'relative',
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
const StyledCompanionAreaBottom = styled(CompanionArea, { name: 'Window', slot: 'bottom' })(() => ({
|
|
61
|
+
...rowMixin,
|
|
62
|
+
flex: '0',
|
|
63
|
+
flexBasis: 'auto',
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
const StyledCompanionAreaRight = styled('div', { name: 'Window', slot: 'right' })(() => ({
|
|
67
|
+
...rowMixin,
|
|
68
|
+
flex: '0 1 auto',
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
/** Window title bar wrapper for drag controls in the mosaic view */
|
|
72
|
+
const DraggableNavBar = ({ children, ...props }) => {
|
|
73
|
+
const { mosaicWindowActions } = useContext(MosaicWindowContext);
|
|
74
|
+
return mosaicWindowActions.connectDragSource(<nav {...props}>{children}</nav>);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Represents a Window in the mirador workspace
|
|
79
|
+
* @param {object} window
|
|
80
|
+
*/
|
|
81
|
+
export function Window({
|
|
82
|
+
focusWindow = () => {},
|
|
83
|
+
label = null,
|
|
84
|
+
isFetching = false,
|
|
85
|
+
sideBarOpen = false,
|
|
86
|
+
view = undefined,
|
|
87
|
+
windowDraggable = null,
|
|
88
|
+
windowId,
|
|
89
|
+
workspaceType = null,
|
|
90
|
+
manifestError = null,
|
|
91
|
+
}) {
|
|
92
|
+
const { t } = useTranslation();
|
|
93
|
+
// eslint-disable-next-line prefer-rest-params
|
|
94
|
+
const ownerState = arguments[0];
|
|
95
|
+
const ErrorWindow = useCallback(
|
|
96
|
+
({ error }) => (
|
|
97
|
+
<MinimalWindow windowId={windowId}>
|
|
98
|
+
<ErrorContent error={error} windowId={windowId} />
|
|
99
|
+
</MinimalWindow>
|
|
100
|
+
),
|
|
101
|
+
[windowId],
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<ErrorBoundary FallbackComponent={ErrorWindow}>
|
|
106
|
+
<Root
|
|
107
|
+
onFocus={focusWindow}
|
|
108
|
+
ownerState={ownerState}
|
|
109
|
+
component="section"
|
|
110
|
+
elevation={1}
|
|
111
|
+
id={windowId}
|
|
112
|
+
className={ns('window')}
|
|
113
|
+
aria-label={t('window', { label })}
|
|
114
|
+
>
|
|
115
|
+
<WindowTopBar
|
|
116
|
+
component={workspaceType === 'mosaic' && windowDraggable ? DraggableNavBar : undefined}
|
|
117
|
+
windowId={windowId}
|
|
118
|
+
windowDraggable={windowDraggable}
|
|
119
|
+
/>
|
|
120
|
+
<IIIFAuthentication windowId={windowId} />
|
|
121
|
+
{manifestError && <ErrorContent error={{ stack: manifestError }} windowId={windowId} />}
|
|
122
|
+
<ContentRow>
|
|
123
|
+
<ContentColumn>
|
|
124
|
+
<StyledPrimaryWindow view={view} windowId={windowId} isFetching={isFetching} sideBarOpen={sideBarOpen} />
|
|
125
|
+
<StyledCompanionAreaBottom windowId={windowId} position="bottom" />
|
|
126
|
+
</ContentColumn>
|
|
127
|
+
<StyledCompanionAreaRight>
|
|
128
|
+
<CompanionArea windowId={windowId} position="right" />
|
|
129
|
+
<CompanionArea windowId={windowId} position="far-right" />
|
|
130
|
+
</StyledCompanionAreaRight>
|
|
131
|
+
</ContentRow>
|
|
132
|
+
<CompanionArea windowId={windowId} position="far-bottom" />
|
|
133
|
+
<PluginHook targetName="Window" {...ownerState} />
|
|
134
|
+
</Root>
|
|
135
|
+
</ErrorBoundary>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
Window.propTypes = {
|
|
140
|
+
focusWindow: PropTypes.func,
|
|
141
|
+
isFetching: PropTypes.bool,
|
|
142
|
+
label: PropTypes.string,
|
|
143
|
+
manifestError: PropTypes.string,
|
|
144
|
+
maximized: PropTypes.bool,
|
|
145
|
+
sideBarOpen: PropTypes.bool,
|
|
146
|
+
view: PropTypes.string,
|
|
147
|
+
windowDraggable: PropTypes.bool,
|
|
148
|
+
windowId: PropTypes.string.isRequired,
|
|
149
|
+
workspaceType: PropTypes.string,
|
|
150
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import Paper from '@mui/material/Paper';
|
|
6
|
+
import Collapse from '@mui/material/Collapse';
|
|
7
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
8
|
+
import Typography from '@mui/material/Typography';
|
|
9
|
+
import LockIcon from '@mui/icons-material/LockSharp';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import SanitizedHtml from '../containers/SanitizedHtml';
|
|
12
|
+
import { PluginHook } from './PluginHook';
|
|
13
|
+
|
|
14
|
+
const StyledTopBar = styled('div')(({ theme }) => ({
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
backgroundColor: theme.palette.secondary.main,
|
|
17
|
+
color: theme.palette.secondary.contrastText,
|
|
18
|
+
display: 'flex',
|
|
19
|
+
padding: theme.spacing(1),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
const StyledFauxButton = styled('span')(({ theme }) => ({
|
|
23
|
+
marginLeft: theme.spacing(2.5),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
/** */
|
|
27
|
+
export function WindowAuthenticationBar({
|
|
28
|
+
confirmButton = undefined,
|
|
29
|
+
continueLabel = undefined,
|
|
30
|
+
header = undefined,
|
|
31
|
+
description = undefined,
|
|
32
|
+
icon = undefined,
|
|
33
|
+
label,
|
|
34
|
+
ruleSet = 'iiif',
|
|
35
|
+
hasLogoutService = true,
|
|
36
|
+
status = undefined,
|
|
37
|
+
ConfirmProps = {},
|
|
38
|
+
onConfirm,
|
|
39
|
+
}) {
|
|
40
|
+
const { t } = useTranslation();
|
|
41
|
+
// eslint-disable-next-line prefer-rest-params
|
|
42
|
+
const pluginProps = arguments[0];
|
|
43
|
+
const [open, setOpen] = useState(false);
|
|
44
|
+
|
|
45
|
+
/** */
|
|
46
|
+
const onSubmit = () => {
|
|
47
|
+
setOpen(false);
|
|
48
|
+
onConfirm();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (status === 'ok' && !hasLogoutService) return null;
|
|
52
|
+
|
|
53
|
+
const button = (
|
|
54
|
+
<Button
|
|
55
|
+
onClick={onSubmit}
|
|
56
|
+
color="secondary"
|
|
57
|
+
sx={(theme) => ({
|
|
58
|
+
backgroundColor: theme.palette.secondary.contrastText,
|
|
59
|
+
lineHeight: '1.5rem',
|
|
60
|
+
})}
|
|
61
|
+
{...ConfirmProps}
|
|
62
|
+
>
|
|
63
|
+
{confirmButton || t('login')}
|
|
64
|
+
</Button>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
if (!description && !header) {
|
|
68
|
+
return (
|
|
69
|
+
<Paper square elevation={4} color="secondary">
|
|
70
|
+
<StyledTopBar>
|
|
71
|
+
{icon || <LockIcon sx={{ marginInlineEnd: 5 }} />}
|
|
72
|
+
<Typography
|
|
73
|
+
component="h3"
|
|
74
|
+
variant="body1"
|
|
75
|
+
sx={{
|
|
76
|
+
color: 'inherit',
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
{ruleSet ? <SanitizedHtml htmlString={label} ruleSet={ruleSet} /> : label}
|
|
80
|
+
</Typography>
|
|
81
|
+
<PluginHook targetName="WindowAuthenticationBar" {...pluginProps} />
|
|
82
|
+
{button}
|
|
83
|
+
</StyledTopBar>
|
|
84
|
+
</Paper>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Paper square elevation={4} color="secondary">
|
|
90
|
+
<Button
|
|
91
|
+
fullWidth
|
|
92
|
+
onClick={() => setOpen(true)}
|
|
93
|
+
component="div"
|
|
94
|
+
color="inherit"
|
|
95
|
+
sx={(theme) => ({
|
|
96
|
+
'&:hover': {
|
|
97
|
+
backgroundColor: theme.palette.secondary.main,
|
|
98
|
+
},
|
|
99
|
+
backgroundColor: theme.palette.secondary.main,
|
|
100
|
+
borderRadius: 0,
|
|
101
|
+
color: theme.palette.secondary.contrastText,
|
|
102
|
+
justifyContent: 'start',
|
|
103
|
+
textTransform: 'none',
|
|
104
|
+
})}
|
|
105
|
+
>
|
|
106
|
+
{icon || <LockIcon sx={{ marginInlineEnd: 1.5 }} />}
|
|
107
|
+
<Typography
|
|
108
|
+
component="h3"
|
|
109
|
+
variant="body1"
|
|
110
|
+
sx={{
|
|
111
|
+
color: 'inherit',
|
|
112
|
+
paddingBlockEnd: 1,
|
|
113
|
+
paddingBlockStart: 1,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{ruleSet ? <SanitizedHtml htmlString={label} ruleSet={ruleSet} /> : label}
|
|
117
|
+
</Typography>
|
|
118
|
+
<PluginHook targetName="WindowAuthenticationBar" {...pluginProps} />
|
|
119
|
+
<StyledFauxButton>
|
|
120
|
+
{!open && (
|
|
121
|
+
<Typography
|
|
122
|
+
variant="button"
|
|
123
|
+
sx={{
|
|
124
|
+
color: 'inherit',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
{continueLabel || t('continue')}
|
|
128
|
+
</Typography>
|
|
129
|
+
)}
|
|
130
|
+
</StyledFauxButton>
|
|
131
|
+
</Button>
|
|
132
|
+
<Collapse
|
|
133
|
+
sx={(theme) => ({
|
|
134
|
+
backgroundColor: theme.palette.secondary.main,
|
|
135
|
+
color: theme.palette.secondary.contrastText,
|
|
136
|
+
paddingInlineEnd: theme.spacing(1),
|
|
137
|
+
paddingInlineStart: theme.spacing(1),
|
|
138
|
+
})}
|
|
139
|
+
in={open}
|
|
140
|
+
onClose={() => setOpen(false)}
|
|
141
|
+
>
|
|
142
|
+
<Typography
|
|
143
|
+
variant="body1"
|
|
144
|
+
sx={{
|
|
145
|
+
color: 'inherit',
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
{ruleSet ? <SanitizedHtml htmlString={header} ruleSet={ruleSet} /> : header}
|
|
149
|
+
{header && description ? ': ' : ''}
|
|
150
|
+
{ruleSet ? <SanitizedHtml htmlString={description} ruleSet={ruleSet} /> : description}
|
|
151
|
+
</Typography>
|
|
152
|
+
<DialogActions>
|
|
153
|
+
<Button onClick={() => setOpen(false)} color="inherit">
|
|
154
|
+
{t('cancel')}
|
|
155
|
+
</Button>
|
|
156
|
+
|
|
157
|
+
{button}
|
|
158
|
+
</DialogActions>
|
|
159
|
+
</Collapse>
|
|
160
|
+
</Paper>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
WindowAuthenticationBar.propTypes = {
|
|
165
|
+
confirmButton: PropTypes.string,
|
|
166
|
+
ConfirmProps: PropTypes.object,
|
|
167
|
+
continueLabel: PropTypes.string,
|
|
168
|
+
description: PropTypes.node,
|
|
169
|
+
hasLogoutService: PropTypes.bool,
|
|
170
|
+
header: PropTypes.node,
|
|
171
|
+
icon: PropTypes.node,
|
|
172
|
+
label: PropTypes.node.isRequired,
|
|
173
|
+
onConfirm: PropTypes.func.isRequired,
|
|
174
|
+
ruleSet: PropTypes.string,
|
|
175
|
+
status: PropTypes.string,
|
|
176
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import Paper from '@mui/material/Paper';
|
|
6
|
+
import Stack from '@mui/material/Stack';
|
|
7
|
+
import Divider from '@mui/material/Divider';
|
|
8
|
+
import Typography from '@mui/material/Typography';
|
|
9
|
+
import { visuallyHidden } from '@mui/utils';
|
|
10
|
+
import { useElementSize } from '@custom-react-hooks/use-element-size';
|
|
11
|
+
import mergeRefs from 'merge-refs';
|
|
12
|
+
import ZoomControls from '../containers/ZoomControls';
|
|
13
|
+
import ViewerInfo from '../containers/ViewerInfo';
|
|
14
|
+
import ViewerNavigation from '../containers/ViewerNavigation';
|
|
15
|
+
import ns from '../config/css-ns';
|
|
16
|
+
import { PluginHook } from './PluginHook';
|
|
17
|
+
|
|
18
|
+
const Root = styled(Paper, { name: 'WindowCanvasNavigationControls', slot: 'root' })(({ theme }) => ({
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
backgroundColor: alpha(theme.palette.background.paper, 0.5),
|
|
21
|
+
bottom: 0,
|
|
22
|
+
cursor: 'default',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
flexWrap: 'wrap',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
textAlign: 'center',
|
|
29
|
+
width: '100%',
|
|
30
|
+
zIndex: 50,
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the viewer controls in the mirador workspace.
|
|
35
|
+
*/
|
|
36
|
+
export const WindowCanvasNavigationControls = forwardRef(
|
|
37
|
+
({ showZoomControls = false, visible = true, windowId, zoomToWorld, ...rest }, ref) => {
|
|
38
|
+
const [sizeRef, size] = useElementSize();
|
|
39
|
+
|
|
40
|
+
const pluginProps = {
|
|
41
|
+
showZoomControls,
|
|
42
|
+
size,
|
|
43
|
+
visible,
|
|
44
|
+
windowId,
|
|
45
|
+
...rest,
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Determine if canvasNavControls are stacked (based on a hard-coded width)
|
|
49
|
+
*/
|
|
50
|
+
const canvasNavControlsAreStacked = size && size.width && size.width <= 253;
|
|
51
|
+
|
|
52
|
+
if (!visible)
|
|
53
|
+
return (
|
|
54
|
+
<Typography style={visuallyHidden} component="div">
|
|
55
|
+
<ViewerInfo windowId={windowId} />
|
|
56
|
+
</Typography>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Root
|
|
61
|
+
square
|
|
62
|
+
className={classNames(ns('canvas-nav'), canvasNavControlsAreStacked ? ns('canvas-nav-stacked') : null)}
|
|
63
|
+
elevation={0}
|
|
64
|
+
ref={mergeRefs(ref, sizeRef)}
|
|
65
|
+
>
|
|
66
|
+
<Stack
|
|
67
|
+
direction={canvasNavControlsAreStacked ? 'column' : 'row'}
|
|
68
|
+
divider={<Divider orientation={canvasNavControlsAreStacked ? 'horizontal' : 'vertical'} variant="middle" flexItem />}
|
|
69
|
+
spacing={0}
|
|
70
|
+
>
|
|
71
|
+
<ViewerNavigation windowId={windowId} />
|
|
72
|
+
{showZoomControls && <ZoomControls windowId={windowId} zoomToWorld={zoomToWorld} />}
|
|
73
|
+
</Stack>
|
|
74
|
+
<ViewerInfo windowId={windowId} />
|
|
75
|
+
|
|
76
|
+
<PluginHook targetName="WindowCanvasNavigationControls" {...pluginProps} />
|
|
77
|
+
</Root>
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
WindowCanvasNavigationControls.propTypes = {
|
|
83
|
+
// eslint-disable-next-line react/require-default-props -- this rule doesn't detect default args through forwardRef's inner callback (see the default arg on line 37); https://github.com/jsx-eslint/eslint-plugin-react/issues/2856
|
|
84
|
+
showZoomControls: PropTypes.bool,
|
|
85
|
+
// eslint-disable-next-line react/require-default-props -- same forwardRef detection gap as above
|
|
86
|
+
visible: PropTypes.bool,
|
|
87
|
+
windowId: PropTypes.string.isRequired,
|
|
88
|
+
zoomToWorld: PropTypes.func.isRequired,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
WindowCanvasNavigationControls.displayName = 'WindowCanvasNavigationControls';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import Menu from '@mui/material/Menu';
|
|
3
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
4
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
5
|
+
import ListSubheader from '@mui/material/ListSubheader';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import WorkspaceContext from '../contexts/WorkspaceContext';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*/
|
|
12
|
+
export function WindowList({
|
|
13
|
+
handleClose,
|
|
14
|
+
windowIds,
|
|
15
|
+
focusWindow,
|
|
16
|
+
focusedWindowId = null,
|
|
17
|
+
titles = {},
|
|
18
|
+
tReady = false,
|
|
19
|
+
...menuProps
|
|
20
|
+
}) {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const container = useContext(WorkspaceContext);
|
|
23
|
+
return (
|
|
24
|
+
<Menu
|
|
25
|
+
anchorOrigin={{
|
|
26
|
+
horizontal: 'right',
|
|
27
|
+
vertical: 'top',
|
|
28
|
+
}}
|
|
29
|
+
transformOrigin={{
|
|
30
|
+
horizontal: 'left',
|
|
31
|
+
vertical: 'top',
|
|
32
|
+
}}
|
|
33
|
+
id="window-list-menu"
|
|
34
|
+
container={container?.current}
|
|
35
|
+
onClose={handleClose}
|
|
36
|
+
{...menuProps}
|
|
37
|
+
>
|
|
38
|
+
<ListSubheader role="presentation" selected={false} disabled tabIndex="-1">
|
|
39
|
+
{t('openWindows')}
|
|
40
|
+
</ListSubheader>
|
|
41
|
+
{windowIds.map((windowId, i) => (
|
|
42
|
+
<MenuItem
|
|
43
|
+
key={windowId}
|
|
44
|
+
selected={windowId === focusedWindowId}
|
|
45
|
+
onClick={(e) => {
|
|
46
|
+
focusWindow(windowId, true);
|
|
47
|
+
handleClose(e);
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<ListItemText
|
|
51
|
+
slotProps={{
|
|
52
|
+
primary: { variant: 'body1' },
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{titles[windowId] || t('untitled')}
|
|
56
|
+
</ListItemText>
|
|
57
|
+
</MenuItem>
|
|
58
|
+
))}
|
|
59
|
+
</Menu>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
WindowList.propTypes = {
|
|
64
|
+
container: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
|
65
|
+
focusedWindowId: PropTypes.string,
|
|
66
|
+
focusWindow: PropTypes.func.isRequired,
|
|
67
|
+
handleClose: PropTypes.func.isRequired,
|
|
68
|
+
titles: PropTypes.objectOf(PropTypes.string),
|
|
69
|
+
tReady: PropTypes.bool,
|
|
70
|
+
windowIds: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
71
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useId, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import BookmarksIcon from '@mui/icons-material/BookmarksSharp';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import WindowList from '../containers/WindowList';
|
|
6
|
+
import MiradorMenuButton from '../containers/MiradorMenuButton';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* WindowListButton ~
|
|
10
|
+
*/
|
|
11
|
+
export function WindowListButton({ disabled = false, windowCount }) {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const [windowListAnchor, setWindowListAnchor] = useState(null);
|
|
14
|
+
const id = useId();
|
|
15
|
+
|
|
16
|
+
/** */
|
|
17
|
+
const handleClose = () => {
|
|
18
|
+
setWindowListAnchor(null);
|
|
19
|
+
};
|
|
20
|
+
/** */
|
|
21
|
+
const handleOpen = (event) => {
|
|
22
|
+
setWindowListAnchor(event.currentTarget);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<MiradorMenuButton
|
|
28
|
+
aria-haspopup="true"
|
|
29
|
+
aria-label={t('listAllOpenWindows')}
|
|
30
|
+
aria-owns={windowListAnchor ? id : null}
|
|
31
|
+
selected={Boolean(windowListAnchor)}
|
|
32
|
+
disabled={disabled}
|
|
33
|
+
badge
|
|
34
|
+
BadgeProps={{
|
|
35
|
+
badgeContent: windowCount,
|
|
36
|
+
sx: {
|
|
37
|
+
'.MuiBadge-badge': {
|
|
38
|
+
paddingLeft: 1.5,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}}
|
|
42
|
+
onClick={(e) => handleOpen(e)}
|
|
43
|
+
>
|
|
44
|
+
<BookmarksIcon />
|
|
45
|
+
</MiradorMenuButton>
|
|
46
|
+
|
|
47
|
+
{Boolean(windowListAnchor) && (
|
|
48
|
+
<WindowList anchorEl={windowListAnchor} id={id} open={Boolean(windowListAnchor)} handleClose={handleClose} />
|
|
49
|
+
)}
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
WindowListButton.propTypes = {
|
|
55
|
+
disabled: PropTypes.bool,
|
|
56
|
+
windowCount: PropTypes.number.isRequired,
|
|
57
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import Drawer from '@mui/material/Drawer';
|
|
4
|
+
import Paper from '@mui/material/Paper';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import WindowSideBarButtons from '../containers/WindowSideBarButtons';
|
|
7
|
+
|
|
8
|
+
const Root = styled(Drawer, { name: 'WindowSideBar', slot: 'root' })(({ theme }) => ({
|
|
9
|
+
flexShrink: 0,
|
|
10
|
+
order: -1000,
|
|
11
|
+
zIndex: theme.zIndex.appBar - 1,
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WindowSideBar
|
|
16
|
+
*/
|
|
17
|
+
export function WindowSideBar({ classes = {}, direction, windowId, sideBarOpen = false }) {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
return (
|
|
20
|
+
<Drawer
|
|
21
|
+
sx={{ flexShrink: 0, order: -1000, zIndex: (theme) => theme.zIndex.appBar - 1 }}
|
|
22
|
+
variant="persistent"
|
|
23
|
+
className={classes.drawer}
|
|
24
|
+
anchor={direction === 'rtl' ? 'right' : 'left'}
|
|
25
|
+
slotProps={{
|
|
26
|
+
paper: {
|
|
27
|
+
component: 'nav',
|
|
28
|
+
sx: { width: sideBarOpen ? 48 : 0, position: 'relative' },
|
|
29
|
+
},
|
|
30
|
+
transition: {
|
|
31
|
+
direction: direction === 'rtl' ? 'left' : 'right',
|
|
32
|
+
mountOnEnter: true,
|
|
33
|
+
unmountOnExit: true,
|
|
34
|
+
},
|
|
35
|
+
}}
|
|
36
|
+
open={sideBarOpen}
|
|
37
|
+
>
|
|
38
|
+
<WindowSideBarButtons windowId={windowId} />
|
|
39
|
+
</Drawer>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
WindowSideBar.propTypes = {
|
|
44
|
+
classes: PropTypes.objectOf(PropTypes.string),
|
|
45
|
+
direction: PropTypes.string.isRequired,
|
|
46
|
+
sideBarOpen: PropTypes.bool,
|
|
47
|
+
windowId: PropTypes.string.isRequired,
|
|
48
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import AnnotationSettings from '../containers/AnnotationSettings';
|
|
6
|
+
import CanvasAnnotations from '../containers/CanvasAnnotations';
|
|
7
|
+
import CompanionWindow from '../containers/CompanionWindow';
|
|
8
|
+
import { CompanionWindowSection } from './CompanionWindowSection';
|
|
9
|
+
import ns from '../config/css-ns';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* WindowSideBarAnnotationsPanel ~
|
|
13
|
+
*/
|
|
14
|
+
export function WindowSideBarAnnotationsPanel({ annotationCount, canvasIds = [], windowId, id }) {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const containerRef = createRef();
|
|
17
|
+
return (
|
|
18
|
+
<CompanionWindow
|
|
19
|
+
title={t('annotations')}
|
|
20
|
+
paperClassName={ns('window-sidebar-annotation-panel')}
|
|
21
|
+
windowId={windowId}
|
|
22
|
+
id={id}
|
|
23
|
+
ref={containerRef}
|
|
24
|
+
titleControls={<AnnotationSettings windowId={windowId} />}
|
|
25
|
+
>
|
|
26
|
+
<CompanionWindowSection>
|
|
27
|
+
<Typography component="p" variant="subtitle2">
|
|
28
|
+
{t('showingNumAnnotations', { count: annotationCount, number: annotationCount })}
|
|
29
|
+
</Typography>
|
|
30
|
+
</CompanionWindowSection>
|
|
31
|
+
|
|
32
|
+
{canvasIds.map((canvasId, index) => (
|
|
33
|
+
<CanvasAnnotations
|
|
34
|
+
canvasId={canvasId}
|
|
35
|
+
containerRef={containerRef}
|
|
36
|
+
key={canvasId}
|
|
37
|
+
index={index}
|
|
38
|
+
totalSize={canvasIds.length}
|
|
39
|
+
windowId={windowId}
|
|
40
|
+
/>
|
|
41
|
+
))}
|
|
42
|
+
</CompanionWindow>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
WindowSideBarAnnotationsPanel.propTypes = {
|
|
47
|
+
annotationCount: PropTypes.number.isRequired,
|
|
48
|
+
canvasIds: PropTypes.arrayOf(PropTypes.string),
|
|
49
|
+
id: PropTypes.string.isRequired,
|
|
50
|
+
windowId: PropTypes.string.isRequired,
|
|
51
|
+
};
|