@uploadcare/file-uploader 1.15.0-alpha.18 → 1.15.0-alpha.19

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.
@@ -52,6 +52,8 @@ export class FileItem extends FileItemConfig {
52
52
  * @param {String} id
53
53
  */
54
54
  private _handleEntryId;
55
+ /** @param {boolean} value */
56
+ _updateShowFileNames(value: boolean): void;
55
57
  _handleState: (...args: any[]) => void;
56
58
  /** @private */
57
59
  private _observer;
@@ -1 +1 @@
1
- {"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAiBA;IAIE,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;+CAVoB,gBAAU;mCAIlB,gBACR;6BAMM,2BAET;;wCAMC,wCACK;;;;;;MAqBN;IAQH;;;OAGG;IACH,0BAUC;IAPC,qCAA2C;IAC3C,wCAA0C;IAQ5C,eAAe;IACf,wBAYG;IAEH,eAAe;IACf,iCAA0E;IAE1E,sCA4BE;IAEF;;;OAGG;IACH,uBAqCC;IAyDD,uCA+BE;IAaA,eAAe;IACf,kBAEE;IAUJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,0CAwGG;CACJ;;;;;+BA1Y8B,qBAAqB"}
1
+ {"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAiBA;IAIE,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;+CAVoB,gBAAU;mCAIlB,gBACR;6BAMM,2BAET;;wCAMC,wCACK;;;;;;MAqBN;IAQH;;;OAGG;IACH,0BAUC;IAPC,qCAA2C;IAC3C,wCAA0C;IAQ5C,eAAe;IACf,wBAYG;IAEH,eAAe;IACf,iCAA0E;IAE1E,sCA4BE;IAEF;;;OAGG;IACH,uBAqCC;IAED,6BAA6B;IAC7B,4BADY,OAAO,QASlB;IAgDD,uCA+BE;IAaA,eAAe;IACf,kBAEE;IAUJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,0CAwGG;CACJ;;;;;+BA5Y8B,qBAAqB"}
@@ -171,6 +171,17 @@ export class FileItem extends FileItemConfig {
171
171
  this._subEntry('isImage', () => this._debouncedCalculateState());
172
172
  }
173
173
 
174
+ /** @param {boolean} value */
175
+ _updateShowFileNames(value) {
176
+ const isListMode = this.cfg.filesViewMode === 'list';
177
+ if (isListMode) {
178
+ this.$.showFileNames = true;
179
+ return;
180
+ }
181
+
182
+ this.$.showFileNames = value;
183
+ }
184
+
174
185
  initCallback() {
175
186
  super.initCallback();
176
187
 
@@ -183,24 +194,15 @@ export class FileItem extends FileItemConfig {
183
194
  });
184
195
 
185
196
  this.subConfigValue('useCloudImageEditor', () => this._debouncedCalculateState());
197
+
186
198
  this.subConfigValue('filesViewMode', (mode) => {
187
- if (this.cfg.filesViewMode === 'list') {
188
- this.$.showFileNames = true;
189
- }
190
- if (this.cfg.filesViewMode === 'grid') {
191
- this.$.showFileNames = this.cfg.gridShowFileNames;
192
- }
199
+ this._updateShowFileNames(this.cfg.gridShowFileNames);
193
200
 
194
201
  this.setAttribute('mode', mode);
195
202
  });
196
203
 
197
204
  this.subConfigValue('gridShowFileNames', (value) => {
198
- if (this.cfg.filesViewMode === 'grid') {
199
- this.$.showFileNames = value;
200
- }
201
- if (this.cfg.filesViewMode === 'list') {
202
- this.$.showFileNames = true;
203
- }
205
+ this._updateShowFileNames(value);
204
206
  });
205
207
 
206
208
  this.onclick = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AASA;IACE,eAAe;IACf,0BAA0B;IAE1B;;;OAGG;IACH,mBAAkB;IAElB,yBAAwB;IAExB,oEAAwC;IAKtC;;;;;;;+CALyB,gBAAU;mCAOjC,gBAAK;6BAMe,2BACZ;;wCAK4B,wCAC5B;;;;;;MAVT;IAGH,6CAgBC;IAED,eAAe;IACf,2BAmDG;IAEH;;MAA4E;IAE5E;;;OAGG;IACH,0BAaC;IAOD;;;OAGG;IACH,uBA6BC;IA8BC,4CAAuG;CAY1G;;;;+BA3M8B,+BAA+B"}
1
+ {"version":3,"file":"Thumb.d.ts","sourceRoot":"","sources":["Thumb.js"],"names":[],"mappings":"AASA;IACE,eAAe;IACf,0BAA0B;IAE1B;;;OAGG;IACH,mBAAkB;IAElB,yBAAwB;IAExB,oEAAwC;IAKtC;;;;;;;+CALyB,gBAAU;mCAOjC,gBAAK;6BAMe,2BACZ;;wCAK4B,wCAC5B;;;;;;MAVT;IAGH,6CAgBC;IAED,eAAe;IACf,2BA+CG;IAEH;;MAA4E;IAE5E;;;OAGG;IACH,0BAaC;IAOD;;;OAGG;IACH,uBA6BC;IA8BC,4CAAuG;CAY1G;;;;+BAvM8B,+BAA+B"}
@@ -55,6 +55,7 @@ export class Thumb extends FileItemConfig {
55
55
  const fileInfo = entry.getValue('fileInfo');
56
56
  const isImage = entry.getValue('isImage');
57
57
  const uuid = entry.getValue('uuid');
58
+ const currentThumbUrl = entry.getValue('thumbUrl');
58
59
 
59
60
  let size = this._calculateThumbSize(force);
60
61
 
@@ -66,17 +67,12 @@ export class Thumb extends FileItemConfig {
66
67
  ),
67
68
  );
68
69
 
69
- let currentThumbUrl = entry.getValue('thumbUrl');
70
-
71
70
  const { promise } = preloadImage(thumbUrl);
72
71
 
73
72
  promise
74
- .then(() => this.set$({ thumbUrl: `url(${thumbUrl})` }))
75
73
  .then(() => {
76
- if (this._entry?.getValue('uuid') !== uuid) {
77
- entry.setValue('thumbUrl', thumbUrl);
78
- currentThumbUrl?.startsWith('blob:') && URL.revokeObjectURL(currentThumbUrl);
79
- }
74
+ entry.setValue('thumbUrl', thumbUrl);
75
+ currentThumbUrl?.startsWith('blob:') && URL.revokeObjectURL(currentThumbUrl);
80
76
  })
81
77
  .catch(() => {
82
78
  console.error('Failed to load image', thumbUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.15.0-alpha.18",
3
+ "version": "1.15.0-alpha.19",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",