react-ui-basics 0.0.158 → 0.0.161
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/Animated.js +11 -10
- package/AutocompleteSelect.js +62 -63
- package/Button.js +21 -22
- package/Checkbox.js +7 -8
- package/CircleProgress.js +5 -6
- package/CommonFields.js +23 -15
- package/DNDContainer.js +47 -48
- package/DNDDraggable.js +8 -9
- package/DNDDroppable.js +8 -9
- package/Dialog.js +16 -17
- package/DropFileInput.js +4 -5
- package/DroppableHorizontalList.js +26 -27
- package/DroppableList.js +26 -27
- package/Dropzone.js +17 -18
- package/FilteredList.js +40 -41
- package/FloatingActionButton.js +4 -5
- package/FormUploadProgress.js +8 -9
- package/ImageGallery.js +121 -122
- package/MaterialIcon.js +5 -6
- package/Modal.js +17 -18
- package/ModalMenu.js +10 -11
- package/ReactConstants.d.ts +2 -0
- package/ReactConstants.js +2 -1
- package/ReactCreateElement.js +2 -0
- package/ReadyListener.js +9 -10
- package/Scrollable.js +50 -51
- package/ScrollableTable.js +4 -5
- package/Size.js +5 -6
- package/Snackbar.js +7 -8
- package/SpinningProgress.js +5 -6
- package/Switch.js +14 -15
- package/Table.js +26 -27
- package/TextField.js +17 -18
- package/Tools.d.ts +1 -0
- package/Tools.js +14 -12
- package/_virtual/_commonjsHelpers.js +2 -0
- package/_virtual/_react.js +2 -0
- package/_virtual/react-jsx-runtime.development.js +2 -0
- package/bundle.css +446 -446
- package/index.js +3 -3
- package/package.json +1 -1
- package/router/HistoryTools.js +2 -0
- package/router/Link.js +5 -6
- package/router/NavLink.js +5 -6
- package/router/Route.js +15 -16
- package/router/index.js +2 -3
- package/store/ProxyTools.js +2 -3
- package/store/Store.js +2 -3
- package/Animated.js.map +0 -1
- package/AutocompleteSelect.js.map +0 -1
- package/Button.js.map +0 -1
- package/Checkbox.js.map +0 -1
- package/CircleProgress.js.map +0 -1
- package/CommonFields.js.map +0 -1
- package/DNDContainer.js.map +0 -1
- package/DNDDraggable.js.map +0 -1
- package/DNDDroppable.js.map +0 -1
- package/Dialog.js.map +0 -1
- package/DropFileInput.js.map +0 -1
- package/DroppableHorizontalList.js.map +0 -1
- package/DroppableList.js.map +0 -1
- package/Dropzone.js.map +0 -1
- package/FilteredList.js.map +0 -1
- package/FloatingActionButton.js.map +0 -1
- package/FormUploadProgress.js.map +0 -1
- package/ImageGallery.js.map +0 -1
- package/MaterialIcon.js.map +0 -1
- package/Modal.js.map +0 -1
- package/ModalMenu.js.map +0 -1
- package/ReactConstants.js.map +0 -1
- package/ReactCreateElement.js.map +0 -1
- package/ReadyListener.js.map +0 -1
- package/Scrollable.js.map +0 -1
- package/ScrollableTable.js.map +0 -1
- package/Size.js.map +0 -1
- package/Snackbar.js.map +0 -1
- package/SpinningProgress.js.map +0 -1
- package/Switch.js.map +0 -1
- package/Table.js.map +0 -1
- package/TextField.js.map +0 -1
- package/Tools.js.map +0 -1
- package/index.js.map +0 -1
package/ImageGallery.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import ReactConstants from "./ReactConstants";
|
|
2
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
1
3
|
import { createClass as _createClass, classCallCheck as _classCallCheck, objectSpread2 as _objectSpread2, defineProperty as _defineProperty, inherits as _inherits, createSuper as _createSuper, assertThisInitialized as _assertThisInitialized, slicedToArray as _slicedToArray, extends as _extends, toConsumableArray as _toConsumableArray } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
3
4
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
5
6
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
6
|
-
import {className as __className} from "./ReactConstants";
|
|
7
|
-
import {children as __children} from "./ReactConstants";
|
|
8
7
|
import React from 'react';
|
|
9
8
|
import ReactCreateElement from './ReactCreateElement.js';
|
|
10
9
|
import Animated from './Animated.js';
|
|
@@ -26,8 +25,8 @@ var previewWidth = previewRatio * previewHeight;
|
|
|
26
25
|
var previewPadding = 8;
|
|
27
26
|
var previewsHeight = previewHeight + 15;
|
|
28
27
|
var calculatePosition = function calculatePosition(it, ratio, width, height, previewsHeight, embedded, container) {
|
|
29
|
-
var windowWidth = embedded ? container
|
|
30
|
-
var windowHeight = embedded ? container
|
|
28
|
+
var windowWidth = embedded ? __clientWidth(container) : min(DOCUMENT.body.clientWidth, WINDOW.innerWidth);
|
|
29
|
+
var windowHeight = embedded ? __clientHeight(container) : min(DOCUMENT.body.clientHeight, WINDOW.innerHeight);
|
|
31
30
|
var offset = it.offset;
|
|
32
31
|
if (offset == null) offset = embedded ? 0 : windowHeight * 0.03;
|
|
33
32
|
var offsetTop = it.offsetTop;
|
|
@@ -117,7 +116,7 @@ var Actions = _createClass(function Actions() {
|
|
|
117
116
|
Actions.replaceImages = function (images) {
|
|
118
117
|
return function (dispatch, getState) {
|
|
119
118
|
var state = getState();
|
|
120
|
-
var length = images
|
|
119
|
+
var length = __length(images);
|
|
121
120
|
var nextState = _objectSpread2({}, state);
|
|
122
121
|
nextState.images = images.map(function (item) {
|
|
123
122
|
var image = state.images.find(function (it) {
|
|
@@ -127,14 +126,14 @@ Actions.replaceImages = function (images) {
|
|
|
127
126
|
var it = _objectSpread2({}, item);
|
|
128
127
|
var el = it.el;
|
|
129
128
|
if (el) {
|
|
130
|
-
var rect = el
|
|
131
|
-
var fromWidth = el
|
|
132
|
-
var fromHeight = el
|
|
133
|
-
it.fromLeftPx = toPx(rect
|
|
134
|
-
it.fromTopPx = toPx(rect
|
|
129
|
+
var rect = el.getBoundingClientRect();
|
|
130
|
+
var fromWidth = __clientWidth(el);
|
|
131
|
+
var fromHeight = __clientHeight(el);
|
|
132
|
+
it.fromLeftPx = toPx(__left(rect));
|
|
133
|
+
it.fromTopPx = toPx(__top(rect));
|
|
135
134
|
it.fromWidthPx = toPx(fromWidth);
|
|
136
135
|
var ratio = fromWidth / fromHeight;
|
|
137
|
-
calculatePosition(it, ratio, el.naturalWidth || el
|
|
136
|
+
calculatePosition(it, ratio, el.naturalWidth || __width(el), el.naturalHeight || __height(el), withPreviews ? previewsHeight : 0, embedded, container);
|
|
138
137
|
} else {
|
|
139
138
|
it.toLeft = 100;
|
|
140
139
|
it.toTop = 100;
|
|
@@ -142,7 +141,7 @@ Actions.replaceImages = function (images) {
|
|
|
142
141
|
if (!it.toWidth || !it.toHeight || !el) Actions.loadPreview(it)(dispatch);
|
|
143
142
|
return it;
|
|
144
143
|
});
|
|
145
|
-
nextState.previews
|
|
144
|
+
nextState.previews.width = min(length, 5) * previewWidth + min(length - 1, 4) * previewPadding;
|
|
146
145
|
nextState.previews.totalWidth = toPx(length * previewWidth + (length - 1) * previewPadding);
|
|
147
146
|
nextState.previews.images = nextState.images.map(function (item) {
|
|
148
147
|
var preview = state.previews.images.find(function (it) {
|
|
@@ -151,8 +150,8 @@ Actions.replaceImages = function (images) {
|
|
|
151
150
|
if (preview) return preview;
|
|
152
151
|
var el = item.el;
|
|
153
152
|
if (!el) return {};
|
|
154
|
-
var width = el
|
|
155
|
-
var height = el
|
|
153
|
+
var width = __clientWidth(el);
|
|
154
|
+
var height = __clientHeight(el);
|
|
156
155
|
return calculatePreview(width, height, el.src);
|
|
157
156
|
});
|
|
158
157
|
dispatch({
|
|
@@ -164,7 +163,7 @@ Actions.replaceImages = function (images) {
|
|
|
164
163
|
Actions.show = function (gallery) {
|
|
165
164
|
return function (dispatch) {
|
|
166
165
|
var images = gallery.images;
|
|
167
|
-
var length = images
|
|
166
|
+
var length = __length(images);
|
|
168
167
|
var withPreviews = length > 1 && (gallery.withPreviews === UNDEFINED || !!gallery.withPreviews);
|
|
169
168
|
var container = gallery.container;
|
|
170
169
|
var embedded = gallery.embedded;
|
|
@@ -178,14 +177,14 @@ Actions.show = function (gallery) {
|
|
|
178
177
|
var it = _objectSpread2({}, item);
|
|
179
178
|
var el = it.el;
|
|
180
179
|
if (el) {
|
|
181
|
-
var rect = el
|
|
182
|
-
var fromWidth = el
|
|
183
|
-
var fromHeight = el
|
|
184
|
-
it.fromLeftPx = toPx(rect
|
|
185
|
-
it.fromTopPx = toPx(rect
|
|
180
|
+
var rect = el.getBoundingClientRect();
|
|
181
|
+
var fromWidth = __clientWidth(el);
|
|
182
|
+
var fromHeight = __clientHeight(el);
|
|
183
|
+
it.fromLeftPx = toPx(__left(rect));
|
|
184
|
+
it.fromTopPx = toPx(__top(rect));
|
|
186
185
|
it.fromWidthPx = toPx(fromWidth);
|
|
187
186
|
var ratio = fromWidth / fromHeight;
|
|
188
|
-
calculatePosition(it, ratio, el.naturalWidth || el
|
|
187
|
+
calculatePosition(it, ratio, el.naturalWidth || __width(el), el.naturalHeight || __height(el), withPreviews ? previewsHeight : 0, embedded, container);
|
|
189
188
|
} else {
|
|
190
189
|
it.toLeft = 100;
|
|
191
190
|
it.toTop = 100;
|
|
@@ -201,8 +200,8 @@ Actions.show = function (gallery) {
|
|
|
201
200
|
images: images.map(function (it) {
|
|
202
201
|
var el = it.el;
|
|
203
202
|
if (!el) return {};
|
|
204
|
-
var width = el
|
|
205
|
-
var height = el
|
|
203
|
+
var width = __clientWidth(el);
|
|
204
|
+
var height = __clientHeight(el);
|
|
206
205
|
return calculatePreview(width, height, el.src);
|
|
207
206
|
})
|
|
208
207
|
}
|
|
@@ -219,7 +218,7 @@ Actions.show = function (gallery) {
|
|
|
219
218
|
}
|
|
220
219
|
}
|
|
221
220
|
});
|
|
222
|
-
data.previews.scroll = calculatePreviewsScroll(index, length, data.previews
|
|
221
|
+
data.previews.scroll = calculatePreviewsScroll(index, length, data.previews.width);
|
|
223
222
|
dispatch({
|
|
224
223
|
type: ACTION_IMAGE_GALLERY_SHOW,
|
|
225
224
|
data: data
|
|
@@ -274,7 +273,7 @@ Actions.loadPreview = function (item) {
|
|
|
274
273
|
};
|
|
275
274
|
};
|
|
276
275
|
var reducers = (_reducers = {}, _defineProperty(_reducers, ACTION_IMAGE_GALLERY_SHOW, function (state, action) {
|
|
277
|
-
return _objectSpread2(_objectSpread2({}, action
|
|
276
|
+
return _objectSpread2(_objectSpread2({}, __data(action)), {}, {
|
|
278
277
|
open: true
|
|
279
278
|
});
|
|
280
279
|
}), _defineProperty(_reducers, ACTION_IMAGE_GALLERY_CLOSE, function (state, action) {
|
|
@@ -286,11 +285,11 @@ var reducers = (_reducers = {}, _defineProperty(_reducers, ACTION_IMAGE_GALLERY_
|
|
|
286
285
|
var result = _objectSpread2(_objectSpread2({}, state), {}, {
|
|
287
286
|
images: images
|
|
288
287
|
});
|
|
289
|
-
for (var i = 0; i < images
|
|
290
|
-
if (!images[i]
|
|
288
|
+
for (var i = 0; i < __length(images); i++) {
|
|
289
|
+
if (!__width(images[i]) && !images[i].fromWidthPx) continue;
|
|
291
290
|
var it = _objectSpread2({}, images[i]);
|
|
292
|
-
var width = it
|
|
293
|
-
var height = it
|
|
291
|
+
var width = __width(it) || Number.parseInt(it.fromWidthPx);
|
|
292
|
+
var height = __height(it) || Number.parseInt(it.fromHeightPx);
|
|
294
293
|
calculatePosition(it, width / height, width, height, result.previews.show ? previewsHeight : 0, state.embedded, state.container);
|
|
295
294
|
images[i] = it;
|
|
296
295
|
}
|
|
@@ -305,8 +304,8 @@ var reducers = (_reducers = {}, _defineProperty(_reducers, ACTION_IMAGE_GALLERY_
|
|
|
305
304
|
var index = images.findIndex(function (it) {
|
|
306
305
|
return it.id === item.id;
|
|
307
306
|
});
|
|
308
|
-
var width = image
|
|
309
|
-
var height = image
|
|
307
|
+
var width = __width(image);
|
|
308
|
+
var height = __height(image);
|
|
310
309
|
var it = _objectSpread2(_objectSpread2({}, images[index]), {}, {
|
|
311
310
|
loaded: true,
|
|
312
311
|
width: width,
|
|
@@ -326,11 +325,11 @@ var reducers = (_reducers = {}, _defineProperty(_reducers, ACTION_IMAGE_GALLERY_
|
|
|
326
325
|
return it.id === item.id;
|
|
327
326
|
});
|
|
328
327
|
var it = _objectSpread2({}, images[index]);
|
|
329
|
-
if (!it.toWidth || !it.toHeight) calculatePosition(it, image
|
|
328
|
+
if (!it.toWidth || !it.toHeight) calculatePosition(it, __width(image) / __height(image), __width(image), __height(image), result.previews.show ? previewsHeight : 0, state.embedded, state.container);
|
|
330
329
|
images[index] = it;
|
|
331
330
|
var previewImages = _toConsumableArray(state.previews.images);
|
|
332
331
|
result.previews.images = previewImages;
|
|
333
|
-
var preview = calculatePreview(image
|
|
332
|
+
var preview = calculatePreview(__width(image), __height(image), image.src);
|
|
334
333
|
previewImages[index] = preview;
|
|
335
334
|
return result;
|
|
336
335
|
}), _reducers);
|
|
@@ -354,7 +353,7 @@ var big = function big(it, index, i, shift, length, previous) {
|
|
|
354
353
|
if (index !== i) {
|
|
355
354
|
var width = WINDOW.innerWidth;
|
|
356
355
|
var additionalOffset = it.toLeft < 0 ? -it.toLeft : 0;
|
|
357
|
-
if (i < index) styles
|
|
356
|
+
if (i < index) styles.left = toPx(it.toLeft - width - additionalOffset + (i + 1 === index ? shift : 0));else styles.left = toPx(it.toLeft + width + additionalOffset + (i - 1 === index ? shift : 0));
|
|
358
357
|
}
|
|
359
358
|
return styles;
|
|
360
359
|
};
|
|
@@ -375,7 +374,7 @@ var ImageGallery = function (_React$Component) {
|
|
|
375
374
|
zoomed = _stateGSs2[3],
|
|
376
375
|
previewScroll = _stateGSs2[4];
|
|
377
376
|
var props = propsGetter(that);
|
|
378
|
-
that[
|
|
377
|
+
that[ReactConstants[2]] = function (prevProps, prevState, snapshot) {
|
|
379
378
|
if (props().open !== prevProps.open && !props().open) {
|
|
380
379
|
setTimeout(function () {
|
|
381
380
|
shift(0);
|
|
@@ -388,7 +387,7 @@ var ImageGallery = function (_React$Component) {
|
|
|
388
387
|
var indexValue = index() !== UNDEFINED ? index() : props().index;
|
|
389
388
|
var image = images[indexValue];
|
|
390
389
|
if (!image) {
|
|
391
|
-
var i = images
|
|
390
|
+
var i = __length(images) - 1;
|
|
392
391
|
if (i === -1) {
|
|
393
392
|
if (prevProps.images !== images) {
|
|
394
393
|
onClose();
|
|
@@ -403,16 +402,16 @@ var ImageGallery = function (_React$Component) {
|
|
|
403
402
|
var resizeListener = debounce(function () {
|
|
404
403
|
props().open && props().recalculate();
|
|
405
404
|
}, 100);
|
|
406
|
-
that[
|
|
405
|
+
that[ReactConstants[0]] = function () {
|
|
407
406
|
addEventListener(WINDOW, 'resize', resizeListener);
|
|
408
407
|
};
|
|
409
|
-
that[
|
|
408
|
+
that[ReactConstants[1]] = function () {
|
|
410
409
|
removeEventListener(WINDOW, 'resize', resizeListener);
|
|
411
410
|
};
|
|
412
411
|
var onClose = function onClose() {
|
|
413
412
|
resetZoom();
|
|
414
413
|
moveListenerAdded = false;
|
|
415
|
-
_this.
|
|
414
|
+
__props(_this).close();
|
|
416
415
|
};
|
|
417
416
|
var onKeyDown = function onKeyDown(e) {
|
|
418
417
|
var keyCode = e.keyCode;
|
|
@@ -452,22 +451,22 @@ var ImageGallery = function (_React$Component) {
|
|
|
452
451
|
var resetZoom = function resetZoom() {
|
|
453
452
|
if (!zoomed()) return;
|
|
454
453
|
zoomed(false);
|
|
455
|
-
zoomedImage
|
|
456
|
-
zoomedImage
|
|
457
|
-
zoomedImage
|
|
458
|
-
zoomedImage
|
|
454
|
+
__style(zoomedImage).width = defaultWidth;
|
|
455
|
+
__style(zoomedImage).left = defaultLeft;
|
|
456
|
+
__style(zoomedImage).top = defaultTop;
|
|
457
|
+
__style(zoomedImage).transition = null;
|
|
459
458
|
touchpadStarted = null;
|
|
460
459
|
};
|
|
461
460
|
var initZoom = function initZoom() {
|
|
462
461
|
zoomed(true);
|
|
463
|
-
defaultWidth = zoomedImage
|
|
464
|
-
defaultLeft = zoomedImage
|
|
465
|
-
defaultTop = zoomedImage
|
|
462
|
+
defaultWidth = __style(zoomedImage).width;
|
|
463
|
+
defaultLeft = __style(zoomedImage).left;
|
|
464
|
+
defaultTop = __style(zoomedImage).top;
|
|
466
465
|
};
|
|
467
466
|
var initTouchpadDragging = function initTouchpadDragging() {
|
|
468
|
-
oldLeft = Number.parseFloat(zoomedImage
|
|
469
|
-
oldTop = Number.parseFloat(zoomedImage
|
|
470
|
-
zoomedImage
|
|
467
|
+
oldLeft = Number.parseFloat(__style(zoomedImage).left);
|
|
468
|
+
oldTop = Number.parseFloat(__style(zoomedImage).top);
|
|
469
|
+
__style(zoomedImage).transition = 'none';
|
|
471
470
|
touchpadStarted = true;
|
|
472
471
|
};
|
|
473
472
|
var onWheel = function onWheel(e) {
|
|
@@ -479,43 +478,43 @@ var ImageGallery = function (_React$Component) {
|
|
|
479
478
|
if (e.ctrlKey) {
|
|
480
479
|
var diff = e.deltaY * 0.005;
|
|
481
480
|
var newZoom = Math.min(Math.max(zoomValue + diff, 0.5), 10);
|
|
482
|
-
var zoomX = e
|
|
481
|
+
var zoomX = __pageX(e);
|
|
483
482
|
oldLeft = zoomX - (zoomX - oldLeft) * newZoom / zoomValue;
|
|
484
|
-
var zoomY = e
|
|
483
|
+
var zoomY = __pageY(e);
|
|
485
484
|
oldTop = zoomY - (zoomY - oldTop) * newZoom / zoomValue;
|
|
486
485
|
zoomValue = newZoom;
|
|
487
|
-
zoomedImage
|
|
486
|
+
__style(zoomedImage).width = zoomValue * 100 + '%';
|
|
488
487
|
} else {
|
|
489
488
|
oldLeft += e.deltaX * 0.5;
|
|
490
489
|
oldTop += e.deltaY * 0.5;
|
|
491
490
|
}
|
|
492
|
-
zoomedImage
|
|
493
|
-
zoomedImage
|
|
491
|
+
__style(zoomedImage).left = oldLeft + 'px';
|
|
492
|
+
__style(zoomedImage).top = oldTop + 'px';
|
|
494
493
|
};
|
|
495
494
|
var moveListenerAdded;
|
|
496
495
|
var onTouchStart = function onTouchStart(e) {
|
|
497
496
|
e.swipeProcessed = false;
|
|
498
497
|
if (e.button === 2) return;
|
|
499
498
|
var touches = e.touches || [{
|
|
500
|
-
pageX: e
|
|
501
|
-
pageY: e
|
|
499
|
+
pageX: __pageX(e),
|
|
500
|
+
pageY: __pageY(e)
|
|
502
501
|
}];
|
|
503
|
-
zoomedImage = e
|
|
502
|
+
zoomedImage = __target(e);
|
|
504
503
|
zoomedImage = zoomedImage.tagName.toLowerCase() === 'img' ? zoomedImage.parentElement : zoomedImage;
|
|
505
|
-
oldLeft = Number.parseFloat(zoomedImage
|
|
506
|
-
oldTop = Number.parseFloat(zoomedImage
|
|
504
|
+
oldLeft = Number.parseFloat(__style(zoomedImage).left);
|
|
505
|
+
oldTop = Number.parseFloat(__style(zoomedImage).top);
|
|
507
506
|
if (zoomed()) {
|
|
508
|
-
zoomedImage
|
|
507
|
+
__style(zoomedImage).transition = 'none';
|
|
509
508
|
}
|
|
510
509
|
if (!moveListenerAdded) {
|
|
511
510
|
addEventListener(_this.gallery, 'touchmove', onTouchMove, false);
|
|
512
511
|
moveListenerAdded = true;
|
|
513
512
|
}
|
|
514
|
-
if (touches
|
|
513
|
+
if (touches.length === 2) {
|
|
515
514
|
if (zoomed()) zoomValueStarted = zoomValue;else if (!props().embedded) {
|
|
516
515
|
initZoom();
|
|
517
|
-
zoomedImage
|
|
518
|
-
zoomValueStarted = zoomValue = Number.parseFloat(zoomedImage
|
|
516
|
+
__style(zoomedImage).transition = 'none';
|
|
517
|
+
zoomValueStarted = zoomValue = Number.parseFloat(__style(zoomedImage).width) / WINDOW.innerWidth;
|
|
519
518
|
}
|
|
520
519
|
}
|
|
521
520
|
touchesStart = touches;
|
|
@@ -526,25 +525,25 @@ var ImageGallery = function (_React$Component) {
|
|
|
526
525
|
var distance = function distance(touches) {
|
|
527
526
|
var a = touches[0];
|
|
528
527
|
var b = touches[1];
|
|
529
|
-
return Math.sqrt(power2(a
|
|
528
|
+
return Math.sqrt(power2(__pageX(a) - __pageX(b)) + power2(__pageY(a) - __pageY(b)));
|
|
530
529
|
};
|
|
531
530
|
var center = function center(touches) {
|
|
532
531
|
var a = touches[0];
|
|
533
532
|
var b = touches[1];
|
|
534
533
|
return {
|
|
535
|
-
x: (a
|
|
536
|
-
y: (a
|
|
534
|
+
x: (__pageX(a) + __pageX(b)) / 2,
|
|
535
|
+
y: (__pageY(a) + __pageY(b)) / 2
|
|
537
536
|
};
|
|
538
537
|
};
|
|
539
538
|
var onTouchMove = function onTouchMove(e) {
|
|
540
539
|
if (!touchesStart) return;
|
|
541
540
|
var touches = e.touches || [{
|
|
542
|
-
pageX: e
|
|
543
|
-
pageY: e
|
|
541
|
+
pageX: __pageX(e),
|
|
542
|
+
pageY: __pageY(e)
|
|
544
543
|
}];
|
|
545
544
|
if (zoomed()) {
|
|
546
545
|
preventDefault(e);
|
|
547
|
-
if (touches
|
|
546
|
+
if (touches.length === 2) {
|
|
548
547
|
var diff = distance(touches) / distance(touchesStart);
|
|
549
548
|
zoomValue = Math.min(Math.max(zoomValueStarted * diff, 0.5), 10);
|
|
550
549
|
var zoomedAt = center(touchesStart);
|
|
@@ -552,24 +551,24 @@ var ImageGallery = function (_React$Component) {
|
|
|
552
551
|
var newLeft = zoomX - (zoomX - oldLeft) * zoomValue / zoomValueStarted;
|
|
553
552
|
var zoomY = zoomedAt.y;
|
|
554
553
|
var newTop = zoomY - (zoomY - oldTop) * zoomValue / zoomValueStarted;
|
|
555
|
-
zoomedImage
|
|
556
|
-
zoomedImage
|
|
557
|
-
zoomedImage
|
|
554
|
+
__style(zoomedImage).left = newLeft + 'px';
|
|
555
|
+
__style(zoomedImage).top = newTop + 'px';
|
|
556
|
+
__style(zoomedImage).width = zoomValue * 100 + '%';
|
|
558
557
|
return;
|
|
559
558
|
} else {
|
|
560
559
|
var _touch = touches[0];
|
|
561
560
|
var _touchStart = touchesStart[0];
|
|
562
|
-
var _newLeft = oldLeft + _touch
|
|
563
|
-
var _newTop = oldTop + _touch
|
|
564
|
-
zoomedImage
|
|
565
|
-
zoomedImage
|
|
561
|
+
var _newLeft = oldLeft + __pageX(_touch) - __pageX(_touchStart);
|
|
562
|
+
var _newTop = oldTop + __pageY(_touch) - __pageY(_touchStart);
|
|
563
|
+
__style(zoomedImage).left = _newLeft + 'px';
|
|
564
|
+
__style(zoomedImage).top = _newTop + 'px';
|
|
566
565
|
return;
|
|
567
566
|
}
|
|
568
567
|
}
|
|
569
|
-
if (touches
|
|
568
|
+
if (__length(touches) > 1 || zoomed()) return;
|
|
570
569
|
var touch = touches[0];
|
|
571
570
|
var touchStart = touchesStart[0];
|
|
572
|
-
shift(touch
|
|
571
|
+
shift(__pageX(touch) - __pageX(touchStart));
|
|
573
572
|
};
|
|
574
573
|
var onTouchEnd = function onTouchEnd(e) {
|
|
575
574
|
if (!touchesStart) return;
|
|
@@ -581,13 +580,13 @@ var ImageGallery = function (_React$Component) {
|
|
|
581
580
|
return;
|
|
582
581
|
}
|
|
583
582
|
var touches = e.changedTouches || [{
|
|
584
|
-
pageX: e
|
|
585
|
-
pageY: e
|
|
583
|
+
pageX: __pageX(e),
|
|
584
|
+
pageY: __pageY(e)
|
|
586
585
|
}];
|
|
587
586
|
var touchEnd = touches[0];
|
|
588
587
|
var touchStart = touchesStart[0];
|
|
589
|
-
var distX = touchEnd
|
|
590
|
-
var distY = touchEnd
|
|
588
|
+
var distX = __pageX(touchEnd) - __pageX(touchStart);
|
|
589
|
+
var distY = __pageY(touchEnd) - __pageY(touchStart);
|
|
591
590
|
touchesStart = UNDEFINED;
|
|
592
591
|
shift(0);
|
|
593
592
|
var minDistance = 20;
|
|
@@ -604,14 +603,14 @@ var ImageGallery = function (_React$Component) {
|
|
|
604
603
|
previews = _props.previews;
|
|
605
604
|
index(i);
|
|
606
605
|
previous(prev);
|
|
607
|
-
previewScroll(calculatePreviewsScroll(i, previews.images
|
|
606
|
+
previewScroll(calculatePreviewsScroll(i, previews.images.length, __width(previews)));
|
|
608
607
|
};
|
|
609
608
|
var left = function left(e) {
|
|
610
609
|
if (zoomed()) return;
|
|
611
610
|
preventDefault(e);
|
|
612
611
|
stopPropagation(e);
|
|
613
612
|
var indexValue = index() !== UNDEFINED ? index() : props().index;
|
|
614
|
-
if (indexValue > 0) scrollTo(indexValue - 1, indexValue);else if (props().loop) scrollTo(props().images
|
|
613
|
+
if (indexValue > 0) scrollTo(indexValue - 1, indexValue);else if (props().loop) scrollTo(props().images.length - 1, indexValue);
|
|
615
614
|
};
|
|
616
615
|
var right = function right(e) {
|
|
617
616
|
if (zoomed()) return;
|
|
@@ -620,23 +619,23 @@ var ImageGallery = function (_React$Component) {
|
|
|
620
619
|
var _props2 = props(),
|
|
621
620
|
images = _props2.images;
|
|
622
621
|
var indexValue = index() !== UNDEFINED ? index() : props().index;
|
|
623
|
-
if (indexValue < images
|
|
622
|
+
if (indexValue < __length(images) - 1) scrollTo(indexValue + 1, indexValue);else if (props().loop) scrollTo(0, indexValue);
|
|
624
623
|
};
|
|
625
624
|
that.scrollTo = scrollTo;
|
|
626
|
-
that
|
|
625
|
+
that.left = left;
|
|
627
626
|
that.right = right;
|
|
628
627
|
var animatedRoundButton = function animatedRoundButton(show, className, onClick, icon) {
|
|
629
628
|
return ReactCreateElement(Animated, {
|
|
630
629
|
value: show
|
|
631
630
|
}, ReactCreateElement(Button, {
|
|
632
|
-
[
|
|
631
|
+
[ReactConstants[5]]: className,
|
|
633
632
|
onClick: onClick,
|
|
634
633
|
round: true
|
|
635
634
|
}, ReactCreateElement(MaterialIcon, {
|
|
636
635
|
icon: icon
|
|
637
636
|
})));
|
|
638
637
|
};
|
|
639
|
-
that[
|
|
638
|
+
that[ReactConstants[3]] = function () {
|
|
640
639
|
var _props3 = props(),
|
|
641
640
|
open = _props3.open;
|
|
642
641
|
var _props4 = props(),
|
|
@@ -648,16 +647,16 @@ var ImageGallery = function (_React$Component) {
|
|
|
648
647
|
embedded = _props4.embedded,
|
|
649
648
|
loop = _props4.loop,
|
|
650
649
|
_onClick = _props4.onClick,
|
|
651
|
-
children = _props4[
|
|
650
|
+
children = _props4[ReactConstants[4]];
|
|
652
651
|
var indexValue = index() !== UNDEFINED ? index() : props().index;
|
|
653
|
-
var length = images
|
|
652
|
+
var length = __length(images);
|
|
654
653
|
var isZoomed = zoomed();
|
|
655
654
|
var shiftValue = shift() || 0;
|
|
656
655
|
previous();
|
|
657
656
|
return ReactCreateElement(Animated, {
|
|
658
657
|
value: open
|
|
659
658
|
}, ReactCreateElement("div", {
|
|
660
|
-
[
|
|
659
|
+
[ReactConstants[5]]: classNames('ImageGallery', embedded && 'embedded', isZoomed && 'zoomed'),
|
|
661
660
|
tabIndex: 0,
|
|
662
661
|
ref: function ref(it) {
|
|
663
662
|
return (that.gallery = it) && !embedded && it.focus();
|
|
@@ -687,24 +686,24 @@ var ImageGallery = function (_React$Component) {
|
|
|
687
686
|
}, ReactCreateElement("div", {
|
|
688
687
|
draggable: false,
|
|
689
688
|
onDoubleClick: function onDoubleClick(e) {
|
|
690
|
-
var img = e
|
|
691
|
-
if (img.naturalWidth === img
|
|
689
|
+
var img = __target(e);
|
|
690
|
+
if (img.naturalWidth === __clientWidth(img) && img.naturalHeight === __clientHeight(img)) return;
|
|
692
691
|
if (!isZoomed) {
|
|
693
692
|
zoomedImage = img.tagName.toLowerCase() === 'img' ? img.parentElement : img;
|
|
694
693
|
initZoom();
|
|
695
694
|
zoomValue = 2;
|
|
696
695
|
var newWidth = WINDOW.innerWidth * 2;
|
|
697
|
-
var oldWidth = Number.parseFloat(zoomedImage
|
|
698
|
-
var _oldLeft = Number.parseFloat(zoomedImage
|
|
699
|
-
var zoomX = e
|
|
696
|
+
var oldWidth = Number.parseFloat(__style(zoomedImage).width);
|
|
697
|
+
var _oldLeft = Number.parseFloat(__style(zoomedImage).left);
|
|
698
|
+
var zoomX = __pageX(e);
|
|
700
699
|
var diff = newWidth / oldWidth;
|
|
701
700
|
var newLeft = zoomX - (zoomX - _oldLeft) * diff;
|
|
702
|
-
var _oldTop = Number.parseFloat(zoomedImage
|
|
703
|
-
var zoomY = e
|
|
701
|
+
var _oldTop = Number.parseFloat(__style(zoomedImage).top);
|
|
702
|
+
var zoomY = __pageY(e);
|
|
704
703
|
var newTop = zoomY - (zoomY - _oldTop) * diff;
|
|
705
|
-
zoomedImage
|
|
706
|
-
zoomedImage
|
|
707
|
-
zoomedImage
|
|
704
|
+
__style(zoomedImage).width = '200%';
|
|
705
|
+
__style(zoomedImage).left = newLeft + 'px';
|
|
706
|
+
__style(zoomedImage).top = newTop + 'px';
|
|
708
707
|
} else {
|
|
709
708
|
resetZoom();
|
|
710
709
|
}
|
|
@@ -713,7 +712,7 @@ var ImageGallery = function (_React$Component) {
|
|
|
713
712
|
!e.swipeProcessed && orNoop(_onClick)(e, it, i);
|
|
714
713
|
},
|
|
715
714
|
key: i,
|
|
716
|
-
[
|
|
715
|
+
[ReactConstants[5]]: classNames('image', touchesStart && 'dragging', isZoomedCurrent && 'zoomed', i === indexValue && 'current')
|
|
717
716
|
}, ReactCreateElement("img", {
|
|
718
717
|
draggable: false,
|
|
719
718
|
src: loaded ? it.url : it.previewUrl,
|
|
@@ -721,29 +720,29 @@ var ImageGallery = function (_React$Component) {
|
|
|
721
720
|
}), ReactCreateElement(Animated, {
|
|
722
721
|
value: !loaded && Math.abs(indexValue - i) <= 1
|
|
723
722
|
}, ReactCreateElement("div", {
|
|
724
|
-
[
|
|
723
|
+
[ReactConstants[5]]: 'spinner'
|
|
725
724
|
}, ReactCreateElement(SpinningProgress, null))), !embedded && animatedRoundButton(open && !isZoomedCurrent, 'close', onClose, 'close'), ReactCreateElement(Animated, {
|
|
726
725
|
value: loaded && !isZoomedCurrent
|
|
727
726
|
}, ReactCreateElement("div", {
|
|
728
|
-
[
|
|
727
|
+
[ReactConstants[5]]: "counter"
|
|
729
728
|
}, indexValue + 1, " / ", length)), !isZoomedCurrent && loaded && it.overlay));
|
|
730
729
|
}), animatedRoundButton(open && length > 1 && (indexValue > 0 || loop) && !isZoomed, 'arrow left', left, 'chevron_left'), animatedRoundButton(open && length > 1 && (indexValue !== length - 1 || loop) && !isZoomed, 'arrow right', right, 'chevron_right'), ReactCreateElement(Animated, {
|
|
731
730
|
value: open && length > 1 && !isZoomed
|
|
732
731
|
}, ReactCreateElement("div", {
|
|
733
|
-
[
|
|
732
|
+
[ReactConstants[5]]: "counter"
|
|
734
733
|
}, indexValue + 1, " / ", length)), indicator && ReactCreateElement(Animated, {
|
|
735
734
|
value: open && length > 1 && !isZoomed
|
|
736
735
|
}, indicator(indexValue, length)), ReactCreateElement(Animated, {
|
|
737
736
|
value: open && previews.show && !isZoomed
|
|
738
737
|
}, ReactCreateElement("div", {
|
|
739
|
-
[
|
|
738
|
+
[ReactConstants[5]]: "previews",
|
|
740
739
|
style: {
|
|
741
|
-
width: previews
|
|
740
|
+
width: __width(previews)
|
|
742
741
|
}
|
|
743
742
|
}, ReactCreateElement("div", {
|
|
744
|
-
[
|
|
743
|
+
[ReactConstants[5]]: "viewport"
|
|
745
744
|
}, ReactCreateElement("div", {
|
|
746
|
-
[
|
|
745
|
+
[ReactConstants[5]]: "container",
|
|
747
746
|
style: {
|
|
748
747
|
width: previews.totalWidth,
|
|
749
748
|
left: toPx(previewScroll() || previews.scroll)
|
|
@@ -751,7 +750,7 @@ var ImageGallery = function (_React$Component) {
|
|
|
751
750
|
}, (previews.images || []).map(function (it, i) {
|
|
752
751
|
return ReactCreateElement("div", {
|
|
753
752
|
key: i,
|
|
754
|
-
[
|
|
753
|
+
[ReactConstants[5]]: classNames('preview', indexValue === i && 'selected'),
|
|
755
754
|
onClick: function onClick() {
|
|
756
755
|
return scrollTo(i, indexValue);
|
|
757
756
|
}
|
|
@@ -759,9 +758,9 @@ var ImageGallery = function (_React$Component) {
|
|
|
759
758
|
src: it.url,
|
|
760
759
|
style: it
|
|
761
760
|
}), ReactCreateElement("div", {
|
|
762
|
-
[
|
|
761
|
+
[ReactConstants[5]]: "border"
|
|
763
762
|
}, ReactCreateElement("div", {
|
|
764
|
-
[
|
|
763
|
+
[ReactConstants[5]]: "line"
|
|
765
764
|
})));
|
|
766
765
|
}))), animatedRoundButton(indexValue > 0 || loop, 'arrow left', left, 'keyboard_arrow_left'), animatedRoundButton(indexValue !== length - 1 || loop, 'arrow right', right, 'keyboard_arrow_right'))), children));
|
|
767
766
|
};
|
|
@@ -785,12 +784,12 @@ var ImageGalleryContainer = function (_React$Component2) {
|
|
|
785
784
|
var that = _assertThisInitialized(_this2);
|
|
786
785
|
that.state = IMAGE_GALLERY_REDUCER(null, {});
|
|
787
786
|
var getState = function getState() {
|
|
788
|
-
return that
|
|
787
|
+
return __state(that);
|
|
789
788
|
};
|
|
790
789
|
var dispatch = function dispatch(action) {
|
|
791
790
|
return setTimeout(function () {
|
|
792
|
-
var state = IMAGE_GALLERY_REDUCER(that
|
|
793
|
-
if (state !== that
|
|
791
|
+
var state = IMAGE_GALLERY_REDUCER(__state(that), action);
|
|
792
|
+
if (state !== __state(that)) that.setState(state);
|
|
794
793
|
}, 0);
|
|
795
794
|
};
|
|
796
795
|
var props = propsGetter(that);
|
|
@@ -820,23 +819,23 @@ var ImageGalleryContainer = function (_React$Component2) {
|
|
|
820
819
|
that.replaceImages = function (images) {
|
|
821
820
|
Actions.replaceImages(images)(dispatch, getState);
|
|
822
821
|
};
|
|
823
|
-
that[
|
|
822
|
+
that[ReactConstants[3]] = function () {
|
|
824
823
|
return ReactCreateElement(ImageGallery, _extends({
|
|
825
824
|
ref: galleryRef
|
|
826
|
-
}, that
|
|
825
|
+
}, __props(that), __state(that), {
|
|
827
826
|
show: show,
|
|
828
827
|
load: load,
|
|
829
828
|
close: close,
|
|
830
829
|
recalculate: recalculate
|
|
831
|
-
}), that
|
|
830
|
+
}), __props(that)[ReactConstants[4]]);
|
|
832
831
|
};
|
|
833
|
-
that[
|
|
832
|
+
that[ReactConstants[0]] = function () {
|
|
834
833
|
props()[embedded] && show(props()[embedded]);
|
|
835
834
|
that.scrollTo = galleryRef().scrollTo;
|
|
836
|
-
that
|
|
835
|
+
that.left = __left(galleryRef());
|
|
837
836
|
that.right = galleryRef().right;
|
|
838
837
|
};
|
|
839
|
-
that[
|
|
838
|
+
that[ReactConstants[2]] = function (prevProps, prevState) {
|
|
840
839
|
isDifferent(prevProps[embedded], props()[embedded]) && props()[embedded] && show(props()[embedded]);
|
|
841
840
|
};
|
|
842
841
|
return _this2;
|