@progress/kendo-spreadsheet-common 1.0.0-develop.1 → 1.0.0-develop.10
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/README.md +28 -3
- package/dist/index-esm.js +174 -162
- package/dist/index.js +182 -165
- package/package.json +6 -8
- package/src/index.d.ts +732 -1
package/README.md
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Professional Grade UI Components
|
|
4
|
+
|
|
5
|
+
This package is part of the [Kendo UI for Angular](https://www.telerik.com/kendo-angular-ui/) and [KendoReact](https://www.telerik.com/kendo-react-ui/components/#react-components) suites.
|
|
4
6
|
|
|
5
7
|
## License
|
|
6
8
|
|
|
7
|
-
This is commercial software. To use it, you need to agree to the [**Telerik End User License Agreement for Kendo UI
|
|
9
|
+
This is commercial software. To use it, you need to agree to the [**Telerik End User License Agreement for Kendo UI** (for Kendo UI for Angular)](http://www.telerik.com/purchase/license-agreement/kendo-ui) or to the [**End User License Agreement for Progress KendoReact** (for KendoReact)](https://www.telerik.com/purchase/license-agreement/progress-kendoreact). If you do not own a commercial license, this file shall be governed by the trial license terms.
|
|
8
10
|
|
|
9
11
|
All available Kendo UI commercial licenses may be obtained at http://www.telerik.com/purchase/kendo-ui.
|
|
12
|
+
|
|
13
|
+
## Kendo UI for Angular Resources and Feedback
|
|
14
|
+
|
|
15
|
+
- [Get Started](https://www.telerik.com/kendo-angular-ui/getting-started)
|
|
16
|
+
- [Component References](https://www.telerik.com/kendo-angular-ui/components)
|
|
17
|
+
- [Blogs](http://www.telerik.com/blogs/kendo-ui)
|
|
18
|
+
- [FAQ](https://www.telerik.com/kendo-angular-ui/components/faq/)
|
|
19
|
+
- [GitHub Issues](https://github.com/telerik/kendo-angular/issues)
|
|
20
|
+
- [Feedback Portal](http://kendoui-feedback.telerik.com/forums/555517-kendo-ui-for-angular-2-feedback)
|
|
21
|
+
- [StackOverflow](https://stackoverflow.com/questions/tagged/kendo-ui-angular2)
|
|
22
|
+
|
|
23
|
+
## KendoReact Resources and Feedback
|
|
24
|
+
|
|
25
|
+
- [Get Started](https://www.telerik.com/kendo-react-ui/getting-started)
|
|
26
|
+
- [Component References](https://www.telerik.com/kendo-react-ui/components/#react-components)
|
|
27
|
+
- [Blogs](http://www.telerik.com/blogs/kendo-ui)
|
|
28
|
+
- [GitHub Issues](https://github.com/telerik/kendo-react/issues)
|
|
29
|
+
- [Feedback Portal](http://kendoui-feedback.telerik.com/forums/908425-kendo-ui-for-react-feedback)
|
|
30
|
+
- [StackOverflow](https://stackoverflow.com/questions/tagged/kendo-react-ui)
|
|
31
|
+
|
|
32
|
+
*Copyright © 2021 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.*
|
|
33
|
+
|
|
34
|
+
*Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.*
|
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,
|
|
@@ -956,10 +998,11 @@ const options = {
|
|
|
956
998
|
headerHeight: 20,
|
|
957
999
|
headerWidth: 32,
|
|
958
1000
|
excel: {
|
|
1001
|
+
fileName: "Workbook.xlsx",
|
|
1002
|
+
forceProxy: false,
|
|
959
1003
|
proxyURL: "",
|
|
960
|
-
fileName: "Workbook.xlsx"
|
|
961
1004
|
},
|
|
962
|
-
messages:
|
|
1005
|
+
messages: messages,
|
|
963
1006
|
pdf: {
|
|
964
1007
|
// which part of the workbook to be exported
|
|
965
1008
|
area: "workbook",
|
|
@@ -1353,18 +1396,18 @@ class CalcError {
|
|
|
1353
1396
|
}
|
|
1354
1397
|
}
|
|
1355
1398
|
|
|
1356
|
-
|
|
1399
|
+
let intlValue = {};
|
|
1357
1400
|
|
|
1358
|
-
const
|
|
1401
|
+
const intl = (value) => {
|
|
1359
1402
|
if (value) {
|
|
1360
|
-
|
|
1403
|
+
intlValue = value;
|
|
1361
1404
|
} else {
|
|
1362
|
-
return
|
|
1405
|
+
return intlValue;
|
|
1363
1406
|
}
|
|
1364
1407
|
};
|
|
1365
1408
|
|
|
1366
1409
|
const culture = () => {
|
|
1367
|
-
return localeInfo(
|
|
1410
|
+
return intl().localeInfo();
|
|
1368
1411
|
};
|
|
1369
1412
|
|
|
1370
1413
|
function createKendoObj(calc, CalcError, Ref, CellRef, RangeRef) {
|
|
@@ -2992,9 +3035,10 @@ function parseDate(str, format) {
|
|
|
2992
3035
|
if (format) {
|
|
2993
3036
|
format = formatting.makeDateFormat(format);
|
|
2994
3037
|
}
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
||
|
|
3038
|
+
const parseExactDate = intl().parseDate;
|
|
3039
|
+
return parseExactDate(str, format)
|
|
3040
|
+
|| parseExactDate(str)
|
|
3041
|
+
|| parseExactDate(str, [
|
|
2998
3042
|
"MMMM dd yyyy",
|
|
2999
3043
|
"MMMM dd yy",
|
|
3000
3044
|
"MMM dd yyyy",
|
|
@@ -12732,10 +12776,6 @@ const ALL_PROPERTIES = propertyBagSpec.reduce(function(a, spec) {
|
|
|
12732
12776
|
return a;
|
|
12733
12777
|
}, [ "borderTop", "borderRight", "borderBottom", "borderLeft" ]);
|
|
12734
12778
|
|
|
12735
|
-
const kendoFormat = function(fmt, ...values) {
|
|
12736
|
-
return format(fmt, values, locale())
|
|
12737
|
-
};
|
|
12738
|
-
|
|
12739
12779
|
/* eslint-disable no-param-reassign */
|
|
12740
12780
|
|
|
12741
12781
|
let TRANSPOSE_FORMAT = "_matrix({0})";
|
|
@@ -12755,13 +12795,13 @@ function compileValidation(sheet, row, col, validation) {
|
|
|
12755
12795
|
if (validation.from.indexOf("{") > -1) {
|
|
12756
12796
|
validation.from = validation.from.replace(/\"/g,"").replace("{","\"").replace("}", "\"");
|
|
12757
12797
|
}
|
|
12758
|
-
validation.from =
|
|
12798
|
+
validation.from = intl().format(TRANSPOSE_FORMAT, validation.from);
|
|
12759
12799
|
validation.fromIsListValue = true;
|
|
12760
12800
|
}
|
|
12761
12801
|
if (validation.dataType === "date") {
|
|
12762
12802
|
parsedFromDate = calc.runtime.parseDate(validation.from);
|
|
12763
12803
|
if (parsedFromDate) {
|
|
12764
|
-
validation.from =
|
|
12804
|
+
validation.from = intl().format(DATE_FORMAT, validation.from);
|
|
12765
12805
|
validation.fromIsDateValue = true;
|
|
12766
12806
|
}
|
|
12767
12807
|
}
|
|
@@ -12771,7 +12811,7 @@ function compileValidation(sheet, row, col, validation) {
|
|
|
12771
12811
|
if (validation.dataType === "date") {
|
|
12772
12812
|
parsedToDate = calc.runtime.parseDate(validation.to);
|
|
12773
12813
|
if (parsedToDate) {
|
|
12774
|
-
validation.to =
|
|
12814
|
+
validation.to = intl().format(DATE_FORMAT, validation.to);
|
|
12775
12815
|
validation.toIsDateValue = true;
|
|
12776
12816
|
}
|
|
12777
12817
|
}
|
|
@@ -12785,7 +12825,7 @@ function compileValidation(sheet, row, col, validation) {
|
|
|
12785
12825
|
comparer = validationExport.validationComparers[validation.comparerType];
|
|
12786
12826
|
}
|
|
12787
12827
|
if (!comparer) {
|
|
12788
|
-
throw
|
|
12828
|
+
throw intl().format("'{0}' comparer is not implemented.", validation.comparerType);
|
|
12789
12829
|
}
|
|
12790
12830
|
validationHandler = function(valueToCompare) { //add 'valueFormat' arg when add isDate comparer
|
|
12791
12831
|
let toValue = this.to && (this.to_value || this.to_value === 0) ? this.to_value : undefined;
|
|
@@ -12851,7 +12891,7 @@ class Validation {
|
|
|
12851
12891
|
let dataType = this.dataType;
|
|
12852
12892
|
let type = this.type;
|
|
12853
12893
|
let comparerType = this.comparerType;
|
|
12854
|
-
return
|
|
12894
|
+
return intl().format(format, from, to, fromFormula, toFormula, dataType, type, comparerType);
|
|
12855
12895
|
}
|
|
12856
12896
|
_setMessages() {
|
|
12857
12897
|
this.title = "";
|
|
@@ -13248,7 +13288,8 @@ let Range$1 = class Range {
|
|
|
13248
13288
|
}
|
|
13249
13289
|
}
|
|
13250
13290
|
if (type === "date") {
|
|
13251
|
-
|
|
13291
|
+
const intlVal = intl();
|
|
13292
|
+
value = intlVal.toString(serialToDate(value), culture().calendar.patterns.d, intlVal.locale);
|
|
13252
13293
|
} else if (type === "percent") {
|
|
13253
13294
|
value = calc.runtime.limitPrecision(value * 100) + "%";
|
|
13254
13295
|
} else if (typeof value == "string" &&
|
|
@@ -14735,49 +14776,6 @@ function notEqual(oldRect, newRect) {
|
|
|
14735
14776
|
return oldRect && (oldRect.top !== newRect.top || oldRect.left !== newRect.left);
|
|
14736
14777
|
}
|
|
14737
14778
|
|
|
14738
|
-
/* eslint-disable key-spacing */
|
|
14739
|
-
const messages = {};
|
|
14740
|
-
messages.view = {
|
|
14741
|
-
nameBox: "Name Box",
|
|
14742
|
-
errors: {
|
|
14743
|
-
openUnsupported: "Unsupported format. Please select an .xlsx file.",
|
|
14744
|
-
shiftingNonblankCells: "Cannot insert cells due to data loss possibility. Select another insert location or delete the data from the end of your worksheet.",
|
|
14745
|
-
insertColumnWhenRowIsSelected: "Cannot insert column when all columns are selected.",
|
|
14746
|
-
insertRowWhenColumnIsSelected: "Cannot insert row when all rows are selected.",
|
|
14747
|
-
filterRangeContainingMerges: "Cannot create a filter within a range containing merges",
|
|
14748
|
-
sortRangeContainingMerges: "Cannot sort a range containing merges",
|
|
14749
|
-
cantSortMultipleSelection: "Cannot sort multiple selection",
|
|
14750
|
-
cantSortNullRef: "Cannot sort empty selection",
|
|
14751
|
-
cantSortMixedCells: "Cannot sort range containing cells of mixed shapes",
|
|
14752
|
-
validationError: "The value that you entered violates the validation rules set on the cell.",
|
|
14753
|
-
cannotModifyDisabled: "Cannot modify disabled cells.",
|
|
14754
|
-
insertRowBelowLastRow: "Cannot insert row below the last row.",
|
|
14755
|
-
insertColAfterLastCol: "Cannot insert column to the right of the last column."
|
|
14756
|
-
},
|
|
14757
|
-
tabs: {
|
|
14758
|
-
home: "Home",
|
|
14759
|
-
insert: "Insert",
|
|
14760
|
-
data: "Data"
|
|
14761
|
-
}
|
|
14762
|
-
};
|
|
14763
|
-
|
|
14764
|
-
messages.menus = {
|
|
14765
|
-
"cut" : "Cut",
|
|
14766
|
-
"copy" : "Copy",
|
|
14767
|
-
"paste" : "Paste",
|
|
14768
|
-
"merge" : "Merge",
|
|
14769
|
-
"unmerge" : "Unmerge",
|
|
14770
|
-
"delete" : "Delete",
|
|
14771
|
-
"hide" : "Hide",
|
|
14772
|
-
"unhide" : "Unhide",
|
|
14773
|
-
"bringToFront" : "Bring to front",
|
|
14774
|
-
"sendToBack" : "Send to back"
|
|
14775
|
-
};
|
|
14776
|
-
|
|
14777
|
-
messages.workbook = {
|
|
14778
|
-
defaultSheetName: "Sheet"
|
|
14779
|
-
};
|
|
14780
|
-
|
|
14781
14779
|
const ampRegExp = /&/g,
|
|
14782
14780
|
ltRegExp = /</g,
|
|
14783
14781
|
quoteRegExp = /"/g,
|
|
@@ -17376,15 +17374,17 @@ filtersObj = {
|
|
|
17376
17374
|
};
|
|
17377
17375
|
});
|
|
17378
17376
|
|
|
17379
|
-
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
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
|
+
}
|
|
17384
17383
|
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
});
|
|
17384
|
+
return false;
|
|
17385
|
+
};
|
|
17386
|
+
});
|
|
17387
|
+
};
|
|
17388
17388
|
|
|
17389
17389
|
function quarter(value) {
|
|
17390
17390
|
var month = value.getMonth() + 1;
|
|
@@ -20486,7 +20486,7 @@ function Borders() {
|
|
|
20486
20486
|
// if (options.useGridFormat) {
|
|
20487
20487
|
// if (value != null) {
|
|
20488
20488
|
// if (col.format) {
|
|
20489
|
-
// value =
|
|
20489
|
+
// value = intl().format(col.format, value);
|
|
20490
20490
|
// } else {
|
|
20491
20491
|
// value += "";
|
|
20492
20492
|
// }
|
|
@@ -21784,13 +21784,13 @@ class FormulaInput extends Widget {
|
|
|
21784
21784
|
if (this._isFormula() && !this._navigated) {
|
|
21785
21785
|
value = ((this._tokenContext() || {}).token || {}).value;
|
|
21786
21786
|
|
|
21787
|
-
this.filter(value);
|
|
21787
|
+
const data = this.filter(value);
|
|
21788
21788
|
|
|
21789
|
-
if (!value || !
|
|
21789
|
+
if (!value || !data.length) {
|
|
21790
21790
|
popup.close();
|
|
21791
21791
|
} else {
|
|
21792
21792
|
popup[popup.visible() ? "position" : "open"]();
|
|
21793
|
-
this.list.focusFirst();
|
|
21793
|
+
setTimeout(() => { this.list.focusFirst(); }, 0);
|
|
21794
21794
|
}
|
|
21795
21795
|
}
|
|
21796
21796
|
|
|
@@ -21933,7 +21933,11 @@ class FormulaInput extends Widget {
|
|
|
21933
21933
|
return;
|
|
21934
21934
|
}
|
|
21935
21935
|
|
|
21936
|
-
|
|
21936
|
+
const data = this.formulaSource.filter((item) => String(item.value).startsWith(value.toLowerCase()));
|
|
21937
|
+
|
|
21938
|
+
this.list.data(data);
|
|
21939
|
+
|
|
21940
|
+
return data;
|
|
21937
21941
|
}
|
|
21938
21942
|
|
|
21939
21943
|
hide() {
|
|
@@ -22114,8 +22118,10 @@ class FormulaInput extends Widget {
|
|
|
22114
22118
|
if (width > element.offsetWidth) {
|
|
22115
22119
|
element.style.width = width + 'px';
|
|
22116
22120
|
}
|
|
22117
|
-
|
|
22118
|
-
|
|
22121
|
+
|
|
22122
|
+
const activeCellOutlineWidth = 1;
|
|
22123
|
+
if (height - activeCellOutlineWidth > element.offsetHeight) {
|
|
22124
|
+
element.style.height = (height - activeCellOutlineWidth) + 'px';
|
|
22119
22125
|
}
|
|
22120
22126
|
|
|
22121
22127
|
this._sync();
|
|
@@ -23160,6 +23166,14 @@ class View extends Observable {
|
|
|
23160
23166
|
|
|
23161
23167
|
destroy() {
|
|
23162
23168
|
this.unbind();
|
|
23169
|
+
|
|
23170
|
+
[this.tree, this.clipboardContents].forEach(el => {
|
|
23171
|
+
while (el && el.root && el.root.lastChild) {
|
|
23172
|
+
el.root.removeChild(el.root.lastChild);
|
|
23173
|
+
}
|
|
23174
|
+
});
|
|
23175
|
+
this.tree = this.clipboardContents = null;
|
|
23176
|
+
|
|
23163
23177
|
// this._dialogs.forEach(function(dialog) {
|
|
23164
23178
|
// dialog.destroy();
|
|
23165
23179
|
// });
|
|
@@ -25895,7 +25909,7 @@ async function readSheet(zip, file, sheet, strings, styles) {
|
|
|
25895
25909
|
} else if (type === "b") {
|
|
25896
25910
|
value = value === "1";
|
|
25897
25911
|
} else if (type === "d") {
|
|
25898
|
-
value = parseDate
|
|
25912
|
+
value = intl().parseDate(value);
|
|
25899
25913
|
}
|
|
25900
25914
|
|
|
25901
25915
|
if (value != null) {
|
|
@@ -26038,7 +26052,7 @@ async function readDrawings(zip, file, sheet) {
|
|
|
26038
26052
|
let relationships = await readRelationships(zip, relsFile);
|
|
26039
26053
|
|
|
26040
26054
|
if (relationships.byType.image) {
|
|
26041
|
-
|
|
26055
|
+
for (const id of Object.keys(relationships.byId)) {
|
|
26042
26056
|
let img = relative_file(file, relationships.byId[id]);
|
|
26043
26057
|
let type = getContentType(img);
|
|
26044
26058
|
|
|
@@ -26050,7 +26064,7 @@ async function readDrawings(zip, file, sheet) {
|
|
|
26050
26064
|
: new window.Blob([ data ], { type: type });
|
|
26051
26065
|
relationships.byId[id] = sheet._workbook.addImage(blob);
|
|
26052
26066
|
}
|
|
26053
|
-
}
|
|
26067
|
+
}
|
|
26054
26068
|
}
|
|
26055
26069
|
|
|
26056
26070
|
let cdr, ref, width, height;
|
|
@@ -26745,7 +26759,7 @@ function excelToPixels(val) {
|
|
|
26745
26759
|
return val / 9525;
|
|
26746
26760
|
}
|
|
26747
26761
|
|
|
26748
|
-
/* eslint-disable no-
|
|
26762
|
+
/* eslint-disable no-undef */
|
|
26749
26763
|
|
|
26750
26764
|
const events$1 = [
|
|
26751
26765
|
"cut",
|
|
@@ -27053,6 +27067,7 @@ class Workbook extends Observable {
|
|
|
27053
27067
|
let insertIndex = typeof options.index === "number" ? options.index : that._sheets.length;
|
|
27054
27068
|
let sheetName;
|
|
27055
27069
|
let sheets = that._sheets;
|
|
27070
|
+
const messages = this.options.messages;
|
|
27056
27071
|
|
|
27057
27072
|
let getUniqueSheetName = function(sheetNameSuffix) {
|
|
27058
27073
|
sheetNameSuffix = sheetNameSuffix ? sheetNameSuffix : 1;
|
|
@@ -27250,33 +27265,33 @@ class Workbook extends Observable {
|
|
|
27250
27265
|
this._imgID = 0;
|
|
27251
27266
|
}
|
|
27252
27267
|
|
|
27253
|
-
|
|
27254
|
-
|
|
27255
|
-
|
|
27256
|
-
|
|
27257
|
-
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27263
|
-
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
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
|
+
}
|
|
27280
27295
|
|
|
27281
27296
|
fromJSON(json) {
|
|
27282
27297
|
if (json.sheets) {
|
|
@@ -27294,7 +27309,7 @@ class Workbook extends Observable {
|
|
|
27294
27309
|
}
|
|
27295
27310
|
this._images[id] = { url: json.images[id] };
|
|
27296
27311
|
}, this);
|
|
27297
|
-
|
|
27312
|
+
this._loadImages();
|
|
27298
27313
|
}
|
|
27299
27314
|
|
|
27300
27315
|
for (let idx = 0; idx < json.sheets.length; idx++) {
|
|
@@ -27361,52 +27376,49 @@ class Workbook extends Observable {
|
|
|
27361
27376
|
return sheet.toJSON();
|
|
27362
27377
|
}, this),
|
|
27363
27378
|
names: names,
|
|
27379
|
+
images: {},
|
|
27364
27380
|
columnWidth: this.options.columnWidth,
|
|
27365
27381
|
rowHeight: this.options.rowHeight
|
|
27366
27382
|
};
|
|
27367
27383
|
}
|
|
27368
27384
|
|
|
27369
27385
|
saveJSON() {
|
|
27370
|
-
|
|
27371
|
-
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
// return self.usesImage(id) === 1;
|
|
27377
|
-
// });
|
|
27378
|
-
// let count = ids.length;
|
|
27379
|
-
// data.images = {};
|
|
27380
|
-
// if (count) {
|
|
27381
|
-
// ids.forEach(function(id) {
|
|
27382
|
-
// let img = self._images[id];
|
|
27383
|
-
// if (img.blob) {
|
|
27384
|
-
// let reader = new FileReader();
|
|
27385
|
-
// reader.onload = function() {
|
|
27386
|
-
// data.images[id] = reader.result;
|
|
27387
|
-
// next();
|
|
27388
|
-
// };
|
|
27389
|
-
// reader.readAsDataURL(img.blob);
|
|
27390
|
-
// } else {
|
|
27391
|
-
// data.images[id] = img.url;
|
|
27392
|
-
// next();
|
|
27393
|
-
// }
|
|
27394
|
-
// });
|
|
27395
|
-
// } else {
|
|
27396
|
-
// next();
|
|
27397
|
-
// }
|
|
27398
|
-
// 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;
|
|
27399
27392
|
|
|
27400
|
-
|
|
27401
|
-
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
|
|
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);
|
|
27405
27415
|
}
|
|
27406
27416
|
|
|
27407
27417
|
fromFile(file) {
|
|
27408
|
-
this.
|
|
27409
|
-
|
|
27418
|
+
if (file && !this.trigger("excelImport", { file })) {
|
|
27419
|
+
this._clearSheets();
|
|
27420
|
+
readExcel(file, this);
|
|
27421
|
+
}
|
|
27410
27422
|
}
|
|
27411
27423
|
|
|
27412
27424
|
saveAsExcel(options) {
|
|
@@ -27732,17 +27744,14 @@ const events = [
|
|
|
27732
27744
|
"dataBound"
|
|
27733
27745
|
];
|
|
27734
27746
|
|
|
27735
|
-
class
|
|
27747
|
+
class SpreadsheetWidget extends Widget {
|
|
27736
27748
|
constructor(element, options$1) {
|
|
27737
|
-
super(element,
|
|
27749
|
+
super(element, deepExtend({}, options, options$1));
|
|
27738
27750
|
this.events = events;
|
|
27739
27751
|
this.bind(this.events, this.options);
|
|
27740
27752
|
|
|
27741
|
-
this.
|
|
27742
|
-
|
|
27743
|
-
this.element.setAttribute("role", "application");
|
|
27744
|
-
|
|
27745
|
-
locale(this.options.locale);
|
|
27753
|
+
intl({ locale: this.options.locale, ...this.options.intl });
|
|
27754
|
+
initDynamicFilter();
|
|
27746
27755
|
|
|
27747
27756
|
this._view = new View(this.element, {
|
|
27748
27757
|
messages: this.options.messages.view,
|
|
@@ -27753,11 +27762,6 @@ class Spreadsheet extends Widget {
|
|
|
27753
27762
|
nameBoxRef: this.options.nameBoxRef
|
|
27754
27763
|
});
|
|
27755
27764
|
|
|
27756
|
-
// element.querySelector('.k-spreadsheet-cell-context-menu').style.display = 'none';
|
|
27757
|
-
// element.querySelector('.k-spreadsheet-row-header-context-menu').style.display = 'none';
|
|
27758
|
-
// element.querySelector('.k-spreadsheet-col-header-context-menu').style.display = 'none';
|
|
27759
|
-
// element.querySelector('.k-spreadsheet-drawing-context-menu').style.display = 'none';
|
|
27760
|
-
|
|
27761
27765
|
this._workbook = new Workbook(this.options, this._view);
|
|
27762
27766
|
|
|
27763
27767
|
this._controller = new Controller(this._view, this._workbook);
|
|
@@ -27778,6 +27782,14 @@ class Spreadsheet extends Widget {
|
|
|
27778
27782
|
this.element.addEventListener("keydown", this._keyDown.bind(this));
|
|
27779
27783
|
}
|
|
27780
27784
|
|
|
27785
|
+
get view() {
|
|
27786
|
+
return this._view;
|
|
27787
|
+
}
|
|
27788
|
+
|
|
27789
|
+
get workbook () {
|
|
27790
|
+
return this._workbook;
|
|
27791
|
+
}
|
|
27792
|
+
|
|
27781
27793
|
_keyDown(e) {
|
|
27782
27794
|
let key = e.keyCode;
|
|
27783
27795
|
|
|
@@ -27982,8 +27994,8 @@ class Spreadsheet extends Widget {
|
|
|
27982
27994
|
return this._workbook.saveJSON();
|
|
27983
27995
|
}
|
|
27984
27996
|
|
|
27985
|
-
fromFile(blob
|
|
27986
|
-
return this._workbook.fromFile(blob
|
|
27997
|
+
fromFile(blob) {
|
|
27998
|
+
return this._workbook.fromFile(blob);
|
|
27987
27999
|
}
|
|
27988
28000
|
|
|
27989
28001
|
saveAsPDF(options) {
|
|
@@ -28213,4 +28225,4 @@ class Spreadsheet extends Widget {
|
|
|
28213
28225
|
}
|
|
28214
28226
|
}
|
|
28215
28227
|
|
|
28216
|
-
export {
|
|
28228
|
+
export { Range$1 as Range, Sheet, SpreadsheetWidget, View, Workbook };
|