@progress/kendo-spreadsheet-common 1.2.7-develop.3 → 1.2.7
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 +73 -55
- package/dist/index.js +73 -55
- package/package.json +1 -1
package/dist/index-esm.js
CHANGED
|
@@ -20811,58 +20811,66 @@ const parseXML = function parseXML() {
|
|
|
20811
20811
|
}
|
|
20812
20812
|
};
|
|
20813
20813
|
|
|
20814
|
-
class Deferred {
|
|
20815
|
-
constructor() {
|
|
20816
|
-
this._progressHandlers = [];
|
|
20817
|
-
this._resolved = false;
|
|
20818
|
-
this._rejected = false;
|
|
20819
|
-
this.promise = new window.Promise((resolve, reject) => {
|
|
20820
|
-
this._resolve = (value) => {
|
|
20821
|
-
if (!this._resolved && !this._rejected) {
|
|
20822
|
-
this._resolved = true;
|
|
20823
|
-
resolve(value);
|
|
20824
|
-
}
|
|
20825
|
-
};
|
|
20826
|
-
this._reject = (reason) => {
|
|
20827
|
-
if (!this._resolved && !this._rejected) {
|
|
20828
|
-
this._rejected = true;
|
|
20829
|
-
reject(reason);
|
|
20830
|
-
}
|
|
20831
|
-
};
|
|
20832
|
-
});
|
|
20833
|
-
}
|
|
20834
|
-
|
|
20835
|
-
resolve(value) {
|
|
20836
|
-
this._resolve(value);
|
|
20837
|
-
return this;
|
|
20838
|
-
}
|
|
20839
|
-
|
|
20840
|
-
reject(reason) {
|
|
20841
|
-
this._reject(reason);
|
|
20842
|
-
return this;
|
|
20843
|
-
}
|
|
20844
|
-
|
|
20845
|
-
notify(value) {
|
|
20846
|
-
if (!this._resolved && !this._rejected) {
|
|
20847
|
-
this._progressHandlers.forEach(handler => handler(value));
|
|
20848
|
-
}
|
|
20849
|
-
}
|
|
20850
|
-
|
|
20851
|
-
progress(callback) {
|
|
20852
|
-
this._progressHandlers.push(callback);
|
|
20853
|
-
return this;
|
|
20854
|
-
}
|
|
20855
|
-
|
|
20856
|
-
then(onFulfilled, onRejected, onProgress) {
|
|
20857
|
-
if (onProgress) {
|
|
20858
|
-
this.progress(onProgress);
|
|
20859
|
-
}
|
|
20860
|
-
return this.promise.then(onFulfilled, onRejected);
|
|
20861
|
-
}
|
|
20862
|
-
|
|
20863
|
-
|
|
20864
|
-
return this.promise;
|
|
20865
|
-
}
|
|
20814
|
+
class Deferred {
|
|
20815
|
+
constructor() {
|
|
20816
|
+
this._progressHandlers = [];
|
|
20817
|
+
this._resolved = false;
|
|
20818
|
+
this._rejected = false;
|
|
20819
|
+
this.promise = new window.Promise((resolve, reject) => {
|
|
20820
|
+
this._resolve = (value) => {
|
|
20821
|
+
if (!this._resolved && !this._rejected) {
|
|
20822
|
+
this._resolved = true;
|
|
20823
|
+
resolve(value);
|
|
20824
|
+
}
|
|
20825
|
+
};
|
|
20826
|
+
this._reject = (reason) => {
|
|
20827
|
+
if (!this._resolved && !this._rejected) {
|
|
20828
|
+
this._rejected = true;
|
|
20829
|
+
reject(reason);
|
|
20830
|
+
}
|
|
20831
|
+
};
|
|
20832
|
+
});
|
|
20833
|
+
}
|
|
20834
|
+
|
|
20835
|
+
resolve(value) {
|
|
20836
|
+
this._resolve(value);
|
|
20837
|
+
return this;
|
|
20838
|
+
}
|
|
20839
|
+
|
|
20840
|
+
reject(reason) {
|
|
20841
|
+
this._reject(reason);
|
|
20842
|
+
return this;
|
|
20843
|
+
}
|
|
20844
|
+
|
|
20845
|
+
notify(value) {
|
|
20846
|
+
if (!this._resolved && !this._rejected) {
|
|
20847
|
+
this._progressHandlers.forEach(handler => handler(value));
|
|
20848
|
+
}
|
|
20849
|
+
}
|
|
20850
|
+
|
|
20851
|
+
progress(callback) {
|
|
20852
|
+
this._progressHandlers.push(callback);
|
|
20853
|
+
return this;
|
|
20854
|
+
}
|
|
20855
|
+
|
|
20856
|
+
then(onFulfilled, onRejected, onProgress) {
|
|
20857
|
+
if (onProgress) {
|
|
20858
|
+
this.progress(onProgress);
|
|
20859
|
+
}
|
|
20860
|
+
return this.promise.then(onFulfilled, onRejected);
|
|
20861
|
+
}
|
|
20862
|
+
|
|
20863
|
+
catch(onRejected) {
|
|
20864
|
+
return this.promise.catch(onRejected);
|
|
20865
|
+
}
|
|
20866
|
+
|
|
20867
|
+
finally(onFinally) {
|
|
20868
|
+
return this.promise.finally(onFinally);
|
|
20869
|
+
}
|
|
20870
|
+
|
|
20871
|
+
promise() {
|
|
20872
|
+
return this.promise;
|
|
20873
|
+
}
|
|
20866
20874
|
}
|
|
20867
20875
|
|
|
20868
20876
|
/* eslint-disable complexity */
|
|
@@ -20883,8 +20891,16 @@ let ERROR_LOG = null;
|
|
|
20883
20891
|
function readExcel(file, workbook, deferred) {
|
|
20884
20892
|
let reader = new FileReader();
|
|
20885
20893
|
reader.onload = async function(e) {
|
|
20886
|
-
|
|
20887
|
-
|
|
20894
|
+
try {
|
|
20895
|
+
const zip = await JSZip.loadAsync(e.target.result);
|
|
20896
|
+
await readWorkbook(zip, workbook, deferred);
|
|
20897
|
+
} catch (error) {
|
|
20898
|
+
deferred.reject(error);
|
|
20899
|
+
}
|
|
20900
|
+
};
|
|
20901
|
+
|
|
20902
|
+
reader.onerror = function() {
|
|
20903
|
+
deferred.reject(new Error('Failed to read file: ' + (reader.error?.message || 'Unknown error')));
|
|
20888
20904
|
};
|
|
20889
20905
|
|
|
20890
20906
|
reader.readAsArrayBuffer(file);
|
|
@@ -20971,6 +20987,9 @@ function xl(file) {
|
|
|
20971
20987
|
async function readWorkbook(zip, workbook, progress) {
|
|
20972
20988
|
ERROR_LOG = workbook.excelImportErrors = [];
|
|
20973
20989
|
|
|
20990
|
+
// Clear sheets only after confirming the file is a valid ZIP
|
|
20991
|
+
workbook._clearSheets();
|
|
20992
|
+
|
|
20974
20993
|
let strings = await readStrings(zip);
|
|
20975
20994
|
let relationships = await readRelationships(zip, "_rels/workbook.xml");
|
|
20976
20995
|
let theme = await readTheme(zip, relationships.byType.theme[0]);
|
|
@@ -22903,7 +22922,6 @@ class Workbook extends Observable {
|
|
|
22903
22922
|
const deferred = new Deferred();
|
|
22904
22923
|
|
|
22905
22924
|
if (file && !this.trigger("excelImport", { file, deferred })) {
|
|
22906
|
-
this._clearSheets();
|
|
22907
22925
|
this._readExcel(file, this, deferred);
|
|
22908
22926
|
}
|
|
22909
22927
|
|
package/dist/index.js
CHANGED
|
@@ -20812,58 +20812,66 @@
|
|
|
20812
20812
|
}
|
|
20813
20813
|
};
|
|
20814
20814
|
|
|
20815
|
-
class Deferred {
|
|
20816
|
-
constructor() {
|
|
20817
|
-
this._progressHandlers = [];
|
|
20818
|
-
this._resolved = false;
|
|
20819
|
-
this._rejected = false;
|
|
20820
|
-
this.promise = new window.Promise((resolve, reject) => {
|
|
20821
|
-
this._resolve = (value) => {
|
|
20822
|
-
if (!this._resolved && !this._rejected) {
|
|
20823
|
-
this._resolved = true;
|
|
20824
|
-
resolve(value);
|
|
20825
|
-
}
|
|
20826
|
-
};
|
|
20827
|
-
this._reject = (reason) => {
|
|
20828
|
-
if (!this._resolved && !this._rejected) {
|
|
20829
|
-
this._rejected = true;
|
|
20830
|
-
reject(reason);
|
|
20831
|
-
}
|
|
20832
|
-
};
|
|
20833
|
-
});
|
|
20834
|
-
}
|
|
20835
|
-
|
|
20836
|
-
resolve(value) {
|
|
20837
|
-
this._resolve(value);
|
|
20838
|
-
return this;
|
|
20839
|
-
}
|
|
20840
|
-
|
|
20841
|
-
reject(reason) {
|
|
20842
|
-
this._reject(reason);
|
|
20843
|
-
return this;
|
|
20844
|
-
}
|
|
20845
|
-
|
|
20846
|
-
notify(value) {
|
|
20847
|
-
if (!this._resolved && !this._rejected) {
|
|
20848
|
-
this._progressHandlers.forEach(handler => handler(value));
|
|
20849
|
-
}
|
|
20850
|
-
}
|
|
20851
|
-
|
|
20852
|
-
progress(callback) {
|
|
20853
|
-
this._progressHandlers.push(callback);
|
|
20854
|
-
return this;
|
|
20855
|
-
}
|
|
20856
|
-
|
|
20857
|
-
then(onFulfilled, onRejected, onProgress) {
|
|
20858
|
-
if (onProgress) {
|
|
20859
|
-
this.progress(onProgress);
|
|
20860
|
-
}
|
|
20861
|
-
return this.promise.then(onFulfilled, onRejected);
|
|
20862
|
-
}
|
|
20863
|
-
|
|
20864
|
-
|
|
20865
|
-
return this.promise;
|
|
20866
|
-
}
|
|
20815
|
+
class Deferred {
|
|
20816
|
+
constructor() {
|
|
20817
|
+
this._progressHandlers = [];
|
|
20818
|
+
this._resolved = false;
|
|
20819
|
+
this._rejected = false;
|
|
20820
|
+
this.promise = new window.Promise((resolve, reject) => {
|
|
20821
|
+
this._resolve = (value) => {
|
|
20822
|
+
if (!this._resolved && !this._rejected) {
|
|
20823
|
+
this._resolved = true;
|
|
20824
|
+
resolve(value);
|
|
20825
|
+
}
|
|
20826
|
+
};
|
|
20827
|
+
this._reject = (reason) => {
|
|
20828
|
+
if (!this._resolved && !this._rejected) {
|
|
20829
|
+
this._rejected = true;
|
|
20830
|
+
reject(reason);
|
|
20831
|
+
}
|
|
20832
|
+
};
|
|
20833
|
+
});
|
|
20834
|
+
}
|
|
20835
|
+
|
|
20836
|
+
resolve(value) {
|
|
20837
|
+
this._resolve(value);
|
|
20838
|
+
return this;
|
|
20839
|
+
}
|
|
20840
|
+
|
|
20841
|
+
reject(reason) {
|
|
20842
|
+
this._reject(reason);
|
|
20843
|
+
return this;
|
|
20844
|
+
}
|
|
20845
|
+
|
|
20846
|
+
notify(value) {
|
|
20847
|
+
if (!this._resolved && !this._rejected) {
|
|
20848
|
+
this._progressHandlers.forEach(handler => handler(value));
|
|
20849
|
+
}
|
|
20850
|
+
}
|
|
20851
|
+
|
|
20852
|
+
progress(callback) {
|
|
20853
|
+
this._progressHandlers.push(callback);
|
|
20854
|
+
return this;
|
|
20855
|
+
}
|
|
20856
|
+
|
|
20857
|
+
then(onFulfilled, onRejected, onProgress) {
|
|
20858
|
+
if (onProgress) {
|
|
20859
|
+
this.progress(onProgress);
|
|
20860
|
+
}
|
|
20861
|
+
return this.promise.then(onFulfilled, onRejected);
|
|
20862
|
+
}
|
|
20863
|
+
|
|
20864
|
+
catch(onRejected) {
|
|
20865
|
+
return this.promise.catch(onRejected);
|
|
20866
|
+
}
|
|
20867
|
+
|
|
20868
|
+
finally(onFinally) {
|
|
20869
|
+
return this.promise.finally(onFinally);
|
|
20870
|
+
}
|
|
20871
|
+
|
|
20872
|
+
promise() {
|
|
20873
|
+
return this.promise;
|
|
20874
|
+
}
|
|
20867
20875
|
}
|
|
20868
20876
|
|
|
20869
20877
|
/* eslint-disable complexity */
|
|
@@ -20884,8 +20892,16 @@
|
|
|
20884
20892
|
function readExcel(file, workbook, deferred) {
|
|
20885
20893
|
let reader = new FileReader();
|
|
20886
20894
|
reader.onload = async function(e) {
|
|
20887
|
-
|
|
20888
|
-
|
|
20895
|
+
try {
|
|
20896
|
+
const zip = await JSZip.loadAsync(e.target.result);
|
|
20897
|
+
await readWorkbook(zip, workbook, deferred);
|
|
20898
|
+
} catch (error) {
|
|
20899
|
+
deferred.reject(error);
|
|
20900
|
+
}
|
|
20901
|
+
};
|
|
20902
|
+
|
|
20903
|
+
reader.onerror = function() {
|
|
20904
|
+
deferred.reject(new Error('Failed to read file: ' + (reader.error?.message || 'Unknown error')));
|
|
20889
20905
|
};
|
|
20890
20906
|
|
|
20891
20907
|
reader.readAsArrayBuffer(file);
|
|
@@ -20972,6 +20988,9 @@
|
|
|
20972
20988
|
async function readWorkbook(zip, workbook, progress) {
|
|
20973
20989
|
ERROR_LOG = workbook.excelImportErrors = [];
|
|
20974
20990
|
|
|
20991
|
+
// Clear sheets only after confirming the file is a valid ZIP
|
|
20992
|
+
workbook._clearSheets();
|
|
20993
|
+
|
|
20975
20994
|
let strings = await readStrings(zip);
|
|
20976
20995
|
let relationships = await readRelationships(zip, "_rels/workbook.xml");
|
|
20977
20996
|
let theme = await readTheme(zip, relationships.byType.theme[0]);
|
|
@@ -22904,7 +22923,6 @@
|
|
|
22904
22923
|
const deferred = new Deferred();
|
|
22905
22924
|
|
|
22906
22925
|
if (file && !this.trigger("excelImport", { file, deferred })) {
|
|
22907
|
-
this._clearSheets();
|
|
22908
22926
|
this._readExcel(file, this, deferred);
|
|
22909
22927
|
}
|
|
22910
22928
|
|