@cu-mkp/editioncrafter 1.0.3 → 1.0.4-beta.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 (57) hide show
  1. package/README.md +7 -7
  2. package/dist/editioncrafter.js +65802 -0
  3. package/dist/editioncrafter.umd.cjs +553 -0
  4. package/dist/es/src/action/DiplomaticActions.js +9 -11
  5. package/dist/es/src/action/DocumentActions.js +164 -154
  6. package/dist/es/src/action/GlossaryActions.js +9 -11
  7. package/dist/es/src/action/initialState/diplomaticInitialState.js +2 -2
  8. package/dist/es/src/action/initialState/documentInitialState.js +9 -12
  9. package/dist/es/src/action/initialState/glossaryInitialState.js +3 -3
  10. package/dist/es/src/action/rootReducer.js +31 -29
  11. package/dist/es/src/component/AlphabetLinks.js +44 -66
  12. package/dist/es/src/component/CustomizedTooltops.js +101 -110
  13. package/dist/es/src/component/DiploMatic.js +64 -91
  14. package/dist/es/src/component/DocumentView.js +442 -366
  15. package/dist/es/src/component/EditorComment.js +51 -75
  16. package/dist/es/src/component/ErrorBoundary.js +37 -61
  17. package/dist/es/src/component/FigureImage.js +56 -67
  18. package/dist/es/src/component/GlossaryView.js +157 -149
  19. package/dist/es/src/component/HelpPopper.js +96 -78
  20. package/dist/es/src/component/ImageGridView.js +184 -249
  21. package/dist/es/src/component/ImageView.js +155 -165
  22. package/dist/es/src/component/ImageZoomControl.js +19 -38
  23. package/dist/es/src/component/JumpToFolio.js +56 -60
  24. package/dist/es/src/component/Navigation.js +374 -328
  25. package/dist/es/src/component/Pagination.js +73 -70
  26. package/dist/es/src/component/Parser.js +11 -32
  27. package/dist/es/src/component/RingSpinner.js +31 -32
  28. package/dist/es/src/component/RouteListener.js +30 -21
  29. package/dist/es/src/component/SeaDragonComponent.js +33 -56
  30. package/dist/es/src/component/SinglePaneView.js +15 -33
  31. package/dist/es/src/component/SplitPaneView.js +151 -170
  32. package/dist/es/src/component/TranscriptionView.js +190 -179
  33. package/dist/es/src/component/Watermark.js +21 -30
  34. package/dist/es/src/component/XMLView.js +60 -82
  35. package/dist/es/src/hooks/useIsWidthUp.js +9 -7
  36. package/dist/es/src/icons/ByIcon.js +16 -16
  37. package/dist/es/src/icons/CcIcon.js +16 -16
  38. package/dist/es/src/icons/NcIcon.js +16 -16
  39. package/dist/es/src/icons/SaIcon.js +16 -16
  40. package/dist/es/src/icons/SideMenuIconLeft.js +30 -38
  41. package/dist/es/src/icons/SideMenuIconRight.js +32 -38
  42. package/dist/es/src/index.js +21 -20
  43. package/dist/es/src/lib/copyObject.js +3 -2
  44. package/dist/es/src/lib/registerServiceWorker.js +77 -54
  45. package/dist/es/src/model/DocumentHelper.js +7 -6
  46. package/dist/es/src/model/Folio.js +68 -146
  47. package/dist/es/src/model/ReduxStore.js +32 -78
  48. package/dist/es/src/model/folioLayout.js +275 -280
  49. package/dist/es/src/saga/RouteListenerSaga.js +89 -203
  50. package/dist/es/src/saga/rootSaga.js +9 -16
  51. package/dist/es/src/scss/_imageView.scss +1 -1
  52. package/dist/es/src/scss/_navigation.scss +1 -1
  53. package/dist/es/src/scss/editioncrafter.scss +1 -1
  54. package/dist/style.css +1 -0
  55. package/package.json +36 -50
  56. package/dist/editioncrafter.min.js +0 -2
  57. package/dist/editioncrafter.min.js.LICENSE.txt +0 -144
