@a3s-lab/office 0.36.0 → 0.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -6
- package/dist/0~3557.js +2 -1
- package/dist/0~3635.js +4 -1
- package/dist/0~7048.js +93 -1
- package/dist/0~9073.js +7 -2
- package/dist/0~presentation-editor.js +45 -9
- package/dist/0~spreadsheet-editor.js +20321 -16966
- package/dist/4121.js +1942 -1939
- package/dist/{3266.js → 5416.js} +1504 -20
- package/dist/9333.js +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +141 -28
- package/dist/index.js +1 -1
- package/dist/internal/features/work/editors/office-shortcuts.d.ts +1 -0
- package/dist/internal/features/work/editors/spreadsheet-auto-filter-command.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-auto-filter-condition-dialog-model.d.ts +27 -0
- package/dist/internal/features/work/editors/spreadsheet-auto-filter-condition-dialog.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-auto-filter-menu.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-auto-filter.d.ts +16 -4
- package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +1 -0
- package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +13 -1
- package/dist/internal/features/work/editors/spreadsheet-current-region.d.ts +12 -0
- package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-appearance.d.ts +45 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-collation.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-command.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-custom-list-editor.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-custom-list-store.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-custom-list.d.ts +26 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-dialog.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-matrix.d.ts +4 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-options-dialog.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-order-controls.d.ts +16 -0
- package/dist/internal/features/work/editors/spreadsheet-sort-range-dialog.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-sort.d.ts +138 -0
- package/dist/internal/features/work/editors/spreadsheet-table-totals.d.ts +39 -0
- package/dist/internal/features/work/editors/spreadsheet-table.d.ts +11 -1
- package/dist/internal/features/work/editors/use-spreadsheet-auto-filter.d.ts +12 -3
- package/dist/internal/features/work/editors/use-spreadsheet-sort.d.ts +26 -0
- package/dist/internal/features/work/editors/work-office-chrome.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-auto-filter.d.ts +14 -0
- package/dist/internal/features/work/work-spreadsheet-dynamic-filter.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-filter-contract.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-wildcard.d.ts +7 -0
- package/dist/internal/features/work/work-types.d.ts +45 -7
- package/dist/internal/features/work/work-xlsx-interop.d.ts +2 -1
- package/dist/internal/features/work/work-xlsx-table-filters.d.ts +3 -1
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-formula.d.ts +11 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +93 -1
- package/dist/styles.css +789 -145
- package/dist/vue.d.ts +3 -1
- package/dist/vue.js +2 -0
- package/dist/web-component.d.ts +3 -1
- package/dist/web-component.js +9 -0
- package/dist/work-spreadsheet-package-scan.worker.js +2 -1
- package/docs/latest/en/browser-editor-architecture.md +136 -2
- package/package.json +24 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type { WorkSpreadsheetTableFilter } from './work-types';
|
|
1
|
+
import type { WorkSpreadsheetFilter, WorkSpreadsheetTableFilter } from './work-types';
|
|
2
2
|
export declare function readXlsxTableFilters(table: Document, width: number): WorkSpreadsheetTableFilter[];
|
|
3
|
+
export declare function readXlsxAutoFilterColumns(autoFilter: Element, width: number): WorkSpreadsheetFilter[];
|
|
3
4
|
export declare function xlsxTableAutoFilterXml(filters: readonly WorkSpreadsheetTableFilter[], rangeReference: string, totalsRow: boolean): string;
|
|
5
|
+
export declare function xlsxAutoFilterXml(filters: readonly WorkSpreadsheetFilter[], rangeReference: string): string;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export declare const browserScalarFunctionArities: Map<string, readonly [minimum: number, maximum: number]>;
|
|
2
2
|
export declare function normalizeSpreadsheetFunctionName(name: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Evaluate the bounded browser implementation of `SUBTOTAL`.
|
|
5
|
+
*
|
|
6
|
+
* Fortune delegates unknown functions to Formula.js. Formula.js returns an
|
|
7
|
+
* undefined value for an unknown function number, which the parser can then
|
|
8
|
+
* coerce into a boolean. Keeping this small implementation here makes the
|
|
9
|
+
* JavaScript fallback deterministic and aligned with the Rust kernel. The
|
|
10
|
+
* calculation request does not carry hidden-row metadata yet, so the 1–11
|
|
11
|
+
* and 101–111 function-number families intentionally have the same result.
|
|
12
|
+
*/
|
|
13
|
+
export declare function evaluateParserSubtotal(parameters: readonly unknown[]): unknown;
|
|
3
14
|
export declare function normalizeFormulaForFortuneParser(formula: string): string;
|
package/dist/office-kernel.wasm
CHANGED
|
Binary file
|
|
@@ -13727,6 +13727,13 @@
|
|
|
13727
13727
|
1
|
|
13728
13728
|
]
|
|
13729
13729
|
],
|
|
13730
|
+
[
|
|
13731
|
+
'SUBTOTAL',
|
|
13732
|
+
[
|
|
13733
|
+
2,
|
|
13734
|
+
255
|
|
13735
|
+
]
|
|
13736
|
+
],
|
|
13730
13737
|
[
|
|
13731
13738
|
'SUM',
|
|
13732
13739
|
[
|
|
@@ -13747,6 +13754,90 @@
|
|
|
13747
13754
|
while(normalized.startsWith('_XLFN.') || normalized.startsWith('_XLWS.'))normalized = normalized.slice(6);
|
|
13748
13755
|
return normalized;
|
|
13749
13756
|
}
|
|
13757
|
+
function evaluateParserSubtotal(parameters) {
|
|
13758
|
+
const codeValue = parserNumericValue(parameters[0]);
|
|
13759
|
+
if (void 0 === codeValue) return 'VALUE!';
|
|
13760
|
+
const code = Math.trunc(codeValue);
|
|
13761
|
+
const values = parameters.slice(1).flatMap((parameter)=>flattenParserValues(parameter));
|
|
13762
|
+
for (const value of values){
|
|
13763
|
+
const error = parserErrorValue(value);
|
|
13764
|
+
if (error) return error;
|
|
13765
|
+
}
|
|
13766
|
+
switch(code){
|
|
13767
|
+
case 1:
|
|
13768
|
+
case 101:
|
|
13769
|
+
return parserSubtotalNumeric(values, 'average');
|
|
13770
|
+
case 2:
|
|
13771
|
+
case 102:
|
|
13772
|
+
return values.filter((value)=>'number' == typeof value).length;
|
|
13773
|
+
case 3:
|
|
13774
|
+
case 103:
|
|
13775
|
+
return values.filter((value)=>null != value).length;
|
|
13776
|
+
case 4:
|
|
13777
|
+
case 104:
|
|
13778
|
+
return parserSubtotalNumeric(values, 'max');
|
|
13779
|
+
case 5:
|
|
13780
|
+
case 105:
|
|
13781
|
+
return parserSubtotalNumeric(values, 'min');
|
|
13782
|
+
case 6:
|
|
13783
|
+
case 106:
|
|
13784
|
+
return parserSubtotalNumeric(values, 'product');
|
|
13785
|
+
case 7:
|
|
13786
|
+
case 107:
|
|
13787
|
+
return parserSubtotalNumeric(values, 'stddev');
|
|
13788
|
+
case 8:
|
|
13789
|
+
case 108:
|
|
13790
|
+
return parserSubtotalNumeric(values, 'stddevp');
|
|
13791
|
+
case 9:
|
|
13792
|
+
case 109:
|
|
13793
|
+
return parserSubtotalNumeric(values, 'sum');
|
|
13794
|
+
case 10:
|
|
13795
|
+
case 110:
|
|
13796
|
+
return parserSubtotalNumeric(values, 'var');
|
|
13797
|
+
case 11:
|
|
13798
|
+
case 111:
|
|
13799
|
+
return parserSubtotalNumeric(values, 'varp');
|
|
13800
|
+
default:
|
|
13801
|
+
return 'VALUE!';
|
|
13802
|
+
}
|
|
13803
|
+
}
|
|
13804
|
+
function parserSubtotalNumeric(values, operation) {
|
|
13805
|
+
const numbers = values.filter((value)=>'number' == typeof value && Number.isFinite(value));
|
|
13806
|
+
const count = numbers.length;
|
|
13807
|
+
const sum = numbers.reduce((total, value)=>total + value, 0);
|
|
13808
|
+
if ('sum' === operation) return finiteParserNumber(sum);
|
|
13809
|
+
if ('average' === operation) return count ? finiteParserNumber(sum / count) : 'DIV/0!';
|
|
13810
|
+
if ('max' === operation) return finiteParserNumber(Math.max(...numbers, 0));
|
|
13811
|
+
if ('min' === operation) return finiteParserNumber(Math.min(...numbers, 0));
|
|
13812
|
+
if ('product' === operation) return finiteParserNumber(count ? numbers.reduce((total, value)=>total * value, 1) : 0);
|
|
13813
|
+
if ('stddev' === operation || 'var' === operation) {
|
|
13814
|
+
if (count < 2) return 'DIV/0!';
|
|
13815
|
+
} else if (0 === count) return 'DIV/0!';
|
|
13816
|
+
const mean = sum / count;
|
|
13817
|
+
const divisor = 'stddev' === operation || 'var' === operation ? count - 1 : count;
|
|
13818
|
+
const variance = numbers.reduce((total, value)=>total + (value - mean) ** 2, 0) / divisor;
|
|
13819
|
+
return finiteParserNumber('stddev' === operation || 'stddevp' === operation ? Math.sqrt(variance) : variance);
|
|
13820
|
+
}
|
|
13821
|
+
function flattenParserValues(value) {
|
|
13822
|
+
if (!Array.isArray(value)) return [
|
|
13823
|
+
value
|
|
13824
|
+
];
|
|
13825
|
+
return value.flatMap((entry)=>flattenParserValues(entry));
|
|
13826
|
+
}
|
|
13827
|
+
function parserNumericValue(value) {
|
|
13828
|
+
if ('number' == typeof value) return Number.isFinite(value) ? value : void 0;
|
|
13829
|
+
if ('boolean' == typeof value) return value ? 1 : 0;
|
|
13830
|
+
if ('string' != typeof value || !value.trim()) return;
|
|
13831
|
+
const parsed = Number(value);
|
|
13832
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
13833
|
+
}
|
|
13834
|
+
function parserErrorValue(value) {
|
|
13835
|
+
if (value instanceof Error) return value.message.startsWith('#') ? value.message.slice(1) : 'VALUE!';
|
|
13836
|
+
return 'string' == typeof value && value.startsWith('#') ? value.slice(1) : void 0;
|
|
13837
|
+
}
|
|
13838
|
+
function finiteParserNumber(value) {
|
|
13839
|
+
return Number.isFinite(value) ? value : 'NUM!';
|
|
13840
|
+
}
|
|
13750
13841
|
function normalizeFormulaForFortuneParser(formula) {
|
|
13751
13842
|
const source = formula.replace(/^=/, '');
|
|
13752
13843
|
let output = '';
|
|
@@ -14608,10 +14699,11 @@
|
|
|
14608
14699
|
let unsupportedFunction;
|
|
14609
14700
|
let materializedRangeCells = 0;
|
|
14610
14701
|
parser.setFunction('IFERROR', evaluateParserIfError).setFunction('ROW', (parameters)=>parameters.length ? null : coordinate.row + 1).setFunction('COLUMN', (parameters)=>parameters.length ? null : coordinate.column + 1);
|
|
14611
|
-
parser.on('callFunction', (name, parameters)=>{
|
|
14702
|
+
parser.on('callFunction', (name, parameters, done)=>{
|
|
14612
14703
|
const normalized = normalizeSpreadsheetFunctionName(name);
|
|
14613
14704
|
const arity = browserScalarFunctionArities.get(normalized);
|
|
14614
14705
|
if (!arity || parameters.length < arity[0] || parameters.length > arity[1]) unsupportedFunction ??= name.toUpperCase();
|
|
14706
|
+
if ('SUBTOTAL' === normalized) done(evaluateParserSubtotal(parameters));
|
|
14615
14707
|
});
|
|
14616
14708
|
parser.on('callCellValue', (cell, _options, done)=>{
|
|
14617
14709
|
const dependency = this.resolveCoordinate(indexed.sheet, cell);
|