dtable-ui-component 4.3.7 → 4.3.8

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 (120) hide show
  1. package/lib/AutoNumberFormatter/index.js +11 -24
  2. package/lib/ButtonFormatter/index.js +29 -45
  3. package/lib/CTimeFormatter/index.js +17 -32
  4. package/lib/CheckboxEditor/index.js +42 -49
  5. package/lib/CheckboxFormatter/index.js +17 -30
  6. package/lib/CollaboratorEditor/index.js +118 -135
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
  9. package/lib/CollaboratorFormatter/index.js +26 -42
  10. package/lib/CollaboratorItem/index.js +31 -44
  11. package/lib/CreatorFormatter/index.js +24 -40
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
  14. package/lib/DTableCustomizeSelect/index.js +92 -103
  15. package/lib/DTablePopover/index.js +52 -71
  16. package/lib/DTablePopover/utils.js +1 -1
  17. package/lib/DTableRadio/index.js +9 -7
  18. package/lib/DTableSearchInput/index.js +89 -99
  19. package/lib/DTableSearchInput/utils.js +2 -2
  20. package/lib/DTableSelect/dtable-select-label.js +5 -3
  21. package/lib/DTableSelect/index.js +50 -64
  22. package/lib/DTableSelect/utils.js +36 -41
  23. package/lib/DTableSwitch/index.js +7 -5
  24. package/lib/DateEditor/index.js +88 -94
  25. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  26. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  27. package/lib/DateFormatter/index.js +15 -28
  28. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  29. package/lib/DigitalSignFormatter/index.js +55 -65
  30. package/lib/DigitalSignFormatter/utils.js +9 -8
  31. package/lib/DurationFormatter/index.js +14 -27
  32. package/lib/EditEditorButton/index.js +10 -22
  33. package/lib/EmailFormatter/index.js +11 -24
  34. package/lib/FieldDisplaySetting/field-item.js +18 -20
  35. package/lib/FieldDisplaySetting/index.js +41 -43
  36. package/lib/FileEditor/index.js +18 -29
  37. package/lib/FileFormatter/index.js +29 -43
  38. package/lib/FileItemFormatter/index.js +17 -32
  39. package/lib/FileItemFormatter/utils.js +5 -5
  40. package/lib/FileUploader/index.js +20 -33
  41. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  42. package/lib/FormulaFormatter/index.js +77 -83
  43. package/lib/FormulaFormatter/utils.js +27 -21
  44. package/lib/GeolocationFormatter/index.js +19 -32
  45. package/lib/HtmlLongTextFormatter/index.js +43 -52
  46. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  47. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  48. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  49. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  50. package/lib/ImageFormatter/index.js +86 -97
  51. package/lib/ImageFormatter/utils.js +1 -1
  52. package/lib/ImagePreviewerLightbox/index.js +20 -18
  53. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  54. package/lib/LastModifierFormatter/index.js +24 -40
  55. package/lib/LinkEditor/index.js +163 -167
  56. package/lib/LinkEditor/link-editor-option.js +41 -56
  57. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  58. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  59. package/lib/LinkFormatter/index.js +75 -77
  60. package/lib/LongTextFormatter/index.js +5 -3
  61. package/lib/MBEditorHeader/index.js +25 -38
  62. package/lib/MTimeFormatter/index.js +17 -32
  63. package/lib/ModalPortal/index.js +15 -32
  64. package/lib/MultipleSelectEditor/index.js +118 -136
  65. package/lib/MultipleSelectFormatter/index.js +24 -40
  66. package/lib/NotificationPopover/index.js +68 -95
  67. package/lib/NumberEditor/index.js +75 -82
  68. package/lib/NumberFormatter/index.js +15 -28
  69. package/lib/RateFormatter/index.js +29 -45
  70. package/lib/RoleStatusEditor/index.js +20 -22
  71. package/lib/RowExpandEmailFormatter/index.js +24 -37
  72. package/lib/RowExpandFileFormatter/index.js +28 -42
  73. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  74. package/lib/RowExpandFormatter/index.js +92 -96
  75. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  76. package/lib/RowExpandImageFormatter/index.js +65 -82
  77. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  78. package/lib/RowExpandImageFormatter/utils.js +1 -1
  79. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  80. package/lib/RowExpandLinkFormatter/index.js +131 -137
  81. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  82. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  83. package/lib/RowExpandRateFormatter/index.js +27 -42
  84. package/lib/RowExpandUrlFormatter/index.js +27 -40
  85. package/lib/SelectItem/index.js +17 -33
  86. package/lib/SelectOptionGroup/index.js +141 -159
  87. package/lib/SelectOptionGroup/option.js +24 -40
  88. package/lib/SimpleLongTextFormatter/index.js +55 -67
  89. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  90. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  91. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  92. package/lib/SingleSelectEditor/index.js +108 -119
  93. package/lib/SingleSelectFormatter/index.js +21 -37
  94. package/lib/TextEditor/index.js +45 -51
  95. package/lib/TextFormatter/index.js +17 -32
  96. package/lib/UrlFormatter/index.js +11 -24
  97. package/lib/cellFormatterFactory/index.js +8 -17
  98. package/lib/common/ClickOutside.js +22 -43
  99. package/lib/common/delete-tip.js +40 -65
  100. package/lib/common/modal-portal.js +15 -33
  101. package/lib/constants/index.js +5 -5
  102. package/lib/data/dtable-value.js +4 -4
  103. package/lib/formatterConfig/base-formatter-config.js +24 -3
  104. package/lib/formatterConfig/index.js +5 -4
  105. package/lib/lang/index.js +6 -6
  106. package/lib/locals/de.js +1 -1
  107. package/lib/locals/en.js +1 -1
  108. package/lib/locals/fr.js +1 -1
  109. package/lib/locals/zh-CN.js +1 -1
  110. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  111. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  112. package/lib/select-editor/select-editor-option.js +41 -56
  113. package/lib/toaster/alert.js +73 -88
  114. package/lib/toaster/index.js +1 -1
  115. package/lib/toaster/toast.js +75 -102
  116. package/lib/toaster/toastManager.js +55 -91
  117. package/lib/toaster/toaster.js +58 -57
  118. package/lib/utils/editor-utils.js +17 -19
  119. package/lib/utils/utils.js +14 -14
  120. package/package.json +4 -4
