dtable-ui-component 5.3.8 → 5.3.9-beta1

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.
@@ -88,7 +88,8 @@ class ImageThumbnail extends _react.default.Component {
88
88
  index,
89
89
  downloadImage,
90
90
  src,
91
- className
91
+ className,
92
+ name
92
93
  } = this.props;
93
94
  const {
94
95
  imageThumbnailUrl
@@ -130,7 +131,7 @@ class ImageThumbnail extends _react.default.Component {
130
131
  hide: 0
131
132
  },
132
133
  fade: false
133
- }, (0, _url.getFileName)(src)));
134
+ }, name || (0, _url.getFileName)(src)));
134
135
  }
135
136
  }
136
137
  var _default = exports.default = ImageThumbnail;
@@ -113,10 +113,11 @@ class RowExpandFileEditor extends _react.default.Component {
113
113
  fileArr = value.map((file, index) => {
114
114
  const {
115
115
  fileIconUrl
116
- } = (0, _url.getFileThumbnailInfo)(file, config);
116
+ } = (0, _url.getFileThumbnailInfo)(file);
117
117
  return /*#__PURE__*/_react.default.createElement(_ImageThumbnail.default, {
118
118
  key: 'file-' + index,
119
119
  src: fileIconUrl,
120
+ name: file.name,
120
121
  index: index,
121
122
  config: config,
122
123
  deleteTip: (0, _lang.getLocale)('Are_you_sure_you_want_to_delete_this_file'),
@@ -4,3 +4,8 @@
4
4
  margin-left: -5px;
5
5
  margin-right: -5px;
6
6
  }
7
+
8
+ .dtable-ui-row-expand-image-editor .dtable-ui-row-expand-image-container img {
9
+ max-width: 96px;
10
+ max-height: 96px;
11
+ }
package/lib/utils/url.js CHANGED
@@ -124,8 +124,14 @@ const getImageThumbnailUrl = function (url) {
124
124
  exports.getImageThumbnailUrl = getImageThumbnailUrl;
125
125
  const getFileName = url => {
126
126
  if (!url) return null;
127
- let lastIndex = url.lastIndexOf('/');
128
- return url.slice(lastIndex + 1);
127
+ let validUrl = url;
128
+ let qIndex = url.indexOf('/?');
129
+ if (qIndex !== -1) {
130
+ validUrl = validUrl.slice(0, qIndex);
131
+ }
132
+ const lastIndex = validUrl.lastIndexOf('/');
133
+ const name = url.slice(lastIndex + 1, qIndex);
134
+ return decodeURI(name);
129
135
  };
130
136
  exports.getFileName = getFileName;
131
137
  const imageCheck = filename => {
@@ -189,7 +195,7 @@ const getFileThumbnailInfo = function (file) {
189
195
  fileIconUrl: defaultIconUrl['192']
190
196
  };
191
197
  const isImage = imageCheck(file.name);
192
- if (isImage) return {
198
+ if (isImage && server) return {
193
199
  isImage,
194
200
  fileIconUrl: getImageThumbnailUrl(file.url, {
195
201
  server
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.3.8",
3
+ "version": "5.3.9beta1",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "3.0.1",