@sheetxl/primitives 0.8.0-beta.2 → 0.8.0-beta.21
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/LICENSE.md +17 -7
- package/browser/esm/index.mjs +92 -42
- package/node/esm/index.mjs +113 -59
- package/package.json +4 -5
- package/types/src/ErrorPolicy.d.ts +2 -2
- package/types/src/Flatten.d.ts +2 -2
- package/types/src/FormulaContext.d.ts +31 -11
- package/types/src/FormulaError.d.ts +1 -1
- package/types/src/IFormulaContext.d.ts +460 -28
- package/types/src/IFunction.d.ts +47 -59
- package/types/src/IFunctionArguments.d.ts +25 -4
- package/types/src/IRange.d.ts +22 -4
- package/types/src/IRangeStats.d.ts +8 -7
- package/types/src/IRichData.d.ts +47 -7
- 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/cjs/index.cjs +0 -1
package/node/esm/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License:
|
|
5
|
+
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
var e;
|
|
8
8
|
(function(e) {
|
|
@@ -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 A 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 = A;
|
|
326
|
+
class b 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 = b;
|
|
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
|
+
}, A = 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;
|
|
@@ -435,7 +470,7 @@ var w = class {
|
|
|
435
470
|
getSheetCount() {
|
|
436
471
|
return 1;
|
|
437
472
|
}
|
|
438
|
-
|
|
473
|
+
defer(e, t) {}
|
|
439
474
|
formatResults(e) {}
|
|
440
475
|
filterHidden(e, t) {
|
|
441
476
|
return e;
|
|
@@ -447,19 +482,25 @@ var w = class {
|
|
|
447
482
|
return null;
|
|
448
483
|
}
|
|
449
484
|
getAddress(e, t) {
|
|
450
|
-
throw
|
|
485
|
+
throw N("getAddress");
|
|
451
486
|
}
|
|
452
487
|
parseAsSerialDate(e, t) {
|
|
453
|
-
throw
|
|
488
|
+
throw N("parseAsSerialDate");
|
|
454
489
|
}
|
|
455
490
|
parseAsDate(e, t) {
|
|
456
|
-
throw
|
|
491
|
+
throw N("parseAsDate");
|
|
457
492
|
}
|
|
458
493
|
parseAsNumber(e, t) {
|
|
459
|
-
throw
|
|
494
|
+
throw N("parseAsNumber");
|
|
460
495
|
}
|
|
461
496
|
createCriteria(e, t) {
|
|
462
|
-
throw
|
|
497
|
+
throw N("createCriteria");
|
|
498
|
+
}
|
|
499
|
+
createPivot(e, t, r) {
|
|
500
|
+
throw N("createPivot");
|
|
501
|
+
}
|
|
502
|
+
getPivotAt(e) {
|
|
503
|
+
return null;
|
|
463
504
|
}
|
|
464
505
|
parseAsLiteral(e) {
|
|
465
506
|
const t = e.toUpperCase();
|
|
@@ -470,16 +511,19 @@ var w = class {
|
|
|
470
511
|
}
|
|
471
512
|
compare(e, t, r) {
|
|
472
513
|
if (e === t) return 0;
|
|
473
|
-
const o =
|
|
514
|
+
const o = b(e), n = b(t);
|
|
474
515
|
return o !== n ? o < n ? -1 : 1 : e < t ? -1 : e > t ? 1 : 0;
|
|
475
516
|
}
|
|
476
517
|
getRuntime() {
|
|
477
|
-
return
|
|
518
|
+
return R;
|
|
478
519
|
}
|
|
479
520
|
getArgs() {
|
|
480
|
-
throw new
|
|
521
|
+
throw new w(D);
|
|
522
|
+
}
|
|
523
|
+
createRichData(e, t) {
|
|
524
|
+
throw new w(y);
|
|
481
525
|
}
|
|
482
|
-
},
|
|
526
|
+
}, b = (e) => {
|
|
483
527
|
if (null == e) return 0;
|
|
484
528
|
switch (typeof e) {
|
|
485
529
|
case "number": return 1;
|
|
@@ -487,19 +531,19 @@ var w = class {
|
|
|
487
531
|
case "boolean": return 3;
|
|
488
532
|
default: return 4;
|
|
489
533
|
}
|
|
490
|
-
}, N = "FormulaContext.getArgs() is only valid while a function body is running",
|
|
534
|
+
}, 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 {
|
|
491
535
|
constructor(e = "Not implemented in StubbedFormulaContext") {
|
|
492
536
|
super(e), this.name = "NotImplementedError";
|
|
493
537
|
}
|
|
494
|
-
},
|
|
538
|
+
}, _ = Object.freeze({
|
|
495
539
|
colStart: 0,
|
|
496
540
|
rowStart: 0,
|
|
497
541
|
colEnd: Math.pow(2, 14) - 1,
|
|
498
542
|
rowEnd: Math.pow(2, 20) - 1
|
|
499
|
-
}),
|
|
543
|
+
}), R = {
|
|
500
544
|
isDate1904: () => !1,
|
|
501
|
-
getLocale: () =>
|
|
502
|
-
getLocaleProfile: () =>
|
|
545
|
+
getLocale: () => T.tag,
|
|
546
|
+
getLocaleProfile: () => T,
|
|
503
547
|
isR1C1: () => !1,
|
|
504
548
|
getNow: () => 0,
|
|
505
549
|
getRandom: () => Math.random(),
|
|
@@ -508,12 +552,12 @@ var w = class {
|
|
|
508
552
|
getOS: () => "unknown",
|
|
509
553
|
getUser: () => "unidentified",
|
|
510
554
|
getDescription: () => "Stubbed Formula Context"
|
|
511
|
-
},
|
|
555
|
+
}, x = 2958465, F = new A(), P = class {
|
|
512
556
|
constructor() {
|
|
513
|
-
this._scope =
|
|
557
|
+
this._scope = F, this._argsFn = null;
|
|
514
558
|
}
|
|
515
559
|
_setScope(e) {
|
|
516
|
-
this._scope = e ??
|
|
560
|
+
this._scope = e ?? F;
|
|
517
561
|
}
|
|
518
562
|
_getScope() {
|
|
519
563
|
return this._scope;
|
|
@@ -525,7 +569,7 @@ var w = class {
|
|
|
525
569
|
return this._getScope().getNumberFormat(e, t);
|
|
526
570
|
}
|
|
527
571
|
getEntireCoords() {
|
|
528
|
-
return this._getScope().getEntireCoords() ??
|
|
572
|
+
return this._getScope().getEntireCoords() ?? _;
|
|
529
573
|
}
|
|
530
574
|
parseAsSerialDate(e, t) {
|
|
531
575
|
return this._getScope().parseAsSerialDate(e, t);
|
|
@@ -539,9 +583,15 @@ var w = class {
|
|
|
539
583
|
createCriteria(e, t) {
|
|
540
584
|
return this._getScope().createCriteria(e, t);
|
|
541
585
|
}
|
|
586
|
+
createPivot(e, t, r) {
|
|
587
|
+
return this._getScope().createPivot(e, t, r);
|
|
588
|
+
}
|
|
589
|
+
getPivotAt(e) {
|
|
590
|
+
return this._getScope().getPivotAt?.(e) ?? null;
|
|
591
|
+
}
|
|
542
592
|
parseAsLiteral(e) {
|
|
543
593
|
const t = this._getScope();
|
|
544
|
-
return t.parseAsLiteral ? t.parseAsLiteral(e) :
|
|
594
|
+
return t.parseAsLiteral ? t.parseAsLiteral(e) : F.parseAsLiteral(e);
|
|
545
595
|
}
|
|
546
596
|
toText(e) {
|
|
547
597
|
return this._getScope().toText(e);
|
|
@@ -609,8 +659,8 @@ var w = class {
|
|
|
609
659
|
getSheetCount() {
|
|
610
660
|
return this._getScope().getSheetCount?.() ?? 1;
|
|
611
661
|
}
|
|
612
|
-
|
|
613
|
-
this._getScope().
|
|
662
|
+
defer(e, t) {
|
|
663
|
+
return this._getScope().defer?.(e, t);
|
|
614
664
|
}
|
|
615
665
|
formatResults(e) {
|
|
616
666
|
this._getScope().formatResults?.(e);
|
|
@@ -628,14 +678,18 @@ var w = class {
|
|
|
628
678
|
return this._getScope().getAddress(e, t);
|
|
629
679
|
}
|
|
630
680
|
compare(e, t, r) {
|
|
631
|
-
return this._getScope().compare?.(e, t, r) ??
|
|
681
|
+
return this._getScope().compare?.(e, t, r) ?? F.compare(e, t, r);
|
|
632
682
|
}
|
|
633
683
|
getRuntime() {
|
|
634
684
|
return this._getScope().getRuntime();
|
|
635
685
|
}
|
|
686
|
+
createRichData(e, t) {
|
|
687
|
+
const r = this._getScope();
|
|
688
|
+
return r.createRichData ? r.createRichData(e, t) : F.createRichData(e, t);
|
|
689
|
+
}
|
|
636
690
|
getArgs() {
|
|
637
691
|
const e = this._argsFn, t = e ? e() : null;
|
|
638
|
-
if (!t) throw new
|
|
692
|
+
if (!t) throw new w(D);
|
|
639
693
|
return t;
|
|
640
694
|
}
|
|
641
695
|
get [Symbol.toStringTag]() {
|
|
@@ -644,7 +698,7 @@ var w = class {
|
|
|
644
698
|
toString() {
|
|
645
699
|
return this._getScope()?.toString?.() ?? "{STUB SCOPE}";
|
|
646
700
|
}
|
|
647
|
-
},
|
|
701
|
+
}, T = Object.freeze({
|
|
648
702
|
tag: "en-US",
|
|
649
703
|
numberingSystem: "latn",
|
|
650
704
|
decimal: ".",
|
|
@@ -724,5 +778,5 @@ var w = class {
|
|
|
724
778
|
sensitivity: "base",
|
|
725
779
|
numeric: !0
|
|
726
780
|
})
|
|
727
|
-
}),
|
|
728
|
-
export {
|
|
781
|
+
}), v = new P();
|
|
782
|
+
export { T as DEFAULT_LOCALE_PROFILE, v as FormulaContext, n as FormulaError, t as IRange, o as IRangeStats, a as InteropScalarType, f as Observable, e as Scalar, s as ScalarType, P as ScopedFormulaContext, A as StubbedFormulaContext, i as ValueKind, l as WildCard, d as isLazyValue };
|
package/package.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/primitives",
|
|
3
3
|
"description": "Primitives - Base types for SheetXL functions.",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
5
|
-
"license": "
|
|
4
|
+
"version": "0.8.0-beta.21",
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
10
10
|
"browser": "./browser/esm/index.mjs",
|
|
11
11
|
"node": "./node/esm/index.mjs",
|
|
12
|
-
"
|
|
13
|
-
"require": "./browser/cjs/index.cjs"
|
|
12
|
+
"default": "./browser/esm/index.mjs"
|
|
14
13
|
}
|
|
15
14
|
},
|
|
16
15
|
"types": "./types/index.d.ts",
|
|
17
16
|
"module": "./browser/esm/index.mjs",
|
|
18
|
-
"main": "./browser/
|
|
17
|
+
"main": "./browser/esm/index.mjs",
|
|
19
18
|
"sideEffects": false,
|
|
20
19
|
"engines": {
|
|
21
20
|
"node": ">=22"
|
|
@@ -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
|
*
|
|
@@ -6,6 +6,7 @@ import { IFunction } from './IFunction';
|
|
|
6
6
|
import { IFunctionArguments } from './IFunctionArguments';
|
|
7
7
|
import { IFormulaContext } from './IFormulaContext';
|
|
8
8
|
import { IRuntime } from './IRuntime';
|
|
9
|
+
import { IRichData } from './IRichData';
|
|
9
10
|
import { LocaleProfile } from './LocaleProfile';
|
|
10
11
|
/**
|
|
11
12
|
* Default implementation of the IFormulaContext interface.
|
|
@@ -61,12 +62,12 @@ export declare class StubbedFormulaContext implements IFormulaContext {
|
|
|
61
62
|
getSheetIndex(sheet?: string | IReferenceRange): number;
|
|
62
63
|
/** @inheritdoc IFormulaContext.getSheetCount */
|
|
63
64
|
getSheetCount(): number | null;
|
|
64
|
-
/** @inheritdoc IFormulaContext.
|
|
65
|
-
|
|
65
|
+
/** @inheritdoc IFormulaContext.defer */
|
|
66
|
+
defer(_executor: IFormulaContext.DeferExecutor, _payload?: unknown): unknown;
|
|
66
67
|
/** @inheritdoc IFormulaContext.formatResults */
|
|
67
68
|
formatResults(numFmt: string): void;
|
|
68
69
|
/** @inheritdoc IFormulaContext.filterHidden */
|
|
69
|
-
filterHidden(range: IRange,
|
|
70
|
+
filterHidden(range: IRange, options?: IFormulaContext.FilterHiddenOptions): IRange;
|
|
70
71
|
/** @inheritdoc IFormulaContext.filterTotals */
|
|
71
72
|
filterTotals(range: IRange): IRange;
|
|
72
73
|
/** @inheritdoc IFormulaContext.getFunction */
|
|
@@ -90,6 +91,17 @@ export declare class StubbedFormulaContext implements IFormulaContext {
|
|
|
90
91
|
* installed scope).
|
|
91
92
|
*/
|
|
92
93
|
createCriteria(criteria: Scalar, options?: IFormulaContext.CriteriaOptions): IFormulaContext.CriteriaEvaluator;
|
|
94
|
+
/**
|
|
95
|
+
* Unimplemented. See {@link IFormulaContext.createPivot}.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* A pivot needs the engine's key equality, which this stub does not have.
|
|
99
|
+
*/
|
|
100
|
+
createPivot(rows: IRange | null, columns: IRange | null, options?: IFormulaContext.PivotOptions): IFormulaContext.Pivot;
|
|
101
|
+
/**
|
|
102
|
+
* No pivot tables. See {@link IFormulaContext.getPivotAt}.
|
|
103
|
+
*/
|
|
104
|
+
getPivotAt(_reference: IReferenceRange): IFormulaContext.PivotView | null;
|
|
93
105
|
/**
|
|
94
106
|
* Parses the canonical English boolean and error literals.
|
|
95
107
|
* See {@link IFormulaContext.parseAsLiteral}.
|
|
@@ -105,15 +117,15 @@ export declare class StubbedFormulaContext implements IFormulaContext {
|
|
|
105
117
|
* Renders a scalar as text. See {@link IFormulaContext.toText}.
|
|
106
118
|
*
|
|
107
119
|
* @remarks
|
|
108
|
-
* A BASIC rendering, deliberately NOT
|
|
120
|
+
* A BASIC rendering, deliberately NOT the engine's. The engine's rule -- coercion General (15
|
|
109
121
|
* significant digits, plain decimal while the rendering fits 20 characters, else
|
|
110
122
|
* scientific) written with the workbook LOCALE's decimal separator -- is
|
|
111
123
|
* `formatNumberGeneral` in `@sheetxl/sdk`, and every evaluation path reaches it through
|
|
112
124
|
* the calculation context rather than through this stub. Numbers here get the plain JS
|
|
113
|
-
* rendering, which diverges from
|
|
125
|
+
* rendering, which diverges from the engine on both precision and separator.
|
|
114
126
|
*
|
|
115
127
|
* This exists so authoring, type defs and other non-runtime access get usable text
|
|
116
|
-
* instead of throwing. Anything that needs
|
|
128
|
+
* instead of throwing. Anything that needs the full rule is running in the engine, and
|
|
117
129
|
* the engine never lands here.
|
|
118
130
|
*/
|
|
119
131
|
toText(value: Scalar | undefined): string;
|
|
@@ -121,14 +133,14 @@ export declare class StubbedFormulaContext implements IFormulaContext {
|
|
|
121
133
|
* Orders two scalars. See {@link IFormulaContext.compare}.
|
|
122
134
|
*
|
|
123
135
|
* @remarks
|
|
124
|
-
* A BASIC total order, deliberately NOT
|
|
136
|
+
* A BASIC total order, deliberately NOT the engine's. The engine's rule -- locale collation, the word
|
|
125
137
|
* sort, a blank taking the other operand's type, 11-decimal numeric normalization -- is
|
|
126
138
|
* `ScalarCollation` in `@sheetxl/sdk`, and every evaluation path reaches it through the
|
|
127
139
|
* calculation context rather than through this stub. `options` is ignored: strength is a
|
|
128
140
|
* collation concept and nothing here collates.
|
|
129
141
|
*
|
|
130
142
|
* This exists so authoring, type defs and other non-runtime access get a usable ordering
|
|
131
|
-
* instead of throwing. Anything that needs
|
|
143
|
+
* instead of throwing. Anything that needs the full rule is running in the engine, and the
|
|
132
144
|
* engine never lands here.
|
|
133
145
|
*/
|
|
134
146
|
compare(a: Scalar, b: Scalar, options?: Intl.CollatorOptions): number;
|
|
@@ -136,6 +148,8 @@ export declare class StubbedFormulaContext implements IFormulaContext {
|
|
|
136
148
|
getRuntime(): IRuntime;
|
|
137
149
|
/** @inheritdoc IFormulaContext.getArgs */
|
|
138
150
|
getArgs(): IFunctionArguments;
|
|
151
|
+
/** @inheritdoc IFormulaContext.createRichData */
|
|
152
|
+
createRichData(_type: string, _data?: any): IRichData;
|
|
139
153
|
}
|
|
140
154
|
/**
|
|
141
155
|
* The single, shared {@link IFormulaContext} that formula implementations use (via
|
|
@@ -178,6 +192,10 @@ export declare class ScopedFormulaContext implements IFormulaContext {
|
|
|
178
192
|
parseAsNumber(textOrNumber: Scalar | undefined, options?: IFormulaContext.ParseNumberOptions): number | undefined;
|
|
179
193
|
/** @inheritdoc IFormulaContext.createCriteria */
|
|
180
194
|
createCriteria(criteria: Scalar, options?: IFormulaContext.CriteriaOptions): IFormulaContext.CriteriaEvaluator;
|
|
195
|
+
/** @inheritdoc IFormulaContext.createPivot */
|
|
196
|
+
createPivot(rows: IRange | null, columns: IRange | null, options?: IFormulaContext.PivotOptions): IFormulaContext.Pivot;
|
|
197
|
+
/** @inheritdoc IFormulaContext.getPivotAt */
|
|
198
|
+
getPivotAt(reference: IReferenceRange): IFormulaContext.PivotView | null;
|
|
181
199
|
/** @inheritdoc IFormulaContext.parseAsLiteral */
|
|
182
200
|
parseAsLiteral(text: string): boolean | FormulaError.Known | undefined;
|
|
183
201
|
/** @inheritdoc IFormulaContext.toText */
|
|
@@ -220,12 +238,12 @@ export declare class ScopedFormulaContext implements IFormulaContext {
|
|
|
220
238
|
getSheetIndex(sheet?: string | IReferenceRange): number;
|
|
221
239
|
/** @inheritdoc IFormulaContext.getSheetCount */
|
|
222
240
|
getSheetCount(): number | null;
|
|
223
|
-
/** @inheritdoc IFormulaContext.
|
|
224
|
-
|
|
241
|
+
/** @inheritdoc IFormulaContext.defer */
|
|
242
|
+
defer(executor: IFormulaContext.DeferExecutor, payload?: unknown): unknown;
|
|
225
243
|
/** @inheritdoc IFormulaContext.formatResults */
|
|
226
244
|
formatResults(numFmt: string): void;
|
|
227
245
|
/** @inheritdoc IFormulaContext.filterHidden */
|
|
228
|
-
filterHidden(range: IRange,
|
|
246
|
+
filterHidden(range: IRange, options?: IFormulaContext.FilterHiddenOptions): IRange;
|
|
229
247
|
/** @inheritdoc IFormulaContext.filterTotals */
|
|
230
248
|
filterTotals(range: IRange): IRange;
|
|
231
249
|
/** @inheritdoc IFormulaContext.getFunction */
|
|
@@ -236,6 +254,8 @@ export declare class ScopedFormulaContext implements IFormulaContext {
|
|
|
236
254
|
compare(a: Scalar, b: Scalar, options?: Intl.CollatorOptions): number;
|
|
237
255
|
/** @inheritdoc IFormulaContext.getRuntime */
|
|
238
256
|
getRuntime(): IRuntime;
|
|
257
|
+
/** @inheritdoc IFormulaContext.createRichData */
|
|
258
|
+
createRichData(type: string, data?: any): IRichData;
|
|
239
259
|
/** @inheritdoc IFormulaContext.getArgs */
|
|
240
260
|
getArgs(): IFunctionArguments;
|
|
241
261
|
get [Symbol.toStringTag](): string;
|
|
@@ -20,7 +20,7 @@ import { IReferenceRange } from './IReferenceRange';
|
|
|
20
20
|
*
|
|
21
21
|
* SpillErrorScalarSubType | "Unknown" | "Collision" | "IndeterminateSize" | "WorksheetEdge" | "OutOfMemoryWhileCalc" | "Table" | "MergedCell"
|
|
22
22
|
* # Office 2023
|
|
23
|
-
* 10. #CONNECT! This occurs when a data type is used that is not currently supported
|
|
23
|
+
* 10. #CONNECT! This occurs when a data type is used that is not currently supported.
|
|
24
24
|
* 11. #BLOCKED! Indicates that an action or feature is blocked, possibly due to security settings, protected view, or other restrictions. Often related to online features, external links, or macros.
|
|
25
25
|
* 12. #UNKNOWN! May be returned in the case of a protected workbook.
|
|
26
26
|
* 13. #FIELD! Invalid field name for a data type.
|