@progress/kendo-spreadsheet-common 1.1.3-develop.2 → 1.2.0-develop.1
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 +586 -426
- package/dist/index.js +674 -424
- package/package.json +6 -5
package/dist/index-esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { drawing, parseColor, geometry,
|
|
1
|
+
import { drawing, parseColor, geometry, drawText as drawText$1 } from '@progress/kendo-drawing';
|
|
2
2
|
import { dayOfWeek, getDate, addDays, firstDayOfMonth } from '@progress/kendo-date-math';
|
|
3
3
|
import { browser } from '@progress/kendo-common';
|
|
4
4
|
import JSZip from '@progress/jszip-esm';
|
|
@@ -1064,13 +1064,18 @@ const keys = {
|
|
|
1064
1064
|
PAGEDOWN: 34,
|
|
1065
1065
|
F2: 113,
|
|
1066
1066
|
F10: 121,
|
|
1067
|
+
F11: 122,
|
|
1067
1068
|
F12: 123,
|
|
1068
1069
|
NUMPAD_PLUS: 107,
|
|
1069
1070
|
NUMPAD_MINUS: 109,
|
|
1070
1071
|
NUMPAD_DOT: 110,
|
|
1071
1072
|
B: 66,
|
|
1072
1073
|
I: 73,
|
|
1073
|
-
U: 85
|
|
1074
|
+
U: 85,
|
|
1075
|
+
N: 78,
|
|
1076
|
+
H: 72,
|
|
1077
|
+
A: 65,
|
|
1078
|
+
R: 82
|
|
1074
1079
|
};
|
|
1075
1080
|
|
|
1076
1081
|
/* eslint-disable no-nested-ternary */
|
|
@@ -1165,66 +1170,36 @@ function withExit(f, obj) {
|
|
|
1165
1170
|
}
|
|
1166
1171
|
}
|
|
1167
1172
|
|
|
1168
|
-
const wrapExpression = function(members, paramName) {
|
|
1169
|
-
let result = paramName || "d",
|
|
1170
|
-
index,
|
|
1171
|
-
idx,
|
|
1172
|
-
length,
|
|
1173
|
-
member,
|
|
1174
|
-
count = 1;
|
|
1175
|
-
|
|
1176
|
-
for (idx = 0, length = members.length; idx < length; idx++) {
|
|
1177
|
-
member = members[idx];
|
|
1178
|
-
if (member !== "") {
|
|
1179
|
-
index = member.indexOf("[");
|
|
1180
|
-
|
|
1181
|
-
if (index !== 0) {
|
|
1182
|
-
if (index === -1) {
|
|
1183
|
-
member = "." + member;
|
|
1184
|
-
} else {
|
|
1185
|
-
count++;
|
|
1186
|
-
member = "." + member.substring(0, index) + " || {})" + member.substring(index);
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
count++;
|
|
1191
|
-
result += member + ((idx < length - 1) ? " || {})" : ")");
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
return new Array(count).join("(") + result;
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
1173
|
const getterCache = {};
|
|
1198
1174
|
|
|
1199
|
-
|
|
1200
|
-
expression = expression || "";
|
|
1201
|
-
|
|
1202
|
-
if (typeof safe == 'string') {
|
|
1203
|
-
paramName = safe;
|
|
1204
|
-
safe = false;
|
|
1205
|
-
}
|
|
1175
|
+
getterCache["undefined"] = (obj) => obj;
|
|
1206
1176
|
|
|
1207
|
-
|
|
1177
|
+
const FIELD_REGEX = /\[(?:(\d+)|['"](.*?)['"])\]|((?:(?!\[.*?\]|\.).)+)/g;
|
|
1178
|
+
function getter(field, safe) {
|
|
1179
|
+
const key = field + safe;
|
|
1208
1180
|
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1181
|
+
if (getterCache[key]) {
|
|
1182
|
+
return getterCache[key];
|
|
1211
1183
|
}
|
|
1212
1184
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
} else {
|
|
1219
|
-
expression = paramName + expression;
|
|
1220
|
-
}
|
|
1185
|
+
const fields = [];
|
|
1186
|
+
field.replace(FIELD_REGEX, (_, index, indexAccessor, field) => {
|
|
1187
|
+
fields.push(isPresent(index) ? index : indexAccessor || field);
|
|
1188
|
+
return undefined;
|
|
1189
|
+
});
|
|
1221
1190
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1191
|
+
getterCache[key] = (obj) => {
|
|
1192
|
+
let result = obj;
|
|
1193
|
+
for (let idx = 0; idx < fields.length; idx++) {
|
|
1194
|
+
result = result[fields[idx]];
|
|
1195
|
+
if (!isPresent(result) && safe) {
|
|
1196
|
+
return result;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
return result;
|
|
1201
|
+
};
|
|
1224
1202
|
|
|
1225
|
-
function getter(expression, safe) {
|
|
1226
|
-
let key = expression + safe;
|
|
1227
|
-
getterCache[key] = getterCache[key] || new Function("d", "return " + expr(expression, safe));
|
|
1228
1203
|
return getterCache[key];
|
|
1229
1204
|
}
|
|
1230
1205
|
|
|
@@ -1239,15 +1214,10 @@ function deepExtend(destination) {
|
|
|
1239
1214
|
return destination;
|
|
1240
1215
|
}
|
|
1241
1216
|
|
|
1242
|
-
function isFunction(fn) {
|
|
1243
|
-
return typeof fn === "function";
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
1217
|
function deepExtendOne(destination, source) {
|
|
1247
1218
|
let property,
|
|
1248
1219
|
propValue,
|
|
1249
1220
|
propType,
|
|
1250
|
-
propInit,
|
|
1251
1221
|
destProp;
|
|
1252
1222
|
|
|
1253
1223
|
for (property in source) {
|
|
@@ -1258,29 +1228,18 @@ function deepExtendOne(destination, source) {
|
|
|
1258
1228
|
propValue = source[property];
|
|
1259
1229
|
propType = typeof propValue;
|
|
1260
1230
|
|
|
1261
|
-
if (
|
|
1262
|
-
|
|
1263
|
-
} else {
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
if (propValue instanceof Date) {
|
|
1272
|
-
destination[property] = new Date(propValue.getTime());
|
|
1273
|
-
} else if (isFunction(propValue.clone)) {
|
|
1274
|
-
destination[property] = propValue.clone();
|
|
1275
|
-
} else {
|
|
1276
|
-
destProp = destination[property];
|
|
1277
|
-
if (typeof (destProp) === 'object') {
|
|
1278
|
-
destination[property] = destProp || {};
|
|
1279
|
-
} else {
|
|
1280
|
-
destination[property] = {};
|
|
1281
|
-
}
|
|
1282
|
-
deepExtendOne(destination[property], propValue);
|
|
1231
|
+
if (propValue instanceof Date) {
|
|
1232
|
+
destination[property] = new Date(propValue.getTime());
|
|
1233
|
+
} else if (isFunction(propValue?.clone)) {
|
|
1234
|
+
destination[property] = propValue.clone();
|
|
1235
|
+
} else if (propType === 'object' && propValue !== null && isPlainObject(propValue)) {
|
|
1236
|
+
// Check if the property is a plain object before attempting to merge deeply
|
|
1237
|
+
destProp = destination[property];
|
|
1238
|
+
if (typeof destProp !== 'object' || destProp === null) {
|
|
1239
|
+
destination[property] = {};
|
|
1283
1240
|
}
|
|
1241
|
+
|
|
1242
|
+
deepExtendOne(destination[property], propValue);
|
|
1284
1243
|
} else if (propType !== 'undefined') {
|
|
1285
1244
|
destination[property] = propValue;
|
|
1286
1245
|
}
|
|
@@ -1316,7 +1275,12 @@ const scrollbar = function(refresh) {
|
|
|
1316
1275
|
let div = document.createElement("div"),
|
|
1317
1276
|
result;
|
|
1318
1277
|
|
|
1319
|
-
div.style.
|
|
1278
|
+
div.style.overflow = "scroll";
|
|
1279
|
+
div.style.overflowX = "hidden";
|
|
1280
|
+
div.style.zoom = "1";
|
|
1281
|
+
div.style.clear = "both";
|
|
1282
|
+
div.style.display = "block";
|
|
1283
|
+
|
|
1320
1284
|
div.innerHTML = " ";
|
|
1321
1285
|
document.body.appendChild(div);
|
|
1322
1286
|
|
|
@@ -1391,6 +1355,21 @@ const _activeElement$1 = function() {
|
|
|
1391
1355
|
}
|
|
1392
1356
|
};
|
|
1393
1357
|
|
|
1358
|
+
const isPresent = (value) => value !== null && value !== undefined;
|
|
1359
|
+
const isBlank = (value) => !isPresent(value);
|
|
1360
|
+
const isDate = (value) => value && value.getTime;
|
|
1361
|
+
const isString = (value) => typeof value === "string";
|
|
1362
|
+
const isNumeric = (value) => !isNaN(value - parseFloat(value));
|
|
1363
|
+
const isFunction = (fn) => typeof fn === "function";
|
|
1364
|
+
const isPlainObject = function(obj) {
|
|
1365
|
+
if (!obj || toString.call(obj) !== "[object Object]") {
|
|
1366
|
+
return false;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
const proto = Object.getPrototypeOf(obj);
|
|
1370
|
+
return proto === null || proto.constructor === Object;
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1394
1373
|
class CalcError {
|
|
1395
1374
|
|
|
1396
1375
|
constructor(code) {
|
|
@@ -1428,6 +1407,9 @@ function createKendoObj(calc, CalcError, Ref, CellRef, RangeRef) {
|
|
|
1428
1407
|
}
|
|
1429
1408
|
|
|
1430
1409
|
/* eslint-disable max-params */
|
|
1410
|
+
/* eslint-disable complexity */
|
|
1411
|
+
/* eslint-disable no-unused-vars */
|
|
1412
|
+
|
|
1431
1413
|
|
|
1432
1414
|
let calc = {
|
|
1433
1415
|
runtime: {
|
|
@@ -2963,7 +2945,7 @@ function Element(nodeName, attr, children) {
|
|
|
2963
2945
|
}
|
|
2964
2946
|
Element.prototype = new Node();
|
|
2965
2947
|
Element.prototype.appendTo = function(parent) {
|
|
2966
|
-
let node = document.createElement(this.nodeName);
|
|
2948
|
+
let node = typeof(this.nodeName) === "string" ? document.createElement(this.nodeName) : this.nodeName;
|
|
2967
2949
|
let children = this.children;
|
|
2968
2950
|
for (let index = 0; index < children.length; index++) {
|
|
2969
2951
|
children[index].render(node, NULL_NODE);
|
|
@@ -3184,6 +3166,7 @@ const dom = {
|
|
|
3184
3166
|
|
|
3185
3167
|
//--------------------------------------------------- custom number format.
|
|
3186
3168
|
|
|
3169
|
+
|
|
3187
3170
|
let RX_COLORS = /^\[(black|green|white|blue|magenta|yellow|cyan|red)\]/i;
|
|
3188
3171
|
let RX_CONDITION = /^\[(<=|>=|<>|<|>|=)(-?[0-9.]+)\]/;
|
|
3189
3172
|
|
|
@@ -4149,6 +4132,28 @@ const formatting = {
|
|
|
4149
4132
|
};
|
|
4150
4133
|
|
|
4151
4134
|
/* eslint-disable no-nested-ternary */
|
|
4135
|
+
/* eslint-disable space-infix-ops */
|
|
4136
|
+
/* eslint-disable indent */
|
|
4137
|
+
/* eslint-disable no-empty */
|
|
4138
|
+
/* eslint-disable no-loop-func */
|
|
4139
|
+
/* eslint-disable consistent-return */
|
|
4140
|
+
/* eslint-disable block-scoped-var */
|
|
4141
|
+
/* eslint-disable no-redeclare */
|
|
4142
|
+
/* eslint-disable no-var */
|
|
4143
|
+
/* eslint-disable eqeqeq */
|
|
4144
|
+
/* eslint-disable complexity */
|
|
4145
|
+
/* eslint-disable max-params */
|
|
4146
|
+
/* eslint-disable no-implicit-coercion */
|
|
4147
|
+
/* eslint-disable key-spacing */
|
|
4148
|
+
/* eslint-disable default-case */
|
|
4149
|
+
/* eslint-disable camelcase */
|
|
4150
|
+
/* eslint-disable brace-style */
|
|
4151
|
+
/* eslint-disable no-else-return */
|
|
4152
|
+
/* eslint-disable no-constant-condition */
|
|
4153
|
+
/* eslint-disable no-param-reassign */
|
|
4154
|
+
/* eslint-disable space-before-blocks */
|
|
4155
|
+
/* eslint-disable no-unused-labels */
|
|
4156
|
+
|
|
4152
4157
|
|
|
4153
4158
|
const kendo = createKendoObj(calc, CalcError, Ref, CellRef, RangeRef);
|
|
4154
4159
|
calc.kendo = kendo; // XXX
|
|
@@ -5954,6 +5959,12 @@ class EventListener {
|
|
|
5954
5959
|
}
|
|
5955
5960
|
|
|
5956
5961
|
/* eslint-disable default-case */
|
|
5962
|
+
/* eslint-disable no-else-return */
|
|
5963
|
+
/* eslint-disable key-spacing */
|
|
5964
|
+
/* eslint-disable eqeqeq */
|
|
5965
|
+
/* eslint-disable brace-style */
|
|
5966
|
+
/* eslint-disable consistent-return */
|
|
5967
|
+
|
|
5957
5968
|
|
|
5958
5969
|
let alphaNumRegExp = /:alphanum$/;
|
|
5959
5970
|
|
|
@@ -6579,6 +6590,7 @@ class Controller {
|
|
|
6579
6590
|
this._workbook.trigger("contextmenu", {
|
|
6580
6591
|
objectRef: object.ref,
|
|
6581
6592
|
targetType: object.type,
|
|
6593
|
+
isComposite,
|
|
6582
6594
|
showUnhide,
|
|
6583
6595
|
showUnmerge,
|
|
6584
6596
|
originalEvent: event
|
|
@@ -7093,7 +7105,7 @@ class Controller {
|
|
|
7093
7105
|
this.clipboardElement.focus();
|
|
7094
7106
|
this.navigator.navigateInSelection(ENTRY_ACTIONS[action]);
|
|
7095
7107
|
}
|
|
7096
|
-
|
|
7108
|
+
|
|
7097
7109
|
if (action === 'tab') {
|
|
7098
7110
|
e.preventDefault();
|
|
7099
7111
|
}
|
|
@@ -7796,6 +7808,9 @@ class SparseRangeList extends RangeList {
|
|
|
7796
7808
|
}
|
|
7797
7809
|
|
|
7798
7810
|
/* eslint-disable default-case */
|
|
7811
|
+
/* eslint-disable camelcase */
|
|
7812
|
+
/* eslint-disable no-param-reassign */
|
|
7813
|
+
|
|
7799
7814
|
|
|
7800
7815
|
class Property {
|
|
7801
7816
|
constructor(list) {
|
|
@@ -8119,6 +8134,10 @@ const ALL_PROPERTIES = propertyBagSpec.reduce(function(a, spec) {
|
|
|
8119
8134
|
}, [ "borderTop", "borderRight", "borderBottom", "borderLeft" ]);
|
|
8120
8135
|
|
|
8121
8136
|
/* eslint-disable no-param-reassign */
|
|
8137
|
+
/* eslint-disable no-useless-call */
|
|
8138
|
+
/* eslint-disable camelcase */
|
|
8139
|
+
/* eslint-disable default-case */
|
|
8140
|
+
|
|
8122
8141
|
|
|
8123
8142
|
let TRANSPOSE_FORMAT = "_matrix({0})";
|
|
8124
8143
|
let DATE_FORMAT = 'DATEVALUE("{0}")';
|
|
@@ -8450,6 +8469,28 @@ validationExport.validationComparers = {
|
|
|
8450
8469
|
validationExport.Validation = Validation;
|
|
8451
8470
|
|
|
8452
8471
|
/* eslint-disable no-nested-ternary */
|
|
8472
|
+
/* eslint-disable curly */
|
|
8473
|
+
/* eslint-disable space-infix-ops */
|
|
8474
|
+
/* eslint-disable indent */
|
|
8475
|
+
/* eslint-disable no-empty */
|
|
8476
|
+
/* eslint-disable no-loop-func */
|
|
8477
|
+
/* eslint-disable consistent-return */
|
|
8478
|
+
/* eslint-disable block-scoped-var */
|
|
8479
|
+
/* eslint-disable no-redeclare */
|
|
8480
|
+
/* eslint-disable no-var */
|
|
8481
|
+
/* eslint-disable eqeqeq */
|
|
8482
|
+
/* eslint-disable complexity */
|
|
8483
|
+
/* eslint-disable max-params */
|
|
8484
|
+
/* eslint-disable no-implicit-coercion */
|
|
8485
|
+
/* eslint-disable key-spacing */
|
|
8486
|
+
/* eslint-disable default-case */
|
|
8487
|
+
/* eslint-disable camelcase */
|
|
8488
|
+
/* eslint-disable brace-style */
|
|
8489
|
+
/* eslint-disable no-else-return */
|
|
8490
|
+
/* eslint-disable no-constant-condition */
|
|
8491
|
+
/* eslint-disable no-param-reassign */
|
|
8492
|
+
/* eslint-disable space-before-blocks */
|
|
8493
|
+
|
|
8453
8494
|
const { measureText } = drawing.util;
|
|
8454
8495
|
|
|
8455
8496
|
let PROPERTIES = [
|
|
@@ -9406,13 +9447,18 @@ function looksLikeANumber(str) {
|
|
|
9406
9447
|
|
|
9407
9448
|
function getTextHeight(text, width, fontFamily, fontSize, wrap) {
|
|
9408
9449
|
const measureBox = document.createElement("div");
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
);
|
|
9450
|
+
|
|
9451
|
+
measureBox.style.setProperty('position', 'absolute', 'important');
|
|
9452
|
+
measureBox.style.setProperty('top', '-4000px', 'important');
|
|
9453
|
+
measureBox.style.setProperty('height', 'auto', 'important');
|
|
9454
|
+
measureBox.style.setProperty('padding', '1px 3px', 'important');
|
|
9455
|
+
measureBox.style.setProperty('box-sizing', 'border-box', 'important');
|
|
9456
|
+
measureBox.style.setProperty('margin', '0', 'important');
|
|
9457
|
+
measureBox.style.setProperty('border', '1px solid black', 'important');
|
|
9458
|
+
measureBox.style.setProperty('line-height', 'normal', 'important');
|
|
9459
|
+
measureBox.style.setProperty('visibility', 'hidden', 'important');
|
|
9460
|
+
measureBox.style.setProperty('white-space', 'pre-wrap');
|
|
9461
|
+
|
|
9416
9462
|
let styles = {
|
|
9417
9463
|
"baselineMarkerSize" : 0,
|
|
9418
9464
|
"width" : (wrap === true) ? width + "px" : "auto",
|
|
@@ -10504,6 +10550,7 @@ class PaneAxis {
|
|
|
10504
10550
|
}
|
|
10505
10551
|
|
|
10506
10552
|
/* eslint-disable no-param-reassign */
|
|
10553
|
+
/* eslint-disable camelcase */
|
|
10507
10554
|
|
|
10508
10555
|
class Rectangle {
|
|
10509
10556
|
constructor(left, top, width, height) {
|
|
@@ -10891,6 +10938,9 @@ Sorter.descendingComparer = function(a, b) {
|
|
|
10891
10938
|
};
|
|
10892
10939
|
|
|
10893
10940
|
/* eslint-disable no-constant-condition */
|
|
10941
|
+
/* eslint-disable key-spacing */
|
|
10942
|
+
/* eslint-disable no-param-reassign */
|
|
10943
|
+
|
|
10894
10944
|
|
|
10895
10945
|
class AxisManager {
|
|
10896
10946
|
constructor(sheet) {
|
|
@@ -11201,6 +11251,21 @@ class AutoFillCalculator {
|
|
|
11201
11251
|
}
|
|
11202
11252
|
|
|
11203
11253
|
/* eslint-disable max-params */
|
|
11254
|
+
/* eslint-disable no-empty */
|
|
11255
|
+
/* eslint-disable no-loop-func */
|
|
11256
|
+
/* eslint-disable consistent-return */
|
|
11257
|
+
/* eslint-disable block-scoped-var */
|
|
11258
|
+
/* eslint-disable no-redeclare */
|
|
11259
|
+
/* eslint-disable no-var */
|
|
11260
|
+
/* eslint-disable eqeqeq */
|
|
11261
|
+
/* eslint-disable complexity */
|
|
11262
|
+
/* eslint-disable no-implicit-coercion */
|
|
11263
|
+
/* eslint-disable brace-style */
|
|
11264
|
+
/* eslint-disable key-spacing */
|
|
11265
|
+
/* eslint-disable no-else-return */
|
|
11266
|
+
/* eslint-disable default-case */
|
|
11267
|
+
/* eslint-disable no-param-reassign */
|
|
11268
|
+
|
|
11204
11269
|
|
|
11205
11270
|
class EdgeNavigator {
|
|
11206
11271
|
constructor(field, axis, rangeGetter, union) {
|
|
@@ -11875,16 +11940,41 @@ function makeWordMovement(sheet, pivot, isCol) {
|
|
|
11875
11940
|
}
|
|
11876
11941
|
|
|
11877
11942
|
/* eslint-disable max-params */
|
|
11943
|
+
/* eslint-disable no-empty */
|
|
11944
|
+
/* eslint-disable no-loop-func */
|
|
11945
|
+
/* eslint-disable consistent-return */
|
|
11946
|
+
/* eslint-disable block-scoped-var */
|
|
11947
|
+
/* eslint-disable no-redeclare */
|
|
11948
|
+
/* eslint-disable no-var */
|
|
11949
|
+
/* eslint-disable eqeqeq */
|
|
11950
|
+
/* eslint-disable complexity */
|
|
11951
|
+
/* eslint-disable no-implicit-coercion */
|
|
11952
|
+
/* eslint-disable brace-style */
|
|
11953
|
+
/* eslint-disable key-spacing */
|
|
11954
|
+
/* eslint-disable no-else-return */
|
|
11955
|
+
/* eslint-disable default-case */
|
|
11956
|
+
/* eslint-disable no-param-reassign */
|
|
11957
|
+
|
|
11878
11958
|
|
|
11879
11959
|
function numberToDate(val) {
|
|
11880
11960
|
return val == null ? null : calc.runtime.serialToDate(val);
|
|
11881
11961
|
}
|
|
11882
11962
|
|
|
11883
|
-
|
|
11963
|
+
function dateToNumber(val) {
|
|
11964
|
+
return val == null ? null : calc.runtime.dateToSerial(val);
|
|
11965
|
+
}
|
|
11966
|
+
|
|
11967
|
+
var identity = function (o) { return o; };
|
|
11884
11968
|
|
|
11885
11969
|
class SheetDataSourceBinder {
|
|
11886
11970
|
constructor(options) {
|
|
11887
|
-
this.options = Object.assign({ columns: [] }, this.options,
|
|
11971
|
+
this.options = Object.assign({ columns: [] }, this.options,
|
|
11972
|
+
// skip undefined properties in options
|
|
11973
|
+
Object.keys(options).reduce((acc, key) => {
|
|
11974
|
+
if (options[key] !== undefined) acc[key] = options[key];
|
|
11975
|
+
return acc;
|
|
11976
|
+
}, {})
|
|
11977
|
+
);
|
|
11888
11978
|
|
|
11889
11979
|
this.columns = this._normalizeColumns(this.options.columns);
|
|
11890
11980
|
|
|
@@ -11928,9 +12018,9 @@ class SheetDataSourceBinder {
|
|
|
11928
12018
|
}
|
|
11929
12019
|
|
|
11930
12020
|
_header() {
|
|
11931
|
-
this.sheet.batch(function() {
|
|
11932
|
-
this.columns.forEach(function(column, index) {
|
|
11933
|
-
this.sheet.range(0,index).value(column.title);
|
|
12021
|
+
this.sheet.batch(function () {
|
|
12022
|
+
this.columns.forEach(function (column, index) {
|
|
12023
|
+
this.sheet.range(0, index).value(column.title);
|
|
11934
12024
|
}.bind(this));
|
|
11935
12025
|
}.bind(this));
|
|
11936
12026
|
}
|
|
@@ -11948,7 +12038,7 @@ class SheetDataSourceBinder {
|
|
|
11948
12038
|
var values = [];
|
|
11949
12039
|
var sheet = this.sheet;
|
|
11950
12040
|
var fields, getters, normalizedRef, i, rangeRef, normalizedRefs;
|
|
11951
|
-
var setValues = function(ref) {
|
|
12041
|
+
var setValues = function (ref) {
|
|
11952
12042
|
ref = ref.toRangeRef();
|
|
11953
12043
|
var record;
|
|
11954
12044
|
var valueIndex = 0;
|
|
@@ -11977,7 +12067,7 @@ class SheetDataSourceBinder {
|
|
|
11977
12067
|
columns = Object.keys(data[0].toJSON());
|
|
11978
12068
|
}
|
|
11979
12069
|
|
|
11980
|
-
getters = columns.map(function(column) {
|
|
12070
|
+
getters = columns.map(function (column) {
|
|
11981
12071
|
var field = column.field;
|
|
11982
12072
|
if (field && fields && fields[field] && fields[field].type === "date") {
|
|
11983
12073
|
return numberToDate;
|
|
@@ -11994,7 +12084,7 @@ class SheetDataSourceBinder {
|
|
|
11994
12084
|
|
|
11995
12085
|
normalizedRefs = normalizedRef.refs;
|
|
11996
12086
|
|
|
11997
|
-
normalizedRefs.forEach(function(ref) {
|
|
12087
|
+
normalizedRefs.forEach(function (ref) {
|
|
11998
12088
|
values.push(sheet.range(ref).values());
|
|
11999
12089
|
});
|
|
12000
12090
|
|
|
@@ -12010,7 +12100,7 @@ class SheetDataSourceBinder {
|
|
|
12010
12100
|
}
|
|
12011
12101
|
|
|
12012
12102
|
_normalizeColumns(columns) {
|
|
12013
|
-
return columns.map(function(column) {
|
|
12103
|
+
return columns.map(function (column) {
|
|
12014
12104
|
var field = column.field || column;
|
|
12015
12105
|
return {
|
|
12016
12106
|
field: field,
|
|
@@ -12022,23 +12112,23 @@ class SheetDataSourceBinder {
|
|
|
12022
12112
|
_dataSource() {
|
|
12023
12113
|
var options = this.options;
|
|
12024
12114
|
var dataSource = options.dataSource;
|
|
12025
|
-
this.dataSource = { data: dataSource };
|
|
12026
|
-
// dataSource = Array.isArray(dataSource) ? { data: dataSource } : dataSource;
|
|
12027
|
-
|
|
12028
|
-
// if (this.dataSource && this._changeHandler) {
|
|
12029
|
-
// this.dataSource.unbind("change", this._changeHandler)
|
|
12030
|
-
// .unbind("progress", this._progressHandler)
|
|
12031
|
-
// .unbind("error", this._errorHandler);
|
|
12032
|
-
// } else {
|
|
12033
|
-
// this._changeHandler = this._change.bind(this);
|
|
12034
|
-
// this._progressHandler = this._requestStart.bind(this);
|
|
12035
|
-
// this._errorHandler = this._error.bind(this);
|
|
12036
|
-
// }
|
|
12037
12115
|
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12116
|
+
dataSource = Array.isArray(dataSource) ? { data: dataSource } : dataSource;
|
|
12117
|
+
|
|
12118
|
+
if (this.dataSource && this._changeHandler) {
|
|
12119
|
+
this.dataSource.unbind("change", this._changeHandler)
|
|
12120
|
+
.unbind("progress", this._progressHandler)
|
|
12121
|
+
.unbind("error", this._errorHandler);
|
|
12122
|
+
} else {
|
|
12123
|
+
this._changeHandler = this._change.bind(this);
|
|
12124
|
+
this._progressHandler = this._requestStart.bind(this);
|
|
12125
|
+
this._errorHandler = this._error.bind(this);
|
|
12126
|
+
}
|
|
12127
|
+
|
|
12128
|
+
this.dataSource = this.options.sheet.createSheetDataSource?.(dataSource)
|
|
12129
|
+
.bind("change", this._changeHandler)
|
|
12130
|
+
.bind("progress", this._progressHandler)
|
|
12131
|
+
.bind("error", this._errorHandler);
|
|
12042
12132
|
}
|
|
12043
12133
|
|
|
12044
12134
|
_error() {
|
|
@@ -12072,11 +12162,11 @@ class SheetDataSourceBinder {
|
|
|
12072
12162
|
this._header();
|
|
12073
12163
|
}
|
|
12074
12164
|
|
|
12075
|
-
var getters = columns.map(function(column) {
|
|
12165
|
+
var getters = columns.map(function (column) {
|
|
12076
12166
|
return getter(column.field);
|
|
12077
12167
|
});
|
|
12078
12168
|
|
|
12079
|
-
this.sheet.batch(function() {
|
|
12169
|
+
this.sheet.batch(function () {
|
|
12080
12170
|
var length = Math.max(data.length, this._boundRowsCount, this.sheet._grid.rowCount - 1);
|
|
12081
12171
|
|
|
12082
12172
|
for (var idx = 0; idx < length; idx++) {
|
|
@@ -12126,214 +12216,154 @@ const kendoDate = (function() {
|
|
|
12126
12216
|
})();
|
|
12127
12217
|
|
|
12128
12218
|
/* eslint-disable no-var */
|
|
12219
|
+
/* eslint-disable no-implicit-coercion */
|
|
12220
|
+
/* eslint-disable no-param-reassign */
|
|
12221
|
+
/* eslint-disable no-loop-func */
|
|
12129
12222
|
|
|
12130
|
-
const dateRegExp = /^\/Date\((.*?)\)\/$/;
|
|
12131
12223
|
|
|
12132
|
-
|
|
12224
|
+
const logic = {
|
|
12225
|
+
or: {
|
|
12226
|
+
concat: (acc, fn) => (a) => acc(a) || fn(a),
|
|
12227
|
+
identity: () => false,
|
|
12228
|
+
},
|
|
12229
|
+
and: {
|
|
12230
|
+
concat: (acc, fn) => (a) => acc(a) && fn(a),
|
|
12231
|
+
identity: () => true,
|
|
12232
|
+
},
|
|
12233
|
+
};
|
|
12234
|
+
|
|
12235
|
+
const operatorsMap = {
|
|
12236
|
+
contains: (a, b) => (a || "").indexOf(b) >= 0,
|
|
12237
|
+
doesnotcontain: (a, b) => (a || "").indexOf(b) === -1,
|
|
12238
|
+
doesnotendwith: (a, b) =>
|
|
12239
|
+
(a || "").indexOf(b, (a || "").length - (b || "").length) < 0,
|
|
12240
|
+
doesnotstartwith: (a, b) => (a || "").lastIndexOf(b, 0) === -1,
|
|
12241
|
+
endswith: (a, b) =>
|
|
12242
|
+
(a || "").indexOf(b, (a || "").length - (b || "").length) >= 0,
|
|
12243
|
+
eq: (a, b) => a === b,
|
|
12244
|
+
gt: (a, b) => a > b,
|
|
12245
|
+
gte: (a, b) => a >= b,
|
|
12246
|
+
isempty: (a) => a === "",
|
|
12247
|
+
isnotempty: (a) => a !== "",
|
|
12248
|
+
isnotnull: (a) => isPresent(a),
|
|
12249
|
+
isnull: (a) => isBlank(a),
|
|
12250
|
+
lt: (a, b) => a < b,
|
|
12251
|
+
lte: (a, b) => a <= b,
|
|
12252
|
+
neq: (a, b) => a != b, // tslint:disable-line:triple-equals
|
|
12253
|
+
startswith: (a, b) => (a || "").lastIndexOf(b, 0) === 0,
|
|
12254
|
+
};
|
|
12255
|
+
|
|
12256
|
+
const dateRegExp = /^\/Date\((.*?)\)\/$/;
|
|
12133
12257
|
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12258
|
+
const convertValue = (value, ignoreCase, accentFoldingFiltering) => {
|
|
12259
|
+
if (value != null && isString(value)) {
|
|
12260
|
+
const date = dateRegExp.exec(value);
|
|
12261
|
+
if (date) {
|
|
12262
|
+
return new Date(+date[1]).getTime();
|
|
12263
|
+
} else if (ignoreCase) {
|
|
12264
|
+
return accentFoldingFiltering
|
|
12265
|
+
? value.toLocaleLowerCase(accentFoldingFiltering)
|
|
12266
|
+
: value.toLowerCase();
|
|
12137
12267
|
}
|
|
12138
|
-
|
|
12268
|
+
} else if (value != null && isDate(value)) {
|
|
12269
|
+
return value.getTime();
|
|
12139
12270
|
}
|
|
12271
|
+
return value;
|
|
12272
|
+
};
|
|
12140
12273
|
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12274
|
+
const transformFilter = ({
|
|
12275
|
+
field,
|
|
12276
|
+
ignoreCase,
|
|
12277
|
+
value,
|
|
12278
|
+
operator,
|
|
12279
|
+
accentFoldingFiltering,
|
|
12280
|
+
}) => {
|
|
12281
|
+
field = !isPresent(field) ? (a) => a : field;
|
|
12282
|
+
|
|
12283
|
+
ignoreCase = isPresent(ignoreCase) ? ignoreCase : true;
|
|
12284
|
+
|
|
12285
|
+
const itemProp = typedGetter(
|
|
12286
|
+
isFunction(field) ? field : getter(field, true),
|
|
12287
|
+
value,
|
|
12288
|
+
ignoreCase,
|
|
12289
|
+
accentFoldingFiltering
|
|
12290
|
+
);
|
|
12151
12291
|
|
|
12152
|
-
|
|
12153
|
-
if (b != null) {
|
|
12154
|
-
if (typeof b === 'string') {
|
|
12155
|
-
var date = dateRegExp.exec(b);
|
|
12156
|
-
if (date) {
|
|
12157
|
-
b = new Date(+date[1]);
|
|
12158
|
-
} else if (ignore) {
|
|
12159
|
-
b = quote(((accentFoldingFiltering) ? b.toLocaleLowerCase(accentFoldingFiltering) : b.toLowerCase()));
|
|
12160
|
-
a = "((" + a + " || '')+'')" + ((accentFoldingFiltering) ? ".toLocaleLowerCase('" + accentFoldingFiltering + "')" : ".toLowerCase()");
|
|
12161
|
-
} else {
|
|
12162
|
-
b = quote(b);
|
|
12163
|
-
}
|
|
12164
|
-
}
|
|
12292
|
+
value = convertValue(value, ignoreCase, accentFoldingFiltering);
|
|
12165
12293
|
|
|
12166
|
-
|
|
12167
|
-
//b looks like a Date
|
|
12168
|
-
a = "(" + a + "&&" + a + ".getTime?" + a + ".getTime():" + a + ")";
|
|
12169
|
-
b = b.getTime();
|
|
12170
|
-
}
|
|
12171
|
-
}
|
|
12294
|
+
const op = isFunction(operator) ? operator : operatorsMap[operator];
|
|
12172
12295
|
|
|
12173
|
-
|
|
12174
|
-
|
|
12296
|
+
return (a) => op(itemProp(a), value, ignoreCase);
|
|
12297
|
+
};
|
|
12175
12298
|
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
// Excel patterns support:
|
|
12180
|
-
//
|
|
12181
|
-
// * - match any sequence of characters
|
|
12182
|
-
// ? - match a single character
|
|
12183
|
-
//
|
|
12184
|
-
// to match a literal * or ?, they must be prefixed by a tilde (~)
|
|
12185
|
-
var rx = "/^";
|
|
12186
|
-
for (var esc = false, i = 0; i < pattern.length; ++i) {
|
|
12187
|
-
var ch = pattern.charAt(i);
|
|
12188
|
-
if (esc) {
|
|
12189
|
-
rx += "\\" + ch;
|
|
12190
|
-
} else if (ch === "~") {
|
|
12191
|
-
esc = true;
|
|
12192
|
-
continue;
|
|
12193
|
-
} else if (ch === "*") {
|
|
12194
|
-
rx += ".*";
|
|
12195
|
-
} else if (ch === "?") {
|
|
12196
|
-
rx += ".";
|
|
12197
|
-
} else if (".+^$()[]{}|\\/\n\r\u2028\u2029\xA0".indexOf(ch) >= 0) {
|
|
12198
|
-
rx += "\\" + ch;
|
|
12199
|
-
} else {
|
|
12200
|
-
rx += ch;
|
|
12201
|
-
}
|
|
12202
|
-
esc = false;
|
|
12203
|
-
}
|
|
12204
|
-
return rx + "$/";
|
|
12299
|
+
const typedGetter = (prop, value, ignoreCase, accentFoldingFiltering) => {
|
|
12300
|
+
if (!isPresent(value)) {
|
|
12301
|
+
return prop;
|
|
12205
12302
|
}
|
|
12206
12303
|
|
|
12207
|
-
|
|
12208
|
-
quote: function(value) {
|
|
12209
|
-
if (value && value.getTime) {
|
|
12210
|
-
return "new Date(" + value.getTime() + ")";
|
|
12211
|
-
}
|
|
12212
|
-
return quote(value);
|
|
12213
|
-
},
|
|
12214
|
-
eq: function(a, b, ignore, accentFoldingFiltering) {
|
|
12215
|
-
return operator("==", a, b, ignore, accentFoldingFiltering);
|
|
12216
|
-
},
|
|
12217
|
-
neq: function(a, b, ignore, accentFoldingFiltering) {
|
|
12218
|
-
return operator("!=", a, b, ignore, accentFoldingFiltering);
|
|
12219
|
-
},
|
|
12220
|
-
gt: function(a, b, ignore) {
|
|
12221
|
-
return operator(">", a, b, ignore);
|
|
12222
|
-
},
|
|
12223
|
-
gte: function(a, b, ignore) {
|
|
12224
|
-
return operator(">=", a, b, ignore);
|
|
12225
|
-
},
|
|
12226
|
-
lt: function(a, b, ignore) {
|
|
12227
|
-
return operator("<", a, b, ignore);
|
|
12228
|
-
},
|
|
12229
|
-
lte: function(a, b, ignore) {
|
|
12230
|
-
return operator("<=", a, b, ignore);
|
|
12231
|
-
},
|
|
12232
|
-
startswith: textOp(function(a, b) {
|
|
12233
|
-
return a + ".lastIndexOf(" + b + ", 0) == 0";
|
|
12234
|
-
}),
|
|
12235
|
-
doesnotstartwith: textOp(function(a, b) {
|
|
12236
|
-
return a + ".lastIndexOf(" + b + ", 0) == -1";
|
|
12237
|
-
}),
|
|
12238
|
-
endswith: textOp(function(a, b) {
|
|
12239
|
-
var n = b ? b.length - 2 : 0;
|
|
12240
|
-
return a + ".indexOf(" + b + ", " + a + ".length - " + n + ") >= 0";
|
|
12241
|
-
}),
|
|
12242
|
-
doesnotendwith: textOp(function(a, b) {
|
|
12243
|
-
var n = b ? b.length - 2 : 0;
|
|
12244
|
-
return a + ".indexOf(" + b + ", " + a + ".length - " + n + ") < 0";
|
|
12245
|
-
}),
|
|
12246
|
-
contains: textOp(function(a, b) {
|
|
12247
|
-
return a + ".indexOf(" + b + ") >= 0";
|
|
12248
|
-
}),
|
|
12249
|
-
doesnotcontain: textOp(function(a, b) {
|
|
12250
|
-
return a + ".indexOf(" + b + ") == -1";
|
|
12251
|
-
}),
|
|
12252
|
-
matches: textOp(function(a, b) {
|
|
12253
|
-
b = b.substring(1, b.length - 1);
|
|
12254
|
-
return getMatchRegexp(b) + ".test(" + a + ")";
|
|
12255
|
-
}),
|
|
12256
|
-
doesnotmatch: textOp(function(a, b) {
|
|
12257
|
-
b = b.substring(1, b.length - 1);
|
|
12258
|
-
return "!" + getMatchRegexp(b) + ".test(" + a + ")";
|
|
12259
|
-
}),
|
|
12260
|
-
isempty: function(a) {
|
|
12261
|
-
return a + " === ''";
|
|
12262
|
-
},
|
|
12263
|
-
isnotempty: function(a) {
|
|
12264
|
-
return a + " !== ''";
|
|
12265
|
-
},
|
|
12266
|
-
isnull: function(a) {
|
|
12267
|
-
return "(" + a + " == null)";
|
|
12268
|
-
},
|
|
12269
|
-
isnotnull: function(a) {
|
|
12270
|
-
return "(" + a + " != null)";
|
|
12271
|
-
},
|
|
12272
|
-
isnullorempty: function(a) {
|
|
12273
|
-
return "(" + a + " === null) || (" + a + " === '')";
|
|
12274
|
-
},
|
|
12275
|
-
isnotnullorempty: function(a) {
|
|
12276
|
-
return "(" + a + " !== null) && (" + a + " !== '')";
|
|
12277
|
-
}
|
|
12278
|
-
};
|
|
12279
|
-
})();
|
|
12280
|
-
|
|
12281
|
-
const filterExpr = function(expression) {
|
|
12282
|
-
var expressions = [],
|
|
12283
|
-
logic = { and: " && ", or: " || " },
|
|
12284
|
-
idx,
|
|
12285
|
-
length,
|
|
12286
|
-
filter,
|
|
12287
|
-
expr$1,
|
|
12288
|
-
fieldFunctions = [],
|
|
12289
|
-
operatorFunctions = [],
|
|
12290
|
-
field,
|
|
12291
|
-
operator,
|
|
12292
|
-
filters = expression.filters;
|
|
12293
|
-
|
|
12294
|
-
for (idx = 0, length = filters.length; idx < length; idx++) {
|
|
12295
|
-
filter = filters[idx];
|
|
12296
|
-
field = filter.field;
|
|
12297
|
-
operator = filter.operator;
|
|
12298
|
-
|
|
12299
|
-
if (filter.filters) {
|
|
12300
|
-
expr$1 = filterExpr(filter);
|
|
12301
|
-
//Nested function fields or operators - update their index e.g. __o[0] -> __o[1]
|
|
12302
|
-
filter = expr$1.expression
|
|
12303
|
-
.replace(/__o\[(\d+)\]/g, function(match, index) {
|
|
12304
|
-
index = +index;
|
|
12305
|
-
return "__o[" + (operatorFunctions.length + index) + "]";
|
|
12306
|
-
})
|
|
12307
|
-
.replace(/__f\[(\d+)\]/g, function(match, index) {
|
|
12308
|
-
index = +index;
|
|
12309
|
-
return "__f[" + (fieldFunctions.length + index) + "]";
|
|
12310
|
-
});
|
|
12304
|
+
let acc = prop;
|
|
12311
12305
|
|
|
12312
|
-
|
|
12313
|
-
|
|
12306
|
+
if (isString(value)) {
|
|
12307
|
+
const date = dateRegExp.exec(value);
|
|
12308
|
+
if (date) {
|
|
12309
|
+
value = new Date(+date[1]);
|
|
12314
12310
|
} else {
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
} else {
|
|
12326
|
-
filter = operators[(operator || "eq").toLowerCase()](expr$1, filter.value, filter.ignoreCase !== undefined ? filter.ignoreCase : true, expression.accentFoldingFiltering);
|
|
12327
|
-
}
|
|
12311
|
+
acc = (a) => {
|
|
12312
|
+
const x = prop(a);
|
|
12313
|
+
if (typeof x === "string" && ignoreCase) {
|
|
12314
|
+
return accentFoldingFiltering
|
|
12315
|
+
? x.toLocaleLowerCase(accentFoldingFiltering)
|
|
12316
|
+
: x.toLowerCase();
|
|
12317
|
+
} else {
|
|
12318
|
+
return isNumeric(x) ? x + "" : x;
|
|
12319
|
+
}
|
|
12320
|
+
};
|
|
12328
12321
|
}
|
|
12322
|
+
}
|
|
12329
12323
|
|
|
12330
|
-
|
|
12324
|
+
if (isDate(value)) {
|
|
12325
|
+
return (a) => {
|
|
12326
|
+
const x = acc(a);
|
|
12327
|
+
return isDate(x) ? x.getTime() : x;
|
|
12328
|
+
};
|
|
12331
12329
|
}
|
|
12330
|
+
return acc;
|
|
12331
|
+
};
|
|
12332
12332
|
|
|
12333
|
-
|
|
12333
|
+
const transformCompositeFilter = function (filter) {
|
|
12334
|
+
const accentFoldingFiltering = filter.accentFoldingFiltering;
|
|
12335
|
+
const combiner = logic[filter.logic || "and"];
|
|
12336
|
+
|
|
12337
|
+
return filter.filters
|
|
12338
|
+
.filter(isPresent)
|
|
12339
|
+
.map((x) => {
|
|
12340
|
+
const extendedFilter = isPresent(accentFoldingFiltering)
|
|
12341
|
+
? deepExtend({}, x, { accentFoldingFiltering })
|
|
12342
|
+
: x;
|
|
12343
|
+
|
|
12344
|
+
return isPresent(x.filters)
|
|
12345
|
+
? transformCompositeFilter(extendedFilter)
|
|
12346
|
+
: transformFilter(extendedFilter);
|
|
12347
|
+
})
|
|
12348
|
+
.reduce(combiner.concat, combiner.identity);
|
|
12334
12349
|
};
|
|
12335
12350
|
|
|
12336
12351
|
/* eslint-disable max-params */
|
|
12352
|
+
/* eslint-disable no-empty */
|
|
12353
|
+
/* eslint-disable no-loop-func */
|
|
12354
|
+
/* eslint-disable consistent-return */
|
|
12355
|
+
/* eslint-disable block-scoped-var */
|
|
12356
|
+
/* eslint-disable no-redeclare */
|
|
12357
|
+
/* eslint-disable no-var */
|
|
12358
|
+
/* eslint-disable eqeqeq */
|
|
12359
|
+
/* eslint-disable complexity */
|
|
12360
|
+
/* eslint-disable no-implicit-coercion */
|
|
12361
|
+
/* eslint-disable brace-style */
|
|
12362
|
+
/* eslint-disable key-spacing */
|
|
12363
|
+
/* eslint-disable no-else-return */
|
|
12364
|
+
/* eslint-disable default-case */
|
|
12365
|
+
/* eslint-disable no-param-reassign */
|
|
12366
|
+
|
|
12337
12367
|
|
|
12338
12368
|
let filtersObj = {};
|
|
12339
12369
|
const dateToSerial$1 = calc.runtime.dateToSerial;
|
|
@@ -12445,13 +12475,11 @@ class CustomFilter extends Filter {
|
|
|
12445
12475
|
|
|
12446
12476
|
this._criteria = options.criteria;
|
|
12447
12477
|
|
|
12448
|
-
|
|
12478
|
+
this._matches = transformCompositeFilter({
|
|
12449
12479
|
logic: this._logic,
|
|
12450
12480
|
filters: this._criteria,
|
|
12451
|
-
accentFoldingFiltering: culture().name
|
|
12452
|
-
})
|
|
12453
|
-
|
|
12454
|
-
this._matches = new Function("d", "return " + expression);
|
|
12481
|
+
accentFoldingFiltering: culture().name,
|
|
12482
|
+
});
|
|
12455
12483
|
}
|
|
12456
12484
|
matches(value) {
|
|
12457
12485
|
if (value === null) {
|
|
@@ -12786,6 +12814,21 @@ function sameWeek(a, b) {
|
|
|
12786
12814
|
}
|
|
12787
12815
|
|
|
12788
12816
|
/* eslint-disable max-params */
|
|
12817
|
+
/* eslint-disable no-empty */
|
|
12818
|
+
/* eslint-disable no-loop-func */
|
|
12819
|
+
/* eslint-disable consistent-return */
|
|
12820
|
+
/* eslint-disable block-scoped-var */
|
|
12821
|
+
/* eslint-disable no-redeclare */
|
|
12822
|
+
/* eslint-disable no-var */
|
|
12823
|
+
/* eslint-disable eqeqeq */
|
|
12824
|
+
/* eslint-disable complexity */
|
|
12825
|
+
/* eslint-disable no-implicit-coercion */
|
|
12826
|
+
/* eslint-disable brace-style */
|
|
12827
|
+
/* eslint-disable key-spacing */
|
|
12828
|
+
/* eslint-disable no-else-return */
|
|
12829
|
+
/* eslint-disable default-case */
|
|
12830
|
+
/* eslint-disable no-param-reassign */
|
|
12831
|
+
|
|
12789
12832
|
|
|
12790
12833
|
// This is a “dynamic variable” (see Greenspun's 10th rule). It's
|
|
12791
12834
|
// bound to an array via sheet._saveModifiedFormulas (which see)
|
|
@@ -12927,6 +12970,12 @@ class Selection {
|
|
|
12927
12970
|
}
|
|
12928
12971
|
}
|
|
12929
12972
|
|
|
12973
|
+
let EDITORS = {};
|
|
12974
|
+
|
|
12975
|
+
function registerEditor(name, editor) {
|
|
12976
|
+
EDITORS[name] = editor;
|
|
12977
|
+
}
|
|
12978
|
+
|
|
12930
12979
|
class Sheet extends Observable {
|
|
12931
12980
|
constructor() {
|
|
12932
12981
|
super();
|
|
@@ -12948,10 +12997,35 @@ class Sheet extends Observable {
|
|
|
12948
12997
|
"dataBound",
|
|
12949
12998
|
"progress"
|
|
12950
12999
|
];
|
|
13000
|
+
|
|
13001
|
+
this.createSheetDataSource = Array.from(arguments).pop();
|
|
13002
|
+
|
|
12951
13003
|
this._reinit.apply(this, arguments);
|
|
12952
13004
|
}
|
|
12953
13005
|
|
|
12954
|
-
activeCellCustomEditor() {
|
|
13006
|
+
activeCellCustomEditor() {
|
|
13007
|
+
let cell = this.activeCell().first();
|
|
13008
|
+
|
|
13009
|
+
if (this.range(cell).enable()) {
|
|
13010
|
+
let val = this.validation(cell);
|
|
13011
|
+
let key = this._properties.get("editor", this._grid.cellRefIndex(cell));
|
|
13012
|
+
let editor;
|
|
13013
|
+
|
|
13014
|
+
if (key != null) {
|
|
13015
|
+
editor = EDITORS[key];
|
|
13016
|
+
}
|
|
13017
|
+
else if (val && val.showButton) {
|
|
13018
|
+
key = "_validation_" + val.dataType;
|
|
13019
|
+
editor = EDITORS[key];
|
|
13020
|
+
}
|
|
13021
|
+
|
|
13022
|
+
if (typeof editor == "function") {
|
|
13023
|
+
editor = EDITORS[key] = editor();
|
|
13024
|
+
}
|
|
13025
|
+
|
|
13026
|
+
return editor;
|
|
13027
|
+
}
|
|
13028
|
+
}
|
|
12955
13029
|
|
|
12956
13030
|
_reinit(rowCount, columnCount, rowHeight, columnWidth, headerHeight, headerWidth, defaultCellStyle) {
|
|
12957
13031
|
defaultCellStyle = defaultCellStyle || {};
|
|
@@ -13153,7 +13227,8 @@ class Sheet extends Observable {
|
|
|
13153
13227
|
this.dataSourceBinder = new SheetDataSourceBinder({
|
|
13154
13228
|
dataSource: dataSource,
|
|
13155
13229
|
sheet: this,
|
|
13156
|
-
columns: columns
|
|
13230
|
+
columns: columns,
|
|
13231
|
+
createSheetDataSource: this.createSheetDataSource
|
|
13157
13232
|
});
|
|
13158
13233
|
|
|
13159
13234
|
this.dataSource = this.dataSourceBinder.dataSource;
|
|
@@ -14958,6 +15033,13 @@ function getPaperOptions(getOption) {
|
|
|
14958
15033
|
}
|
|
14959
15034
|
|
|
14960
15035
|
/* eslint-disable no-nested-ternary */
|
|
15036
|
+
/* eslint-disable default-case */
|
|
15037
|
+
/* eslint-disable no-implicit-coercion */
|
|
15038
|
+
/* eslint-disable no-else-return */
|
|
15039
|
+
/* eslint-disable key-spacing */
|
|
15040
|
+
/* eslint-disable eqeqeq */
|
|
15041
|
+
/* eslint-disable no-param-reassign */
|
|
15042
|
+
|
|
14961
15043
|
|
|
14962
15044
|
let GUIDELINE_WIDTH = 0.8;
|
|
14963
15045
|
|
|
@@ -15599,7 +15681,7 @@ function drawText(text, color, cell, group) {
|
|
|
15599
15681
|
}
|
|
15600
15682
|
if (vtrans < 0) { vtrans = 0; }
|
|
15601
15683
|
|
|
15602
|
-
let textGroup =
|
|
15684
|
+
let textGroup = drawText$1(CONT);
|
|
15603
15685
|
textGroup.transform(geometry.Matrix.translate(cell.left, cell.top + vtrans));
|
|
15604
15686
|
group.append(textGroup);
|
|
15605
15687
|
}
|
|
@@ -16002,7 +16084,7 @@ const viewClassNames = {
|
|
|
16002
16084
|
horizontalResize: "k-horizontal-resize",
|
|
16003
16085
|
verticalResize: "k-vertical-resize",
|
|
16004
16086
|
icon: "k-icon",
|
|
16005
|
-
iconFilterDefault: "k-i-
|
|
16087
|
+
iconFilterDefault: "k-i-caret-alt-down",
|
|
16006
16088
|
sheetsBar: "k-spreadsheet-sheets-bar",
|
|
16007
16089
|
sheetsBarActive: "k-spreadsheet-sheets-bar-active",
|
|
16008
16090
|
sheetsBarInactive: "k-spreadsheet-sheets-bar-inactive",
|
|
@@ -16053,6 +16135,7 @@ const paneClassNames = {
|
|
|
16053
16135
|
|
|
16054
16136
|
/* eslint-disable complexity */
|
|
16055
16137
|
|
|
16138
|
+
|
|
16056
16139
|
function cellBorder(value) {
|
|
16057
16140
|
return (value.size || 1) + "px solid " + (value.color || "#000");
|
|
16058
16141
|
}
|
|
@@ -16264,9 +16347,10 @@ function drawCell(collection, cell, cls, showGrid) {
|
|
|
16264
16347
|
}
|
|
16265
16348
|
|
|
16266
16349
|
class Pane {
|
|
16267
|
-
constructor(sheet, grid) {
|
|
16350
|
+
constructor(sheet, grid, getIconHTMLString) {
|
|
16268
16351
|
this._sheet = sheet;
|
|
16269
16352
|
this._grid = grid;
|
|
16353
|
+
this.getIconHTMLString = getIconHTMLString;
|
|
16270
16354
|
}
|
|
16271
16355
|
|
|
16272
16356
|
refresh(width, height) {
|
|
@@ -16622,18 +16706,23 @@ class Pane {
|
|
|
16622
16706
|
);
|
|
16623
16707
|
}
|
|
16624
16708
|
|
|
16709
|
+
icon(className) {
|
|
16710
|
+
if (typeof this.getIconHTMLString === "function") {
|
|
16711
|
+
return dom.element(this.getIconHTMLString(className));
|
|
16712
|
+
}
|
|
16713
|
+
|
|
16714
|
+
return dom.element("span", {
|
|
16715
|
+
className: viewClassNames.icon + " " + className
|
|
16716
|
+
});
|
|
16717
|
+
}
|
|
16718
|
+
|
|
16625
16719
|
renderFilterHeaders() {
|
|
16720
|
+
let pane = this;
|
|
16626
16721
|
let sheet = this._sheet;
|
|
16627
16722
|
let children = [];
|
|
16628
16723
|
let classNames = viewClassNames;
|
|
16629
16724
|
let filter = sheet.filter();
|
|
16630
16725
|
|
|
16631
|
-
function icon(className) {
|
|
16632
|
-
return dom.element("span", {
|
|
16633
|
-
className: classNames.icon + " " + className
|
|
16634
|
-
});
|
|
16635
|
-
}
|
|
16636
|
-
|
|
16637
16726
|
function filterButton(classNames, position, index) {
|
|
16638
16727
|
let style = {
|
|
16639
16728
|
left: position.left + "px",
|
|
@@ -16651,7 +16740,7 @@ class Pane {
|
|
|
16651
16740
|
let button = dom.element(
|
|
16652
16741
|
"span",
|
|
16653
16742
|
{ className: classes, style: style },
|
|
16654
|
-
[ icon(classNames.iconFilterDefault) ]
|
|
16743
|
+
[ pane.icon(classNames.iconFilterDefault) ]
|
|
16655
16744
|
);
|
|
16656
16745
|
|
|
16657
16746
|
return button;
|
|
@@ -16808,11 +16897,11 @@ class Pane {
|
|
|
16808
16897
|
height : cell.height + "px"
|
|
16809
16898
|
}
|
|
16810
16899
|
});
|
|
16900
|
+
|
|
16811
16901
|
if (ed.icon) {
|
|
16812
|
-
btn.children.push(
|
|
16813
|
-
className: "k-icon " + ed.icon
|
|
16814
|
-
}));
|
|
16902
|
+
btn.children.push(self.icon(ed.icon));
|
|
16815
16903
|
}
|
|
16904
|
+
|
|
16816
16905
|
collection.push(btn);
|
|
16817
16906
|
});
|
|
16818
16907
|
}
|
|
@@ -16887,6 +16976,11 @@ function drawingResizeHandles(container) {
|
|
|
16887
16976
|
}
|
|
16888
16977
|
|
|
16889
16978
|
/* eslint-disable no-unused-vars */
|
|
16979
|
+
/* eslint-disable no-param-reassign */
|
|
16980
|
+
/* eslint-disable no-else-return */
|
|
16981
|
+
/* eslint-disable no-multi-spaces */
|
|
16982
|
+
/* eslint-disable no-nested-ternary */
|
|
16983
|
+
|
|
16890
16984
|
|
|
16891
16985
|
let styles = [
|
|
16892
16986
|
"font-family",
|
|
@@ -17027,24 +17121,9 @@ class FormulaInput extends Widget {
|
|
|
17027
17121
|
end = begin;
|
|
17028
17122
|
}
|
|
17029
17123
|
if (begin && end) {
|
|
17030
|
-
|
|
17031
|
-
range.setStart(begin.node, begin.pos);
|
|
17032
|
-
range.setEnd(end.node, end.pos);
|
|
17033
|
-
let sel = window.getSelection();
|
|
17034
|
-
let currentRange = sel.getRangeAt(0);
|
|
17035
|
-
if (differ(range, currentRange)) {
|
|
17036
|
-
sel.removeAllRanges();
|
|
17037
|
-
sel.addRange(range);
|
|
17038
|
-
}
|
|
17039
|
-
}
|
|
17040
|
-
function differ(a, b) {
|
|
17041
|
-
return (
|
|
17042
|
-
a.startOffset !== b.startOffset ||
|
|
17043
|
-
a.endOffset !== b.endOffset ||
|
|
17044
|
-
a.startContainer !== b.endContainer ||
|
|
17045
|
-
a.endContainer !== b.endContainer
|
|
17046
|
-
);
|
|
17124
|
+
this._setRange(begin, end);
|
|
17047
17125
|
}
|
|
17126
|
+
|
|
17048
17127
|
function lookup(node, pos) {
|
|
17049
17128
|
try {
|
|
17050
17129
|
(function loop(node) {
|
|
@@ -17082,6 +17161,27 @@ class FormulaInput extends Widget {
|
|
|
17082
17161
|
return this.value().length;
|
|
17083
17162
|
}
|
|
17084
17163
|
|
|
17164
|
+
_setRange(begin, end) {
|
|
17165
|
+
let range = document.createRange();
|
|
17166
|
+
range.setStart(begin.node, begin.pos);
|
|
17167
|
+
range.setEnd(end.node, end.pos);
|
|
17168
|
+
let sel = window.getSelection();
|
|
17169
|
+
let currentRange = sel.getRangeAt(0);
|
|
17170
|
+
if (differ(range, currentRange)) {
|
|
17171
|
+
sel.removeAllRanges();
|
|
17172
|
+
sel.addRange(range);
|
|
17173
|
+
}
|
|
17174
|
+
|
|
17175
|
+
function differ(a, b) {
|
|
17176
|
+
return (
|
|
17177
|
+
a.startOffset !== b.startOffset ||
|
|
17178
|
+
a.endOffset !== b.endOffset ||
|
|
17179
|
+
a.startContainer !== b.endContainer ||
|
|
17180
|
+
a.endContainer !== b.endContainer
|
|
17181
|
+
);
|
|
17182
|
+
}
|
|
17183
|
+
}
|
|
17184
|
+
|
|
17085
17185
|
_formulaSource() {
|
|
17086
17186
|
let result = [];
|
|
17087
17187
|
let value;
|
|
@@ -17212,8 +17312,9 @@ class FormulaInput extends Widget {
|
|
|
17212
17312
|
return true;
|
|
17213
17313
|
}
|
|
17214
17314
|
if (key === keys.ENTER || key === keys.TAB) {
|
|
17215
|
-
|
|
17216
|
-
|
|
17315
|
+
let focusIndex = typeof list.focusIndex === "function" ? list.focusIndex() : list.focus();
|
|
17316
|
+
if (list.data()[focusIndex]) {
|
|
17317
|
+
this._formulaListChange(list.data()[focusIndex].value);
|
|
17217
17318
|
}
|
|
17218
17319
|
|
|
17219
17320
|
popup.close();
|
|
@@ -17741,6 +17842,13 @@ class SheetsBar extends Widget {
|
|
|
17741
17842
|
}
|
|
17742
17843
|
|
|
17743
17844
|
/* eslint-disable complexity */
|
|
17845
|
+
/* eslint-disable consistent-return */
|
|
17846
|
+
/* eslint-disable default-case */
|
|
17847
|
+
/* eslint-disable no-implicit-coercion */
|
|
17848
|
+
/* eslint-disable no-nested-ternary */
|
|
17849
|
+
/* eslint-disable key-spacing */
|
|
17850
|
+
/* eslint-disable no-param-reassign */
|
|
17851
|
+
|
|
17744
17852
|
|
|
17745
17853
|
function selectElementContents(el) {
|
|
17746
17854
|
let sel = window.getSelection();
|
|
@@ -17844,7 +17952,7 @@ function addCell(table, row, cell) {
|
|
|
17844
17952
|
break;
|
|
17845
17953
|
case "boolean":
|
|
17846
17954
|
style.textAlign = "center";
|
|
17847
|
-
|
|
17955
|
+
break;
|
|
17848
17956
|
}
|
|
17849
17957
|
}
|
|
17850
17958
|
|
|
@@ -17935,7 +18043,7 @@ class HtmlTable {
|
|
|
17935
18043
|
text = dom.text(text);
|
|
17936
18044
|
}
|
|
17937
18045
|
|
|
17938
|
-
let children = [
|
|
18046
|
+
let children = [text];
|
|
17939
18047
|
|
|
17940
18048
|
if (validation && !validation.value) {
|
|
17941
18049
|
children.push(dom.element("span", { className: "k-dirty" }));
|
|
@@ -17954,14 +18062,14 @@ class HtmlTable {
|
|
|
17954
18062
|
}
|
|
17955
18063
|
|
|
17956
18064
|
toDomTree(x, y, className) {
|
|
17957
|
-
this.trs = this.trs.filter(function(tr) {
|
|
18065
|
+
this.trs = this.trs.filter(function (tr) {
|
|
17958
18066
|
return tr.visible;
|
|
17959
18067
|
});
|
|
17960
18068
|
|
|
17961
18069
|
let offset = 0;
|
|
17962
|
-
this.cols = this.cols.filter(function(col, ci) {
|
|
18070
|
+
this.cols = this.cols.filter(function (col, ci) {
|
|
17963
18071
|
if (!col.visible) {
|
|
17964
|
-
this.trs.forEach(function(tr) {
|
|
18072
|
+
this.trs.forEach(function (tr) {
|
|
17965
18073
|
tr.children.splice(ci - offset, 1);
|
|
17966
18074
|
});
|
|
17967
18075
|
offset++;
|
|
@@ -17974,7 +18082,7 @@ class HtmlTable {
|
|
|
17974
18082
|
style: { left: x + "px", top: y + "px", height: this._height + "px", width: this._width + "px" },
|
|
17975
18083
|
className: className,
|
|
17976
18084
|
role: "presentation"
|
|
17977
|
-
},[
|
|
18085
|
+
}, [
|
|
17978
18086
|
dom.element("colgroup", null, this.cols),
|
|
17979
18087
|
dom.element("tbody", null, this.trs)
|
|
17980
18088
|
]);
|
|
@@ -18029,6 +18137,8 @@ class View extends Observable {
|
|
|
18029
18137
|
this.editor = new SheetEditor(this);
|
|
18030
18138
|
|
|
18031
18139
|
this._sheetsbar();
|
|
18140
|
+
|
|
18141
|
+
this.options.createContextMenus?.();
|
|
18032
18142
|
}
|
|
18033
18143
|
|
|
18034
18144
|
enableClipboard(enable) {
|
|
@@ -18072,7 +18182,7 @@ class View extends Observable {
|
|
|
18072
18182
|
this.formulaBar = new FormulaBar(formulaBar, { input: this.options.formulaBarInputRef });
|
|
18073
18183
|
|
|
18074
18184
|
// if (this.options.toolbar) {
|
|
18075
|
-
|
|
18185
|
+
this._tabstrip();
|
|
18076
18186
|
// }
|
|
18077
18187
|
}
|
|
18078
18188
|
|
|
@@ -18088,10 +18198,12 @@ class View extends Observable {
|
|
|
18088
18198
|
_sheetsbar() {
|
|
18089
18199
|
if (this.options.sheetsbar) {
|
|
18090
18200
|
this.sheetsbar = new SheetsBar(this.element.querySelector(DOT + View.classNames.sheetsBar), this.options.sheetsbar);
|
|
18201
|
+
this.options.createSheetBar?.(this.options.openDialogCallback);
|
|
18091
18202
|
}
|
|
18092
18203
|
}
|
|
18093
18204
|
|
|
18094
18205
|
_tabstrip() {
|
|
18206
|
+
this.tabstrip = this.options.createTabStrip?.();
|
|
18095
18207
|
// let messages = this.options.messages.tabs;
|
|
18096
18208
|
// let options = $.extend(true, { home: true, insert: true, data: true }, this.options.toolbar);
|
|
18097
18209
|
// let tabs = [];
|
|
@@ -18150,7 +18262,7 @@ class View extends Observable {
|
|
|
18150
18262
|
x += this.scroller.scrollLeft;
|
|
18151
18263
|
}
|
|
18152
18264
|
|
|
18153
|
-
col = this._sheet._grid._columns.locate(0, col, function(w) {
|
|
18265
|
+
col = this._sheet._grid._columns.locate(0, col, function (w) {
|
|
18154
18266
|
return Math.abs(x - w) <= RESIZE_HANDLE_WIDTH / 2;
|
|
18155
18267
|
});
|
|
18156
18268
|
|
|
@@ -18166,7 +18278,7 @@ class View extends Observable {
|
|
|
18166
18278
|
y += this.scroller.scrollTop;
|
|
18167
18279
|
}
|
|
18168
18280
|
|
|
18169
|
-
row = this._sheet._grid._rows.locate(0, row, function(h) {
|
|
18281
|
+
row = this._sheet._grid._rows.locate(0, row, function (h) {
|
|
18170
18282
|
return Math.abs(y - h) <= RESIZE_HANDLE_WIDTH / 2;
|
|
18171
18283
|
});
|
|
18172
18284
|
|
|
@@ -18182,8 +18294,8 @@ class View extends Observable {
|
|
|
18182
18294
|
x -= self._sheet._grid._headerWidth - scrollLeft;
|
|
18183
18295
|
y -= self._sheet._grid._headerHeight - scrollTop;
|
|
18184
18296
|
|
|
18185
|
-
return withExit(function(exit) {
|
|
18186
|
-
self._sheet.forEachFilterHeader(ref, function(ref) {
|
|
18297
|
+
return withExit(function (exit) {
|
|
18298
|
+
self._sheet.forEachFilterHeader(ref, function (ref) {
|
|
18187
18299
|
let rect = self._rectangle(pane, ref);
|
|
18188
18300
|
if (pane.filterIconRect(rect).intersects(x, y)) {
|
|
18189
18301
|
exit(true);
|
|
@@ -18333,7 +18445,7 @@ class View extends Observable {
|
|
|
18333
18445
|
}
|
|
18334
18446
|
|
|
18335
18447
|
containingPane(cell) {
|
|
18336
|
-
return this.panes.filter(function(pane) {
|
|
18448
|
+
return this.panes.filter(function (pane) {
|
|
18337
18449
|
if (pane._grid.contains(cell)) {
|
|
18338
18450
|
return true;
|
|
18339
18451
|
}
|
|
@@ -18358,7 +18470,7 @@ class View extends Observable {
|
|
|
18358
18470
|
// this.tabstrip.refreshTools(sheet.range(sheet.activeCell()));
|
|
18359
18471
|
// }
|
|
18360
18472
|
|
|
18361
|
-
this.trigger('update', { reason, range: sheet.range(sheet.activeCell()) });
|
|
18473
|
+
this.trigger('update', { reason, range: sheet.range(sheet.activeCell()), sheet });
|
|
18362
18474
|
|
|
18363
18475
|
// if (reason.sheetSelection && this.sheetsbar) {
|
|
18364
18476
|
// this.sheetsbar.renderSheets(this._workbook.sheets(), this._workbook.sheetIndex(this._sheet));
|
|
@@ -18375,7 +18487,7 @@ class View extends Observable {
|
|
|
18375
18487
|
let frozenRows = sheet.frozenRows();
|
|
18376
18488
|
|
|
18377
18489
|
// main or bottom or right pane
|
|
18378
|
-
this.panes = [
|
|
18490
|
+
this.panes = [this._pane(frozenRows, frozenColumns)];
|
|
18379
18491
|
|
|
18380
18492
|
// left pane
|
|
18381
18493
|
if (frozenColumns > 0) {
|
|
@@ -18402,19 +18514,18 @@ class View extends Observable {
|
|
|
18402
18514
|
}
|
|
18403
18515
|
}
|
|
18404
18516
|
|
|
18405
|
-
createFilterMenu(
|
|
18406
|
-
|
|
18517
|
+
createFilterMenu(column) {
|
|
18518
|
+
this._destroyFilterMenu();
|
|
18407
18519
|
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
// let element = $("<div />").appendTo(this.element);
|
|
18412
|
-
// let options = { column: column, range: range };
|
|
18413
|
-
// let filterMenu = new kendo.spreadsheet.FilterMenu(element, options);
|
|
18520
|
+
let sheet = this._sheet;
|
|
18521
|
+
let ref = sheet.filter().ref;
|
|
18522
|
+
let range = new Range$1(ref, sheet);
|
|
18414
18523
|
|
|
18415
|
-
|
|
18524
|
+
let options = { column: column, range: range };
|
|
18416
18525
|
|
|
18417
|
-
|
|
18526
|
+
this._filterMenu = this.options.createFilterMenu(options);
|
|
18527
|
+
|
|
18528
|
+
return this._filterMenu;
|
|
18418
18529
|
}
|
|
18419
18530
|
|
|
18420
18531
|
selectClipboardContents() {
|
|
@@ -18467,11 +18578,11 @@ class View extends Observable {
|
|
|
18467
18578
|
let editor = self._sheet.activeCellCustomEditor();
|
|
18468
18579
|
let range = self._sheet.range(cell);
|
|
18469
18580
|
editor.edit({
|
|
18470
|
-
range
|
|
18471
|
-
rect
|
|
18472
|
-
view
|
|
18473
|
-
validation
|
|
18474
|
-
callback
|
|
18581
|
+
range: range,
|
|
18582
|
+
rect: self.activeCellRectangle(),
|
|
18583
|
+
view: this,
|
|
18584
|
+
validation: this._sheet.validation(cell),
|
|
18585
|
+
callback: function (value, parse) {
|
|
18475
18586
|
self._executeCommand({
|
|
18476
18587
|
command: "EditCommand",
|
|
18477
18588
|
options: {
|
|
@@ -18487,10 +18598,12 @@ class View extends Observable {
|
|
|
18487
18598
|
|
|
18488
18599
|
openDialog(name, options) {
|
|
18489
18600
|
let sheet = this._sheet;
|
|
18490
|
-
return sheet.withCultureDecimals(function() {
|
|
18601
|
+
return sheet.withCultureDecimals(function () {
|
|
18491
18602
|
let ref = sheet.activeCell();
|
|
18492
18603
|
let range = new Range$1(ref, sheet);
|
|
18493
|
-
|
|
18604
|
+
let args = { ...options, name, ref, range };
|
|
18605
|
+
this.trigger('message', args);
|
|
18606
|
+
return args.dialog;
|
|
18494
18607
|
}.bind(this));
|
|
18495
18608
|
}
|
|
18496
18609
|
|
|
@@ -18502,7 +18615,7 @@ class View extends Observable {
|
|
|
18502
18615
|
return;
|
|
18503
18616
|
}
|
|
18504
18617
|
|
|
18505
|
-
let onClose = function() {
|
|
18618
|
+
let onClose = function () {
|
|
18506
18619
|
currentDialogs.pop();
|
|
18507
18620
|
// let dlg = e.sender;
|
|
18508
18621
|
this.selectClipboardContents();
|
|
@@ -18548,19 +18661,18 @@ class View extends Observable {
|
|
|
18548
18661
|
// this.colHeaderContextMenu =
|
|
18549
18662
|
// this.drawingContextMenu = null;
|
|
18550
18663
|
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18664
|
+
if (this.tabstrip) {
|
|
18665
|
+
this.tabstrip.destroy();
|
|
18666
|
+
this.tabstrip = null;
|
|
18667
|
+
}
|
|
18555
18668
|
|
|
18556
|
-
|
|
18669
|
+
this._destroyFilterMenu();
|
|
18557
18670
|
}
|
|
18558
18671
|
|
|
18559
18672
|
_destroyFilterMenu() {
|
|
18560
18673
|
if (this._filterMenu) {
|
|
18561
18674
|
this._filterMenu.destroy();
|
|
18562
18675
|
this._filterMenu = undefined;
|
|
18563
|
-
this._filterMenuColumn = undefined;
|
|
18564
18676
|
}
|
|
18565
18677
|
}
|
|
18566
18678
|
|
|
@@ -18580,8 +18692,8 @@ class View extends Observable {
|
|
|
18580
18692
|
|
|
18581
18693
|
let resizeDirection =
|
|
18582
18694
|
!sheet.resizingInProgress() ? "none" :
|
|
18583
|
-
|
|
18584
|
-
|
|
18695
|
+
sheet.resizeHandlePosition().col === -Infinity ? "column" :
|
|
18696
|
+
"row";
|
|
18585
18697
|
|
|
18586
18698
|
this.wrapper.classList.toggle(viewClassNames.editContainer, this.editor.isActive());
|
|
18587
18699
|
this.wrapper.classList.toggle(viewClassNames.horizontalResize, resizeDirection === "row");
|
|
@@ -18595,7 +18707,7 @@ class View extends Observable {
|
|
|
18595
18707
|
contentWidth: contentWidth,
|
|
18596
18708
|
contentHeight: contentHeight
|
|
18597
18709
|
};
|
|
18598
|
-
this.panes.forEach(function(pane) {
|
|
18710
|
+
this.panes.forEach(function (pane) {
|
|
18599
18711
|
content.push(pane.render(args));
|
|
18600
18712
|
});
|
|
18601
18713
|
|
|
@@ -18622,11 +18734,11 @@ class View extends Observable {
|
|
|
18622
18734
|
if (this.editor.isActive()) {
|
|
18623
18735
|
this.editor.toggleTooltip(this.activeCellRectangle());
|
|
18624
18736
|
} else if (!(reason.resize ||
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18737
|
+
reason.comment ||
|
|
18738
|
+
sheet.selectionInProgress() ||
|
|
18739
|
+
sheet.resizingInProgress() ||
|
|
18740
|
+
sheet.draggingInProgress() ||
|
|
18741
|
+
sheet.isInEditMode())) {
|
|
18630
18742
|
this.renderClipboardContents();
|
|
18631
18743
|
}
|
|
18632
18744
|
}
|
|
@@ -18660,7 +18772,7 @@ class View extends Observable {
|
|
|
18660
18772
|
return dom.element("div", {
|
|
18661
18773
|
className: classNames.resizeHint + (!horizontal ? " " + classNames.resizeHintVertical : ""),
|
|
18662
18774
|
style: style
|
|
18663
|
-
},[
|
|
18775
|
+
}, [
|
|
18664
18776
|
dom.element("div", { className: classNames.resizeHintHandle }),
|
|
18665
18777
|
dom.element("div", { className: classNames.resizeHintMarker })
|
|
18666
18778
|
]);
|
|
@@ -18698,11 +18810,11 @@ class View extends Observable {
|
|
|
18698
18810
|
|
|
18699
18811
|
let selectionView = grid.rangeDimensions(selection);
|
|
18700
18812
|
|
|
18701
|
-
selectionView.rows.forEach(function(height) {
|
|
18813
|
+
selectionView.rows.forEach(function (height) {
|
|
18702
18814
|
table.addRow(height);
|
|
18703
18815
|
});
|
|
18704
18816
|
|
|
18705
|
-
selectionView.columns.forEach(function(width) {
|
|
18817
|
+
selectionView.columns.forEach(function (width) {
|
|
18706
18818
|
table.addColumn(width);
|
|
18707
18819
|
});
|
|
18708
18820
|
|
|
@@ -18710,7 +18822,7 @@ class View extends Observable {
|
|
|
18710
18822
|
let primaryMergedCells = tmp.primary;
|
|
18711
18823
|
let secondaryMergedCells = tmp.secondary;
|
|
18712
18824
|
|
|
18713
|
-
sheet.forEach(selection, function(row, col, cell) {
|
|
18825
|
+
sheet.forEach(selection, function (row, col, cell) {
|
|
18714
18826
|
let location = new CellRef(row, col).print();
|
|
18715
18827
|
|
|
18716
18828
|
if (!secondaryMergedCells[location]) {
|
|
@@ -18725,13 +18837,13 @@ class View extends Observable {
|
|
|
18725
18837
|
}
|
|
18726
18838
|
});
|
|
18727
18839
|
|
|
18728
|
-
this.clipboardContents.render([
|
|
18840
|
+
this.clipboardContents.render([table.toDomTree(0, 0, "kendo-clipboard-" + this._workbook.clipboard()._uid)]);
|
|
18729
18841
|
|
|
18730
18842
|
this.selectClipboardContents();
|
|
18731
18843
|
}
|
|
18732
18844
|
|
|
18733
18845
|
_pane(row, column, rowCount, columnCount) {
|
|
18734
|
-
let pane = new Pane(this._sheet, this._sheet._grid.pane({ row: row, column: column, rowCount: rowCount, columnCount: columnCount }));
|
|
18846
|
+
let pane = new Pane(this._sheet, this._sheet._grid.pane({ row: row, column: column, rowCount: rowCount, columnCount: columnCount }), this.options.getIconHTMLString);
|
|
18735
18847
|
pane.refresh(this.scroller.clientWidth, this.scroller.clientHeight);
|
|
18736
18848
|
return pane;
|
|
18737
18849
|
}
|
|
@@ -19129,6 +19241,10 @@ function parseTSV(data) {
|
|
|
19129
19241
|
}
|
|
19130
19242
|
|
|
19131
19243
|
/* eslint-disable no-else-return */
|
|
19244
|
+
/* eslint-disable consistent-return */
|
|
19245
|
+
/* eslint-disable space-before-blocks */
|
|
19246
|
+
/* eslint-disable no-implicit-coercion */
|
|
19247
|
+
|
|
19132
19248
|
|
|
19133
19249
|
let COMMAND_TYPES = {
|
|
19134
19250
|
AUTO_FILL: "autoFill",
|
|
@@ -20944,6 +21060,13 @@ class Deferred {
|
|
|
20944
21060
|
}
|
|
20945
21061
|
|
|
20946
21062
|
/* eslint-disable complexity */
|
|
21063
|
+
/* eslint-disable camelcase */
|
|
21064
|
+
/* eslint-disable key-spacing */
|
|
21065
|
+
/* eslint-disable no-nested-ternary */
|
|
21066
|
+
/* eslint-disable brace-style */
|
|
21067
|
+
/* eslint-disable no-implicit-coercion */
|
|
21068
|
+
/* eslint-disable no-loop-func */
|
|
21069
|
+
/* eslint-disable no-param-reassign */
|
|
20947
21070
|
|
|
20948
21071
|
// WARNING: removing the following jshint declaration and turning
|
|
20949
21072
|
// == into === to make JSHint happy will break functionality.
|
|
@@ -22313,6 +22436,11 @@ function excelToPixels(val) {
|
|
|
22313
22436
|
}
|
|
22314
22437
|
|
|
22315
22438
|
/* eslint-disable no-undef */
|
|
22439
|
+
/* eslint-disable no-nested-ternary */
|
|
22440
|
+
/* eslint-disable key-spacing */
|
|
22441
|
+
/* eslint-disable consistent-return */
|
|
22442
|
+
/* eslint-disable no-param-reassign */
|
|
22443
|
+
|
|
22316
22444
|
|
|
22317
22445
|
const events$1 = [
|
|
22318
22446
|
"cut",
|
|
@@ -22531,7 +22659,13 @@ class Workbook extends Observable {
|
|
|
22531
22659
|
|
|
22532
22660
|
execute(options) {
|
|
22533
22661
|
let commandOptions = Object.assign({}, { workbook: this }, options.options);
|
|
22534
|
-
let command
|
|
22662
|
+
let command;
|
|
22663
|
+
|
|
22664
|
+
if (this.options.getWorkbookCommand) {
|
|
22665
|
+
command = this.options.getWorkbookCommand(options.command, commandOptions);
|
|
22666
|
+
}
|
|
22667
|
+
|
|
22668
|
+
command = command || new commands[options.command](commandOptions);
|
|
22535
22669
|
let sheet = this.activeSheet();
|
|
22536
22670
|
|
|
22537
22671
|
if (commandOptions.origin) {
|
|
@@ -22650,7 +22784,8 @@ class Workbook extends Observable {
|
|
|
22650
22784
|
options.columnWidth || this.options.columnWidth,
|
|
22651
22785
|
options.headerHeight || this.options.headerHeight,
|
|
22652
22786
|
options.headerWidth || this.options.headerWidth,
|
|
22653
|
-
options.defaultCellStyle || this.options.defaultCellStyle
|
|
22787
|
+
options.defaultCellStyle || this.options.defaultCellStyle,
|
|
22788
|
+
options.createSheetDataSource || this.options.createSheetDataSource
|
|
22654
22789
|
);
|
|
22655
22790
|
|
|
22656
22791
|
sheet._workbook = this;
|
|
@@ -22974,12 +23109,16 @@ class Workbook extends Observable {
|
|
|
22974
23109
|
|
|
22975
23110
|
if (file && !this.trigger("excelImport", { file, deferred })) {
|
|
22976
23111
|
this._clearSheets();
|
|
22977
|
-
|
|
23112
|
+
this._readExcel(file, this, deferred);
|
|
22978
23113
|
}
|
|
22979
23114
|
|
|
22980
23115
|
return deferred.promise;
|
|
22981
23116
|
}
|
|
22982
23117
|
|
|
23118
|
+
_readExcel(file, workbook, deferred) {
|
|
23119
|
+
readExcel(file, workbook, deferred);
|
|
23120
|
+
}
|
|
23121
|
+
|
|
22983
23122
|
saveAsExcel(options) {
|
|
22984
23123
|
let self = this;
|
|
22985
23124
|
options = deepExtend({}, self.options.excel, options);
|
|
@@ -23325,7 +23464,10 @@ const events = [
|
|
|
23325
23464
|
"select",
|
|
23326
23465
|
"changeFormat",
|
|
23327
23466
|
"dataBinding",
|
|
23328
|
-
"dataBound"
|
|
23467
|
+
"dataBound",
|
|
23468
|
+
"update",
|
|
23469
|
+
"message",
|
|
23470
|
+
"contextmenu",
|
|
23329
23471
|
];
|
|
23330
23472
|
|
|
23331
23473
|
class SpreadsheetWidget extends Widget {
|
|
@@ -23343,7 +23485,13 @@ class SpreadsheetWidget extends Widget {
|
|
|
23343
23485
|
sheetsbar: this.options.sheetsbar,
|
|
23344
23486
|
formulaBarInputRef: this.options.formulaBarInputRef,
|
|
23345
23487
|
formulaCellInputRef: this.options.formulaCellInputRef,
|
|
23346
|
-
nameBoxRef: this.options.nameBoxRef
|
|
23488
|
+
nameBoxRef: this.options.nameBoxRef,
|
|
23489
|
+
createTabStrip: this.options.createTabStrip,
|
|
23490
|
+
createFilterMenu: this.options.createFilterMenu,
|
|
23491
|
+
createContextMenus: this.options.createContextMenus,
|
|
23492
|
+
createSheetBar: this.options.createSheetBar,
|
|
23493
|
+
getIconHTMLString: this.options.getIconHTMLString,
|
|
23494
|
+
openDialogCallback: this.openDialog.bind(this),
|
|
23347
23495
|
});
|
|
23348
23496
|
|
|
23349
23497
|
this._workbook = new Workbook(this.options, this._view);
|
|
@@ -23353,6 +23501,7 @@ class SpreadsheetWidget extends Widget {
|
|
|
23353
23501
|
this._autoRefresh = true;
|
|
23354
23502
|
|
|
23355
23503
|
this._bindWorkbookEvents();
|
|
23504
|
+
this._bindViewEvents();
|
|
23356
23505
|
|
|
23357
23506
|
this._view.workbook(this._workbook);
|
|
23358
23507
|
|
|
@@ -23382,35 +23531,29 @@ class SpreadsheetWidget extends Widget {
|
|
|
23382
23531
|
this.trigger("keydown", e);
|
|
23383
23532
|
|
|
23384
23533
|
if (key === keys.F11 && e.shiftKey) {
|
|
23385
|
-
this._view.sheetsbar.
|
|
23534
|
+
this._view.sheetsbar.onAddSelect();
|
|
23386
23535
|
e.preventDefault();
|
|
23387
23536
|
return;
|
|
23388
23537
|
} else if (e.altKey && key === keys.PAGEDOWN) {
|
|
23389
|
-
this.
|
|
23390
|
-
|
|
23391
|
-
isAddButton: false
|
|
23392
|
-
});
|
|
23393
|
-
} else if (e.altKey && key === keys.PAGEUP) {
|
|
23394
|
-
this._view.sheetsbar.trigger("select", {
|
|
23395
|
-
name: this._view.sheetsbar._sheets[this._view.sheetsbar._selectedIndex - 1].name(),
|
|
23396
|
-
isAddButton: false
|
|
23397
|
-
});
|
|
23398
|
-
} else if (e.altKey && key === keys.DELETE) {
|
|
23399
|
-
let closeCallback = function(e) {
|
|
23400
|
-
let dlg = e.sender;
|
|
23538
|
+
let activeSheetIndex = this.sheetIndex(this.activeSheet());
|
|
23539
|
+
let nextSheetName = this.sheetByIndex(activeSheetIndex + 1)?.name();
|
|
23401
23540
|
|
|
23402
|
-
|
|
23403
|
-
|
|
23404
|
-
|
|
23405
|
-
|
|
23541
|
+
if (nextSheetName){
|
|
23542
|
+
this._view.sheetsbar.onSheetSelect(nextSheetName);
|
|
23543
|
+
}
|
|
23544
|
+
} else if (e.altKey && key === keys.PAGEUP) {
|
|
23545
|
+
let activeSheetIndex = this.sheetIndex(this.activeSheet());
|
|
23546
|
+
let prevSheetName = this.sheetByIndex(activeSheetIndex - 1)?.name();
|
|
23406
23547
|
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
}
|
|
23548
|
+
if (prevSheetName) {
|
|
23549
|
+
this._view.sheetsbar.onSheetSelect(prevSheetName);
|
|
23550
|
+
}
|
|
23551
|
+
} else if (e.altKey && key === keys.DELETE) {
|
|
23552
|
+
this._view.sheetsbar.onSheetRemove(this.activeSheet()._name());
|
|
23410
23553
|
e.preventDefault();
|
|
23411
23554
|
return;
|
|
23412
23555
|
} else if (e.altKey && key === keys.R) {
|
|
23413
|
-
this.
|
|
23556
|
+
this.options.createSheetEditor?.();
|
|
23414
23557
|
e.preventDefault();
|
|
23415
23558
|
return;
|
|
23416
23559
|
} else if (controlKey && key === keys.B) {
|
|
@@ -23420,17 +23563,20 @@ class SpreadsheetWidget extends Widget {
|
|
|
23420
23563
|
} else if (controlKey && key === keys.U) {
|
|
23421
23564
|
this._handleTypographicalEmphasis('underline');
|
|
23422
23565
|
} else if (e.altKey && key === keys.H) {
|
|
23423
|
-
this._view.tabstrip
|
|
23566
|
+
this._view.tabstrip?.select(0);
|
|
23424
23567
|
e.preventDefault();
|
|
23425
23568
|
return;
|
|
23426
23569
|
} else if (e.altKey && key === keys.N) {
|
|
23427
|
-
this._view.tabstrip
|
|
23570
|
+
this._view.tabstrip?.select(1);
|
|
23428
23571
|
e.preventDefault();
|
|
23429
23572
|
return;
|
|
23430
23573
|
} else if (e.altKey && key === keys.A) {
|
|
23431
|
-
this._view.tabstrip
|
|
23574
|
+
this._view.tabstrip?.select(2);
|
|
23432
23575
|
e.preventDefault();
|
|
23433
23576
|
return;
|
|
23577
|
+
} else if (key === keys.F10) {
|
|
23578
|
+
e.preventDefault();
|
|
23579
|
+
this._view.tabstrip?.wrapper?.find(".k-tabstrip-content.k-active .k-toolbar [tabindex=0]").trigger("focus");
|
|
23434
23580
|
}
|
|
23435
23581
|
}
|
|
23436
23582
|
|
|
@@ -23741,6 +23887,14 @@ class SpreadsheetWidget extends Widget {
|
|
|
23741
23887
|
// kendo.ui.progress(this.element, e.toggle);
|
|
23742
23888
|
}
|
|
23743
23889
|
|
|
23890
|
+
_viewUpdate(e) {
|
|
23891
|
+
this.trigger("update", e);
|
|
23892
|
+
}
|
|
23893
|
+
|
|
23894
|
+
_viewMessage(e) {
|
|
23895
|
+
this.trigger("message", e);
|
|
23896
|
+
}
|
|
23897
|
+
|
|
23744
23898
|
_onContextMenu(e) {
|
|
23745
23899
|
this.trigger("contextmenu", e);
|
|
23746
23900
|
}
|
|
@@ -23774,6 +23928,11 @@ class SpreadsheetWidget extends Widget {
|
|
|
23774
23928
|
this._workbook.bind("contextmenu", this._onContextMenu.bind(this));
|
|
23775
23929
|
}
|
|
23776
23930
|
|
|
23931
|
+
_bindViewEvents() {
|
|
23932
|
+
this._view.bind("update", this._viewUpdate.bind(this));
|
|
23933
|
+
this._view.bind("message", this._viewMessage.bind(this));
|
|
23934
|
+
}
|
|
23935
|
+
|
|
23777
23936
|
destroy() {
|
|
23778
23937
|
window.removeEventListener('resize', this._resizeHandler);
|
|
23779
23938
|
this.element.removeEventListener("keydown", this._keyDownHandler);
|
|
@@ -23824,6 +23983,7 @@ class SpreadsheetWidget extends Widget {
|
|
|
23824
23983
|
|
|
23825
23984
|
/* -----[ Excel operators ]----- */
|
|
23826
23985
|
|
|
23986
|
+
|
|
23827
23987
|
const {
|
|
23828
23988
|
FUNCS,
|
|
23829
23989
|
defineBuiltinFunction,
|
|
@@ -43971,4 +44131,4 @@ const {
|
|
|
43971
44131
|
defineAlias
|
|
43972
44132
|
} = calc.runtime;
|
|
43973
44133
|
|
|
43974
|
-
export { CalcError, CellRef, Context, Deferred, Matrix, NULLREF, NameRef, Range$1 as Range, RangeRef, Ref, Sheet, SpreadsheetWidget, UnionRef, View, Workbook, calc, dateToSerial, defineAlias, defineFunction, packDate, packTime, serialToDate, unpackDate, unpackTime };
|
|
44134
|
+
export { ALL_PROPERTIES, ALL_REASONS, AddColumnCommand, AddCommand, AddRowCommand, AdjustDecimalsCommand, AdjustRowHeightCommand, ApplyFilterCommand, AutoFillCalculator, AutoFillCommand, Axis, AxisManager, BorderChangeCommand, BringToFrontCommand, CalcError, CellRef, ClearContentCommand, ClearFilterCommand, Clipboard, ColumnWidthCommand, Command, Context, Controller, CopyCommand, CustomFilter, CutCommand, Deferred, DefineNameCommand, DeleteColumnCommand, DeleteCommand, DeleteDrawingCommand, DeleteNameCommand, DeleteRowCommand, Drawing, DrawingCommand, DrawingUpdateCommand, DynamicFilter, EditCommand, EditValidationCommand, EventListener, FIRSTREF, Filter, FilterCommand, FormulaBar, FormulaContext, FormulaInput, FreezePanesCommand, Grid, GridLinesChangeCommand, HideLineCommand, HyperlinkCommand, InsertCommentCommand, InsertImageCommand, Matrix, MergeCellCommand, NULLREF, NameCommand, NameEditor, NameRef, OpenCommand, Pane, PaneAxis, PaneGrid, PasteCommand, PropertyBag, PropertyChangeCommand, PropertyCleanCommand, Range$1 as Range, RangeList, RangeRef, RangeTree, Ref, ReorderDrawingsCommand, RowHeightCommand, SHEETREF, SaveAsCommand, SendToBackCommand, Sheet, SheetDataSourceBinder, SheetEditor, SheetNavigator, SortCommand, Sorter, SpreadsheetWidget, TargetValueCommand, TextWrapCommand, ToolbarCopyCommand, ToolbarCutCommand, ToolbarPasteCommand, TopFilter, UnHideLineCommand, UnionRef, ValidationFormulaContext, ValueFilter, View, Workbook, calc, dateToNumber, dateToSerial, defineAlias, defineFunction, draw, drawCell, formatting, initDynamicFilter, intl, numberToDate, packDate, packTime, registerEditor, serialToDate, unpackDate, unpackTime, validationExport as validation };
|