@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.
- package/README.md +7 -7
- package/dist/editioncrafter.js +65802 -0
- package/dist/editioncrafter.umd.cjs +553 -0
- package/dist/es/src/action/DiplomaticActions.js +9 -11
- package/dist/es/src/action/DocumentActions.js +164 -154
- package/dist/es/src/action/GlossaryActions.js +9 -11
- package/dist/es/src/action/initialState/diplomaticInitialState.js +2 -2
- package/dist/es/src/action/initialState/documentInitialState.js +9 -12
- package/dist/es/src/action/initialState/glossaryInitialState.js +3 -3
- package/dist/es/src/action/rootReducer.js +31 -29
- package/dist/es/src/component/AlphabetLinks.js +44 -66
- package/dist/es/src/component/CustomizedTooltops.js +101 -110
- package/dist/es/src/component/DiploMatic.js +64 -91
- package/dist/es/src/component/DocumentView.js +442 -366
- package/dist/es/src/component/EditorComment.js +51 -75
- package/dist/es/src/component/ErrorBoundary.js +37 -61
- package/dist/es/src/component/FigureImage.js +56 -67
- package/dist/es/src/component/GlossaryView.js +157 -149
- package/dist/es/src/component/HelpPopper.js +96 -78
- package/dist/es/src/component/ImageGridView.js +184 -249
- package/dist/es/src/component/ImageView.js +155 -165
- package/dist/es/src/component/ImageZoomControl.js +19 -38
- package/dist/es/src/component/JumpToFolio.js +56 -60
- package/dist/es/src/component/Navigation.js +374 -328
- package/dist/es/src/component/Pagination.js +73 -70
- package/dist/es/src/component/Parser.js +11 -32
- package/dist/es/src/component/RingSpinner.js +31 -32
- package/dist/es/src/component/RouteListener.js +30 -21
- package/dist/es/src/component/SeaDragonComponent.js +33 -56
- package/dist/es/src/component/SinglePaneView.js +15 -33
- package/dist/es/src/component/SplitPaneView.js +151 -170
- package/dist/es/src/component/TranscriptionView.js +190 -179
- package/dist/es/src/component/Watermark.js +21 -30
- package/dist/es/src/component/XMLView.js +60 -82
- package/dist/es/src/hooks/useIsWidthUp.js +9 -7
- package/dist/es/src/icons/ByIcon.js +16 -16
- package/dist/es/src/icons/CcIcon.js +16 -16
- package/dist/es/src/icons/NcIcon.js +16 -16
- package/dist/es/src/icons/SaIcon.js +16 -16
- package/dist/es/src/icons/SideMenuIconLeft.js +30 -38
- package/dist/es/src/icons/SideMenuIconRight.js +32 -38
- package/dist/es/src/index.js +21 -20
- package/dist/es/src/lib/copyObject.js +3 -2
- package/dist/es/src/lib/registerServiceWorker.js +77 -54
- package/dist/es/src/model/DocumentHelper.js +7 -6
- package/dist/es/src/model/Folio.js +68 -146
- package/dist/es/src/model/ReduxStore.js +32 -78
- package/dist/es/src/model/folioLayout.js +275 -280
- package/dist/es/src/saga/RouteListenerSaga.js +89 -203
- package/dist/es/src/saga/rootSaga.js +9 -16
- package/dist/es/src/scss/_imageView.scss +1 -1
- package/dist/es/src/scss/_navigation.scss +1 -1
- package/dist/es/src/scss/editioncrafter.scss +1 -1
- package/dist/style.css +1 -0
- package/package.json +36 -50
- package/dist/editioncrafter.min.js +0 -2
- package/dist/editioncrafter.min.js.LICENSE.txt +0 -144
|
@@ -1,265 +1,200 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
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
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
className
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
236
|
-
value: function hasMore() {
|
|
237
|
-
return this.state.visibleThumbs.length !== this.state.thumbs.length;
|
|
160
|
+
else {
|
|
161
|
+
visibleThumbs = thumbs
|
|
238
162
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
|
|
259
|
-
|
|
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
|
-
|
|
199
|
+
|
|
200
|
+
export default connect(mapStateToProps)(ImageGridView)
|