@a3s-lab/office 0.43.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -1
- package/dist/0~1403.js +1 -1
- package/dist/0~2330.js +2 -2
- package/dist/0~3539.js +2 -2
- package/dist/0~3557.js +1 -1
- package/dist/{0~5024.js → 0~4042.js} +111 -3
- package/dist/0~4980.js +1 -1
- package/dist/0~7828.js +1 -1
- package/dist/{0~7048.js → 0~7831.js} +2 -547
- package/dist/0~document-editor.js +154 -5
- package/dist/{0~3635.js → 0~office-color-picker.js} +1 -12
- package/dist/0~pdf-viewer.js +22 -8
- package/dist/0~presentation-editor.js +4 -3
- package/dist/0~spreadsheet-editor.js +200 -3669
- package/dist/0~work-docx-export.js +11 -8
- package/dist/0~work-docx-import.js +11 -5
- package/dist/0~work-office-diagnostics.js +14 -3
- package/dist/0~work-pptx-export.js +1 -1
- package/dist/0~work-pptx-import.js +1 -1
- package/dist/0~work-presentation-charts.js +1 -1
- package/dist/3818.js +1 -1
- package/dist/4166.js +1 -1
- package/dist/4174.js +112 -4
- package/dist/4560.js +2 -2
- package/dist/{5416.js → 610.js} +4335 -410
- package/dist/{4121.js → 6968.js} +622 -13
- package/dist/7060.js +1 -1
- package/dist/{4650.js → 816.js} +12 -1
- package/dist/8715.js +1 -1
- package/dist/9333.js +17 -17
- package/dist/core.js +7 -5
- package/dist/index.js +2 -2
- package/dist/internal/features/work/editors/document-picture-properties-dialog-model.d.ts +4 -1
- package/dist/internal/features/work/editors/spreadsheet-data-validation-list.d.ts +44 -0
- package/dist/internal/features/work/editors/spreadsheet-data-validation.d.ts +2 -1
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +1 -1
- package/dist/internal/features/work/work-document-image-layout.d.ts +14 -0
- package/dist/internal/features/work/work-docx-export-image.d.ts +2 -1
- package/dist/internal/features/work/work-docx-image-layout-import.d.ts +2 -1
- package/dist/internal/features/work/work-docx-image-transform.d.ts +17 -0
- package/dist/internal/features/work/work-types.d.ts +4 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +51 -3
- package/docs/latest/en/browser-editor-architecture.md +7 -3
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { Check, ChevronDown, ChevronUp, Minus } from "lucide-react";
|
|
4
4
|
import { button_Button, office_text_field_OfficeTextArea, office_text_field_OfficeTextField, Dialog } from "./0~8136.js";
|
|
5
|
-
import { OFFICE_KERNEL_SPREADSHEET_MAX_ROWS as office_kernel_spreadsheet_protocol_OFFICE_KERNEL_SPREADSHEET_MAX_ROWS,
|
|
5
|
+
import { isOfficeKernelSpreadsheetError, browserScalarFunctionArities, evaluateParserSubtotal, OFFICE_KERNEL_SPREADSHEET_MAX_ROWS as office_kernel_spreadsheet_protocol_OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, normalizeSpreadsheetFunctionName, normalizeFormulaForFortuneParser } from "./6968.js";
|
|
6
6
|
function CollectionState({ children, icon, actions, tone = 'neutral', role, className = '' }) {
|
|
7
7
|
return /*#__PURE__*/ jsxs("div", {
|
|
8
8
|
className: `ds-collection-state ${tone}${className ? ` ${className}` : ''}`,
|
|
@@ -467,215 +467,6 @@ function OfficeCheckbox({ ariaLabel, checked, onCheckedChange, children, disable
|
|
|
467
467
|
]
|
|
468
468
|
});
|
|
469
469
|
}
|
|
470
|
-
const officeFontFamilies = [
|
|
471
|
-
{
|
|
472
|
-
id: 'microsoft-yahei',
|
|
473
|
-
name: 'Microsoft YaHei',
|
|
474
|
-
cssValue: '"Microsoft YaHei"',
|
|
475
|
-
cssFamily: '"Microsoft YaHei", "PingFang SC", sans-serif',
|
|
476
|
-
label: '微软雅黑',
|
|
477
|
-
group: '中文字体'
|
|
478
|
-
},
|
|
479
|
-
{
|
|
480
|
-
id: 'pingfang-sc',
|
|
481
|
-
name: 'PingFang SC',
|
|
482
|
-
cssValue: '"PingFang SC"',
|
|
483
|
-
cssFamily: '"PingFang SC", "Microsoft YaHei", sans-serif',
|
|
484
|
-
label: '苹方',
|
|
485
|
-
group: '中文字体'
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
id: 'simsun',
|
|
489
|
-
name: 'SimSun',
|
|
490
|
-
cssValue: 'SimSun',
|
|
491
|
-
cssFamily: 'SimSun, "Songti SC", serif',
|
|
492
|
-
label: '宋体',
|
|
493
|
-
group: '中文字体'
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
id: 'stsong',
|
|
497
|
-
name: 'STSong',
|
|
498
|
-
cssValue: 'STSong',
|
|
499
|
-
cssFamily: 'STSong, "Songti SC", SimSun, serif',
|
|
500
|
-
label: '华文宋体',
|
|
501
|
-
group: '中文字体'
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
id: 'simhei',
|
|
505
|
-
name: 'SimHei',
|
|
506
|
-
cssValue: 'SimHei',
|
|
507
|
-
cssFamily: 'SimHei, "Heiti SC", sans-serif',
|
|
508
|
-
label: '黑体',
|
|
509
|
-
group: '中文字体'
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
id: 'stheiti',
|
|
513
|
-
name: 'STHeiti',
|
|
514
|
-
cssValue: 'STHeiti',
|
|
515
|
-
cssFamily: 'STHeiti, "Heiti SC", SimHei, sans-serif',
|
|
516
|
-
label: '华文黑体',
|
|
517
|
-
group: '中文字体'
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
id: 'kaiti',
|
|
521
|
-
name: 'KaiTi',
|
|
522
|
-
cssValue: 'KaiTi',
|
|
523
|
-
cssFamily: 'KaiTi, "Kaiti SC", serif',
|
|
524
|
-
label: '楷体',
|
|
525
|
-
group: '中文字体'
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
id: 'fangsong',
|
|
529
|
-
name: 'FangSong',
|
|
530
|
-
cssValue: 'FangSong',
|
|
531
|
-
cssFamily: 'FangSong, STFangsong, serif',
|
|
532
|
-
label: '仿宋',
|
|
533
|
-
group: '中文字体'
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
id: 'hiragino-sans-gb',
|
|
537
|
-
name: 'Hiragino Sans GB',
|
|
538
|
-
cssValue: '"Hiragino Sans GB"',
|
|
539
|
-
cssFamily: '"Hiragino Sans GB", "PingFang SC", sans-serif',
|
|
540
|
-
label: '冬青黑体',
|
|
541
|
-
group: '中文字体'
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
id: 'aptos',
|
|
545
|
-
name: 'Aptos',
|
|
546
|
-
cssValue: 'Aptos',
|
|
547
|
-
cssFamily: 'Aptos, sans-serif',
|
|
548
|
-
label: 'Aptos',
|
|
549
|
-
group: '西文字体'
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
id: 'calibri',
|
|
553
|
-
name: 'Calibri',
|
|
554
|
-
cssValue: 'Calibri',
|
|
555
|
-
cssFamily: 'Calibri',
|
|
556
|
-
label: 'Calibri',
|
|
557
|
-
group: '西文字体'
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
id: 'arial',
|
|
561
|
-
name: 'Arial',
|
|
562
|
-
cssValue: 'Arial',
|
|
563
|
-
cssFamily: 'Arial, sans-serif',
|
|
564
|
-
label: 'Arial',
|
|
565
|
-
group: '西文字体'
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
id: 'helvetica',
|
|
569
|
-
name: 'Helvetica',
|
|
570
|
-
cssValue: 'Helvetica',
|
|
571
|
-
cssFamily: 'Helvetica, Arial, sans-serif',
|
|
572
|
-
label: 'Helvetica',
|
|
573
|
-
group: '西文字体'
|
|
574
|
-
},
|
|
575
|
-
{
|
|
576
|
-
id: 'times-new-roman',
|
|
577
|
-
name: 'Times New Roman',
|
|
578
|
-
cssValue: '"Times New Roman"',
|
|
579
|
-
cssFamily: '"Times New Roman", Times, serif',
|
|
580
|
-
label: 'Times New Roman',
|
|
581
|
-
group: '西文字体'
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
id: 'georgia',
|
|
585
|
-
name: 'Georgia',
|
|
586
|
-
cssValue: 'Georgia',
|
|
587
|
-
cssFamily: 'Georgia, "Times New Roman", serif',
|
|
588
|
-
label: 'Georgia',
|
|
589
|
-
group: '西文字体'
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
id: 'cambria',
|
|
593
|
-
name: 'Cambria',
|
|
594
|
-
cssValue: 'Cambria',
|
|
595
|
-
cssFamily: 'Cambria, Georgia, serif',
|
|
596
|
-
label: 'Cambria',
|
|
597
|
-
group: '西文字体'
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
id: 'garamond',
|
|
601
|
-
name: 'Garamond',
|
|
602
|
-
cssValue: 'Garamond',
|
|
603
|
-
cssFamily: 'Garamond, Georgia, serif',
|
|
604
|
-
label: 'Garamond',
|
|
605
|
-
group: '西文字体'
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
id: 'verdana',
|
|
609
|
-
name: 'Verdana',
|
|
610
|
-
cssValue: 'Verdana',
|
|
611
|
-
cssFamily: 'Verdana, Arial, sans-serif',
|
|
612
|
-
label: 'Verdana',
|
|
613
|
-
group: '西文字体'
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
id: 'tahoma',
|
|
617
|
-
name: 'Tahoma',
|
|
618
|
-
cssValue: 'Tahoma',
|
|
619
|
-
cssFamily: 'Tahoma, Verdana, sans-serif',
|
|
620
|
-
label: 'Tahoma',
|
|
621
|
-
group: '西文字体'
|
|
622
|
-
},
|
|
623
|
-
{
|
|
624
|
-
id: 'trebuchet-ms',
|
|
625
|
-
name: 'Trebuchet MS',
|
|
626
|
-
cssValue: '"Trebuchet MS"',
|
|
627
|
-
cssFamily: '"Trebuchet MS", Arial, sans-serif',
|
|
628
|
-
label: 'Trebuchet MS',
|
|
629
|
-
group: '西文字体'
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
id: 'sf-mono',
|
|
633
|
-
name: 'SFMono-Regular',
|
|
634
|
-
cssValue: 'SFMono-Regular',
|
|
635
|
-
cssFamily: 'SFMono-Regular, Menlo, Consolas, monospace',
|
|
636
|
-
label: 'SF Mono',
|
|
637
|
-
group: '等宽字体'
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
id: 'menlo',
|
|
641
|
-
name: 'Menlo',
|
|
642
|
-
cssValue: 'Menlo',
|
|
643
|
-
cssFamily: 'Menlo, SFMono-Regular, Consolas, monospace',
|
|
644
|
-
label: 'Menlo',
|
|
645
|
-
group: '等宽字体'
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
id: 'consolas',
|
|
649
|
-
name: 'Consolas',
|
|
650
|
-
cssValue: 'Consolas',
|
|
651
|
-
cssFamily: 'Consolas, "Courier New", monospace',
|
|
652
|
-
label: 'Consolas',
|
|
653
|
-
group: '等宽字体'
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
id: 'courier-new',
|
|
657
|
-
name: 'Courier New',
|
|
658
|
-
cssValue: '"Courier New"',
|
|
659
|
-
cssFamily: '"Courier New", Courier, monospace',
|
|
660
|
-
label: 'Courier New',
|
|
661
|
-
group: '等宽字体'
|
|
662
|
-
},
|
|
663
|
-
{
|
|
664
|
-
id: 'monaco',
|
|
665
|
-
name: 'Monaco',
|
|
666
|
-
cssValue: 'Monaco',
|
|
667
|
-
cssFamily: 'Monaco, Menlo, Consolas, monospace',
|
|
668
|
-
label: 'Monaco',
|
|
669
|
-
group: '等宽字体'
|
|
670
|
-
}
|
|
671
|
-
];
|
|
672
|
-
function officeFontFamilyLabel(value) {
|
|
673
|
-
const firstFamily = value.split(',')[0]?.trim() || value.trim();
|
|
674
|
-
return firstFamily.replace(/^(['"])(.*)\1$/, '$2');
|
|
675
|
-
}
|
|
676
|
-
function normalizeOfficeFontFamily(value) {
|
|
677
|
-
return officeFontFamilyLabel(value).toLocaleLowerCase();
|
|
678
|
-
}
|
|
679
470
|
const MAX_LAYOUT_BLOCKS = 200000;
|
|
680
471
|
const MAX_LAYOUT_PAGE_STYLES = 10000;
|
|
681
472
|
const MAX_LAYOUT_EXTENT = 1000000;
|
|
@@ -1197,342 +988,6 @@ function office_kernel_presentation_fallback_kernelError(code, message) {
|
|
|
1197
988
|
code
|
|
1198
989
|
});
|
|
1199
990
|
}
|
|
1200
|
-
const browserScalarFunctionArities = new Map([
|
|
1201
|
-
[
|
|
1202
|
-
'ABS',
|
|
1203
|
-
[
|
|
1204
|
-
1,
|
|
1205
|
-
1
|
|
1206
|
-
]
|
|
1207
|
-
],
|
|
1208
|
-
[
|
|
1209
|
-
'AND',
|
|
1210
|
-
[
|
|
1211
|
-
1,
|
|
1212
|
-
255
|
|
1213
|
-
]
|
|
1214
|
-
],
|
|
1215
|
-
[
|
|
1216
|
-
'AVERAGE',
|
|
1217
|
-
[
|
|
1218
|
-
1,
|
|
1219
|
-
255
|
|
1220
|
-
]
|
|
1221
|
-
],
|
|
1222
|
-
[
|
|
1223
|
-
'COLUMN',
|
|
1224
|
-
[
|
|
1225
|
-
0,
|
|
1226
|
-
0
|
|
1227
|
-
]
|
|
1228
|
-
],
|
|
1229
|
-
[
|
|
1230
|
-
'CONCAT',
|
|
1231
|
-
[
|
|
1232
|
-
1,
|
|
1233
|
-
255
|
|
1234
|
-
]
|
|
1235
|
-
],
|
|
1236
|
-
[
|
|
1237
|
-
'CONCATENATE',
|
|
1238
|
-
[
|
|
1239
|
-
1,
|
|
1240
|
-
255
|
|
1241
|
-
]
|
|
1242
|
-
],
|
|
1243
|
-
[
|
|
1244
|
-
'COUNT',
|
|
1245
|
-
[
|
|
1246
|
-
1,
|
|
1247
|
-
255
|
|
1248
|
-
]
|
|
1249
|
-
],
|
|
1250
|
-
[
|
|
1251
|
-
'COUNTA',
|
|
1252
|
-
[
|
|
1253
|
-
1,
|
|
1254
|
-
255
|
|
1255
|
-
]
|
|
1256
|
-
],
|
|
1257
|
-
[
|
|
1258
|
-
'FALSE',
|
|
1259
|
-
[
|
|
1260
|
-
0,
|
|
1261
|
-
0
|
|
1262
|
-
]
|
|
1263
|
-
],
|
|
1264
|
-
[
|
|
1265
|
-
'IF',
|
|
1266
|
-
[
|
|
1267
|
-
2,
|
|
1268
|
-
3
|
|
1269
|
-
]
|
|
1270
|
-
],
|
|
1271
|
-
[
|
|
1272
|
-
'IFERROR',
|
|
1273
|
-
[
|
|
1274
|
-
2,
|
|
1275
|
-
2
|
|
1276
|
-
]
|
|
1277
|
-
],
|
|
1278
|
-
[
|
|
1279
|
-
'MAX',
|
|
1280
|
-
[
|
|
1281
|
-
1,
|
|
1282
|
-
255
|
|
1283
|
-
]
|
|
1284
|
-
],
|
|
1285
|
-
[
|
|
1286
|
-
'MIN',
|
|
1287
|
-
[
|
|
1288
|
-
1,
|
|
1289
|
-
255
|
|
1290
|
-
]
|
|
1291
|
-
],
|
|
1292
|
-
[
|
|
1293
|
-
'MOD',
|
|
1294
|
-
[
|
|
1295
|
-
2,
|
|
1296
|
-
2
|
|
1297
|
-
]
|
|
1298
|
-
],
|
|
1299
|
-
[
|
|
1300
|
-
'NA',
|
|
1301
|
-
[
|
|
1302
|
-
0,
|
|
1303
|
-
0
|
|
1304
|
-
]
|
|
1305
|
-
],
|
|
1306
|
-
[
|
|
1307
|
-
'NOT',
|
|
1308
|
-
[
|
|
1309
|
-
1,
|
|
1310
|
-
1
|
|
1311
|
-
]
|
|
1312
|
-
],
|
|
1313
|
-
[
|
|
1314
|
-
'OR',
|
|
1315
|
-
[
|
|
1316
|
-
1,
|
|
1317
|
-
255
|
|
1318
|
-
]
|
|
1319
|
-
],
|
|
1320
|
-
[
|
|
1321
|
-
'PI',
|
|
1322
|
-
[
|
|
1323
|
-
0,
|
|
1324
|
-
0
|
|
1325
|
-
]
|
|
1326
|
-
],
|
|
1327
|
-
[
|
|
1328
|
-
'POWER',
|
|
1329
|
-
[
|
|
1330
|
-
2,
|
|
1331
|
-
2
|
|
1332
|
-
]
|
|
1333
|
-
],
|
|
1334
|
-
[
|
|
1335
|
-
'ROUND',
|
|
1336
|
-
[
|
|
1337
|
-
2,
|
|
1338
|
-
2
|
|
1339
|
-
]
|
|
1340
|
-
],
|
|
1341
|
-
[
|
|
1342
|
-
'ROW',
|
|
1343
|
-
[
|
|
1344
|
-
0,
|
|
1345
|
-
0
|
|
1346
|
-
]
|
|
1347
|
-
],
|
|
1348
|
-
[
|
|
1349
|
-
'SQRT',
|
|
1350
|
-
[
|
|
1351
|
-
1,
|
|
1352
|
-
1
|
|
1353
|
-
]
|
|
1354
|
-
],
|
|
1355
|
-
[
|
|
1356
|
-
'SUBTOTAL',
|
|
1357
|
-
[
|
|
1358
|
-
2,
|
|
1359
|
-
255
|
|
1360
|
-
]
|
|
1361
|
-
],
|
|
1362
|
-
[
|
|
1363
|
-
'SUM',
|
|
1364
|
-
[
|
|
1365
|
-
1,
|
|
1366
|
-
255
|
|
1367
|
-
]
|
|
1368
|
-
],
|
|
1369
|
-
[
|
|
1370
|
-
'TRUE',
|
|
1371
|
-
[
|
|
1372
|
-
0,
|
|
1373
|
-
0
|
|
1374
|
-
]
|
|
1375
|
-
]
|
|
1376
|
-
]);
|
|
1377
|
-
function normalizeSpreadsheetFunctionName(name) {
|
|
1378
|
-
let normalized = name.toUpperCase();
|
|
1379
|
-
while(normalized.startsWith('_XLFN.') || normalized.startsWith('_XLWS.'))normalized = normalized.slice(6);
|
|
1380
|
-
return normalized;
|
|
1381
|
-
}
|
|
1382
|
-
function evaluateParserSubtotal(parameters) {
|
|
1383
|
-
const codeValue = parserNumericValue(parameters[0]);
|
|
1384
|
-
if (void 0 === codeValue) return 'VALUE!';
|
|
1385
|
-
const code = Math.trunc(codeValue);
|
|
1386
|
-
const values = parameters.slice(1).flatMap((parameter)=>flattenParserValues(parameter));
|
|
1387
|
-
for (const value of values){
|
|
1388
|
-
const error = parserErrorValue(value);
|
|
1389
|
-
if (error) return error;
|
|
1390
|
-
}
|
|
1391
|
-
switch(code){
|
|
1392
|
-
case 1:
|
|
1393
|
-
case 101:
|
|
1394
|
-
return parserSubtotalNumeric(values, 'average');
|
|
1395
|
-
case 2:
|
|
1396
|
-
case 102:
|
|
1397
|
-
return values.filter((value)=>'number' == typeof value).length;
|
|
1398
|
-
case 3:
|
|
1399
|
-
case 103:
|
|
1400
|
-
return values.filter((value)=>null != value).length;
|
|
1401
|
-
case 4:
|
|
1402
|
-
case 104:
|
|
1403
|
-
return parserSubtotalNumeric(values, 'max');
|
|
1404
|
-
case 5:
|
|
1405
|
-
case 105:
|
|
1406
|
-
return parserSubtotalNumeric(values, 'min');
|
|
1407
|
-
case 6:
|
|
1408
|
-
case 106:
|
|
1409
|
-
return parserSubtotalNumeric(values, 'product');
|
|
1410
|
-
case 7:
|
|
1411
|
-
case 107:
|
|
1412
|
-
return parserSubtotalNumeric(values, 'stddev');
|
|
1413
|
-
case 8:
|
|
1414
|
-
case 108:
|
|
1415
|
-
return parserSubtotalNumeric(values, 'stddevp');
|
|
1416
|
-
case 9:
|
|
1417
|
-
case 109:
|
|
1418
|
-
return parserSubtotalNumeric(values, 'sum');
|
|
1419
|
-
case 10:
|
|
1420
|
-
case 110:
|
|
1421
|
-
return parserSubtotalNumeric(values, 'var');
|
|
1422
|
-
case 11:
|
|
1423
|
-
case 111:
|
|
1424
|
-
return parserSubtotalNumeric(values, 'varp');
|
|
1425
|
-
default:
|
|
1426
|
-
return 'VALUE!';
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
function parserSubtotalNumeric(values, operation) {
|
|
1430
|
-
const numbers = values.filter((value)=>'number' == typeof value && Number.isFinite(value));
|
|
1431
|
-
const count = numbers.length;
|
|
1432
|
-
const sum = numbers.reduce((total, value)=>total + value, 0);
|
|
1433
|
-
if ('sum' === operation) return finiteParserNumber(sum);
|
|
1434
|
-
if ('average' === operation) return count ? finiteParserNumber(sum / count) : 'DIV/0!';
|
|
1435
|
-
if ('max' === operation) return finiteParserNumber(Math.max(...numbers, 0));
|
|
1436
|
-
if ('min' === operation) return finiteParserNumber(Math.min(...numbers, 0));
|
|
1437
|
-
if ('product' === operation) return finiteParserNumber(count ? numbers.reduce((total, value)=>total * value, 1) : 0);
|
|
1438
|
-
if ('stddev' === operation || 'var' === operation) {
|
|
1439
|
-
if (count < 2) return 'DIV/0!';
|
|
1440
|
-
} else if (0 === count) return 'DIV/0!';
|
|
1441
|
-
const mean = sum / count;
|
|
1442
|
-
const divisor = 'stddev' === operation || 'var' === operation ? count - 1 : count;
|
|
1443
|
-
const variance = numbers.reduce((total, value)=>total + (value - mean) ** 2, 0) / divisor;
|
|
1444
|
-
return finiteParserNumber('stddev' === operation || 'stddevp' === operation ? Math.sqrt(variance) : variance);
|
|
1445
|
-
}
|
|
1446
|
-
function flattenParserValues(value) {
|
|
1447
|
-
if (!Array.isArray(value)) return [
|
|
1448
|
-
value
|
|
1449
|
-
];
|
|
1450
|
-
return value.flatMap((entry)=>flattenParserValues(entry));
|
|
1451
|
-
}
|
|
1452
|
-
function parserNumericValue(value) {
|
|
1453
|
-
if ('number' == typeof value) return Number.isFinite(value) ? value : void 0;
|
|
1454
|
-
if ('boolean' == typeof value) return value ? 1 : 0;
|
|
1455
|
-
if ('string' != typeof value || !value.trim()) return;
|
|
1456
|
-
const parsed = Number(value);
|
|
1457
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
1458
|
-
}
|
|
1459
|
-
function parserErrorValue(value) {
|
|
1460
|
-
if (value instanceof Error) return value.message.startsWith('#') ? value.message.slice(1) : 'VALUE!';
|
|
1461
|
-
return 'string' == typeof value && value.startsWith('#') ? value.slice(1) : void 0;
|
|
1462
|
-
}
|
|
1463
|
-
function finiteParserNumber(value) {
|
|
1464
|
-
return Number.isFinite(value) ? value : 'NUM!';
|
|
1465
|
-
}
|
|
1466
|
-
function normalizeFormulaForFortuneParser(formula) {
|
|
1467
|
-
const source = formula.replace(/^=/, '');
|
|
1468
|
-
let output = '';
|
|
1469
|
-
let cursor = 0;
|
|
1470
|
-
let bracketDepth = 0;
|
|
1471
|
-
while(cursor < source.length){
|
|
1472
|
-
const character = source[cursor] ?? '';
|
|
1473
|
-
if ('"' === character || "'" === character) {
|
|
1474
|
-
const quote = character;
|
|
1475
|
-
output += quote;
|
|
1476
|
-
cursor += 1;
|
|
1477
|
-
while(cursor < source.length){
|
|
1478
|
-
const quoted = source[cursor] ?? '';
|
|
1479
|
-
output += quoted;
|
|
1480
|
-
cursor += 1;
|
|
1481
|
-
if (quoted !== quote) continue;
|
|
1482
|
-
if (source[cursor] === quote) {
|
|
1483
|
-
output += quote;
|
|
1484
|
-
cursor += 1;
|
|
1485
|
-
continue;
|
|
1486
|
-
}
|
|
1487
|
-
break;
|
|
1488
|
-
}
|
|
1489
|
-
continue;
|
|
1490
|
-
}
|
|
1491
|
-
if ('[' === character) {
|
|
1492
|
-
bracketDepth += 1;
|
|
1493
|
-
output += character;
|
|
1494
|
-
cursor += 1;
|
|
1495
|
-
continue;
|
|
1496
|
-
}
|
|
1497
|
-
if (']' === character && bracketDepth > 0) {
|
|
1498
|
-
bracketDepth -= 1;
|
|
1499
|
-
output += character;
|
|
1500
|
-
cursor += 1;
|
|
1501
|
-
continue;
|
|
1502
|
-
}
|
|
1503
|
-
if (0 === bracketDepth && isAsciiFormulaNameStart(character)) {
|
|
1504
|
-
const start = cursor;
|
|
1505
|
-
cursor += 1;
|
|
1506
|
-
while(cursor < source.length && isAsciiFormulaNameContinue(source[cursor] ?? ''))cursor += 1;
|
|
1507
|
-
const token = source.slice(start, cursor);
|
|
1508
|
-
const normalized = token.toUpperCase();
|
|
1509
|
-
const normalizedFunction = normalizeSpreadsheetFunctionName(token);
|
|
1510
|
-
const previous = adjacentNonWhitespace(source, start - 1, -1);
|
|
1511
|
-
const next = adjacentNonWhitespace(source, cursor, 1);
|
|
1512
|
-
if ('(' === next && normalizedFunction !== normalized) output += normalizedFunction;
|
|
1513
|
-
else if (('TRUE' === normalized || 'FALSE' === normalized) && '!' !== previous && '!' !== next && '(' !== next) output += `${token}()`;
|
|
1514
|
-
else output += token;
|
|
1515
|
-
continue;
|
|
1516
|
-
}
|
|
1517
|
-
output += character;
|
|
1518
|
-
cursor += 1;
|
|
1519
|
-
}
|
|
1520
|
-
return output;
|
|
1521
|
-
}
|
|
1522
|
-
function adjacentNonWhitespace(value, start, direction) {
|
|
1523
|
-
let cursor = start;
|
|
1524
|
-
while(cursor >= 0 && cursor < value.length){
|
|
1525
|
-
const character = value[cursor];
|
|
1526
|
-
if (character && !/\s/u.test(character)) return character;
|
|
1527
|
-
cursor += direction;
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
function isAsciiFormulaNameStart(value) {
|
|
1531
|
-
return /[A-Za-z_]/u.test(value);
|
|
1532
|
-
}
|
|
1533
|
-
function isAsciiFormulaNameContinue(value) {
|
|
1534
|
-
return /[A-Za-z0-9_.]/u.test(value);
|
|
1535
|
-
}
|
|
1536
991
|
const MAX_SPREADSHEET_INPUT_CELLS = 100000;
|
|
1537
992
|
const MAX_SPREADSHEET_FORMULA_CHARACTERS = 8192;
|
|
1538
993
|
const MAX_SPREADSHEET_SHEETS = 1024;
|
|
@@ -2733,4 +2188,4 @@ function abortError() {
|
|
|
2733
2188
|
function disposedError() {
|
|
2734
2189
|
return new Error('Office kernel client is disposed.');
|
|
2735
2190
|
}
|
|
2736
|
-
export { CollectionState, CommittedOfficeNumberField, OfficeCheckbox, OfficeNumberField, createOfficeKernelClient, handleOfficeTaskPaneKeyDown,
|
|
2191
|
+
export { CollectionState, CommittedOfficeNumberField, OfficeCheckbox, OfficeNumberField, createOfficeKernelClient, handleOfficeTaskPaneKeyDown, useOfficeDialog, useOfficeTaskPaneEscape, useOfficeTaskPaneModal };
|