@cu-mkp/editioncrafter 0.1.0 → 0.2.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 (31) hide show
  1. package/dist/editioncrafter.min.js +1 -1
  2. package/dist/es/src/action/DocumentActions.js +11 -0
  3. package/dist/es/src/action/initialState/documentInitialState.js +6 -0
  4. package/dist/es/src/action/rootReducer.js +21 -4
  5. package/dist/es/src/component/DiploMatic.js +38 -7
  6. package/dist/es/src/component/DocumentView.js +101 -32
  7. package/dist/es/src/component/ImageGridView.js +96 -20
  8. package/dist/es/src/component/ImageView.js +30 -5
  9. package/dist/es/src/component/Navigation.js +109 -11
  10. package/dist/es/src/component/RingSpinner.js +40 -0
  11. package/dist/es/src/component/SeaDragonComponent.js +40 -6
  12. package/dist/es/src/component/SinglePaneView.js +8 -8
  13. package/dist/es/src/component/SplitPaneView.js +53 -25
  14. package/dist/es/src/component/TranscriptionView.js +38 -11
  15. package/dist/es/src/component/Watermark.js +1 -1
  16. package/dist/es/src/component/XMLView.js +2 -1
  17. package/dist/es/src/img/editioncrafterlogo.png +0 -0
  18. package/dist/es/src/index.js +2 -2
  19. package/dist/es/src/model/ReduxStore.js +1 -0
  20. package/dist/es/src/saga/RouteListenerSaga.js +82 -33
  21. package/dist/es/src/scss/_CETEIcean.scss +1 -1
  22. package/dist/es/src/scss/_diplomatic.scss +12 -9
  23. package/dist/es/src/scss/_glossary.scss +5 -0
  24. package/dist/es/src/scss/_imageGridView.scss +10 -0
  25. package/dist/es/src/scss/_imageView.scss +2 -1
  26. package/dist/es/src/scss/_navigation.scss +57 -6
  27. package/dist/es/src/scss/_ringSpinner.scss +88 -0
  28. package/dist/es/src/scss/_splitPaneView.scss +15 -1
  29. package/dist/es/src/scss/_watermark.scss +5 -1
  30. package/dist/es/src/scss/editioncrafter.scss +8 -6
  31. package/package.json +1 -1