@@ -1,125 +1,117 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React from 'react';
6
2
  import Loading from '../Loading';
7
3
  import { getImageThumbnailUrl } from './utils';
8
- var ImagesLazyLoad = /*#__PURE__*/function (_React$Component) {
9
- _inherits(ImagesLazyLoad, _React$Component);
10
- var _super = _createSuper(ImagesLazyLoad);
11
- function ImagesLazyLoad(_props) {
12
- var _this;
13
- _classCallCheck(this, ImagesLazyLoad);
14
- _this = _super.call(this, _props);
15
- _this.componentDidMount = function () {
16
- _this.lazyLoadImages(_this.props);
4
+ class ImagesLazyLoad extends React.Component {
5
+ constructor(_props) {
6
+ super(_props);
7
+ this.componentDidMount = () => {
8
+ this.lazyLoadImages(this.props);
17
9
  };
18
- _this.UNSAFE_componentWillReceiveProps = function (nextProps) {
19
- if (nextProps.images.toString() !== _this.props.images.toString()) {
20
- _this.lazyLoadImages(nextProps);
10
+ this.UNSAFE_componentWillReceiveProps = nextProps => {
11
+ if (nextProps.images.toString() !== this.props.images.toString()) {
12
+ this.lazyLoadImages(nextProps);
21
13
  }
22
14
  };
23
- _this.componentWillUnmount = function () {
15
+ this.componentWillUnmount = () => {
24
16
  // prevent async operation
25
- _this.setState = function (state, callback) {
17
+ this.setState = (state, callback) => {
26
18
  return;
27
19
  };
28
20
  };
29
- _this.lazyLoadImages = function (props) {
30
- var images = props.images;
21
+ this.lazyLoadImages = props => {
22
+ const {
23
+ images
24
+ } = props;
31
25
  if (!Array.isArray(images) || images.length === 0) {
32
26
  return;
33
27
  }
34
- _this.setState({
35
- images: images,
28
+ this.setState({
29
+ images,
36
30
  loadedImages: [],
37
31
  loadedCount: 0
38
- }, function () {
39
- var server = _this.props.server;
40
- images.forEach(function (item, index) {
41
- var url = getImageThumbnailUrl(item, server);
42
- _this.lazyLoadImage(url, function (image) {
43
- var _this$state = _this.state,
44
- loadedCount = _this$state.loadedCount,
45
- loadedImages = _this$state.loadedImages;
46
- var newImageList = loadedImages.slice(0);
32
+ }, () => {
33
+ let {
34
+ server
35
+ } = this.props;
36
+ images.forEach((item, index) => {
37
+ let url = getImageThumbnailUrl(item, server);
38
+ this.lazyLoadImage(url, image => {
39
+ let {
40
+ loadedCount,
41
+ loadedImages
42
+ } = this.state;
43
+ let newImageList = loadedImages.slice(0);
47
44
  newImageList[index] = image;
48
- _this.setState({
45
+ this.setState({
49
46
  loadedCount: loadedCount + 1,
50
47
  loadedImages: newImageList
51
48
  });
52
- }, function () {
53
- var loadedCount = _this.state.loadedCount;
54
- _this.setState({
49
+ }, () => {
50
+ let {
51
+ loadedCount
52
+ } = this.state;
53
+ this.setState({
55
54
  loadedCount: loadedCount + 1
56
55
  });
57
56
  });
58
57
  });
59
58
  });
60
59
  };
61
- _this.lazyLoadImage = function (url, resolve, reject) {
60
+ this.lazyLoadImage = (url, resolve, reject) => {
62
61
  if (!url) {
63
62
  reject('img path is require');
64
63
  return;
65
64
  }
66
- var image = new Image();
67
- image.onload = function () {
65
+ const image = new Image();
66
+ image.onload = () => {
68
67
  resolve(image);
69
68
  };
70
- image.onerror = function (e) {
69
+ image.onerror = e => {
71
70
  reject(e);
72
71
  };
73
72
  image.src = url;
74
73
  };
75
- _this.onMouseDown = function (event) {
74
+ this.onMouseDown = event => {
76
75
  event.stopPropagation();
77
76
  };
78
- _this.onImageClick = function (event, index) {
77
+ this.onImageClick = (event, index) => {
79
78
  event.stopPropagation();
80
- _this.props.onImageClick(index);
79
+ this.props.onImageClick(index);
81
80
  };
82
- _this.state = {
81
+ this.state = {
83
82
  images: _props.images,
84
83
  loadedImages: [],
85
84
  loadedCount: 0
86
85
  };
87
- return _this;
88
86
  }
89
- _createClass(ImagesLazyLoad, [{
90
- key: "render",
91
- value: function render() {
92
- var _this2 = this;
93
- var _this$state2 = this.state,
94
- images = _this$state2.images,
95
- loadedImages = _this$state2.loadedImages,
96
- loadedCount = _this$state2.loadedCount;
97
- if (!Array.isArray(images) || images.length === 0) {
98
- return '';
99
- }
100
- if (images.length > loadedCount) {
101
- var style = {
102
- marginLeft: '4px'
103
- };
104
- return /*#__PURE__*/React.createElement("div", {
105
- style: style,
106
- className: "d-flex align-items-center"
107
- }, /*#__PURE__*/React.createElement(Loading, null));
108
- }
109
- return loadedImages.map(function (image, index) {
110
- return /*#__PURE__*/React.createElement("img", {
111
- key: index,
112
- className: "image-item",
113
- src: image.src,
114
- onMouseDown: _this2.onMouseDown,
115
- onClick: function onClick(event) {
116
- return _this2.onImageClick(event, index);
117
- },
118
- alt: ""
119
- });
120
- });
87
+ render() {
88
+ const {
89
+ images,
90
+ loadedImages,
91
+ loadedCount
92
+ } = this.state;
93
+ if (!Array.isArray(images) || images.length === 0) {
94
+ return '';
121
95
  }
122
- }]);
123
- return ImagesLazyLoad;
124
- }(React.Component);
96
+ if (images.length > loadedCount) {
97
+ let style = {
98
+ marginLeft: '4px'
99
+ };
100
+ return /*#__PURE__*/React.createElement("div", {
101
+ style: style,
102
+ className: "d-flex align-items-center"
103
+ }, /*#__PURE__*/React.createElement(Loading, null));
104
+ }
105
+ return loadedImages.map((image, index) => {
106
+ return /*#__PURE__*/React.createElement("img", {
107
+ key: index,
108
+ className: "image-item",
109
+ src: image.src,
110
+ onMouseDown: this.onMouseDown,
111
+ onClick: event => this.onImageClick(event, index),
112
+ alt: ""
113
+ });
114
+ });
115
+ }
116
+ }
125
117
  export default ImagesLazyLoad;
@@ -1,128 +1,117 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React, { Fragment } from 'react';
6
2
  import classnames from 'classnames';
7
3
  import ImagesLazyLoad from './images-lazy-load';
8
4
  import { getImageThumbnailUrl } from './utils';
9
5
  import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
10
6
  import './index.css';
11
- var ImageFormatter = /*#__PURE__*/function (_React$Component) {
12
- _inherits(ImageFormatter, _React$Component);
13
- var _super = _createSuper(ImageFormatter);
14
- function ImageFormatter(props) {
15
- var _this;
16
- _classCallCheck(this, ImageFormatter);
17
- _this = _super.call(this, props);
18
- _this.onImageClick = function (index) {
19
- if (!_this.props.isSupportPreview) return;
20
- _this.setState({
7
+ class ImageFormatter extends React.Component {
8
+ constructor(props) {
9
+ super(props);
10
+ this.onImageClick = index => {
11
+ if (!this.props.isSupportPreview) return;
12
+ this.setState({
21
13
  isPreviewImage: true,
22
14
  previewImageIndex: index
23
15
  });
24
16
  };
25
- _this.closeImagePopup = function () {
26
- if (!_this.props.isSupportPreview) return;
27
- if (_this.props.onCloseCallback) {
28
- _this.props.onCloseCallback();
17
+ this.closeImagePopup = () => {
18
+ if (!this.props.isSupportPreview) return;
19
+ if (this.props.onCloseCallback) {
20
+ this.props.onCloseCallback();
29
21
  }
30
- _this.setState({
22
+ this.setState({
31
23
  isPreviewImage: false,
32
24
  previewImageIndex: -1
33
25
  });
34
26
  };
35
- _this.movePrev = function () {
36
- var images = _this.props.value;
37
- _this.setState(function (prevState) {
38
- return {
39
- previewImageIndex: (prevState.previewImageIndex + images.length - 1) % images.length
40
- };
41
- });
27
+ this.movePrev = () => {
28
+ let images = this.props.value;
29
+ this.setState(prevState => ({
30
+ previewImageIndex: (prevState.previewImageIndex + images.length - 1) % images.length
31
+ }));
42
32
  };
43
- _this.moveNext = function () {
44
- var images = _this.props.value;
45
- _this.setState(function (prevState) {
46
- return {
47
- previewImageIndex: (prevState.previewImageIndex + 1) % images.length
48
- };
49
- });
33
+ this.moveNext = () => {
34
+ let images = this.props.value;
35
+ this.setState(prevState => ({
36
+ previewImageIndex: (prevState.previewImageIndex + 1) % images.length
37
+ }));
50
38
  };
51
- _this.downloadImage = function (imageItemUrl) {
52
- if (!_this.props.downloadImage) return;
53
- _this.props.downloadImage(imageItemUrl);
39
+ this.downloadImage = imageItemUrl => {
40
+ if (!this.props.downloadImage) return;
41
+ this.props.downloadImage(imageItemUrl);
54
42
  };
55
- _this.deleteImage = function (index) {
56
- var readOnly = _this.props.readOnly;
43
+ this.deleteImage = index => {
44
+ const {
45
+ readOnly
46
+ } = this.props;
57
47
  if (readOnly) return;
58
- if (!_this.props.deleteImage) return;
59
- _this.props.deleteImage(index);
48
+ if (!this.props.deleteImage) return;
49
+ this.props.deleteImage(index);
60
50
  };
61
- _this.onRotateImage = function (index, degree) {
62
- var readOnly = _this.props.readOnly;
51
+ this.onRotateImage = (index, degree) => {
52
+ const {
53
+ readOnly
54
+ } = this.props;
63
55
  if (readOnly) return;
64
- if (!_this.props.rotateImage) return;
65
- _this.props.rotateImage(index, degree);
56
+ if (!this.props.rotateImage) return;
57
+ this.props.rotateImage(index, degree);
66
58
  };
67
- _this.state = {
59
+ this.state = {
68
60
  isPreviewImage: false,
69
61
  previewImageIndex: -1
70
62
  };
71
- return _this;
72
63
  }
73
- _createClass(ImageFormatter, [{
74
- key: "render",
75
- value: function render() {
76
- var _this$props = this.props,
77
- isSample = _this$props.isSample,
78
- value = _this$props.value,
79
- server = _this$props.server,
80
- containerClassName = _this$props.containerClassName,
81
- readOnly = _this$props.readOnly;
82
- var className = classnames('dtable-ui cell-formatter-container image-formatter', containerClassName);
83
- var _this$state = this.state,
84
- isPreviewImage = _this$state.isPreviewImage,
85
- previewImageIndex = _this$state.previewImageIndex;
86
- if (!Array.isArray(value) || value.length === 0) {
87
- return null;
88
- }
89
- if (isSample) {
90
- var item = value[0];
91
- var url = getImageThumbnailUrl(item, server);
92
- return /*#__PURE__*/React.createElement("div", {
93
- className: className
94
- }, /*#__PURE__*/React.createElement("img", {
95
- className: "image-item",
96
- src: url,
97
- alt: ""
98
- }), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
99
- className: "image-item-count"
100
- }, "+".concat(value.length)));
101
- }
102
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
64
+ render() {
65
+ const {
66
+ isSample,
67
+ value,
68
+ server,
69
+ containerClassName,
70
+ readOnly
71
+ } = this.props;
72
+ const className = classnames('dtable-ui cell-formatter-container image-formatter', containerClassName);
73
+ const {
74
+ isPreviewImage,
75
+ previewImageIndex
76
+ } = this.state;
77
+ if (!Array.isArray(value) || value.length === 0) {
78
+ return null;
79
+ }
80
+ if (isSample) {
81
+ let item = value[0];
82
+ let url = getImageThumbnailUrl(item, server);
83
+ return /*#__PURE__*/React.createElement("div", {
103
84
  className: className
104
- }, /*#__PURE__*/React.createElement(ImagesLazyLoad, {
105
- images: value,
106
- server: server,
107
- onImageClick: this.onImageClick
108
- })), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
109
- imageItems: value,
110
- imageIndex: previewImageIndex,
111
- closeImagePopup: this.closeImagePopup,
112
- moveToPrevImage: this.movePrev,
113
- moveToNextImage: this.moveNext,
114
- deleteImage: readOnly ? null : this.deleteImage,
115
- downloadImage: this.downloadImage,
116
- onRotateImage: readOnly ? null : this.onRotateImage,
117
- readOnly: readOnly,
118
- server: server,
119
- moveToPrevRowImage: this.props.moveToPrevRowImage,
120
- moveToNextRowImage: this.props.moveToNextRowImage
121
- }));
85
+ }, /*#__PURE__*/React.createElement("img", {
86
+ className: "image-item",
87
+ src: url,
88
+ alt: ""
89
+ }), value.length !== 1 && /*#__PURE__*/React.createElement("span", {
90
+ className: "image-item-count"
91
+ }, "+".concat(value.length)));
122
92
  }
123
- }]);
124
- return ImageFormatter;
125
- }(React.Component);
93
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
94
+ className: className
95
+ }, /*#__PURE__*/React.createElement(ImagesLazyLoad, {
96
+ images: value,
97
+ server: server,
98
+ onImageClick: this.onImageClick
99
+ })), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
100
+ imageItems: value,
101
+ imageIndex: previewImageIndex,
102
+ closeImagePopup: this.closeImagePopup,
103
+ moveToPrevImage: this.movePrev,
104
+ moveToNextImage: this.moveNext,
105
+ deleteImage: readOnly ? null : this.deleteImage,
106
+ downloadImage: this.downloadImage,
107
+ onRotateImage: readOnly ? null : this.onRotateImage,
108
+ readOnly: readOnly,
109
+ server: server,
110
+ moveToPrevRowImage: this.props.moveToPrevRowImage,
111
+ moveToNextRowImage: this.props.moveToNextRowImage
112
+ }));
113
+ }
114
+ }
126
115
  ImageFormatter.defaultProps = {
127
116
  isSample: false,
128
117
  isSupportPreview: false,
@@ -1,4 +1,4 @@
1
- export var getImageThumbnailUrl = function getImageThumbnailUrl(url, server) {
1
+ export const getImageThumbnailUrl = (url, server) => {
2
2
  if (server && url.indexOf(server) > -1) {
3
3
  return url.replace('/workspace', '/thumbnail/workspace') + '?size=256';
4
4
  }
@@ -4,22 +4,24 @@ import Lightbox from '@seafile/react-image-lightbox';
4
4
  import { checkSVGImage, isInternalImg } from './utils';
5
5
  import '@seafile/react-image-lightbox/style.css';
6
6
  function ImagePreviewerLightbox(props) {
7
- var imageItems = props.imageItems,
8
- imageIndex = props.imageIndex,
9
- deleteImage = props.deleteImage,
10
- downloadImage = props.downloadImage,
11
- onRotateImage = props.onRotateImage,
12
- readOnly = props.readOnly,
13
- server = props.server,
14
- moveToPrevRowImage = props.moveToPrevRowImage,
15
- moveToNextRowImage = props.moveToNextRowImage,
16
- className = props.className;
17
- var imageItemsLength = imageItems.length;
18
- var URL = imageItems[imageIndex];
19
- var imageTitle = URL ? decodeURI(URL.slice(URL.lastIndexOf('/') + 1)) : '';
7
+ const {
8
+ imageItems,
9
+ imageIndex,
10
+ deleteImage,
11
+ downloadImage,
12
+ onRotateImage,
13
+ readOnly,
14
+ server,
15
+ moveToPrevRowImage,
16
+ moveToNextRowImage,
17
+ className
18
+ } = props;
19
+ const imageItemsLength = imageItems.length;
20
+ const URL = imageItems[imageIndex];
21
+ const imageTitle = URL ? decodeURI(URL.slice(URL.lastIndexOf('/') + 1)) : '';
20
22
  // svg image is vectorgraph and can't rotate, external image can't rotate
21
- var canRotateImage = onRotateImage && !readOnly && !checkSVGImage(URL) && isInternalImg(URL, server);
22
- var imageTitleEl = /*#__PURE__*/React.createElement("span", {
23
+ const canRotateImage = onRotateImage && !readOnly && !checkSVGImage(URL) && isInternalImg(URL, server);
24
+ const imageTitleEl = /*#__PURE__*/React.createElement("span", {
23
25
  className: "d-flex"
24
26
  }, /*#__PURE__*/React.createElement("span", {
25
27
  className: "text-truncate"
@@ -37,13 +39,13 @@ function ImagePreviewerLightbox(props) {
37
39
  onMoveNextRequest: props.moveToNextImage,
38
40
  onClickMoveUp: moveToPrevRowImage,
39
41
  onClickMoveDown: moveToNextRowImage,
40
- onRotateImage: canRotateImage ? function (deg) {
42
+ onRotateImage: canRotateImage ? deg => {
41
43
  onRotateImage(imageIndex, deg);
42
44
  } : null,
43
- onClickDelete: !readOnly && deleteImage ? function () {
45
+ onClickDelete: !readOnly && deleteImage ? () => {
44
46
  deleteImage(imageIndex, 'previewer');
45
47
  } : null,
46
- onClickDownload: downloadImage ? function () {
48
+ onClickDownload: downloadImage ? () => {
47
49
  downloadImage(URL);
48
50
  } : null
49
51
  });
@@ -1,9 +1,9 @@
1
- export var isInternalImg = function isInternalImg(url, server) {
1
+ export const isInternalImg = (url, server) => {
2
2
  if (!url) return;
3
- var currentServer = server || window.dtable && window.dtable.server;
3
+ const currentServer = server || window.dtable && window.dtable.server;
4
4
  return url.indexOf(currentServer) > -1;
5
5
  };
6
- export var checkSVGImage = function checkSVGImage(url) {
6
+ export const checkSVGImage = url => {
7
7
  if (!url) return false;
8
8
  return url.substr(-4).toLowerCase() === '.svg';
9
9
  };
@@ -1,7 +1,3 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React from 'react';
6
2
  import classnames from 'classnames';
7
3
  import CollaboratorItem from '../CollaboratorItem';
@@ -12,27 +8,19 @@ import './index.css';
12
8
  // 2 value is exist, but can't find in collaborators
13
9
  // 3 value is exist, typeof value is a string
14
10
  // 4 value is exist, typeof value is array
15
- var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
16
- _inherits(LastModifierFormatter, _React$PureComponent);
17
- var _super = _createSuper(LastModifierFormatter);
18
- function LastModifierFormatter() {
19
- var _this;
20
- _classCallCheck(this, LastModifierFormatter);
21
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
- args[_key] = arguments[_key];
23
- }
24
- _this = _super.call.apply(_super, [this].concat(args));
25
- _this.getCollaborators = function () {
26
- var _this$props = _this.props,
27
- value = _this$props.value,
28
- collaborators = _this$props.collaborators;
11
+ class LastModifierFormatter extends React.PureComponent {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.getCollaborators = () => {
15
+ let {
16
+ value,
17
+ collaborators
18
+ } = this.props;
29
19
  if (!Array.isArray(value)) {
30
20
  value = [value];
31
21
  }
32
- return value.map(function (item, index) {
33
- var collaborator = collaborators.find(function (collaborator) {
34
- return collaborator.email === item;
35
- });
22
+ return value.map((item, index) => {
23
+ let collaborator = collaborators.find(collaborator => collaborator.email === item);
36
24
  // the collaborator can be not exist, because the row modified by third app
37
25
  if (!collaborator) {
38
26
  collaborator = {
@@ -46,28 +34,24 @@ var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
46
34
  });
47
35
  });
48
36
  };
49
- return _this;
50
37
  }
51
- _createClass(LastModifierFormatter, [{
52
- key: "render",
53
- value: function render() {
54
- var _this$props2 = this.props,
55
- containerClassName = _this$props2.containerClassName,
56
- value = _this$props2.value;
57
- var classname = classnames('dtable-ui cell-formatter-container last-modified-formatter', containerClassName);
58
- if (!value || Array.isArray(value) && value.length === 0) {
59
- return /*#__PURE__*/React.createElement("div", {
60
- className: classname
61
- });
62
- }
63
- var collaborators = this.getCollaborators();
38
+ render() {
39
+ const {
40
+ containerClassName,
41
+ value
42
+ } = this.props;
43
+ const classname = classnames('dtable-ui cell-formatter-container last-modified-formatter', containerClassName);
44
+ if (!value || Array.isArray(value) && value.length === 0) {
64
45
  return /*#__PURE__*/React.createElement("div", {
65
46
  className: classname
66
- }, collaborators);
47
+ });
67
48
  }
68
- }]);
69
- return LastModifierFormatter;
70
- }(React.PureComponent);
49
+ const collaborators = this.getCollaborators();
50
+ return /*#__PURE__*/React.createElement("div", {
51
+ className: classname
52
+ }, collaborators);
53
+ }
54
+ }
71
55
  LastModifierFormatter.defaultProps = {
72
56
  value: ''
73
57
  };