@a3s-lab/office 0.11.0 → 0.12.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 +23 -1
- package/dist/0~spreadsheet-editor.js +189 -104
- package/dist/0~work-docx-import.js +2 -2
- package/dist/0~work-office-diagnostics.js +6 -4
- package/dist/0~work-pptx-import.js +2 -2
- package/dist/4104.js +329 -121
- package/dist/4476.js +82 -65
- package/dist/8715.js +41 -3
- package/dist/9356.js +126 -8
- package/dist/core.d.ts +1 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +1 -0
- package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +2 -1
- package/dist/internal/features/work/spreadsheet-sparse.d.ts +5 -0
- package/dist/internal/features/work/work-document-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-docx-import.d.ts +2 -1
- package/dist/internal/features/work/work-file-data.d.ts +7 -1
- package/dist/internal/features/work/work-file-import.d.ts +28 -0
- package/dist/internal/features/work/work-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-markdown-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-office-diagnostics.d.ts +3 -2
- package/dist/internal/features/work/work-pptx-import.d.ts +1 -1
- package/dist/internal/features/work/work-presentation-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-spreadsheet-protection.d.ts +2 -0
- package/dist/internal/features/work/work-types.d.ts +22 -0
- package/dist/internal/features/work/work-xlsx-interop.d.ts +4 -14
- package/dist/office-kernel.wasm +0 -0
- package/package.json +8 -4
package/dist/4476.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationEditable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin } from "./9787.js";
|
|
2
2
|
import { OFFICE_KERNEL_SPREADSHEET_MAX_ROWS } from "./5184.js";
|
|
3
3
|
import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
|
|
4
|
+
import { sparseMatrixColumnCount, sparseArrayEntries as spreadsheet_sparse_sparseArrayEntries, cloneSparseMatrix, formatSpreadsheetCellRanges, parseSpreadsheetCellRanges as work_spreadsheet_ranges_parseSpreadsheetCellRanges } from "./8715.js";
|
|
4
5
|
import { patchWorkOfficeCollaborationFlatJsonMap, readWorkOfficeCollaborationFlatJsonMap } from "./7060.js";
|
|
5
|
-
import { formatSpreadsheetCellRanges, parseSpreadsheetCellRanges } from "./8715.js";
|
|
6
6
|
import * as __rspack_external_yjs from "yjs";
|
|
7
7
|
const MAX_POPULATED_CELLS = 1000000;
|
|
8
8
|
const MAX_DENSE_MATRIX_CELLS = 1000000;
|
|
@@ -421,7 +421,7 @@ function assertCompatibleValue(previous, next, shared, label) {
|
|
|
421
421
|
function spreadsheetCells(sheet) {
|
|
422
422
|
const result = new Map();
|
|
423
423
|
if (void 0 !== sheet.data) {
|
|
424
|
-
for (const [row, values] of sheet.data
|
|
424
|
+
for (const [row, values] of spreadsheet_sparse_sparseArrayEntries(sheet.data))for (const [column, cell] of spreadsheet_sparse_sparseArrayEntries(values))if (null !== cell) result.set(`${row}:${column}`, cell);
|
|
425
425
|
return result;
|
|
426
426
|
}
|
|
427
427
|
for (const entry of sheet.celldata ?? [])if (null !== entry.v) result.set(`${entry.r}:${entry.c}`, entry.v);
|
|
@@ -531,7 +531,7 @@ function spreadsheetCellEntries(sheet) {
|
|
|
531
531
|
if (!sheet) return [];
|
|
532
532
|
const entries = [];
|
|
533
533
|
if (void 0 !== sheet.data) {
|
|
534
|
-
for (const [row, values] of sheet.data
|
|
534
|
+
for (const [row, values] of spreadsheet_sparse_sparseArrayEntries(sheet.data))for (const [column, cell] of spreadsheet_sparse_sparseArrayEntries(values))if (null !== cell) entries.push({
|
|
535
535
|
cell,
|
|
536
536
|
column,
|
|
537
537
|
coordinate: encodedCoordinate(row, column),
|
|
@@ -1305,7 +1305,8 @@ function defaultSheetProtectionAuthority(enabled = false) {
|
|
|
1305
1305
|
editScenarios: 0,
|
|
1306
1306
|
hintText: '',
|
|
1307
1307
|
defaultSheetHintText: DEFAULT_PROTECTION_HINT,
|
|
1308
|
-
allowRangeList: []
|
|
1308
|
+
allowRangeList: [],
|
|
1309
|
+
cellProtectionRanges: []
|
|
1309
1310
|
};
|
|
1310
1311
|
}
|
|
1311
1312
|
function sheetProtectionAuthority(sheet) {
|
|
@@ -1335,9 +1336,23 @@ function normalizeSheetProtectionAuthority(source) {
|
|
|
1335
1336
|
hintText: stringValue(authority.hintText),
|
|
1336
1337
|
defaultSheetHintText: stringValue(authority.defaultSheetHintText) || DEFAULT_PROTECTION_HINT,
|
|
1337
1338
|
allowRangeList: editableRangeList(authority.allowRangeList),
|
|
1339
|
+
cellProtectionRanges: cellProtectionRangeList(authority.cellProtectionRanges),
|
|
1338
1340
|
xlsxAttributes: stringRecord(authority.xlsxAttributes)
|
|
1339
1341
|
};
|
|
1340
1342
|
}
|
|
1343
|
+
function importedSheetProtectionAuthority(authority, cellProtectionRanges) {
|
|
1344
|
+
if (!authority && !cellProtectionRanges.length) return;
|
|
1345
|
+
const normalized = normalizeSheetProtectionAuthority(authority);
|
|
1346
|
+
normalized.cellProtectionRanges = [
|
|
1347
|
+
...cellProtectionRanges,
|
|
1348
|
+
...normalized.allowRangeList.filter((range)=>!editableRangeRequiresCredentials(range)).flatMap((range)=>work_spreadsheet_ranges_parseSpreadsheetCellRanges(range.sqref) ?? []).map((range)=>({
|
|
1349
|
+
range,
|
|
1350
|
+
locked: false,
|
|
1351
|
+
hidden: false
|
|
1352
|
+
}))
|
|
1353
|
+
];
|
|
1354
|
+
return normalized;
|
|
1355
|
+
}
|
|
1341
1356
|
function withSheetProtection(sheet, enabled) {
|
|
1342
1357
|
const authority = sheetProtectionAuthority(sheet);
|
|
1343
1358
|
authority.sheet = enabled ? 1 : 0;
|
|
@@ -1359,73 +1374,56 @@ function withEditableRange(sheet, index, editableRange) {
|
|
|
1359
1374
|
};
|
|
1360
1375
|
if (null !== index && authority.allowRangeList[index]) authority.allowRangeList[index] = nextRange;
|
|
1361
1376
|
else authority.allowRangeList.push(nextRange);
|
|
1362
|
-
const ranges =
|
|
1363
|
-
|
|
1377
|
+
const ranges = work_spreadsheet_ranges_parseSpreadsheetCellRanges(nextRange.sqref) ?? [];
|
|
1378
|
+
const next = withCellProtection(sheet, ranges, false);
|
|
1379
|
+
const nextAuthority = sheetProtectionAuthority(next);
|
|
1380
|
+
nextAuthority.allowRangeList = authority.allowRangeList;
|
|
1381
|
+
return withAuthority(next, nextAuthority);
|
|
1364
1382
|
}
|
|
1365
1383
|
function withoutEditableRange(sheet, index) {
|
|
1366
1384
|
const authority = sheetProtectionAuthority(sheet);
|
|
1367
1385
|
const removed = authority.allowRangeList[index];
|
|
1368
1386
|
if (!removed) return sheet;
|
|
1369
1387
|
authority.allowRangeList.splice(index, 1);
|
|
1370
|
-
const removedRanges =
|
|
1388
|
+
const removedRanges = work_spreadsheet_ranges_parseSpreadsheetCellRanges(removed.sqref) ?? [];
|
|
1371
1389
|
let next = withCellProtection(sheet, removedRanges, true);
|
|
1372
|
-
for (const editableRange of authority.allowRangeList)if (!editableRangeRequiresCredentials(editableRange)) next = withCellProtection(next,
|
|
1373
|
-
|
|
1390
|
+
for (const editableRange of authority.allowRangeList)if (!editableRangeRequiresCredentials(editableRange)) next = withCellProtection(next, work_spreadsheet_ranges_parseSpreadsheetCellRanges(editableRange.sqref) ?? [], false);
|
|
1391
|
+
const nextAuthority = sheetProtectionAuthority(next);
|
|
1392
|
+
nextAuthority.allowRangeList = authority.allowRangeList;
|
|
1393
|
+
return withAuthority(next, nextAuthority);
|
|
1374
1394
|
}
|
|
1375
1395
|
function withCellProtection(sheet, ranges, locked, hidden = false) {
|
|
1376
1396
|
if (!ranges.length) return sheet;
|
|
1377
|
-
const data =
|
|
1397
|
+
const data = cloneSparseMatrix(sheet.data);
|
|
1378
1398
|
let rowCount = Math.max(sheet.row ?? 0, data.length);
|
|
1379
|
-
let columnCount = Math.max(sheet.column ?? 0,
|
|
1399
|
+
let columnCount = Math.max(sheet.column ?? 0, sparseMatrixColumnCount(data));
|
|
1380
1400
|
for (const range of ranges){
|
|
1381
1401
|
rowCount = Math.max(rowCount, range.row[1] + 1);
|
|
1382
1402
|
columnCount = Math.max(columnCount, range.column[1] + 1);
|
|
1383
|
-
for(
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
data[row][column] = cell;
|
|
1393
|
-
}
|
|
1403
|
+
for (const [row, values] of spreadsheet_sparse_sparseArrayEntries(data))if (!(row < range.row[0]) && !(row > range.row[1])) for (const [column, source] of spreadsheet_sparse_sparseArrayEntries(values)){
|
|
1404
|
+
if (column < range.column[0] || column > range.column[1]) continue;
|
|
1405
|
+
const cell = {
|
|
1406
|
+
...source ?? {}
|
|
1407
|
+
};
|
|
1408
|
+
cell.lo = locked ? 1 : 0;
|
|
1409
|
+
if (hidden) cell.hi = 1;
|
|
1410
|
+
else if (void 0 !== cell.hi) delete cell.hi;
|
|
1411
|
+
data[row][column] = cell;
|
|
1394
1412
|
}
|
|
1395
1413
|
}
|
|
1396
1414
|
normalizeMatrix(data, rowCount, columnCount);
|
|
1397
|
-
|
|
1415
|
+
const authority = sheetProtectionAuthority(sheet);
|
|
1416
|
+
authority.cellProtectionRanges.push(...ranges.map((range)=>({
|
|
1417
|
+
range,
|
|
1418
|
+
locked,
|
|
1419
|
+
hidden
|
|
1420
|
+
})));
|
|
1421
|
+
return withAuthority({
|
|
1398
1422
|
...sheet,
|
|
1399
1423
|
row: rowCount,
|
|
1400
1424
|
column: columnCount,
|
|
1401
1425
|
data
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
function applySpreadsheetCellProtectionRanges(data, ranges, rowCount, columnCount) {
|
|
1405
|
-
for (const item of ranges){
|
|
1406
|
-
const lastRow = Math.min(item.range.row[1], rowCount - 1);
|
|
1407
|
-
const lastColumn = Math.min(item.range.column[1], columnCount - 1);
|
|
1408
|
-
for(let row = Math.max(0, item.range.row[0]); row <= lastRow; row += 1){
|
|
1409
|
-
data[row] ??= [];
|
|
1410
|
-
for(let column = Math.max(0, item.range.column[0]); column <= lastColumn; column += 1){
|
|
1411
|
-
const cell = {
|
|
1412
|
-
...data[row][column] ?? {}
|
|
1413
|
-
};
|
|
1414
|
-
cell.lo = item.locked ? 1 : 0;
|
|
1415
|
-
if (item.hidden) cell.hi = 1;
|
|
1416
|
-
else if (void 0 !== cell.hi) delete cell.hi;
|
|
1417
|
-
data[row][column] = cell;
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
function applyPasswordlessEditableRanges(data, ranges, rowCount, columnCount) {
|
|
1423
|
-
const protectionRanges = ranges.filter((range)=>!editableRangeRequiresCredentials(range)).flatMap((range)=>parseSpreadsheetCellRanges(range.sqref) ?? []).map((range)=>({
|
|
1424
|
-
range,
|
|
1425
|
-
locked: false,
|
|
1426
|
-
hidden: false
|
|
1427
|
-
}));
|
|
1428
|
-
applySpreadsheetCellProtectionRanges(data, protectionRanges, rowCount, columnCount);
|
|
1426
|
+
}, authority);
|
|
1429
1427
|
}
|
|
1430
1428
|
function editableRangeRequiresCredentials(range) {
|
|
1431
1429
|
const attributes = range.xlsxAttributes ?? {};
|
|
@@ -1446,7 +1444,7 @@ function spreadsheetProtectionKey(sheets) {
|
|
|
1446
1444
|
return sheets.map((sheet)=>{
|
|
1447
1445
|
const authority = sheetProtectionAuthority(sheet);
|
|
1448
1446
|
const cells = [];
|
|
1449
|
-
for (const [row, values] of (sheet.data
|
|
1447
|
+
for (const [row, values] of spreadsheet_sparse_sparseArrayEntries(sheet.data))for (const [column, cell] of spreadsheet_sparse_sparseArrayEntries(values)){
|
|
1450
1448
|
const hidden = cell?.hi;
|
|
1451
1449
|
if (cell?.lo !== void 0 || void 0 !== hidden) cells.push(`${row}_${column}:${cell?.lo ?? ''}:${hidden ?? ''}`);
|
|
1452
1450
|
}
|
|
@@ -1471,7 +1469,7 @@ function editableRangeList(value) {
|
|
|
1471
1469
|
if (!item || 'object' != typeof item) return [];
|
|
1472
1470
|
const range = item;
|
|
1473
1471
|
const sqref = stringValue(range.sqref);
|
|
1474
|
-
if (!sqref || !
|
|
1472
|
+
if (!sqref || !work_spreadsheet_ranges_parseSpreadsheetCellRanges(sqref)) return [];
|
|
1475
1473
|
return [
|
|
1476
1474
|
{
|
|
1477
1475
|
name: stringValue(range.name) || `Range ${index + 1}`,
|
|
@@ -1483,21 +1481,40 @@ function editableRangeList(value) {
|
|
|
1483
1481
|
});
|
|
1484
1482
|
}
|
|
1485
1483
|
function canonicalRangeReference(value) {
|
|
1486
|
-
const ranges =
|
|
1484
|
+
const ranges = work_spreadsheet_ranges_parseSpreadsheetCellRanges(value);
|
|
1487
1485
|
return ranges ? formatSpreadsheetCellRanges(ranges) : value.trim();
|
|
1488
1486
|
}
|
|
1489
|
-
function cloneMatrix(source) {
|
|
1490
|
-
return (source ?? []).map((row)=>[
|
|
1491
|
-
...row
|
|
1492
|
-
]);
|
|
1493
|
-
}
|
|
1494
1487
|
function normalizeMatrix(data, rows, columns) {
|
|
1495
|
-
|
|
1496
|
-
for(
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1488
|
+
data.length = Math.max(data.length, rows);
|
|
1489
|
+
for (const [, row] of spreadsheet_sparse_sparseArrayEntries(data))row.length = Math.max(row.length, columns);
|
|
1490
|
+
}
|
|
1491
|
+
function cellProtectionRangeList(value) {
|
|
1492
|
+
if (!Array.isArray(value)) return [];
|
|
1493
|
+
return value.flatMap((item)=>{
|
|
1494
|
+
if (!item || 'object' != typeof item) return [];
|
|
1495
|
+
const candidate = item;
|
|
1496
|
+
const range = candidate.range;
|
|
1497
|
+
if (!range || !Array.isArray(range.row) || !Array.isArray(range.column) || range.row.length < 2 || range.column.length < 2 || ![
|
|
1498
|
+
...range.row,
|
|
1499
|
+
...range.column
|
|
1500
|
+
].every((index)=>Number.isSafeInteger(index) && index >= 0)) return [];
|
|
1501
|
+
return [
|
|
1502
|
+
{
|
|
1503
|
+
range: {
|
|
1504
|
+
row: [
|
|
1505
|
+
Math.min(range.row[0], range.row[1]),
|
|
1506
|
+
Math.max(range.row[0], range.row[1])
|
|
1507
|
+
],
|
|
1508
|
+
column: [
|
|
1509
|
+
Math.min(range.column[0], range.column[1]),
|
|
1510
|
+
Math.max(range.column[0], range.column[1])
|
|
1511
|
+
]
|
|
1512
|
+
},
|
|
1513
|
+
locked: false !== candidate.locked,
|
|
1514
|
+
hidden: true === candidate.hidden
|
|
1515
|
+
}
|
|
1516
|
+
];
|
|
1517
|
+
});
|
|
1501
1518
|
}
|
|
1502
1519
|
function flag(value, fallback) {
|
|
1503
1520
|
if (1 === value || true === value || '1' === value) return 1;
|
|
@@ -2005,4 +2022,4 @@ function boundedInteger(value, minimum, maximum, fallback) {
|
|
|
2005
2022
|
function boundedNumber(value, minimum, maximum, fallback) {
|
|
2006
2023
|
return 'number' == typeof value && Number.isFinite(value) && value >= minimum && value <= maximum ? value : fallback;
|
|
2007
2024
|
}
|
|
2008
|
-
export { DEFAULT_PROTECTION_HINT, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, SPREADSHEET_CONDITIONAL_ICON_SETS,
|
|
2025
|
+
export { DEFAULT_PROTECTION_HINT, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, SPREADSHEET_CONDITIONAL_ICON_SETS, createWorkOfficeSpreadsheetCollaborationBinding as createOfficeSpreadsheetCollaborationBinding, defaultSpreadsheetColorScaleThresholds, defaultSpreadsheetConditionalIconThresholds, defaultSpreadsheetDataBarOptions, drawSpreadsheetConditionalIcon, editableRangeCellCount, editableRangeRequiresCredentials, effectiveSpreadsheetPageSetup, importedSheetProtectionAuthority, initializeWorkOfficeSpreadsheetCollaboration as initializeOfficeSpreadsheetCollaboration, isSpreadsheetConditionalComparisonOperator, isSpreadsheetConditionalIconSetName, normalizeSheetProtectionAuthority, normalizeSpreadsheetConditionalIconSetFormat, normalizeSpreadsheetConditionalVisualOptions, normalizeSpreadsheetPaperSize, protectedSheetCount, readWorkOfficeSpreadsheetCollaboration as readOfficeSpreadsheetCollaboration, replaceWorkOfficeSpreadsheetCollaboration as replaceOfficeSpreadsheetCollaboration, sheetHasProtectionState, sheetProtectionAuthority, spreadsheetConditionalComparisonNeedsUpperValue, spreadsheetConditionalIconForValue, spreadsheetConditionalIconSetCount, spreadsheetConditionalThresholdValue, spreadsheetConditionalThresholdsEqual, spreadsheetProtectionKey, unlockedCellCount, withEditableRange, withSheetProtection, withSheetSelectionPermissions, withoutEditableRange };
|
package/dist/8715.js
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
import { createOfficeId as createWorkId, directChild, attribute } from "./5184.js";
|
|
2
|
+
function sparseArrayIndexes(values) {
|
|
3
|
+
if (!values) return [];
|
|
4
|
+
return Object.keys(values).flatMap((key)=>{
|
|
5
|
+
const index = Number(key);
|
|
6
|
+
return Number.isSafeInteger(index) && index >= 0 && index < values.length ? [
|
|
7
|
+
index
|
|
8
|
+
] : [];
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function sparseArrayEntries(values) {
|
|
12
|
+
if (!values) return [];
|
|
13
|
+
return sparseArrayIndexes(values).flatMap((index)=>{
|
|
14
|
+
const value = values[index];
|
|
15
|
+
return void 0 === value ? [] : [
|
|
16
|
+
[
|
|
17
|
+
index,
|
|
18
|
+
value
|
|
19
|
+
]
|
|
20
|
+
];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function sparseMatrixColumnCount(matrix) {
|
|
24
|
+
let maximum = 0;
|
|
25
|
+
for (const [, row] of sparseArrayEntries(matrix))maximum = Math.max(maximum, row.length);
|
|
26
|
+
return maximum;
|
|
27
|
+
}
|
|
28
|
+
function cloneSparseMatrix(source) {
|
|
29
|
+
const clone = [];
|
|
30
|
+
if (!source) return clone;
|
|
31
|
+
clone.length = source.length;
|
|
32
|
+
for (const [rowIndex, sourceRow] of sparseArrayEntries(source)){
|
|
33
|
+
const row = [];
|
|
34
|
+
row.length = sourceRow.length;
|
|
35
|
+
for (const columnIndex of sparseArrayIndexes(sourceRow))row[columnIndex] = sourceRow[columnIndex];
|
|
36
|
+
clone[rowIndex] = row;
|
|
37
|
+
}
|
|
38
|
+
return clone;
|
|
39
|
+
}
|
|
2
40
|
function normalizeWorkSpreadsheetDoughnutHoleSize(value) {
|
|
3
41
|
const size = Number(value);
|
|
4
42
|
if (!Number.isFinite(size)) return 50;
|
|
@@ -3725,8 +3763,8 @@ function spreadsheetFormulaRangeConflict(sheet, range) {
|
|
|
3725
3763
|
if (!anchorCell) return '锚点单元格不存在';
|
|
3726
3764
|
const overlaps = (sheet.formulaMetadata?.ranges ?? []).filter((candidate)=>candidate !== range && work_spreadsheet_formulas_rangesOverlap(bounds, parseSpreadsheetFormulaRange(candidate.reference)));
|
|
3727
3765
|
if (overlaps.length) return '与其他公式范围重叠';
|
|
3728
|
-
for (const [row, cells] of (sheet.data
|
|
3729
|
-
for (const [column, cell] of cells
|
|
3766
|
+
for (const [row, cells] of sparseArrayEntries(sheet.data))if (!(row < bounds.startRow) && !(row > bounds.endRow)) {
|
|
3767
|
+
for (const [column, cell] of sparseArrayEntries(cells))if (!(column < bounds.startColumn) && !(column > bounds.endColumn)) {
|
|
3730
3768
|
if (row !== anchor.row || column !== anchor.column) {
|
|
3731
3769
|
if (cell?.f) return `${spreadsheetCellAddress(row, column)} 包含独立公式`;
|
|
3732
3770
|
}
|
|
@@ -3822,4 +3860,4 @@ function positiveNumber(value, fallback) {
|
|
|
3822
3860
|
function transformFormulaOutsideStrings(formula, transform) {
|
|
3823
3861
|
return formula.split(/("(?:[^"]|"")*")/).map((segment, index)=>index % 2 ? segment : transform(segment)).join('');
|
|
3824
3862
|
}
|
|
3825
|
-
export { createSpreadsheetChartFromSelection, createSpreadsheetPivotFromSelection, defaultPivotValueCaption, defaultWorkSpreadsheetChartSeriesStyle, deleteSpreadsheetPivotTable, editableSpreadsheetFormula, effectiveSpreadsheetCalculationSettings, errorBarSourceValues, fitSpreadsheetTrendline, formatSpreadsheetCellRanges, formatSpreadsheetChartAxisNumber, formulaHasExternalReference, formulaHasStructuredReference, isValidSpreadsheetDefinedName, normalizeSpreadsheetPrintArea, normalizeSpreadsheetPrintTitleColumns, normalizeSpreadsheetPrintTitleRows, normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxes, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetChartColor, normalizeWorkSpreadsheetChartGapWidth, normalizeWorkSpreadsheetChartGrouping, normalizeWorkSpreadsheetChartLayout, normalizeWorkSpreadsheetChartLegendOverlay, normalizeWorkSpreadsheetChartLegendPosition, normalizeWorkSpreadsheetChartOverlap, normalizeWorkSpreadsheetChartSeriesStyle, normalizeWorkSpreadsheetChartSmoothLines, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, parseSpreadsheetCellRanges, parseSpreadsheetChartReference, parseSpreadsheetPrintTitles, qualifySpreadsheetRange, readXlsxDrawingAnchor, reconcileSpreadsheetChartPreviews, reconcileSpreadsheetPivots, refreshSpreadsheetPivotTables, resolveSpreadsheetChart, roundChartNumber, spreadsheetCellAddress, spreadsheetChartAxisGridlinesVisible, spreadsheetChartAxisLabelLayout, spreadsheetChartAxisScale, spreadsheetChartAxisValueRatio, spreadsheetChartBarGeometry, spreadsheetChartCategoryLabelVisible, spreadsheetChartCategoryVisualIndex, spreadsheetChartCount, spreadsheetChartSeriesFillStyle, spreadsheetChartSeriesLayout, spreadsheetChartSeriesLegendColor, spreadsheetChartSeriesLineStyle, spreadsheetChartSeriesStyleContext, spreadsheetErrorBarAmounts, spreadsheetFormulaForXlsx, spreadsheetFormulaFunctions, spreadsheetFormulaRangeConflict, spreadsheetFormulaRangeForCell, spreadsheetFormulaRangesForSelection, spreadsheetPivotAggregationLabel, spreadsheetPivotCount, spreadsheetPivotFields, spreadsheetPivotFilterItems, spreadsheetPivotFilterValueKey, spreadsheetPivotIntersects, spreadsheetPivotOutputContains, spreadsheetPivotValidation, spreadsheetSheetsWithChartPreviews, stripSpreadsheetSheetQualifier, volatileSpreadsheetFormulaFunctions, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartAxisIsCategoryAxis, workSpreadsheetChartAxisIsValueAxis, workSpreadsheetChartAxisLabelPositionLabel, workSpreadsheetChartAxisPositionLabel, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, workSpreadsheetChartAxisTickMarkLabel, workSpreadsheetChartGroupingIsStacked, workSpreadsheetChartGroupingLabel, workSpreadsheetChartLegendPositionLabel, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsBarSpacing, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsGrouping, workSpreadsheetChartSupportsSeriesAnalysis, workSpreadsheetChartSupportsSmoothLines, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel, xlsxDrawingAnchorToBounds, xlsxTwoCellAnchorMarkers };
|
|
3863
|
+
export { cloneSparseMatrix, createSpreadsheetChartFromSelection, createSpreadsheetPivotFromSelection, defaultPivotValueCaption, defaultWorkSpreadsheetChartSeriesStyle, deleteSpreadsheetPivotTable, editableSpreadsheetFormula, effectiveSpreadsheetCalculationSettings, errorBarSourceValues, fitSpreadsheetTrendline, formatSpreadsheetCellRanges, formatSpreadsheetChartAxisNumber, formulaHasExternalReference, formulaHasStructuredReference, isValidSpreadsheetDefinedName, normalizeSpreadsheetPrintArea, normalizeSpreadsheetPrintTitleColumns, normalizeSpreadsheetPrintTitleRows, normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxes, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetChartColor, normalizeWorkSpreadsheetChartGapWidth, normalizeWorkSpreadsheetChartGrouping, normalizeWorkSpreadsheetChartLayout, normalizeWorkSpreadsheetChartLegendOverlay, normalizeWorkSpreadsheetChartLegendPosition, normalizeWorkSpreadsheetChartOverlap, normalizeWorkSpreadsheetChartSeriesStyle, normalizeWorkSpreadsheetChartSmoothLines, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, parseSpreadsheetCellRanges, parseSpreadsheetChartReference, parseSpreadsheetPrintTitles, qualifySpreadsheetRange, readXlsxDrawingAnchor, reconcileSpreadsheetChartPreviews, reconcileSpreadsheetPivots, refreshSpreadsheetPivotTables, resolveSpreadsheetChart, roundChartNumber, sparseArrayEntries, sparseArrayIndexes, sparseMatrixColumnCount, spreadsheetCellAddress, spreadsheetChartAxisGridlinesVisible, spreadsheetChartAxisLabelLayout, spreadsheetChartAxisScale, spreadsheetChartAxisValueRatio, spreadsheetChartBarGeometry, spreadsheetChartCategoryLabelVisible, spreadsheetChartCategoryVisualIndex, spreadsheetChartCount, spreadsheetChartSeriesFillStyle, spreadsheetChartSeriesLayout, spreadsheetChartSeriesLegendColor, spreadsheetChartSeriesLineStyle, spreadsheetChartSeriesStyleContext, spreadsheetErrorBarAmounts, spreadsheetFormulaForXlsx, spreadsheetFormulaFunctions, spreadsheetFormulaRangeConflict, spreadsheetFormulaRangeForCell, spreadsheetFormulaRangesForSelection, spreadsheetPivotAggregationLabel, spreadsheetPivotCount, spreadsheetPivotFields, spreadsheetPivotFilterItems, spreadsheetPivotFilterValueKey, spreadsheetPivotIntersects, spreadsheetPivotOutputContains, spreadsheetPivotValidation, spreadsheetSheetsWithChartPreviews, stripSpreadsheetSheetQualifier, volatileSpreadsheetFormulaFunctions, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartAxisIsCategoryAxis, workSpreadsheetChartAxisIsValueAxis, workSpreadsheetChartAxisLabelPositionLabel, workSpreadsheetChartAxisPositionLabel, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, workSpreadsheetChartAxisTickMarkLabel, workSpreadsheetChartGroupingIsStacked, workSpreadsheetChartGroupingLabel, workSpreadsheetChartLegendPositionLabel, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsBarSpacing, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsGrouping, workSpreadsheetChartSupportsSeriesAnalysis, workSpreadsheetChartSupportsSmoothLines, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel, xlsxDrawingAnchorToBounds, xlsxTwoCellAnchorMarkers };
|
package/dist/9356.js
CHANGED
|
@@ -1,10 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
],
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const stageRanges = {
|
|
2
|
+
reading: [
|
|
3
|
+
0,
|
|
4
|
+
0.2
|
|
5
|
+
],
|
|
6
|
+
parsing: [
|
|
7
|
+
0.2,
|
|
8
|
+
0.75
|
|
9
|
+
],
|
|
10
|
+
analyzing: [
|
|
11
|
+
0.75,
|
|
12
|
+
0.95
|
|
13
|
+
],
|
|
14
|
+
finalizing: [
|
|
15
|
+
0.95,
|
|
16
|
+
1
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
class WorkFileImportController {
|
|
20
|
+
options;
|
|
21
|
+
totalBytes;
|
|
22
|
+
progress = 0;
|
|
23
|
+
constructor(options, totalBytes){
|
|
24
|
+
this.options = options;
|
|
25
|
+
this.totalBytes = totalBytes;
|
|
26
|
+
}
|
|
27
|
+
get signal() {
|
|
28
|
+
return this.options.signal;
|
|
29
|
+
}
|
|
30
|
+
throwIfAborted() {
|
|
31
|
+
if (!this.signal?.aborted) return;
|
|
32
|
+
throw workFileImportAbortError(this.signal.reason);
|
|
33
|
+
}
|
|
34
|
+
report(stage, stageProgress, bytesRead = this.totalBytes) {
|
|
35
|
+
this.throwIfAborted();
|
|
36
|
+
const boundedStageProgress = Math.max(0, Math.min(1, stageProgress));
|
|
37
|
+
const [start, end] = stageRanges[stage];
|
|
38
|
+
this.progress = Math.max(this.progress, start + (end - start) * boundedStageProgress);
|
|
39
|
+
this.options.onProgress?.({
|
|
40
|
+
stage,
|
|
41
|
+
stageProgress: boundedStageProgress,
|
|
42
|
+
progress: this.progress,
|
|
43
|
+
bytesRead: Math.max(0, Math.min(this.totalBytes, bytesRead)),
|
|
44
|
+
totalBytes: this.totalBytes
|
|
45
|
+
});
|
|
46
|
+
this.throwIfAborted();
|
|
47
|
+
}
|
|
48
|
+
async checkpoint(stage, stageProgress) {
|
|
49
|
+
this.report(stage, stageProgress);
|
|
50
|
+
await this.yieldToMainThread();
|
|
51
|
+
}
|
|
52
|
+
async yieldToMainThread() {
|
|
53
|
+
this.throwIfAborted();
|
|
54
|
+
await new Promise((resolve)=>setTimeout(resolve, 0));
|
|
55
|
+
this.throwIfAborted();
|
|
56
|
+
}
|
|
57
|
+
complete() {
|
|
58
|
+
this.report('finalizing', 1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function workFileImportAbortError(reason) {
|
|
62
|
+
if (reason instanceof Error && 'AbortError' === reason.name) return reason;
|
|
63
|
+
if ("u" > typeof DOMException) return new DOMException('Office file import was cancelled.', 'AbortError');
|
|
64
|
+
const error = new Error('Office file import was cancelled.');
|
|
65
|
+
error.name = 'AbortError';
|
|
66
|
+
return error;
|
|
67
|
+
}
|
|
68
|
+
const WORK_FILE_READ_CHUNK_BYTES = 4194304;
|
|
69
|
+
async function materializeWorkFile(file, controller = new WorkFileImportController({}, file.size)) {
|
|
70
|
+
return (await materializeWorkFileSource(file, controller)).file;
|
|
71
|
+
}
|
|
72
|
+
async function materializeWorkFileSource(file, controller) {
|
|
73
|
+
const bytes = await readWorkFileBytes(file, controller);
|
|
74
|
+
return {
|
|
75
|
+
bytes,
|
|
76
|
+
file: new File([
|
|
77
|
+
bytes
|
|
78
|
+
], file.name, {
|
|
79
|
+
lastModified: file.lastModified,
|
|
80
|
+
type: file.type
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async function readWorkFileBytes(file, controller) {
|
|
85
|
+
controller.report('reading', 0, 0);
|
|
86
|
+
if (file.size <= WORK_FILE_READ_CHUNK_BYTES) {
|
|
87
|
+
const bytes = await abortableArrayBuffer(file.arrayBuffer(), controller);
|
|
88
|
+
controller.report('reading', 1, bytes.byteLength);
|
|
89
|
+
return bytes;
|
|
90
|
+
}
|
|
91
|
+
const bytes = new Uint8Array(file.size);
|
|
92
|
+
for(let offset = 0; offset < file.size; offset += WORK_FILE_READ_CHUNK_BYTES){
|
|
93
|
+
controller.throwIfAborted();
|
|
94
|
+
const end = Math.min(file.size, offset + WORK_FILE_READ_CHUNK_BYTES);
|
|
95
|
+
const chunk = await abortableArrayBuffer(file.slice(offset, end).arrayBuffer(), controller);
|
|
96
|
+
bytes.set(new Uint8Array(chunk), offset);
|
|
97
|
+
controller.report('reading', end / file.size, end);
|
|
98
|
+
if (end < file.size) await controller.yieldToMainThread();
|
|
99
|
+
}
|
|
100
|
+
return bytes.buffer;
|
|
101
|
+
}
|
|
102
|
+
async function abortableArrayBuffer(pending, controller) {
|
|
103
|
+
controller.throwIfAborted();
|
|
104
|
+
const signal = controller.signal;
|
|
105
|
+
if (!signal) return pending;
|
|
106
|
+
return new Promise((resolve, reject)=>{
|
|
107
|
+
const abort = ()=>{
|
|
108
|
+
cleanup();
|
|
109
|
+
try {
|
|
110
|
+
controller.throwIfAborted();
|
|
111
|
+
} catch (error) {
|
|
112
|
+
reject(error);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const cleanup = ()=>signal.removeEventListener('abort', abort);
|
|
116
|
+
signal.addEventListener('abort', abort, {
|
|
117
|
+
once: true
|
|
118
|
+
});
|
|
119
|
+
pending.then((bytes)=>{
|
|
120
|
+
cleanup();
|
|
121
|
+
resolve(bytes);
|
|
122
|
+
}, (error)=>{
|
|
123
|
+
cleanup();
|
|
124
|
+
reject(error);
|
|
125
|
+
});
|
|
8
126
|
});
|
|
9
127
|
}
|
|
10
|
-
export { materializeWorkFile };
|
|
128
|
+
export { WorkFileImportController, materializeWorkFile, materializeWorkFileSource };
|
package/dist/core.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type { WorkEditorAgentRequest as EditorAgentRequest } from './internal/fe
|
|
|
21
21
|
export type { WorkDocumentReviewConflict as DocumentReviewConflict, WorkDocumentReviewConflictEvent as DocumentReviewConflictEvent, WorkDocumentReviewConflictReason as DocumentReviewConflictReason, WorkDocumentReviewKind as DocumentReviewKind, } from './internal/features/work/work-document-review-conflicts';
|
|
22
22
|
export type { WorkDocumentSelectionCommandFailure as DocumentSelectionCommandFailure, WorkDocumentSelectionCommandResult as DocumentSelectionCommandResult, WorkDocumentSelectionCommands as DocumentSelectionCommands, WorkDocumentSelectionContext as DocumentSelectionContext, WorkDocumentSelectionMenuIcon as DocumentSelectionMenuIcon, WorkDocumentSelectionMenuItem as DocumentSelectionMenuItem, WorkDocumentSelectionSnapshot as DocumentSelectionSnapshot, WorkGetDocumentSelectionMenuItems as GetDocumentSelectionMenuItems, } from './internal/features/work/work-document-selection-menu';
|
|
23
23
|
export type { WorkArtifactExportOptions as ArtifactExportOptions } from './internal/features/work/work-file-io';
|
|
24
|
+
export type { WorkFileImportOptions as OfficeFileImportOptions, WorkFileImportProgress as OfficeFileImportProgress, WorkFileImportStage as OfficeFileImportStage, } from './internal/features/work/work-file-import';
|
|
24
25
|
export { createWorkArtifactBlob as createArtifactBlob, exportWorkArtifact as downloadArtifact, importWorkFile as importOfficeFile, WORK_IMPORT_ACCEPT as OFFICE_FILE_ACCEPT, workKindForFile as officeKindForFile, } from './internal/features/work/work-file-io';
|
|
25
26
|
export { decodeWorkDocumentSnapshot as decodeDocumentSnapshot, encodeWorkDocumentSnapshot as encodeDocumentSnapshot, WORK_DOCUMENT_SNAPSHOT_MEDIA_TYPE as DOCUMENT_SNAPSHOT_MEDIA_TYPE, WORK_DOCUMENT_SNAPSHOT_SCHEMA as DOCUMENT_SNAPSHOT_SCHEMA, WORK_DOCUMENT_SNAPSHOT_VERSION as DOCUMENT_SNAPSHOT_VERSION, type WorkDocumentSnapshot as DocumentSnapshot, } from './internal/features/work/work-document-snapshot';
|
|
26
27
|
export { applyWorkDocumentSource as applyDocumentSource, projectWorkDocumentSource as projectDocumentSource, WORK_DOCUMENT_SOURCE_MEDIA_TYPE as DOCUMENT_SOURCE_MEDIA_TYPE, WORK_DOCUMENT_SOURCE_SCHEMA as DOCUMENT_SOURCE_SCHEMA, WORK_DOCUMENT_SOURCE_VERSION as DOCUMENT_SOURCE_VERSION, type WorkDocumentSource as DocumentSource, } from './internal/features/work/work-document-source';
|
|
@@ -21,6 +21,7 @@ export declare function spreadsheetFontSizeOptions(current: number | undefined):
|
|
|
21
21
|
export declare function spreadsheetFontFamilyOptions(current: string | undefined): OfficeSelectOption[];
|
|
22
22
|
export declare function spreadsheetSheetsWithFiniteSelections(sheets: WorkSpreadsheetContent['sheets']): WorkSpreadsheetContent['sheets'];
|
|
23
23
|
export declare function spreadsheetSheetsForFortune(sheets: WorkSpreadsheetContent['sheets']): WorkSpreadsheetContent['sheets'];
|
|
24
|
+
export declare function spreadsheetSheetsFromFortune(sheets: WorkSpreadsheetContent['sheets'], sourceSheets: WorkSpreadsheetContent['sheets']): WorkSpreadsheetContent['sheets'];
|
|
24
25
|
export declare function finiteSpreadsheetSelection(selection: Selection | undefined): Selection;
|
|
25
26
|
export declare function sameSpreadsheetWorkbookState(changed: WorkSpreadsheetContent['sheets'], rendered: WorkSpreadsheetContent['sheets']): boolean;
|
|
26
27
|
export declare function sameSpreadsheetHistoryContent(left: WorkSpreadsheetContent, right: WorkSpreadsheetContent): boolean;
|
|
@@ -8,7 +8,7 @@ export interface SpreadsheetCollaborationHistory {
|
|
|
8
8
|
undo: () => boolean;
|
|
9
9
|
}
|
|
10
10
|
export interface SpreadsheetCollaborationViewController {
|
|
11
|
-
activateSheet: (sheetId: string) =>
|
|
11
|
+
activateSheet: (sheetId: string) => boolean;
|
|
12
12
|
select: (sheetId: string, selection: Selection) => void;
|
|
13
13
|
setZoom: (sheetId: string, zoomRatio: number) => void;
|
|
14
14
|
}
|
|
@@ -21,6 +21,7 @@ export declare function useSpreadsheetCollaboration({ initialContent, onChange,
|
|
|
21
21
|
content: WorkSpreadsheetContent;
|
|
22
22
|
history: SpreadsheetCollaborationHistory;
|
|
23
23
|
onChange: (next: WorkSpreadsheetContent) => void;
|
|
24
|
+
onDerivedChange: (next: WorkSpreadsheetContent) => void;
|
|
24
25
|
readOnly: boolean;
|
|
25
26
|
view: SpreadsheetCollaborationViewController;
|
|
26
27
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CellMatrix } from '@fortune-sheet/core';
|
|
2
|
+
export declare function sparseArrayIndexes(values: readonly unknown[] | undefined): number[];
|
|
3
|
+
export declare function sparseArrayEntries<T>(values: readonly T[] | undefined): Array<[number, T]>;
|
|
4
|
+
export declare function sparseMatrixColumnCount(matrix: CellMatrix | undefined): number;
|
|
5
|
+
export declare function cloneSparseMatrix(source: CellMatrix | undefined): CellMatrix;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { WorkFileImportContext } from './work-file-import';
|
|
1
2
|
import type { WorkArtifact } from './work-types';
|
|
2
|
-
export declare function importWorkDocumentFile(file: File, extension: string): Promise<WorkArtifact>;
|
|
3
|
+
export declare function importWorkDocumentFile(file: File, extension: string, context?: WorkFileImportContext): Promise<WorkArtifact>;
|
|
3
4
|
export declare function exportWorkDocumentArtifact(artifact: WorkArtifact): Promise<void>;
|
|
4
5
|
export declare function createWorkDocumentBlob(artifact: WorkArtifact): Promise<Blob>;
|
|
@@ -21,6 +21,7 @@ import { type ImportedDocxParagraphTabStopMarkers } from './work-docx-tab-stop-i
|
|
|
21
21
|
import { type ImportedDocxTableCellMarkers } from './work-docx-table-cell-import';
|
|
22
22
|
import { type ImportedDocxTableRowMarkers } from './work-docx-table-row-import';
|
|
23
23
|
import { type ImportedDocxTableSizingMarkers } from './work-docx-table-sizing-import';
|
|
24
|
+
import { OoxmlPackage } from './work-ooxml-package';
|
|
24
25
|
import type { WorkDocumentContent, WorkDocumentSectionLayout } from './work-types';
|
|
25
26
|
type ImportedDocumentLayout = Omit<WorkDocumentContent, 'type' | 'html'>;
|
|
26
27
|
export interface PreparedDocxImport {
|
|
@@ -56,7 +57,7 @@ export interface PreparedDocxImport {
|
|
|
56
57
|
bibliography?: WorkDocumentContent['bibliography'];
|
|
57
58
|
trackChanges: boolean;
|
|
58
59
|
}
|
|
59
|
-
export declare function prepareDocxImport(buffer: ArrayBuffer): Promise<PreparedDocxImport>;
|
|
60
|
+
export declare function prepareDocxImport(buffer: ArrayBuffer, sourcePackage?: OoxmlPackage): Promise<PreparedDocxImport>;
|
|
60
61
|
export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers): string;
|
|
61
62
|
export declare function readDocxLayout(buffer: ArrayBuffer): Promise<ImportedDocumentLayout>;
|
|
62
63
|
export {};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { WorkFileImportController } from './work-file-import';
|
|
2
|
+
export interface MaterializedWorkFile {
|
|
3
|
+
bytes: ArrayBuffer;
|
|
4
|
+
file: File;
|
|
5
|
+
}
|
|
6
|
+
export declare function materializeWorkFile(file: File, controller?: WorkFileImportController): Promise<File>;
|
|
7
|
+
export declare function materializeWorkFileSource(file: File, controller: WorkFileImportController): Promise<MaterializedWorkFile>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type WorkFileImportStage = 'reading' | 'parsing' | 'analyzing' | 'finalizing';
|
|
2
|
+
export interface WorkFileImportProgress {
|
|
3
|
+
stage: WorkFileImportStage;
|
|
4
|
+
stageProgress: number;
|
|
5
|
+
progress: number;
|
|
6
|
+
bytesRead: number;
|
|
7
|
+
totalBytes: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkFileImportOptions {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
onProgress?: (progress: WorkFileImportProgress) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkFileImportContext {
|
|
14
|
+
bytes: ArrayBuffer;
|
|
15
|
+
controller: WorkFileImportController;
|
|
16
|
+
}
|
|
17
|
+
export declare class WorkFileImportController {
|
|
18
|
+
private readonly options;
|
|
19
|
+
readonly totalBytes: number;
|
|
20
|
+
private progress;
|
|
21
|
+
constructor(options: WorkFileImportOptions, totalBytes: number);
|
|
22
|
+
get signal(): AbortSignal | undefined;
|
|
23
|
+
throwIfAborted(): void;
|
|
24
|
+
report(stage: WorkFileImportStage, stageProgress: number, bytesRead?: number): void;
|
|
25
|
+
checkpoint(stage: WorkFileImportStage, stageProgress: number): Promise<void>;
|
|
26
|
+
yieldToMainThread(): Promise<void>;
|
|
27
|
+
complete(): void;
|
|
28
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { WORK_IMPORT_ACCEPT } from './work-file-contract';
|
|
2
|
+
import { type WorkFileImportOptions } from './work-file-import';
|
|
2
3
|
import { type WorkPresentationExportOptions } from './work-presentation-file-io';
|
|
3
4
|
import { type WorkArtifact, type WorkArtifactKind } from './work-types';
|
|
4
5
|
export type WorkArtifactExportOptions = WorkPresentationExportOptions;
|
|
5
|
-
export declare function importWorkFile(file: File): Promise<WorkArtifact>;
|
|
6
|
+
export declare function importWorkFile(file: File, options?: WorkFileImportOptions): Promise<WorkArtifact>;
|
|
6
7
|
export declare function exportWorkArtifact(artifact: WorkArtifact, options?: WorkArtifactExportOptions): Promise<void>;
|
|
7
8
|
export declare function createWorkArtifactBlob(artifact: WorkArtifact, options?: WorkArtifactExportOptions): Promise<Blob>;
|
|
8
9
|
export declare function workKindForFile(file: File): WorkArtifactKind | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WorkFileImportContext } from './work-file-import';
|
|
1
2
|
import type { WorkArtifact } from './work-types';
|
|
2
|
-
export declare function importWorkMarkdownFile(file: File): Promise<WorkArtifact>;
|
|
3
|
+
export declare function importWorkMarkdownFile(file: File, context?: WorkFileImportContext): Promise<WorkArtifact>;
|
|
3
4
|
export declare function createWorkMarkdownBlob(artifact: WorkArtifact): Blob;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { WorkBook } from 'xlsx';
|
|
2
|
+
import { OoxmlPackage } from './work-ooxml-package';
|
|
2
3
|
import type { WorkCompatibilityReport } from './work-types';
|
|
3
4
|
interface ConversionMessage {
|
|
4
5
|
type: string;
|
|
5
6
|
message: string;
|
|
6
7
|
}
|
|
7
|
-
export declare function analyzeDocxCompatibility(file: File, messages: ConversionMessage[]): Promise<WorkCompatibilityReport>;
|
|
8
|
-
export declare function analyzeSpreadsheetCompatibility(file: File, extension: string, workbook: WorkBook): Promise<WorkCompatibilityReport | null>;
|
|
8
|
+
export declare function analyzeDocxCompatibility(file: File, messages: ConversionMessage[], sourcePackage?: OoxmlPackage | null): Promise<WorkCompatibilityReport>;
|
|
9
|
+
export declare function analyzeSpreadsheetCompatibility(file: File, extension: string, workbook: WorkBook, sourcePackage?: OoxmlPackage | null): Promise<WorkCompatibilityReport | null>;
|
|
9
10
|
export {};
|
|
@@ -3,4 +3,4 @@ export interface PptxImportResult {
|
|
|
3
3
|
content: WorkPresentationContent;
|
|
4
4
|
compatibility: WorkCompatibilityReport;
|
|
5
5
|
}
|
|
6
|
-
export declare function importPptxPresentation(file: File): Promise<PptxImportResult>;
|
|
6
|
+
export declare function importPptxPresentation(file: File, sourceBytes?: ArrayBuffer): Promise<PptxImportResult>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WorkFileImportContext } from './work-file-import';
|
|
1
2
|
import type { WorkArtifact } from './work-types';
|
|
2
3
|
type PptxConstructor = typeof import('pptxgenjs').default;
|
|
3
4
|
declare global {
|
|
@@ -9,7 +10,7 @@ export interface WorkPresentationExportOptions {
|
|
|
9
10
|
pptxRuntimeUrl?: string;
|
|
10
11
|
}
|
|
11
12
|
export declare const defaultPptxRuntimeUrl: string;
|
|
12
|
-
export declare function importWorkPresentationFile(file: File): Promise<WorkArtifact>;
|
|
13
|
+
export declare function importWorkPresentationFile(file: File, context?: WorkFileImportContext): Promise<WorkArtifact>;
|
|
13
14
|
export declare function exportWorkPresentationArtifact(artifact: WorkArtifact, options?: WorkPresentationExportOptions): Promise<void>;
|
|
14
15
|
export declare function createWorkPresentationBlob(artifact: WorkArtifact, options?: WorkPresentationExportOptions): Promise<Blob>;
|
|
15
16
|
export {};
|
|
@@ -27,6 +27,7 @@ export interface FortuneSheetProtectionAuthority {
|
|
|
27
27
|
hintText: string;
|
|
28
28
|
defaultSheetHintText: string;
|
|
29
29
|
allowRangeList: FortuneSheetEditableRange[];
|
|
30
|
+
cellProtectionRanges: SpreadsheetCellProtectionRange[];
|
|
30
31
|
xlsxAttributes?: Record<string, string>;
|
|
31
32
|
}
|
|
32
33
|
export interface SpreadsheetCellProtectionRange {
|
|
@@ -37,6 +38,7 @@ export interface SpreadsheetCellProtectionRange {
|
|
|
37
38
|
export declare function defaultSheetProtectionAuthority(enabled?: boolean): FortuneSheetProtectionAuthority;
|
|
38
39
|
export declare function sheetProtectionAuthority(sheet: Sheet): FortuneSheetProtectionAuthority;
|
|
39
40
|
export declare function normalizeSheetProtectionAuthority(source: unknown): FortuneSheetProtectionAuthority;
|
|
41
|
+
export declare function importedSheetProtectionAuthority(authority: FortuneSheetProtectionAuthority | undefined, cellProtectionRanges: SpreadsheetCellProtectionRange[]): FortuneSheetProtectionAuthority | undefined;
|
|
40
42
|
export declare function withSheetProtection(sheet: Sheet, enabled: boolean): Sheet;
|
|
41
43
|
export declare function withSheetSelectionPermissions(sheet: Sheet, permissions: {
|
|
42
44
|
selectLockedCells?: boolean;
|