@@ -148,6 +148,16 @@ function parseAnnotationURLs(canvas, transcriptionTypes) {
148
148
  // The largest dimension for either width or height allowed in a thumbnail.
149
149
  var MAX_THUMBNAIL_DIMENSION = 130;
150
150
  function parseManifest(manifest, transcriptionTypes) {
151
+ if (manifest.type === 'variorum') {
152
+ var folios = [];
153
+ Object.keys(manifest.documentData).forEach(function (key) {
154
+ folios = folios.concat(parseSingleManifest(manifest.documentData[key], transcriptionTypes[key], key));
155
+ });
156
+ return folios;
157
+ }
158
+ return parseSingleManifest(manifest, transcriptionTypes);
159
+ }
160
+ function parseSingleManifest(manifest, transcriptionTypes, document) {
151
161
  var folios = [];
152
162
 
153
163
  // make sure this is a IIIF Presentation API v3 Manifest
@@ -177,6 +187,7 @@ function parseManifest(manifest, transcriptionTypes) {
177
187
  var thumbnailURL = "".concat(bodyId, "/full/").concat(thumbnailDimensions.join(','), "/0/default.jpg");
178
188
  var folio = {
179
189
  id: folioID,
190
+ doc_id: document || manifest.id,
180
191
  name: canvasLabel,
181
192
  pageNumber: i,
182
193
  image_zoom_url: imageURL,
@@ -1,8 +1,14 @@
1
1
  export default function documentInitalState(iiifManifest, documentName, transcriptionTypes) {
2
+ var variorum = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
3
+ var derivativeNames = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
4
+ var threePanel = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
2
5
  return {
3
6
  documentName: documentName,
7
+ derivativeNames: derivativeNames,
4
8
  manifestURL: iiifManifest,
5
9
  transcriptionTypes: transcriptionTypes,
10
+ variorum: variorum,
11
+ threePanel: threePanel,
6
12
  folios: [],
7
13
  loaded: false,
8
14
  folioIndex: {},
@@ -1,4 +1,6 @@
1
1
  import { combineReducers } from 'redux';
2
+
3
+ // eslint-disable-next-line import/no-cycle
2
4
  import { createReducer } from '../model/ReduxStore';
3
5
  import GlossaryActions from './GlossaryActions';
4
6
  import DocumentActions from './DocumentActions';
@@ -7,12 +9,27 @@ import diplomaticInitialState from './initialState/diplomaticInitialState';
7
9
  import glossaryInitialState from './initialState/glossaryInitialState';
8
10
  import documentInitialState from './initialState/documentInitialState';
9
11
  export default function rootReducer(config) {
10
- var iiifManifest = config.iiifManifest,
11
- documentName = config.documentName,
12
- transcriptionTypes = config.transcriptionTypes;
12
+ var documentName = config.documentName,
13
+ documentInfo = config.documentInfo,
14
+ _config$threePanel = config.threePanel,
15
+ threePanel = _config$threePanel === void 0 ? false : _config$threePanel;
16
+ var variorum = documentInfo && Object.keys(documentInfo).length > 1;
17
+ var transcriptionTypesInfo = {};
18
+ var manifestInfo = {};
19
+ var derivativesInfo = {};
20
+ if (variorum) {
21
+ Object.keys(config.documentInfo).forEach(function (key) {
22
+ transcriptionTypesInfo[key] = config.documentInfo[key].transcriptionTypes;
23
+ manifestInfo[key] = config.documentInfo[key].iiifManifest;
24
+ derivativesInfo[key] = config.documentInfo[key].documentName;
25
+ });
26
+ }
27
+ var transcriptionTypes = variorum ? transcriptionTypesInfo : config.transcriptionTypes;
28
+ var iiifManifest = variorum ? manifestInfo : config.iiifManifest;
29
+ var derivativeNames = variorum && derivativesInfo;
13
30
  return combineReducers({
14
31
  diplomatic: createReducer('DiplomaticActions', DiplomaticActions, diplomaticInitialState),
15
- document: createReducer('DocumentActions', DocumentActions, documentInitialState(iiifManifest, documentName, transcriptionTypes)),
32
+ document: createReducer('DocumentActions', DocumentActions, documentInitialState(iiifManifest, documentName, transcriptionTypes, variorum, derivativeNames, threePanel)),
16
33
  glossary: createReducer('GlossaryActions', GlossaryActions, glossaryInitialState())
17
34
  });
18
35
  }
@@ -1,41 +1,72 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
7
  import withWidth from '@material-ui/core/withWidth';
2
8
  import { createBrowserHistory } from 'history';
3
- import React, { useEffect } from 'react';
9
+ import React, { useEffect, useRef, useState } from 'react';
4
10
  import { connect, Provider } from 'react-redux';
5
11
  import { HashRouter, Route, Navigate, Routes } from 'react-router-dom';
6
12
  import DocumentView from './DocumentView';
7
13
  import RouteListener from './RouteListener';
8
14
  var DiploMatic = function DiploMatic(props) {
15
+ var _useState = useState(0),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ containerWidth = _useState2[0],
18
+ setContainerWidth = _useState2[1];
19
+ var containerRef = useRef(null);
9
20
  useEffect(function () {
10
21
  var history = createBrowserHistory();
11
22
  history.listen(function () {
12
23
  window.scrollTo(0, 0);
13
24
  });
14
- });
25
+ }, []);
26
+ useEffect(function () {
27
+ if (containerRef.current) {
28
+ setContainerWidth(containerRef.current.offsetWidth);
29
+ }
30
+ }, [containerRef]);
15
31
  var fixedFrameMode = props.diplomatic.fixedFrameMode;
16
32
  var fixedFrameModeClass = fixedFrameMode ? 'fixed' : 'sticky';
17
33
  return /*#__PURE__*/React.createElement(Provider, {
18
34
  store: props.store
19
35
  }, /*#__PURE__*/React.createElement(HashRouter, null, /*#__PURE__*/React.createElement("div", {
20
36
  id: "diplomatic",
21
- className: fixedFrameModeClass
37
+ className: fixedFrameModeClass,
38
+ ref: containerRef
22
39
  }, /*#__PURE__*/React.createElement(RouteListener, null), /*#__PURE__*/React.createElement("div", {
23
40
  id: "content"
24
41
  }, /*#__PURE__*/React.createElement(Routes, null, /*#__PURE__*/React.createElement(Route, {
42
+ path: "/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3",
43
+ element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
44
+ containerWidth: containerWidth
45
+ })),
46
+ exact: true
47
+ }), /*#__PURE__*/React.createElement(Route, {
25
48
  path: "/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2",
26
- element: /*#__PURE__*/React.createElement(DocumentView, props),
49
+ element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
50
+ containerWidth: containerWidth
51
+ })),
27
52
  exact: true
28
53
  }), /*#__PURE__*/React.createElement(Route, {
29
54
  path: "/ec/:folioID/:transcriptionType",
30
- element: /*#__PURE__*/React.createElement(DocumentView, props),
55
+ element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
56
+ containerWidth: containerWidth
57
+ })),
31
58
  exact: true
32
59
  }), /*#__PURE__*/React.createElement(Route, {
33
60
  path: "/ec/:folioID",
34
- element: /*#__PURE__*/React.createElement(DocumentView, props),
61
+ element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
62
+ containerWidth: containerWidth
63
+ })),
35
64
  exact: true
