@extend-ai/react-xlsx 0.20.10 → 0.20.11
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/{chunk-DWBPSBJ5.cjs → chunk-SXHHFUXA.cjs} +494 -453
- package/dist/chunk-SXHHFUXA.cjs.map +1 -0
- package/dist/{chunk-2QENCJUT.js → chunk-VSM7WKLM.js} +59 -18
- package/dist/chunk-VSM7WKLM.js.map +1 -0
- package/dist/index.cjs +151 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +2 -2
- package/dist/internal.js +1 -1
- package/dist/vanilla.cjs +2 -2
- package/dist/vanilla.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2QENCJUT.js.map +0 -1
- package/dist/chunk-DWBPSBJ5.cjs.map +0 -1
|
@@ -10855,9 +10855,10 @@ function useXlsxViewerController(options) {
|
|
|
10855
10855
|
activeCell,
|
|
10856
10856
|
activeSheetIndex,
|
|
10857
10857
|
bytes: createSavedWorkbookBytes(workbook),
|
|
10858
|
-
selection
|
|
10858
|
+
selection,
|
|
10859
|
+
sortState
|
|
10859
10860
|
};
|
|
10860
|
-
}, [activeCell, activeSheetIndex, createSavedWorkbookBytes, selection, workbook]);
|
|
10861
|
+
}, [activeCell, activeSheetIndex, createSavedWorkbookBytes, selection, sortState, workbook]);
|
|
10861
10862
|
const captureCellMutationState = q((cell) => {
|
|
10862
10863
|
const worksheet = getActiveWorksheet();
|
|
10863
10864
|
if (!worksheet) {
|
|
@@ -10897,6 +10898,7 @@ function useXlsxViewerController(options) {
|
|
|
10897
10898
|
}
|
|
10898
10899
|
setActiveCell(entry.activeCell);
|
|
10899
10900
|
setSelection(entry.selection);
|
|
10901
|
+
setSortState(entry.sortState);
|
|
10900
10902
|
selectionAnchorRef.current = entry.selection ? normalizeRange(entry.selection).start : entry.activeCell;
|
|
10901
10903
|
setRevision((current) => current + 1);
|
|
10902
10904
|
}, [setChartAssets, setImageAssets]);
|
|
@@ -10931,6 +10933,7 @@ function useXlsxViewerController(options) {
|
|
|
10931
10933
|
for (const mutation of entry.mutations) {
|
|
10932
10934
|
applyCellMutationState(worksheet, mutation.cell, direction === "undo" ? mutation.before : mutation.after);
|
|
10933
10935
|
}
|
|
10936
|
+
setSortState(direction === "undo" ? entry.sortStateBefore : entry.sortStateAfter);
|
|
10934
10937
|
maybeRecalculateWorkbook(workbook);
|
|
10935
10938
|
refreshWorkbookState(workbook);
|
|
10936
10939
|
const nextActiveCell = direction === "undo" ? entry.activeCellBefore : entry.activeCellAfter;
|
|
@@ -11068,8 +11071,8 @@ function useXlsxViewerController(options) {
|
|
|
11068
11071
|
redoStackRef.current = [];
|
|
11069
11072
|
setHistoryRevision((current) => current + 1);
|
|
11070
11073
|
}, [activeCell, activeSheet, selection]);
|
|
11071
|
-
const recordRangeEditHistory = q((mutations, selectionAfter, activeCellAfter) => {
|
|
11072
|
-
if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0) {
|
|
11074
|
+
const recordRangeEditHistory = q((mutations, selectionAfter, activeCellAfter, sortStateAfter = sortState) => {
|
|
11075
|
+
if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0 && sortStateAfter === sortState) {
|
|
11073
11076
|
return;
|
|
11074
11077
|
}
|
|
11075
11078
|
pushHistoryEntry(undoStackRef.current, {
|
|
@@ -11079,11 +11082,13 @@ function useXlsxViewerController(options) {
|
|
|
11079
11082
|
mutations,
|
|
11080
11083
|
selectionAfter,
|
|
11081
11084
|
selectionBefore: selection,
|
|
11082
|
-
sheetIndex: activeSheet.workbookSheetIndex
|
|
11085
|
+
sheetIndex: activeSheet.workbookSheetIndex,
|
|
11086
|
+
sortStateAfter,
|
|
11087
|
+
sortStateBefore: sortState
|
|
11083
11088
|
});
|
|
11084
11089
|
redoStackRef.current = [];
|
|
11085
11090
|
setHistoryRevision((current) => current + 1);
|
|
11086
|
-
}, [activeCell, activeSheet, selection]);
|
|
11091
|
+
}, [activeCell, activeSheet, selection, sortState]);
|
|
11087
11092
|
const sortTable = q((tableName, columnIndex, direction) => {
|
|
11088
11093
|
const worksheet = getActiveWorksheet();
|
|
11089
11094
|
const targetTable = tables.find((table) => table.name === tableName || table.displayName === tableName);
|
|
@@ -11135,8 +11140,13 @@ function useXlsxViewerController(options) {
|
|
|
11135
11140
|
const comparedText = left.sortText.localeCompare(right.sortText, void 0, { numeric: true, sensitivity: "base" });
|
|
11136
11141
|
return direction === "ascending" ? comparedText : -comparedText;
|
|
11137
11142
|
});
|
|
11143
|
+
const nextSortState = { columnIndex, direction, tableName: targetTable.name };
|
|
11138
11144
|
if (sortedRows.every((row, index) => row.index === rows[index]?.index)) {
|
|
11139
|
-
|
|
11145
|
+
if (sortState?.tableName === targetTable.name && sortState.columnIndex === columnIndex && sortState.direction === direction) {
|
|
11146
|
+
return;
|
|
11147
|
+
}
|
|
11148
|
+
setSortState(nextSortState);
|
|
11149
|
+
recordRangeEditHistory([], selection, activeCell, nextSortState);
|
|
11140
11150
|
return;
|
|
11141
11151
|
}
|
|
11142
11152
|
const mutations = [];
|
|
@@ -11164,8 +11174,8 @@ function useXlsxViewerController(options) {
|
|
|
11164
11174
|
}
|
|
11165
11175
|
maybeRecalculateWorkbook(workbook);
|
|
11166
11176
|
refreshWorkbookState(workbook);
|
|
11167
|
-
setSortState(
|
|
11168
|
-
recordRangeEditHistory(mutations, selection, activeCell);
|
|
11177
|
+
setSortState(nextSortState);
|
|
11178
|
+
recordRangeEditHistory(mutations, selection, activeCell, nextSortState);
|
|
11169
11179
|
}, [
|
|
11170
11180
|
activeCell,
|
|
11171
11181
|
activeSheet,
|
|
@@ -11175,6 +11185,7 @@ function useXlsxViewerController(options) {
|
|
|
11175
11185
|
recordRangeEditHistory,
|
|
11176
11186
|
refreshWorkbookState,
|
|
11177
11187
|
selection,
|
|
11188
|
+
sortState,
|
|
11178
11189
|
tables,
|
|
11179
11190
|
workbook
|
|
11180
11191
|
]);
|
|
@@ -24006,6 +24017,10 @@ function XlsxGrid({
|
|
|
24006
24017
|
}
|
|
24007
24018
|
const direction = sortState && sortState.tableName === table.name && sortState.columnIndex === tableColumn.index ? sortState.direction : null;
|
|
24008
24019
|
const triggerIcon = direction === "ascending" ? "\u25B2" : direction === "descending" ? "\u25BC" : "\u25BE";
|
|
24020
|
+
const triggerStyle = {
|
|
24021
|
+
...resolveTableHeaderTriggerStyle(palette, zoomFactor),
|
|
24022
|
+
...experimentalCanvas ? { bottom: zoomFactor, right: zoomFactor, top: void 0, maxHeight: "100%", maxWidth: "100%" } : {}
|
|
24023
|
+
};
|
|
24009
24024
|
if (renderTableHeaderMenu) {
|
|
24010
24025
|
return renderTableHeaderMenu({
|
|
24011
24026
|
cell,
|
|
@@ -24024,7 +24039,7 @@ function XlsxGrid({
|
|
|
24024
24039
|
onPointerDown: (event) => {
|
|
24025
24040
|
event.stopPropagation();
|
|
24026
24041
|
},
|
|
24027
|
-
style:
|
|
24042
|
+
style: { ...triggerStyle, pointerEvents: "auto" },
|
|
24028
24043
|
type: "button"
|
|
24029
24044
|
}
|
|
24030
24045
|
});
|
|
@@ -24046,10 +24061,7 @@ function XlsxGrid({
|
|
|
24046
24061
|
(current) => current && current.tableName === table.name && current.row === cell.row && current.col === cell.col ? null : { col: cell.col, row: cell.row, tableName: table.name }
|
|
24047
24062
|
);
|
|
24048
24063
|
},
|
|
24049
|
-
style:
|
|
24050
|
-
...resolveTableHeaderTriggerStyle(palette, zoomFactor),
|
|
24051
|
-
...experimentalCanvas ? { bottom: zoomFactor, right: zoomFactor, top: void 0, maxHeight: "100%", maxWidth: "100%" } : {}
|
|
24052
|
-
},
|
|
24064
|
+
style: triggerStyle,
|
|
24053
24065
|
type: "button",
|
|
24054
24066
|
children: experimentalCanvas ? null : triggerIcon
|
|
24055
24067
|
}
|
|
@@ -24263,7 +24275,6 @@ function XlsxGrid({
|
|
|
24263
24275
|
if (editingCellRef.current) {
|
|
24264
24276
|
commitEditingRef.current();
|
|
24265
24277
|
}
|
|
24266
|
-
commitSelectionRange({ start: cell, end: cell });
|
|
24267
24278
|
setOpenTableMenu({ col: cell.col, row: cell.row, tableName: table.name });
|
|
24268
24279
|
return;
|
|
24269
24280
|
}
|
|
@@ -25310,7 +25321,7 @@ function XlsxGrid({
|
|
|
25310
25321
|
drawCanvasConditionalIcon(paneContext, cellData.conditionalIcon, iconX + iconSize / 2, iconY, iconSize);
|
|
25311
25322
|
}
|
|
25312
25323
|
paneContext.restore();
|
|
25313
|
-
if (cellData.isTableHeader && !
|
|
25324
|
+
if (cellData.isTableHeader && !renderTableHeaderMenu) {
|
|
25314
25325
|
const table = getTableAtCell(effectiveTables, drawCell.row, drawCell.col);
|
|
25315
25326
|
const column = getTableHeaderColumn(table, drawCell.row, drawCell.col);
|
|
25316
25327
|
const direction = table && column && sortState?.tableName === table.name && sortState.columnIndex === column.index ? sortState.direction : null;
|
|
@@ -25977,8 +25988,22 @@ function XlsxGrid({
|
|
|
25977
25988
|
zIndex: cornerHeaderOverlayZIndex
|
|
25978
25989
|
};
|
|
25979
25990
|
const editingOverlayRect = experimentalCanvas && editingCell ? resolveCellDisplayRect(editingCell) : null;
|
|
25980
|
-
const activeCellAdornment = experimentalCanvas && activeCell ? renderCellAdornment(activeCell) : null;
|
|
25991
|
+
const activeCellAdornment = experimentalCanvas && !renderTableHeaderMenu && activeCell ? renderCellAdornment(activeCell) : null;
|
|
25981
25992
|
const activeCellAdornmentRect = activeCell && activeCellAdornment ? resolveCellDisplayRect(activeCell) : null;
|
|
25993
|
+
const canvasTableHeaderAdornments = experimentalCanvas && renderTableHeaderMenu ? effectiveTables.flatMap((table) => {
|
|
25994
|
+
if (!canvasVisibleRowItems.some((row) => row.actualRow === table.start.row)) {
|
|
25995
|
+
return [];
|
|
25996
|
+
}
|
|
25997
|
+
return canvasVisibleColItems.flatMap((column) => {
|
|
25998
|
+
const cell = { row: table.start.row, col: column.actualCol };
|
|
25999
|
+
if (!getTableHeaderColumn(table, cell.row, cell.col)) {
|
|
26000
|
+
return [];
|
|
26001
|
+
}
|
|
26002
|
+
const rect = resolveCellDisplayRect(cell);
|
|
26003
|
+
const adornment = renderCellAdornment(cell);
|
|
26004
|
+
return rect && adornment ? [{ cell, rect, adornment }] : [];
|
|
26005
|
+
});
|
|
26006
|
+
}) : [];
|
|
25982
26007
|
const activeCellOverlayCell = renderActiveCellOverlay && activeCell ? resolveMergeAnchorCell(activeCell) : null;
|
|
25983
26008
|
const activeCellOverlayRect = activeCellOverlayCell ? resolveCellDisplayRect(activeCellOverlayCell) : null;
|
|
25984
26009
|
const activeCellOverlay = activeCellOverlayCell && activeCellOverlayRect ? renderActiveCellOverlay?.({ cell: activeCellOverlayCell, rect: activeCellOverlayRect }) : null;
|
|
@@ -27741,6 +27766,21 @@ function XlsxGrid({
|
|
|
27741
27766
|
{ pane: "left", style: canvasLeftOverlayPaneStyle, ref: canvasLeftOverlayContentRef, left: -displayRowHeaderWidth, top: -drawingViewport.top - frozenPaneBottom },
|
|
27742
27767
|
{ pane: "corner", style: canvasCornerOverlayPaneStyle, ref: canvasCornerOverlayContentRef, left: -displayRowHeaderWidth, top: -displayHeaderHeight }
|
|
27743
27768
|
];
|
|
27769
|
+
const tableHeaderOverlayPanes = canvasTableHeaderAdornments.length > 0 ? /* @__PURE__ */ u("div", { style: { ...canvasBodyViewportLayerStyle, zIndex: 27 }, children: overlayPanes.map(({ pane, style, left, top }) => /* @__PURE__ */ u("div", { style, children: canvasTableHeaderAdornments.map(({ cell, rect, adornment }) => drawingIntersectsPane(rect, pane) ? /* @__PURE__ */ u(
|
|
27770
|
+
"div",
|
|
27771
|
+
{
|
|
27772
|
+
style: {
|
|
27773
|
+
height: rect.height,
|
|
27774
|
+
left: rect.left + left,
|
|
27775
|
+
pointerEvents: "none",
|
|
27776
|
+
position: "absolute",
|
|
27777
|
+
top: rect.top + top,
|
|
27778
|
+
width: rect.width
|
|
27779
|
+
},
|
|
27780
|
+
children: adornment
|
|
27781
|
+
},
|
|
27782
|
+
`${cell.row}:${cell.col}`
|
|
27783
|
+
) : null) }, pane)) }) : null;
|
|
27744
27784
|
const selectionOverlayPanes = experimentalCanvas ? /* @__PURE__ */ u("div", { style: { ...canvasBodyViewportLayerStyle, zIndex: 40 }, children: overlayPanes.map(({ pane, style, left, top }) => /* @__PURE__ */ u("div", { style, children: /* @__PURE__ */ u(
|
|
27745
27785
|
"div",
|
|
27746
27786
|
{
|
|
@@ -27820,6 +27860,7 @@ function XlsxGrid({
|
|
|
27820
27860
|
] }) : null,
|
|
27821
27861
|
drawingOverlayPanes,
|
|
27822
27862
|
selectionOverlayPanes,
|
|
27863
|
+
tableHeaderOverlayPanes,
|
|
27823
27864
|
experimentalCanvas ? /* @__PURE__ */ u(S, { children: [
|
|
27824
27865
|
/* @__PURE__ */ u("div", { style: canvasBodyViewportLayerStyle, children: [
|
|
27825
27866
|
/* @__PURE__ */ u(
|
|
@@ -28647,4 +28688,4 @@ export {
|
|
|
28647
28688
|
__createContentNode,
|
|
28648
28689
|
__createContentRoot
|
|
28649
28690
|
};
|
|
28650
|
-
//# sourceMappingURL=chunk-
|
|
28691
|
+
//# sourceMappingURL=chunk-VSM7WKLM.js.map
|