@progress/kendo-spreadsheet-common 1.0.0-develop.5 → 1.0.0-develop.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 +148 -146
- package/dist/index.js +152 -149
- package/package.json +3 -3
- package/src/index.d.ts +6 -0
package/dist/index-esm.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { localeInfo, parseDate as parseDate$1, format, toString } from '@progress/kendo-intl';
|
|
2
1
|
import { drawing, parseColor, geometry, drawDOM } from '@progress/kendo-drawing';
|
|
3
2
|
import { dayOfWeek, getDate, addDays, firstDayOfMonth } from '@progress/kendo-date-math';
|
|
4
3
|
import { browser } from '@progress/kendo-common';
|
|
@@ -945,6 +944,49 @@ SHEETREF.print = function() {
|
|
|
945
944
|
return "#SHEET";
|
|
946
945
|
};
|
|
947
946
|
|
|
947
|
+
/* eslint-disable key-spacing */
|
|
948
|
+
const messages = {};
|
|
949
|
+
messages.view = {
|
|
950
|
+
nameBox: "Name Box",
|
|
951
|
+
errors: {
|
|
952
|
+
openUnsupported: "Unsupported format. Please select an .xlsx file.",
|
|
953
|
+
shiftingNonblankCells: "Cannot insert cells due to data loss possibility. Select another insert location or delete the data from the end of your worksheet.",
|
|
954
|
+
insertColumnWhenRowIsSelected: "Cannot insert column when all columns are selected.",
|
|
955
|
+
insertRowWhenColumnIsSelected: "Cannot insert row when all rows are selected.",
|
|
956
|
+
filterRangeContainingMerges: "Cannot create a filter within a range containing merges",
|
|
957
|
+
sortRangeContainingMerges: "Cannot sort a range containing merges",
|
|
958
|
+
cantSortMultipleSelection: "Cannot sort multiple selection",
|
|
959
|
+
cantSortNullRef: "Cannot sort empty selection",
|
|
960
|
+
cantSortMixedCells: "Cannot sort range containing cells of mixed shapes",
|
|
961
|
+
validationError: "The value that you entered violates the validation rules set on the cell.",
|
|
962
|
+
cannotModifyDisabled: "Cannot modify disabled cells.",
|
|
963
|
+
insertRowBelowLastRow: "Cannot insert row below the last row.",
|
|
964
|
+
insertColAfterLastCol: "Cannot insert column to the right of the last column."
|
|
965
|
+
},
|
|
966
|
+
tabs: {
|
|
967
|
+
home: "Home",
|
|
968
|
+
insert: "Insert",
|
|
969
|
+
data: "Data"
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
messages.menus = {
|
|
974
|
+
"cut" : "Cut",
|
|
975
|
+
"copy" : "Copy",
|
|
976
|
+
"paste" : "Paste",
|
|
977
|
+
"merge" : "Merge",
|
|
978
|
+
"unmerge" : "Unmerge",
|
|
979
|
+
"delete" : "Delete",
|
|
980
|
+
"hide" : "Hide",
|
|
981
|
+
"unhide" : "Unhide",
|
|
982
|
+
"bringToFront" : "Bring to front",
|
|
983
|
+
"sendToBack" : "Send to back"
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
messages.workbook = {
|
|
987
|
+
defaultSheetName: "Sheet"
|
|
988
|
+
};
|
|
989
|
+
|
|
948
990
|
const options = {
|
|
949
991
|
name: "Spreadsheet",
|
|
950
992
|
toolbar: true,
|
|
@@ -960,7 +1002,7 @@ const options = {
|
|
|
960
1002
|
forceProxy: false,
|
|
961
1003
|
proxyURL: "",
|
|
962
1004
|
},
|
|
963
|
-
messages:
|
|
1005
|
+
messages: messages,
|
|
964
1006
|
pdf: {
|
|
965
1007
|
// which part of the workbook to be exported
|
|
966
1008
|
area: "workbook",
|
|
@@ -1354,18 +1396,18 @@ class CalcError {
|
|
|
1354
1396
|
}
|
|
1355
1397
|
}
|
|
1356
1398
|
|
|
1357
|
-
|
|
1399
|
+
let intlValue = {};
|
|
1358
1400
|
|
|
1359
|
-
const
|
|
1401
|
+
const intl = (value) => {
|
|
1360
1402
|
if (value) {
|
|
1361
|
-
|
|
1403
|
+
intlValue = value;
|
|
1362
1404
|
} else {
|
|
1363
|
-
return
|
|
1405
|
+
return intlValue;
|
|
1364
1406
|
}
|
|
1365
1407
|
};
|
|
1366
1408
|
|
|
1367
1409
|
const culture = () => {
|
|
1368
|
-
return localeInfo(
|
|
1410
|
+
return intl().localeInfo();
|
|
1369
1411
|
};
|
|
1370
1412
|
|
|
1371
1413
|
function createKendoObj(calc, CalcError, Ref, CellRef, RangeRef) {
|
|
@@ -2993,9 +3035,10 @@ function parseDate(str, format) {
|
|
|
2993
3035
|
if (format) {
|
|
2994
3036
|
format = formatting.makeDateFormat(format);
|
|
2995
3037
|
}
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
||
|
|
3038
|
+
const parseExactDate = intl().parseDate;
|
|
3039
|
+
return parseExactDate(str, format)
|
|
3040
|
+
|| parseExactDate(str)
|
|
3041
|
+
|| parseExactDate(str, [
|
|
2999
3042
|
"MMMM dd yyyy",
|
|
3000
3043
|
"MMMM dd yy",
|
|
3001
3044
|
"MMM dd yyyy",
|
|
@@ -12733,10 +12776,6 @@ const ALL_PROPERTIES = propertyBagSpec.reduce(function(a, spec) {
|
|
|
12733
12776
|
return a;
|
|
12734
12777
|
}, [ "borderTop", "borderRight", "borderBottom", "borderLeft" ]);
|
|
12735
12778
|
|
|
12736
|
-
const kendoFormat = function(fmt, ...values) {
|
|
12737
|
-
return format(fmt, values, locale())
|
|
12738
|
-
};
|
|
12739
|
-
|
|
12740
12779
|
/* eslint-disable no-param-reassign */
|
|
12741
12780
|
|
|
12742
12781
|
let TRANSPOSE_FORMAT = "_matrix({0})";
|
|
@@ -12756,13 +12795,13 @@ function compileValidation(sheet, row, col, validation) {
|
|
|
12756
12795
|
if (validation.from.indexOf("{") > -1) {
|
|
12757
12796
|
validation.from = validation.from.replace(/\"/g,"").replace("{","\"").replace("}", "\"");
|
|
12758
12797
|
}
|
|
12759
|
-
validation.from =
|
|
12798
|
+
validation.from = intl().format(TRANSPOSE_FORMAT, validation.from);
|
|
12760
12799
|
validation.fromIsListValue = true;
|
|
12761
12800
|
}
|
|
12762
12801
|
if (validation.dataType === "date") {
|
|
12763
12802
|
parsedFromDate = calc.runtime.parseDate(validation.from);
|
|
12764
12803
|
if (parsedFromDate) {
|
|
12765
|
-
validation.from =
|
|
12804
|
+
validation.from = intl().format(DATE_FORMAT, validation.from);
|
|
12766
12805
|
validation.fromIsDateValue = true;
|
|
12767
12806
|
}
|
|
12768
12807
|
}
|
|
@@ -12772,7 +12811,7 @@ function compileValidation(sheet, row, col, validation) {
|
|
|
12772
12811
|
if (validation.dataType === "date") {
|
|
12773
12812
|
parsedToDate = calc.runtime.parseDate(validation.to);
|
|
12774
12813
|
if (parsedToDate) {
|
|
12775
|
-
validation.to =
|
|
12814
|
+
validation.to = intl().format(DATE_FORMAT, validation.to);
|
|
12776
12815
|
validation.toIsDateValue = true;
|
|
12777
12816
|
}
|
|
12778
12817
|
}
|
|
@@ -12786,7 +12825,7 @@ function compileValidation(sheet, row, col, validation) {
|
|
|
12786
12825
|
comparer = validationExport.validationComparers[validation.comparerType];
|
|
12787
12826
|
}
|
|
12788
12827
|
if (!comparer) {
|
|
12789
|
-
throw
|
|
12828
|
+
throw intl().format("'{0}' comparer is not implemented.", validation.comparerType);
|
|
12790
12829
|
}
|
|
12791
12830
|
validationHandler = function(valueToCompare) { //add 'valueFormat' arg when add isDate comparer
|
|
12792
12831
|
let toValue = this.to && (this.to_value || this.to_value === 0) ? this.to_value : undefined;
|
|
@@ -12852,7 +12891,7 @@ class Validation {
|
|
|
12852
12891
|
let dataType = this.dataType;
|
|
12853
12892
|
let type = this.type;
|
|
12854
12893
|
let comparerType = this.comparerType;
|
|
12855
|
-
return
|
|
12894
|
+
return intl().format(format, from, to, fromFormula, toFormula, dataType, type, comparerType);
|
|
12856
12895
|
}
|
|
12857
12896
|
_setMessages() {
|
|
12858
12897
|
this.title = "";
|
|
@@ -13249,7 +13288,8 @@ let Range$1 = class Range {
|
|
|
13249
13288
|
}
|
|
13250
13289
|
}
|
|
13251
13290
|
if (type === "date") {
|
|
13252
|
-
|
|
13291
|
+
const intlVal = intl();
|
|
13292
|
+
value = intlVal.toString(serialToDate(value), culture().calendar.patterns.d, intlVal.locale);
|
|
13253
13293
|
} else if (type === "percent") {
|
|
13254
13294
|
value = calc.runtime.limitPrecision(value * 100) + "%";
|
|
13255
13295
|
} else if (typeof value == "string" &&
|
|
@@ -14736,49 +14776,6 @@ function notEqual(oldRect, newRect) {
|
|
|
14736
14776
|
return oldRect && (oldRect.top !== newRect.top || oldRect.left !== newRect.left);
|
|
14737
14777
|
}
|
|
14738
14778
|
|
|
14739
|
-
/* eslint-disable key-spacing */
|
|
14740
|
-
const messages = {};
|
|
14741
|
-
messages.view = {
|
|
14742
|
-
nameBox: "Name Box",
|
|
14743
|
-
errors: {
|
|
14744
|
-
openUnsupported: "Unsupported format. Please select an .xlsx file.",
|
|
14745
|
-
shiftingNonblankCells: "Cannot insert cells due to data loss possibility. Select another insert location or delete the data from the end of your worksheet.",
|
|
14746
|
-
insertColumnWhenRowIsSelected: "Cannot insert column when all columns are selected.",
|
|
14747
|
-
insertRowWhenColumnIsSelected: "Cannot insert row when all rows are selected.",
|
|
14748
|
-
filterRangeContainingMerges: "Cannot create a filter within a range containing merges",
|
|
14749
|
-
sortRangeContainingMerges: "Cannot sort a range containing merges",
|
|
14750
|
-
cantSortMultipleSelection: "Cannot sort multiple selection",
|
|
14751
|
-
cantSortNullRef: "Cannot sort empty selection",
|
|
14752
|
-
cantSortMixedCells: "Cannot sort range containing cells of mixed shapes",
|
|
14753
|
-
validationError: "The value that you entered violates the validation rules set on the cell.",
|
|
14754
|
-
cannotModifyDisabled: "Cannot modify disabled cells.",
|
|
14755
|
-
insertRowBelowLastRow: "Cannot insert row below the last row.",
|
|
14756
|
-
insertColAfterLastCol: "Cannot insert column to the right of the last column."
|
|
14757
|
-
},
|
|
14758
|
-
tabs: {
|
|
14759
|
-
home: "Home",
|
|
14760
|
-
insert: "Insert",
|
|
14761
|
-
data: "Data"
|
|
14762
|
-
}
|
|
14763
|
-
};
|
|
14764
|
-
|
|
14765
|
-
messages.menus = {
|
|
14766
|
-
"cut" : "Cut",
|
|
14767
|
-
"copy" : "Copy",
|
|
14768
|
-
"paste" : "Paste",
|
|
14769
|
-
"merge" : "Merge",
|
|
14770
|
-
"unmerge" : "Unmerge",
|
|
14771
|
-
"delete" : "Delete",
|
|
14772
|
-
"hide" : "Hide",
|
|
14773
|
-
"unhide" : "Unhide",
|
|
14774
|
-
"bringToFront" : "Bring to front",
|
|
14775
|
-
"sendToBack" : "Send to back"
|
|
14776
|
-
};
|
|
14777
|
-
|
|
14778
|
-
messages.workbook = {
|
|
14779
|
-
defaultSheetName: "Sheet"
|
|
14780
|
-
};
|
|
14781
|
-
|
|
14782
14779
|
const ampRegExp = /&/g,
|
|
14783
14780
|
ltRegExp = /</g,
|
|
14784
14781
|
quoteRegExp = /"/g,
|
|
@@ -17377,15 +17374,17 @@ filtersObj = {
|
|
|
17377
17374
|
};
|
|
17378
17375
|
});
|
|
17379
17376
|
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
17384
|
-
|
|
17377
|
+
const initDynamicFilter = () => {
|
|
17378
|
+
culture().calendar.months.format.wide.forEach(function(month, index) {
|
|
17379
|
+
DynamicFilter.prototype[month.toLowerCase()] = function(value) {
|
|
17380
|
+
if (value instanceof Date) {
|
|
17381
|
+
return value.getMonth() === index;
|
|
17382
|
+
}
|
|
17385
17383
|
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
});
|
|
17384
|
+
return false;
|
|
17385
|
+
};
|
|
17386
|
+
});
|
|
17387
|
+
};
|
|
17389
17388
|
|
|
17390
17389
|
function quarter(value) {
|
|
17391
17390
|
var month = value.getMonth() + 1;
|
|
@@ -20487,7 +20486,7 @@ function Borders() {
|
|
|
20487
20486
|
// if (options.useGridFormat) {
|
|
20488
20487
|
// if (value != null) {
|
|
20489
20488
|
// if (col.format) {
|
|
20490
|
-
// value =
|
|
20489
|
+
// value = intl().format(col.format, value);
|
|
20491
20490
|
// } else {
|
|
20492
20491
|
// value += "";
|
|
20493
20492
|
// }
|
|
@@ -21785,13 +21784,13 @@ class FormulaInput extends Widget {
|
|
|
21785
21784
|
if (this._isFormula() && !this._navigated) {
|
|
21786
21785
|
value = ((this._tokenContext() || {}).token || {}).value;
|
|
21787
21786
|
|
|
21788
|
-
this.filter(value);
|
|
21787
|
+
const data = this.filter(value);
|
|
21789
21788
|
|
|
21790
|
-
if (!value || !
|
|
21789
|
+
if (!value || !data.length) {
|
|
21791
21790
|
popup.close();
|
|
21792
21791
|
} else {
|
|
21793
21792
|
popup[popup.visible() ? "position" : "open"]();
|
|
21794
|
-
this.list.focusFirst();
|
|
21793
|
+
setTimeout(() => { this.list.focusFirst(); }, 0);
|
|
21795
21794
|
}
|
|
21796
21795
|
}
|
|
21797
21796
|
|
|
@@ -21934,7 +21933,11 @@ class FormulaInput extends Widget {
|
|
|
21934
21933
|
return;
|
|
21935
21934
|
}
|
|
21936
21935
|
|
|
21937
|
-
|
|
21936
|
+
const data = this.formulaSource.filter((item) => String(item.value).startsWith(value.toLowerCase()));
|
|
21937
|
+
|
|
21938
|
+
this.list.data(data);
|
|
21939
|
+
|
|
21940
|
+
return data;
|
|
21938
21941
|
}
|
|
21939
21942
|
|
|
21940
21943
|
hide() {
|
|
@@ -22115,8 +22118,10 @@ class FormulaInput extends Widget {
|
|
|
22115
22118
|
if (width > element.offsetWidth) {
|
|
22116
22119
|
element.style.width = width + 'px';
|
|
22117
22120
|
}
|
|
22118
|
-
|
|
22119
|
-
|
|
22121
|
+
|
|
22122
|
+
const activeCellOutlineWidth = 1;
|
|
22123
|
+
if (height - activeCellOutlineWidth > element.offsetHeight) {
|
|
22124
|
+
element.style.height = (height - activeCellOutlineWidth) + 'px';
|
|
22120
22125
|
}
|
|
22121
22126
|
|
|
22122
22127
|
this._sync();
|
|
@@ -25904,7 +25909,7 @@ async function readSheet(zip, file, sheet, strings, styles) {
|
|
|
25904
25909
|
} else if (type === "b") {
|
|
25905
25910
|
value = value === "1";
|
|
25906
25911
|
} else if (type === "d") {
|
|
25907
|
-
value = parseDate
|
|
25912
|
+
value = intl().parseDate(value);
|
|
25908
25913
|
}
|
|
25909
25914
|
|
|
25910
25915
|
if (value != null) {
|
|
@@ -26047,7 +26052,7 @@ async function readDrawings(zip, file, sheet) {
|
|
|
26047
26052
|
let relationships = await readRelationships(zip, relsFile);
|
|
26048
26053
|
|
|
26049
26054
|
if (relationships.byType.image) {
|
|
26050
|
-
|
|
26055
|
+
for (const id of Object.keys(relationships.byId)) {
|
|
26051
26056
|
let img = relative_file(file, relationships.byId[id]);
|
|
26052
26057
|
let type = getContentType(img);
|
|
26053
26058
|
|
|
@@ -26059,7 +26064,7 @@ async function readDrawings(zip, file, sheet) {
|
|
|
26059
26064
|
: new window.Blob([ data ], { type: type });
|
|
26060
26065
|
relationships.byId[id] = sheet._workbook.addImage(blob);
|
|
26061
26066
|
}
|
|
26062
|
-
}
|
|
26067
|
+
}
|
|
26063
26068
|
}
|
|
26064
26069
|
|
|
26065
26070
|
let cdr, ref, width, height;
|
|
@@ -26754,7 +26759,7 @@ function excelToPixels(val) {
|
|
|
26754
26759
|
return val / 9525;
|
|
26755
26760
|
}
|
|
26756
26761
|
|
|
26757
|
-
/* eslint-disable no-
|
|
26762
|
+
/* eslint-disable no-undef */
|
|
26758
26763
|
|
|
26759
26764
|
const events$1 = [
|
|
26760
26765
|
"cut",
|
|
@@ -27062,6 +27067,7 @@ class Workbook extends Observable {
|
|
|
27062
27067
|
let insertIndex = typeof options.index === "number" ? options.index : that._sheets.length;
|
|
27063
27068
|
let sheetName;
|
|
27064
27069
|
let sheets = that._sheets;
|
|
27070
|
+
const messages = this.options.messages;
|
|
27065
27071
|
|
|
27066
27072
|
let getUniqueSheetName = function(sheetNameSuffix) {
|
|
27067
27073
|
sheetNameSuffix = sheetNameSuffix ? sheetNameSuffix : 1;
|
|
@@ -27259,33 +27265,33 @@ class Workbook extends Observable {
|
|
|
27259
27265
|
this._imgID = 0;
|
|
27260
27266
|
}
|
|
27261
27267
|
|
|
27262
|
-
|
|
27263
|
-
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
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
|
+
}
|
|
27289
27295
|
|
|
27290
27296
|
fromJSON(json) {
|
|
27291
27297
|
if (json.sheets) {
|
|
@@ -27303,7 +27309,7 @@ class Workbook extends Observable {
|
|
|
27303
27309
|
}
|
|
27304
27310
|
this._images[id] = { url: json.images[id] };
|
|
27305
27311
|
}, this);
|
|
27306
|
-
|
|
27312
|
+
this._loadImages();
|
|
27307
27313
|
}
|
|
27308
27314
|
|
|
27309
27315
|
for (let idx = 0; idx < json.sheets.length; idx++) {
|
|
@@ -27370,47 +27376,42 @@ class Workbook extends Observable {
|
|
|
27370
27376
|
return sheet.toJSON();
|
|
27371
27377
|
}, this),
|
|
27372
27378
|
names: names,
|
|
27379
|
+
images: {},
|
|
27373
27380
|
columnWidth: this.options.columnWidth,
|
|
27374
27381
|
rowHeight: this.options.rowHeight
|
|
27375
27382
|
};
|
|
27376
27383
|
}
|
|
27377
27384
|
|
|
27378
27385
|
saveJSON() {
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
// return self.usesImage(id) === 1;
|
|
27386
|
-
// });
|
|
27387
|
-
// let count = ids.length;
|
|
27388
|
-
// data.images = {};
|
|
27389
|
-
// if (count) {
|
|
27390
|
-
// ids.forEach(function(id) {
|
|
27391
|
-
// let img = self._images[id];
|
|
27392
|
-
// if (img.blob) {
|
|
27393
|
-
// let reader = new FileReader();
|
|
27394
|
-
// reader.onload = function() {
|
|
27395
|
-
// data.images[id] = reader.result;
|
|
27396
|
-
// next();
|
|
27397
|
-
// };
|
|
27398
|
-
// reader.readAsDataURL(img.blob);
|
|
27399
|
-
// } else {
|
|
27400
|
-
// data.images[id] = img.url;
|
|
27401
|
-
// next();
|
|
27402
|
-
// }
|
|
27403
|
-
// });
|
|
27404
|
-
// } else {
|
|
27405
|
-
// next();
|
|
27406
|
-
// }
|
|
27407
|
-
// 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;
|
|
27408
27392
|
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
|
|
27412
|
-
|
|
27413
|
-
|
|
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);
|
|
27414
27415
|
}
|
|
27415
27416
|
|
|
27416
27417
|
fromFile(file) {
|
|
@@ -27745,11 +27746,12 @@ const events = [
|
|
|
27745
27746
|
|
|
27746
27747
|
class Spreadsheet extends Widget {
|
|
27747
27748
|
constructor(element, options$1) {
|
|
27748
|
-
super(element,
|
|
27749
|
+
super(element, deepExtend({}, options, options$1));
|
|
27749
27750
|
this.events = events;
|
|
27750
27751
|
this.bind(this.events, this.options);
|
|
27751
27752
|
|
|
27752
|
-
locale
|
|
27753
|
+
intl({ locale: this.options.locale, ...this.options.intl });
|
|
27754
|
+
initDynamicFilter();
|
|
27753
27755
|
|
|
27754
27756
|
this._view = new View(this.element, {
|
|
27755
27757
|
messages: this.options.messages.view,
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@progress/kendo-
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@progress/kendo-
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.KendoSpreadsheetCommon = {}, global.
|
|
5
|
-
})(this, (function (exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@progress/kendo-drawing'), require('@progress/kendo-date-math'), require('@progress/kendo-common'), require('@progress/jszip-esm')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@progress/kendo-drawing', '@progress/kendo-date-math', '@progress/kendo-common', '@progress/jszip-esm'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.KendoSpreadsheetCommon = {}, global.KendoDrawing, global.KendoDateMath, global.KendoCommon, global.JSZip));
|
|
5
|
+
})(this, (function (exports, kendoDrawing, kendoDateMath, kendoCommon, JSZip) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/* eslint-disable camelcase */
|
|
8
8
|
/* eslint-disable no-nested-ternary */
|
|
@@ -945,6 +945,49 @@
|
|
|
945
945
|
return "#SHEET";
|
|
946
946
|
};
|
|
947
947
|
|
|
948
|
+
/* eslint-disable key-spacing */
|
|
949
|
+
const messages = {};
|
|
950
|
+
messages.view = {
|
|
951
|
+
nameBox: "Name Box",
|
|
952
|
+
errors: {
|
|
953
|
+
openUnsupported: "Unsupported format. Please select an .xlsx file.",
|
|
954
|
+
shiftingNonblankCells: "Cannot insert cells due to data loss possibility. Select another insert location or delete the data from the end of your worksheet.",
|
|
955
|
+
insertColumnWhenRowIsSelected: "Cannot insert column when all columns are selected.",
|
|
956
|
+
insertRowWhenColumnIsSelected: "Cannot insert row when all rows are selected.",
|
|
957
|
+
filterRangeContainingMerges: "Cannot create a filter within a range containing merges",
|
|
958
|
+
sortRangeContainingMerges: "Cannot sort a range containing merges",
|
|
959
|
+
cantSortMultipleSelection: "Cannot sort multiple selection",
|
|
960
|
+
cantSortNullRef: "Cannot sort empty selection",
|
|
961
|
+
cantSortMixedCells: "Cannot sort range containing cells of mixed shapes",
|
|
962
|
+
validationError: "The value that you entered violates the validation rules set on the cell.",
|
|
963
|
+
cannotModifyDisabled: "Cannot modify disabled cells.",
|
|
964
|
+
insertRowBelowLastRow: "Cannot insert row below the last row.",
|
|
965
|
+
insertColAfterLastCol: "Cannot insert column to the right of the last column."
|
|
966
|
+
},
|
|
967
|
+
tabs: {
|
|
968
|
+
home: "Home",
|
|
969
|
+
insert: "Insert",
|
|
970
|
+
data: "Data"
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
messages.menus = {
|
|
975
|
+
"cut" : "Cut",
|
|
976
|
+
"copy" : "Copy",
|
|
977
|
+
"paste" : "Paste",
|
|
978
|
+
"merge" : "Merge",
|
|
979
|
+
"unmerge" : "Unmerge",
|
|
980
|
+
"delete" : "Delete",
|
|
981
|
+
"hide" : "Hide",
|
|
982
|
+
"unhide" : "Unhide",
|
|
983
|
+
"bringToFront" : "Bring to front",
|
|
984
|
+
"sendToBack" : "Send to back"
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
messages.workbook = {
|
|
988
|
+
defaultSheetName: "Sheet"
|
|
989
|
+
};
|
|
990
|
+
|
|
948
991
|
const options = {
|
|
949
992
|
name: "Spreadsheet",
|
|
950
993
|
toolbar: true,
|
|
@@ -960,7 +1003,7 @@
|
|
|
960
1003
|
forceProxy: false,
|
|
961
1004
|
proxyURL: "",
|
|
962
1005
|
},
|
|
963
|
-
messages:
|
|
1006
|
+
messages: messages,
|
|
964
1007
|
pdf: {
|
|
965
1008
|
// which part of the workbook to be exported
|
|
966
1009
|
area: "workbook",
|
|
@@ -1354,18 +1397,18 @@
|
|
|
1354
1397
|
}
|
|
1355
1398
|
}
|
|
1356
1399
|
|
|
1357
|
-
|
|
1400
|
+
let intlValue = {};
|
|
1358
1401
|
|
|
1359
|
-
const
|
|
1402
|
+
const intl = (value) => {
|
|
1360
1403
|
if (value) {
|
|
1361
|
-
|
|
1404
|
+
intlValue = value;
|
|
1362
1405
|
} else {
|
|
1363
|
-
return
|
|
1406
|
+
return intlValue;
|
|
1364
1407
|
}
|
|
1365
1408
|
};
|
|
1366
1409
|
|
|
1367
1410
|
const culture = () => {
|
|
1368
|
-
return
|
|
1411
|
+
return intl().localeInfo();
|
|
1369
1412
|
};
|
|
1370
1413
|
|
|
1371
1414
|
function createKendoObj(calc, CalcError, Ref, CellRef, RangeRef) {
|
|
@@ -2993,9 +3036,10 @@
|
|
|
2993
3036
|
if (format) {
|
|
2994
3037
|
format = formatting.makeDateFormat(format);
|
|
2995
3038
|
}
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
||
|
|
3039
|
+
const parseExactDate = intl().parseDate;
|
|
3040
|
+
return parseExactDate(str, format)
|
|
3041
|
+
|| parseExactDate(str)
|
|
3042
|
+
|| parseExactDate(str, [
|
|
2999
3043
|
"MMMM dd yyyy",
|
|
3000
3044
|
"MMMM dd yy",
|
|
3001
3045
|
"MMM dd yyyy",
|
|
@@ -12733,10 +12777,6 @@
|
|
|
12733
12777
|
return a;
|
|
12734
12778
|
}, [ "borderTop", "borderRight", "borderBottom", "borderLeft" ]);
|
|
12735
12779
|
|
|
12736
|
-
const kendoFormat = function(fmt, ...values) {
|
|
12737
|
-
return kendoIntl.format(fmt, values, locale())
|
|
12738
|
-
};
|
|
12739
|
-
|
|
12740
12780
|
/* eslint-disable no-param-reassign */
|
|
12741
12781
|
|
|
12742
12782
|
let TRANSPOSE_FORMAT = "_matrix({0})";
|
|
@@ -12756,13 +12796,13 @@
|
|
|
12756
12796
|
if (validation.from.indexOf("{") > -1) {
|
|
12757
12797
|
validation.from = validation.from.replace(/\"/g,"").replace("{","\"").replace("}", "\"");
|
|
12758
12798
|
}
|
|
12759
|
-
validation.from =
|
|
12799
|
+
validation.from = intl().format(TRANSPOSE_FORMAT, validation.from);
|
|
12760
12800
|
validation.fromIsListValue = true;
|
|
12761
12801
|
}
|
|
12762
12802
|
if (validation.dataType === "date") {
|
|
12763
12803
|
parsedFromDate = calc.runtime.parseDate(validation.from);
|
|
12764
12804
|
if (parsedFromDate) {
|
|
12765
|
-
validation.from =
|
|
12805
|
+
validation.from = intl().format(DATE_FORMAT, validation.from);
|
|
12766
12806
|
validation.fromIsDateValue = true;
|
|
12767
12807
|
}
|
|
12768
12808
|
}
|
|
@@ -12772,7 +12812,7 @@
|
|
|
12772
12812
|
if (validation.dataType === "date") {
|
|
12773
12813
|
parsedToDate = calc.runtime.parseDate(validation.to);
|
|
12774
12814
|
if (parsedToDate) {
|
|
12775
|
-
validation.to =
|
|
12815
|
+
validation.to = intl().format(DATE_FORMAT, validation.to);
|
|
12776
12816
|
validation.toIsDateValue = true;
|
|
12777
12817
|
}
|
|
12778
12818
|
}
|
|
@@ -12786,7 +12826,7 @@
|
|
|
12786
12826
|
comparer = validationExport.validationComparers[validation.comparerType];
|
|
12787
12827
|
}
|
|
12788
12828
|
if (!comparer) {
|
|
12789
|
-
throw
|
|
12829
|
+
throw intl().format("'{0}' comparer is not implemented.", validation.comparerType);
|
|
12790
12830
|
}
|
|
12791
12831
|
validationHandler = function(valueToCompare) { //add 'valueFormat' arg when add isDate comparer
|
|
12792
12832
|
let toValue = this.to && (this.to_value || this.to_value === 0) ? this.to_value : undefined;
|
|
@@ -12852,7 +12892,7 @@
|
|
|
12852
12892
|
let dataType = this.dataType;
|
|
12853
12893
|
let type = this.type;
|
|
12854
12894
|
let comparerType = this.comparerType;
|
|
12855
|
-
return
|
|
12895
|
+
return intl().format(format, from, to, fromFormula, toFormula, dataType, type, comparerType);
|
|
12856
12896
|
}
|
|
12857
12897
|
_setMessages() {
|
|
12858
12898
|
this.title = "";
|
|
@@ -13249,7 +13289,8 @@
|
|
|
13249
13289
|
}
|
|
13250
13290
|
}
|
|
13251
13291
|
if (type === "date") {
|
|
13252
|
-
|
|
13292
|
+
const intlVal = intl();
|
|
13293
|
+
value = intlVal.toString(serialToDate(value), culture().calendar.patterns.d, intlVal.locale);
|
|
13253
13294
|
} else if (type === "percent") {
|
|
13254
13295
|
value = calc.runtime.limitPrecision(value * 100) + "%";
|
|
13255
13296
|
} else if (typeof value == "string" &&
|
|
@@ -14736,49 +14777,6 @@
|
|
|
14736
14777
|
return oldRect && (oldRect.top !== newRect.top || oldRect.left !== newRect.left);
|
|
14737
14778
|
}
|
|
14738
14779
|
|
|
14739
|
-
/* eslint-disable key-spacing */
|
|
14740
|
-
const messages = {};
|
|
14741
|
-
messages.view = {
|
|
14742
|
-
nameBox: "Name Box",
|
|
14743
|
-
errors: {
|
|
14744
|
-
openUnsupported: "Unsupported format. Please select an .xlsx file.",
|
|
14745
|
-
shiftingNonblankCells: "Cannot insert cells due to data loss possibility. Select another insert location or delete the data from the end of your worksheet.",
|
|
14746
|
-
insertColumnWhenRowIsSelected: "Cannot insert column when all columns are selected.",
|
|
14747
|
-
insertRowWhenColumnIsSelected: "Cannot insert row when all rows are selected.",
|
|
14748
|
-
filterRangeContainingMerges: "Cannot create a filter within a range containing merges",
|
|
14749
|
-
sortRangeContainingMerges: "Cannot sort a range containing merges",
|
|
14750
|
-
cantSortMultipleSelection: "Cannot sort multiple selection",
|
|
14751
|
-
cantSortNullRef: "Cannot sort empty selection",
|
|
14752
|
-
cantSortMixedCells: "Cannot sort range containing cells of mixed shapes",
|
|
14753
|
-
validationError: "The value that you entered violates the validation rules set on the cell.",
|
|
14754
|
-
cannotModifyDisabled: "Cannot modify disabled cells.",
|
|
14755
|
-
insertRowBelowLastRow: "Cannot insert row below the last row.",
|
|
14756
|
-
insertColAfterLastCol: "Cannot insert column to the right of the last column."
|
|
14757
|
-
},
|
|
14758
|
-
tabs: {
|
|
14759
|
-
home: "Home",
|
|
14760
|
-
insert: "Insert",
|
|
14761
|
-
data: "Data"
|
|
14762
|
-
}
|
|
14763
|
-
};
|
|
14764
|
-
|
|
14765
|
-
messages.menus = {
|
|
14766
|
-
"cut" : "Cut",
|
|
14767
|
-
"copy" : "Copy",
|
|
14768
|
-
"paste" : "Paste",
|
|
14769
|
-
"merge" : "Merge",
|
|
14770
|
-
"unmerge" : "Unmerge",
|
|
14771
|
-
"delete" : "Delete",
|
|
14772
|
-
"hide" : "Hide",
|
|
14773
|
-
"unhide" : "Unhide",
|
|
14774
|
-
"bringToFront" : "Bring to front",
|
|
14775
|
-
"sendToBack" : "Send to back"
|
|
14776
|
-
};
|
|
14777
|
-
|
|
14778
|
-
messages.workbook = {
|
|
14779
|
-
defaultSheetName: "Sheet"
|
|
14780
|
-
};
|
|
14781
|
-
|
|
14782
14780
|
const ampRegExp = /&/g,
|
|
14783
14781
|
ltRegExp = /</g,
|
|
14784
14782
|
quoteRegExp = /"/g,
|
|
@@ -17377,15 +17375,17 @@
|
|
|
17377
17375
|
};
|
|
17378
17376
|
});
|
|
17379
17377
|
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
17384
|
-
|
|
17378
|
+
const initDynamicFilter = () => {
|
|
17379
|
+
culture().calendar.months.format.wide.forEach(function(month, index) {
|
|
17380
|
+
DynamicFilter.prototype[month.toLowerCase()] = function(value) {
|
|
17381
|
+
if (value instanceof Date) {
|
|
17382
|
+
return value.getMonth() === index;
|
|
17383
|
+
}
|
|
17385
17384
|
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17385
|
+
return false;
|
|
17386
|
+
};
|
|
17387
|
+
});
|
|
17388
|
+
};
|
|
17389
17389
|
|
|
17390
17390
|
function quarter(value) {
|
|
17391
17391
|
var month = value.getMonth() + 1;
|
|
@@ -20487,7 +20487,7 @@
|
|
|
20487
20487
|
// if (options.useGridFormat) {
|
|
20488
20488
|
// if (value != null) {
|
|
20489
20489
|
// if (col.format) {
|
|
20490
|
-
// value =
|
|
20490
|
+
// value = intl().format(col.format, value);
|
|
20491
20491
|
// } else {
|
|
20492
20492
|
// value += "";
|
|
20493
20493
|
// }
|
|
@@ -21785,13 +21785,13 @@
|
|
|
21785
21785
|
if (this._isFormula() && !this._navigated) {
|
|
21786
21786
|
value = ((this._tokenContext() || {}).token || {}).value;
|
|
21787
21787
|
|
|
21788
|
-
this.filter(value);
|
|
21788
|
+
const data = this.filter(value);
|
|
21789
21789
|
|
|
21790
|
-
if (!value || !
|
|
21790
|
+
if (!value || !data.length) {
|
|
21791
21791
|
popup.close();
|
|
21792
21792
|
} else {
|
|
21793
21793
|
popup[popup.visible() ? "position" : "open"]();
|
|
21794
|
-
this.list.focusFirst();
|
|
21794
|
+
setTimeout(() => { this.list.focusFirst(); }, 0);
|
|
21795
21795
|
}
|
|
21796
21796
|
}
|
|
21797
21797
|
|
|
@@ -21934,7 +21934,11 @@
|
|
|
21934
21934
|
return;
|
|
21935
21935
|
}
|
|
21936
21936
|
|
|
21937
|
-
|
|
21937
|
+
const data = this.formulaSource.filter((item) => String(item.value).startsWith(value.toLowerCase()));
|
|
21938
|
+
|
|
21939
|
+
this.list.data(data);
|
|
21940
|
+
|
|
21941
|
+
return data;
|
|
21938
21942
|
}
|
|
21939
21943
|
|
|
21940
21944
|
hide() {
|
|
@@ -22115,8 +22119,10 @@
|
|
|
22115
22119
|
if (width > element.offsetWidth) {
|
|
22116
22120
|
element.style.width = width + 'px';
|
|
22117
22121
|
}
|
|
22118
|
-
|
|
22119
|
-
|
|
22122
|
+
|
|
22123
|
+
const activeCellOutlineWidth = 1;
|
|
22124
|
+
if (height - activeCellOutlineWidth > element.offsetHeight) {
|
|
22125
|
+
element.style.height = (height - activeCellOutlineWidth) + 'px';
|
|
22120
22126
|
}
|
|
22121
22127
|
|
|
22122
22128
|
this._sync();
|
|
@@ -25904,7 +25910,7 @@
|
|
|
25904
25910
|
} else if (type === "b") {
|
|
25905
25911
|
value = value === "1";
|
|
25906
25912
|
} else if (type === "d") {
|
|
25907
|
-
value =
|
|
25913
|
+
value = intl().parseDate(value);
|
|
25908
25914
|
}
|
|
25909
25915
|
|
|
25910
25916
|
if (value != null) {
|
|
@@ -26047,7 +26053,7 @@
|
|
|
26047
26053
|
let relationships = await readRelationships(zip, relsFile);
|
|
26048
26054
|
|
|
26049
26055
|
if (relationships.byType.image) {
|
|
26050
|
-
|
|
26056
|
+
for (const id of Object.keys(relationships.byId)) {
|
|
26051
26057
|
let img = relative_file(file, relationships.byId[id]);
|
|
26052
26058
|
let type = getContentType(img);
|
|
26053
26059
|
|
|
@@ -26059,7 +26065,7 @@
|
|
|
26059
26065
|
: new window.Blob([ data ], { type: type });
|
|
26060
26066
|
relationships.byId[id] = sheet._workbook.addImage(blob);
|
|
26061
26067
|
}
|
|
26062
|
-
}
|
|
26068
|
+
}
|
|
26063
26069
|
}
|
|
26064
26070
|
|
|
26065
26071
|
let cdr, ref, width, height;
|
|
@@ -26754,7 +26760,7 @@
|
|
|
26754
26760
|
return val / 9525;
|
|
26755
26761
|
}
|
|
26756
26762
|
|
|
26757
|
-
/* eslint-disable no-
|
|
26763
|
+
/* eslint-disable no-undef */
|
|
26758
26764
|
|
|
26759
26765
|
const events$1 = [
|
|
26760
26766
|
"cut",
|
|
@@ -27062,6 +27068,7 @@
|
|
|
27062
27068
|
let insertIndex = typeof options.index === "number" ? options.index : that._sheets.length;
|
|
27063
27069
|
let sheetName;
|
|
27064
27070
|
let sheets = that._sheets;
|
|
27071
|
+
const messages = this.options.messages;
|
|
27065
27072
|
|
|
27066
27073
|
let getUniqueSheetName = function(sheetNameSuffix) {
|
|
27067
27074
|
sheetNameSuffix = sheetNameSuffix ? sheetNameSuffix : 1;
|
|
@@ -27259,33 +27266,33 @@
|
|
|
27259
27266
|
this._imgID = 0;
|
|
27260
27267
|
}
|
|
27261
27268
|
|
|
27262
|
-
|
|
27263
|
-
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
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
|
+
}
|
|
27289
27296
|
|
|
27290
27297
|
fromJSON(json) {
|
|
27291
27298
|
if (json.sheets) {
|
|
@@ -27303,7 +27310,7 @@
|
|
|
27303
27310
|
}
|
|
27304
27311
|
this._images[id] = { url: json.images[id] };
|
|
27305
27312
|
}, this);
|
|
27306
|
-
|
|
27313
|
+
this._loadImages();
|
|
27307
27314
|
}
|
|
27308
27315
|
|
|
27309
27316
|
for (let idx = 0; idx < json.sheets.length; idx++) {
|
|
@@ -27370,47 +27377,42 @@
|
|
|
27370
27377
|
return sheet.toJSON();
|
|
27371
27378
|
}, this),
|
|
27372
27379
|
names: names,
|
|
27380
|
+
images: {},
|
|
27373
27381
|
columnWidth: this.options.columnWidth,
|
|
27374
27382
|
rowHeight: this.options.rowHeight
|
|
27375
27383
|
};
|
|
27376
27384
|
}
|
|
27377
27385
|
|
|
27378
27386
|
saveJSON() {
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
// return self.usesImage(id) === 1;
|
|
27386
|
-
// });
|
|
27387
|
-
// let count = ids.length;
|
|
27388
|
-
// data.images = {};
|
|
27389
|
-
// if (count) {
|
|
27390
|
-
// ids.forEach(function(id) {
|
|
27391
|
-
// let img = self._images[id];
|
|
27392
|
-
// if (img.blob) {
|
|
27393
|
-
// let reader = new FileReader();
|
|
27394
|
-
// reader.onload = function() {
|
|
27395
|
-
// data.images[id] = reader.result;
|
|
27396
|
-
// next();
|
|
27397
|
-
// };
|
|
27398
|
-
// reader.readAsDataURL(img.blob);
|
|
27399
|
-
// } else {
|
|
27400
|
-
// data.images[id] = img.url;
|
|
27401
|
-
// next();
|
|
27402
|
-
// }
|
|
27403
|
-
// });
|
|
27404
|
-
// } else {
|
|
27405
|
-
// next();
|
|
27406
|
-
// }
|
|
27407
|
-
// 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;
|
|
27408
27393
|
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
|
|
27412
|
-
|
|
27413
|
-
|
|
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);
|
|
27414
27416
|
}
|
|
27415
27417
|
|
|
27416
27418
|
fromFile(file) {
|
|
@@ -27745,11 +27747,12 @@
|
|
|
27745
27747
|
|
|
27746
27748
|
class Spreadsheet extends Widget {
|
|
27747
27749
|
constructor(element, options$1) {
|
|
27748
|
-
super(element,
|
|
27750
|
+
super(element, deepExtend({}, options, options$1));
|
|
27749
27751
|
this.events = events;
|
|
27750
27752
|
this.bind(this.events, this.options);
|
|
27751
27753
|
|
|
27752
|
-
locale
|
|
27754
|
+
intl({ locale: this.options.locale, ...this.options.intl });
|
|
27755
|
+
initDynamicFilter();
|
|
27753
27756
|
|
|
27754
27757
|
this._view = new View(this.element, {
|
|
27755
27758
|
messages: this.options.messages.view,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-spreadsheet-common",
|
|
3
3
|
"description": "Kendo UI platform-independent Spreadsheet library",
|
|
4
|
-
"version": "1.0.0-develop.
|
|
4
|
+
"version": "1.0.0-develop.7",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Kendo UI"
|
|
7
7
|
],
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"@progress/kendo-common": "^0.2.2",
|
|
25
25
|
"@progress/kendo-date-math": "^1.5.10",
|
|
26
26
|
"@progress/kendo-drawing": "^1.17.5",
|
|
27
|
-
"@progress/jszip-esm": "^1.0.3"
|
|
28
|
-
"@progress/kendo-intl": "^3.1.1"
|
|
27
|
+
"@progress/jszip-esm": "^1.0.3"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@commitlint/cli": "^17.3.0",
|
|
32
31
|
"@commitlint/config-conventional": "^17.3.0",
|
|
33
32
|
"@progress/kendo-e2e": "^1.3.0",
|
|
33
|
+
"@progress/kendo-intl": "^3.1.1",
|
|
34
34
|
"@types/jest": "^29.0.0",
|
|
35
35
|
"es-jest": "^2.1.0",
|
|
36
36
|
"eslint": "^8.28.0",
|
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
|
*
|