@progress/kendo-spreadsheet-common 1.0.0-develop.6 → 1.0.0-develop.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.
- package/dist/index-esm.js +65 -68
- package/dist/index.js +68 -67
- package/package.json +1 -1
- package/src/index.d.ts +6 -0
package/dist/index-esm.js
CHANGED
|
@@ -22118,8 +22118,10 @@ class FormulaInput extends Widget {
|
|
|
22118
22118
|
if (width > element.offsetWidth) {
|
|
22119
22119
|
element.style.width = width + 'px';
|
|
22120
22120
|
}
|
|
22121
|
-
|
|
22122
|
-
|
|
22121
|
+
|
|
22122
|
+
const activeCellOutlineWidth = 1;
|
|
22123
|
+
if (height - activeCellOutlineWidth > element.offsetHeight) {
|
|
22124
|
+
element.style.height = (height - activeCellOutlineWidth) + 'px';
|
|
22123
22125
|
}
|
|
22124
22126
|
|
|
22125
22127
|
this._sync();
|
|
@@ -26050,7 +26052,7 @@ async function readDrawings(zip, file, sheet) {
|
|
|
26050
26052
|
let relationships = await readRelationships(zip, relsFile);
|
|
26051
26053
|
|
|
26052
26054
|
if (relationships.byType.image) {
|
|
26053
|
-
|
|
26055
|
+
for (const id of Object.keys(relationships.byId)) {
|
|
26054
26056
|
let img = relative_file(file, relationships.byId[id]);
|
|
26055
26057
|
let type = getContentType(img);
|
|
26056
26058
|
|
|
@@ -26062,7 +26064,7 @@ async function readDrawings(zip, file, sheet) {
|
|
|
26062
26064
|
: new window.Blob([ data ], { type: type });
|
|
26063
26065
|
relationships.byId[id] = sheet._workbook.addImage(blob);
|
|
26064
26066
|
}
|
|
26065
|
-
}
|
|
26067
|
+
}
|
|
26066
26068
|
}
|
|
26067
26069
|
|
|
26068
26070
|
let cdr, ref, width, height;
|
|
@@ -26757,7 +26759,7 @@ function excelToPixels(val) {
|
|
|
26757
26759
|
return val / 9525;
|
|
26758
26760
|
}
|
|
26759
26761
|
|
|
26760
|
-
/* eslint-disable no-
|
|
26762
|
+
/* eslint-disable no-undef */
|
|
26761
26763
|
|
|
26762
26764
|
const events$1 = [
|
|
26763
26765
|
"cut",
|
|
@@ -27263,33 +27265,33 @@ class Workbook extends Observable {
|
|
|
27263
27265
|
this._imgID = 0;
|
|
27264
27266
|
}
|
|
27265
27267
|
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27291
|
-
|
|
27292
|
-
|
|
27268
|
+
_loadImages() {
|
|
27269
|
+
let self = this;
|
|
27270
|
+
let ids = Object.keys(self._images);
|
|
27271
|
+
let count = ids.length;
|
|
27272
|
+
if (count) {
|
|
27273
|
+
ids.forEach(function(id){
|
|
27274
|
+
let img = self._images[id];
|
|
27275
|
+
if (!img.blob) {
|
|
27276
|
+
loadBinary(img.url, function(data, type) {
|
|
27277
|
+
// XXX: can we do something better in case of error?
|
|
27278
|
+
if (data != null) {
|
|
27279
|
+
img.blob = new Blob([ data ], { type: type });
|
|
27280
|
+
delete img.url;
|
|
27281
|
+
}
|
|
27282
|
+
next();
|
|
27283
|
+
});
|
|
27284
|
+
}
|
|
27285
|
+
});
|
|
27286
|
+
} else {
|
|
27287
|
+
next();
|
|
27288
|
+
}
|
|
27289
|
+
function next() {
|
|
27290
|
+
if (--count <= 0) {
|
|
27291
|
+
self.activeSheet().triggerChange({ layout: true });
|
|
27292
|
+
}
|
|
27293
|
+
}
|
|
27294
|
+
}
|
|
27293
27295
|
|
|
27294
27296
|
fromJSON(json) {
|
|
27295
27297
|
if (json.sheets) {
|
|
@@ -27307,7 +27309,7 @@ class Workbook extends Observable {
|
|
|
27307
27309
|
}
|
|
27308
27310
|
this._images[id] = { url: json.images[id] };
|
|
27309
27311
|
}, this);
|
|
27310
|
-
|
|
27312
|
+
this._loadImages();
|
|
27311
27313
|
}
|
|
27312
27314
|
|
|
27313
27315
|
for (let idx = 0; idx < json.sheets.length; idx++) {
|
|
@@ -27374,47 +27376,42 @@ class Workbook extends Observable {
|
|
|
27374
27376
|
return sheet.toJSON();
|
|
27375
27377
|
}, this),
|
|
27376
27378
|
names: names,
|
|
27379
|
+
images: {},
|
|
27377
27380
|
columnWidth: this.options.columnWidth,
|
|
27378
27381
|
rowHeight: this.options.rowHeight
|
|
27379
27382
|
};
|
|
27380
27383
|
}
|
|
27381
27384
|
|
|
27382
27385
|
saveJSON() {
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
// return self.usesImage(id) === 1;
|
|
27390
|
-
// });
|
|
27391
|
-
// let count = ids.length;
|
|
27392
|
-
// data.images = {};
|
|
27393
|
-
// if (count) {
|
|
27394
|
-
// ids.forEach(function(id) {
|
|
27395
|
-
// let img = self._images[id];
|
|
27396
|
-
// if (img.blob) {
|
|
27397
|
-
// let reader = new FileReader();
|
|
27398
|
-
// reader.onload = function() {
|
|
27399
|
-
// data.images[id] = reader.result;
|
|
27400
|
-
// next();
|
|
27401
|
-
// };
|
|
27402
|
-
// reader.readAsDataURL(img.blob);
|
|
27403
|
-
// } else {
|
|
27404
|
-
// data.images[id] = img.url;
|
|
27405
|
-
// next();
|
|
27406
|
-
// }
|
|
27407
|
-
// });
|
|
27408
|
-
// } else {
|
|
27409
|
-
// next();
|
|
27410
|
-
// }
|
|
27411
|
-
// return deferred.promise();
|
|
27386
|
+
let self = this;
|
|
27387
|
+
let data = self.toJSON();
|
|
27388
|
+
let ids = Object.keys(self._images).filter(function(id) {
|
|
27389
|
+
return self.usesImage(id) === 1;
|
|
27390
|
+
});
|
|
27391
|
+
let count = ids.length;
|
|
27412
27392
|
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27393
|
+
const promises = [];
|
|
27394
|
+
|
|
27395
|
+
if (count) {
|
|
27396
|
+
ids.forEach(function(id) {
|
|
27397
|
+
let img = self._images[id];
|
|
27398
|
+
if (img.blob) {
|
|
27399
|
+
const promise = new Promise((resolve) => {
|
|
27400
|
+
let reader = new FileReader();
|
|
27401
|
+
reader.onload = function() {
|
|
27402
|
+
data.images[id] = reader.result;
|
|
27403
|
+
resolve();
|
|
27404
|
+
};
|
|
27405
|
+
reader.readAsDataURL(img.blob);
|
|
27406
|
+
});
|
|
27407
|
+
promises.push(promise);
|
|
27408
|
+
} else {
|
|
27409
|
+
data.images[id] = img.url;
|
|
27410
|
+
}
|
|
27411
|
+
});
|
|
27412
|
+
}
|
|
27413
|
+
|
|
27414
|
+
return Promise.all(promises).then(() => data);
|
|
27418
27415
|
}
|
|
27419
27416
|
|
|
27420
27417
|
fromFile(file) {
|
|
@@ -28228,4 +28225,4 @@ class Spreadsheet extends Widget {
|
|
|
28228
28225
|
}
|
|
28229
28226
|
}
|
|
28230
28227
|
|
|
28231
|
-
export { Spreadsheet };
|
|
28228
|
+
export { Range$1 as Range, Sheet, Spreadsheet, View, Workbook };
|
package/dist/index.js
CHANGED
|
@@ -22119,8 +22119,10 @@
|
|
|
22119
22119
|
if (width > element.offsetWidth) {
|
|
22120
22120
|
element.style.width = width + 'px';
|
|
22121
22121
|
}
|
|
22122
|
-
|
|
22123
|
-
|
|
22122
|
+
|
|
22123
|
+
const activeCellOutlineWidth = 1;
|
|
22124
|
+
if (height - activeCellOutlineWidth > element.offsetHeight) {
|
|
22125
|
+
element.style.height = (height - activeCellOutlineWidth) + 'px';
|
|
22124
22126
|
}
|
|
22125
22127
|
|
|
22126
22128
|
this._sync();
|
|
@@ -26051,7 +26053,7 @@
|
|
|
26051
26053
|
let relationships = await readRelationships(zip, relsFile);
|
|
26052
26054
|
|
|
26053
26055
|
if (relationships.byType.image) {
|
|
26054
|
-
|
|
26056
|
+
for (const id of Object.keys(relationships.byId)) {
|
|
26055
26057
|
let img = relative_file(file, relationships.byId[id]);
|
|
26056
26058
|
let type = getContentType(img);
|
|
26057
26059
|
|
|
@@ -26063,7 +26065,7 @@
|
|
|
26063
26065
|
: new window.Blob([ data ], { type: type });
|
|
26064
26066
|
relationships.byId[id] = sheet._workbook.addImage(blob);
|
|
26065
26067
|
}
|
|
26066
|
-
}
|
|
26068
|
+
}
|
|
26067
26069
|
}
|
|
26068
26070
|
|
|
26069
26071
|
let cdr, ref, width, height;
|
|
@@ -26758,7 +26760,7 @@
|
|
|
26758
26760
|
return val / 9525;
|
|
26759
26761
|
}
|
|
26760
26762
|
|
|
26761
|
-
/* eslint-disable no-
|
|
26763
|
+
/* eslint-disable no-undef */
|
|
26762
26764
|
|
|
26763
26765
|
const events$1 = [
|
|
26764
26766
|
"cut",
|
|
@@ -27264,33 +27266,33 @@
|
|
|
27264
27266
|
this._imgID = 0;
|
|
27265
27267
|
}
|
|
27266
27268
|
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27291
|
-
|
|
27292
|
-
|
|
27293
|
-
|
|
27269
|
+
_loadImages() {
|
|
27270
|
+
let self = this;
|
|
27271
|
+
let ids = Object.keys(self._images);
|
|
27272
|
+
let count = ids.length;
|
|
27273
|
+
if (count) {
|
|
27274
|
+
ids.forEach(function(id){
|
|
27275
|
+
let img = self._images[id];
|
|
27276
|
+
if (!img.blob) {
|
|
27277
|
+
loadBinary(img.url, function(data, type) {
|
|
27278
|
+
// XXX: can we do something better in case of error?
|
|
27279
|
+
if (data != null) {
|
|
27280
|
+
img.blob = new Blob([ data ], { type: type });
|
|
27281
|
+
delete img.url;
|
|
27282
|
+
}
|
|
27283
|
+
next();
|
|
27284
|
+
});
|
|
27285
|
+
}
|
|
27286
|
+
});
|
|
27287
|
+
} else {
|
|
27288
|
+
next();
|
|
27289
|
+
}
|
|
27290
|
+
function next() {
|
|
27291
|
+
if (--count <= 0) {
|
|
27292
|
+
self.activeSheet().triggerChange({ layout: true });
|
|
27293
|
+
}
|
|
27294
|
+
}
|
|
27295
|
+
}
|
|
27294
27296
|
|
|
27295
27297
|
fromJSON(json) {
|
|
27296
27298
|
if (json.sheets) {
|
|
@@ -27308,7 +27310,7 @@
|
|
|
27308
27310
|
}
|
|
27309
27311
|
this._images[id] = { url: json.images[id] };
|
|
27310
27312
|
}, this);
|
|
27311
|
-
|
|
27313
|
+
this._loadImages();
|
|
27312
27314
|
}
|
|
27313
27315
|
|
|
27314
27316
|
for (let idx = 0; idx < json.sheets.length; idx++) {
|
|
@@ -27375,47 +27377,42 @@
|
|
|
27375
27377
|
return sheet.toJSON();
|
|
27376
27378
|
}, this),
|
|
27377
27379
|
names: names,
|
|
27380
|
+
images: {},
|
|
27378
27381
|
columnWidth: this.options.columnWidth,
|
|
27379
27382
|
rowHeight: this.options.rowHeight
|
|
27380
27383
|
};
|
|
27381
27384
|
}
|
|
27382
27385
|
|
|
27383
27386
|
saveJSON() {
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27390
|
-
// return self.usesImage(id) === 1;
|
|
27391
|
-
// });
|
|
27392
|
-
// let count = ids.length;
|
|
27393
|
-
// data.images = {};
|
|
27394
|
-
// if (count) {
|
|
27395
|
-
// ids.forEach(function(id) {
|
|
27396
|
-
// let img = self._images[id];
|
|
27397
|
-
// if (img.blob) {
|
|
27398
|
-
// let reader = new FileReader();
|
|
27399
|
-
// reader.onload = function() {
|
|
27400
|
-
// data.images[id] = reader.result;
|
|
27401
|
-
// next();
|
|
27402
|
-
// };
|
|
27403
|
-
// reader.readAsDataURL(img.blob);
|
|
27404
|
-
// } else {
|
|
27405
|
-
// data.images[id] = img.url;
|
|
27406
|
-
// next();
|
|
27407
|
-
// }
|
|
27408
|
-
// });
|
|
27409
|
-
// } else {
|
|
27410
|
-
// next();
|
|
27411
|
-
// }
|
|
27412
|
-
// return deferred.promise();
|
|
27387
|
+
let self = this;
|
|
27388
|
+
let data = self.toJSON();
|
|
27389
|
+
let ids = Object.keys(self._images).filter(function(id) {
|
|
27390
|
+
return self.usesImage(id) === 1;
|
|
27391
|
+
});
|
|
27392
|
+
let count = ids.length;
|
|
27413
27393
|
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
|
|
27394
|
+
const promises = [];
|
|
27395
|
+
|
|
27396
|
+
if (count) {
|
|
27397
|
+
ids.forEach(function(id) {
|
|
27398
|
+
let img = self._images[id];
|
|
27399
|
+
if (img.blob) {
|
|
27400
|
+
const promise = new Promise((resolve) => {
|
|
27401
|
+
let reader = new FileReader();
|
|
27402
|
+
reader.onload = function() {
|
|
27403
|
+
data.images[id] = reader.result;
|
|
27404
|
+
resolve();
|
|
27405
|
+
};
|
|
27406
|
+
reader.readAsDataURL(img.blob);
|
|
27407
|
+
});
|
|
27408
|
+
promises.push(promise);
|
|
27409
|
+
} else {
|
|
27410
|
+
data.images[id] = img.url;
|
|
27411
|
+
}
|
|
27412
|
+
});
|
|
27413
|
+
}
|
|
27414
|
+
|
|
27415
|
+
return Promise.all(promises).then(() => data);
|
|
27419
27416
|
}
|
|
27420
27417
|
|
|
27421
27418
|
fromFile(file) {
|
|
@@ -28229,6 +28226,10 @@
|
|
|
28229
28226
|
}
|
|
28230
28227
|
}
|
|
28231
28228
|
|
|
28229
|
+
exports.Range = Range$1;
|
|
28230
|
+
exports.Sheet = Sheet;
|
|
28232
28231
|
exports.Spreadsheet = Spreadsheet;
|
|
28232
|
+
exports.View = View;
|
|
28233
|
+
exports.Workbook = Workbook;
|
|
28233
28234
|
|
|
28234
28235
|
}));
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -395,6 +395,12 @@ export class Spreadsheet {
|
|
|
395
395
|
*/
|
|
396
396
|
toJSON(): DocumentDescriptor;
|
|
397
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Serializes the workbook. This method does not return the JSON, but a Promise object which will yield the JSON data when it is available.
|
|
400
|
+
* The method is functionally similar to `toJSON`, but it is also able to save the embedded images (this is the reason why it must be asynchronous).
|
|
401
|
+
*/
|
|
402
|
+
saveJSON(): Promise<DocumentDescriptor>;
|
|
403
|
+
|
|
398
404
|
/**
|
|
399
405
|
* Clears the Spreadsheet and populates it with data from the specified Excel (.xlsx) file.
|
|
400
406
|
*
|