@a3s-lab/office 0.37.4 → 0.38.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 +10 -1
- package/dist/{0~4808.js → 0~5024.js} +150 -2
- package/dist/0~7240.js +26 -4
- package/dist/0~document-editor.js +455 -13
- package/dist/0~spreadsheet-editor.js +52 -36
- package/dist/0~work-docx-export.js +215 -18
- package/dist/0~work-docx-import.js +4 -2
- package/dist/0~work-office-diagnostics.js +57 -1
- package/dist/4174.js +313 -112
- package/dist/5416.js +56 -44
- package/dist/core.js +56 -10
- package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +5 -4
- package/dist/internal/features/work/editors/document-font-dialog-opentype-model.d.ts +53 -0
- package/dist/internal/features/work/editors/document-font-dialog-script-font-model.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-auto-filter-menu.d.ts +2 -2
- package/dist/internal/features/work/editors/spreadsheet-auto-filter.d.ts +3 -3
- package/dist/internal/features/work/editors/spreadsheet-date-time-command.d.ts +2 -1
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +2 -2
- package/dist/internal/features/work/editors/spreadsheet-filter-reconciliation.d.ts +3 -2
- package/dist/internal/features/work/work-document-equations.d.ts +4 -3
- package/dist/internal/features/work/work-document-format-changes.d.ts +2 -0
- package/dist/internal/features/work/work-document-opentype.d.ts +39 -0
- package/dist/internal/features/work/work-document-word-line-metrics.d.ts +1 -0
- package/dist/internal/features/work/work-docx-opentype-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-opentype-export.d.ts +19 -0
- package/dist/internal/features/work/work-docx-opentype-import.d.ts +8 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-dynamic-filter.d.ts +3 -2
- package/dist/internal/features/work/work-types.d.ts +3 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +7 -3
- package/docs/latest/en/browser-editor-architecture.md +4 -2
- package/package.json +6 -1
package/dist/5416.js
CHANGED
|
@@ -591,6 +591,10 @@ function validateWorkOfficeSpreadsheetContent(content) {
|
|
|
591
591
|
type: 'spreadsheet',
|
|
592
592
|
sheets
|
|
593
593
|
};
|
|
594
|
+
if (void 0 !== content.dateSystem) {
|
|
595
|
+
if ('1900' !== content.dateSystem && '1904' !== content.dateSystem) invalidWorkOfficeSpreadsheetInput("a Spreadsheet date system of '1900' or '1904'");
|
|
596
|
+
result.dateSystem = content.dateSystem;
|
|
597
|
+
}
|
|
594
598
|
copyOptionalJsonField(content, result, 'calculation', 'calculation settings');
|
|
595
599
|
if (void 0 !== content.namedRanges) result.namedRanges = validateIdRecords(content.namedRanges, 'named range');
|
|
596
600
|
copyOptionalSheetSidecars(content, result, 'printAreas', 'print area');
|
|
@@ -1209,6 +1213,7 @@ function claimLabel(claim) {
|
|
|
1209
1213
|
return `${claim.kind} in sheet '${claim.parentId}'`;
|
|
1210
1214
|
}
|
|
1211
1215
|
function assertWorkOfficeSpreadsheetPatchSafe(previous, next, shared) {
|
|
1216
|
+
assertCompatibleValue(previous.dateSystem, next.dateSystem, shared.dateSystem, 'date system');
|
|
1212
1217
|
assertCompatibleValue(previous.calculation, next.calculation, shared.calculation, 'calculation settings');
|
|
1213
1218
|
assertRecordCollection(previous.sheets, next.sheets, shared.sheets, (sheet)=>sheet.id, 'sheet', assertCompatibleSheet);
|
|
1214
1219
|
assertRecordCollection(previous.namedRanges ?? [], next.namedRanges ?? [], shared.namedRanges ?? [], (range)=>range.id, 'named range');
|
|
@@ -1843,7 +1848,7 @@ function workOfficeSpreadsheetRoots(document, rootName) {
|
|
|
1843
1848
|
}
|
|
1844
1849
|
function initializeWorkOfficeSpreadsheetRoots(roots, content) {
|
|
1845
1850
|
appendWorkOfficeSpreadsheetRecordClaims(roots.recordClaims, void 0, content);
|
|
1846
|
-
patchSpreadsheetFlatJsonMap(roots.options, void 0, content
|
|
1851
|
+
patchSpreadsheetFlatJsonMap(roots.options, void 0, spreadsheetWorkbookOptions(content), 'workbook options');
|
|
1847
1852
|
patchSheets(roots, void 0, content);
|
|
1848
1853
|
patchIdRecords(roots.namedRanges, roots.namedRangeOrder, [], content.namedRanges ?? [], 'named range');
|
|
1849
1854
|
patchSheetSidecars(roots.printAreas, [], content.printAreas ?? [], 'print area');
|
|
@@ -1856,7 +1861,9 @@ function readWorkOfficeSpreadsheetRoots(roots) {
|
|
|
1856
1861
|
type: 'spreadsheet',
|
|
1857
1862
|
sheets: validatedSpreadsheetOrder(roots.sheetOrder, roots.sheets, 'sheet').map((id)=>readSpreadsheetSheetRecord(office_spreadsheet_collaboration_records_requiredSpreadsheetMap(roots.sheets, id, `sheet '${id}'`), id))
|
|
1858
1863
|
};
|
|
1859
|
-
const
|
|
1864
|
+
const options = readSpreadsheetFlatJsonMap(roots.options, 'workbook options');
|
|
1865
|
+
const { dateSystem, ...calculation } = options;
|
|
1866
|
+
if (void 0 !== dateSystem) result.dateSystem = dateSystem;
|
|
1860
1867
|
if (Object.keys(calculation).length > 0) result.calculation = calculation;
|
|
1861
1868
|
const namedRanges = readIdRecords(roots.namedRanges, roots.namedRangeOrder, 'named range');
|
|
1862
1869
|
if (namedRanges.length > 0) result.namedRanges = namedRanges;
|
|
@@ -1872,7 +1879,7 @@ function patchWorkOfficeSpreadsheetRoots(roots, previous, next) {
|
|
|
1872
1879
|
const shared = readWorkOfficeSpreadsheetRoots(roots);
|
|
1873
1880
|
assertWorkOfficeSpreadsheetPatchSafe(previous, next, shared);
|
|
1874
1881
|
appendWorkOfficeSpreadsheetRecordClaims(roots.recordClaims, previous, next);
|
|
1875
|
-
patchSpreadsheetFlatJsonMap(roots.options, previous
|
|
1882
|
+
patchSpreadsheetFlatJsonMap(roots.options, spreadsheetWorkbookOptions(previous), spreadsheetWorkbookOptions(next), 'workbook options');
|
|
1876
1883
|
patchSheets(roots, previous, next);
|
|
1877
1884
|
patchIdRecords(roots.namedRanges, roots.namedRangeOrder, previous.namedRanges ?? [], next.namedRanges ?? [], 'named range');
|
|
1878
1885
|
patchSheetSidecars(roots.printAreas, previous.printAreas ?? [], next.printAreas ?? [], 'print area');
|
|
@@ -1880,6 +1887,13 @@ function patchWorkOfficeSpreadsheetRoots(roots, previous, next) {
|
|
|
1880
1887
|
patchSheetSidecars(roots.pageBreaks, previous.pageBreaks ?? [], next.pageBreaks ?? [], 'page breaks');
|
|
1881
1888
|
patchSheetSidecars(roots.pageSetups, previous.pageSetups ?? [], next.pageSetups ?? [], 'page setup');
|
|
1882
1889
|
}
|
|
1890
|
+
function spreadsheetWorkbookOptions(content) {
|
|
1891
|
+
const options = {
|
|
1892
|
+
...content.calculation
|
|
1893
|
+
};
|
|
1894
|
+
if (void 0 !== content.dateSystem) options.dateSystem = content.dateSystem;
|
|
1895
|
+
return Object.keys(options).length ? options : void 0;
|
|
1896
|
+
}
|
|
1883
1897
|
function assertWorkOfficeSpreadsheetRootsEmpty(roots) {
|
|
1884
1898
|
if (roots.options.size > 0 || roots.sheets.size > 0 || roots.sheetOrder.length > 0 || roots.namedRanges.size > 0 || roots.namedRangeOrder.length > 0 || roots.recordClaims.length > 0 || roots.printAreas.size > 0 || roots.printTitles.size > 0 || roots.pageBreaks.size > 0 || roots.pageSetups.size > 0) throw new WorkOfficeCollaborationError('office.collaboration.bootstrap_ambiguous', 'The Spreadsheet collaboration roots contain data without initialized metadata.');
|
|
1885
1899
|
}
|
|
@@ -2212,9 +2226,8 @@ function workSpreadsheetFilterTextIsBounded(value) {
|
|
|
2212
2226
|
return characters >= 1 && characters <= WORK_SPREADSHEET_FILTER_TEXT_MAX_CHARACTERS;
|
|
2213
2227
|
}
|
|
2214
2228
|
const MILLISECONDS_PER_DAY = 86400000;
|
|
2215
|
-
const EXCEL_1900_EPOCH_UTC = Date.UTC(1899, 11, 30);
|
|
2216
2229
|
const EXCEL_1900_CIVIL_EPOCH_UTC = Date.UTC(1899, 11, 31);
|
|
2217
|
-
const
|
|
2230
|
+
const EXCEL_1904_EPOCH_UTC = Date.UTC(1904, 0, 1);
|
|
2218
2231
|
const SERIAL_INTEGER_EPSILON = 1e-7;
|
|
2219
2232
|
const CALENDAR_MONTH_FILTERS = [
|
|
2220
2233
|
'month-1',
|
|
@@ -2239,18 +2252,18 @@ const CALENDAR_QUARTER_FILTERS = [
|
|
|
2239
2252
|
function workSpreadsheetDynamicFilterMatcher(kind, cells, context) {
|
|
2240
2253
|
if ('above-average' === kind || 'below-average' === kind) return averageMatcher(kind, cells);
|
|
2241
2254
|
const month = CALENDAR_MONTH_FILTERS.indexOf(kind);
|
|
2242
|
-
if (month >= 0) return (cell)=>spreadsheetDateParts(cell)?.month === month;
|
|
2255
|
+
if (month >= 0) return (cell)=>spreadsheetDateParts(cell, context.dateSystem)?.month === month;
|
|
2243
2256
|
const quarter = CALENDAR_QUARTER_FILTERS.indexOf(kind);
|
|
2244
|
-
if (quarter >= 0) return (cell)=>spreadsheetDateParts(cell)?.quarter === quarter;
|
|
2257
|
+
if (quarter >= 0) return (cell)=>spreadsheetDateParts(cell, context.dateSystem)?.quarter === quarter;
|
|
2245
2258
|
const bounds = relativeDateBounds(kind, context.now);
|
|
2246
2259
|
if (!bounds) return null;
|
|
2247
2260
|
return (cell)=>{
|
|
2248
|
-
const day =
|
|
2261
|
+
const day = spreadsheetDateCivilDay(cell, context.dateSystem);
|
|
2249
2262
|
return null !== day && day >= bounds.start && day < bounds.end;
|
|
2250
2263
|
};
|
|
2251
2264
|
}
|
|
2252
|
-
function workSpreadsheetCellIsDate(cell) {
|
|
2253
|
-
return null !==
|
|
2265
|
+
function workSpreadsheetCellIsDate(cell, dateSystem = '1900') {
|
|
2266
|
+
return null !== spreadsheetDateCivilDay(cell, dateSystem);
|
|
2254
2267
|
}
|
|
2255
2268
|
function averageMatcher(kind, cells) {
|
|
2256
2269
|
const average = finiteArithmeticMean(cells);
|
|
@@ -2284,7 +2297,7 @@ function relativeDateBounds(kind, now) {
|
|
|
2284
2297
|
const year = now.getFullYear();
|
|
2285
2298
|
if (!Number.isFinite(timestamp) || !Number.isSafeInteger(year) || year < 1900 || year > 9999) return null;
|
|
2286
2299
|
const month = now.getMonth();
|
|
2287
|
-
const today =
|
|
2300
|
+
const today = civilDayFromDateParts(year, month, now.getDate());
|
|
2288
2301
|
if ('yesterday' === kind) return dayBounds(today - 1);
|
|
2289
2302
|
if ('today' === kind) return dayBounds(today);
|
|
2290
2303
|
if ('tomorrow' === kind) return dayBounds(today + 1);
|
|
@@ -2292,65 +2305,64 @@ function relativeDateBounds(kind, now) {
|
|
|
2292
2305
|
if ('last-week' === kind) return rangeBounds(weekStart - 7, weekStart);
|
|
2293
2306
|
if ('this-week' === kind) return rangeBounds(weekStart, weekStart + 7);
|
|
2294
2307
|
if ('next-week' === kind) return rangeBounds(weekStart + 7, weekStart + 14);
|
|
2295
|
-
const monthStart =
|
|
2296
|
-
if ('last-month' === kind) return rangeBounds(
|
|
2297
|
-
if ('this-month' === kind) return rangeBounds(monthStart,
|
|
2298
|
-
if ('next-month' === kind) return rangeBounds(
|
|
2308
|
+
const monthStart = civilDayFromDateParts(year, month, 1);
|
|
2309
|
+
if ('last-month' === kind) return rangeBounds(civilDayFromDateParts(year, month - 1, 1), monthStart);
|
|
2310
|
+
if ('this-month' === kind) return rangeBounds(monthStart, civilDayFromDateParts(year, month + 1, 1));
|
|
2311
|
+
if ('next-month' === kind) return rangeBounds(civilDayFromDateParts(year, month + 1, 1), civilDayFromDateParts(year, month + 2, 1));
|
|
2299
2312
|
const quarterStartMonth = 3 * Math.floor(month / 3);
|
|
2300
|
-
const quarterStart =
|
|
2301
|
-
if ('last-quarter' === kind) return rangeBounds(
|
|
2302
|
-
if ('this-quarter' === kind) return rangeBounds(quarterStart,
|
|
2303
|
-
if ('next-quarter' === kind) return rangeBounds(
|
|
2304
|
-
const yearStart =
|
|
2305
|
-
if ('last-year' === kind) return rangeBounds(
|
|
2306
|
-
if ('this-year' === kind) return rangeBounds(yearStart,
|
|
2307
|
-
if ('next-year' === kind) return rangeBounds(
|
|
2313
|
+
const quarterStart = civilDayFromDateParts(year, quarterStartMonth, 1);
|
|
2314
|
+
if ('last-quarter' === kind) return rangeBounds(civilDayFromDateParts(year, quarterStartMonth - 3, 1), quarterStart);
|
|
2315
|
+
if ('this-quarter' === kind) return rangeBounds(quarterStart, civilDayFromDateParts(year, quarterStartMonth + 3, 1));
|
|
2316
|
+
if ('next-quarter' === kind) return rangeBounds(civilDayFromDateParts(year, quarterStartMonth + 3, 1), civilDayFromDateParts(year, quarterStartMonth + 6, 1));
|
|
2317
|
+
const yearStart = civilDayFromDateParts(year, 0, 1);
|
|
2318
|
+
if ('last-year' === kind) return rangeBounds(civilDayFromDateParts(year - 1, 0, 1), yearStart);
|
|
2319
|
+
if ('this-year' === kind) return rangeBounds(yearStart, civilDayFromDateParts(year + 1, 0, 1));
|
|
2320
|
+
if ('next-year' === kind) return rangeBounds(civilDayFromDateParts(year + 1, 0, 1), civilDayFromDateParts(year + 2, 0, 1));
|
|
2308
2321
|
if ('year-to-date' === kind) return rangeBounds(yearStart, today + 1);
|
|
2309
2322
|
return null;
|
|
2310
2323
|
}
|
|
2311
|
-
function spreadsheetDateParts(cell) {
|
|
2312
|
-
const day =
|
|
2324
|
+
function spreadsheetDateParts(cell, dateSystem = '1900') {
|
|
2325
|
+
const day = spreadsheetDateCivilDay(cell, dateSystem);
|
|
2313
2326
|
if (null === day) return null;
|
|
2314
|
-
const
|
|
2315
|
-
const date = new Date(EXCEL_1900_CIVIL_EPOCH_UTC + adjustedDay * MILLISECONDS_PER_DAY);
|
|
2327
|
+
const date = new Date(day * MILLISECONDS_PER_DAY);
|
|
2316
2328
|
const timestamp = date.getTime();
|
|
2317
2329
|
const year = date.getUTCFullYear();
|
|
2318
|
-
if (!Number.isFinite(timestamp) || year
|
|
2330
|
+
if (!Number.isFinite(timestamp) || year > 9999) return null;
|
|
2319
2331
|
const month = date.getUTCMonth();
|
|
2320
2332
|
return {
|
|
2321
2333
|
month,
|
|
2322
2334
|
quarter: Math.floor(month / 3)
|
|
2323
2335
|
};
|
|
2324
2336
|
}
|
|
2325
|
-
function
|
|
2326
|
-
const serial = spreadsheetDateCellSerial(cell);
|
|
2327
|
-
if (null === serial) return null;
|
|
2328
|
-
const rounded = Math.round(serial);
|
|
2329
|
-
const normalized = Math.abs(serial - rounded) <= SERIAL_INTEGER_EPSILON ? rounded : serial;
|
|
2330
|
-
const day = Math.floor(normalized);
|
|
2331
|
-
return day >= 1 && 60 !== day ? day : null;
|
|
2332
|
-
}
|
|
2333
|
-
function spreadsheetDateCellSerial(cell) {
|
|
2337
|
+
function spreadsheetDateCivilDay(cell, dateSystem = '1900') {
|
|
2334
2338
|
const value = spreadsheetCellRawValue(cell);
|
|
2335
2339
|
if (value instanceof Date) {
|
|
2336
2340
|
if (!Number.isFinite(value.getTime())) return null;
|
|
2337
|
-
const
|
|
2338
|
-
const
|
|
2339
|
-
return
|
|
2341
|
+
const year = value.getFullYear();
|
|
2342
|
+
const minimumYear = '1904' === dateSystem ? 1904 : 1900;
|
|
2343
|
+
return year >= minimumYear && year <= 9999 ? civilDayFromDateParts(year, value.getMonth(), value.getDate()) : null;
|
|
2340
2344
|
}
|
|
2341
|
-
|
|
2345
|
+
if ('number' != typeof value || !Number.isFinite(value) || cell?.ct?.t !== 'd') return null;
|
|
2346
|
+
const serial = value;
|
|
2347
|
+
const rounded = Math.round(serial);
|
|
2348
|
+
const normalized = Math.abs(serial - rounded) <= SERIAL_INTEGER_EPSILON ? rounded : serial;
|
|
2349
|
+
const day = Math.floor(normalized);
|
|
2350
|
+
if ('1904' === dateSystem) return day >= 0 ? (EXCEL_1904_EPOCH_UTC + day * MILLISECONDS_PER_DAY) / MILLISECONDS_PER_DAY : null;
|
|
2351
|
+
if (day < 1 || 60 === day) return null;
|
|
2352
|
+
const civilOffset = day > 60 ? day - 1 : day;
|
|
2353
|
+
return (EXCEL_1900_CIVIL_EPOCH_UTC + civilOffset * MILLISECONDS_PER_DAY) / MILLISECONDS_PER_DAY;
|
|
2342
2354
|
}
|
|
2343
2355
|
function spreadsheetNumericCellValue(cell) {
|
|
2344
|
-
if (null !== spreadsheetDateCellSerial(cell)) return null;
|
|
2345
2356
|
const value = spreadsheetCellRawValue(cell);
|
|
2357
|
+
if (value instanceof Date || cell?.ct?.t === 'd') return null;
|
|
2346
2358
|
return 'number' == typeof value && Number.isFinite(value) ? value : null;
|
|
2347
2359
|
}
|
|
2348
2360
|
function spreadsheetCellRawValue(cell) {
|
|
2349
2361
|
const candidate = cell;
|
|
2350
2362
|
return candidate?.v ?? candidate?.m;
|
|
2351
2363
|
}
|
|
2352
|
-
function
|
|
2353
|
-
return
|
|
2364
|
+
function civilDayFromDateParts(year, month, day) {
|
|
2365
|
+
return Date.UTC(year, month, day) / MILLISECONDS_PER_DAY;
|
|
2354
2366
|
}
|
|
2355
2367
|
function dayBounds(day) {
|
|
2356
2368
|
return {
|
package/dist/core.js
CHANGED
|
@@ -3464,12 +3464,16 @@ async function createWorkSpreadsheetBlob(artifact) {
|
|
|
3464
3464
|
const XLSX = await import("xlsx");
|
|
3465
3465
|
const workbook = XLSX.utils.book_new();
|
|
3466
3466
|
for (const sheet of content.sheets){
|
|
3467
|
-
const worksheet = createSparseXlsxWorksheet(sheet, XLSX);
|
|
3467
|
+
const worksheet = createSparseXlsxWorksheet(sheet, XLSX, content.dateSystem);
|
|
3468
3468
|
applySpreadsheetLayout(worksheet, sheet);
|
|
3469
3469
|
XLSX.utils.book_append_sheet(workbook, worksheet, sheet.name.slice(0, 31) || '工作表');
|
|
3470
3470
|
}
|
|
3471
3471
|
workbook.Workbook = {
|
|
3472
3472
|
...workbook.Workbook,
|
|
3473
|
+
WBProps: {
|
|
3474
|
+
...workbook.Workbook?.WBProps,
|
|
3475
|
+
date1904: '1904' === content.dateSystem
|
|
3476
|
+
},
|
|
3473
3477
|
Sheets: content.sheets.map((sheet)=>({
|
|
3474
3478
|
name: sheet.name.slice(0, 31) || '工作表',
|
|
3475
3479
|
Hidden: sheet.hide ? 1 : 0
|
|
@@ -3492,7 +3496,7 @@ async function createWorkSpreadsheetBlob(artifact) {
|
|
|
3492
3496
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
3493
3497
|
});
|
|
3494
3498
|
}
|
|
3495
|
-
function createSparseXlsxWorksheet(sheet, XLSX) {
|
|
3499
|
+
function createSparseXlsxWorksheet(sheet, XLSX, dateSystem = '1900') {
|
|
3496
3500
|
const data = sheet.data ?? [];
|
|
3497
3501
|
const worksheet = {
|
|
3498
3502
|
'!a3sSparse': true
|
|
@@ -3511,7 +3515,7 @@ function createSparseXlsxWorksheet(sheet, XLSX) {
|
|
|
3511
3515
|
const style = xlsxCellStyle(cell);
|
|
3512
3516
|
const comment = exportXlsxCellComment(cell.ps);
|
|
3513
3517
|
const hyperlink = sheet.hyperlink?.[`${rowIndex}_${columnIndex}`];
|
|
3514
|
-
const target = xlsxCellObject(cell, rowIndex, columnIndex, sheet) ?? (style || comment || hyperlink ? {
|
|
3518
|
+
const target = xlsxCellObject(cell, rowIndex, columnIndex, sheet, dateSystem) ?? (style || comment || hyperlink ? {
|
|
3515
3519
|
t: 's',
|
|
3516
3520
|
v: ''
|
|
3517
3521
|
} : null);
|
|
@@ -3538,14 +3542,30 @@ function createSparseXlsxWorksheet(sheet, XLSX) {
|
|
|
3538
3542
|
});
|
|
3539
3543
|
return worksheet;
|
|
3540
3544
|
}
|
|
3541
|
-
function xlsxCellObject(cell, row, column, sheet) {
|
|
3542
|
-
if (cell.f)
|
|
3545
|
+
function xlsxCellObject(cell, row, column, sheet, dateSystem) {
|
|
3546
|
+
if (cell.f) {
|
|
3547
|
+
const formula = createXlsxFormulaCell(cell, row, column, sheet);
|
|
3548
|
+
if (formula.v instanceof Date && Number.isFinite(formula.v.getTime())) return {
|
|
3549
|
+
...formula,
|
|
3550
|
+
t: 'n',
|
|
3551
|
+
v: spreadsheetDateSerial(formula.v, dateSystem)
|
|
3552
|
+
};
|
|
3553
|
+
if ('d' === formula.t && 'number' == typeof formula.v) return {
|
|
3554
|
+
...formula,
|
|
3555
|
+
t: 'n'
|
|
3556
|
+
};
|
|
3557
|
+
return formula;
|
|
3558
|
+
}
|
|
3543
3559
|
if (cell.ct?.t === 'e') return createXlsxErrorCell(cell);
|
|
3544
3560
|
const value = xlsxRichTextCellText(cell) ?? cell.v ?? cell.m;
|
|
3545
3561
|
if (null == value) return cell.ps ? {
|
|
3546
3562
|
t: 's',
|
|
3547
3563
|
v: ''
|
|
3548
3564
|
} : null;
|
|
3565
|
+
if (value instanceof Date && Number.isFinite(value.getTime())) return {
|
|
3566
|
+
t: 'n',
|
|
3567
|
+
v: spreadsheetDateSerial(value, dateSystem)
|
|
3568
|
+
};
|
|
3549
3569
|
if ('boolean' == typeof value) return {
|
|
3550
3570
|
t: 'b',
|
|
3551
3571
|
v: value
|
|
@@ -3559,6 +3579,15 @@ function xlsxCellObject(cell, row, column, sheet) {
|
|
|
3559
3579
|
v: String(value)
|
|
3560
3580
|
};
|
|
3561
3581
|
}
|
|
3582
|
+
function spreadsheetDateSerial(value, dateSystem) {
|
|
3583
|
+
const year = value.getFullYear();
|
|
3584
|
+
const month = value.getMonth();
|
|
3585
|
+
const day = value.getDate();
|
|
3586
|
+
const time = (3600000 * value.getHours() + 60000 * value.getMinutes() + 1000 * value.getSeconds() + value.getMilliseconds()) / 86400000;
|
|
3587
|
+
if ('1904' === dateSystem) return (Date.UTC(year, month, day) - Date.UTC(1904, 0, 1)) / 86400000 + time;
|
|
3588
|
+
const civilDay = (Date.UTC(year, month, day) - Date.UTC(1899, 11, 31)) / 86400000;
|
|
3589
|
+
return civilDay + (civilDay >= 60 ? 1 : 0) + time;
|
|
3590
|
+
}
|
|
3562
3591
|
function applySpreadsheetLayout(worksheet, sheet) {
|
|
3563
3592
|
const merges = Object.values(sheet.config?.merge ?? {});
|
|
3564
3593
|
if (merges.length) worksheet['!merges'] = merges.map((merge)=>({
|
|
@@ -4101,7 +4130,7 @@ async function importWorkSpreadsheetFile(file, extension, context) {
|
|
|
4101
4130
|
const initialRequiresCellStyles = archive ? archive.has('xl/styles.xml') : true;
|
|
4102
4131
|
let readOptions = {
|
|
4103
4132
|
type: 'array',
|
|
4104
|
-
cellDates:
|
|
4133
|
+
cellDates: false,
|
|
4105
4134
|
cellFormula: true,
|
|
4106
4135
|
cellHTML: false,
|
|
4107
4136
|
cellStyles: initialRequiresCellStyles,
|
|
@@ -4185,6 +4214,11 @@ async function importWorkSpreadsheetFile(file, extension, context) {
|
|
|
4185
4214
|
]);
|
|
4186
4215
|
const XLSX = usesPlainXlsxFastPath ? null : await loadSheetJs();
|
|
4187
4216
|
const [sheetFeatures, formulaFeatures, pivotFeatures] = importedFeatures;
|
|
4217
|
+
const dateSystem = workbook.Workbook?.WBProps?.date1904 ? '1904' : '1900';
|
|
4218
|
+
const dynamicFilterContext = {
|
|
4219
|
+
dateSystem,
|
|
4220
|
+
now: new Date()
|
|
4221
|
+
};
|
|
4188
4222
|
await context.controller.checkpoint('parsing', 0.2);
|
|
4189
4223
|
await context.controller.checkpoint('parsing', 0.4);
|
|
4190
4224
|
const conversionStartedAt = spreadsheetImportNow();
|
|
@@ -4301,7 +4335,7 @@ async function importWorkSpreadsheetFile(file, extension, context) {
|
|
|
4301
4335
|
charts: features?.charts.length ? xlsxWorksheetChartsToSheet(features.charts, config) : void 0,
|
|
4302
4336
|
tables: features?.tables.length ? features.tables : void 0,
|
|
4303
4337
|
formulaMetadata
|
|
4304
|
-
}, features?.autoFilterCriteria ?? []));
|
|
4338
|
+
}, features?.autoFilterCriteria ?? [], dynamicFilterContext));
|
|
4305
4339
|
await context.controller.checkpoint('parsing', sheetProgressStart + sheetProgressSize);
|
|
4306
4340
|
}
|
|
4307
4341
|
const workbookMetadata = importXlsxDefinedNames(workbook, sheets);
|
|
@@ -4330,6 +4364,9 @@ async function importWorkSpreadsheetFile(file, extension, context) {
|
|
|
4330
4364
|
artifact.content = applyImportedXlsxPivotTables({
|
|
4331
4365
|
type: 'spreadsheet',
|
|
4332
4366
|
sheets,
|
|
4367
|
+
...'1904' === dateSystem ? {
|
|
4368
|
+
dateSystem
|
|
4369
|
+
} : {},
|
|
4333
4370
|
calculation: formulaFeatures?.calculation,
|
|
4334
4371
|
...workbookMetadata,
|
|
4335
4372
|
pageBreaks: pageBreaks.length ? pageBreaks : void 0,
|
|
@@ -4447,7 +4484,7 @@ function fortuneSheetConfig(worksheet) {
|
|
|
4447
4484
|
}
|
|
4448
4485
|
function fortuneCellFromXlsx(source, row, column, sheetId, hyperlink, comment, XLSX, directStyle) {
|
|
4449
4486
|
const cell = {
|
|
4450
|
-
...fortuneCellStyle(source),
|
|
4487
|
+
...fortuneCellStyle(source, XLSX),
|
|
4451
4488
|
...directStyle
|
|
4452
4489
|
};
|
|
4453
4490
|
const orientation = spreadsheetExplicitTextOrientationFromCell(cell);
|
|
@@ -4476,7 +4513,7 @@ function fortuneCellFromXlsx(source, row, column, sheetId, hyperlink, comment, X
|
|
|
4476
4513
|
function spreadsheetCellKey(row, column) {
|
|
4477
4514
|
return `${row}_${column}`;
|
|
4478
4515
|
}
|
|
4479
|
-
function fortuneCellStyle(source) {
|
|
4516
|
+
function fortuneCellStyle(source, XLSX) {
|
|
4480
4517
|
const style = source.s;
|
|
4481
4518
|
const font = style && 'object' == typeof style ? style.font : void 0;
|
|
4482
4519
|
const fill = style && 'object' == typeof style ? style.fill : void 0;
|
|
@@ -4504,10 +4541,19 @@ function fortuneCellStyle(source) {
|
|
|
4504
4541
|
if (orientationStyle) Object.assign(target, orientationStyle);
|
|
4505
4542
|
if (source.z && 'General' !== source.z || 'e' === source.t) target.ct = {
|
|
4506
4543
|
fa: source.z && 'General' !== source.z ? String(source.z) : void 0,
|
|
4507
|
-
t: source.t
|
|
4544
|
+
t: xlsxCellIsDate(source, XLSX) ? 'd' : source.t
|
|
4508
4545
|
};
|
|
4509
4546
|
return target;
|
|
4510
4547
|
}
|
|
4548
|
+
function xlsxCellIsDate(source, XLSX) {
|
|
4549
|
+
if ('d' === source.t) return true;
|
|
4550
|
+
if ('n' !== source.t || !source.z || 'General' === source.z) return false;
|
|
4551
|
+
try {
|
|
4552
|
+
return Boolean(XLSX.SSF.is_date(String(source.z)));
|
|
4553
|
+
} catch {
|
|
4554
|
+
return false;
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4511
4557
|
function fortuneCellDisplayText(source, XLSX) {
|
|
4512
4558
|
if (void 0 !== source.w) return source.w;
|
|
4513
4559
|
if (void 0 === source.v || null === source.v) return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
2
|
import { type WorkDocumentEmphasisMark } from '../work-document-emphasis';
|
|
3
3
|
import { type DocumentFontDialogScriptFontPatch, type DocumentFontFamilySource } from './document-font-dialog-script-font-model';
|
|
4
|
+
import { type DocumentFontDialogOpenTypeDraft, type DocumentFontDialogOpenTypePatch, type DocumentFontDialogOpenTypeSource, type DocumentFontDialogOpenTypeTouched } from './document-font-dialog-opentype-model';
|
|
4
5
|
import { type DocumentFontDialogRunBorderDraft, type DocumentFontDialogRunBorderPatch, type DocumentFontDialogRunBorderSource } from './document-font-dialog-run-border-model';
|
|
5
6
|
import { type DocumentFontDialogRunShadingDraft, type DocumentFontDialogRunShadingPatch, type DocumentFontDialogRunShadingSource } from './document-font-dialog-run-shading-model';
|
|
6
7
|
export type { DocumentFontFamilySource } from './document-font-dialog-script-font-model';
|
|
@@ -8,7 +9,7 @@ export type DocumentCharacterSpacingMode = 'condensed' | 'expanded' | 'mixed' |
|
|
|
8
9
|
export type DocumentCharacterPositionMode = 'lowered' | 'mixed' | 'normal' | 'raised';
|
|
9
10
|
export type DocumentCharacterScaleMode = 'mixed' | 'value';
|
|
10
11
|
export type DocumentEmphasisMarkMode = 'inherit' | 'mixed' | WorkDocumentEmphasisMark;
|
|
11
|
-
export interface DocumentFontDialogSource {
|
|
12
|
+
export interface DocumentFontDialogSource extends DocumentFontDialogOpenTypeSource {
|
|
12
13
|
characterScale: {
|
|
13
14
|
mixed: boolean;
|
|
14
15
|
value: number | null;
|
|
@@ -59,7 +60,7 @@ export interface DocumentFontDialogSource {
|
|
|
59
60
|
previewText: string;
|
|
60
61
|
selectedCharacters: number;
|
|
61
62
|
}
|
|
62
|
-
export interface DocumentFontDialogDraft extends DocumentFontDialogRunBorderDraft, DocumentFontDialogRunShadingDraft {
|
|
63
|
+
export interface DocumentFontDialogDraft extends DocumentFontDialogRunBorderDraft, DocumentFontDialogRunShadingDraft, DocumentFontDialogOpenTypeDraft {
|
|
63
64
|
characterScaleMode: DocumentCharacterScaleMode;
|
|
64
65
|
characterScalePercent: string;
|
|
65
66
|
characterPositionMode: DocumentCharacterPositionMode;
|
|
@@ -78,7 +79,7 @@ export interface DocumentFontDialogDraft extends DocumentFontDialogRunBorderDraf
|
|
|
78
79
|
eastAsiaFont: string;
|
|
79
80
|
complexScriptFont: string;
|
|
80
81
|
}
|
|
81
|
-
export interface DocumentFontDialogPatch extends DocumentFontDialogScriptFontPatch, DocumentFontDialogRunBorderPatch, DocumentFontDialogRunShadingPatch {
|
|
82
|
+
export interface DocumentFontDialogPatch extends DocumentFontDialogScriptFontPatch, DocumentFontDialogRunBorderPatch, DocumentFontDialogRunShadingPatch, DocumentFontDialogOpenTypePatch {
|
|
82
83
|
characterScalePercent?: number;
|
|
83
84
|
characterPositionHalfPoints?: number;
|
|
84
85
|
characterSpacingTwips?: number;
|
|
@@ -90,7 +91,7 @@ export interface DocumentFontDialogPatch extends DocumentFontDialogScriptFontPat
|
|
|
90
91
|
legacyTextEmboss?: boolean;
|
|
91
92
|
legacyTextImprint?: boolean;
|
|
92
93
|
}
|
|
93
|
-
export interface DocumentFontDialogTouched {
|
|
94
|
+
export interface DocumentFontDialogTouched extends DocumentFontDialogOpenTypeTouched {
|
|
94
95
|
characterPosition: boolean;
|
|
95
96
|
characterScale: boolean;
|
|
96
97
|
characterSpacing: boolean;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type WorkDocumentOpenTypeFeaturePatch, type WorkDocumentOpenTypeFeatures, type WorkDocumentOpenTypeLigatures, type WorkDocumentOpenTypeNumberForm, type WorkDocumentOpenTypeNumberSpacing } from '../work-document-opentype';
|
|
2
|
+
interface DocumentFontDialogOpenTypeValue<T> {
|
|
3
|
+
mixed: boolean;
|
|
4
|
+
value: T | null;
|
|
5
|
+
}
|
|
6
|
+
export interface DocumentFontDialogOpenTypeSource {
|
|
7
|
+
openTypeLigatures: DocumentFontDialogOpenTypeValue<WorkDocumentOpenTypeLigatures>;
|
|
8
|
+
openTypeNumberForm: DocumentFontDialogOpenTypeValue<WorkDocumentOpenTypeNumberForm>;
|
|
9
|
+
openTypeNumberSpacing: DocumentFontDialogOpenTypeValue<WorkDocumentOpenTypeNumberSpacing>;
|
|
10
|
+
openTypeStylisticSets: DocumentFontDialogOpenTypeValue<readonly number[]>;
|
|
11
|
+
openTypeContextualAlternates: DocumentFontDialogOpenTypeValue<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export type DocumentOpenTypeLigaturesMode = 'inherit' | 'mixed' | WorkDocumentOpenTypeLigatures;
|
|
14
|
+
export type DocumentOpenTypeNumberFormMode = 'inherit' | 'mixed' | WorkDocumentOpenTypeNumberForm;
|
|
15
|
+
export type DocumentOpenTypeNumberSpacingMode = 'inherit' | 'mixed' | WorkDocumentOpenTypeNumberSpacing;
|
|
16
|
+
export type DocumentOpenTypeStylisticSetsMode = 'inherit' | 'mixed' | 'multiple' | 'none' | `set-${number}`;
|
|
17
|
+
export type DocumentOpenTypeContextualAlternatesMode = 'disabled' | 'enabled' | 'inherit' | 'mixed';
|
|
18
|
+
export interface DocumentFontDialogOpenTypeDraft {
|
|
19
|
+
openTypeLigatures: DocumentOpenTypeLigaturesMode;
|
|
20
|
+
openTypeNumberForm: DocumentOpenTypeNumberFormMode;
|
|
21
|
+
openTypeNumberSpacing: DocumentOpenTypeNumberSpacingMode;
|
|
22
|
+
openTypeStylisticSets: DocumentOpenTypeStylisticSetsMode;
|
|
23
|
+
openTypeContextualAlternates: DocumentOpenTypeContextualAlternatesMode;
|
|
24
|
+
}
|
|
25
|
+
export interface DocumentFontDialogOpenTypePatch {
|
|
26
|
+
openTypeLigatures?: WorkDocumentOpenTypeLigatures | null;
|
|
27
|
+
openTypeNumberForm?: WorkDocumentOpenTypeNumberForm | null;
|
|
28
|
+
openTypeNumberSpacing?: WorkDocumentOpenTypeNumberSpacing | null;
|
|
29
|
+
openTypeStylisticSets?: readonly number[] | null;
|
|
30
|
+
openTypeContextualAlternates?: boolean | null;
|
|
31
|
+
}
|
|
32
|
+
export interface DocumentFontDialogOpenTypeTouched {
|
|
33
|
+
openTypeLigatures: boolean;
|
|
34
|
+
openTypeNumberForm: boolean;
|
|
35
|
+
openTypeNumberSpacing: boolean;
|
|
36
|
+
openTypeStylisticSets: boolean;
|
|
37
|
+
openTypeContextualAlternates: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface DocumentFontDialogOpenTypeValueMaps {
|
|
40
|
+
ligatures: Map<string, WorkDocumentOpenTypeLigatures | null>;
|
|
41
|
+
numberForm: Map<string, WorkDocumentOpenTypeNumberForm | null>;
|
|
42
|
+
numberSpacing: Map<string, WorkDocumentOpenTypeNumberSpacing | null>;
|
|
43
|
+
stylisticSets: Map<string, readonly number[] | null>;
|
|
44
|
+
contextualAlternates: Map<string, boolean | null>;
|
|
45
|
+
}
|
|
46
|
+
export declare function createDocumentFontDialogOpenTypeValueMaps(): DocumentFontDialogOpenTypeValueMaps;
|
|
47
|
+
export declare function addDocumentFontDialogOpenTypeValues(values: DocumentFontDialogOpenTypeValueMaps, serialized: unknown): void;
|
|
48
|
+
export declare function selectedDocumentFontDialogOpenTypeSource(values: DocumentFontDialogOpenTypeValueMaps): DocumentFontDialogOpenTypeSource;
|
|
49
|
+
export declare function createDocumentFontDialogOpenTypeDraft(source: DocumentFontDialogOpenTypeSource): DocumentFontDialogOpenTypeDraft;
|
|
50
|
+
export declare function appendDocumentFontDialogOpenTypePatch(patch: DocumentFontDialogOpenTypePatch, source: DocumentFontDialogOpenTypeSource, draft: DocumentFontDialogOpenTypeDraft, touched: DocumentFontDialogOpenTypeTouched): void;
|
|
51
|
+
export declare function documentFontDialogOpenTypeFeaturePatch(patch: DocumentFontDialogOpenTypePatch): WorkDocumentOpenTypeFeaturePatch;
|
|
52
|
+
export declare function documentFontDialogOpenTypePreviewFeatures(source: DocumentFontDialogOpenTypeSource, draft: DocumentFontDialogOpenTypeDraft): WorkDocumentOpenTypeFeatures | null;
|
|
53
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
2
|
import { type WorkDocumentScriptFontPatch } from '../work-document-script-fonts';
|
|
3
|
+
import { type WorkDocumentOpenTypeFeaturePatch } from '../work-document-opentype';
|
|
3
4
|
export interface DocumentFontFamilySource {
|
|
4
5
|
mixed: boolean;
|
|
5
6
|
value: string | null;
|
|
@@ -16,3 +17,7 @@ export declare function applyDocumentScriptFontPatch(editor: Editor, selection:
|
|
|
16
17
|
from: number;
|
|
17
18
|
to: number;
|
|
18
19
|
}, scalarPatch: Readonly<Record<string, boolean | number | string | null>>, scriptFontPatch: WorkDocumentScriptFontPatch): boolean;
|
|
20
|
+
export declare function applyDocumentTextStylePatch(editor: Editor, selection: {
|
|
21
|
+
from: number;
|
|
22
|
+
to: number;
|
|
23
|
+
}, scalarPatch: Readonly<Record<string, boolean | number | string | null>>, scriptFontPatch: WorkDocumentScriptFontPatch, openTypePatch: WorkDocumentOpenTypeFeaturePatch): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { WorkSpreadsheetSheet } from '../work-types';
|
|
1
|
+
import type { WorkSpreadsheetDateSystem, WorkSpreadsheetSheet } from '../work-types';
|
|
2
2
|
export declare const SPREADSHEET_AUTO_FILTER_MENU_ITEMS: string[];
|
|
3
|
-
export declare function enhanceSpreadsheetAutoFilterSurface(container: HTMLElement, sheet: WorkSpreadsheetSheet | undefined, invoker: HTMLElement | null): HTMLElement | null;
|
|
3
|
+
export declare function enhanceSpreadsheetAutoFilterSurface(container: HTMLElement, sheet: WorkSpreadsheetSheet | undefined, invoker: HTMLElement | null, dateSystem?: WorkSpreadsheetDateSystem): HTMLElement | null;
|
|
4
4
|
export declare function focusSpreadsheetAutoFilterMenu(container: HTMLElement): void;
|
|
5
5
|
export declare function spreadsheetAutoFilterMenuFocusable(menu: HTMLElement): HTMLElement[];
|
|
6
6
|
export declare function spreadsheetAutoFilterTrigger(target: EventTarget | null): HTMLElement | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Selection } from '@fortune-sheet/core';
|
|
2
|
-
import type { WorkSpreadsheetFilterCriteria, WorkSpreadsheetContent, WorkSpreadsheetSheet } from '../work-types';
|
|
2
|
+
import type { WorkSpreadsheetDateSystem, WorkSpreadsheetFilterCriteria, WorkSpreadsheetContent, WorkSpreadsheetSheet } from '../work-types';
|
|
3
3
|
import { type WorkSpreadsheetAutoFilterRange } from '../work-spreadsheet-auto-filter';
|
|
4
4
|
import { type WorkSpreadsheetDynamicFilterContext } from '../work-spreadsheet-dynamic-filter';
|
|
5
5
|
export type SpreadsheetAutoFilterRange = WorkSpreadsheetAutoFilterRange;
|
|
@@ -16,7 +16,7 @@ export declare function spreadsheetSelectionOrCurrentRegion(sheet: WorkSpreadshe
|
|
|
16
16
|
export declare function spreadsheetAutoFilterHeaderColumn(sheet: WorkSpreadsheetSheet | undefined, selection: Selection): number | null;
|
|
17
17
|
export declare function toggleSpreadsheetAutoFilter(content: WorkSpreadsheetContent, sheetId: string, selection: Selection): WorkSpreadsheetContent | null;
|
|
18
18
|
export declare function spreadsheetAutoFilterCriteria(sheet: WorkSpreadsheetSheet | undefined, column: number): WorkSpreadsheetFilterCriteria | null;
|
|
19
|
-
export declare function spreadsheetAutoFilterColumnIsNumeric(sheet: WorkSpreadsheetSheet, range: SpreadsheetAutoFilterRange, column: number): boolean;
|
|
20
|
-
export declare function spreadsheetAutoFilterColumnIsDate(sheet: WorkSpreadsheetSheet, range: SpreadsheetAutoFilterRange, column: number): boolean;
|
|
19
|
+
export declare function spreadsheetAutoFilterColumnIsNumeric(sheet: WorkSpreadsheetSheet, range: SpreadsheetAutoFilterRange, column: number, dateSystem?: WorkSpreadsheetDateSystem): boolean;
|
|
20
|
+
export declare function spreadsheetAutoFilterColumnIsDate(sheet: WorkSpreadsheetSheet, range: SpreadsheetAutoFilterRange, column: number, dateSystem?: WorkSpreadsheetDateSystem): boolean;
|
|
21
21
|
export declare function applySpreadsheetAutoFilterCriteria(content: WorkSpreadsheetContent, sheetId: string, column: number, criteria: WorkSpreadsheetFilterCriteria, context?: WorkSpreadsheetDynamicFilterContext): WorkSpreadsheetContent | null;
|
|
22
22
|
export declare function clearSpreadsheetAutoFilterCriteria(content: WorkSpreadsheetContent, sheetId: string, column: number): WorkSpreadsheetContent | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Cell } from '@fortune-sheet/core';
|
|
2
|
+
import type { WorkSpreadsheetDateSystem } from '../work-types';
|
|
2
3
|
import type { SpreadsheetCommandContext, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
|
|
3
4
|
import { type OfficeEditorExtension } from './office-editor-extension';
|
|
4
5
|
export type SpreadsheetDateTimeKind = 'date' | 'time';
|
|
@@ -10,5 +11,5 @@ export interface SpreadsheetDateTimeEntry {
|
|
|
10
11
|
formulaBarValue: string;
|
|
11
12
|
value: number;
|
|
12
13
|
}
|
|
13
|
-
export declare function spreadsheetDateTimeEntry(kind: SpreadsheetDateTimeKind, now: Date): SpreadsheetDateTimeEntry | null;
|
|
14
|
+
export declare function spreadsheetDateTimeEntry(kind: SpreadsheetDateTimeKind, now: Date, dateSystem?: WorkSpreadsheetDateSystem): SpreadsheetDateTimeEntry | null;
|
|
14
15
|
export declare function createSpreadsheetDateTimeExtension(): OfficeEditorExtension<SpreadsheetCommandContext, SpreadsheetEditorCommands>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Cell, Op, Selection } from '@fortune-sheet/core';
|
|
2
|
-
import type { WorkSpreadsheetContent } from '../work-types';
|
|
2
|
+
import type { WorkSpreadsheetContent, WorkSpreadsheetDateSystem } from '../work-types';
|
|
3
3
|
import type { OfficeSelectOption } from './office-select';
|
|
4
4
|
export interface SpreadsheetSelectionSummary {
|
|
5
5
|
average: number | null;
|
|
@@ -21,7 +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'], operations?: readonly Op[]): WorkSpreadsheetContent['sheets'];
|
|
24
|
+
export declare function spreadsheetSheetsFromFortune(sheets: WorkSpreadsheetContent['sheets'], sourceSheets: WorkSpreadsheetContent['sheets'], operations?: readonly Op[], dateSystem?: WorkSpreadsheetDateSystem): WorkSpreadsheetContent['sheets'];
|
|
25
25
|
export declare function finiteSpreadsheetSelection(selection: Selection | undefined): Selection;
|
|
26
26
|
export declare function sameSpreadsheetWorkbookState(changed: WorkSpreadsheetContent['sheets'], rendered: WorkSpreadsheetContent['sheets']): boolean;
|
|
27
27
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Op } from '@fortune-sheet/core';
|
|
2
|
+
import type { WorkSpreadsheetDynamicFilterContext } from '../work-spreadsheet-dynamic-filter';
|
|
2
3
|
import type { WorkSpreadsheetContent, WorkSpreadsheetSheet } from '../work-types';
|
|
3
4
|
import type { SpreadsheetCellRange } from './spreadsheet-cell-range';
|
|
4
|
-
export declare function reconcileSpreadsheetFiltersAfterFortune(sheets: WorkSpreadsheetContent['sheets'], sourceSheets: WorkSpreadsheetContent['sheets'], operations?: readonly Op[]): WorkSpreadsheetContent['sheets'];
|
|
5
|
-
export declare function reconcileSpreadsheetFiltersAfterSort(sheet: WorkSpreadsheetSheet, source: WorkSpreadsheetSheet, range: SpreadsheetCellRange, sourceIndexes: readonly number[]): WorkSpreadsheetSheet | null;
|
|
5
|
+
export declare function reconcileSpreadsheetFiltersAfterFortune(sheets: WorkSpreadsheetContent['sheets'], sourceSheets: WorkSpreadsheetContent['sheets'], operations?: readonly Op[], context?: WorkSpreadsheetDynamicFilterContext): WorkSpreadsheetContent['sheets'];
|
|
6
|
+
export declare function reconcileSpreadsheetFiltersAfterSort(sheet: WorkSpreadsheetSheet, source: WorkSpreadsheetSheet, range: SpreadsheetCellRange, sourceIndexes: readonly number[], context?: WorkSpreadsheetDynamicFilterContext): WorkSpreadsheetSheet | null;
|
|
6
7
|
export declare function spreadsheetFilterReconciliationIsBounded(sheet: WorkSpreadsheetSheet): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
import { type WorkDocumentEmphasisMark } from './work-document-emphasis';
|
|
3
|
+
import { type WorkDocumentOpenTypeLigatures, type WorkDocumentOpenTypeNumberForm, type WorkDocumentOpenTypeNumberSpacing } from './work-document-opentype';
|
|
3
4
|
export type WorkDocumentEquationDisplay = 'inline' | 'block';
|
|
4
5
|
export type WorkDocumentEquationJustification = 'left' | 'right' | 'center' | 'centerGroup';
|
|
5
6
|
export type WorkDocumentEquationBarPosition = 'top' | 'bottom';
|
|
@@ -159,9 +160,9 @@ export interface WorkDocumentEquationWordProperties3D {
|
|
|
159
160
|
extrusionColor?: WorkDocumentEquationWordEffectColor;
|
|
160
161
|
contourColor?: WorkDocumentEquationWordEffectColor;
|
|
161
162
|
}
|
|
162
|
-
export type WorkDocumentEquationWordLigatures =
|
|
163
|
-
export type WorkDocumentEquationWordNumberForm =
|
|
164
|
-
export type WorkDocumentEquationWordNumberSpacing =
|
|
163
|
+
export type WorkDocumentEquationWordLigatures = WorkDocumentOpenTypeLigatures;
|
|
164
|
+
export type WorkDocumentEquationWordNumberForm = WorkDocumentOpenTypeNumberForm;
|
|
165
|
+
export type WorkDocumentEquationWordNumberSpacing = WorkDocumentOpenTypeNumberSpacing;
|
|
165
166
|
export interface WorkDocumentEquationWordLineDash {
|
|
166
167
|
preset?: WorkDocumentEquationWordPresetLineDash;
|
|
167
168
|
}
|
|
@@ -7,6 +7,7 @@ import { type WorkDocumentStrikeFormatting } from './work-document-strike';
|
|
|
7
7
|
import { type WorkDocumentScriptFontSlot, type WorkDocumentScriptFonts } from './work-document-script-fonts';
|
|
8
8
|
import { type WorkDocumentHighlight } from './work-document-highlight';
|
|
9
9
|
import { type WorkDocumentProofingLanguages } from './work-document-proofing';
|
|
10
|
+
import { type WorkDocumentOpenTypeFeatures } from './work-document-opentype';
|
|
10
11
|
export declare const DOCUMENT_CHARACTER_FORMAT_MARKS: readonly ["bold", "italic", "underline", "strike", "subscript", "superscript", "textStyle", "highlight"];
|
|
11
12
|
export type DocumentCharacterFormatMarkName = (typeof DOCUMENT_CHARACTER_FORMAT_MARKS)[number];
|
|
12
13
|
export interface DocumentCharacterFormatMark {
|
|
@@ -50,4 +51,5 @@ export declare function importedDocumentCharacterFormatting(formatting: {
|
|
|
50
51
|
themeFill?: string;
|
|
51
52
|
highlight?: WorkDocumentHighlight;
|
|
52
53
|
textCase?: WorkDocumentTextCase;
|
|
54
|
+
openTypeFeatures?: WorkDocumentOpenTypeFeatures;
|
|
53
55
|
}): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const DOCUMENT_OPEN_TYPE_ATTRIBUTE = "data-office-opentype-features";
|
|
2
|
+
export declare const DOCUMENT_OPEN_TYPE_LIGATURES: readonly ["none", "standard", "contextual", "historical", "discretional", "standardContextual", "standardHistorical", "contextualHistorical", "standardDiscretional", "contextualDiscretional", "historicalDiscretional", "standardContextualHistorical", "standardContextualDiscretional", "standardHistoricalDiscretional", "contextualHistoricalDiscretional", "all"];
|
|
3
|
+
export type WorkDocumentOpenTypeLigatures = (typeof DOCUMENT_OPEN_TYPE_LIGATURES)[number];
|
|
4
|
+
export declare const DOCUMENT_OPEN_TYPE_NUMBER_FORMS: readonly ["default", "lining", "oldStyle"];
|
|
5
|
+
export type WorkDocumentOpenTypeNumberForm = (typeof DOCUMENT_OPEN_TYPE_NUMBER_FORMS)[number];
|
|
6
|
+
export declare const DOCUMENT_OPEN_TYPE_NUMBER_SPACINGS: readonly ["default", "proportional", "tabular"];
|
|
7
|
+
export type WorkDocumentOpenTypeNumberSpacing = (typeof DOCUMENT_OPEN_TYPE_NUMBER_SPACINGS)[number];
|
|
8
|
+
export interface WorkDocumentOpenTypeFeatures {
|
|
9
|
+
ligatures?: WorkDocumentOpenTypeLigatures;
|
|
10
|
+
numberForm?: WorkDocumentOpenTypeNumberForm;
|
|
11
|
+
numberSpacing?: WorkDocumentOpenTypeNumberSpacing;
|
|
12
|
+
stylisticSets?: number[];
|
|
13
|
+
contextualAlternates?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkDocumentOpenTypeFeaturePatch {
|
|
16
|
+
ligatures?: WorkDocumentOpenTypeLigatures | null;
|
|
17
|
+
numberForm?: WorkDocumentOpenTypeNumberForm | null;
|
|
18
|
+
numberSpacing?: WorkDocumentOpenTypeNumberSpacing | null;
|
|
19
|
+
stylisticSets?: readonly number[] | null;
|
|
20
|
+
contextualAlternates?: boolean | null;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkDocumentOpenTypeCssProperties {
|
|
23
|
+
fontFeatureSettings?: string;
|
|
24
|
+
fontVariantLigatures?: string;
|
|
25
|
+
fontVariantNumeric?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function normalizeDocumentOpenTypeLigatures(value: unknown): WorkDocumentOpenTypeLigatures | null;
|
|
28
|
+
export declare function normalizeDocumentOpenTypeNumberForm(value: unknown): WorkDocumentOpenTypeNumberForm | null;
|
|
29
|
+
export declare function normalizeDocumentOpenTypeNumberSpacing(value: unknown): WorkDocumentOpenTypeNumberSpacing | null;
|
|
30
|
+
export declare function normalizeDocumentOpenTypeStylisticSets(value: unknown): number[] | null;
|
|
31
|
+
export declare function normalizeDocumentOpenTypeFeatures(value: unknown): WorkDocumentOpenTypeFeatures | null;
|
|
32
|
+
export declare function serializeDocumentOpenTypeFeatures(value: unknown): string | null;
|
|
33
|
+
export declare function parseDocumentOpenTypeFeatures(value: unknown): WorkDocumentOpenTypeFeatures | null;
|
|
34
|
+
export declare function documentOpenTypeFeaturesFromElement(element: HTMLElement): WorkDocumentOpenTypeFeatures | null;
|
|
35
|
+
export declare function documentOpenTypeDomAttributes(value: unknown): Record<string, string>;
|
|
36
|
+
export declare function documentOpenTypeCss(value: unknown): string;
|
|
37
|
+
export declare function documentOpenTypeCssProperties(value: unknown): WorkDocumentOpenTypeCssProperties;
|
|
38
|
+
export declare function isDocumentOpenTypeFeaturePatch(value: unknown): value is WorkDocumentOpenTypeFeaturePatch;
|
|
39
|
+
export declare function patchDocumentOpenTypeFeatures(source: unknown, patch: WorkDocumentOpenTypeFeaturePatch): WorkDocumentOpenTypeFeatures | null;
|