dtable-ui-component 0.2.2 → 0.2.4

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.
@@ -11,22 +11,20 @@ var ImagesLazyLoad = /*#__PURE__*/function (_React$Component) {
11
11
 
12
12
  var _super = _createSuper(ImagesLazyLoad);
13
13
 
14
- function ImagesLazyLoad(props) {
14
+ function ImagesLazyLoad(_props) {
15
15
  var _this;
16
16
 
17
17
  _classCallCheck(this, ImagesLazyLoad);
18
18
 
19
- _this = _super.call(this, props);
19
+ _this = _super.call(this, _props);
20
20
 
21
21
  _this.componentDidMount = function () {
22
- var images = _this.state.images;
23
-
24
- _this.lazyLoadImages(images);
22
+ _this.lazyLoadImages(_this.props);
25
23
  };
26
24
 
27
25
  _this.componentWillReceiveProps = function (nextProps) {
28
26
  if (nextProps.images.toString() !== _this.props.images.toString()) {
29
- _this.lazyLoadImages(nextProps.images);
27
+ _this.lazyLoadImages(nextProps);
30
28
  }
31
29
  };
32
30
 
@@ -37,29 +35,36 @@ var ImagesLazyLoad = /*#__PURE__*/function (_React$Component) {
37
35
  };
38
36
  };
39
37
 
40
- _this.lazyLoadImages = function (images) {
38
+ _this.lazyLoadImages = function (props) {
39
+ var images = props.images;
40
+
41
41
  if (!Array.isArray(images) || images.length === 0) {
42
42
  return;
43
43
  }
44
44
 
45
- var server = _this.props.server;
46
- images.forEach(function (item) {
47
- var url = getImageThumbnailUrl(item, server);
48
-
49
- _this.lazyLoadImage(url, function (image) {
50
- var _this$state = _this.state,
51
- loadedCount = _this$state.loadedCount,
52
- loadedImages = _this$state.loadedImages;
53
-
54
- _this.setState({
55
- loadedCount: loadedCount + 1,
56
- loadedImages: loadedImages.concat(image)
57
- });
58
- }, function () {
59
- var loadedCount = _this.state.loadedCount;
60
-
61
- _this.setState({
62
- loadedCount: loadedCount + 1
45
+ _this.setState({
46
+ images: images,
47
+ loadedCount: 0
48
+ }, function () {
49
+ var server = _this.props.server;
50
+ images.forEach(function (item) {
51
+ var url = getImageThumbnailUrl(item, server);
52
+
53
+ _this.lazyLoadImage(url, function (image) {
54
+ var _this$state = _this.state,
55
+ loadedCount = _this$state.loadedCount,
56
+ loadedImages = _this$state.loadedImages;
57
+
58
+ _this.setState({
59
+ loadedCount: loadedCount + 1,
60
+ loadedImages: loadedImages.concat(image)
61
+ });
62
+ }, function () {
63
+ var loadedCount = _this.state.loadedCount;
64
+
65
+ _this.setState({
66
+ loadedCount: loadedCount + 1
67
+ });
63
68
  });
64
69
  });
65
70
  });
@@ -95,7 +100,7 @@ var ImagesLazyLoad = /*#__PURE__*/function (_React$Component) {
95
100
  };
96
101
 
97
102
  _this.state = {
98
- images: props.images,
103
+ images: _props.images,
99
104
  loadedImages: [],
100
105
  loadedCount: 0
101
106
  };
@@ -136,7 +136,9 @@ var ImageFormatter = /*#__PURE__*/function (_React$Component) {
136
136
  downloadImage: this.downloadImage,
137
137
  onRotateImage: readOnly ? null : this.onRotateImage,
138
138
  readOnly: readOnly,
139
- server: server
139
+ server: server,
140
+ moveToPrevRowImage: this.props.moveToPrevRowImage,
141
+ moveToNextRowImage: this.props.moveToNextRowImage
140
142
  }));
141
143
  }
142
144
  }]);
@@ -13,7 +13,9 @@ function ImagePreviewerLightbox(props) {
13
13
  downloadImage = props.downloadImage,
14
14
  onRotateImage = props.onRotateImage,
15
15
  readOnly = props.readOnly,
16
- server = props.server;
16
+ server = props.server,
17
+ moveToPrevRowImage = props.moveToPrevRowImage,
18
+ moveToNextRowImage = props.moveToNextRowImage;
17
19
  var imageItemsLength = imageItems.length;
18
20
  var URL = imageItems[imageIndex];
19
21
  var imageTitle = URL ? decodeURI(URL.slice(URL.lastIndexOf('/') + 1)) : ''; // svg image is vectorgraph and can't rotate, external image can't rotate
@@ -28,6 +30,24 @@ function ImagePreviewerLightbox(props) {
28
30
  }, "(", imageIndex + 1, "/", imageItemsLength, ")"));
29
31
  var toolbarButtons = [];
30
32
 
33
+ if (moveToPrevRowImage) {
34
+ toolbarButtons.push( /*#__PURE__*/React.createElement("button", {
35
+ className: "dtable-font dtable-icon-retract",
36
+ onClick: function onClick() {
37
+ moveToPrevRowImage();
38
+ }
39
+ }));
40
+ }
41
+
42
+ if (moveToNextRowImage) {
43
+ toolbarButtons.push( /*#__PURE__*/React.createElement("button", {
44
+ className: "dtable-font dtable-icon-display",
45
+ onClick: function onClick() {
46
+ moveToNextRowImage();
47
+ }
48
+ }));
49
+ }
50
+
31
51
  if (!readOnly && deleteImage) {
32
52
  toolbarButtons.push( /*#__PURE__*/React.createElement("button", {
33
53
  className: "dtable-font dtable-icon-delete",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "0.0.9",