@progress/kendo-spreadsheet-common 1.0.0-develop.8 → 1.0.0
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 +71 -103
- package/dist/index.js +88 -103
- package/package.json +1 -1
- package/src/index.d.ts +581 -9
package/dist/index-esm.js
CHANGED
|
@@ -949,6 +949,7 @@ const messages = {};
|
|
|
949
949
|
messages.view = {
|
|
950
950
|
nameBox: "Name Box",
|
|
951
951
|
errors: {
|
|
952
|
+
modifyMerged: "Cannot change part of a merged cell.",
|
|
952
953
|
openUnsupported: "Unsupported format. Please select an .xlsx file.",
|
|
953
954
|
shiftingNonblankCells: "Cannot insert cells due to data loss possibility. Select another insert location or delete the data from the end of your worksheet.",
|
|
954
955
|
insertColumnWhenRowIsSelected: "Cannot insert column when all columns are selected.",
|
|
@@ -3060,6 +3061,18 @@ function parseDate(str, format) {
|
|
|
3060
3061
|
]);
|
|
3061
3062
|
}
|
|
3062
3063
|
|
|
3064
|
+
function defineAlias(alias, name) {
|
|
3065
|
+
var orig = FUNCS[name];
|
|
3066
|
+
if (!orig) {
|
|
3067
|
+
throw new Error("Function " + name + " is not yet defined");
|
|
3068
|
+
}
|
|
3069
|
+
if (!orig.kendoSpreadsheetAliases) {
|
|
3070
|
+
orig.kendoSpreadsheetAliases = [ name ];
|
|
3071
|
+
}
|
|
3072
|
+
orig.kendoSpreadsheetAliases.push(alias);
|
|
3073
|
+
FUNCS[alias] = orig;
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3063
3076
|
/* -----[ exports ]----- */
|
|
3064
3077
|
|
|
3065
3078
|
calc.runtime.CalcError = CalcError;
|
|
@@ -3078,24 +3091,8 @@ calc.runtime.isLeapYear = isLeapYear;
|
|
|
3078
3091
|
calc.runtime.daysInYear = daysInYear;
|
|
3079
3092
|
calc.runtime.parseDate = parseDate;
|
|
3080
3093
|
calc.runtime.limitPrecision = limitPrecision;
|
|
3081
|
-
|
|
3082
|
-
// spreadsheet.dateToNumber = dateToSerial;
|
|
3083
|
-
// spreadsheet.numberToDate = serialToDate;
|
|
3084
|
-
// spreadsheet.defineFunction = defineFunction;
|
|
3085
|
-
// spreadsheet.CalcError = CalcError;
|
|
3086
|
-
|
|
3087
3094
|
calc.runtime.defineFunction = defineFunction;
|
|
3088
|
-
calc.runtime.defineAlias =
|
|
3089
|
-
var orig = FUNCS[name];
|
|
3090
|
-
if (!orig) {
|
|
3091
|
-
throw new Error("Function " + name + " is not yet defined");
|
|
3092
|
-
}
|
|
3093
|
-
if (!orig.kendoSpreadsheetAliases) {
|
|
3094
|
-
orig.kendoSpreadsheetAliases = [ name ];
|
|
3095
|
-
}
|
|
3096
|
-
orig.kendoSpreadsheetAliases.push(alias);
|
|
3097
|
-
FUNCS[alias] = orig;
|
|
3098
|
-
};
|
|
3095
|
+
calc.runtime.defineAlias = defineAlias;
|
|
3099
3096
|
|
|
3100
3097
|
/* -----[ Excel operators ]----- */
|
|
3101
3098
|
|
|
@@ -10801,13 +10798,13 @@ class Controller {
|
|
|
10801
10798
|
this.editor.deactivate(true); // make sure we don't call any change hooks
|
|
10802
10799
|
this.view.showError(result, function() {
|
|
10803
10800
|
// we only get here in case of a validation error when the user decided to retry.
|
|
10804
|
-
this.activateEditor(false);
|
|
10801
|
+
// this.activateEditor(false);
|
|
10805
10802
|
// reset to last input from user
|
|
10806
|
-
this.editor.value(this._lastEditorValue);
|
|
10803
|
+
// this.editor.value(this._lastEditorValue);
|
|
10807
10804
|
// however, set _value manually such that it'll detect change properly. ugly :-\
|
|
10808
|
-
this.editor._value = this._workbook._inputForRef(this._workbook.activeSheet()._viewActiveCell());
|
|
10805
|
+
// this.editor._value = this._workbook._inputForRef(this._workbook.activeSheet()._viewActiveCell());
|
|
10809
10806
|
// seems like a nice UX to have the whole input selected
|
|
10810
|
-
this.editor.select();
|
|
10807
|
+
// this.editor.select();
|
|
10811
10808
|
}.bind(this));
|
|
10812
10809
|
} else {
|
|
10813
10810
|
this.view.openDialog(result.reason);
|
|
@@ -21933,7 +21930,7 @@ class FormulaInput extends Widget {
|
|
|
21933
21930
|
return;
|
|
21934
21931
|
}
|
|
21935
21932
|
|
|
21936
|
-
const data = this.formulaSource.filter((item) => String(item.value).startsWith(value.toLowerCase()));
|
|
21933
|
+
const data = this.formulaSource.filter((item) => String(item.value).toLowerCase().startsWith(value.toLowerCase()));
|
|
21937
21934
|
|
|
21938
21935
|
this.list.data(data);
|
|
21939
21936
|
|
|
@@ -22604,7 +22601,7 @@ class View extends Observable {
|
|
|
22604
22601
|
messages: messages.view
|
|
22605
22602
|
}, this.options, options);
|
|
22606
22603
|
|
|
22607
|
-
this.events = ['update'];
|
|
22604
|
+
this.events = ['update', 'message'];
|
|
22608
22605
|
|
|
22609
22606
|
this._chrome();
|
|
22610
22607
|
|
|
@@ -23021,7 +23018,7 @@ class View extends Observable {
|
|
|
23021
23018
|
|
|
23022
23019
|
selectClipboardContents() {
|
|
23023
23020
|
if (!this.isClipboardDeactivated) {
|
|
23024
|
-
this.clipboard.focus();
|
|
23021
|
+
this.clipboard.focus({ preventScroll: true });
|
|
23025
23022
|
selectElementContents(this.clipboard);
|
|
23026
23023
|
}
|
|
23027
23024
|
}
|
|
@@ -23087,81 +23084,41 @@ class View extends Observable {
|
|
|
23087
23084
|
});
|
|
23088
23085
|
}
|
|
23089
23086
|
|
|
23090
|
-
openDialog(
|
|
23091
|
-
|
|
23092
|
-
|
|
23093
|
-
|
|
23094
|
-
|
|
23095
|
-
|
|
23096
|
-
|
|
23097
|
-
// dialog.bind("deactivate", this._destroyDialog.bind(this));
|
|
23098
|
-
// this._dialogs.push(dialog);
|
|
23099
|
-
|
|
23100
|
-
// let ref = sheet.activeCell();
|
|
23101
|
-
// let range = new kendo.spreadsheet.Range(ref, sheet);
|
|
23102
|
-
|
|
23103
|
-
// dialog.open(range);
|
|
23104
|
-
// return dialog;
|
|
23105
|
-
// }
|
|
23106
|
-
// }.bind(this));
|
|
23087
|
+
openDialog(name, options) {
|
|
23088
|
+
let sheet = this._sheet;
|
|
23089
|
+
return sheet.withCultureDecimals(function() {
|
|
23090
|
+
let ref = sheet.activeCell();
|
|
23091
|
+
let range = new Range$1(ref, sheet);
|
|
23092
|
+
this.trigger('message', { ...options, name, ref, range });
|
|
23093
|
+
}.bind(this));
|
|
23107
23094
|
}
|
|
23108
23095
|
|
|
23109
|
-
showError(
|
|
23110
|
-
|
|
23111
|
-
|
|
23112
|
-
// let hasOpenedError = false;
|
|
23096
|
+
showError(options, reopenEditor) {
|
|
23097
|
+
let currentDialogs = this._dialogs;
|
|
23098
|
+
let errorMessages = this.options.messages.errors;
|
|
23113
23099
|
|
|
23114
|
-
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
// hasOpenedError = true;
|
|
23118
|
-
// }
|
|
23119
|
-
// });
|
|
23120
|
-
// }
|
|
23121
|
-
// if (hasOpenedError) {
|
|
23122
|
-
// return;
|
|
23123
|
-
// }
|
|
23100
|
+
if (currentDialogs.length > 0) {
|
|
23101
|
+
return;
|
|
23102
|
+
}
|
|
23124
23103
|
|
|
23125
|
-
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
|
|
23129
|
-
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
// };
|
|
23104
|
+
let onClose = function() {
|
|
23105
|
+
currentDialogs.pop();
|
|
23106
|
+
// let dlg = e.sender;
|
|
23107
|
+
this.selectClipboardContents();
|
|
23108
|
+
if (reopenEditor) { // dlg._retry &&
|
|
23109
|
+
reopenEditor();
|
|
23110
|
+
}
|
|
23111
|
+
}.bind(this);
|
|
23134
23112
|
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
// }
|
|
23141
|
-
// }.bind(this);
|
|
23142
|
-
|
|
23143
|
-
// if (kendo.spreadsheet.dialogs.registered(options.type)) {
|
|
23144
|
-
// let dialogOptions = {
|
|
23145
|
-
// close: onClose
|
|
23146
|
-
// };
|
|
23147
|
-
|
|
23148
|
-
// if (options.type === "validationError") {
|
|
23149
|
-
// dialogOptions = $.extend(dialogOptions, {
|
|
23150
|
-
// title: options.title || "Error",
|
|
23151
|
-
// text: options.body ? options.body : errorMessages[options.type],
|
|
23152
|
-
// activate: focusButton
|
|
23153
|
-
// });
|
|
23154
|
-
// }
|
|
23113
|
+
const dialogOptions = {
|
|
23114
|
+
title: options.title || "Error",
|
|
23115
|
+
text: options.body ? options.body : errorMessages[options.type],
|
|
23116
|
+
close: onClose
|
|
23117
|
+
};
|
|
23155
23118
|
|
|
23156
|
-
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
// title : options.title || "Error",
|
|
23160
|
-
// text : options.body ? options.body : errorMessages[options.type],
|
|
23161
|
-
// activate: focusButton,
|
|
23162
|
-
// close: onClose
|
|
23163
|
-
// });
|
|
23164
|
-
// }
|
|
23119
|
+
currentDialogs.push(dialogOptions);
|
|
23120
|
+
|
|
23121
|
+
this.openDialog(options.type || "message", dialogOptions);
|
|
23165
23122
|
}
|
|
23166
23123
|
|
|
23167
23124
|
destroy() {
|
|
@@ -23998,6 +23955,16 @@ class PropertyChangeCommand extends Command {
|
|
|
23998
23955
|
}
|
|
23999
23956
|
}
|
|
24000
23957
|
|
|
23958
|
+
class PropertyCleanCommand extends PropertyChangeCommand {
|
|
23959
|
+
exec() {
|
|
23960
|
+
let range = this.range();
|
|
23961
|
+
if (range.enable()) {
|
|
23962
|
+
this.getState();
|
|
23963
|
+
range.clearFormat();
|
|
23964
|
+
}
|
|
23965
|
+
}
|
|
23966
|
+
}
|
|
23967
|
+
|
|
24001
23968
|
class ClearContentCommand extends Command {
|
|
24002
23969
|
exec() {
|
|
24003
23970
|
let values = [], range, rowValues, nullValues, validationState, currentRange;
|
|
@@ -24993,14 +24960,14 @@ class OpenCommand extends Command {
|
|
|
24993
24960
|
}
|
|
24994
24961
|
|
|
24995
24962
|
let workbook = this.options.workbook;
|
|
24996
|
-
workbook.fromFile(this.options.file)
|
|
24997
|
-
|
|
24998
|
-
|
|
24999
|
-
|
|
25000
|
-
|
|
25001
|
-
|
|
25002
|
-
}
|
|
25003
|
-
}
|
|
24963
|
+
workbook.fromFile(this.options.file);
|
|
24964
|
+
|
|
24965
|
+
let errors = workbook.excelImportErrors;
|
|
24966
|
+
if (errors && errors.length) {
|
|
24967
|
+
workbook._view.openDialog("importError", {
|
|
24968
|
+
errors: errors
|
|
24969
|
+
});
|
|
24970
|
+
}
|
|
25004
24971
|
}
|
|
25005
24972
|
}
|
|
25006
24973
|
|
|
@@ -25099,6 +25066,7 @@ var commands = /*#__PURE__*/Object.freeze({
|
|
|
25099
25066
|
OpenCommand: OpenCommand,
|
|
25100
25067
|
PasteCommand: PasteCommand,
|
|
25101
25068
|
PropertyChangeCommand: PropertyChangeCommand,
|
|
25069
|
+
PropertyCleanCommand: PropertyCleanCommand,
|
|
25102
25070
|
ReorderDrawingsCommand: ReorderDrawingsCommand,
|
|
25103
25071
|
RowHeightCommand: RowHeightCommand,
|
|
25104
25072
|
SaveAsCommand: SaveAsCommand,
|
|
@@ -27744,7 +27712,7 @@ const events = [
|
|
|
27744
27712
|
"dataBound"
|
|
27745
27713
|
];
|
|
27746
27714
|
|
|
27747
|
-
class
|
|
27715
|
+
class SpreadsheetWidget extends Widget {
|
|
27748
27716
|
constructor(element, options$1) {
|
|
27749
27717
|
super(element, deepExtend({}, options, options$1));
|
|
27750
27718
|
this.events = events;
|
|
@@ -28225,4 +28193,4 @@ class Spreadsheet extends Widget {
|
|
|
28225
28193
|
}
|
|
28226
28194
|
}
|
|
28227
28195
|
|
|
28228
|
-
export { Range$1 as Range, Sheet,
|
|
28196
|
+
export { CalcError, CellRef, Context, Matrix, NULLREF, NameRef, Range$1 as Range, RangeRef, Ref, Sheet, SpreadsheetWidget, UnionRef, View, Workbook, dateToSerial, defineAlias, defineFunction, packDate, packTime, serialToDate, unpackDate, unpackTime };
|
package/dist/index.js
CHANGED
|
@@ -950,6 +950,7 @@
|
|
|
950
950
|
messages.view = {
|
|
951
951
|
nameBox: "Name Box",
|
|
952
952
|
errors: {
|
|
953
|
+
modifyMerged: "Cannot change part of a merged cell.",
|
|
953
954
|
openUnsupported: "Unsupported format. Please select an .xlsx file.",
|
|
954
955
|
shiftingNonblankCells: "Cannot insert cells due to data loss possibility. Select another insert location or delete the data from the end of your worksheet.",
|
|
955
956
|
insertColumnWhenRowIsSelected: "Cannot insert column when all columns are selected.",
|
|
@@ -3061,6 +3062,18 @@
|
|
|
3061
3062
|
]);
|
|
3062
3063
|
}
|
|
3063
3064
|
|
|
3065
|
+
function defineAlias(alias, name) {
|
|
3066
|
+
var orig = FUNCS[name];
|
|
3067
|
+
if (!orig) {
|
|
3068
|
+
throw new Error("Function " + name + " is not yet defined");
|
|
3069
|
+
}
|
|
3070
|
+
if (!orig.kendoSpreadsheetAliases) {
|
|
3071
|
+
orig.kendoSpreadsheetAliases = [ name ];
|
|
3072
|
+
}
|
|
3073
|
+
orig.kendoSpreadsheetAliases.push(alias);
|
|
3074
|
+
FUNCS[alias] = orig;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3064
3077
|
/* -----[ exports ]----- */
|
|
3065
3078
|
|
|
3066
3079
|
calc.runtime.CalcError = CalcError;
|
|
@@ -3079,24 +3092,8 @@
|
|
|
3079
3092
|
calc.runtime.daysInYear = daysInYear;
|
|
3080
3093
|
calc.runtime.parseDate = parseDate;
|
|
3081
3094
|
calc.runtime.limitPrecision = limitPrecision;
|
|
3082
|
-
|
|
3083
|
-
// spreadsheet.dateToNumber = dateToSerial;
|
|
3084
|
-
// spreadsheet.numberToDate = serialToDate;
|
|
3085
|
-
// spreadsheet.defineFunction = defineFunction;
|
|
3086
|
-
// spreadsheet.CalcError = CalcError;
|
|
3087
|
-
|
|
3088
3095
|
calc.runtime.defineFunction = defineFunction;
|
|
3089
|
-
calc.runtime.defineAlias =
|
|
3090
|
-
var orig = FUNCS[name];
|
|
3091
|
-
if (!orig) {
|
|
3092
|
-
throw new Error("Function " + name + " is not yet defined");
|
|
3093
|
-
}
|
|
3094
|
-
if (!orig.kendoSpreadsheetAliases) {
|
|
3095
|
-
orig.kendoSpreadsheetAliases = [ name ];
|
|
3096
|
-
}
|
|
3097
|
-
orig.kendoSpreadsheetAliases.push(alias);
|
|
3098
|
-
FUNCS[alias] = orig;
|
|
3099
|
-
};
|
|
3096
|
+
calc.runtime.defineAlias = defineAlias;
|
|
3100
3097
|
|
|
3101
3098
|
/* -----[ Excel operators ]----- */
|
|
3102
3099
|
|
|
@@ -10802,13 +10799,13 @@
|
|
|
10802
10799
|
this.editor.deactivate(true); // make sure we don't call any change hooks
|
|
10803
10800
|
this.view.showError(result, function() {
|
|
10804
10801
|
// we only get here in case of a validation error when the user decided to retry.
|
|
10805
|
-
this.activateEditor(false);
|
|
10802
|
+
// this.activateEditor(false);
|
|
10806
10803
|
// reset to last input from user
|
|
10807
|
-
this.editor.value(this._lastEditorValue);
|
|
10804
|
+
// this.editor.value(this._lastEditorValue);
|
|
10808
10805
|
// however, set _value manually such that it'll detect change properly. ugly :-\
|
|
10809
|
-
this.editor._value = this._workbook._inputForRef(this._workbook.activeSheet()._viewActiveCell());
|
|
10806
|
+
// this.editor._value = this._workbook._inputForRef(this._workbook.activeSheet()._viewActiveCell());
|
|
10810
10807
|
// seems like a nice UX to have the whole input selected
|
|
10811
|
-
this.editor.select();
|
|
10808
|
+
// this.editor.select();
|
|
10812
10809
|
}.bind(this));
|
|
10813
10810
|
} else {
|
|
10814
10811
|
this.view.openDialog(result.reason);
|
|
@@ -21934,7 +21931,7 @@
|
|
|
21934
21931
|
return;
|
|
21935
21932
|
}
|
|
21936
21933
|
|
|
21937
|
-
const data = this.formulaSource.filter((item) => String(item.value).startsWith(value.toLowerCase()));
|
|
21934
|
+
const data = this.formulaSource.filter((item) => String(item.value).toLowerCase().startsWith(value.toLowerCase()));
|
|
21938
21935
|
|
|
21939
21936
|
this.list.data(data);
|
|
21940
21937
|
|
|
@@ -22605,7 +22602,7 @@
|
|
|
22605
22602
|
messages: messages.view
|
|
22606
22603
|
}, this.options, options);
|
|
22607
22604
|
|
|
22608
|
-
this.events = ['update'];
|
|
22605
|
+
this.events = ['update', 'message'];
|
|
22609
22606
|
|
|
22610
22607
|
this._chrome();
|
|
22611
22608
|
|
|
@@ -23022,7 +23019,7 @@
|
|
|
23022
23019
|
|
|
23023
23020
|
selectClipboardContents() {
|
|
23024
23021
|
if (!this.isClipboardDeactivated) {
|
|
23025
|
-
this.clipboard.focus();
|
|
23022
|
+
this.clipboard.focus({ preventScroll: true });
|
|
23026
23023
|
selectElementContents(this.clipboard);
|
|
23027
23024
|
}
|
|
23028
23025
|
}
|
|
@@ -23088,81 +23085,41 @@
|
|
|
23088
23085
|
});
|
|
23089
23086
|
}
|
|
23090
23087
|
|
|
23091
|
-
openDialog(
|
|
23092
|
-
|
|
23093
|
-
|
|
23094
|
-
|
|
23095
|
-
|
|
23096
|
-
|
|
23097
|
-
|
|
23098
|
-
// dialog.bind("deactivate", this._destroyDialog.bind(this));
|
|
23099
|
-
// this._dialogs.push(dialog);
|
|
23100
|
-
|
|
23101
|
-
// let ref = sheet.activeCell();
|
|
23102
|
-
// let range = new kendo.spreadsheet.Range(ref, sheet);
|
|
23103
|
-
|
|
23104
|
-
// dialog.open(range);
|
|
23105
|
-
// return dialog;
|
|
23106
|
-
// }
|
|
23107
|
-
// }.bind(this));
|
|
23088
|
+
openDialog(name, options) {
|
|
23089
|
+
let sheet = this._sheet;
|
|
23090
|
+
return sheet.withCultureDecimals(function() {
|
|
23091
|
+
let ref = sheet.activeCell();
|
|
23092
|
+
let range = new Range$1(ref, sheet);
|
|
23093
|
+
this.trigger('message', { ...options, name, ref, range });
|
|
23094
|
+
}.bind(this));
|
|
23108
23095
|
}
|
|
23109
23096
|
|
|
23110
|
-
showError(
|
|
23111
|
-
|
|
23112
|
-
|
|
23113
|
-
// let hasOpenedError = false;
|
|
23097
|
+
showError(options, reopenEditor) {
|
|
23098
|
+
let currentDialogs = this._dialogs;
|
|
23099
|
+
let errorMessages = this.options.messages.errors;
|
|
23114
23100
|
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
|
|
23118
|
-
// hasOpenedError = true;
|
|
23119
|
-
// }
|
|
23120
|
-
// });
|
|
23121
|
-
// }
|
|
23122
|
-
// if (hasOpenedError) {
|
|
23123
|
-
// return;
|
|
23124
|
-
// }
|
|
23101
|
+
if (currentDialogs.length > 0) {
|
|
23102
|
+
return;
|
|
23103
|
+
}
|
|
23125
23104
|
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
|
|
23129
|
-
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
// };
|
|
23105
|
+
let onClose = function() {
|
|
23106
|
+
currentDialogs.pop();
|
|
23107
|
+
// let dlg = e.sender;
|
|
23108
|
+
this.selectClipboardContents();
|
|
23109
|
+
if (reopenEditor) { // dlg._retry &&
|
|
23110
|
+
reopenEditor();
|
|
23111
|
+
}
|
|
23112
|
+
}.bind(this);
|
|
23135
23113
|
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
// }
|
|
23142
|
-
// }.bind(this);
|
|
23143
|
-
|
|
23144
|
-
// if (kendo.spreadsheet.dialogs.registered(options.type)) {
|
|
23145
|
-
// let dialogOptions = {
|
|
23146
|
-
// close: onClose
|
|
23147
|
-
// };
|
|
23148
|
-
|
|
23149
|
-
// if (options.type === "validationError") {
|
|
23150
|
-
// dialogOptions = $.extend(dialogOptions, {
|
|
23151
|
-
// title: options.title || "Error",
|
|
23152
|
-
// text: options.body ? options.body : errorMessages[options.type],
|
|
23153
|
-
// activate: focusButton
|
|
23154
|
-
// });
|
|
23155
|
-
// }
|
|
23114
|
+
const dialogOptions = {
|
|
23115
|
+
title: options.title || "Error",
|
|
23116
|
+
text: options.body ? options.body : errorMessages[options.type],
|
|
23117
|
+
close: onClose
|
|
23118
|
+
};
|
|
23156
23119
|
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
|
|
23160
|
-
// title : options.title || "Error",
|
|
23161
|
-
// text : options.body ? options.body : errorMessages[options.type],
|
|
23162
|
-
// activate: focusButton,
|
|
23163
|
-
// close: onClose
|
|
23164
|
-
// });
|
|
23165
|
-
// }
|
|
23120
|
+
currentDialogs.push(dialogOptions);
|
|
23121
|
+
|
|
23122
|
+
this.openDialog(options.type || "message", dialogOptions);
|
|
23166
23123
|
}
|
|
23167
23124
|
|
|
23168
23125
|
destroy() {
|
|
@@ -23999,6 +23956,16 @@
|
|
|
23999
23956
|
}
|
|
24000
23957
|
}
|
|
24001
23958
|
|
|
23959
|
+
class PropertyCleanCommand extends PropertyChangeCommand {
|
|
23960
|
+
exec() {
|
|
23961
|
+
let range = this.range();
|
|
23962
|
+
if (range.enable()) {
|
|
23963
|
+
this.getState();
|
|
23964
|
+
range.clearFormat();
|
|
23965
|
+
}
|
|
23966
|
+
}
|
|
23967
|
+
}
|
|
23968
|
+
|
|
24002
23969
|
class ClearContentCommand extends Command {
|
|
24003
23970
|
exec() {
|
|
24004
23971
|
let values = [], range, rowValues, nullValues, validationState, currentRange;
|
|
@@ -24994,14 +24961,14 @@
|
|
|
24994
24961
|
}
|
|
24995
24962
|
|
|
24996
24963
|
let workbook = this.options.workbook;
|
|
24997
|
-
workbook.fromFile(this.options.file)
|
|
24998
|
-
|
|
24999
|
-
|
|
25000
|
-
|
|
25001
|
-
|
|
25002
|
-
|
|
25003
|
-
}
|
|
25004
|
-
}
|
|
24964
|
+
workbook.fromFile(this.options.file);
|
|
24965
|
+
|
|
24966
|
+
let errors = workbook.excelImportErrors;
|
|
24967
|
+
if (errors && errors.length) {
|
|
24968
|
+
workbook._view.openDialog("importError", {
|
|
24969
|
+
errors: errors
|
|
24970
|
+
});
|
|
24971
|
+
}
|
|
25005
24972
|
}
|
|
25006
24973
|
}
|
|
25007
24974
|
|
|
@@ -25100,6 +25067,7 @@
|
|
|
25100
25067
|
OpenCommand: OpenCommand,
|
|
25101
25068
|
PasteCommand: PasteCommand,
|
|
25102
25069
|
PropertyChangeCommand: PropertyChangeCommand,
|
|
25070
|
+
PropertyCleanCommand: PropertyCleanCommand,
|
|
25103
25071
|
ReorderDrawingsCommand: ReorderDrawingsCommand,
|
|
25104
25072
|
RowHeightCommand: RowHeightCommand,
|
|
25105
25073
|
SaveAsCommand: SaveAsCommand,
|
|
@@ -27745,7 +27713,7 @@
|
|
|
27745
27713
|
"dataBound"
|
|
27746
27714
|
];
|
|
27747
27715
|
|
|
27748
|
-
class
|
|
27716
|
+
class SpreadsheetWidget extends Widget {
|
|
27749
27717
|
constructor(element, options$1) {
|
|
27750
27718
|
super(element, deepExtend({}, options, options$1));
|
|
27751
27719
|
this.events = events;
|
|
@@ -28226,10 +28194,27 @@
|
|
|
28226
28194
|
}
|
|
28227
28195
|
}
|
|
28228
28196
|
|
|
28197
|
+
exports.CalcError = CalcError;
|
|
28198
|
+
exports.CellRef = CellRef;
|
|
28199
|
+
exports.Context = Context;
|
|
28200
|
+
exports.Matrix = Matrix;
|
|
28201
|
+
exports.NULLREF = NULLREF;
|
|
28202
|
+
exports.NameRef = NameRef;
|
|
28229
28203
|
exports.Range = Range$1;
|
|
28204
|
+
exports.RangeRef = RangeRef;
|
|
28205
|
+
exports.Ref = Ref;
|
|
28230
28206
|
exports.Sheet = Sheet;
|
|
28231
|
-
exports.
|
|
28207
|
+
exports.SpreadsheetWidget = SpreadsheetWidget;
|
|
28208
|
+
exports.UnionRef = UnionRef;
|
|
28232
28209
|
exports.View = View;
|
|
28233
28210
|
exports.Workbook = Workbook;
|
|
28211
|
+
exports.dateToSerial = dateToSerial;
|
|
28212
|
+
exports.defineAlias = defineAlias;
|
|
28213
|
+
exports.defineFunction = defineFunction;
|
|
28214
|
+
exports.packDate = packDate;
|
|
28215
|
+
exports.packTime = packTime;
|
|
28216
|
+
exports.serialToDate = serialToDate;
|
|
28217
|
+
exports.unpackDate = unpackDate;
|
|
28218
|
+
exports.unpackTime = unpackTime;
|
|
28234
28219
|
|
|
28235
28220
|
}));
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
/* eslint-disable max-len */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the default cell styles that will be applied to the sheet cells.
|
|
6
|
+
*/
|
|
3
7
|
export interface CellDefaultStyle {
|
|
4
8
|
/**
|
|
5
9
|
* The background [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the cell.
|
|
@@ -42,11 +46,14 @@ export interface CellDefaultStyle {
|
|
|
42
46
|
wrap?: boolean;
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Configures the Excel export settings of the Spreadsheet.
|
|
51
|
+
*/
|
|
45
52
|
export interface ExcelExportSettings {
|
|
46
53
|
/**
|
|
47
54
|
* Specifies the file name of the exported Excel file.
|
|
48
55
|
*
|
|
49
|
-
* @default '
|
|
56
|
+
* @default 'Workbook.xslx'
|
|
50
57
|
*/
|
|
51
58
|
fileName?: string;
|
|
52
59
|
|
|
@@ -69,6 +76,9 @@ export interface ExcelExportSettings {
|
|
|
69
76
|
proxyURL?: string | null;
|
|
70
77
|
}
|
|
71
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The SheetColumn object.
|
|
81
|
+
*/
|
|
72
82
|
export interface SheetColumn {
|
|
73
83
|
/**
|
|
74
84
|
* The zero-based index of the column. Required to ensure correct positioning.
|
|
@@ -81,6 +91,9 @@ export interface SheetColumn {
|
|
|
81
91
|
width?: number;
|
|
82
92
|
}
|
|
83
93
|
|
|
94
|
+
/**
|
|
95
|
+
* The CellBorder object.
|
|
96
|
+
*/
|
|
84
97
|
export interface CellBorder {
|
|
85
98
|
/**
|
|
86
99
|
* The border color of the cell. Many standard CSS formats are supported. However, the canonical form is #ccff00.
|
|
@@ -92,6 +105,9 @@ export interface CellBorder {
|
|
|
92
105
|
size?: number;
|
|
93
106
|
}
|
|
94
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Represents the interface of a Spreadsheet cell.
|
|
110
|
+
*/
|
|
95
111
|
export interface Cell extends CellDefaultStyle {
|
|
96
112
|
/**
|
|
97
113
|
* The style information for the bottom border of the cell.
|
|
@@ -166,7 +182,13 @@ export interface Cell extends CellDefaultStyle {
|
|
|
166
182
|
verticalAlign?: string;
|
|
167
183
|
}
|
|
168
184
|
|
|
185
|
+
/**
|
|
186
|
+
* The SheetRow object.
|
|
187
|
+
*/
|
|
169
188
|
export interface SheetRow {
|
|
189
|
+
/**
|
|
190
|
+
* The cells in the row.
|
|
191
|
+
*/
|
|
170
192
|
cells?: Cell[];
|
|
171
193
|
|
|
172
194
|
/**
|
|
@@ -185,6 +207,9 @@ export interface SheetRow {
|
|
|
185
207
|
type?: string;
|
|
186
208
|
}
|
|
187
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Represents the interface of a Spreadsheet document sheet and its content.
|
|
212
|
+
*/
|
|
188
213
|
export interface SheetDescriptor {
|
|
189
214
|
/**
|
|
190
215
|
* The active cell in the sheet, for example, `A1`.
|
|
@@ -233,13 +258,30 @@ export interface SheetDescriptor {
|
|
|
233
258
|
*/
|
|
234
259
|
showGridLines?: boolean;
|
|
235
260
|
|
|
236
|
-
|
|
261
|
+
/**
|
|
262
|
+
* @hidden
|
|
263
|
+
*/
|
|
264
|
+
gridLinesColor?: string | null;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* An array which contains the hyperlinks of the cells.
|
|
268
|
+
*/
|
|
269
|
+
hyperlinks?: { ref: string; target: string }[];
|
|
237
270
|
|
|
271
|
+
/**
|
|
272
|
+
* The default cell styles that will be applied to the sheet cells.
|
|
273
|
+
*/
|
|
238
274
|
defaultCellStyle?: CellDefaultStyle;
|
|
239
275
|
|
|
240
|
-
|
|
276
|
+
/**
|
|
277
|
+
* An array which contains the drawings used in this sheet.
|
|
278
|
+
*/
|
|
279
|
+
drawings?: { topLeftCell: any; offsetX: number; offsetY: number; width: number; height: number; image: string; opacity: any }[];
|
|
241
280
|
}
|
|
242
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Represents the configuration of a Spreadsheet document.
|
|
284
|
+
*/
|
|
243
285
|
export interface DocumentDescriptor {
|
|
244
286
|
/**
|
|
245
287
|
* The name of the currently active sheet. Must exactly match one of the sheet names.
|
|
@@ -250,7 +292,22 @@ export interface DocumentDescriptor {
|
|
|
250
292
|
* An array which defines the document sheets and their content.
|
|
251
293
|
*/
|
|
252
294
|
sheets?: SheetDescriptor[];
|
|
253
|
-
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* An array which holds the names of the sheets.
|
|
298
|
+
*/
|
|
299
|
+
names?: { value: string; name: string; sheet: string; localName: string }[];
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* An object containing any images used in the Spreadsheet. The keys should be image ID-s
|
|
303
|
+
* (they are referenced by this ID in `sheets.drawings`) and the values should be image URLs.
|
|
304
|
+
* The image URLs can be either [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs), in which case the images are fully contained by the JSON,
|
|
305
|
+
* or can be external URLs.
|
|
306
|
+
* Note that when external URLs are used, they should reside on the same domain, or the server must
|
|
307
|
+
* be configured with the proper [CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS),
|
|
308
|
+
* for the Spreadsheet to be able to fetch binary image data using a XMLHttpRequest. If it cannot fetch
|
|
309
|
+
* the image, export to Excel or PDF might not work.
|
|
310
|
+
*/
|
|
254
311
|
images?: { [name: string]: string };
|
|
255
312
|
|
|
256
313
|
/**
|
|
@@ -301,84 +358,360 @@ export interface DocumentDescriptor {
|
|
|
301
358
|
rows?: number;
|
|
302
359
|
}
|
|
303
360
|
|
|
361
|
+
/**
|
|
362
|
+
* The View object.
|
|
363
|
+
*/
|
|
304
364
|
export class View {
|
|
305
365
|
constructor(element: HTMLElement, options: any);
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* A function which enables and disables the clipboard.
|
|
369
|
+
*/
|
|
306
370
|
enableClipboard(enable: boolean): void;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Returns the workbook object of the View.
|
|
374
|
+
*/
|
|
307
375
|
workbook(workbook?: Workbook): void | Workbook;
|
|
376
|
+
/**
|
|
377
|
+
* @hidden
|
|
378
|
+
*/
|
|
308
379
|
sheet(sheet: Sheet): void;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Re-renders all data in the View.
|
|
383
|
+
*/
|
|
309
384
|
refresh(reason: any): void;
|
|
385
|
+
/**
|
|
386
|
+
* @hidden
|
|
387
|
+
*/
|
|
310
388
|
nameEditor: any;
|
|
389
|
+
/**
|
|
390
|
+
* @hidden
|
|
391
|
+
*/
|
|
311
392
|
bind(eventName: string, handler: any, one?: boolean): void;
|
|
312
393
|
}
|
|
313
394
|
|
|
395
|
+
/**
|
|
396
|
+
* The props of the Workbook component.
|
|
397
|
+
*/
|
|
314
398
|
export class Workbook {
|
|
315
399
|
constructor(options: any, view: View);
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Executes a command with the passed options.
|
|
403
|
+
*
|
|
404
|
+
* @param options The object from where data will be loaded. This has to be the deserialized object, not the JSON string.
|
|
405
|
+
*/
|
|
316
406
|
execute(options: any): any;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Re-renders all data in the Workbook.
|
|
410
|
+
*/
|
|
317
411
|
refresh(reason: any): void;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* A collection holding the commands available for undo and redo.
|
|
415
|
+
*/
|
|
318
416
|
undoRedoStack: any;
|
|
319
417
|
}
|
|
320
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Represents one or more rectangular regions of cells in a given Sheet.
|
|
421
|
+
*/
|
|
321
422
|
export class Range {
|
|
423
|
+
/**
|
|
424
|
+
* Gets or sets the background color of the cells in the range.
|
|
425
|
+
*
|
|
426
|
+
* @param value Any valid [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
427
|
+
* @returns the current background color of the top-left cell of the range.
|
|
428
|
+
*/
|
|
322
429
|
background(value?: string): string;
|
|
430
|
+
/**
|
|
431
|
+
* Gets or sets the bold state of the cells in the range.
|
|
432
|
+
*
|
|
433
|
+
* @param value True to make the text bold; false otherwise.
|
|
434
|
+
* @returns the current bold state of the top-left cell of the range.
|
|
435
|
+
*/
|
|
323
436
|
bold(value?: boolean): boolean;
|
|
437
|
+
/**
|
|
438
|
+
* Gets or sets the state of the bottom border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
439
|
+
*
|
|
440
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
441
|
+
* @returns the current value of the top-left cell of the range.
|
|
442
|
+
*/
|
|
324
443
|
borderBottom(value?: CellBorder): CellBorder;
|
|
444
|
+
/**
|
|
445
|
+
* Gets or sets the state of the left border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
446
|
+
*
|
|
447
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
448
|
+
* @returns the current value of the top-left cell of the range.
|
|
449
|
+
*/
|
|
325
450
|
borderLeft(value?: CellBorder): CellBorder;
|
|
451
|
+
/**
|
|
452
|
+
* Gets or sets the state of the right border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
453
|
+
*
|
|
454
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
455
|
+
* @returns the current value of the top-left cell of the range.
|
|
456
|
+
*/
|
|
326
457
|
borderRight(value?: CellBorder): CellBorder;
|
|
458
|
+
/**
|
|
459
|
+
* Gets or sets the state of the top border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
460
|
+
*
|
|
461
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
462
|
+
* @returns the current value of the top-left cell of the range.
|
|
463
|
+
*/
|
|
327
464
|
borderTop(value?: CellBorder): CellBorder;
|
|
465
|
+
/**
|
|
466
|
+
* Gets or sets the text color of the cells in the range.
|
|
467
|
+
*
|
|
468
|
+
* @param value - Any valid [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
469
|
+
* @returns the current text color of the top-left cell of the range.
|
|
470
|
+
*/
|
|
328
471
|
color(value?: string): string;
|
|
472
|
+
/**
|
|
473
|
+
* Clears the contents of the range cells.
|
|
474
|
+
*
|
|
475
|
+
* @param value An object which may contain `contentsOnly: true` or `formatOnly: true` key values. Clearing the format will remove the cell formatting and visual styles.
|
|
476
|
+
* If a parameter is not passed, the method will clear both the cells values and the formatting.
|
|
477
|
+
*/
|
|
329
478
|
clear(value?: { contentsOnly?: boolean; formatOnly: boolean }): void;
|
|
479
|
+
/**
|
|
480
|
+
* Gets or sets the disabled state of the cells in the range.
|
|
481
|
+
*
|
|
482
|
+
* @param value True to make the cell enabled; false to disable it.
|
|
483
|
+
* @returns the current disabled state of the top-left cell of the range.
|
|
484
|
+
*/
|
|
330
485
|
enable(value?: boolean): boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Gets or sets the font family of the cells in the range.
|
|
488
|
+
*
|
|
489
|
+
* @param value The font family that should be set.
|
|
490
|
+
* @returns the font family of the top-left cell of the range.
|
|
491
|
+
*/
|
|
331
492
|
fontFamily(value?: string): string;
|
|
493
|
+
/**
|
|
494
|
+
* Gets or sets the font size of the cells in the range.
|
|
495
|
+
*
|
|
496
|
+
* @param value The font size (in pixels) that should be set.
|
|
497
|
+
* @returns the font size of the top-left cell of the range.
|
|
498
|
+
*/
|
|
332
499
|
fontSize(value?: number): number;
|
|
500
|
+
/**
|
|
501
|
+
* Executes a function for each cell in the range.
|
|
502
|
+
*
|
|
503
|
+
* @param value The function that will be executed against every cell. The function receives the following parameters:
|
|
504
|
+
* `rowIndex` - the row index of the cell,
|
|
505
|
+
* `columnIndex` - the column index of the cell,
|
|
506
|
+
* `cellProperties` - the cell properties
|
|
507
|
+
*/
|
|
333
508
|
forEachCell(value: (rowIndex: number, columnIndex: number, cellProperties: Cell) => void): void;
|
|
509
|
+
/**
|
|
510
|
+
* Gets or sets the format of the cells.
|
|
511
|
+
*
|
|
512
|
+
* @param value The new format for the cells.
|
|
513
|
+
* @returns the format of the top-left cell of the range. When used as a setter, format returns the Range object to allow chained calls.
|
|
514
|
+
*/
|
|
334
515
|
format(value?: string): string;
|
|
516
|
+
/**
|
|
517
|
+
* Gets or sets the formula of the cells.
|
|
518
|
+
*
|
|
519
|
+
* @param value The new formula of the cell. The string may optionally start with `=`.
|
|
520
|
+
* @returns the formula of the top-left cell of the range.
|
|
521
|
+
*/
|
|
335
522
|
formula(value?: string): string;
|
|
523
|
+
/**
|
|
524
|
+
* Gets or sets the value of the cells. This is similar to `value`, but it parses the argument as if it was entered through the text box:
|
|
525
|
+
* - if it starts with `=` (equal sign), a formula is set. This may throw an error if the formula is syntactically invalid. Example: `range("C1").input("=A1+B1")`.
|
|
526
|
+
* - if it looks like a number, a numeric value (not string) is set.
|
|
527
|
+
* - if it's `true` or `false` (case-insensitive) the respective boolean value is set.
|
|
528
|
+
* - if it's a `Date` object, or a string that can be parsed as a date, it is converted to the numerical representation of the date.
|
|
529
|
+
* - if it starts with `'` (single quote), a string containing the rest of the characters is set. Example: `range("A1").input("'TRUE")` — sets the text "TRUE", not the boolean.
|
|
530
|
+
*
|
|
531
|
+
* @param value The value to be set to the cells.
|
|
532
|
+
* @returns the current value of the top-left cell of the range.
|
|
533
|
+
*/
|
|
336
534
|
input(value?: string | number | Date): any;
|
|
535
|
+
/**
|
|
536
|
+
* Gets or sets the italic state of the cells in the range.
|
|
537
|
+
*
|
|
538
|
+
* @param value True will make the text of the cells italic; false otherwise.
|
|
539
|
+
* @returns the current italic state of the top-left cell of the range.
|
|
540
|
+
*/
|
|
337
541
|
italic(value?: boolean): boolean;
|
|
542
|
+
/**
|
|
543
|
+
* Gets or sets the hyperlink of the cells in the range.
|
|
544
|
+
*
|
|
545
|
+
* @param value Pass a string (the URL) to create a hyperlink. Pass `null` to remove the link. Omit argument to get the existing URL, if any.
|
|
546
|
+
* @returns the current hyperlink attribute of the top-left cell of the range.
|
|
547
|
+
*/
|
|
338
548
|
link(value?: string): any;
|
|
549
|
+
/**
|
|
550
|
+
* Sets the sheet selection to the range cells.
|
|
551
|
+
*/
|
|
339
552
|
select(): void;
|
|
553
|
+
/**
|
|
554
|
+
* Gets or sets the text alignment of the cells in the range.
|
|
555
|
+
*
|
|
556
|
+
* @param value One of the following values: "left", "center", "right" and "justify".
|
|
557
|
+
* @returns the current text alignment of the top-left cell of the range.
|
|
558
|
+
*/
|
|
340
559
|
textAlign(value?: string): string;
|
|
560
|
+
/**
|
|
561
|
+
* Gets or sets the value of the cells. If the cell has formula set, the value setting will clear it.
|
|
562
|
+
*
|
|
563
|
+
* @param value The value to be set to the cells.
|
|
564
|
+
* @returns the current value of the top-left cell of the range.
|
|
565
|
+
*/
|
|
341
566
|
value(value?: string | number | Date): any;
|
|
567
|
+
/**
|
|
568
|
+
* Gets or sets the vertical alignment of the cells in the range.
|
|
569
|
+
*
|
|
570
|
+
* @param value One of the following values: "top", "center" and "bottom".
|
|
571
|
+
* @returns the current text alignment of the top-left cell of the range.
|
|
572
|
+
*/
|
|
342
573
|
verticalAlign(value?: string): string;
|
|
574
|
+
/**
|
|
575
|
+
* Gets or sets the wrap of the range cells.
|
|
576
|
+
*
|
|
577
|
+
* @param value `true` if to enable wrapping, `false` otherwise.
|
|
578
|
+
* @returns the current wrap state of the top-left cell of the range.
|
|
579
|
+
*/
|
|
343
580
|
wrap(value?: boolean): boolean;
|
|
344
581
|
}
|
|
345
582
|
|
|
583
|
+
/**
|
|
584
|
+
* @hidden
|
|
585
|
+
*/
|
|
586
|
+
export interface SelectedHeaders {
|
|
587
|
+
all: boolean;
|
|
588
|
+
allCols: boolean;
|
|
589
|
+
allRows: boolean;
|
|
590
|
+
cols: {
|
|
591
|
+
[key: number]: 'full' | 'partial';
|
|
592
|
+
};
|
|
593
|
+
rows: {
|
|
594
|
+
[key: number]: 'full' | 'partial';
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* The Sheet object.
|
|
600
|
+
*/
|
|
346
601
|
export class Sheet {
|
|
347
|
-
|
|
602
|
+
/**
|
|
603
|
+
* Changes the size of the rows and columns of the current sheet.
|
|
604
|
+
*
|
|
605
|
+
* @param newRows The rows of the sheet after the resizing.
|
|
606
|
+
*
|
|
607
|
+
* @param newCols The columns of the sheet after the resizing.
|
|
608
|
+
*/
|
|
348
609
|
resize(newRows: number, newCols: number): void;
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Returns the name of the sheet.
|
|
613
|
+
*/
|
|
349
614
|
name(): string;
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Returns a Range object based on the passed cells.
|
|
618
|
+
*/
|
|
350
619
|
range(cell: string): Range;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Returns the active cell in the sheet, for example, A1.
|
|
623
|
+
*/
|
|
351
624
|
activeCell(): any;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* A Boolean value which indicates if the grid lines of the sheet will be displayed.
|
|
628
|
+
*
|
|
629
|
+
* @default true
|
|
630
|
+
*/
|
|
352
631
|
showGridLines(value?: any): any;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @hidden
|
|
635
|
+
*/
|
|
636
|
+
selectedHeaders(): SelectedHeaders;
|
|
353
637
|
}
|
|
354
638
|
|
|
639
|
+
/**
|
|
640
|
+
* @hidden
|
|
641
|
+
*/
|
|
355
642
|
export interface ExternalRef<T> {
|
|
356
643
|
get current(): T | null;
|
|
357
644
|
}
|
|
358
645
|
|
|
646
|
+
/**
|
|
647
|
+
* Represents the options that will be applied the Spreadsheet.
|
|
648
|
+
*/
|
|
359
649
|
export interface SpreadsheetOptions extends DocumentDescriptor {
|
|
360
|
-
|
|
361
|
-
|
|
650
|
+
/**
|
|
651
|
+
* The name of the sheet.
|
|
652
|
+
*/
|
|
653
|
+
name?: string;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* @hidden
|
|
657
|
+
*/
|
|
658
|
+
sheetsbar?: boolean;
|
|
659
|
+
|
|
362
660
|
/**
|
|
363
661
|
* Configures the Excel export settings of the Spreadsheet.
|
|
364
662
|
*/
|
|
365
663
|
excel?: ExcelExportSettings;
|
|
366
664
|
|
|
665
|
+
/**
|
|
666
|
+
* Sets the component messages.
|
|
667
|
+
*/
|
|
367
668
|
messages?: any;
|
|
368
669
|
|
|
670
|
+
/**
|
|
671
|
+
* Sets the component locale.
|
|
672
|
+
*/
|
|
369
673
|
locale?: string;
|
|
370
674
|
|
|
675
|
+
/**
|
|
676
|
+
* @hidden
|
|
677
|
+
*/
|
|
371
678
|
formulaBarInputRef?: ExternalRef<any>;
|
|
679
|
+
/**
|
|
680
|
+
* @hidden
|
|
681
|
+
*/
|
|
372
682
|
formulaCellInputRef?: ExternalRef<any>;
|
|
683
|
+
/**
|
|
684
|
+
* @hidden
|
|
685
|
+
*/
|
|
373
686
|
nameBoxRef?: ExternalRef<any>;
|
|
374
687
|
}
|
|
375
688
|
|
|
376
|
-
|
|
689
|
+
/**
|
|
690
|
+
* Represents the SpreadsheetWidget, holding the core functionality of the Spreadsheet.
|
|
691
|
+
*/
|
|
692
|
+
export class SpreadsheetWidget {
|
|
377
693
|
constructor(element: HTMLElement, options: SpreadsheetOptions);
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Returns the `View` object of the Spreadsheet.
|
|
697
|
+
*/
|
|
378
698
|
get view(): View;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Returns the `Workbook` object of the Spreadsheet.
|
|
702
|
+
*/
|
|
379
703
|
get workbook(): Workbook;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* @hidden
|
|
707
|
+
*/
|
|
380
708
|
get options(): SpreadsheetOptions;
|
|
381
709
|
|
|
710
|
+
/**
|
|
711
|
+
* Executes the passed command against the selected cell/range.
|
|
712
|
+
*
|
|
713
|
+
* @param options An object containing the command name and the required by it options.
|
|
714
|
+
*/
|
|
382
715
|
executeCommand(options: any): void;
|
|
383
716
|
|
|
384
717
|
/**
|
|
@@ -411,7 +744,7 @@ export class Spreadsheet {
|
|
|
411
744
|
/**
|
|
412
745
|
* Initiates the Excel export. Also fires the excelExport event.
|
|
413
746
|
*
|
|
414
|
-
*
|
|
747
|
+
* Note: Calling this method may trigger the built-in popup blocker of the browser.
|
|
415
748
|
* To avoid that, always call it as a response to an end-user action, for example, a button click.
|
|
416
749
|
*/
|
|
417
750
|
saveAsExcel(options: any): void;
|
|
@@ -431,7 +764,246 @@ export class Spreadsheet {
|
|
|
431
764
|
*/
|
|
432
765
|
refresh(): void;
|
|
433
766
|
|
|
767
|
+
/**
|
|
768
|
+
* @hidden
|
|
769
|
+
*/
|
|
434
770
|
bind(eventName: string, handler: any, one?: boolean): void;
|
|
435
771
|
|
|
772
|
+
/**
|
|
773
|
+
* @hidden
|
|
774
|
+
*/
|
|
436
775
|
destroy(): void;
|
|
437
776
|
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* The context object of the custom JavaScript functions (primitives) in formulas.
|
|
780
|
+
*/
|
|
781
|
+
export class Context {
|
|
782
|
+
/**
|
|
783
|
+
* Verifies that all references in the given array are resolved before invoking your callback—that is, executes any formula.
|
|
784
|
+
* If this array turns out to include the cell where the current formula lives, it returns a `#CIRCULAR!` error. Elements that are not references are ignored.
|
|
785
|
+
*/
|
|
786
|
+
resolveCells(array: Ref[] | Ref[][], callback: () => any): any;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Returns as a flat array the values in any reference that exist in the given array. Elements that are not references are copied over.
|
|
790
|
+
*/
|
|
791
|
+
cellValues(array: (Ref | Matrix)[] | Ref | Matrix): any;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Converts the given argument to a matrix, if possible.
|
|
795
|
+
* It accepts a `RangeRef` object or a plain JavaScript non-empty array.
|
|
796
|
+
* Additionally, if a `Matrix` object is provided, it is returned as is.
|
|
797
|
+
*/
|
|
798
|
+
asMatrix(arg: RangeRef | RangeRef[] | Matrix): Matrix;
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Returns the `Workbook` object where the current formula is evaluated.
|
|
802
|
+
*/
|
|
803
|
+
workbook(): Workbook;
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Returns the data that is the value in the given reference.
|
|
807
|
+
* If a `CellRef` is given, it returns a single value. For a `RangeRef` or `UnionRef`, it returns a flat array of values.
|
|
808
|
+
*/
|
|
809
|
+
getRefData(ref: CellRef | RangeRef | UnionRef): any;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* The "matrix" type which can be used in the custom JavaScript functions (primitives) in formulas.
|
|
814
|
+
*/
|
|
815
|
+
export class Matrix {
|
|
816
|
+
constructor(context: Context);
|
|
817
|
+
/**
|
|
818
|
+
* Indicate the width of the matrix.
|
|
819
|
+
*/
|
|
820
|
+
width: number;
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Indicate the height of the matrix.
|
|
824
|
+
*/
|
|
825
|
+
height: number;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Returns a new matrix with the same data.
|
|
829
|
+
*/
|
|
830
|
+
clone(): Matrix;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Returns the element at a given location.
|
|
834
|
+
*/
|
|
835
|
+
get(row: number, col: number): any;
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Sets the element at a given location.
|
|
839
|
+
*/
|
|
840
|
+
set(row: number, col: number, value: any): void;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Iterates through elements of the matrix and calling the `func` for each element (first columns, then rows).
|
|
844
|
+
*
|
|
845
|
+
* @param func The function which will be called for each element.
|
|
846
|
+
* @param includeEmpty If `true`, it will call the function for empty (`null`) elements as well. Otherwise, it only calls it where a value exists.
|
|
847
|
+
*/
|
|
848
|
+
each(func: (value: any, row: number, column: number) => void, includeEmpty: boolean): void;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Similar to `each`, but produces a new matrix of the same shape as the original one with the values returned by the function.
|
|
852
|
+
*
|
|
853
|
+
* @param func The function which will be called for each element.
|
|
854
|
+
* @param includeEmpty If `true`, it will call the function for empty (`null`) elements as well. Otherwise, it only calls it where a value exists.
|
|
855
|
+
*/
|
|
856
|
+
map(func: (value: any, row: number, column: number) => void, includeEmpty: boolean): Matrix;
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Returns the transposed matrix. The rows of the original matrix become columns of the transposed one.
|
|
860
|
+
*/
|
|
861
|
+
transpose(): Matrix;
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Returns the unit square matrix of size `n`.
|
|
865
|
+
*/
|
|
866
|
+
unit(n: number): Matrix;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Multiplies the current matrix by the given matrix, and returns a new matrix as the result.
|
|
870
|
+
*/
|
|
871
|
+
multiply(m: Matrix): Matrix;
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Returns the determinant of this matrix. The matrix should contain only numbers and be square. Note that there are no checks for this.
|
|
875
|
+
*/
|
|
876
|
+
determinant(): number;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Returns the inverse of this matrix. The matrix should contain only numbers and be square.
|
|
880
|
+
* Note that there are no checks for this. If the inverse does not exist, the determinant is zero, then it returns `null`.
|
|
881
|
+
*/
|
|
882
|
+
inverse(): Matrix | null;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* A class from which formula calculation errors will be instantiated.
|
|
887
|
+
*/
|
|
888
|
+
export class CalcError {
|
|
889
|
+
/**
|
|
890
|
+
* The error code.
|
|
891
|
+
*/
|
|
892
|
+
code: string;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* A base class only. All references inherit from it, but no direct instance of this object should ever be created.
|
|
897
|
+
* The class is exported just to make it easier to check whether something is a reference: `x instanceof Ref`.
|
|
898
|
+
*/
|
|
899
|
+
export class Ref {
|
|
900
|
+
/**
|
|
901
|
+
* The name of the sheet that this cell points to.
|
|
902
|
+
*/
|
|
903
|
+
sheet: string;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Represents a cell reference. Note that the references do not contain data.
|
|
908
|
+
* Instead they just point to where the data is.
|
|
909
|
+
*/
|
|
910
|
+
export class CellRef extends Ref {
|
|
911
|
+
/**
|
|
912
|
+
* The row number, zero-based.
|
|
913
|
+
*/
|
|
914
|
+
row: number;
|
|
915
|
+
/**
|
|
916
|
+
* The column number, zero-based.
|
|
917
|
+
*/
|
|
918
|
+
col: number;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Represents a name cell reference.
|
|
923
|
+
*/
|
|
924
|
+
export class NameRef extends Ref { }
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* A range reference.
|
|
928
|
+
*/
|
|
929
|
+
export class RangeRef extends Ref {
|
|
930
|
+
/**
|
|
931
|
+
* The top-left CellRef of the range.
|
|
932
|
+
*/
|
|
933
|
+
topLeft: CellRef;
|
|
934
|
+
/**
|
|
935
|
+
* The bottom-right CellRef of the range.
|
|
936
|
+
*/
|
|
937
|
+
bottomRight: CellRef;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* A union. It contains a refs property, which is an array of references (it can be empty).
|
|
942
|
+
* A UnionRef can be created by the union operator, which is the comma.
|
|
943
|
+
*/
|
|
944
|
+
export class UnionRef extends Ref {
|
|
945
|
+
refs: (CellRef | RangeRef)[];
|
|
946
|
+
}
|
|
947
|
+
export class NULLREFClass {}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* An object (a singleton) and not a class.
|
|
951
|
+
* It represents the NULL reference, and could occur, for example, when you intersect two disjoint ranges, or when a formula depends on a cell that has been deleted.
|
|
952
|
+
* For example, when you put in some cell `=test(B5)` and then right-click on column `B` and delete it.
|
|
953
|
+
* To test when something is the `NULL` reference, just do `x === NULLREF`.
|
|
954
|
+
*/
|
|
955
|
+
export const NULLREF: NULLREFClass;
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Converts date parameters to number.
|
|
959
|
+
*/
|
|
960
|
+
export function packDate(year: number, month: number, date: number): number;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Converts number to date parameters.
|
|
964
|
+
*/
|
|
965
|
+
export function unpackDate(serial: number): {
|
|
966
|
+
year: number;
|
|
967
|
+
month: number;
|
|
968
|
+
date: number;
|
|
969
|
+
day: number;
|
|
970
|
+
ord: number
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Converts time parameters to number.
|
|
975
|
+
*/
|
|
976
|
+
export function packTime(hh: number, mm: number, ss: number, ms: number): number;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Converts number to time parameters.
|
|
980
|
+
*/
|
|
981
|
+
export function unpackTime(serial: number): {
|
|
982
|
+
hours: number;
|
|
983
|
+
minutes: number;
|
|
984
|
+
seconds: number;
|
|
985
|
+
milliseconds: number
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Converts number to date.
|
|
990
|
+
*/
|
|
991
|
+
export function serialToDate(serial: number): Date;
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* Converts date to number.
|
|
995
|
+
*/
|
|
996
|
+
export function dateToSerial(date: Date): number;
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Defines custom formula.
|
|
1000
|
+
*/
|
|
1001
|
+
export function defineFunction(name: string, func: Function): {
|
|
1002
|
+
args(args: any, log: any): any;
|
|
1003
|
+
argsAsync(args: any, log: any): any;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Defines alias of a formula.
|
|
1008
|
+
*/
|
|
1009
|
+
export function defineAlias(alias: string, name: string): void;
|