@extend-ai/react-xlsx 0.12.2 → 0.12.3
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/dist/duke_sheets_wasm_bg.wasm +0 -0
- package/dist/index.cjs +136 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +136 -134
- package/dist/index.js.map +1 -1
- package/dist/xlsx-worker.js +133 -133
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3458,6 +3458,85 @@ function sheetColumnWidthToPixels(width, columnCharacterWidthPx = DEFAULT_COLUMN
|
|
|
3458
3458
|
const pixels = width < 1 ? Math.floor(width * (digitWidth + 5) + 0.5) : Math.floor((256 * width + Math.floor(128 / digitWidth)) / 256 * digitWidth);
|
|
3459
3459
|
return Math.max(MIN_COL_WIDTH_PX, pixels);
|
|
3460
3460
|
}
|
|
3461
|
+
function resolveWorksheetDefaultColumnWidthPixels(worksheet, columnCharacterWidthPx = DEFAULT_COLUMN_CHARACTER_WIDTH_PX, fallbackPx = sheetColumnWidthToPixels(8.43, columnCharacterWidthPx)) {
|
|
3462
|
+
const width = typeof worksheet.defaultColumnWidth === "number" ? worksheet.defaultColumnWidth : Number.NaN;
|
|
3463
|
+
return Number.isFinite(width) && width > 0 ? sheetColumnWidthToPixels(width, columnCharacterWidthPx) : fallbackPx;
|
|
3464
|
+
}
|
|
3465
|
+
function resolveWorksheetDefaultRowHeightPixels(worksheet, fallbackPx = Math.max(MIN_ROW_HEIGHT_PX, Math.round(15 * 1.33))) {
|
|
3466
|
+
const height = typeof worksheet.defaultRowHeight === "number" ? worksheet.defaultRowHeight : Number.NaN;
|
|
3467
|
+
return Number.isFinite(height) && height > 0 ? Math.max(MIN_ROW_HEIGHT_PX, Math.round(height * 1.33)) : fallbackPx;
|
|
3468
|
+
}
|
|
3469
|
+
function resolveWorksheetHiddenRows(worksheet, maxRow) {
|
|
3470
|
+
if (!Number.isFinite(maxRow) || maxRow < 0 || typeof worksheet.isRowHidden !== "function") {
|
|
3471
|
+
return [];
|
|
3472
|
+
}
|
|
3473
|
+
const hiddenRows = [];
|
|
3474
|
+
for (let row = 0; row <= maxRow; row += 1) {
|
|
3475
|
+
if (worksheet.isRowHidden(row)) {
|
|
3476
|
+
hiddenRows.push(row);
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
return hiddenRows;
|
|
3480
|
+
}
|
|
3481
|
+
function resolveWorksheetHiddenCols(worksheet, maxCol) {
|
|
3482
|
+
if (!Number.isFinite(maxCol) || maxCol < 0 || typeof worksheet.isColumnHidden !== "function") {
|
|
3483
|
+
return [];
|
|
3484
|
+
}
|
|
3485
|
+
const hiddenCols = [];
|
|
3486
|
+
for (let col = 0; col <= maxCol; col += 1) {
|
|
3487
|
+
if (worksheet.isColumnHidden(col)) {
|
|
3488
|
+
hiddenCols.push(col);
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
return hiddenCols;
|
|
3492
|
+
}
|
|
3493
|
+
function resolveWorksheetMergeMetadata(worksheet) {
|
|
3494
|
+
const mergeMetadata = {
|
|
3495
|
+
hasHorizontalMerges: false,
|
|
3496
|
+
hasVerticalMerges: false,
|
|
3497
|
+
maxHorizontalMergeEndCol: -1,
|
|
3498
|
+
maxVerticalMergeEndRow: -1
|
|
3499
|
+
};
|
|
3500
|
+
const mergedRegions = Array.isArray(worksheet.mergedRegions) ? worksheet.mergedRegions : [];
|
|
3501
|
+
for (const rawRegion of mergedRegions) {
|
|
3502
|
+
let range = null;
|
|
3503
|
+
if (typeof rawRegion === "string") {
|
|
3504
|
+
range = parseA1RangeReference(rawRegion);
|
|
3505
|
+
} else if (rawRegion && typeof rawRegion === "object") {
|
|
3506
|
+
const region = rawRegion;
|
|
3507
|
+
const startRow = typeof region.startRow === "number" ? region.startRow : Number.NaN;
|
|
3508
|
+
const startCol = typeof region.startCol === "number" ? region.startCol : Number.NaN;
|
|
3509
|
+
const endRow = typeof region.endRow === "number" ? region.endRow : Number.NaN;
|
|
3510
|
+
const endCol = typeof region.endCol === "number" ? region.endCol : Number.NaN;
|
|
3511
|
+
if ([startRow, startCol, endRow, endCol].every((value) => Number.isFinite(value) && value >= 0)) {
|
|
3512
|
+
range = {
|
|
3513
|
+
end: {
|
|
3514
|
+
col: Math.max(startCol, endCol),
|
|
3515
|
+
row: Math.max(startRow, endRow)
|
|
3516
|
+
},
|
|
3517
|
+
start: {
|
|
3518
|
+
col: Math.min(startCol, endCol),
|
|
3519
|
+
row: Math.min(startRow, endRow)
|
|
3520
|
+
}
|
|
3521
|
+
};
|
|
3522
|
+
} else if (typeof region.range === "string") {
|
|
3523
|
+
range = parseA1RangeReference(region.range);
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
if (!range) {
|
|
3527
|
+
continue;
|
|
3528
|
+
}
|
|
3529
|
+
if (range.end.col > range.start.col) {
|
|
3530
|
+
mergeMetadata.hasHorizontalMerges = true;
|
|
3531
|
+
mergeMetadata.maxHorizontalMergeEndCol = Math.max(mergeMetadata.maxHorizontalMergeEndCol, range.end.col);
|
|
3532
|
+
}
|
|
3533
|
+
if (range.end.row > range.start.row) {
|
|
3534
|
+
mergeMetadata.hasVerticalMerges = true;
|
|
3535
|
+
mergeMetadata.maxVerticalMergeEndRow = Math.max(mergeMetadata.maxVerticalMergeEndRow, range.end.row);
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
return mergeMetadata;
|
|
3539
|
+
}
|
|
3461
3540
|
function buildThemePalette(theme) {
|
|
3462
3541
|
const themeOrder = ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink"];
|
|
3463
3542
|
const colorsByIndex = {};
|
|
@@ -4189,67 +4268,6 @@ function parseWorkbookStyles(archive) {
|
|
|
4189
4268
|
tableStyleByName
|
|
4190
4269
|
};
|
|
4191
4270
|
}
|
|
4192
|
-
function parseWorkbookTableMetadata(archive, workbookSheets) {
|
|
4193
|
-
return workbookSheets.map((sheet) => {
|
|
4194
|
-
const sheetRelationships = parseRelationships(archive, relsPathForDocument(sheet.path), sheet.path);
|
|
4195
|
-
const sheetXml = readArchiveText2(archive, sheet.path);
|
|
4196
|
-
if (!sheetXml) {
|
|
4197
|
-
return [];
|
|
4198
|
-
}
|
|
4199
|
-
const sheetDocument = parseXml2(sheetXml);
|
|
4200
|
-
if (!sheetDocument) {
|
|
4201
|
-
return [];
|
|
4202
|
-
}
|
|
4203
|
-
return getLocalElements(sheetDocument, "tablePart").flatMap((tablePartNode) => {
|
|
4204
|
-
const relationshipId = getRelationshipId(tablePartNode);
|
|
4205
|
-
if (!relationshipId) {
|
|
4206
|
-
return [];
|
|
4207
|
-
}
|
|
4208
|
-
const relationship = sheetRelationships.get(relationshipId);
|
|
4209
|
-
if (!relationship) {
|
|
4210
|
-
return [];
|
|
4211
|
-
}
|
|
4212
|
-
const tableXml = readArchiveText2(archive, relationship.target);
|
|
4213
|
-
if (!tableXml) {
|
|
4214
|
-
return [];
|
|
4215
|
-
}
|
|
4216
|
-
const tableDocument = parseXml2(tableXml);
|
|
4217
|
-
const tableNode = tableDocument?.documentElement;
|
|
4218
|
-
if (!tableNode || tableNode.localName !== "table") {
|
|
4219
|
-
return [];
|
|
4220
|
-
}
|
|
4221
|
-
return [{
|
|
4222
|
-
displayName: tableNode.getAttribute("displayName") ?? void 0,
|
|
4223
|
-
headerRowCount: parseWorkbookTableCount(tableNode.getAttribute("headerRowCount"), 1),
|
|
4224
|
-
headerRowCellStyle: tableNode.getAttribute("headerRowCellStyle") ?? void 0,
|
|
4225
|
-
name: tableNode.getAttribute("name") ?? void 0,
|
|
4226
|
-
reference: tableNode.getAttribute("ref") ?? void 0,
|
|
4227
|
-
totalsRowCount: parseWorkbookTableCount(tableNode.getAttribute("totalsRowCount"), 0),
|
|
4228
|
-
totalsRowShown: parseWorkbookTableBoolean(tableNode.getAttribute("totalsRowShown"), false)
|
|
4229
|
-
}];
|
|
4230
|
-
});
|
|
4231
|
-
});
|
|
4232
|
-
}
|
|
4233
|
-
function parseWorkbookTableCount(value, fallback) {
|
|
4234
|
-
if (value === null) {
|
|
4235
|
-
return fallback;
|
|
4236
|
-
}
|
|
4237
|
-
const parsed = Number.parseInt(value, 10);
|
|
4238
|
-
return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;
|
|
4239
|
-
}
|
|
4240
|
-
function parseWorkbookTableBoolean(value, fallback) {
|
|
4241
|
-
if (value === null) {
|
|
4242
|
-
return fallback;
|
|
4243
|
-
}
|
|
4244
|
-
const normalized = value.trim().toLowerCase();
|
|
4245
|
-
if (normalized === "0" || normalized === "false" || normalized === "") {
|
|
4246
|
-
return false;
|
|
4247
|
-
}
|
|
4248
|
-
if (normalized === "1" || normalized === "true") {
|
|
4249
|
-
return true;
|
|
4250
|
-
}
|
|
4251
|
-
return fallback;
|
|
4252
|
-
}
|
|
4253
4271
|
function parseSqrefRanges(sqref) {
|
|
4254
4272
|
if (!sqref) {
|
|
4255
4273
|
return [];
|
|
@@ -4521,12 +4539,6 @@ function parseSheetState(archive, path, options) {
|
|
|
4521
4539
|
const colWidthOverridesPx = {};
|
|
4522
4540
|
const rowStyleIds = {};
|
|
4523
4541
|
const colStyleIds = {};
|
|
4524
|
-
const hiddenRows = /* @__PURE__ */ new Set();
|
|
4525
|
-
const hiddenCols = /* @__PURE__ */ new Set();
|
|
4526
|
-
let hasHorizontalMerges = false;
|
|
4527
|
-
let hasVerticalMerges = false;
|
|
4528
|
-
let maxHorizontalMergeEndCol = -1;
|
|
4529
|
-
let maxVerticalMergeEndRow = -1;
|
|
4530
4542
|
let minContentCol = Number.POSITIVE_INFINITY;
|
|
4531
4543
|
let minContentRow = Number.POSITIVE_INFINITY;
|
|
4532
4544
|
let maxContentCol = -1;
|
|
@@ -4567,16 +4579,12 @@ function parseSheetState(archive, path, options) {
|
|
|
4567
4579
|
const rowIndex = Number(rowNode.getAttribute("r") ?? 0) - 1;
|
|
4568
4580
|
const height = Number(rowNode.getAttribute("ht") ?? Number.NaN);
|
|
4569
4581
|
const styleId = Number(rowNode.getAttribute("s") ?? Number.NaN);
|
|
4570
|
-
const isHidden = (rowNode.getAttribute("hidden") ?? "0") === "1";
|
|
4571
4582
|
if (rowIndex >= 0 && Number.isFinite(height)) {
|
|
4572
4583
|
rowHeightOverridesPx[rowIndex] = Math.max(MIN_ROW_HEIGHT_PX, Math.round(height * 1.33));
|
|
4573
4584
|
}
|
|
4574
4585
|
if (rowIndex >= 0 && Number.isFinite(styleId)) {
|
|
4575
4586
|
rowStyleIds[rowIndex] = styleId;
|
|
4576
4587
|
}
|
|
4577
|
-
if (rowIndex >= 0 && isHidden) {
|
|
4578
|
-
hiddenRows.add(rowIndex);
|
|
4579
|
-
}
|
|
4580
4588
|
getChildElements(rowNode, "c").forEach((cellNode) => {
|
|
4581
4589
|
const cellRef = cellNode.getAttribute("r");
|
|
4582
4590
|
if (isMeaningfulCellNode(cellNode)) {
|
|
@@ -4591,28 +4599,12 @@ function parseSheetState(archive, path, options) {
|
|
|
4591
4599
|
}
|
|
4592
4600
|
});
|
|
4593
4601
|
});
|
|
4594
|
-
|
|
4595
|
-
const reference = mergeNode.getAttribute("ref");
|
|
4596
|
-
const range = reference ? parseA1RangeReference(reference) : null;
|
|
4597
|
-
if (!range) {
|
|
4598
|
-
return;
|
|
4599
|
-
}
|
|
4600
|
-
if (range.end.col > range.start.col) {
|
|
4601
|
-
hasHorizontalMerges = true;
|
|
4602
|
-
maxHorizontalMergeEndCol = Math.max(maxHorizontalMergeEndCol, range.end.col);
|
|
4603
|
-
}
|
|
4604
|
-
if (range.end.row > range.start.row) {
|
|
4605
|
-
hasVerticalMerges = true;
|
|
4606
|
-
maxVerticalMergeEndRow = Math.max(maxVerticalMergeEndRow, range.end.row);
|
|
4607
|
-
}
|
|
4608
|
-
});
|
|
4609
|
-
const maxMetadataCol = Math.max(maxContentCol, maxHorizontalMergeEndCol, 0) + 256;
|
|
4602
|
+
const maxMetadataCol = Math.max(maxContentCol, 0) + 256;
|
|
4610
4603
|
getLocalElements(document2, "col").forEach((colNode) => {
|
|
4611
4604
|
const min = Number(colNode.getAttribute("min") ?? 0) - 1;
|
|
4612
4605
|
const max = Number(colNode.getAttribute("max") ?? 0) - 1;
|
|
4613
4606
|
const width = Number(colNode.getAttribute("width") ?? Number.NaN);
|
|
4614
4607
|
const styleId = Number(colNode.getAttribute("style") ?? Number.NaN);
|
|
4615
|
-
const isHidden = (colNode.getAttribute("hidden") ?? "0") === "1";
|
|
4616
4608
|
if (!Number.isFinite(width)) {
|
|
4617
4609
|
if (!Number.isFinite(styleId)) {
|
|
4618
4610
|
return;
|
|
@@ -4627,9 +4619,6 @@ function parseSheetState(archive, path, options) {
|
|
|
4627
4619
|
if (Number.isFinite(styleId)) {
|
|
4628
4620
|
colStyleIds[col] = styleId;
|
|
4629
4621
|
}
|
|
4630
|
-
if (isHidden) {
|
|
4631
|
-
hiddenCols.add(col);
|
|
4632
|
-
}
|
|
4633
4622
|
}
|
|
4634
4623
|
}
|
|
4635
4624
|
});
|
|
@@ -4641,16 +4630,16 @@ function parseSheetState(archive, path, options) {
|
|
|
4641
4630
|
conditionalFormatRules,
|
|
4642
4631
|
defaultColWidthPx: sheetColumnWidthToPixels(defaultColWidth, columnWidthCharacterWidthPx),
|
|
4643
4632
|
defaultRowHeightPx: Math.max(MIN_ROW_HEIGHT_PX, Math.round(defaultRowHeight * 1.33)),
|
|
4644
|
-
hasHorizontalMerges,
|
|
4645
|
-
hasVerticalMerges,
|
|
4646
|
-
maxHorizontalMergeEndCol,
|
|
4647
|
-
maxVerticalMergeEndRow,
|
|
4633
|
+
hasHorizontalMerges: false,
|
|
4634
|
+
hasVerticalMerges: false,
|
|
4635
|
+
maxHorizontalMergeEndCol: -1,
|
|
4636
|
+
maxVerticalMergeEndRow: -1,
|
|
4648
4637
|
maxContentCol,
|
|
4649
4638
|
maxContentRow,
|
|
4650
4639
|
minContentCol: Number.isFinite(minContentCol) ? minContentCol : -1,
|
|
4651
4640
|
minContentRow: Number.isFinite(minContentRow) ? minContentRow : -1,
|
|
4652
|
-
hiddenCols: [
|
|
4653
|
-
hiddenRows: [
|
|
4641
|
+
hiddenCols: [],
|
|
4642
|
+
hiddenRows: [],
|
|
4654
4643
|
rowHeightOverridesPx,
|
|
4655
4644
|
rowStyleIds,
|
|
4656
4645
|
showGridLines: (sheetViewNode?.getAttribute("showGridLines") ?? "1") !== "0",
|
|
@@ -5820,7 +5809,6 @@ function parseWorkbookStructureAssetsFromArchive(archive, options) {
|
|
|
5820
5809
|
const theme = parseWorkbookTheme(archive);
|
|
5821
5810
|
const themePalette = buildThemePalette(theme);
|
|
5822
5811
|
const { defaultFont, namedCellStyleByName, styleById, tableStyleByName } = parseWorkbookStyles(archive);
|
|
5823
|
-
const tableMetadataByWorkbookSheetIndex = parseWorkbookTableMetadata(archive, workbookSheets);
|
|
5824
5812
|
return {
|
|
5825
5813
|
contentTypes,
|
|
5826
5814
|
namedCellStyleByName,
|
|
@@ -5830,7 +5818,7 @@ function parseWorkbookStructureAssetsFromArchive(archive, options) {
|
|
|
5830
5818
|
themePalette
|
|
5831
5819
|
})),
|
|
5832
5820
|
styleById,
|
|
5833
|
-
tableMetadataByWorkbookSheetIndex,
|
|
5821
|
+
tableMetadataByWorkbookSheetIndex: workbookSheets.map(() => []),
|
|
5834
5822
|
tableStyleByName,
|
|
5835
5823
|
theme,
|
|
5836
5824
|
themePalette,
|
|
@@ -6726,16 +6714,20 @@ function resolveDisplayFileName(src, fileName) {
|
|
|
6726
6714
|
}
|
|
6727
6715
|
function resolveSheetDisplayUsedRange(usedRange, sheetState) {
|
|
6728
6716
|
const [minRow, minCol, maxRow, maxCol] = usedRange;
|
|
6729
|
-
const
|
|
6730
|
-
const
|
|
6717
|
+
const maxContentRow = sheetState?.maxContentRow ?? -1;
|
|
6718
|
+
const maxContentCol = sheetState?.maxContentCol ?? -1;
|
|
6719
|
+
const maxVerticalMergeEndRow = sheetState?.maxVerticalMergeEndRow ?? -1;
|
|
6720
|
+
const maxHorizontalMergeEndCol = sheetState?.maxHorizontalMergeEndCol ?? -1;
|
|
6721
|
+
const maxMeaningfulRow = Math.max(maxContentRow, maxVerticalMergeEndRow);
|
|
6722
|
+
const maxMeaningfulCol = Math.max(maxContentCol, maxHorizontalMergeEndCol);
|
|
6731
6723
|
if (maxMeaningfulRow < 0 && maxMeaningfulCol < 0) {
|
|
6732
6724
|
return usedRange;
|
|
6733
6725
|
}
|
|
6734
6726
|
return [
|
|
6735
6727
|
sheetState?.minContentRow !== void 0 && sheetState.minContentRow >= 0 ? Math.min(minRow, sheetState.minContentRow) : minRow,
|
|
6736
6728
|
sheetState?.minContentCol !== void 0 && sheetState.minContentCol >= 0 ? Math.min(minCol, sheetState.minContentCol) : minCol,
|
|
6737
|
-
maxMeaningfulRow >= 0 ? Math.min(maxRow, maxMeaningfulRow) : maxRow,
|
|
6738
|
-
maxMeaningfulCol >= 0 ? Math.min(maxCol, maxMeaningfulCol) : maxCol
|
|
6729
|
+
maxMeaningfulRow >= 0 ? maxContentRow >= 0 ? Math.min(maxRow, maxMeaningfulRow) : Math.max(maxRow, maxMeaningfulRow) : maxRow,
|
|
6730
|
+
maxMeaningfulCol >= 0 ? maxContentCol >= 0 ? Math.min(maxCol, maxMeaningfulCol) : Math.max(maxCol, maxMeaningfulCol) : maxCol
|
|
6739
6731
|
];
|
|
6740
6732
|
}
|
|
6741
6733
|
function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette, styleById, namedCellStyleByName, tableStyleByName, showHiddenSheets = false) {
|
|
@@ -6743,6 +6735,20 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
6743
6735
|
for (let index = 0; index < workbook.sheetCount; index += 1) {
|
|
6744
6736
|
const worksheet = workbook.getSheet(index);
|
|
6745
6737
|
const sheetState = sheetStatesByWorkbookSheetIndex?.[index] ?? null;
|
|
6738
|
+
const mergeMetadata = resolveWorksheetMergeMetadata(worksheet);
|
|
6739
|
+
const effectiveSheetState = {
|
|
6740
|
+
...sheetState,
|
|
6741
|
+
...mergeMetadata
|
|
6742
|
+
};
|
|
6743
|
+
const defaultColWidthPx = resolveWorksheetDefaultColumnWidthPixels(
|
|
6744
|
+
worksheet,
|
|
6745
|
+
sheetState?.columnWidthCharacterWidthPx,
|
|
6746
|
+
sheetState?.defaultColWidthPx ?? DEFAULT_COL_WIDTH
|
|
6747
|
+
);
|
|
6748
|
+
const defaultRowHeightPx = resolveWorksheetDefaultRowHeightPixels(
|
|
6749
|
+
worksheet,
|
|
6750
|
+
sheetState?.defaultRowHeightPx ?? DEFAULT_ROW_HEIGHT
|
|
6751
|
+
);
|
|
6746
6752
|
const visibility = normalizeWorksheetVisibility2(worksheet.visibility);
|
|
6747
6753
|
if (!showHiddenSheets && visibility !== "visible") {
|
|
6748
6754
|
continue;
|
|
@@ -6752,14 +6758,14 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
6752
6758
|
if (width !== void 0 && width !== null) {
|
|
6753
6759
|
return resolveSheetColumnWidthPixels(width, sheetState?.columnWidthCharacterWidthPx);
|
|
6754
6760
|
}
|
|
6755
|
-
return sheetState?.colWidthOverridesPx?.[col] ??
|
|
6761
|
+
return sheetState?.colWidthOverridesPx?.[col] ?? defaultColWidthPx;
|
|
6756
6762
|
};
|
|
6757
6763
|
const resolveRowHeightPx = (row) => {
|
|
6758
6764
|
const height = worksheet.getRowHeight(row);
|
|
6759
6765
|
if (height !== void 0 && height !== null) {
|
|
6760
6766
|
return Math.max(Math.round(height * 1.33), MIN_ROW_HEIGHT_PX2);
|
|
6761
6767
|
}
|
|
6762
|
-
return sheetState?.rowHeightOverridesPx?.[row] ??
|
|
6768
|
+
return sheetState?.rowHeightOverridesPx?.[row] ?? defaultRowHeightPx;
|
|
6763
6769
|
};
|
|
6764
6770
|
const usedRange = worksheet.usedRange();
|
|
6765
6771
|
if (!usedRange) {
|
|
@@ -6770,15 +6776,15 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
6770
6776
|
colStyleIds: sheetState?.colStyleIds ?? {},
|
|
6771
6777
|
conditionalFormatRules: sheetState?.conditionalFormatRules ?? [],
|
|
6772
6778
|
dataValidations: parseWorksheetDataValidations(worksheet),
|
|
6773
|
-
defaultColWidthPx
|
|
6774
|
-
defaultRowHeightPx
|
|
6779
|
+
defaultColWidthPx,
|
|
6780
|
+
defaultRowHeightPx,
|
|
6775
6781
|
freezePanes: parseWorksheetFreezePanes(worksheet),
|
|
6776
|
-
hasHorizontalMerges:
|
|
6777
|
-
hasVerticalMerges:
|
|
6778
|
-
maxHorizontalMergeEndCol:
|
|
6779
|
-
maxVerticalMergeEndRow:
|
|
6780
|
-
hiddenCols:
|
|
6781
|
-
hiddenRows:
|
|
6782
|
+
hasHorizontalMerges: mergeMetadata.hasHorizontalMerges,
|
|
6783
|
+
hasVerticalMerges: mergeMetadata.hasVerticalMerges,
|
|
6784
|
+
maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
|
|
6785
|
+
maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
|
|
6786
|
+
hiddenCols: [],
|
|
6787
|
+
hiddenRows: [],
|
|
6782
6788
|
minUsedCol: -1,
|
|
6783
6789
|
minUsedRow: -1,
|
|
6784
6790
|
maxUsedCol: -1,
|
|
@@ -6804,7 +6810,7 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
6804
6810
|
});
|
|
6805
6811
|
continue;
|
|
6806
6812
|
}
|
|
6807
|
-
const [minRow, minCol, maxRow, maxCol] = resolveSheetDisplayUsedRange(usedRange,
|
|
6813
|
+
const [minRow, minCol, maxRow, maxCol] = resolveSheetDisplayUsedRange(usedRange, effectiveSheetState);
|
|
6808
6814
|
let visibleRowsCache = null;
|
|
6809
6815
|
let visibleColsCache = null;
|
|
6810
6816
|
let rowHeightsCache = null;
|
|
@@ -6856,15 +6862,15 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
6856
6862
|
colStyleIds: sheetState?.colStyleIds ?? {},
|
|
6857
6863
|
conditionalFormatRules: sheetState?.conditionalFormatRules ?? [],
|
|
6858
6864
|
dataValidations: parseWorksheetDataValidations(worksheet),
|
|
6859
|
-
defaultColWidthPx
|
|
6860
|
-
defaultRowHeightPx
|
|
6865
|
+
defaultColWidthPx,
|
|
6866
|
+
defaultRowHeightPx,
|
|
6861
6867
|
freezePanes: parseWorksheetFreezePanes(worksheet),
|
|
6862
|
-
hasHorizontalMerges:
|
|
6863
|
-
hasVerticalMerges:
|
|
6864
|
-
maxHorizontalMergeEndCol:
|
|
6865
|
-
maxVerticalMergeEndRow:
|
|
6866
|
-
hiddenCols:
|
|
6867
|
-
hiddenRows:
|
|
6868
|
+
hasHorizontalMerges: mergeMetadata.hasHorizontalMerges,
|
|
6869
|
+
hasVerticalMerges: mergeMetadata.hasVerticalMerges,
|
|
6870
|
+
maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
|
|
6871
|
+
maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
|
|
6872
|
+
hiddenCols: resolveWorksheetHiddenCols(worksheet, maxCol),
|
|
6873
|
+
hiddenRows: resolveWorksheetHiddenRows(worksheet, maxRow),
|
|
6868
6874
|
minUsedCol: minCol,
|
|
6869
6875
|
minUsedRow: minRow,
|
|
6870
6876
|
maxUsedCol: maxCol,
|
|
@@ -7023,17 +7029,14 @@ function rangeContainsCell(range, cell) {
|
|
|
7023
7029
|
const normalized = normalizeRange(range);
|
|
7024
7030
|
return cell.row >= normalized.start.row && cell.row <= normalized.end.row && cell.col >= normalized.start.col && cell.col <= normalized.end.col;
|
|
7025
7031
|
}
|
|
7026
|
-
function mapWorksheetTables(worksheet
|
|
7032
|
+
function mapWorksheetTables(worksheet) {
|
|
7027
7033
|
const rawTables = worksheet?.tables ?? [];
|
|
7028
7034
|
return rawTables.flatMap((table, index) => {
|
|
7029
7035
|
const rawColumns = Array.isArray(table.columns) ? table.columns : [];
|
|
7030
7036
|
const rawName = typeof table.name === "string" ? table.name : `Table${index + 1}`;
|
|
7031
7037
|
const rawDisplayName = typeof table.displayName === "string" ? table.displayName : typeof table.name === "string" ? table.name : `Table ${index + 1}`;
|
|
7032
|
-
const metadata = metadataForSheet?.find(
|
|
7033
|
-
(entry) => entry.name && entry.name === rawName || entry.displayName && entry.displayName === rawDisplayName || entry.reference && entry.reference === table.reference
|
|
7034
|
-
);
|
|
7035
7038
|
const rawReference = typeof table.reference === "string" ? table.reference : "";
|
|
7036
|
-
const reference =
|
|
7039
|
+
const reference = rawReference;
|
|
7037
7040
|
const parsedRange = parseA1RangeReference2(reference);
|
|
7038
7041
|
if (!parsedRange) {
|
|
7039
7042
|
return [];
|
|
@@ -7046,14 +7049,14 @@ function mapWorksheetTables(worksheet, metadataForSheet) {
|
|
|
7046
7049
|
})),
|
|
7047
7050
|
displayName: rawDisplayName,
|
|
7048
7051
|
end: parsedRange.end,
|
|
7049
|
-
headerRowCount:
|
|
7050
|
-
headerRowCellStyle:
|
|
7052
|
+
headerRowCount: resolveWorkbookTableCount(table.headerRowCount, 1),
|
|
7053
|
+
headerRowCellStyle: typeof table.headerRowCellStyle === "string" ? table.headerRowCellStyle : void 0,
|
|
7051
7054
|
name: rawName,
|
|
7052
7055
|
reference,
|
|
7053
7056
|
start: parsedRange.start,
|
|
7054
7057
|
styleInfo: table.styleInfo,
|
|
7055
|
-
totalsRowCount:
|
|
7056
|
-
totalsRowShown:
|
|
7058
|
+
totalsRowCount: resolveWorkbookTableCount(table.totalsRowCount, 0),
|
|
7059
|
+
totalsRowShown: resolveWorkbookTableBoolean(table.totalsRowShown)
|
|
7057
7060
|
}];
|
|
7058
7061
|
});
|
|
7059
7062
|
}
|
|
@@ -8528,10 +8531,9 @@ function useXlsxViewerController(options) {
|
|
|
8528
8531
|
}
|
|
8529
8532
|
return workbook.getSheet(activeSheet.workbookSheetIndex);
|
|
8530
8533
|
}, [activeSheet, workbook]);
|
|
8531
|
-
const activeTableMetadata = imageAssetsRef.current?.tableMetadataByWorkbookSheetIndex[activeSheet?.workbookSheetIndex ?? -1] ?? null;
|
|
8532
8534
|
const tables = React.useMemo(
|
|
8533
|
-
() => isWorkerBacked ? workerTablesByWorkbookSheetIndex[activeSheet?.workbookSheetIndex ?? -1] ?? [] : mapWorksheetTables(getActiveWorksheet()
|
|
8534
|
-
[activeSheet?.workbookSheetIndex,
|
|
8535
|
+
() => isWorkerBacked ? workerTablesByWorkbookSheetIndex[activeSheet?.workbookSheetIndex ?? -1] ?? [] : mapWorksheetTables(getActiveWorksheet()),
|
|
8536
|
+
[activeSheet?.workbookSheetIndex, getActiveWorksheet, isWorkerBacked, revision, workerTablesByWorkbookSheetIndex]
|
|
8535
8537
|
);
|
|
8536
8538
|
const getCellSnapshotAsync = React.useCallback((workbookSheetIndex, row, col) => {
|
|
8537
8539
|
if (!isWorkerBacked) {
|