@progress/kendo-spreadsheet-common 1.0.0-develop.1 → 1.0.0-develop.11
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 +756 -1
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,
|
|
@@ -956,10 +999,11 @@
|
|
|
956
999
|
headerHeight: 20,
|
|
957
1000
|
headerWidth: 32,
|
|
958
1001
|
excel: {
|
|
1002
|
+
fileName: "Workbook.xlsx",
|
|
1003
|
+
forceProxy: false,
|
|
959
1004
|
proxyURL: "",
|
|
960
|
-
fileName: "Workbook.xlsx"
|
|
961
1005
|
},
|
|
962
|
-
messages:
|
|
1006
|
+
messages: messages,
|
|
963
1007
|
pdf: {
|
|
964
1008
|
// which part of the workbook to be exported
|
|
965
1009
|
area: "workbook",
|
|
@@ -1353,18 +1397,18 @@
|
|
|
1353
1397
|
}
|
|
1354
1398
|
}
|
|
1355
1399
|
|
|
1356
|
-
|
|
1400
|
+
let intlValue = {};
|
|
1357
1401
|
|
|
1358
|
-
const
|
|
1402
|
+
const intl = (value) => {
|
|
1359
1403
|
if (value) {
|
|
1360
|
-
|
|
1404
|
+
intlValue = value;
|
|
1361
1405
|
} else {
|
|
1362
|
-
return
|
|
1406
|
+
return intlValue;
|
|
1363
1407
|
}
|
|
1364
1408
|
};
|
|
1365
1409
|
|
|
1366
1410
|
const culture = () => {
|
|
1367
|
-
return
|
|
1411
|
+
return intl().localeInfo();
|
|
1368
1412
|
};
|
|
1369
1413
|
|
|
1370
1414
|
function createKendoObj(calc, CalcError, Ref, CellRef, RangeRef) {
|
|
@@ -2992,9 +3036,10 @@
|
|
|
2992
3036
|
if (format) {
|
|
2993
3037
|
format = formatting.makeDateFormat(format);
|
|
2994
3038
|
}
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
||
|
|
3039
|
+
const parseExactDate = intl().parseDate;
|
|
3040
|
+
return parseExactDate(str, format)
|
|
3041
|
+
|| parseExactDate(str)
|
|
3042
|
+
|| parseExactDate(str, [
|
|
2998
3043
|
"MMMM dd yyyy",
|
|
2999
3044
|
"MMMM dd yy",
|
|
3000
3045
|
"MMM dd yyyy",
|
|
@@ -12732,10 +12777,6 @@
|
|
|
12732
12777
|
return a;
|
|
12733
12778
|
}, [ "borderTop", "borderRight", "borderBottom", "borderLeft" ]);
|
|
12734
12779
|
|
|
12735
|
-
const kendoFormat = function(fmt, ...values) {
|
|
12736
|
-
return kendoIntl.format(fmt, values, locale())
|
|
12737
|
-
};
|
|
12738
|
-
|
|
12739
12780
|
/* eslint-disable no-param-reassign */
|
|
12740
12781
|
|
|
12741
12782
|
let TRANSPOSE_FORMAT = "_matrix({0})";
|
|
@@ -12755,13 +12796,13 @@
|
|
|
12755
12796
|
if (validation.from.indexOf("{") > -1) {
|
|
12756
12797
|
validation.from = validation.from.replace(/\"/g,"").replace("{","\"").replace("}", "\"");
|
|
12757
12798
|
}
|
|
12758
|
-
validation.from =
|
|
12799
|
+
validation.from = intl().format(TRANSPOSE_FORMAT, validation.from);
|
|
12759
12800
|
validation.fromIsListValue = true;
|
|
12760
12801
|
}
|
|
12761
12802
|
if (validation.dataType === "date") {
|
|
12762
12803
|
parsedFromDate = calc.runtime.parseDate(validation.from);
|
|
12763
12804
|
if (parsedFromDate) {
|
|
12764
|
-
validation.from =
|
|
12805
|
+
validation.from = intl().format(DATE_FORMAT, validation.from);
|
|
12765
12806
|
validation.fromIsDateValue = true;
|
|
12766
12807
|
}
|
|
12767
12808
|
}
|
|
@@ -12771,7 +12812,7 @@
|
|
|
12771
12812
|
if (validation.dataType === "date") {
|
|
12772
12813
|
parsedToDate = calc.runtime.parseDate(validation.to);
|
|
12773
12814
|
if (parsedToDate) {
|
|
12774
|
-
validation.to =
|
|
12815
|
+
validation.to = intl().format(DATE_FORMAT, validation.to);
|
|
12775
12816
|
validation.toIsDateValue = true;
|
|
12776
12817
|
}
|
|
12777
12818
|
}
|
|
@@ -12785,7 +12826,7 @@
|
|
|
12785
12826
|
comparer = validationExport.validationComparers[validation.comparerType];
|
|
12786
12827
|
}
|
|
12787
12828
|
if (!comparer) {
|
|
12788
|
-
throw
|
|
12829
|
+
throw intl().format("'{0}' comparer is not implemented.", validation.comparerType);
|
|
12789
12830
|
}
|
|
12790
12831
|
validationHandler = function(valueToCompare) { //add 'valueFormat' arg when add isDate comparer
|
|
12791
12832
|
let toValue = this.to && (this.to_value || this.to_value === 0) ? this.to_value : undefined;
|
|
@@ -12851,7 +12892,7 @@
|
|
|
12851
12892
|
let dataType = this.dataType;
|
|
12852
12893
|
let type = this.type;
|
|
12853
12894
|
let comparerType = this.comparerType;
|
|
12854
|
-
return
|
|
12895
|
+
return intl().format(format, from, to, fromFormula, toFormula, dataType, type, comparerType);
|
|
12855
12896
|
}
|
|
12856
12897
|
_setMessages() {
|
|
12857
12898
|
this.title = "";
|
|
@@ -13248,7 +13289,8 @@
|
|
|
13248
13289
|
}
|
|
13249
13290
|
}
|
|
13250
13291
|
if (type === "date") {
|
|
13251
|
-
|
|
13292
|
+
const intlVal = intl();
|
|
13293
|
+
value = intlVal.toString(serialToDate(value), culture().calendar.patterns.d, intlVal.locale);
|
|
13252
13294
|
} else if (type === "percent") {
|
|
13253
13295
|
value = calc.runtime.limitPrecision(value * 100) + "%";
|
|
13254
13296
|
} else if (typeof value == "string" &&
|
|
@@ -14735,49 +14777,6 @@
|
|
|
14735
14777
|
return oldRect && (oldRect.top !== newRect.top || oldRect.left !== newRect.left);
|
|
14736
14778
|
}
|
|
14737
14779
|
|
|
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
14780
|
const ampRegExp = /&/g,
|
|
14782
14781
|
ltRegExp = /</g,
|
|
14783
14782
|
quoteRegExp = /"/g,
|
|
@@ -17376,15 +17375,17 @@
|
|
|
17376
17375
|
};
|
|
17377
17376
|
});
|
|
17378
17377
|
|
|
17379
|
-
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
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
|
+
}
|
|
17384
17384
|
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17385
|
+
return false;
|
|
17386
|
+
};
|
|
17387
|
+
});
|
|
17388
|
+
};
|
|
17388
17389
|
|
|
17389
17390
|
function quarter(value) {
|
|
17390
17391
|
var month = value.getMonth() + 1;
|
|
@@ -20486,7 +20487,7 @@
|
|
|
20486
20487
|
// if (options.useGridFormat) {
|
|
20487
20488
|
// if (value != null) {
|
|
20488
20489
|
// if (col.format) {
|
|
20489
|
-
// value =
|
|
20490
|
+
// value = intl().format(col.format, value);
|
|
20490
20491
|
// } else {
|
|
20491
20492
|
// value += "";
|
|
20492
20493
|
// }
|
|
@@ -21784,13 +21785,13 @@
|
|
|
21784
21785
|
if (this._isFormula() && !this._navigated) {
|
|
21785
21786
|
value = ((this._tokenContext() || {}).token || {}).value;
|
|
21786
21787
|
|
|
21787
|
-
this.filter(value);
|
|
21788
|
+
const data = this.filter(value);
|
|
21788
21789
|
|
|
21789
|
-
if (!value || !
|
|
21790
|
+
if (!value || !data.length) {
|
|
21790
21791
|
popup.close();
|
|
21791
21792
|
} else {
|
|
21792
21793
|
popup[popup.visible() ? "position" : "open"]();
|
|
21793
|
-
this.list.focusFirst();
|
|
21794
|
+
setTimeout(() => { this.list.focusFirst(); }, 0);
|
|
21794
21795
|
}
|
|
21795
21796
|
}
|
|
21796
21797
|
|
|
@@ -21933,7 +21934,11 @@
|
|
|
21933
21934
|
return;
|
|
21934
21935
|
}
|
|
21935
21936
|
|
|
21936
|
-
|
|
21937
|
+
const data = this.formulaSource.filter((item) => String(item.value).startsWith(value.toLowerCase()));
|
|
21938
|
+
|
|
21939
|
+
this.list.data(data);
|
|
21940
|
+
|
|
21941
|
+
return data;
|
|
21937
21942
|
}
|
|
21938
21943
|
|
|
21939
21944
|
hide() {
|
|
@@ -22114,8 +22119,10 @@
|
|
|
22114
22119
|
if (width > element.offsetWidth) {
|
|
22115
22120
|
element.style.width = width + 'px';
|
|
22116
22121
|
}
|
|
22117
|
-
|
|
22118
|
-
|
|
22122
|
+
|
|
22123
|
+
const activeCellOutlineWidth = 1;
|
|
22124
|
+
if (height - activeCellOutlineWidth > element.offsetHeight) {
|
|
22125
|
+
element.style.height = (height - activeCellOutlineWidth) + 'px';
|
|
22119
22126
|
}
|
|
22120
22127
|
|
|
22121
22128
|
this._sync();
|
|
@@ -23160,6 +23167,14 @@
|
|
|
23160
23167
|
|
|
23161
23168
|
destroy() {
|
|
23162
23169
|
this.unbind();
|
|
23170
|
+
|
|
23171
|
+
[this.tree, this.clipboardContents].forEach(el => {
|
|
23172
|
+
while (el && el.root && el.root.lastChild) {
|
|
23173
|
+
el.root.removeChild(el.root.lastChild);
|
|
23174
|
+
}
|
|
23175
|
+
});
|
|
23176
|
+
this.tree = this.clipboardContents = null;
|
|
23177
|
+
|
|
23163
23178
|
// this._dialogs.forEach(function(dialog) {
|
|
23164
23179
|
// dialog.destroy();
|
|
23165
23180
|
// });
|
|
@@ -25895,7 +25910,7 @@
|
|
|
25895
25910
|
} else if (type === "b") {
|
|
25896
25911
|
value = value === "1";
|
|
25897
25912
|
} else if (type === "d") {
|
|
25898
|
-
value =
|
|
25913
|
+
value = intl().parseDate(value);
|
|
25899
25914
|
}
|
|
25900
25915
|
|
|
25901
25916
|
if (value != null) {
|
|
@@ -26038,7 +26053,7 @@
|
|
|
26038
26053
|
let relationships = await readRelationships(zip, relsFile);
|
|
26039
26054
|
|
|
26040
26055
|
if (relationships.byType.image) {
|
|
26041
|
-
|
|
26056
|
+
for (const id of Object.keys(relationships.byId)) {
|
|
26042
26057
|
let img = relative_file(file, relationships.byId[id]);
|
|
26043
26058
|
let type = getContentType(img);
|
|
26044
26059
|
|
|
@@ -26050,7 +26065,7 @@
|
|
|
26050
26065
|
: new window.Blob([ data ], { type: type });
|
|
26051
26066
|
relationships.byId[id] = sheet._workbook.addImage(blob);
|
|
26052
26067
|
}
|
|
26053
|
-
}
|
|
26068
|
+
}
|
|
26054
26069
|
}
|
|
26055
26070
|
|
|
26056
26071
|
let cdr, ref, width, height;
|
|
@@ -26745,7 +26760,7 @@
|
|
|
26745
26760
|
return val / 9525;
|
|
26746
26761
|
}
|
|
26747
26762
|
|
|
26748
|
-
/* eslint-disable no-
|
|
26763
|
+
/* eslint-disable no-undef */
|
|
26749
26764
|
|
|
26750
26765
|
const events$1 = [
|
|
26751
26766
|
"cut",
|
|
@@ -27053,6 +27068,7 @@
|
|
|
27053
27068
|
let insertIndex = typeof options.index === "number" ? options.index : that._sheets.length;
|
|
27054
27069
|
let sheetName;
|
|
27055
27070
|
let sheets = that._sheets;
|
|
27071
|
+
const messages = this.options.messages;
|
|
27056
27072
|
|
|
27057
27073
|
let getUniqueSheetName = function(sheetNameSuffix) {
|
|
27058
27074
|
sheetNameSuffix = sheetNameSuffix ? sheetNameSuffix : 1;
|
|
@@ -27250,33 +27266,33 @@
|
|
|
27250
27266
|
this._imgID = 0;
|
|
27251
27267
|
}
|
|
27252
27268
|
|
|
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
|
-
|
|
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
|
+
}
|
|
27280
27296
|
|
|
27281
27297
|
fromJSON(json) {
|
|
27282
27298
|
if (json.sheets) {
|
|
@@ -27294,7 +27310,7 @@
|
|
|
27294
27310
|
}
|
|
27295
27311
|
this._images[id] = { url: json.images[id] };
|
|
27296
27312
|
}, this);
|
|
27297
|
-
|
|
27313
|
+
this._loadImages();
|
|
27298
27314
|
}
|
|
27299
27315
|
|
|
27300
27316
|
for (let idx = 0; idx < json.sheets.length; idx++) {
|
|
@@ -27361,52 +27377,49 @@
|
|
|
27361
27377
|
return sheet.toJSON();
|
|
27362
27378
|
}, this),
|
|
27363
27379
|
names: names,
|
|
27380
|
+
images: {},
|
|
27364
27381
|
columnWidth: this.options.columnWidth,
|
|
27365
27382
|
rowHeight: this.options.rowHeight
|
|
27366
27383
|
};
|
|
27367
27384
|
}
|
|
27368
27385
|
|
|
27369
27386
|
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();
|
|
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;
|
|
27399
27393
|
|
|
27400
|
-
|
|
27401
|
-
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
|
|
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);
|
|
27405
27416
|
}
|
|
27406
27417
|
|
|
27407
27418
|
fromFile(file) {
|
|
27408
|
-
this.
|
|
27409
|
-
|
|
27419
|
+
if (file && !this.trigger("excelImport", { file })) {
|
|
27420
|
+
this._clearSheets();
|
|
27421
|
+
readExcel(file, this);
|
|
27422
|
+
}
|
|
27410
27423
|
}
|
|
27411
27424
|
|
|
27412
27425
|
saveAsExcel(options) {
|
|
@@ -27732,17 +27745,14 @@
|
|
|
27732
27745
|
"dataBound"
|
|
27733
27746
|
];
|
|
27734
27747
|
|
|
27735
|
-
class
|
|
27748
|
+
class SpreadsheetWidget extends Widget {
|
|
27736
27749
|
constructor(element, options$1) {
|
|
27737
|
-
super(element,
|
|
27750
|
+
super(element, deepExtend({}, options, options$1));
|
|
27738
27751
|
this.events = events;
|
|
27739
27752
|
this.bind(this.events, this.options);
|
|
27740
27753
|
|
|
27741
|
-
this.
|
|
27742
|
-
|
|
27743
|
-
this.element.setAttribute("role", "application");
|
|
27744
|
-
|
|
27745
|
-
locale(this.options.locale);
|
|
27754
|
+
intl({ locale: this.options.locale, ...this.options.intl });
|
|
27755
|
+
initDynamicFilter();
|
|
27746
27756
|
|
|
27747
27757
|
this._view = new View(this.element, {
|
|
27748
27758
|
messages: this.options.messages.view,
|
|
@@ -27753,11 +27763,6 @@
|
|
|
27753
27763
|
nameBoxRef: this.options.nameBoxRef
|
|
27754
27764
|
});
|
|
27755
27765
|
|
|
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
27766
|
this._workbook = new Workbook(this.options, this._view);
|
|
27762
27767
|
|
|
27763
27768
|
this._controller = new Controller(this._view, this._workbook);
|
|
@@ -27778,6 +27783,14 @@
|
|
|
27778
27783
|
this.element.addEventListener("keydown", this._keyDown.bind(this));
|
|
27779
27784
|
}
|
|
27780
27785
|
|
|
27786
|
+
get view() {
|
|
27787
|
+
return this._view;
|
|
27788
|
+
}
|
|
27789
|
+
|
|
27790
|
+
get workbook () {
|
|
27791
|
+
return this._workbook;
|
|
27792
|
+
}
|
|
27793
|
+
|
|
27781
27794
|
_keyDown(e) {
|
|
27782
27795
|
let key = e.keyCode;
|
|
27783
27796
|
|
|
@@ -27982,8 +27995,8 @@
|
|
|
27982
27995
|
return this._workbook.saveJSON();
|
|
27983
27996
|
}
|
|
27984
27997
|
|
|
27985
|
-
fromFile(blob
|
|
27986
|
-
return this._workbook.fromFile(blob
|
|
27998
|
+
fromFile(blob) {
|
|
27999
|
+
return this._workbook.fromFile(blob);
|
|
27987
28000
|
}
|
|
27988
28001
|
|
|
27989
28002
|
saveAsPDF(options) {
|
|
@@ -28213,6 +28226,10 @@
|
|
|
28213
28226
|
}
|
|
28214
28227
|
}
|
|
28215
28228
|
|
|
28216
|
-
exports.
|
|
28229
|
+
exports.Range = Range$1;
|
|
28230
|
+
exports.Sheet = Sheet;
|
|
28231
|
+
exports.SpreadsheetWidget = SpreadsheetWidget;
|
|
28232
|
+
exports.View = View;
|
|
28233
|
+
exports.Workbook = Workbook;
|
|
28217
28234
|
|
|
28218
28235
|
}));
|
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.11",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Kendo UI"
|
|
7
7
|
],
|
|
@@ -19,20 +19,18 @@
|
|
|
19
19
|
"e2e:visual": "jest --config ./jest.e2e.visual.config.json",
|
|
20
20
|
"prepare": "husky install"
|
|
21
21
|
},
|
|
22
|
-
"dependencies": {
|
|
22
|
+
"dependencies": {},
|
|
23
|
+
"peerDependencies": {
|
|
23
24
|
"@progress/kendo-common": "^0.2.2",
|
|
24
25
|
"@progress/kendo-date-math": "^1.5.10",
|
|
26
|
+
"@progress/kendo-drawing": "^1.17.5",
|
|
25
27
|
"@progress/jszip-esm": "^1.0.3"
|
|
26
28
|
},
|
|
27
|
-
"peerDependencies": {
|
|
28
|
-
"@progress/kendo-drawing": "^1.17.1",
|
|
29
|
-
"@progress/kendo-intl": "^3.1.1"
|
|
30
|
-
},
|
|
31
29
|
"devDependencies": {
|
|
32
30
|
"@commitlint/cli": "^17.3.0",
|
|
33
31
|
"@commitlint/config-conventional": "^17.3.0",
|
|
34
|
-
"@progress/kendo-e2e": "^1.
|
|
35
|
-
"@progress/kendo-
|
|
32
|
+
"@progress/kendo-e2e": "^1.3.0",
|
|
33
|
+
"@progress/kendo-intl": "^3.1.1",
|
|
36
34
|
"@types/jest": "^29.0.0",
|
|
37
35
|
"es-jest": "^2.1.0",
|
|
38
36
|
"eslint": "^8.28.0",
|