@@ -1,265 +1,200 @@
1
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
11
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
13
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
- import React from 'react';
17
- import { connect } from 'react-redux';
18
- import InfiniteScroll from 'react-infinite-scroller';
19
- import { MenuItem, Select } from '@material-ui/core';
20
- var ImageGridView = /*#__PURE__*/function (_React$Component) {
21
- _inherits(ImageGridView, _React$Component);
22
- var _super = _createSuper(ImageGridView);
23
- function ImageGridView(props, context) {
24
- var _this;
25
- _classCallCheck(this, ImageGridView);
26
- _this = _super.call(this, props, context);
27
- _this.onJumpToChange = function (event) {
28
- var jumpToBuffer = event.target.value;
29
- _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
30
- jumpToBuffer: jumpToBuffer
31
- }));
32
- };
33
- _this.onJumpTo = function (event) {
34
- var jumpToBuffer = _this.state.jumpToBuffer;
35
- var _this$props = _this.props,
36
- side = _this$props.side,
37
- document = _this$props.document,
38
- documentViewActions = _this$props.documentViewActions;
39
- event.preventDefault();
1
+ import { MenuItem, Select } from '@material-ui/core'
2
+ import React from 'react'
3
+ import InfiniteScroll from 'react-infinite-scroller'
4
+ import { connect } from 'react-redux'
40
5
 
41
- // Convert folioName to ID (and confirm it exists)
42
- if (document.folioByName[jumpToBuffer]) {
43
- var folio = document.folioByName[jumpToBuffer];
44
- if (folio) {
45
- documentViewActions.changeCurrentFolio(folio.id, side);
46
- }
47
- }
48
- _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
49
- jumpToBuffer: ''
50
- }));
51
- };
52
- _this.onSelectDoc = function (event) {
53
- if (!event.target.value || event.target.value == 0) {
54
- return;
55
- }
56
- if (event.target.value && event.target.value !== 'none') {
57
- _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
58
- currentDoc: event.target.value
59
- }));
60
- } else {
61
- _this.setState(_objectSpread(_objectSpread({}, _this.state), {}, {
62
- currentDoc: null
63
- }));
64
- }
65
- var documentView = _this.props.documentView;
66
- var folioID = documentView[_this.props.side].iiifShortID;
67
- var thumbs = _this.generateThumbs(folioID, event.target.value !== 'none' ? _this.props.document.folios.filter(function (folio) {
68
- return folio.doc_id === event.target.value;
69
- }) : _this.props.document.folios);
70
- var thumbCount = thumbs.length > _this.loadIncrement ? _this.loadIncrement : thumbs.length;
71
- var visibleThumbs = thumbs.slice(0, thumbCount);
72
- _this.setState({
73
- thumbs: thumbs,
74
- visibleThumbs: visibleThumbs
75
- });
76
- };
77
- _this.onClickThumb = function (id, e) {
78
- // Set the folio for this side
79
- _this.props.documentViewActions.changeCurrentFolio(id, _this.props.side, 'f');
80
- };
81
- _this.moreThumbs = function () {
82
- var thumbs = _this.state.thumbs;
83
- var visibleThumbs = _this.state.visibleThumbs;
84
- var thumbCount = visibleThumbs.length + _this.loadIncrement;
85
- if (thumbs.length >= thumbCount) {
86
- visibleThumbs = thumbs.slice(0, thumbCount);
87
- } else {
88
- visibleThumbs = thumbs;
89
- }
90
- _this.setState({
91
- visibleThumbs: visibleThumbs
92
- });
93
- };
94
- _this.generateThumbs = _this.generateThumbs.bind(_assertThisInitialized(_this));
95
- _this.loadIncrement = 10;
96
- _this.state = {
6
+ class ImageGridView extends React.Component {
7
+ constructor(props, context) {
8
+ super(props, context)
9
+ this.generateThumbs = this.generateThumbs.bind(this)
10
+ this.loadIncrement = 10
11
+ this.state = {
97
12
  jumpToBuffer: '',
98
13
  thumbs: '',
99
14
  visibleThumbs: [],
100
- currentDoc: props.selectedDoc || null
101
- };
102
- return _this;
15
+ currentDoc: props.selectedDoc || null,
16
+ }
103
17
  }
104
- _createClass(ImageGridView, [{
105
- key: "componentDidUpdate",
106
- value: function componentDidUpdate(prevProps) {
107
- var _this2 = this;
108
- var documentView = this.props.documentView;
109
- var folioID = documentView[this.props.side].iiifShortID;
110
- var nextFolioID = this.props.documentView[this.props.side].iiifShortID;
111
- if (folioID !== nextFolioID) {
112
- var thumbs = this.generateThumbs(nextFolioID, this.state.currentDoc ? this.props.document.folios.filter(function (folio) {
113
- return folio.doc_id === _this2.state.currentDoc;
114
- }) : this.props.document.folios);
115
- var thumbCount = thumbs.length > this.loadIncrement ? this.loadIncrement : thumbs.length;
116
- var visibleThumbs = thumbs.slice(0, thumbCount);
117
- this.setState({
118
- thumbs: thumbs,
119
- visibleThumbs: visibleThumbs
120
- });
121
- }
18
+
19
+ componentDidUpdate(prevProps) {
20
+ const { documentView } = this.props
21
+ const folioID = documentView[this.props.side].iiifShortID
22
+ const nextFolioID = this.props.documentView[this.props.side].iiifShortID
23
+
24
+ if (folioID !== nextFolioID) {
25
+ const thumbs = this.generateThumbs(nextFolioID, this.state.currentDoc ? this.props.document.folios.filter(folio => (folio.doc_id === this.state.currentDoc)) : this.props.document.folios)
26
+ const thumbCount = (thumbs.length > this.loadIncrement) ? this.loadIncrement : thumbs.length
27
+ const visibleThumbs = thumbs.slice(0, thumbCount)
28
+ this.setState({ thumbs, visibleThumbs })
122
29
  }
123
- }, {
124
- key: "renderToolbar",
125
- value: function renderToolbar() {
126
- return /*#__PURE__*/React.createElement("div", {
127
- className: "imageGridToolbar"
128
- }, /*#__PURE__*/React.createElement("span", {
129
- className: "fas fa-th",
130
- style: {
131
- paddingLeft: '15px'
132
- }
133
- }), this.props.document.variorum ? this.renderDocSelect() : /*#__PURE__*/React.createElement("div", {
134
- className: "doc-select",
135
- style: {
136
- marginTop: '5px'
137
- }
138
- }, this.props.document.documentName), /*#__PURE__*/React.createElement("div", {
139
- className: "jump-to"
140
- }, /*#__PURE__*/React.createElement("form", {
141
- onSubmit: this.onJumpTo
142
- }, /*#__PURE__*/React.createElement("span", null, "Jump to: "), /*#__PURE__*/React.createElement("input", {
143
- id: "jump-to-input",
144
- placeholder: "Page Name (e.g. '3r')",
145
- onChange: this.onJumpToChange,
146
- value: this.state.jumpToBuffer
147
- }), /*#__PURE__*/React.createElement("button", {
148
- id: "jump-to-button",
149
- onClick: this.onJumpTo
150
- }, /*#__PURE__*/React.createElement("span", {
151
- style: {
152
- color: 'black'
153
- },
154
- className: "fa fa-hand-point-right"
155
- })))));
30
+ }
31
+
32
+ onJumpToChange = (event) => {
33
+ const jumpToBuffer = event.target.value
34
+ this.setState({ ...this.state, jumpToBuffer })
35
+ }
36
+
37
+ onJumpTo = (event) => {
38
+ const { jumpToBuffer } = this.state
39
+ const { side, document, documentViewActions } = this.props
40
+ event.preventDefault()
41
+
42
+ // Convert folioName to ID (and confirm it exists)
43
+ if (document.folioByName[jumpToBuffer]) {
44
+ const folio = document.folioByName[jumpToBuffer]
45
+ if (folio) {
46
+ documentViewActions.changeCurrentFolio(folio.id, side)
47
+ }
156
48
  }
157
49
 
158
- // in the case of a variorum, allow for filtering by document
159
- }, {
160
- key: "renderDocSelect",
161
- value: function renderDocSelect() {
162
- var _this3 = this;
163
- return /*#__PURE__*/React.createElement("div", {
164
- className: "doc-select"
165
- }, /*#__PURE__*/React.createElement(Select, {
166
- id: "doc-filter",
167
- className: "dark",
168
- style: {
169
- color: 'white',
170
- fontSize: 'max(16px, 1rem)'
171
- },
172
- value: this.state.currentDoc || Object.keys(this.props.document.derivativeNames)[0],
173
- onClick: this.onSelectDoc
174
- }, Object.keys(this.props.document.derivativeNames).map(function (key) {
175
- return /*#__PURE__*/React.createElement(MenuItem, {
176
- value: key,
177
- key: key
178
- }, _this3.props.document.derivativeNames[key]);
179
- })));
50
+ this.setState({ ...this.state, jumpToBuffer: '' })
51
+ }
52
+
53
+ renderToolbar() {
54
+ return (
55
+ <div className="imageGridToolbar">
56
+ <span className="fas fa-th" style={{ paddingLeft: '15px' }} />
57
+ { this.props.document.variorum
58
+ ? this.renderDocSelect()
59
+ : (
60
+ <div className="doc-select" style={{ marginTop: '5px' }}>
61
+ { this.props.document.documentName }
62
+ </div>
63
+ ) }
64
+ <div className="jump-to">
65
+ <form onSubmit={this.onJumpTo}>
66
+ <span>Jump to: </span>
67
+ <input
68
+ id="jump-to-input"
69
+ placeholder="Page Name (e.g. '3r')"
70
+ onChange={this.onJumpToChange}
71
+ value={this.state.jumpToBuffer}
72
+ />
73
+ <button id="jump-to-button" onClick={this.onJumpTo}>
74
+ <span style={{ color: 'black' }} className="fa fa-hand-point-right" />
75
+ </button>
76
+ </form>
77
+ </div>
78
+ </div>
79
+ )
80
+ }
81
+
82
+ // in the case of a variorum, allow for filtering by document
83
+ renderDocSelect() {
84
+ return (
85
+ <div className="doc-select">
86
+ <Select
87
+ id="doc-filter"
88
+ className="dark"
89
+ style={{ color: 'white', fontSize: 'max(16px, 1rem)' }}
90
+ value={this.state.currentDoc || Object.keys(this.props.document.derivativeNames)[0]}
91
+ onClick={this.onSelectDoc}
92
+ >
93
+ {/* <MenuItem value="none" key="none">{this.state.currentDoc ? 'View All' : 'Select a Document'}</MenuItem> */}
94
+ { Object.keys(this.props.document.derivativeNames).map(key => (
95
+ <MenuItem value={key} key={key}>{this.props.document.derivativeNames[key]}</MenuItem>
96
+ ))}
97
+ </Select>
98
+ </div>
99
+ )
100
+ }
101
+
102
+ onSelectDoc = (event) => {
103
+ if (!event.target.value || event.target.value == 0) {
104
+ return
105
+ }
106
+ if (event.target.value && event.target.value !== 'none') {
107
+ this.setState({ ...this.state, currentDoc: event.target.value })
180
108
  }
181
- }, {
182
- key: "componentDidMount",
183
- value: function componentDidMount() {
184
- var _this4 = this;
185
- var documentView = this.props.documentView;
186
- var folioID = documentView[this.props.side].iiifShortID;
187
- var thumbs = this.generateThumbs(folioID, this.props.document.variorum && this.state.currentDoc ? this.props.document.folios.filter(function (folio) {
188
- return folio.doc_id === _this4.state.currentDoc;
189
- }) : this.props.document.folios);
190
- console.log(thumbs);
191
- console.log(this.props.document.folios);
192
- var thumbCount = thumbs.length > this.loadIncrement ? this.loadIncrement : thumbs.length;
193
- var visibleThumbs = thumbs.slice(0, thumbCount);
194
- this.setState({
195
- thumbs: thumbs,
196
- visibleThumbs: visibleThumbs
197
- });
109
+ else {
110
+ this.setState({ ...this.state, currentDoc: null })
198
111
  }
199
- }, {
200
- key: "generateThumbs",
201
- value: function generateThumbs(currentID, folios) {
202
- var _this5 = this;
203
- var thumbs = folios.map(function (folio, index) {
204
- return (
205
- /*#__PURE__*/
206
- // eslint-disable-next-line react/no-array-index-key
207
- React.createElement("li", {
208
- key: "thumb-".concat(index),
209
- className: "thumbnail"
210
- }, /*#__PURE__*/React.createElement("figure", null, /*#__PURE__*/React.createElement("a", {
211
- id: folio.id,
212
- onClick: _this5.onClickThumb.bind(_this5, folio.id)
213
- }, /*#__PURE__*/React.createElement("img", {
214
- src: folio.image_thumbnail_url,
215
- alt: folio.name,
216
- style: {
217
- maxWidth: "130px",
218
- maxHeight: "130px"
219
- },
220
- onError: function onError(_ref) {
221
- var currentTarget = _ref.currentTarget;
222
- currentTarget.onerror = null;
223
- if (folio.image_zoom_url && currentTarget.src !== "".concat(folio.image_zoom_url.slice(0, -9), "full/full/0/default.jpg")) {
224
- currentTarget.src = "".concat(folio.image_zoom_url.slice(0, -9), "full/full/0/default.jpg");
225
- }
226
- }
227
- }))), /*#__PURE__*/React.createElement("figcaption", {
228
- className: "thumbnail-caption"
229
- }, folio.name))
230
- );
231
- });
232
- return thumbs;
112
+ const { documentView } = this.props
113
+ const folioID = documentView[this.props.side].iiifShortID
114
+ const thumbs = this.generateThumbs(folioID, event.target.value !== 'none' ? this.props.document.folios.filter(folio => (folio.doc_id === event.target.value)) : this.props.document.folios)
115
+ const thumbCount = (thumbs.length > this.loadIncrement) ? this.loadIncrement : thumbs.length
116
+ const visibleThumbs = thumbs.slice(0, thumbCount)
117
+ this.setState({ thumbs, visibleThumbs })
118
+ }
119
+
120
+ componentDidMount() {
121
+ const { documentView } = this.props
122
+ const folioID = documentView[this.props.side].iiifShortID
123
+ const thumbs = this.generateThumbs(folioID, this.props.document.variorum && this.state.currentDoc ? this.props.document.folios.filter(folio => (folio.doc_id === this.state.currentDoc)) : this.props.document.folios)
124
+ const thumbCount = (thumbs.length > this.loadIncrement) ? this.loadIncrement : thumbs.length
125
+ const visibleThumbs = thumbs.slice(0, thumbCount)
126
+ this.setState({ thumbs, visibleThumbs })
127
+ }
128
+
129
+ onClickThumb = (id, e) => {
130
+ // Set the folio for this side
131
+ this.props.documentViewActions.changeCurrentFolio(
132
+ id,
133
+ this.props.side,
134
+ 'f',
135
+ )
136
+ }
137
+
138
+ generateThumbs(currentID, folios) {
139
+ const thumbs = folios.map((folio, index) => (
140
+ // eslint-disable-next-line react/no-array-index-key
141
+ <li key={`thumb-${index}`} className="thumbnail">
142
+ <figure><a id={folio.id} onClick={this.onClickThumb.bind(this, folio.id)}><img src={folio.image_thumbnail_url} alt={folio.name} style={{ maxWidth: '130px', maxHeight: '130px' }} onError={({ currentTarget }) => { currentTarget.onerror = null; if (folio.image_zoom_url && currentTarget.src !== `${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`) { currentTarget.src = `${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg` } }} /></a></figure>
143
+ <figcaption className="thumbnail-caption">
144
+ {folio.name}
145
+ </figcaption>
146
+
147
+ </li>
148
+ ))
149
+ return thumbs
150
+ }
151
+
152
+ moreThumbs = () => {
153
+ const { thumbs } = this.state
154
+ let { visibleThumbs } = this.state
155
+ const thumbCount = visibleThumbs.length + this.loadIncrement
156
+
157
+ if (thumbs.length >= thumbCount) {
158
+ visibleThumbs = thumbs.slice(0, thumbCount)
233
159
  }
234
- }, {
235
- key: "hasMore",
236
- value: function hasMore() {
237
- return this.state.visibleThumbs.length !== this.state.thumbs.length;
160
+ else {
161
+ visibleThumbs = thumbs
238
162
  }
239
- }, {
240
- key: "render",
241
- value: function render() {
242
- var thisClass = 'imageGridComponent';
243
- thisClass = "".concat(thisClass, " ").concat(this.props.side);
244
- var visibleThumbs = this.state.visibleThumbs;
245
- if (visibleThumbs.constructor.toString().indexOf('Array') === -1) {
246
- visibleThumbs = [];
247
- }
248
- return /*#__PURE__*/React.createElement("div", {
249
- className: thisClass
250
- }, this.renderToolbar(), /*#__PURE__*/React.createElement(InfiniteScroll, {
251
- element: "ul",
252
- loadMore: this.moreThumbs,
253
- hasMore: this.hasMore(),
254
- useWindow: false
255
- }, visibleThumbs));
163
+
164
+ this.setState({ visibleThumbs })
165
+ }
166
+
167
+ hasMore() {
168
+ return (this.state.visibleThumbs.length !== this.state.thumbs.length)
169
+ }
170
+
171
+ render() {
172
+ let thisClass = 'imageGridComponent'
173
+ thisClass = `${thisClass} ${this.props.side}`
174
+ let { visibleThumbs } = this.state
175
+ if (!visibleThumbs.constructor.toString().includes('Array')) {
176
+ visibleThumbs = []
256
177
  }
257
- }]);
258
- return ImageGridView;
259
- }(React.Component);
178
+ return (
179
+ <div className={thisClass}>
180
+ { this.renderToolbar() }
181
+ <InfiniteScroll
182
+ element="ul"
183
+ loadMore={this.moreThumbs}
184
+ hasMore={this.hasMore()}
185
+ useWindow={false}
186
+ >
187
+ {visibleThumbs}
188
+ </InfiniteScroll>
189
+ </div>
190
+ )
191
+ }
192
+ }
193
+
260
194
  function mapStateToProps(state) {
261
195
  return {
262
- document: state.document
263
- };
196
+ document: state.document,
197
+ }
264
198
  }
265
- export default connect(mapStateToProps)(ImageGridView);
199
+
200
+ export default connect(mapStateToProps)(ImageGridView)