@progress/kendo-spreadsheet-common 1.1.2-develop.2 → 1.1.2-develop.3
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 +42 -17
- package/dist/index.js +42 -17
- package/package.json +1 -1
- package/src/index.d.ts +1 -1
package/dist/index-esm.js
CHANGED
|
@@ -25019,7 +25019,7 @@ class SaveAsCommand extends Command {
|
|
|
25019
25019
|
exec() {
|
|
25020
25020
|
let fileName = this.options.name + this.options.extension;
|
|
25021
25021
|
if (this.options.extension === ".xlsx") {
|
|
25022
|
-
this.options.workbook.saveAsExcel({
|
|
25022
|
+
return this.options.workbook.saveAsExcel({
|
|
25023
25023
|
fileName: fileName
|
|
25024
25024
|
});
|
|
25025
25025
|
} else if (this.options.extension === ".pdf") {
|
|
@@ -27452,29 +27452,47 @@ class Workbook extends Observable {
|
|
|
27452
27452
|
});
|
|
27453
27453
|
let count = ids.length;
|
|
27454
27454
|
let images = count ? {} : null;
|
|
27455
|
+
const promises = [];
|
|
27456
|
+
|
|
27455
27457
|
if (count) {
|
|
27456
27458
|
ids.forEach(function(id) {
|
|
27457
27459
|
let img = self._images[id];
|
|
27460
|
+
|
|
27458
27461
|
if (img.blob) {
|
|
27459
|
-
|
|
27460
|
-
|
|
27461
|
-
|
|
27462
|
-
|
|
27463
|
-
|
|
27464
|
-
|
|
27462
|
+
const promise = new Promise((resolve) => {
|
|
27463
|
+
let reader = new FileReader();
|
|
27464
|
+
reader.onload = function() {
|
|
27465
|
+
images[id] = {
|
|
27466
|
+
type: img.blob.type,
|
|
27467
|
+
name: img.blob.name,
|
|
27468
|
+
data: reader.result
|
|
27469
|
+
};
|
|
27470
|
+
|
|
27471
|
+
count--;
|
|
27472
|
+
resolve();
|
|
27465
27473
|
};
|
|
27466
|
-
|
|
27467
|
-
};
|
|
27468
|
-
|
|
27474
|
+
reader.readAsArrayBuffer(img.blob);
|
|
27475
|
+
});
|
|
27476
|
+
|
|
27477
|
+
promises.push(promise);
|
|
27469
27478
|
} else {
|
|
27470
|
-
|
|
27471
|
-
|
|
27472
|
-
|
|
27479
|
+
const promise = new Promise((resolve) => {
|
|
27480
|
+
loadBinary(img.url, function(data, type) {
|
|
27481
|
+
images[id] = { type: type, data: data };
|
|
27482
|
+
count--;
|
|
27483
|
+
resolve();
|
|
27484
|
+
});
|
|
27473
27485
|
});
|
|
27486
|
+
promises.push(promise);
|
|
27474
27487
|
}
|
|
27475
27488
|
});
|
|
27489
|
+
|
|
27490
|
+
return Promise.all(promises)
|
|
27491
|
+
.then(() => {
|
|
27492
|
+
return next();
|
|
27493
|
+
});
|
|
27476
27494
|
} else {
|
|
27477
|
-
next();
|
|
27495
|
+
return next();
|
|
27478
27496
|
}
|
|
27479
27497
|
|
|
27480
27498
|
function next() {
|
|
@@ -27482,13 +27500,20 @@ class Workbook extends Observable {
|
|
|
27482
27500
|
data.images = images;
|
|
27483
27501
|
let workbook = new options.Workbook(data);
|
|
27484
27502
|
const promise = options.forceProxy ? workbook.toDataURL() : workbook.toBlob();
|
|
27485
|
-
|
|
27503
|
+
|
|
27504
|
+
if (!options.saveAs) {
|
|
27505
|
+
return promise;
|
|
27506
|
+
}
|
|
27507
|
+
|
|
27508
|
+
return promise.then(blob => {
|
|
27486
27509
|
options.saveAs(blob, data.fileName || options.fileName, {
|
|
27487
27510
|
proxyURL: options.proxyURL,
|
|
27488
27511
|
forceProxy: options.forceProxy
|
|
27489
27512
|
});
|
|
27490
27513
|
});
|
|
27491
27514
|
}
|
|
27515
|
+
|
|
27516
|
+
return Promise.resolve();
|
|
27492
27517
|
}
|
|
27493
27518
|
}
|
|
27494
27519
|
|
|
@@ -28031,7 +28056,7 @@ class SpreadsheetWidget extends Widget {
|
|
|
28031
28056
|
}
|
|
28032
28057
|
|
|
28033
28058
|
saveAsExcel(options) {
|
|
28034
|
-
this._workbook.saveAsExcel(options);
|
|
28059
|
+
return this._workbook.saveAsExcel(options);
|
|
28035
28060
|
}
|
|
28036
28061
|
|
|
28037
28062
|
draw(options, callback) {
|
|
@@ -28174,7 +28199,7 @@ class SpreadsheetWidget extends Widget {
|
|
|
28174
28199
|
// kendo.ui.progress(this.element, e.toggle);
|
|
28175
28200
|
}
|
|
28176
28201
|
|
|
28177
|
-
_onContextMenu(e) {
|
|
28202
|
+
_onContextMenu(e) {
|
|
28178
28203
|
this.trigger("contextmenu", e);
|
|
28179
28204
|
}
|
|
28180
28205
|
|
package/dist/index.js
CHANGED
|
@@ -25020,7 +25020,7 @@
|
|
|
25020
25020
|
exec() {
|
|
25021
25021
|
let fileName = this.options.name + this.options.extension;
|
|
25022
25022
|
if (this.options.extension === ".xlsx") {
|
|
25023
|
-
this.options.workbook.saveAsExcel({
|
|
25023
|
+
return this.options.workbook.saveAsExcel({
|
|
25024
25024
|
fileName: fileName
|
|
25025
25025
|
});
|
|
25026
25026
|
} else if (this.options.extension === ".pdf") {
|
|
@@ -27453,29 +27453,47 @@
|
|
|
27453
27453
|
});
|
|
27454
27454
|
let count = ids.length;
|
|
27455
27455
|
let images = count ? {} : null;
|
|
27456
|
+
const promises = [];
|
|
27457
|
+
|
|
27456
27458
|
if (count) {
|
|
27457
27459
|
ids.forEach(function(id) {
|
|
27458
27460
|
let img = self._images[id];
|
|
27461
|
+
|
|
27459
27462
|
if (img.blob) {
|
|
27460
|
-
|
|
27461
|
-
|
|
27462
|
-
|
|
27463
|
-
|
|
27464
|
-
|
|
27465
|
-
|
|
27463
|
+
const promise = new Promise((resolve) => {
|
|
27464
|
+
let reader = new FileReader();
|
|
27465
|
+
reader.onload = function() {
|
|
27466
|
+
images[id] = {
|
|
27467
|
+
type: img.blob.type,
|
|
27468
|
+
name: img.blob.name,
|
|
27469
|
+
data: reader.result
|
|
27470
|
+
};
|
|
27471
|
+
|
|
27472
|
+
count--;
|
|
27473
|
+
resolve();
|
|
27466
27474
|
};
|
|
27467
|
-
|
|
27468
|
-
};
|
|
27469
|
-
|
|
27475
|
+
reader.readAsArrayBuffer(img.blob);
|
|
27476
|
+
});
|
|
27477
|
+
|
|
27478
|
+
promises.push(promise);
|
|
27470
27479
|
} else {
|
|
27471
|
-
|
|
27472
|
-
|
|
27473
|
-
|
|
27480
|
+
const promise = new Promise((resolve) => {
|
|
27481
|
+
loadBinary(img.url, function(data, type) {
|
|
27482
|
+
images[id] = { type: type, data: data };
|
|
27483
|
+
count--;
|
|
27484
|
+
resolve();
|
|
27485
|
+
});
|
|
27474
27486
|
});
|
|
27487
|
+
promises.push(promise);
|
|
27475
27488
|
}
|
|
27476
27489
|
});
|
|
27490
|
+
|
|
27491
|
+
return Promise.all(promises)
|
|
27492
|
+
.then(() => {
|
|
27493
|
+
return next();
|
|
27494
|
+
});
|
|
27477
27495
|
} else {
|
|
27478
|
-
next();
|
|
27496
|
+
return next();
|
|
27479
27497
|
}
|
|
27480
27498
|
|
|
27481
27499
|
function next() {
|
|
@@ -27483,13 +27501,20 @@
|
|
|
27483
27501
|
data.images = images;
|
|
27484
27502
|
let workbook = new options.Workbook(data);
|
|
27485
27503
|
const promise = options.forceProxy ? workbook.toDataURL() : workbook.toBlob();
|
|
27486
|
-
|
|
27504
|
+
|
|
27505
|
+
if (!options.saveAs) {
|
|
27506
|
+
return promise;
|
|
27507
|
+
}
|
|
27508
|
+
|
|
27509
|
+
return promise.then(blob => {
|
|
27487
27510
|
options.saveAs(blob, data.fileName || options.fileName, {
|
|
27488
27511
|
proxyURL: options.proxyURL,
|
|
27489
27512
|
forceProxy: options.forceProxy
|
|
27490
27513
|
});
|
|
27491
27514
|
});
|
|
27492
27515
|
}
|
|
27516
|
+
|
|
27517
|
+
return Promise.resolve();
|
|
27493
27518
|
}
|
|
27494
27519
|
}
|
|
27495
27520
|
|
|
@@ -28032,7 +28057,7 @@
|
|
|
28032
28057
|
}
|
|
28033
28058
|
|
|
28034
28059
|
saveAsExcel(options) {
|
|
28035
|
-
this._workbook.saveAsExcel(options);
|
|
28060
|
+
return this._workbook.saveAsExcel(options);
|
|
28036
28061
|
}
|
|
28037
28062
|
|
|
28038
28063
|
draw(options, callback) {
|
|
@@ -28175,7 +28200,7 @@
|
|
|
28175
28200
|
// kendo.ui.progress(this.element, e.toggle);
|
|
28176
28201
|
}
|
|
28177
28202
|
|
|
28178
|
-
_onContextMenu(e) {
|
|
28203
|
+
_onContextMenu(e) {
|
|
28179
28204
|
this.trigger("contextmenu", e);
|
|
28180
28205
|
}
|
|
28181
28206
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -754,7 +754,7 @@ export class SpreadsheetWidget {
|
|
|
754
754
|
* Note: Calling this method may trigger the built-in popup blocker of the browser.
|
|
755
755
|
* To avoid that, always call it as a response to an end-user action, for example, a button click.
|
|
756
756
|
*/
|
|
757
|
-
saveAsExcel(options: any):
|
|
757
|
+
saveAsExcel(options: any): Promise<Blob | string>;
|
|
758
758
|
|
|
759
759
|
/**
|
|
760
760
|
* Gets or sets the active sheet.
|