@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
package/dist/{4121.js → 6968.js}
RENAMED
|
@@ -3271,7 +3271,8 @@ function contentForTemplate(templateId) {
|
|
|
3271
3271
|
};
|
|
3272
3272
|
if ('data-validation' === templateId) return {
|
|
3273
3273
|
type: 'spreadsheet',
|
|
3274
|
-
sheets: dataValidationTemplateSheets()
|
|
3274
|
+
sheets: dataValidationTemplateSheets(),
|
|
3275
|
+
namedRanges: dataValidationTemplateNamedRanges()
|
|
3275
3276
|
};
|
|
3276
3277
|
if ('conditional-format' === templateId) return {
|
|
3277
3278
|
type: 'spreadsheet',
|
|
@@ -3439,7 +3440,9 @@ function dataValidationTemplateSheets() {
|
|
|
3439
3440
|
'State',
|
|
3440
3441
|
'Due date',
|
|
3441
3442
|
'Priority',
|
|
3442
|
-
'Owner'
|
|
3443
|
+
'Owner',
|
|
3444
|
+
'Region',
|
|
3445
|
+
'Regional owner'
|
|
3443
3446
|
].forEach((value, column)=>{
|
|
3444
3447
|
inputs[0][column] = headerCell(value);
|
|
3445
3448
|
});
|
|
@@ -3449,35 +3452,45 @@ function dataValidationTemplateSheets() {
|
|
|
3449
3452
|
'Ready',
|
|
3450
3453
|
'2026-09-05',
|
|
3451
3454
|
2,
|
|
3452
|
-
'Avery'
|
|
3455
|
+
'Avery',
|
|
3456
|
+
'North',
|
|
3457
|
+
''
|
|
3453
3458
|
],
|
|
3454
3459
|
[
|
|
3455
3460
|
'Review integration',
|
|
3456
3461
|
'In review',
|
|
3457
3462
|
'2026-09-12',
|
|
3458
3463
|
3,
|
|
3459
|
-
'Morgan'
|
|
3464
|
+
'Morgan',
|
|
3465
|
+
'South',
|
|
3466
|
+
''
|
|
3460
3467
|
],
|
|
3461
3468
|
[
|
|
3462
3469
|
'Resolve blockers',
|
|
3463
3470
|
'Blocked',
|
|
3464
3471
|
'2026-09-18',
|
|
3465
3472
|
5,
|
|
3466
|
-
'Riley'
|
|
3473
|
+
'Riley',
|
|
3474
|
+
'North',
|
|
3475
|
+
''
|
|
3467
3476
|
],
|
|
3468
3477
|
[
|
|
3469
3478
|
'Publish preview',
|
|
3470
3479
|
'Ready',
|
|
3471
3480
|
'2026-09-24',
|
|
3472
3481
|
1,
|
|
3473
|
-
'Jordan'
|
|
3482
|
+
'Jordan',
|
|
3483
|
+
'South',
|
|
3484
|
+
''
|
|
3474
3485
|
],
|
|
3475
3486
|
[
|
|
3476
3487
|
'Ship release',
|
|
3477
3488
|
'In review',
|
|
3478
3489
|
'2026-09-30',
|
|
3479
3490
|
4,
|
|
3480
|
-
'Taylor'
|
|
3491
|
+
'Taylor',
|
|
3492
|
+
'North',
|
|
3493
|
+
''
|
|
3481
3494
|
]
|
|
3482
3495
|
];
|
|
3483
3496
|
rows.forEach((row, rowIndex)=>{
|
|
@@ -3604,6 +3617,33 @@ function dataValidationTemplateSheets() {
|
|
|
3604
3617
|
hintTitle: 'Owner',
|
|
3605
3618
|
hintValue: 'The custom formula checks that this cell is not blank.'
|
|
3606
3619
|
})
|
|
3620
|
+
},
|
|
3621
|
+
{
|
|
3622
|
+
ranges: [
|
|
3623
|
+
{
|
|
3624
|
+
row: [
|
|
3625
|
+
1,
|
|
3626
|
+
5
|
|
3627
|
+
],
|
|
3628
|
+
column: [
|
|
3629
|
+
6,
|
|
3630
|
+
6
|
|
3631
|
+
]
|
|
3632
|
+
}
|
|
3633
|
+
],
|
|
3634
|
+
item: dataValidationTemplateItem({
|
|
3635
|
+
type: 'dropdown',
|
|
3636
|
+
rangeTxt: 'G2:G6',
|
|
3637
|
+
value1: '=INDIRECT($F2)',
|
|
3638
|
+
allowBlank: true,
|
|
3639
|
+
showDropdownArrow: true,
|
|
3640
|
+
errorStyle: 'stop',
|
|
3641
|
+
errorTitle: 'Regional owner required',
|
|
3642
|
+
errorMessage: 'Choose an owner from the selected region.',
|
|
3643
|
+
hintShow: true,
|
|
3644
|
+
hintTitle: 'Dependent list',
|
|
3645
|
+
hintValue: 'The options follow the Region column through a local INDIRECT formula.'
|
|
3646
|
+
})
|
|
3607
3647
|
}
|
|
3608
3648
|
],
|
|
3609
3649
|
luckysheet_select_save: [
|
|
@@ -3626,7 +3666,9 @@ function dataValidationTemplateSheets() {
|
|
|
3626
3666
|
1: 110,
|
|
3627
3667
|
2: 118,
|
|
3628
3668
|
3: 84,
|
|
3629
|
-
4: 104
|
|
3669
|
+
4: 104,
|
|
3670
|
+
5: 92,
|
|
3671
|
+
6: 132
|
|
3630
3672
|
},
|
|
3631
3673
|
rowlen: {
|
|
3632
3674
|
0: 30
|
|
@@ -3642,23 +3684,45 @@ function dataValidationTemplateSheets() {
|
|
|
3642
3684
|
column: 3,
|
|
3643
3685
|
data: [
|
|
3644
3686
|
[
|
|
3645
|
-
styledCell('Ready')
|
|
3687
|
+
styledCell('Ready'),
|
|
3688
|
+
styledCell('Avery'),
|
|
3689
|
+
styledCell('Morgan')
|
|
3646
3690
|
],
|
|
3647
3691
|
[
|
|
3648
|
-
styledCell('Blocked')
|
|
3692
|
+
styledCell('Blocked'),
|
|
3693
|
+
styledCell('Jordan'),
|
|
3694
|
+
styledCell('Taylor')
|
|
3649
3695
|
],
|
|
3650
3696
|
[
|
|
3651
|
-
styledCell('In review')
|
|
3697
|
+
styledCell('In review'),
|
|
3698
|
+
styledCell('Cara'),
|
|
3699
|
+
styledCell('Quinn')
|
|
3652
3700
|
]
|
|
3653
3701
|
],
|
|
3654
3702
|
config: {
|
|
3655
3703
|
columnlen: {
|
|
3656
|
-
0: 120
|
|
3704
|
+
0: 120,
|
|
3705
|
+
1: 110,
|
|
3706
|
+
2: 110
|
|
3657
3707
|
}
|
|
3658
3708
|
}
|
|
3659
3709
|
}
|
|
3660
3710
|
];
|
|
3661
3711
|
}
|
|
3712
|
+
function dataValidationTemplateNamedRanges() {
|
|
3713
|
+
return [
|
|
3714
|
+
{
|
|
3715
|
+
id: 'data-validation-north',
|
|
3716
|
+
name: 'North',
|
|
3717
|
+
reference: "'Lists'!B1:B3"
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
id: 'data-validation-south',
|
|
3721
|
+
name: 'South',
|
|
3722
|
+
reference: "'Lists'!C1:C3"
|
|
3723
|
+
}
|
|
3724
|
+
];
|
|
3725
|
+
}
|
|
3662
3726
|
function conditionalFormatTemplateSheets() {
|
|
3663
3727
|
const status = emptyMatrix(18, 8);
|
|
3664
3728
|
status[0][0] = styledCell('公式条件格式 · 发布看板', {
|
|
@@ -4552,4 +4616,549 @@ new TextEncoder();
|
|
|
4552
4616
|
function isOfficeKernelSpreadsheetError(value) {
|
|
4553
4617
|
return 'string' == typeof value && spreadsheetErrors.has(value);
|
|
4554
4618
|
}
|
|
4555
|
-
|
|
4619
|
+
const officeFontFamilies = [
|
|
4620
|
+
{
|
|
4621
|
+
id: 'microsoft-yahei',
|
|
4622
|
+
name: 'Microsoft YaHei',
|
|
4623
|
+
cssValue: '"Microsoft YaHei"',
|
|
4624
|
+
cssFamily: '"Microsoft YaHei", "PingFang SC", sans-serif',
|
|
4625
|
+
label: '微软雅黑',
|
|
4626
|
+
group: '中文字体'
|
|
4627
|
+
},
|
|
4628
|
+
{
|
|
4629
|
+
id: 'pingfang-sc',
|
|
4630
|
+
name: 'PingFang SC',
|
|
4631
|
+
cssValue: '"PingFang SC"',
|
|
4632
|
+
cssFamily: '"PingFang SC", "Microsoft YaHei", sans-serif',
|
|
4633
|
+
label: '苹方',
|
|
4634
|
+
group: '中文字体'
|
|
4635
|
+
},
|
|
4636
|
+
{
|
|
4637
|
+
id: 'simsun',
|
|
4638
|
+
name: 'SimSun',
|
|
4639
|
+
cssValue: 'SimSun',
|
|
4640
|
+
cssFamily: 'SimSun, "Songti SC", serif',
|
|
4641
|
+
label: '宋体',
|
|
4642
|
+
group: '中文字体'
|
|
4643
|
+
},
|
|
4644
|
+
{
|
|
4645
|
+
id: 'stsong',
|
|
4646
|
+
name: 'STSong',
|
|
4647
|
+
cssValue: 'STSong',
|
|
4648
|
+
cssFamily: 'STSong, "Songti SC", SimSun, serif',
|
|
4649
|
+
label: '华文宋体',
|
|
4650
|
+
group: '中文字体'
|
|
4651
|
+
},
|
|
4652
|
+
{
|
|
4653
|
+
id: 'simhei',
|
|
4654
|
+
name: 'SimHei',
|
|
4655
|
+
cssValue: 'SimHei',
|
|
4656
|
+
cssFamily: 'SimHei, "Heiti SC", sans-serif',
|
|
4657
|
+
label: '黑体',
|
|
4658
|
+
group: '中文字体'
|
|
4659
|
+
},
|
|
4660
|
+
{
|
|
4661
|
+
id: 'stheiti',
|
|
4662
|
+
name: 'STHeiti',
|
|
4663
|
+
cssValue: 'STHeiti',
|
|
4664
|
+
cssFamily: 'STHeiti, "Heiti SC", SimHei, sans-serif',
|
|
4665
|
+
label: '华文黑体',
|
|
4666
|
+
group: '中文字体'
|
|
4667
|
+
},
|
|
4668
|
+
{
|
|
4669
|
+
id: 'kaiti',
|
|
4670
|
+
name: 'KaiTi',
|
|
4671
|
+
cssValue: 'KaiTi',
|
|
4672
|
+
cssFamily: 'KaiTi, "Kaiti SC", serif',
|
|
4673
|
+
label: '楷体',
|
|
4674
|
+
group: '中文字体'
|
|
4675
|
+
},
|
|
4676
|
+
{
|
|
4677
|
+
id: 'fangsong',
|
|
4678
|
+
name: 'FangSong',
|
|
4679
|
+
cssValue: 'FangSong',
|
|
4680
|
+
cssFamily: 'FangSong, STFangsong, serif',
|
|
4681
|
+
label: '仿宋',
|
|
4682
|
+
group: '中文字体'
|
|
4683
|
+
},
|
|
4684
|
+
{
|
|
4685
|
+
id: 'hiragino-sans-gb',
|
|
4686
|
+
name: 'Hiragino Sans GB',
|
|
4687
|
+
cssValue: '"Hiragino Sans GB"',
|
|
4688
|
+
cssFamily: '"Hiragino Sans GB", "PingFang SC", sans-serif',
|
|
4689
|
+
label: '冬青黑体',
|
|
4690
|
+
group: '中文字体'
|
|
4691
|
+
},
|
|
4692
|
+
{
|
|
4693
|
+
id: 'aptos',
|
|
4694
|
+
name: 'Aptos',
|
|
4695
|
+
cssValue: 'Aptos',
|
|
4696
|
+
cssFamily: 'Aptos, sans-serif',
|
|
4697
|
+
label: 'Aptos',
|
|
4698
|
+
group: '西文字体'
|
|
4699
|
+
},
|
|
4700
|
+
{
|
|
4701
|
+
id: 'calibri',
|
|
4702
|
+
name: 'Calibri',
|
|
4703
|
+
cssValue: 'Calibri',
|
|
4704
|
+
cssFamily: 'Calibri',
|
|
4705
|
+
label: 'Calibri',
|
|
4706
|
+
group: '西文字体'
|
|
4707
|
+
},
|
|
4708
|
+
{
|
|
4709
|
+
id: 'arial',
|
|
4710
|
+
name: 'Arial',
|
|
4711
|
+
cssValue: 'Arial',
|
|
4712
|
+
cssFamily: 'Arial, sans-serif',
|
|
4713
|
+
label: 'Arial',
|
|
4714
|
+
group: '西文字体'
|
|
4715
|
+
},
|
|
4716
|
+
{
|
|
4717
|
+
id: 'helvetica',
|
|
4718
|
+
name: 'Helvetica',
|
|
4719
|
+
cssValue: 'Helvetica',
|
|
4720
|
+
cssFamily: 'Helvetica, Arial, sans-serif',
|
|
4721
|
+
label: 'Helvetica',
|
|
4722
|
+
group: '西文字体'
|
|
4723
|
+
},
|
|
4724
|
+
{
|
|
4725
|
+
id: 'times-new-roman',
|
|
4726
|
+
name: 'Times New Roman',
|
|
4727
|
+
cssValue: '"Times New Roman"',
|
|
4728
|
+
cssFamily: '"Times New Roman", Times, serif',
|
|
4729
|
+
label: 'Times New Roman',
|
|
4730
|
+
group: '西文字体'
|
|
4731
|
+
},
|
|
4732
|
+
{
|
|
4733
|
+
id: 'georgia',
|
|
4734
|
+
name: 'Georgia',
|
|
4735
|
+
cssValue: 'Georgia',
|
|
4736
|
+
cssFamily: 'Georgia, "Times New Roman", serif',
|
|
4737
|
+
label: 'Georgia',
|
|
4738
|
+
group: '西文字体'
|
|
4739
|
+
},
|
|
4740
|
+
{
|
|
4741
|
+
id: 'cambria',
|
|
4742
|
+
name: 'Cambria',
|
|
4743
|
+
cssValue: 'Cambria',
|
|
4744
|
+
cssFamily: 'Cambria, Georgia, serif',
|
|
4745
|
+
label: 'Cambria',
|
|
4746
|
+
group: '西文字体'
|
|
4747
|
+
},
|
|
4748
|
+
{
|
|
4749
|
+
id: 'garamond',
|
|
4750
|
+
name: 'Garamond',
|
|
4751
|
+
cssValue: 'Garamond',
|
|
4752
|
+
cssFamily: 'Garamond, Georgia, serif',
|
|
4753
|
+
label: 'Garamond',
|
|
4754
|
+
group: '西文字体'
|
|
4755
|
+
},
|
|
4756
|
+
{
|
|
4757
|
+
id: 'verdana',
|
|
4758
|
+
name: 'Verdana',
|
|
4759
|
+
cssValue: 'Verdana',
|
|
4760
|
+
cssFamily: 'Verdana, Arial, sans-serif',
|
|
4761
|
+
label: 'Verdana',
|
|
4762
|
+
group: '西文字体'
|
|
4763
|
+
},
|
|
4764
|
+
{
|
|
4765
|
+
id: 'tahoma',
|
|
4766
|
+
name: 'Tahoma',
|
|
4767
|
+
cssValue: 'Tahoma',
|
|
4768
|
+
cssFamily: 'Tahoma, Verdana, sans-serif',
|
|
4769
|
+
label: 'Tahoma',
|
|
4770
|
+
group: '西文字体'
|
|
4771
|
+
},
|
|
4772
|
+
{
|
|
4773
|
+
id: 'trebuchet-ms',
|
|
4774
|
+
name: 'Trebuchet MS',
|
|
4775
|
+
cssValue: '"Trebuchet MS"',
|
|
4776
|
+
cssFamily: '"Trebuchet MS", Arial, sans-serif',
|
|
4777
|
+
label: 'Trebuchet MS',
|
|
4778
|
+
group: '西文字体'
|
|
4779
|
+
},
|
|
4780
|
+
{
|
|
4781
|
+
id: 'sf-mono',
|
|
4782
|
+
name: 'SFMono-Regular',
|
|
4783
|
+
cssValue: 'SFMono-Regular',
|
|
4784
|
+
cssFamily: 'SFMono-Regular, Menlo, Consolas, monospace',
|
|
4785
|
+
label: 'SF Mono',
|
|
4786
|
+
group: '等宽字体'
|
|
4787
|
+
},
|
|
4788
|
+
{
|
|
4789
|
+
id: 'menlo',
|
|
4790
|
+
name: 'Menlo',
|
|
4791
|
+
cssValue: 'Menlo',
|
|
4792
|
+
cssFamily: 'Menlo, SFMono-Regular, Consolas, monospace',
|
|
4793
|
+
label: 'Menlo',
|
|
4794
|
+
group: '等宽字体'
|
|
4795
|
+
},
|
|
4796
|
+
{
|
|
4797
|
+
id: 'consolas',
|
|
4798
|
+
name: 'Consolas',
|
|
4799
|
+
cssValue: 'Consolas',
|
|
4800
|
+
cssFamily: 'Consolas, "Courier New", monospace',
|
|
4801
|
+
label: 'Consolas',
|
|
4802
|
+
group: '等宽字体'
|
|
4803
|
+
},
|
|
4804
|
+
{
|
|
4805
|
+
id: 'courier-new',
|
|
4806
|
+
name: 'Courier New',
|
|
4807
|
+
cssValue: '"Courier New"',
|
|
4808
|
+
cssFamily: '"Courier New", Courier, monospace',
|
|
4809
|
+
label: 'Courier New',
|
|
4810
|
+
group: '等宽字体'
|
|
4811
|
+
},
|
|
4812
|
+
{
|
|
4813
|
+
id: 'monaco',
|
|
4814
|
+
name: 'Monaco',
|
|
4815
|
+
cssValue: 'Monaco',
|
|
4816
|
+
cssFamily: 'Monaco, Menlo, Consolas, monospace',
|
|
4817
|
+
label: 'Monaco',
|
|
4818
|
+
group: '等宽字体'
|
|
4819
|
+
}
|
|
4820
|
+
];
|
|
4821
|
+
function officeFontFamilyLabel(value) {
|
|
4822
|
+
const firstFamily = value.split(',')[0]?.trim() || value.trim();
|
|
4823
|
+
return firstFamily.replace(/^(['"])(.*)\1$/, '$2');
|
|
4824
|
+
}
|
|
4825
|
+
function normalizeOfficeFontFamily(value) {
|
|
4826
|
+
return officeFontFamilyLabel(value).toLocaleLowerCase();
|
|
4827
|
+
}
|
|
4828
|
+
const browserScalarFunctionArities = new Map([
|
|
4829
|
+
[
|
|
4830
|
+
'ABS',
|
|
4831
|
+
[
|
|
4832
|
+
1,
|
|
4833
|
+
1
|
|
4834
|
+
]
|
|
4835
|
+
],
|
|
4836
|
+
[
|
|
4837
|
+
'AND',
|
|
4838
|
+
[
|
|
4839
|
+
1,
|
|
4840
|
+
255
|
|
4841
|
+
]
|
|
4842
|
+
],
|
|
4843
|
+
[
|
|
4844
|
+
'AVERAGE',
|
|
4845
|
+
[
|
|
4846
|
+
1,
|
|
4847
|
+
255
|
|
4848
|
+
]
|
|
4849
|
+
],
|
|
4850
|
+
[
|
|
4851
|
+
'COLUMN',
|
|
4852
|
+
[
|
|
4853
|
+
0,
|
|
4854
|
+
0
|
|
4855
|
+
]
|
|
4856
|
+
],
|
|
4857
|
+
[
|
|
4858
|
+
'CONCAT',
|
|
4859
|
+
[
|
|
4860
|
+
1,
|
|
4861
|
+
255
|
|
4862
|
+
]
|
|
4863
|
+
],
|
|
4864
|
+
[
|
|
4865
|
+
'CONCATENATE',
|
|
4866
|
+
[
|
|
4867
|
+
1,
|
|
4868
|
+
255
|
|
4869
|
+
]
|
|
4870
|
+
],
|
|
4871
|
+
[
|
|
4872
|
+
'COUNT',
|
|
4873
|
+
[
|
|
4874
|
+
1,
|
|
4875
|
+
255
|
|
4876
|
+
]
|
|
4877
|
+
],
|
|
4878
|
+
[
|
|
4879
|
+
'COUNTA',
|
|
4880
|
+
[
|
|
4881
|
+
1,
|
|
4882
|
+
255
|
|
4883
|
+
]
|
|
4884
|
+
],
|
|
4885
|
+
[
|
|
4886
|
+
'FALSE',
|
|
4887
|
+
[
|
|
4888
|
+
0,
|
|
4889
|
+
0
|
|
4890
|
+
]
|
|
4891
|
+
],
|
|
4892
|
+
[
|
|
4893
|
+
'IF',
|
|
4894
|
+
[
|
|
4895
|
+
2,
|
|
4896
|
+
3
|
|
4897
|
+
]
|
|
4898
|
+
],
|
|
4899
|
+
[
|
|
4900
|
+
'IFERROR',
|
|
4901
|
+
[
|
|
4902
|
+
2,
|
|
4903
|
+
2
|
|
4904
|
+
]
|
|
4905
|
+
],
|
|
4906
|
+
[
|
|
4907
|
+
'MAX',
|
|
4908
|
+
[
|
|
4909
|
+
1,
|
|
4910
|
+
255
|
|
4911
|
+
]
|
|
4912
|
+
],
|
|
4913
|
+
[
|
|
4914
|
+
'MIN',
|
|
4915
|
+
[
|
|
4916
|
+
1,
|
|
4917
|
+
255
|
|
4918
|
+
]
|
|
4919
|
+
],
|
|
4920
|
+
[
|
|
4921
|
+
'MOD',
|
|
4922
|
+
[
|
|
4923
|
+
2,
|
|
4924
|
+
2
|
|
4925
|
+
]
|
|
4926
|
+
],
|
|
4927
|
+
[
|
|
4928
|
+
'NA',
|
|
4929
|
+
[
|
|
4930
|
+
0,
|
|
4931
|
+
0
|
|
4932
|
+
]
|
|
4933
|
+
],
|
|
4934
|
+
[
|
|
4935
|
+
'NOT',
|
|
4936
|
+
[
|
|
4937
|
+
1,
|
|
4938
|
+
1
|
|
4939
|
+
]
|
|
4940
|
+
],
|
|
4941
|
+
[
|
|
4942
|
+
'OR',
|
|
4943
|
+
[
|
|
4944
|
+
1,
|
|
4945
|
+
255
|
|
4946
|
+
]
|
|
4947
|
+
],
|
|
4948
|
+
[
|
|
4949
|
+
'PI',
|
|
4950
|
+
[
|
|
4951
|
+
0,
|
|
4952
|
+
0
|
|
4953
|
+
]
|
|
4954
|
+
],
|
|
4955
|
+
[
|
|
4956
|
+
'POWER',
|
|
4957
|
+
[
|
|
4958
|
+
2,
|
|
4959
|
+
2
|
|
4960
|
+
]
|
|
4961
|
+
],
|
|
4962
|
+
[
|
|
4963
|
+
'ROUND',
|
|
4964
|
+
[
|
|
4965
|
+
2,
|
|
4966
|
+
2
|
|
4967
|
+
]
|
|
4968
|
+
],
|
|
4969
|
+
[
|
|
4970
|
+
'ROW',
|
|
4971
|
+
[
|
|
4972
|
+
0,
|
|
4973
|
+
0
|
|
4974
|
+
]
|
|
4975
|
+
],
|
|
4976
|
+
[
|
|
4977
|
+
'SQRT',
|
|
4978
|
+
[
|
|
4979
|
+
1,
|
|
4980
|
+
1
|
|
4981
|
+
]
|
|
4982
|
+
],
|
|
4983
|
+
[
|
|
4984
|
+
'SUBTOTAL',
|
|
4985
|
+
[
|
|
4986
|
+
2,
|
|
4987
|
+
255
|
|
4988
|
+
]
|
|
4989
|
+
],
|
|
4990
|
+
[
|
|
4991
|
+
'SUM',
|
|
4992
|
+
[
|
|
4993
|
+
1,
|
|
4994
|
+
255
|
|
4995
|
+
]
|
|
4996
|
+
],
|
|
4997
|
+
[
|
|
4998
|
+
'TRUE',
|
|
4999
|
+
[
|
|
5000
|
+
0,
|
|
5001
|
+
0
|
|
5002
|
+
]
|
|
5003
|
+
]
|
|
5004
|
+
]);
|
|
5005
|
+
function normalizeSpreadsheetFunctionName(name) {
|
|
5006
|
+
let normalized = name.toUpperCase();
|
|
5007
|
+
while(normalized.startsWith('_XLFN.') || normalized.startsWith('_XLWS.'))normalized = normalized.slice(6);
|
|
5008
|
+
return normalized;
|
|
5009
|
+
}
|
|
5010
|
+
function evaluateParserSubtotal(parameters) {
|
|
5011
|
+
const codeValue = parserNumericValue(parameters[0]);
|
|
5012
|
+
if (void 0 === codeValue) return 'VALUE!';
|
|
5013
|
+
const code = Math.trunc(codeValue);
|
|
5014
|
+
const values = parameters.slice(1).flatMap((parameter)=>flattenParserValues(parameter));
|
|
5015
|
+
for (const value of values){
|
|
5016
|
+
const error = parserErrorValue(value);
|
|
5017
|
+
if (error) return error;
|
|
5018
|
+
}
|
|
5019
|
+
switch(code){
|
|
5020
|
+
case 1:
|
|
5021
|
+
case 101:
|
|
5022
|
+
return parserSubtotalNumeric(values, 'average');
|
|
5023
|
+
case 2:
|
|
5024
|
+
case 102:
|
|
5025
|
+
return values.filter((value)=>'number' == typeof value).length;
|
|
5026
|
+
case 3:
|
|
5027
|
+
case 103:
|
|
5028
|
+
return values.filter((value)=>null != value).length;
|
|
5029
|
+
case 4:
|
|
5030
|
+
case 104:
|
|
5031
|
+
return parserSubtotalNumeric(values, 'max');
|
|
5032
|
+
case 5:
|
|
5033
|
+
case 105:
|
|
5034
|
+
return parserSubtotalNumeric(values, 'min');
|
|
5035
|
+
case 6:
|
|
5036
|
+
case 106:
|
|
5037
|
+
return parserSubtotalNumeric(values, 'product');
|
|
5038
|
+
case 7:
|
|
5039
|
+
case 107:
|
|
5040
|
+
return parserSubtotalNumeric(values, 'stddev');
|
|
5041
|
+
case 8:
|
|
5042
|
+
case 108:
|
|
5043
|
+
return parserSubtotalNumeric(values, 'stddevp');
|
|
5044
|
+
case 9:
|
|
5045
|
+
case 109:
|
|
5046
|
+
return parserSubtotalNumeric(values, 'sum');
|
|
5047
|
+
case 10:
|
|
5048
|
+
case 110:
|
|
5049
|
+
return parserSubtotalNumeric(values, 'var');
|
|
5050
|
+
case 11:
|
|
5051
|
+
case 111:
|
|
5052
|
+
return parserSubtotalNumeric(values, 'varp');
|
|
5053
|
+
default:
|
|
5054
|
+
return 'VALUE!';
|
|
5055
|
+
}
|
|
5056
|
+
}
|
|
5057
|
+
function parserSubtotalNumeric(values, operation) {
|
|
5058
|
+
const numbers = values.filter((value)=>'number' == typeof value && Number.isFinite(value));
|
|
5059
|
+
const count = numbers.length;
|
|
5060
|
+
const sum = numbers.reduce((total, value)=>total + value, 0);
|
|
5061
|
+
if ('sum' === operation) return finiteParserNumber(sum);
|
|
5062
|
+
if ('average' === operation) return count ? finiteParserNumber(sum / count) : 'DIV/0!';
|
|
5063
|
+
if ('max' === operation) return finiteParserNumber(Math.max(...numbers, 0));
|
|
5064
|
+
if ('min' === operation) return finiteParserNumber(Math.min(...numbers, 0));
|
|
5065
|
+
if ('product' === operation) return finiteParserNumber(count ? numbers.reduce((total, value)=>total * value, 1) : 0);
|
|
5066
|
+
if ('stddev' === operation || 'var' === operation) {
|
|
5067
|
+
if (count < 2) return 'DIV/0!';
|
|
5068
|
+
} else if (0 === count) return 'DIV/0!';
|
|
5069
|
+
const mean = sum / count;
|
|
5070
|
+
const divisor = 'stddev' === operation || 'var' === operation ? count - 1 : count;
|
|
5071
|
+
const variance = numbers.reduce((total, value)=>total + (value - mean) ** 2, 0) / divisor;
|
|
5072
|
+
return finiteParserNumber('stddev' === operation || 'stddevp' === operation ? Math.sqrt(variance) : variance);
|
|
5073
|
+
}
|
|
5074
|
+
function flattenParserValues(value) {
|
|
5075
|
+
if (!Array.isArray(value)) return [
|
|
5076
|
+
value
|
|
5077
|
+
];
|
|
5078
|
+
return value.flatMap((entry)=>flattenParserValues(entry));
|
|
5079
|
+
}
|
|
5080
|
+
function parserNumericValue(value) {
|
|
5081
|
+
if ('number' == typeof value) return Number.isFinite(value) ? value : void 0;
|
|
5082
|
+
if ('boolean' == typeof value) return value ? 1 : 0;
|
|
5083
|
+
if ('string' != typeof value || !value.trim()) return;
|
|
5084
|
+
const parsed = Number(value);
|
|
5085
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
5086
|
+
}
|
|
5087
|
+
function parserErrorValue(value) {
|
|
5088
|
+
if (value instanceof Error) return value.message.startsWith('#') ? value.message.slice(1) : 'VALUE!';
|
|
5089
|
+
return 'string' == typeof value && value.startsWith('#') ? value.slice(1) : void 0;
|
|
5090
|
+
}
|
|
5091
|
+
function finiteParserNumber(value) {
|
|
5092
|
+
return Number.isFinite(value) ? value : 'NUM!';
|
|
5093
|
+
}
|
|
5094
|
+
function normalizeFormulaForFortuneParser(formula) {
|
|
5095
|
+
const source = formula.replace(/^=/, '');
|
|
5096
|
+
let output = '';
|
|
5097
|
+
let cursor = 0;
|
|
5098
|
+
let bracketDepth = 0;
|
|
5099
|
+
while(cursor < source.length){
|
|
5100
|
+
const character = source[cursor] ?? '';
|
|
5101
|
+
if ('"' === character || "'" === character) {
|
|
5102
|
+
const quote = character;
|
|
5103
|
+
output += quote;
|
|
5104
|
+
cursor += 1;
|
|
5105
|
+
while(cursor < source.length){
|
|
5106
|
+
const quoted = source[cursor] ?? '';
|
|
5107
|
+
output += quoted;
|
|
5108
|
+
cursor += 1;
|
|
5109
|
+
if (quoted !== quote) continue;
|
|
5110
|
+
if (source[cursor] === quote) {
|
|
5111
|
+
output += quote;
|
|
5112
|
+
cursor += 1;
|
|
5113
|
+
continue;
|
|
5114
|
+
}
|
|
5115
|
+
break;
|
|
5116
|
+
}
|
|
5117
|
+
continue;
|
|
5118
|
+
}
|
|
5119
|
+
if ('[' === character) {
|
|
5120
|
+
bracketDepth += 1;
|
|
5121
|
+
output += character;
|
|
5122
|
+
cursor += 1;
|
|
5123
|
+
continue;
|
|
5124
|
+
}
|
|
5125
|
+
if (']' === character && bracketDepth > 0) {
|
|
5126
|
+
bracketDepth -= 1;
|
|
5127
|
+
output += character;
|
|
5128
|
+
cursor += 1;
|
|
5129
|
+
continue;
|
|
5130
|
+
}
|
|
5131
|
+
if (0 === bracketDepth && isAsciiFormulaNameStart(character)) {
|
|
5132
|
+
const start = cursor;
|
|
5133
|
+
cursor += 1;
|
|
5134
|
+
while(cursor < source.length && isAsciiFormulaNameContinue(source[cursor] ?? ''))cursor += 1;
|
|
5135
|
+
const token = source.slice(start, cursor);
|
|
5136
|
+
const normalized = token.toUpperCase();
|
|
5137
|
+
const normalizedFunction = normalizeSpreadsheetFunctionName(token);
|
|
5138
|
+
const previous = adjacentNonWhitespace(source, start - 1, -1);
|
|
5139
|
+
const next = adjacentNonWhitespace(source, cursor, 1);
|
|
5140
|
+
if ('(' === next && normalizedFunction !== normalized) output += normalizedFunction;
|
|
5141
|
+
else if (('TRUE' === normalized || 'FALSE' === normalized) && '!' !== previous && '!' !== next && '(' !== next) output += `${token}()`;
|
|
5142
|
+
else output += token;
|
|
5143
|
+
continue;
|
|
5144
|
+
}
|
|
5145
|
+
output += character;
|
|
5146
|
+
cursor += 1;
|
|
5147
|
+
}
|
|
5148
|
+
return output;
|
|
5149
|
+
}
|
|
5150
|
+
function adjacentNonWhitespace(value, start, direction) {
|
|
5151
|
+
let cursor = start;
|
|
5152
|
+
while(cursor >= 0 && cursor < value.length){
|
|
5153
|
+
const character = value[cursor];
|
|
5154
|
+
if (character && !/\s/u.test(character)) return character;
|
|
5155
|
+
cursor += direction;
|
|
5156
|
+
}
|
|
5157
|
+
}
|
|
5158
|
+
function isAsciiFormulaNameStart(value) {
|
|
5159
|
+
return /[A-Za-z_]/u.test(value);
|
|
5160
|
+
}
|
|
5161
|
+
function isAsciiFormulaNameContinue(value) {
|
|
5162
|
+
return /[A-Za-z0-9_.]/u.test(value);
|
|
5163
|
+
}
|
|
5164
|
+
export { DEFAULT_DOCUMENT_INDEX_OPTIONS, DEFAULT_DOCUMENT_TABLE_OF_CONTENTS_OPTIONS, DOCUMENT_HIGHLIGHT_ATTRIBUTE, DOCUMENT_NO_PROOF_ATTRIBUTE, DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE, DOCUMENT_PARAGRAPH_BORDER_EDGES, DOCUMENT_PARAGRAPH_BORDER_STYLES, DOCUMENT_PARAGRAPH_ID_ATTRIBUTE, DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE, DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE, DOCUMENT_RUN_BORDER_ATTRIBUTE, DOCUMENT_RUN_BORDER_STYLES, DOCUMENT_RUN_SHADING_ATTRIBUTE, DOCUMENT_SCRIPT_FONTS_ATTRIBUTE, DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE, DocumentParagraphIdentity, DocxThemePatchCollector, OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, OoxmlPackage, WORK_TEMPLATES as officeTemplates, applyDocumentParagraphIdentityToElement, attribute, browserScalarFunctionArities, buildDocumentIndexEntries, buildDocumentTableOfContentsEntries, bytesToDataUrl, childPath, collectWorkDocumentOutline, contentTypeForPart, createDocumentParagraphIdentity, createDocumentParagraphIdentityRegistry, createWorkArtifact as createArtifact, createWorkId as createOfficeId, cssDocumentFontFamily, currentWorkDocumentOutlineItem, decodeXmlBytes, descendants, directChild, directChildren, documentBorderPresentation, documentFontNameFromCssFamily, documentHasIntegrityFeature, documentHighlightCssColor, documentHighlightDomAttributes, documentHighlightForCssColor, documentHighlightFromDocxValue, documentHighlightFromElement, documentIndexEntryFromElement, documentIndexEntryHtml, documentIndexHtml, documentIndexValueFromElement, documentNoProofFromElement, documentParagraphBordersDomAttributes, documentParagraphIdentityFromElement, documentParagraphShadingDomAttributes, documentProofingDomAttributes, documentProofingLanguagesFromElement, documentRunBorderDomAttributes, documentRunBorderIsVisible, documentRunShadingDomAttributes, documentScriptFontDirectFamily, documentScriptFontFallbackSlots, documentScriptFontFamily, documentScriptFontFamilyForRendering, documentScriptFontSegments, documentScriptFontSlotFromElement, documentScriptFontSlotFromHint, documentScriptFontsDomAttributes, documentScriptFontsForAllText, documentScriptFontsFromElement, documentTableOfContentsHtml, documentTableOfContentsValueFromElement, evaluateParserSubtotal, firstDescendant, isDocumentParagraphArtBorderStyle, isOfficeKernelSpreadsheetError, normalizeCssColor, normalizeDocumentFontName, normalizeDocumentHighlight, normalizeDocumentIndexEntry, normalizeDocumentIndexEntryDraft, normalizeDocumentIndexOptions, normalizeDocumentIndexValue, normalizeDocumentIndexesHtml, normalizeDocumentLanguageTag, normalizeDocumentNoProof, normalizeDocumentParagraphBorder, normalizeDocumentParagraphBorders, normalizeDocumentParagraphId, normalizeDocumentParagraphIdentity, normalizeDocumentProofingLanguages, normalizeDocumentRunBorder, normalizeDocumentRunShading, normalizeDocumentScriptFontHint, normalizeDocumentScriptFontSlot, normalizeDocumentScriptFonts, normalizeDocumentTableOfContentsHtml, normalizeDocumentTableOfContentsOptions, normalizeDocumentTableOfContentsValue, normalizeDocumentThemeFont, normalizeFormulaForFortuneParser, normalizeOfficeFontFamily, normalizeSpreadsheetFunctionName, officeFontFamilies, officeFontFamilyLabel, parseDocumentParagraphBorders, parseDocumentParagraphBordersElement, parseDocumentParagraphShading, parseDocumentParagraphShadingElement, parseDocumentProofingLanguages, parseDocumentRunBorder, parseDocumentRunBorderElement, parseDocumentRunShading, parseDocumentRunShadingElement, parseDocumentScriptFonts, parseDocumentTableOfContentsInstruction, parseDocxThemeReference, parseXml, patchDocumentProofingLanguages, patchDocumentScriptFonts, patchDocxThemeReferences, primeDocumentIntegrityFeatures, resolvePartTarget, serializeDocumentParagraphBorders, serializeDocumentParagraphShading, serializeDocumentProofingLanguages, serializeDocumentRunBorder, serializeDocumentRunShading, serializeDocumentScriptFonts, serializeDocxThemeReference, serializeUtf8Xml, uniqueDocumentParagraphIdentity, visibleWorkDocumentOutlineItems, workDocumentOutlineLevel, work_document_paragraph_shading_DOCUMENT_PARAGRAPH_SHADING_PATTERNS, xmlContainsAnyElement, xmlNamespacePrefix };
|