36
65
  }), /*#__PURE__*/React.createElement(Route, {
37
66
  path: "/ec",
38
- element: /*#__PURE__*/React.createElement(DocumentView, props),
67
+ element: /*#__PURE__*/React.createElement(DocumentView, Object.assign({}, props, {
68
+ containerWidth: containerWidth
69
+ })),
39
70
  exact: true
40
71
  }), /*#__PURE__*/React.createElement(Route, {
41
72
  path: "/",
@@ -26,7 +26,7 @@ var paneDefaults = {
26
26
  width: 0
27
27
  };
28
28
  var DocumentView = function DocumentView(props) {
29
- var _useState = useState(true),
29
+ var _useState = useState(!props.document.variorum),
30
30
  _useState2 = _slicedToArray(_useState, 2),
31
31
  linkedMode = _useState2[0],
32
32
  setLinkedMode = _useState2[1];
@@ -42,9 +42,20 @@ var DocumentView = function DocumentView(props) {
42
42
  _useState8 = _slicedToArray(_useState7, 2),
43
43
  right = _useState8[0],
44
44
  setRight = _useState8[1];
45
+ var _useState9 = useState(paneDefaults),
46
+ _useState10 = _slicedToArray(_useState9, 2),
47
+ third = _useState10[0],
48
+ setThird = _useState10[1];
49
+ var _useState11 = useState(props.containerWidth < 960),
50
+ _useState12 = _slicedToArray(_useState11, 2),
51
+ singlePaneMode = _useState12[0],
52
+ setSinglePaneMode = _useState12[1];
45
53
  var params = useParams();
46
54
  var navigate = useNavigate();
47
55
  var location = useLocation();
56
+ useEffect(function () {
57
+ setSinglePaneMode(props.containerWidth < 960);
58
+ }, [props.containerWidth]);
48
59
 
49
60
  // Navigate while keeping existing search params
50
61
  var navigateWithParams = function navigateWithParams(pathname) {
@@ -54,9 +65,11 @@ var DocumentView = function DocumentView(props) {
54
65
  var folioID = params.folioID,
55
66
  transcriptionType = params.transcriptionType,
56
67
  folioID2 = params.folioID2,
57
- transcriptionType2 = params.transcriptionType2;
68
+ transcriptionType2 = params.transcriptionType2,
69
+ folioID3 = params.folioID3,
70
+ transcriptionType3 = params.transcriptionType3;
58
71
  var document = props.document;
59
- var firstTranscriptionType = Object.keys(document.transcriptionTypes)[0];
72
+ var firstTranscriptionType = document.variorum ? Object.keys(document.transcriptionTypes[Object.keys(document.transcriptionTypes)[0]])[0] : Object.keys(document.transcriptionTypes)[0];
60
73
  if (!folioID) {
61
74
  // route /folios
62
75
  return {
@@ -66,7 +79,11 @@ var DocumentView = function DocumentView(props) {
66
79
  },
67
80
  right: {
68
81
  folioID: '-1',
69
- transcriptionType: firstTranscriptionType
82
+ transcriptionType: document.variorum ? 'g' : firstTranscriptionType
83
+ },
84
+ third: {
85
+ folioID: '-1',
86
+ transcriptionType: 'g'
70
87
  }
71
88
  };
72
89
  }
@@ -74,17 +91,29 @@ var DocumentView = function DocumentView(props) {
74
91
  var leftTranscriptionType;
75
92
  var rightFolioID;
76
93
  var rightTranscriptionType;
94
+ var thirdFolioID;
95
+ var thirdTranscriptionType;
77
96
  if (folioID2) {
78
97
  // route /ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2
79
98
  leftTranscriptionType = transcriptionType;
80
99
  rightFolioID = folioID2;
81
100
  rightTranscriptionType = transcriptionType2 || firstTranscriptionType;
101
+ if (folioID3) {
102
+ // route /ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3
103
+ thirdFolioID = folioID3;
104
+ thirdTranscriptionType = transcriptionType3 || firstTranscriptionType;
105
+ } else {
106
+ thirdFolioID = '-1';
107
+ thirdTranscriptionType = 'g';
108
+ }
82
109
  } else {
83
110
  // route /ec/:folioID
84
111
  // route /ec/:folioID/:transcriptionType
85
112
  leftTranscriptionType = 'f';
86
113
  rightFolioID = folioID;
87
114
  rightTranscriptionType = transcriptionType || firstTranscriptionType;
115
+ thirdFolioID = '-1';
116
+ thirdTranscriptionType = 'g';
88
117
  }
89
118
  return {
90
119
  left: {
@@ -94,6 +123,10 @@ var DocumentView = function DocumentView(props) {
94
123
  right: {
95
124
  folioID: rightFolioID,
96
125
  transcriptionType: rightTranscriptionType
126
+ },
127
+ third: {
128
+ folioID: thirdFolioID,
129
+ transcriptionType: thirdTranscriptionType
97
130
  }
98
131
  };
99
132
  };
@@ -106,10 +139,14 @@ var DocumentView = function DocumentView(props) {
106
139
  setLeft(_objectSpread(_objectSpread({}, left), {}, {
107
140
  isXMLMode: xmlMode
108
141
  }));
109
- } else {
142
+ } else if (side === 'right') {
110
143
  setRight(_objectSpread(_objectSpread({}, right), {}, {
111
144
  isXMLMode: xmlMode
112
145
  }));
146
+ } else {
147
+ setThird(_objectSpread(_objectSpread({}, third), {}, {
148
+ isXMLMode: xmlMode
149
+ }));
113
150
  }
114
151
  };
115
152
  var handleSetBookMode = function handleSetBookMode(shortid, bool) {
@@ -136,32 +173,41 @@ var DocumentView = function DocumentView(props) {
136
173
  var versoFolio = document.folioIndex[folioID];
137
174
  var name = versoFolio.name,
138
175
  pageNumber = versoFolio.pageNumber;
176
+ var documentFolios = document.variorum ? document.folios.filter(function (f) {
177
+ return f.doc_id === versoFolio.doc_id;
178
+ }) : document.folios;
139
179
  if (!name.endsWith('v') && name.endsWith('r')) {
140
- return [document.folios[pageNumber - 1].id, document.folios[pageNumber].id];
180
+ return [documentFolios[pageNumber - 1].id, documentFolios[pageNumber].id];
141
181
  }
142
- return [document.folios[pageNumber].id, document.folios[pageNumber + 1].id];
182
+ return [documentFolios[pageNumber].id, documentFolios[pageNumber + 1].id];
143
183
  };
144
- var onWidth = function onWidth(leftWidth, rightWidth) {
184
+ var onWidth = function onWidth(leftWidth, rightWidth, thirdWidth) {
145
185
  setLeft(_objectSpread(_objectSpread({}, left), {}, {
146
186
  width: leftWidth
147
187
  }));
148
188
  setRight(_objectSpread(_objectSpread({}, right), {}, {
149
189
  width: rightWidth
150
190
  }));
191
+ setThird(_objectSpread(_objectSpread({}, third), {}, {
192
+ width: thirdWidth
193
+ }));
151
194
  };
152
195
  var changeTranscriptionType = function changeTranscriptionType(side, transcriptionType) {
153
196
  var currentViewports = getViewports();
154
197
  if (side === 'left') {
155
198
  var folioID = currentViewports.left.folioID;
156
199
  var otherSide = currentViewports.right;
157
- navigateFolios(folioID, transcriptionType, otherSide.folioID, otherSide.transcriptionType);
158
- } else {
200
+ navigateFolios(folioID, transcriptionType, otherSide.folioID, otherSide.transcriptionType, currentViewports.third.folioID, currentViewports.third.transcriptionType);
201
+ } else if (side === 'right') {
159
202
  var _folioID = currentViewports.right.folioID;
160
203
  var _otherSide = currentViewports.left;
161
- navigateFolios(_otherSide.folioID, _otherSide.transcriptionType, _folioID, transcriptionType);
204
+ navigateFolios(_otherSide.folioID, _otherSide.transcriptionType, _folioID, transcriptionType, currentViewports.third.folioID, currentViewports.third.transcriptionType);
205
+ } else {
206
+ var _folioID2 = currentViewports.third.folioID;
207
+ navigateFolios(currentViewports.left.folioID, currentViewports.left.transcriptionType, currentViewports.right.folioID, currentViewports.right.transcriptionType, _folioID2, transcriptionType);
162
208
  }
163
209
  };
164
- var navigateFolios = function navigateFolios(folioID, transcriptionType, folioID2, transcriptionType2) {
210
+ var navigateFolios = function navigateFolios(folioID, transcriptionType, folioID2, transcriptionType2, folioID3, transcriptionType3) {
165
211
  if (!folioID) {
166
212
  // goto grid view
167
213
  navigateWithParams('/ec');
@@ -182,8 +228,18 @@ var DocumentView = function DocumentView(props) {
182
228
  navigateWithParams("/ec/".concat(folioID, "/").concat(transcriptionType, "/").concat(folioID2, "/tc"));
183
229
  return;
184
230
  }
185
- // goto folioID, transcriptionType, folioID2, transcriptionType2
186
- navigateWithParams("/ec/".concat(folioID, "/").concat(transcriptionType, "/").concat(folioID2, "/").concat(transcriptionType2));
231
+ if (!folioID3) {
232
+ // goto folioID, transcriptionType, folioID2, transcriptionType2
233
+ navigateWithParams("/ec/".concat(folioID, "/").concat(transcriptionType, "/").concat(folioID2, "/").concat(transcriptionType2));
234
+ return;
235
+ }
236
+ if (!transcriptionType3) {
237
+ // goto folioID, transcriptionType, folioID2, transcriptionType2, folioID3, tc
238
+ navigateWithParams("/ec/".concat(folioID, "/").concat(transcriptionType, "/").concat(folioID2, "/").concat(transcriptionType2, "/").concat(folioID3, "/f"));
239
+ return;
240
+ }
241
+ // goto folioID, transcrptionType, folioID2, transcriptionType2, folioID3, transcriptionType3
242
+ navigateWithParams("/ec/".concat(folioID, "/").concat(transcriptionType, "/").concat(folioID2, "/").concat(transcriptionType2, "/").concat(folioID3, "/").concat(transcriptionType3));
187
243
  };
188
244
  var changeCurrentFolio = function changeCurrentFolio(folioID, side, transcriptionType) {
189
245
  // Lookup prev/next
@@ -200,21 +256,27 @@ var DocumentView = function DocumentView(props) {
200
256
  if (side === 'left') {
201
257
  var otherSide = currentViewports.right;
202
258
  navigateFolios(folioID, transcriptionType, folioID, otherSide.transcriptionType);
203
- } else {
259
+ } else if (side === 'right') {
204
260
  var _otherSide2 = currentViewports.left;
205
261
  navigateFolios(folioID, _otherSide2.transcriptionType, folioID, transcriptionType);
262
+ } else {
263
+ navigateFolios(currentViewports.left.folioID, currentViewports.left.transcriptionType, currentViewports.right.folioID, currentViewports.right.transcriptionType, folioID, transcriptionType);
206
264
  }
207
265
  } else if (side === 'left') {
208
266
  var _otherSide3 = currentViewports.right;
209
- navigateFolios(folioID, transcriptionType, _otherSide3.folioID, _otherSide3.transcriptionType);
210
- } else {
267
+ var thirdPane = currentViewports.third;
268
+ navigateFolios(folioID, transcriptionType, _otherSide3.folioID, _otherSide3.transcriptionType, thirdPane.folioID, thirdPane.transcriptionType);
269
+ } else if (side === 'right') {
211
270
  var _otherSide4 = currentViewports.left;
212
- navigateFolios(_otherSide4.folioID, _otherSide4.transcriptionType, folioID, transcriptionType);
271
+ var _thirdPane = currentViewports.third;
272
+ navigateFolios(_otherSide4.folioID, _otherSide4.transcriptionType, folioID, transcriptionType, _thirdPane.folioID, _thirdPane.transcriptionType);
273
+ } else {
274
+ navigateFolios(currentViewports.left.folioID, currentViewports.left.transcriptionType, currentViewports.right.folioID, currentViewports.right.transcriptionType, folioID, transcriptionType);
213
275
  }
214
276
  };
215
277
  var determineViewType = function determineViewType(side) {
216
278
  var transcriptionType = getViewports()[side].transcriptionType;
217
- var xmlMode = side === 'left' ? left.isXMLMode : right.isXMLMode;
279
+ var xmlMode = side === 'left' ? left.isXMLMode : side === 'right' ? right.isXMLMode : third.isXMLMode;
218
280
  if (transcriptionType === 'g') {
219
281
  return 'ImageGridView';
220
282
  }
@@ -232,13 +294,16 @@ var DocumentView = function DocumentView(props) {
232
294
 
233
295
  // blank folio ID
234
296
  if (viewport.folioID === '-1') {
235
- return _objectSpread(_objectSpread({}, side === 'left' ? left : right), {}, {
297
+ return _objectSpread(_objectSpread({}, side === 'left' ? left : side === 'right' ? right : third), {}, {
236
298
  iiifShortID: viewport.folioID,
237
299
  transcriptionType: viewport.transcriptionType
238
300
  });
239
301
  }
240
302
  var shortID = viewport.folioID;
241
- var folioCount = doc.folios.length;
303
+ var documentFolios = doc.variorum ? doc.folios.filter(function (f) {
304
+ return f.doc_id === doc.folioIndex[shortID].doc_id;
305
+ }) : doc.folios;
306
+ var folioCount = documentFolios.length;
242
307
  var nextID = '';
243
308
  var prevID = '';
244
309
  var current_hasPrev = false;
@@ -250,20 +315,20 @@ var DocumentView = function DocumentView(props) {
250
315
  var current_idx = doc.folioIndex[versoID].pageNumber;
251
316
  if (current_idx > -1) {
252
317
  current_hasNext = current_idx < folioCount - 2;
253
- nextID = current_hasNext ? doc.folios[current_idx + 2].id : '';
318
+ nextID = current_hasNext ? documentFolios[current_idx + 2].id : '';
254
319
  current_hasPrev = current_idx > 1 && folioCount > 1;
255
- prevID = current_hasPrev ? doc.folios[current_idx - 2].id : '';
320
+ prevID = current_hasPrev ? documentFolios[current_idx - 2].id : '';
256
321
  }
257
322
  } else {
258
323
  var _current_idx = doc.folioIndex[shortID].pageNumber;
259
324
  if (_current_idx > -1) {
260
325
  current_hasNext = _current_idx < folioCount - 1;
261
- nextID = current_hasNext ? doc.folios[_current_idx + 1].id : '';
326
+ nextID = current_hasNext ? documentFolios[_current_idx + 1].id : '';
262
327
  current_hasPrev = _current_idx > 0 && folioCount > 1;
263
- prevID = current_hasPrev ? doc.folios[_current_idx - 1].id : '';
328
+ prevID = current_hasPrev ? documentFolios[_current_idx - 1].id : '';
264
329
  }
265
330
  }
266
- return _objectSpread(_objectSpread({}, side === 'left' ? left : right), {}, {
331
+ return _objectSpread(_objectSpread({}, side === 'left' ? left : side === 'right' ? right : third), {}, {
267
332
  iiifShortID: shortID,
268
333
  transcriptionType: viewport.transcriptionType,
269
334
  hasPrevious: current_hasPrev,
@@ -319,7 +384,8 @@ var DocumentView = function DocumentView(props) {
319
384
  key: key,
320
385
  documentView: docView,
321
386
  documentViewActions: documentViewActions,
322
- side: side
387
+ side: side,
388
+ selectedDoc: props.document.variorum && Object.keys(props.document.derivativeNames)[side === 'left' ? 0 : side === 'right' ? 1 : Object.keys(props.document.derivativeNames).length > 2 ? 2 : 1]
323
389
  });
324
390
  }
325
391
  if (viewType === 'GlossaryView') {
@@ -333,7 +399,7 @@ var DocumentView = function DocumentView(props) {
333
399
  return /*#__PURE__*/React.createElement("div", null, "ERROR: Unrecognized viewType.");
334
400
  };
335
401
  var viewPaneKey = function viewPaneKey(side) {
336
- var pane = side === 'left' ? left : right;
402
+ var pane = side === 'left' ? left : side === 'right' ? right : third;
337
403
  if (pane.viewType === 'ImageGridView') {
338
404
  return "".concat(side, "-").concat(pane.viewType);
339
405
  }
@@ -351,7 +417,8 @@ var DocumentView = function DocumentView(props) {
351
417
  linkedMode: linkedMode,
352
418
  bookMode: bookMode,
353
419
  left: viewportState('left'),
354
- right: viewportState('right')
420
+ right: viewportState('right'),
421
+ third: viewportState('third')
355
422
  };
356
423
  var mobileDocView = {
357
424
  linkedMode: linkedMode,
@@ -359,15 +426,17 @@ var DocumentView = function DocumentView(props) {
359
426
  left: left,
360
427
  right: _objectSpread({}, viewportState('right'))
361
428
  };
362
- if (isWidthUp('md', props.width)) {
429
+ if (isWidthUp('md', props.width) && !singlePaneMode) {
363
430
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SplitPaneView, {
364
431
  leftPane: renderPane('left', docView),
365
432
  rightPane: renderPane('right', docView),
366
- onWidth: onWidth
433
+ thirdPane: renderPane('third', docView),
434
+ onWidth: onWidth,
435
+ threePanel: props.document.threePanel
367
436
  }));
368
437
  }
369
438
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SinglePaneView, {
370
- singlePane: renderPane('right', mobileDocView)
439
+ singlePane: renderPane(viewportState('left').iiifShortID === "-1" ? 'left' : 'right', docView)
371
440
  }));
372
441
  };
373
442
  function mapStateToProps(state) {
@@ -16,6 +16,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
16
16
  import React from 'react';
17
17
  import { connect } from 'react-redux';
18
18
  import InfiniteScroll from 'react-infinite-scroller';
19
+ import { MenuItem, Select } from '@material-ui/core';
19
20
  var ImageGridView = /*#__PURE__*/function (_React$Component) {
20
21
  _inherits(ImageGridView, _React$Component);
21
22
  var _super = _createSuper(ImageGridView);
@@ -48,9 +49,31 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
48
49
  jumpToBuffer: ''
49
50
  }));
50
51
  };
52
+ _this.onSelectDoc = function (event) {
53
+ if (event.target.value !== 'none') {
54
+ _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
55
+ currentDoc: event.target.value
56
+ }));
57
+ } else {
58
+ _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
59
+ currentDoc: null
60
+ }));
61
+ }
62
+ var documentView = _this.props.documentView;
63
+ var folioID = documentView[_this.props.side].iiifShortID;
64
+ var thumbs = _this.generateThumbs(folioID, event.target.value !== 'none' ? _this.props.document.folios.filter(function (folio) {
65
+ return folio.doc_id === event.target.value;
66
+ }) : _this.props.document.folios);
67
+ var thumbCount = thumbs.length > _this.loadIncrement ? _this.loadIncrement : thumbs.length;
68
+ var visibleThumbs = thumbs.slice(0, thumbCount);
69
+ _this.setState({
70
+ thumbs: thumbs,
71
+ visibleThumbs: visibleThumbs
72
+ });
73
+ };
51
74
  _this.onClickThumb = function (id, e) {
52
75
  // Set the folio for this side
53
- _this.props.documentViewActions.changeCurrentFolio(id, _this.props.side);
76
+ _this.props.documentViewActions.changeCurrentFolio(id, _this.props.side, 'f');
54
77
  };
55
78
  _this.moreThumbs = function () {
56
79
  var thumbs = _this.state.thumbs;
@@ -70,18 +93,22 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
70
93
  _this.state = {
71
94
  jumpToBuffer: '',
72
95
  thumbs: '',
73
- visibleThumbs: []
96
+ visibleThumbs: [],
97
+ currentDoc: props.selectedDoc || null
74
98
  };
75
99
  return _this;
76
100
  }
77
101
  _createClass(ImageGridView, [{
78
102
  key: "componentDidUpdate",
79
103
  value: function componentDidUpdate(prevProps) {
104
+ var _this2 = this;
80
105
  var documentView = this.props.documentView;
81
106
  var folioID = documentView[this.props.side].iiifShortID;
82
107
  var nextFolioID = this.props.documentView[this.props.side].iiifShortID;
83
108
  if (folioID !== nextFolioID) {
84
- var thumbs = this.generateThumbs(nextFolioID, this.props.document.folios);
109
+ var thumbs = this.generateThumbs(nextFolioID, this.state.currentDoc ? this.props.document.folios.filter(function (folio) {
110
+ return folio.doc_id === _this2.state.currentDoc;
111
+ }) : this.props.document.folios);
85
112
  var thumbCount = thumbs.length > this.loadIncrement ? this.loadIncrement : thumbs.length;
86
113
  var visibleThumbs = thumbs.slice(0, thumbCount);
87
114
  this.setState({
@@ -95,7 +122,17 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
95
122
  value: function renderToolbar() {
96
123
  return /*#__PURE__*/React.createElement("div", {
97
124
  className: "imageGridToolbar"
98
- }, /*#__PURE__*/React.createElement("div", {
125
+ }, /*#__PURE__*/React.createElement("span", {
126
+ className: "fas fa-th",
127
+ style: {
128
+ paddingLeft: '15px'
129
+ }
130
+ }), this.props.document.variorum ? this.renderDocSelect() : /*#__PURE__*/React.createElement("div", {
131
+ className: "doc-select",
132
+ style: {
133
+ marginTop: '5px'
134
+ }
135
+ }, this.props.document.documentName), /*#__PURE__*/React.createElement("div", {
99
136
  className: "jump-to"
100
137
  }, /*#__PURE__*/React.createElement("form", {
101
138
  onSubmit: this.onJumpTo
@@ -114,12 +151,38 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
114
151
  className: "fa fa-hand-point-right"
115
152
  })))));
116
153
  }
154
+
155
+ // in the case of a variorum, allow for filtering by document
156
+ }, {
157
+ key: "renderDocSelect",
158
+ value: function renderDocSelect() {
159
+ var _this3 = this;
160
+ return /*#__PURE__*/React.createElement("div", {
161
+ className: "doc-select"
162
+ }, /*#__PURE__*/React.createElement(Select, {
163
+ id: "doc-filter",
164
+ className: "dark",
165
+ style: {
166
+ color: 'white'
167
+ },
168
+ value: this.state.currentDoc || Object.keys(this.props.document.derivativeNames)[0],
169
+ onClick: this.onSelectDoc
170
+ }, Object.keys(this.props.document.derivativeNames).map(function (key) {
171
+ return /*#__PURE__*/React.createElement(MenuItem, {
172
+ value: key,
173
+ key: key
174
+ }, _this3.props.document.derivativeNames[key]);
175
+ })));
176
+ }
117
177
  }, {
118
178
  key: "componentDidMount",
119
179
  value: function componentDidMount() {
180
+ var _this4 = this;
120
181
  var documentView = this.props.documentView;
121
182
  var folioID = documentView[this.props.side].iiifShortID;
122
- var thumbs = this.generateThumbs(folioID, this.props.document.folios);
183
+ var thumbs = this.generateThumbs(folioID, this.state.currentDoc ? this.props.document.folios.filter(function (folio) {
184
+ return folio.doc_id === _this4.state.currentDoc;
185
+ }) : this.props.document.folios);
123
186
  var thumbCount = thumbs.length > this.loadIncrement ? this.loadIncrement : thumbs.length;
124
187
  var visibleThumbs = thumbs.slice(0, thumbCount);
125
188
  this.setState({
@@ -130,22 +193,35 @@ var ImageGridView = /*#__PURE__*/function (_React$Component) {
130
193
  }, {
131
194
  key: "generateThumbs",
132
195
  value: function generateThumbs(currentID, folios) {
133
- var _this2 = this;
196
+ var _this5 = this;
134
197
  var thumbs = folios.map(function (folio, index) {
135
- return /*#__PURE__*/React.createElement("li", {
136
- key: "thumb-".concat(index),
137
- className: "thumbnail"
138
- }, /*#__PURE__*/React.createElement("figure", {
139
- className: folio.id === currentID ? 'current' : ''
140
- }, /*#__PURE__*/React.createElement("a", {
141
- id: folio.id,
142
- onClick: _this2.onClickThumb.bind(_this2, folio.id)
143
- }, /*#__PURE__*/React.createElement("img", {
144
- src: folio.image_thumbnail_url,
145
- alt: folio.name
146
- }))), /*#__PURE__*/React.createElement("figcaption", {
147
- className: folio.id === currentID ? 'thumbnail-caption current' : 'thumbnail-caption'
148
- }, folio.id === currentID ? "*".concat(folio.name) : folio.name));
198
+ return (
199
+ /*#__PURE__*/
200
+ // eslint-disable-next-line react/no-array-index-key
201
+ React.createElement("li", {
202
+ key: "thumb-".concat(index),
203
+ className: "thumbnail"
204
+ }, /*#__PURE__*/React.createElement("figure", {
205
+ className: folio.id === currentID ? 'current' : ''
206
+ }, /*#__PURE__*/React.createElement("a", {
207
+ id: folio.id,
208
+ onClick: _this5.onClickThumb.bind(_this5, folio.id)
209
+ }, /*#__PURE__*/React.createElement("img", {
210
+ src: folio.image_thumbnail_url,
211
+ alt: folio.name,
212
+ style: {
213
+ maxWidth: "130px",
214
+ maxHeight: "130px"
215
+ },
216
+ onError: function onError(_ref) {
217
+ var currentTarget = _ref.currentTarget;
218
+ currentTarget.onerror = null;
219
+ currentTarget.src = "".concat(folio.image_zoom_url.slice(0, -9), "full/full/0/default.jpg");
220
+ }
221
+ }))), /*#__PURE__*/React.createElement("figcaption", {
222
+ className: folio.id === currentID ? 'thumbnail-caption current' : 'thumbnail-caption'
223
+ }, folio.id === currentID ? "*".concat(folio.name) : folio.name))
224
+ );
149
225
  });
150
226
  return thumbs;
151
227
  }