@sheetxl/primitives 0.8.0-beta.11 → 0.8.0-beta.13
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/browser/esm/index.mjs +80 -36
- package/node/esm/index.mjs +102 -56
- package/package.json +1 -1
- package/types/src/ErrorPolicy.d.ts +2 -2
- package/types/src/Flatten.d.ts +2 -2
- package/types/src/FormulaContext.d.ts +15 -6
- package/types/src/FormulaError.d.ts +1 -1
- package/types/src/IFormulaContext.d.ts +218 -13
- package/types/src/IFunction.d.ts +13 -44
- package/types/src/IFunctionArguments.d.ts +3 -4
- package/types/src/IRange.d.ts +4 -4
- package/types/src/IRangeStats.d.ts +6 -6
- package/types/src/IRichData.d.ts +33 -10
- package/types/src/IRichType.d.ts +139 -0
- package/types/src/Repeating.d.ts +3 -3
- package/types/src/ReportType.d.ts +2 -2
- package/types/src/Scalar.d.ts +53 -2
- package/types/src/ValueKind.d.ts +2 -2
- package/types/src/WildCard.d.ts +1 -1
- package/types/src/index.d.ts +1 -0
package/browser/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.8.0-beta.13
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -21,6 +21,39 @@ var e;
|
|
|
21
21
|
}
|
|
22
22
|
return i === null ? e : i.join("");
|
|
23
23
|
};
|
|
24
|
+
let n = e.MIN_NUMBER = 22250738585072014e-324;
|
|
25
|
+
e.flushSubnormal = function(e) {
|
|
26
|
+
return e > -n && e < n ? 0 : e;
|
|
27
|
+
}, e.isNumberTextInRange = function(e, t = ".") {
|
|
28
|
+
let n = e.length;
|
|
29
|
+
if (n < 309 && e.indexOf("E") < 0 && e.indexOf("e") < 0) return !0;
|
|
30
|
+
let r = t.charCodeAt(0), i = !1, a = !1, o = !1, s = 0, c = 0, l = 0, u = 0;
|
|
31
|
+
for (; u < n; u++) {
|
|
32
|
+
let t = e.charCodeAt(u);
|
|
33
|
+
if (t >= 48 && t <= 57) i = !0, a ? (l++, o || (t === 48 ? c++ : o = !0)) : (o || t !== 48) && (o = !0, s++);
|
|
34
|
+
else if (t === r) a = !0;
|
|
35
|
+
else if ((t === 69 || t === 101) && i) break;
|
|
36
|
+
}
|
|
37
|
+
let d = 0;
|
|
38
|
+
if (u < n) {
|
|
39
|
+
let t = u + 1, r = !1, i = e.charCodeAt(t);
|
|
40
|
+
i === 45 ? (r = !0, t++) : i === 43 && t++;
|
|
41
|
+
let a = 0;
|
|
42
|
+
for (; t < n; t++) {
|
|
43
|
+
let n = e.charCodeAt(t);
|
|
44
|
+
if (n < 48 || n > 57) break;
|
|
45
|
+
d = 10 * d + (n - 48), a++;
|
|
46
|
+
}
|
|
47
|
+
if (a === 0) return !0;
|
|
48
|
+
r && (d = -d);
|
|
49
|
+
}
|
|
50
|
+
if (o) {
|
|
51
|
+
let e = (s > 0 ? s - 1 : -(c + 1)) + d;
|
|
52
|
+
return e >= -309 && e <= 307;
|
|
53
|
+
}
|
|
54
|
+
let f = d - l;
|
|
55
|
+
return f >= -308 && f <= 308;
|
|
56
|
+
};
|
|
24
57
|
})(e ||= {});
|
|
25
58
|
var t, n, r, i, a = {
|
|
26
59
|
Number: "number",
|
|
@@ -370,34 +403,34 @@ var v = class {
|
|
|
370
403
|
}
|
|
371
404
|
}, y = class {
|
|
372
405
|
createRange(e, t, n) {
|
|
373
|
-
throw
|
|
406
|
+
throw x("createRange");
|
|
374
407
|
}
|
|
375
408
|
flattenAreas(e) {
|
|
376
|
-
throw
|
|
409
|
+
throw x("flattenAreas");
|
|
377
410
|
}
|
|
378
411
|
getReference(e, t) {
|
|
379
|
-
throw
|
|
412
|
+
throw x("getReference");
|
|
380
413
|
}
|
|
381
414
|
getResizedReference(e, t, n) {
|
|
382
|
-
throw
|
|
415
|
+
throw x("getResizedReference");
|
|
383
416
|
}
|
|
384
417
|
getNumberFormat(e, t) {
|
|
385
|
-
throw
|
|
418
|
+
throw x("getNumberFormat");
|
|
386
419
|
}
|
|
387
420
|
fromSerialDate(e, t) {
|
|
388
|
-
throw
|
|
421
|
+
throw x("fromSerialDate");
|
|
389
422
|
}
|
|
390
423
|
toSerialDate(e, t) {
|
|
391
|
-
throw
|
|
424
|
+
throw x("toSerialDate");
|
|
392
425
|
}
|
|
393
426
|
getDateParts(e, t) {
|
|
394
|
-
throw
|
|
427
|
+
throw x("getDateParts");
|
|
395
428
|
}
|
|
396
429
|
getSerialDate(e, t, n, r, i, a, o) {
|
|
397
|
-
throw
|
|
430
|
+
throw x("getSerialDate");
|
|
398
431
|
}
|
|
399
432
|
getNow() {
|
|
400
|
-
throw
|
|
433
|
+
throw x("getNow");
|
|
401
434
|
}
|
|
402
435
|
getRandom() {
|
|
403
436
|
return Math.random();
|
|
@@ -406,10 +439,10 @@ var v = class {
|
|
|
406
439
|
return null;
|
|
407
440
|
}
|
|
408
441
|
getEntireCoords() {
|
|
409
|
-
return
|
|
442
|
+
return T;
|
|
410
443
|
}
|
|
411
444
|
isValidDate(e, t) {
|
|
412
|
-
return e instanceof Date || Object.prototype.toString.call(e) === "[object Date]" ? !isNaN(e.getTime()) : !t && typeof e == "number" && !(e < 0 || e >
|
|
445
|
+
return e instanceof Date || Object.prototype.toString.call(e) === "[object Date]" ? !isNaN(e.getTime()) : !t && typeof e == "number" && !(e < 0 || e > D);
|
|
413
446
|
}
|
|
414
447
|
getRow() {
|
|
415
448
|
return 0;
|
|
@@ -433,6 +466,7 @@ var v = class {
|
|
|
433
466
|
return 1;
|
|
434
467
|
}
|
|
435
468
|
markVolatile() {}
|
|
469
|
+
defer(e, t) {}
|
|
436
470
|
formatResults(e) {}
|
|
437
471
|
filterHidden(e, t) {
|
|
438
472
|
return e;
|
|
@@ -444,22 +478,22 @@ var v = class {
|
|
|
444
478
|
return null;
|
|
445
479
|
}
|
|
446
480
|
getAddress(e, t) {
|
|
447
|
-
throw
|
|
481
|
+
throw x("getAddress");
|
|
448
482
|
}
|
|
449
483
|
parseAsSerialDate(e, t) {
|
|
450
|
-
throw
|
|
484
|
+
throw x("parseAsSerialDate");
|
|
451
485
|
}
|
|
452
486
|
parseAsDate(e, t) {
|
|
453
|
-
throw
|
|
487
|
+
throw x("parseAsDate");
|
|
454
488
|
}
|
|
455
489
|
parseAsNumber(e, t) {
|
|
456
|
-
throw
|
|
490
|
+
throw x("parseAsNumber");
|
|
457
491
|
}
|
|
458
492
|
createCriteria(e, t) {
|
|
459
|
-
throw
|
|
493
|
+
throw x("createCriteria");
|
|
460
494
|
}
|
|
461
495
|
createGrouping(e, t) {
|
|
462
|
-
throw
|
|
496
|
+
throw x("createGrouping");
|
|
463
497
|
}
|
|
464
498
|
parseAsLiteral(e) {
|
|
465
499
|
let t = e.toUpperCase();
|
|
@@ -474,10 +508,13 @@ var v = class {
|
|
|
474
508
|
return r === i ? e < t ? -1 : +(e > t) : r < i ? -1 : 1;
|
|
475
509
|
}
|
|
476
510
|
getRuntime() {
|
|
477
|
-
return
|
|
511
|
+
return E;
|
|
478
512
|
}
|
|
479
513
|
getArgs() {
|
|
480
|
-
throw new S
|
|
514
|
+
throw new w(S);
|
|
515
|
+
}
|
|
516
|
+
createRichData(e, t) {
|
|
517
|
+
throw new w(C);
|
|
481
518
|
}
|
|
482
519
|
}, b = (e) => {
|
|
483
520
|
if (e == null) return 0;
|
|
@@ -487,19 +524,19 @@ var v = class {
|
|
|
487
524
|
case "boolean": return 3;
|
|
488
525
|
default: return 4;
|
|
489
526
|
}
|
|
490
|
-
}, x = "FormulaContext.getArgs() is only valid while a function body is running",
|
|
527
|
+
}, x = (e) => new w(`FormulaContext.${e}() is only valid while a function body is running. A deferred executor reads its workbook through ctx.getFormulaContext().`), S = "FormulaContext.getArgs() is only valid while a function body is running", C = "FormulaContext.createRichData() needs a workbook being calculated", w = class extends Error {
|
|
491
528
|
constructor(e = "Not implemented in StubbedFormulaContext") {
|
|
492
529
|
super(e), this.name = "NotImplementedError";
|
|
493
530
|
}
|
|
494
|
-
},
|
|
531
|
+
}, T = Object.freeze({
|
|
495
532
|
colStart: 0,
|
|
496
533
|
rowStart: 0,
|
|
497
534
|
colEnd: 2 ** 14 - 1,
|
|
498
535
|
rowEnd: 2 ** 20 - 1
|
|
499
|
-
}),
|
|
536
|
+
}), E = {
|
|
500
537
|
isDate1904: () => !1,
|
|
501
|
-
getLocale: () =>
|
|
502
|
-
getLocaleProfile: () =>
|
|
538
|
+
getLocale: () => A.tag,
|
|
539
|
+
getLocaleProfile: () => A,
|
|
503
540
|
isR1C1: () => !1,
|
|
504
541
|
getNow: () => 0,
|
|
505
542
|
getRandom: () => Math.random(),
|
|
@@ -508,12 +545,12 @@ var v = class {
|
|
|
508
545
|
getOS: () => "unknown",
|
|
509
546
|
getUser: () => "unidentified",
|
|
510
547
|
getDescription: () => "Stubbed Formula Context"
|
|
511
|
-
},
|
|
548
|
+
}, D = 2958465, O = new y(), k = class {
|
|
512
549
|
constructor() {
|
|
513
|
-
this._scope =
|
|
550
|
+
this._scope = O, this._argsFn = null;
|
|
514
551
|
}
|
|
515
552
|
_setScope(e) {
|
|
516
|
-
this._scope = e ??
|
|
553
|
+
this._scope = e ?? O;
|
|
517
554
|
}
|
|
518
555
|
_getScope() {
|
|
519
556
|
return this._scope;
|
|
@@ -525,7 +562,7 @@ var v = class {
|
|
|
525
562
|
return this._getScope().getNumberFormat(e, t);
|
|
526
563
|
}
|
|
527
564
|
getEntireCoords() {
|
|
528
|
-
return this._getScope().getEntireCoords() ??
|
|
565
|
+
return this._getScope().getEntireCoords() ?? T;
|
|
529
566
|
}
|
|
530
567
|
parseAsSerialDate(e, t) {
|
|
531
568
|
return this._getScope().parseAsSerialDate(e, t);
|
|
@@ -544,7 +581,7 @@ var v = class {
|
|
|
544
581
|
}
|
|
545
582
|
parseAsLiteral(e) {
|
|
546
583
|
let t = this._getScope();
|
|
547
|
-
return t.parseAsLiteral ? t.parseAsLiteral(e) :
|
|
584
|
+
return t.parseAsLiteral ? t.parseAsLiteral(e) : O.parseAsLiteral(e);
|
|
548
585
|
}
|
|
549
586
|
toText(e) {
|
|
550
587
|
return this._getScope().toText(e);
|
|
@@ -615,6 +652,9 @@ var v = class {
|
|
|
615
652
|
markVolatile() {
|
|
616
653
|
this._getScope().markVolatile?.();
|
|
617
654
|
}
|
|
655
|
+
defer(e, t) {
|
|
656
|
+
return this._getScope().defer?.(e, t);
|
|
657
|
+
}
|
|
618
658
|
formatResults(e) {
|
|
619
659
|
this._getScope().formatResults?.(e);
|
|
620
660
|
}
|
|
@@ -631,14 +671,18 @@ var v = class {
|
|
|
631
671
|
return this._getScope().getAddress(e, t);
|
|
632
672
|
}
|
|
633
673
|
compare(e, t, n) {
|
|
634
|
-
return this._getScope().compare?.(e, t, n) ??
|
|
674
|
+
return this._getScope().compare?.(e, t, n) ?? O.compare(e, t, n);
|
|
635
675
|
}
|
|
636
676
|
getRuntime() {
|
|
637
677
|
return this._getScope().getRuntime();
|
|
638
678
|
}
|
|
679
|
+
createRichData(e, t) {
|
|
680
|
+
let n = this._getScope();
|
|
681
|
+
return n.createRichData ? n.createRichData(e, t) : O.createRichData(e, t);
|
|
682
|
+
}
|
|
639
683
|
getArgs() {
|
|
640
684
|
let e = this._argsFn, t = e ? e() : null;
|
|
641
|
-
if (!t) throw new S
|
|
685
|
+
if (!t) throw new w(S);
|
|
642
686
|
return t;
|
|
643
687
|
}
|
|
644
688
|
get [Symbol.toStringTag]() {
|
|
@@ -647,7 +691,7 @@ var v = class {
|
|
|
647
691
|
toString() {
|
|
648
692
|
return this._getScope()?.toString?.() ?? "{STUB SCOPE}";
|
|
649
693
|
}
|
|
650
|
-
},
|
|
694
|
+
}, A = Object.freeze({
|
|
651
695
|
tag: "en-US",
|
|
652
696
|
numberingSystem: "latn",
|
|
653
697
|
decimal: ".",
|
|
@@ -727,5 +771,5 @@ var v = class {
|
|
|
727
771
|
sensitivity: "base",
|
|
728
772
|
numeric: !0
|
|
729
773
|
})
|
|
730
|
-
}),
|
|
731
|
-
export {
|
|
774
|
+
}), j = new k();
|
|
775
|
+
export { A as DEFAULT_LOCALE_PROFILE, j as FormulaContext, i as FormulaError, t as IRange, r as IRangeStats, o as InteropScalarType, v as Observable, e as Scalar, a as ScalarType, k as ScopedFormulaContext, y as StubbedFormulaContext, s as ValueKind, u as WildCard, d as isLazyValue };
|
package/node/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/primitives - Primitives - Base types for SheetXL functions. - v0.8.0-beta.13
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -21,6 +21,41 @@ var e;
|
|
|
21
21
|
}
|
|
22
22
|
return null === n ? e : n.join("");
|
|
23
23
|
};
|
|
24
|
+
const r = e.MIN_NUMBER = 22250738585072014e-324;
|
|
25
|
+
e.flushSubnormal = function(e) {
|
|
26
|
+
return e > -r && e < r ? 0 : e;
|
|
27
|
+
}, e.isNumberTextInRange = function(e, t = ".") {
|
|
28
|
+
const r = e.length;
|
|
29
|
+
if (r < 309 && e.indexOf("E") < 0 && e.indexOf("e") < 0) return !0;
|
|
30
|
+
const o = t.charCodeAt(0);
|
|
31
|
+
let n = !1, s = !1, a = !1, i = 0, c = 0, u = 0, l = 0;
|
|
32
|
+
for (; l < r; l++) {
|
|
33
|
+
const t = e.charCodeAt(l);
|
|
34
|
+
if (t >= 48 && t <= 57) n = !0, s ? (u++, a || (48 === t ? c++ : a = !0)) : (a || 48 !== t) && (a = !0, i++);
|
|
35
|
+
else if (t === o) s = !0;
|
|
36
|
+
else if ((69 === t || 101 === t) && n) break;
|
|
37
|
+
}
|
|
38
|
+
let d = 0;
|
|
39
|
+
if (l < r) {
|
|
40
|
+
let t = l + 1, o = !1;
|
|
41
|
+
const n = e.charCodeAt(t);
|
|
42
|
+
45 === n ? (o = !0, t++) : 43 === n && t++;
|
|
43
|
+
let s = 0;
|
|
44
|
+
for (; t < r; t++) {
|
|
45
|
+
const r = e.charCodeAt(t);
|
|
46
|
+
if (r < 48 || r > 57) break;
|
|
47
|
+
d = 10 * d + (r - 48), s++;
|
|
48
|
+
}
|
|
49
|
+
if (0 === s) return !0;
|
|
50
|
+
o && (d = -d);
|
|
51
|
+
}
|
|
52
|
+
if (a) {
|
|
53
|
+
const e = (i > 0 ? i - 1 : -(c + 1)) + d;
|
|
54
|
+
return e >= -309 && e <= 307;
|
|
55
|
+
}
|
|
56
|
+
const g = d - u;
|
|
57
|
+
return g >= -308 && g <= 308;
|
|
58
|
+
};
|
|
24
59
|
})(e || (e = {}));
|
|
25
60
|
var t, r, o, n, s = {
|
|
26
61
|
Number: "number",
|
|
@@ -225,7 +260,7 @@ var t, r, o, n, s = {
|
|
|
225
260
|
}
|
|
226
261
|
}
|
|
227
262
|
e.NA = g;
|
|
228
|
-
class
|
|
263
|
+
class h extends o {
|
|
229
264
|
constructor(e, o) {
|
|
230
265
|
super(t.GettingData, r.GettingData, e, o);
|
|
231
266
|
}
|
|
@@ -233,8 +268,8 @@ var t, r, o, n, s = {
|
|
|
233
268
|
this.code = n.Code.GettingData;
|
|
234
269
|
}
|
|
235
270
|
}
|
|
236
|
-
e.GettingData =
|
|
237
|
-
class
|
|
271
|
+
e.GettingData = h;
|
|
272
|
+
class p extends o {
|
|
238
273
|
constructor(e, o) {
|
|
239
274
|
super(t.Spill, r.Spill, e, o);
|
|
240
275
|
}
|
|
@@ -242,7 +277,7 @@ var t, r, o, n, s = {
|
|
|
242
277
|
this.code = n.Code.Spill;
|
|
243
278
|
}
|
|
244
279
|
}
|
|
245
|
-
e.Spill =
|
|
280
|
+
e.Spill = p;
|
|
246
281
|
class m extends o {
|
|
247
282
|
constructor(e, o) {
|
|
248
283
|
super(t.Connect, r.Connect, e, o);
|
|
@@ -270,7 +305,7 @@ var t, r, o, n, s = {
|
|
|
270
305
|
}
|
|
271
306
|
}
|
|
272
307
|
e.Unknown = C;
|
|
273
|
-
class
|
|
308
|
+
class f extends o {
|
|
274
309
|
constructor(e, o) {
|
|
275
310
|
super(t.Field, r.Field, e, o);
|
|
276
311
|
}
|
|
@@ -278,8 +313,8 @@ var t, r, o, n, s = {
|
|
|
278
313
|
this.code = n.Code.Field;
|
|
279
314
|
}
|
|
280
315
|
}
|
|
281
|
-
e.Field =
|
|
282
|
-
class
|
|
316
|
+
e.Field = f;
|
|
317
|
+
class b extends o {
|
|
283
318
|
constructor(e, o) {
|
|
284
319
|
super(t.Calc, r.Calc, e, o);
|
|
285
320
|
}
|
|
@@ -287,8 +322,8 @@ var t, r, o, n, s = {
|
|
|
287
322
|
this.code = n.Code.Calc;
|
|
288
323
|
}
|
|
289
324
|
}
|
|
290
|
-
e.Calc =
|
|
291
|
-
class
|
|
325
|
+
e.Calc = b;
|
|
326
|
+
class A extends o {
|
|
292
327
|
constructor(e, o) {
|
|
293
328
|
super(t.Busy, r.Busy, e, o);
|
|
294
329
|
}
|
|
@@ -296,7 +331,7 @@ var t, r, o, n, s = {
|
|
|
296
331
|
this.code = n.Code.Busy;
|
|
297
332
|
}
|
|
298
333
|
}
|
|
299
|
-
e.Busy =
|
|
334
|
+
e.Busy = A;
|
|
300
335
|
class N extends o {
|
|
301
336
|
constructor(e, o) {
|
|
302
337
|
super(t.Python, r.Python, e, o);
|
|
@@ -306,7 +341,7 @@ var t, r, o, n, s = {
|
|
|
306
341
|
}
|
|
307
342
|
}
|
|
308
343
|
e.Python = N;
|
|
309
|
-
class
|
|
344
|
+
class D extends o {
|
|
310
345
|
constructor(e, o) {
|
|
311
346
|
super(t.Timeout, r.Timeout, e, o);
|
|
312
347
|
}
|
|
@@ -314,17 +349,17 @@ var t, r, o, n, s = {
|
|
|
314
349
|
this.code = n.Code.Timeout;
|
|
315
350
|
}
|
|
316
351
|
}
|
|
317
|
-
e.Timeout =
|
|
352
|
+
e.Timeout = D;
|
|
318
353
|
}(n || (n = {}));
|
|
319
354
|
var g = {};
|
|
320
355
|
g[n.Code.Parse] = n.Parse, g[n.Code.Null] = n.Null, g[n.Code.Div0] = n.Div0, g[n.Code.Value] = n.Value, g[n.Code.Ref] = n.Ref, g[n.Code.Name] = n.Name, g[n.Code.Num] = n.Num, g[n.Code.NA] = n.NA, g[n.Code.GettingData] = n.GettingData, g[n.Code.Spill] = n.Spill, g[n.Code.Connect] = n.Connect, g[n.Code.Blocked] = n.Blocked, g[n.Code.Unknown] = n.Unknown, g[n.Code.Field] = n.Field, g[n.Code.Calc] = n.Calc, g[n.Code.Busy] = n.Busy, g[n.Code.Python] = n.Python, g[n.Code.Timeout] = n.Timeout;
|
|
321
|
-
var
|
|
356
|
+
var h = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), C = Object.keys(g);
|
|
322
357
|
for (let e = 0; e < C.length; e++) {
|
|
323
358
|
const t = g[C[e]], r = new t();
|
|
324
|
-
m.set(r.getLabel(), t), S.set(r.getCode(), t),
|
|
359
|
+
m.set(r.getLabel(), t), S.set(r.getCode(), t), h.set(r.getLabel(), r), p.set(r.getCode(), r);
|
|
325
360
|
}
|
|
326
361
|
(function(e) {
|
|
327
|
-
const t = e.getBuiltInByCode = (e) =>
|
|
362
|
+
const t = e.getBuiltInByCode = (e) => p.get(e);
|
|
328
363
|
e.BuiltIn = {
|
|
329
364
|
Parse: t(n.Code.Parse),
|
|
330
365
|
Null: t(n.Code.Null),
|
|
@@ -347,11 +382,11 @@ for (let e = 0; e < C.length; e++) {
|
|
|
347
382
|
}, e.newTypedError = (e, t, r) => {
|
|
348
383
|
let o;
|
|
349
384
|
return o = "string" == typeof e ? m.get(e) : S.get(e), o || (o = n.Unknown), new o(t, r);
|
|
350
|
-
}, e.getBuiltInByLabel = (e) =>
|
|
385
|
+
}, e.getBuiltInByLabel = (e) => h.get(e), e.isError = function(e, t) {
|
|
351
386
|
return !!e && !0 === e.isFormulaError && (void 0 === t || e.getCode() === t);
|
|
352
387
|
};
|
|
353
388
|
})(n || (n = {}));
|
|
354
|
-
var
|
|
389
|
+
var f = class {
|
|
355
390
|
constructor(e) {
|
|
356
391
|
this._subscribeFn = e;
|
|
357
392
|
}
|
|
@@ -371,36 +406,36 @@ var w = class {
|
|
|
371
406
|
"function" == typeof n && n();
|
|
372
407
|
}, o;
|
|
373
408
|
}
|
|
374
|
-
},
|
|
409
|
+
}, b = class {
|
|
375
410
|
createRange(e, t, r) {
|
|
376
|
-
throw
|
|
411
|
+
throw N("createRange");
|
|
377
412
|
}
|
|
378
413
|
flattenAreas(e) {
|
|
379
|
-
throw
|
|
414
|
+
throw N("flattenAreas");
|
|
380
415
|
}
|
|
381
416
|
getReference(e, t) {
|
|
382
|
-
throw
|
|
417
|
+
throw N("getReference");
|
|
383
418
|
}
|
|
384
419
|
getResizedReference(e, t, r) {
|
|
385
|
-
throw
|
|
420
|
+
throw N("getResizedReference");
|
|
386
421
|
}
|
|
387
422
|
getNumberFormat(e, t) {
|
|
388
|
-
throw
|
|
423
|
+
throw N("getNumberFormat");
|
|
389
424
|
}
|
|
390
425
|
fromSerialDate(e, t) {
|
|
391
|
-
throw
|
|
426
|
+
throw N("fromSerialDate");
|
|
392
427
|
}
|
|
393
428
|
toSerialDate(e, t) {
|
|
394
|
-
throw
|
|
429
|
+
throw N("toSerialDate");
|
|
395
430
|
}
|
|
396
431
|
getDateParts(e, t) {
|
|
397
|
-
throw
|
|
432
|
+
throw N("getDateParts");
|
|
398
433
|
}
|
|
399
434
|
getSerialDate(e, t, r, o, n, s, a) {
|
|
400
|
-
throw
|
|
435
|
+
throw N("getSerialDate");
|
|
401
436
|
}
|
|
402
437
|
getNow() {
|
|
403
|
-
throw
|
|
438
|
+
throw N("getNow");
|
|
404
439
|
}
|
|
405
440
|
getRandom() {
|
|
406
441
|
return Math.random();
|
|
@@ -409,10 +444,10 @@ var w = class {
|
|
|
409
444
|
return null;
|
|
410
445
|
}
|
|
411
446
|
getEntireCoords() {
|
|
412
|
-
return
|
|
447
|
+
return _;
|
|
413
448
|
}
|
|
414
449
|
isValidDate(e, t) {
|
|
415
|
-
return e instanceof Date || "[object Date]" === Object.prototype.toString.call(e) ? !isNaN(e.getTime()) : !t && "number" == typeof e && !(e < 0 || e >
|
|
450
|
+
return e instanceof Date || "[object Date]" === Object.prototype.toString.call(e) ? !isNaN(e.getTime()) : !t && "number" == typeof e && !(e < 0 || e > x);
|
|
416
451
|
}
|
|
417
452
|
getRow() {
|
|
418
453
|
return 0;
|
|
@@ -436,6 +471,7 @@ var w = class {
|
|
|
436
471
|
return 1;
|
|
437
472
|
}
|
|
438
473
|
markVolatile() {}
|
|
474
|
+
defer(e, t) {}
|
|
439
475
|
formatResults(e) {}
|
|
440
476
|
filterHidden(e, t) {
|
|
441
477
|
return e;
|
|
@@ -447,22 +483,22 @@ var w = class {
|
|
|
447
483
|
return null;
|
|
448
484
|
}
|
|
449
485
|
getAddress(e, t) {
|
|
450
|
-
throw
|
|
486
|
+
throw N("getAddress");
|
|
451
487
|
}
|
|
452
488
|
parseAsSerialDate(e, t) {
|
|
453
|
-
throw
|
|
489
|
+
throw N("parseAsSerialDate");
|
|
454
490
|
}
|
|
455
491
|
parseAsDate(e, t) {
|
|
456
|
-
throw
|
|
492
|
+
throw N("parseAsDate");
|
|
457
493
|
}
|
|
458
494
|
parseAsNumber(e, t) {
|
|
459
|
-
throw
|
|
495
|
+
throw N("parseAsNumber");
|
|
460
496
|
}
|
|
461
497
|
createCriteria(e, t) {
|
|
462
|
-
throw
|
|
498
|
+
throw N("createCriteria");
|
|
463
499
|
}
|
|
464
500
|
createGrouping(e, t) {
|
|
465
|
-
throw
|
|
501
|
+
throw N("createGrouping");
|
|
466
502
|
}
|
|
467
503
|
parseAsLiteral(e) {
|
|
468
504
|
const t = e.toUpperCase();
|
|
@@ -473,16 +509,19 @@ var w = class {
|
|
|
473
509
|
}
|
|
474
510
|
compare(e, t, r) {
|
|
475
511
|
if (e === t) return 0;
|
|
476
|
-
const o =
|
|
512
|
+
const o = A(e), n = A(t);
|
|
477
513
|
return o !== n ? o < n ? -1 : 1 : e < t ? -1 : e > t ? 1 : 0;
|
|
478
514
|
}
|
|
479
515
|
getRuntime() {
|
|
480
|
-
return
|
|
516
|
+
return R;
|
|
481
517
|
}
|
|
482
518
|
getArgs() {
|
|
483
|
-
throw new
|
|
519
|
+
throw new w(D);
|
|
520
|
+
}
|
|
521
|
+
createRichData(e, t) {
|
|
522
|
+
throw new w(y);
|
|
484
523
|
}
|
|
485
|
-
},
|
|
524
|
+
}, A = (e) => {
|
|
486
525
|
if (null == e) return 0;
|
|
487
526
|
switch (typeof e) {
|
|
488
527
|
case "number": return 1;
|
|
@@ -490,19 +529,19 @@ var w = class {
|
|
|
490
529
|
case "boolean": return 3;
|
|
491
530
|
default: return 4;
|
|
492
531
|
}
|
|
493
|
-
}, N = "FormulaContext.getArgs() is only valid while a function body is running",
|
|
532
|
+
}, N = (e) => new w(`FormulaContext.${e}() is only valid while a function body is running. A deferred executor reads its workbook through ctx.getFormulaContext().`), D = "FormulaContext.getArgs() is only valid while a function body is running", y = "FormulaContext.createRichData() needs a workbook being calculated", w = class extends Error {
|
|
494
533
|
constructor(e = "Not implemented in StubbedFormulaContext") {
|
|
495
534
|
super(e), this.name = "NotImplementedError";
|
|
496
535
|
}
|
|
497
|
-
},
|
|
536
|
+
}, _ = Object.freeze({
|
|
498
537
|
colStart: 0,
|
|
499
538
|
rowStart: 0,
|
|
500
539
|
colEnd: Math.pow(2, 14) - 1,
|
|
501
540
|
rowEnd: Math.pow(2, 20) - 1
|
|
502
|
-
}),
|
|
541
|
+
}), R = {
|
|
503
542
|
isDate1904: () => !1,
|
|
504
|
-
getLocale: () =>
|
|
505
|
-
getLocaleProfile: () =>
|
|
543
|
+
getLocale: () => k.tag,
|
|
544
|
+
getLocaleProfile: () => k,
|
|
506
545
|
isR1C1: () => !1,
|
|
507
546
|
getNow: () => 0,
|
|
508
547
|
getRandom: () => Math.random(),
|
|
@@ -511,12 +550,12 @@ var w = class {
|
|
|
511
550
|
getOS: () => "unknown",
|
|
512
551
|
getUser: () => "unidentified",
|
|
513
552
|
getDescription: () => "Stubbed Formula Context"
|
|
514
|
-
},
|
|
553
|
+
}, x = 2958465, F = new b(), T = class {
|
|
515
554
|
constructor() {
|
|
516
|
-
this._scope =
|
|
555
|
+
this._scope = F, this._argsFn = null;
|
|
517
556
|
}
|
|
518
557
|
_setScope(e) {
|
|
519
|
-
this._scope = e ??
|
|
558
|
+
this._scope = e ?? F;
|
|
520
559
|
}
|
|
521
560
|
_getScope() {
|
|
522
561
|
return this._scope;
|
|
@@ -528,7 +567,7 @@ var w = class {
|
|
|
528
567
|
return this._getScope().getNumberFormat(e, t);
|
|
529
568
|
}
|
|
530
569
|
getEntireCoords() {
|
|
531
|
-
return this._getScope().getEntireCoords() ??
|
|
570
|
+
return this._getScope().getEntireCoords() ?? _;
|
|
532
571
|
}
|
|
533
572
|
parseAsSerialDate(e, t) {
|
|
534
573
|
return this._getScope().parseAsSerialDate(e, t);
|
|
@@ -547,7 +586,7 @@ var w = class {
|
|
|
547
586
|
}
|
|
548
587
|
parseAsLiteral(e) {
|
|
549
588
|
const t = this._getScope();
|
|
550
|
-
return t.parseAsLiteral ? t.parseAsLiteral(e) :
|
|
589
|
+
return t.parseAsLiteral ? t.parseAsLiteral(e) : F.parseAsLiteral(e);
|
|
551
590
|
}
|
|
552
591
|
toText(e) {
|
|
553
592
|
return this._getScope().toText(e);
|
|
@@ -618,6 +657,9 @@ var w = class {
|
|
|
618
657
|
markVolatile() {
|
|
619
658
|
this._getScope().markVolatile?.();
|
|
620
659
|
}
|
|
660
|
+
defer(e, t) {
|
|
661
|
+
return this._getScope().defer?.(e, t);
|
|
662
|
+
}
|
|
621
663
|
formatResults(e) {
|
|
622
664
|
this._getScope().formatResults?.(e);
|
|
623
665
|
}
|
|
@@ -634,14 +676,18 @@ var w = class {
|
|
|
634
676
|
return this._getScope().getAddress(e, t);
|
|
635
677
|
}
|
|
636
678
|
compare(e, t, r) {
|
|
637
|
-
return this._getScope().compare?.(e, t, r) ??
|
|
679
|
+
return this._getScope().compare?.(e, t, r) ?? F.compare(e, t, r);
|
|
638
680
|
}
|
|
639
681
|
getRuntime() {
|
|
640
682
|
return this._getScope().getRuntime();
|
|
641
683
|
}
|
|
684
|
+
createRichData(e, t) {
|
|
685
|
+
const r = this._getScope();
|
|
686
|
+
return r.createRichData ? r.createRichData(e, t) : F.createRichData(e, t);
|
|
687
|
+
}
|
|
642
688
|
getArgs() {
|
|
643
689
|
const e = this._argsFn, t = e ? e() : null;
|
|
644
|
-
if (!t) throw new
|
|
690
|
+
if (!t) throw new w(D);
|
|
645
691
|
return t;
|
|
646
692
|
}
|
|
647
693
|
get [Symbol.toStringTag]() {
|
|
@@ -650,7 +696,7 @@ var w = class {
|
|
|
650
696
|
toString() {
|
|
651
697
|
return this._getScope()?.toString?.() ?? "{STUB SCOPE}";
|
|
652
698
|
}
|
|
653
|
-
},
|
|
699
|
+
}, k = Object.freeze({
|
|
654
700
|
tag: "en-US",
|
|
655
701
|
numberingSystem: "latn",
|
|
656
702
|
decimal: ".",
|
|
@@ -730,5 +776,5 @@ var w = class {
|
|
|
730
776
|
sensitivity: "base",
|
|
731
777
|
numeric: !0
|
|
732
778
|
})
|
|
733
|
-
}),
|
|
734
|
-
export {
|
|
779
|
+
}), P = new T();
|
|
780
|
+
export { k as DEFAULT_LOCALE_PROFILE, P as FormulaContext, n as FormulaError, t as IRange, o as IRangeStats, a as InteropScalarType, f as Observable, e as Scalar, s as ScalarType, T as ScopedFormulaContext, b as StubbedFormulaContext, i as ValueKind, l as WildCard, d as isLazyValue };
|
package/package.json
CHANGED
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
* if (range.hasError()) return range.firstError();
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
|
-
* placed before its own validation where
|
|
27
|
+
* placed before its own validation where the member's error outranks it (`LARGE(range-with-#N/A, 0)`
|
|
28
28
|
* is `#N/A`, not `#NUM!`). Aggregators and consumers say it; reshapers and lookups, whose members
|
|
29
29
|
* pass through or are never read, need no line at all. Where a function takes several ranges the
|
|
30
30
|
* lines run in ARGUMENT order — the whole of argument N before N+1, row-major within — which is
|
|
31
|
-
*
|
|
31
|
+
* the which-error-wins order, and a function that pairs its ranges (the paired
|
|
32
32
|
* statistics) orders its own scan the way it pairs.
|
|
33
33
|
*
|
|
34
34
|
* > *A bare error propagates unless your function opts in to seeing it; the members of a range
|
package/types/src/Flatten.d.ts
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* Both are the same mechanism at different granularity — the marshaller picks the unit from the
|
|
20
20
|
* element type — and a blank drops out of either. The scalar case is the common one; the range case
|
|
21
21
|
* exists because a reference UNION is a single argument holding several areas: a parameter that does
|
|
22
|
-
* not declare `Flatten` refuses one outright (`#VALUE!` — `TRANSPOSE((A1:A3,C1:C3))`
|
|
23
|
-
* body that declares it answers for the union itself, in one line, the way
|
|
22
|
+
* not declare `Flatten` refuses one outright (`#VALUE!` — `TRANSPOSE((A1:A3,C1:C3))`), and a
|
|
23
|
+
* body that declares it answers for the union itself, in one line, the way the built-ins do:
|
|
24
24
|
* `AREAS` counts the areas, `SUM` adds them, `ROWS` answers `#REF!` to more than one, the lookups
|
|
25
25
|
* `#N/A`.
|
|
26
26
|
*
|