dtable-ui-component 6.0.98 → 6.0.99

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.
@@ -59,15 +59,18 @@ class ClickOutside extends _react.default.Component {
59
59
  constructor() {
60
60
  super(...arguments);
61
61
  this.isClickedInside = false;
62
+ this.setClickedInsideStatus = status => {
63
+ this.isClickedInside = status || false;
64
+ };
62
65
  this.handleDocumentClick = e => {
63
66
  if (this.isClickedInside) {
64
- this.isClickedInside = false;
67
+ this.setClickedInsideStatus(false);
65
68
  return;
66
69
  }
67
70
  this.props.onClickOutside(e);
68
71
  };
69
72
  this.handleMouseDown = () => {
70
- this.isClickedInside = true;
73
+ this.setClickedInsideStatus(true);
71
74
  };
72
75
  }
73
76
  componentDidMount() {
@@ -143,29 +143,35 @@ class FileUploader extends _react.default.Component {
143
143
  });
144
144
  }
145
145
  try {
146
- let fileReader = new FileReader();
147
- fileReader.readAsDataURL(file);
148
- fileReader.addEventListener('load', function (event) {
149
- let isImage = /image/i.test(file.type);
150
- if (uploadType === 'file' || isImage) {
151
- let uploadFileItem = {
152
- name: file.name,
153
- fileIconUrl: isImage ? event.target.result : (0, _url.getFileIconUrl)(file.name, file.type),
154
- isUploading: true,
155
- isErrorTip: false,
156
- file: file,
157
- size: file.size,
158
- url: '',
159
- type: uploadType === 'file' ? 'file' : '',
160
- percent: 0
161
- };
146
+ let isImage = /image/i.test(uploadFile.type);
147
+ let uploadFileItem = {
148
+ name: uploadFile.name,
149
+ fileIconUrl: (0, _url.getFileIconUrl)(uploadFile.name),
150
+ isUploading: true,
151
+ isErrorTip: false,
152
+ uploadFile: uploadFile,
153
+ size: uploadFile.size,
154
+ url: '',
155
+ type: uploadType === 'file' ? 'file' : '',
156
+ percent: 0
157
+ };
158
+
159
+ // Provide preview when the image size is less than 100MB
160
+ if (isImage && uploadFile.size < 100 * 1024 * 1024) {
161
+ let fileReader = new FileReader();
162
+ fileReader.readAsDataURL(uploadFile);
163
+ fileReader.onload = function (event) {
164
+ uploadFileItem.fileIconUrl = event.target.result;
162
165
  uploadFileList.push(uploadFileItem);
163
- }
164
- checkLoadFinish();
165
- }, false);
166
- fileReader.addEventListener('error', function (e) {
166
+ checkLoadFinish();
167
+ };
168
+ fileReader.onerror = function () {
169
+ checkLoadFinish();
170
+ };
171
+ } else {
172
+ uploadFileList.push(uploadFileItem);
167
173
  checkLoadFinish();
168
- }, false);
174
+ }
169
175
  } catch (event) {
170
176
  checkLoadFinish();
171
177
  }
@@ -85,6 +85,10 @@ class SelectOptionGroup extends _react.Component {
85
85
  if (isInModal) {
86
86
  e.stopPropagation();
87
87
  e.nativeEvent.stopImmediatePropagation();
88
+
89
+ // ClickOutside set isClickedInside to true via mouse down capture first
90
+ // Set isClickedInside to false after mouse down
91
+ this.clickOutsideRef && this.clickOutsideRef.setClickedInsideStatus(false);
88
92
  }
89
93
  };
90
94
  this.scrollContent = () => {
@@ -213,6 +217,7 @@ class SelectOptionGroup extends _react.Component {
213
217
  };
214
218
  }
215
219
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
220
+ ref: ref => this.clickOutsideRef = ref,
216
221
  onClickOutside: this.props.onClickOutside,
217
222
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
218
223
  className: (0, _classnames.default)('option-group', className ? 'option-group-' + className : '', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.98",
3
+ "version": "6.0.99",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "4.0.2",