@progress/kendo-spreadsheet-common 1.0.0-develop.9 → 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 +70 -102
- package/dist/index.js +86 -101
- package/package.json +1 -1
- package/src/index.d.ts +291 -16
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,
|
|
@@ -28225,4 +28193,4 @@ class SpreadsheetWidget extends Widget {
|
|
|
28225
28193
|
}
|
|
28226
28194
|
}
|
|
28227
28195
|
|
|
28228
|
-
export { Range$1 as Range, Sheet, SpreadsheetWidget, View, Workbook };
|
|
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,
|
|
@@ -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
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
|
@@ -106,7 +106,7 @@ export interface CellBorder {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* Represents the
|
|
109
|
+
* Represents the interface of a Spreadsheet cell.
|
|
110
110
|
*/
|
|
111
111
|
export interface Cell extends CellDefaultStyle {
|
|
112
112
|
/**
|
|
@@ -208,7 +208,7 @@ export interface SheetRow {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
|
-
* Represents the
|
|
211
|
+
* Represents the interface of a Spreadsheet document sheet and its content.
|
|
212
212
|
*/
|
|
213
213
|
export interface SheetDescriptor {
|
|
214
214
|
/**
|
|
@@ -258,10 +258,15 @@ export interface SheetDescriptor {
|
|
|
258
258
|
*/
|
|
259
259
|
showGridLines?: boolean;
|
|
260
260
|
|
|
261
|
+
/**
|
|
262
|
+
* @hidden
|
|
263
|
+
*/
|
|
264
|
+
gridLinesColor?: string | null;
|
|
265
|
+
|
|
261
266
|
/**
|
|
262
267
|
* An array which contains the hyperlinks of the cells.
|
|
263
268
|
*/
|
|
264
|
-
hyperlinks?: { ref: string; target: string
|
|
269
|
+
hyperlinks?: { ref: string; target: string }[];
|
|
265
270
|
|
|
266
271
|
/**
|
|
267
272
|
* The default cell styles that will be applied to the sheet cells.
|
|
@@ -271,7 +276,7 @@ export interface SheetDescriptor {
|
|
|
271
276
|
/**
|
|
272
277
|
* An array which contains the drawings used in this sheet.
|
|
273
278
|
*/
|
|
274
|
-
drawings?: { topLeftCell: any; offsetX: number; offsetY: number; width: number; height: number; image: string; opacity: any
|
|
279
|
+
drawings?: { topLeftCell: any; offsetX: number; offsetY: number; width: number; height: number; image: string; opacity: any }[];
|
|
275
280
|
}
|
|
276
281
|
|
|
277
282
|
/**
|
|
@@ -291,7 +296,7 @@ export interface DocumentDescriptor {
|
|
|
291
296
|
/**
|
|
292
297
|
* An array which holds the names of the sheets.
|
|
293
298
|
*/
|
|
294
|
-
names?: { value: string; name: string; sheet: string; localName: string
|
|
299
|
+
names?: { value: string; name: string; sheet: string; localName: string }[];
|
|
295
300
|
|
|
296
301
|
/**
|
|
297
302
|
* An object containing any images used in the Spreadsheet. The keys should be image ID-s
|
|
@@ -360,9 +365,7 @@ export class View {
|
|
|
360
365
|
constructor(element: HTMLElement, options: any);
|
|
361
366
|
|
|
362
367
|
/**
|
|
363
|
-
* A
|
|
364
|
-
*
|
|
365
|
-
* @default true
|
|
368
|
+
* A function which enables and disables the clipboard.
|
|
366
369
|
*/
|
|
367
370
|
enableClipboard(enable: boolean): void;
|
|
368
371
|
|
|
@@ -419,72 +422,84 @@ export class Workbook {
|
|
|
419
422
|
export class Range {
|
|
420
423
|
/**
|
|
421
424
|
* Gets or sets the background color of the cells in the range.
|
|
425
|
+
*
|
|
422
426
|
* @param value Any valid [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
423
427
|
* @returns the current background color of the top-left cell of the range.
|
|
424
428
|
*/
|
|
425
|
-
background(value?:
|
|
429
|
+
background(value?: string): string;
|
|
426
430
|
/**
|
|
427
431
|
* Gets or sets the bold state of the cells in the range.
|
|
432
|
+
*
|
|
428
433
|
* @param value True to make the text bold; false otherwise.
|
|
429
434
|
* @returns the current bold state of the top-left cell of the range.
|
|
430
435
|
*/
|
|
431
436
|
bold(value?: boolean): boolean;
|
|
432
437
|
/**
|
|
433
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
|
+
*
|
|
434
440
|
* @param value The border configuration object. It may contain size and color keys.
|
|
435
441
|
* @returns the current value of the top-left cell of the range.
|
|
436
442
|
*/
|
|
437
443
|
borderBottom(value?: CellBorder): CellBorder;
|
|
438
444
|
/**
|
|
439
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
|
+
*
|
|
440
447
|
* @param value The border configuration object. It may contain size and color keys.
|
|
441
448
|
* @returns the current value of the top-left cell of the range.
|
|
442
449
|
*/
|
|
443
450
|
borderLeft(value?: CellBorder): CellBorder;
|
|
444
451
|
/**
|
|
445
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
|
+
*
|
|
446
454
|
* @param value The border configuration object. It may contain size and color keys.
|
|
447
455
|
* @returns the current value of the top-left cell of the range.
|
|
448
456
|
*/
|
|
449
457
|
borderRight(value?: CellBorder): CellBorder;
|
|
450
458
|
/**
|
|
451
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
|
+
*
|
|
452
461
|
* @param value The border configuration object. It may contain size and color keys.
|
|
453
462
|
* @returns the current value of the top-left cell of the range.
|
|
454
463
|
*/
|
|
455
464
|
borderTop(value?: CellBorder): CellBorder;
|
|
456
465
|
/**
|
|
457
466
|
* Gets or sets the text color of the cells in the range.
|
|
467
|
+
*
|
|
458
468
|
* @param value - Any valid [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
459
469
|
* @returns the current text color of the top-left cell of the range.
|
|
460
470
|
*/
|
|
461
471
|
color(value?: string): string;
|
|
462
472
|
/**
|
|
463
473
|
* Clears the contents of the range cells.
|
|
474
|
+
*
|
|
464
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.
|
|
465
476
|
* If a parameter is not passed, the method will clear both the cells values and the formatting.
|
|
466
477
|
*/
|
|
467
478
|
clear(value?: { contentsOnly?: boolean; formatOnly: boolean }): void;
|
|
468
479
|
/**
|
|
469
480
|
* Gets or sets the disabled state of the cells in the range.
|
|
481
|
+
*
|
|
470
482
|
* @param value True to make the cell enabled; false to disable it.
|
|
471
483
|
* @returns the current disabled state of the top-left cell of the range.
|
|
472
484
|
*/
|
|
473
485
|
enable(value?: boolean): boolean;
|
|
474
486
|
/**
|
|
475
487
|
* Gets or sets the font family of the cells in the range.
|
|
488
|
+
*
|
|
476
489
|
* @param value The font family that should be set.
|
|
477
490
|
* @returns the font family of the top-left cell of the range.
|
|
478
491
|
*/
|
|
479
492
|
fontFamily(value?: string): string;
|
|
480
493
|
/**
|
|
481
494
|
* Gets or sets the font size of the cells in the range.
|
|
495
|
+
*
|
|
482
496
|
* @param value The font size (in pixels) that should be set.
|
|
483
497
|
* @returns the font size of the top-left cell of the range.
|
|
484
498
|
*/
|
|
485
499
|
fontSize(value?: number): number;
|
|
486
500
|
/**
|
|
487
501
|
* Executes a function for each cell in the range.
|
|
502
|
+
*
|
|
488
503
|
* @param value The function that will be executed against every cell. The function receives the following parameters:
|
|
489
504
|
* `rowIndex` - the row index of the cell,
|
|
490
505
|
* `columnIndex` - the column index of the cell,
|
|
@@ -493,12 +508,14 @@ export class Range {
|
|
|
493
508
|
forEachCell(value: (rowIndex: number, columnIndex: number, cellProperties: Cell) => void): void;
|
|
494
509
|
/**
|
|
495
510
|
* Gets or sets the format of the cells.
|
|
511
|
+
*
|
|
496
512
|
* @param value The new format for the cells.
|
|
497
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.
|
|
498
514
|
*/
|
|
499
515
|
format(value?: string): string;
|
|
500
516
|
/**
|
|
501
517
|
* Gets or sets the formula of the cells.
|
|
518
|
+
*
|
|
502
519
|
* @param value The new formula of the cell. The string may optionally start with `=`.
|
|
503
520
|
* @returns the formula of the top-left cell of the range.
|
|
504
521
|
*/
|
|
@@ -510,18 +527,21 @@ export class Range {
|
|
|
510
527
|
* - if it's `true` or `false` (case-insensitive) the respective boolean value is set.
|
|
511
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.
|
|
512
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
|
+
*
|
|
513
531
|
* @param value The value to be set to the cells.
|
|
514
532
|
* @returns the current value of the top-left cell of the range.
|
|
515
533
|
*/
|
|
516
534
|
input(value?: string | number | Date): any;
|
|
517
535
|
/**
|
|
518
536
|
* Gets or sets the italic state of the cells in the range.
|
|
537
|
+
*
|
|
519
538
|
* @param value True will make the text of the cells italic; false otherwise.
|
|
520
539
|
* @returns the current italic state of the top-left cell of the range.
|
|
521
540
|
*/
|
|
522
541
|
italic(value?: boolean): boolean;
|
|
523
542
|
/**
|
|
524
543
|
* Gets or sets the hyperlink of the cells in the range.
|
|
544
|
+
*
|
|
525
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.
|
|
526
546
|
* @returns the current hyperlink attribute of the top-left cell of the range.
|
|
527
547
|
*/
|
|
@@ -532,36 +552,53 @@ export class Range {
|
|
|
532
552
|
select(): void;
|
|
533
553
|
/**
|
|
534
554
|
* Gets or sets the text alignment of the cells in the range.
|
|
555
|
+
*
|
|
535
556
|
* @param value One of the following values: "left", "center", "right" and "justify".
|
|
536
557
|
* @returns the current text alignment of the top-left cell of the range.
|
|
537
558
|
*/
|
|
538
559
|
textAlign(value?: string): string;
|
|
539
560
|
/**
|
|
540
561
|
* Gets or sets the value of the cells. If the cell has formula set, the value setting will clear it.
|
|
562
|
+
*
|
|
541
563
|
* @param value The value to be set to the cells.
|
|
542
564
|
* @returns the current value of the top-left cell of the range.
|
|
543
565
|
*/
|
|
544
566
|
value(value?: string | number | Date): any;
|
|
545
567
|
/**
|
|
546
568
|
* Gets or sets the vertical alignment of the cells in the range.
|
|
569
|
+
*
|
|
547
570
|
* @param value One of the following values: "top", "center" and "bottom".
|
|
548
571
|
* @returns the current text alignment of the top-left cell of the range.
|
|
549
572
|
*/
|
|
550
573
|
verticalAlign(value?: string): string;
|
|
551
574
|
/**
|
|
552
575
|
* Gets or sets the wrap of the range cells.
|
|
576
|
+
*
|
|
553
577
|
* @param value `true` if to enable wrapping, `false` otherwise.
|
|
554
578
|
* @returns the current wrap state of the top-left cell of the range.
|
|
555
579
|
*/
|
|
556
580
|
wrap(value?: boolean): boolean;
|
|
557
581
|
}
|
|
558
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
|
+
|
|
559
598
|
/**
|
|
560
599
|
* The Sheet object.
|
|
561
600
|
*/
|
|
562
601
|
export class Sheet {
|
|
563
|
-
constructor();
|
|
564
|
-
|
|
565
602
|
/**
|
|
566
603
|
* Changes the size of the rows and columns of the current sheet.
|
|
567
604
|
*
|
|
@@ -586,12 +623,17 @@ export class Sheet {
|
|
|
586
623
|
*/
|
|
587
624
|
activeCell(): any;
|
|
588
625
|
|
|
589
|
-
|
|
626
|
+
/**
|
|
590
627
|
* A Boolean value which indicates if the grid lines of the sheet will be displayed.
|
|
591
628
|
*
|
|
592
629
|
* @default true
|
|
593
630
|
*/
|
|
594
631
|
showGridLines(value?: any): any;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @hidden
|
|
635
|
+
*/
|
|
636
|
+
selectedHeaders(): SelectedHeaders;
|
|
595
637
|
}
|
|
596
638
|
|
|
597
639
|
/**
|
|
@@ -608,12 +650,12 @@ export interface SpreadsheetOptions extends DocumentDescriptor {
|
|
|
608
650
|
/**
|
|
609
651
|
* The name of the sheet.
|
|
610
652
|
*/
|
|
611
|
-
name?: string
|
|
653
|
+
name?: string;
|
|
612
654
|
|
|
613
655
|
/**
|
|
614
656
|
* @hidden
|
|
615
657
|
*/
|
|
616
|
-
sheetsbar?: boolean
|
|
658
|
+
sheetsbar?: boolean;
|
|
617
659
|
|
|
618
660
|
/**
|
|
619
661
|
* Configures the Excel export settings of the Spreadsheet.
|
|
@@ -625,7 +667,7 @@ export interface SpreadsheetOptions extends DocumentDescriptor {
|
|
|
625
667
|
*/
|
|
626
668
|
messages?: any;
|
|
627
669
|
|
|
628
|
-
|
|
670
|
+
/**
|
|
629
671
|
* Sets the component locale.
|
|
630
672
|
*/
|
|
631
673
|
locale?: string;
|
|
@@ -645,7 +687,7 @@ export interface SpreadsheetOptions extends DocumentDescriptor {
|
|
|
645
687
|
}
|
|
646
688
|
|
|
647
689
|
/**
|
|
648
|
-
* Represents the Spreadsheet
|
|
690
|
+
* Represents the SpreadsheetWidget, holding the core functionality of the Spreadsheet.
|
|
649
691
|
*/
|
|
650
692
|
export class SpreadsheetWidget {
|
|
651
693
|
constructor(element: HTMLElement, options: SpreadsheetOptions);
|
|
@@ -732,3 +774,236 @@ export class SpreadsheetWidget {
|
|
|
732
774
|
*/
|
|
733
775
|
destroy(): void;
|
|
734
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;
|