@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
package/dist/index.js
CHANGED
|
@@ -10692,9 +10692,10 @@ function useXlsxViewerController(options) {
|
|
|
10692
10692
|
activeCell,
|
|
10693
10693
|
activeSheetIndex,
|
|
10694
10694
|
bytes: createSavedWorkbookBytes(workbook),
|
|
10695
|
-
selection
|
|
10695
|
+
selection,
|
|
10696
|
+
sortState
|
|
10696
10697
|
};
|
|
10697
|
-
}, [activeCell, activeSheetIndex, createSavedWorkbookBytes, selection, workbook]);
|
|
10698
|
+
}, [activeCell, activeSheetIndex, createSavedWorkbookBytes, selection, sortState, workbook]);
|
|
10698
10699
|
const captureCellMutationState = React.useCallback((cell) => {
|
|
10699
10700
|
const worksheet = getActiveWorksheet();
|
|
10700
10701
|
if (!worksheet) {
|
|
@@ -10734,6 +10735,7 @@ function useXlsxViewerController(options) {
|
|
|
10734
10735
|
}
|
|
10735
10736
|
setActiveCell(entry.activeCell);
|
|
10736
10737
|
setSelection(entry.selection);
|
|
10738
|
+
setSortState(entry.sortState);
|
|
10737
10739
|
selectionAnchorRef.current = entry.selection ? normalizeRange(entry.selection).start : entry.activeCell;
|
|
10738
10740
|
setRevision((current) => current + 1);
|
|
10739
10741
|
}, [setChartAssets, setImageAssets]);
|
|
@@ -10768,6 +10770,7 @@ function useXlsxViewerController(options) {
|
|
|
10768
10770
|
for (const mutation of entry.mutations) {
|
|
10769
10771
|
applyCellMutationState(worksheet, mutation.cell, direction === "undo" ? mutation.before : mutation.after);
|
|
10770
10772
|
}
|
|
10773
|
+
setSortState(direction === "undo" ? entry.sortStateBefore : entry.sortStateAfter);
|
|
10771
10774
|
maybeRecalculateWorkbook(workbook);
|
|
10772
10775
|
refreshWorkbookState(workbook);
|
|
10773
10776
|
const nextActiveCell = direction === "undo" ? entry.activeCellBefore : entry.activeCellAfter;
|
|
@@ -10905,8 +10908,8 @@ function useXlsxViewerController(options) {
|
|
|
10905
10908
|
redoStackRef.current = [];
|
|
10906
10909
|
setHistoryRevision((current) => current + 1);
|
|
10907
10910
|
}, [activeCell, activeSheet, selection]);
|
|
10908
|
-
const recordRangeEditHistory = React.useCallback((mutations, selectionAfter, activeCellAfter) => {
|
|
10909
|
-
if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0) {
|
|
10911
|
+
const recordRangeEditHistory = React.useCallback((mutations, selectionAfter, activeCellAfter, sortStateAfter = sortState) => {
|
|
10912
|
+
if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0 && sortStateAfter === sortState) {
|
|
10910
10913
|
return;
|
|
10911
10914
|
}
|
|
10912
10915
|
pushHistoryEntry(undoStackRef.current, {
|
|
@@ -10916,11 +10919,13 @@ function useXlsxViewerController(options) {
|
|
|
10916
10919
|
mutations,
|
|
10917
10920
|
selectionAfter,
|
|
10918
10921
|
selectionBefore: selection,
|
|
10919
|
-
sheetIndex: activeSheet.workbookSheetIndex
|
|
10922
|
+
sheetIndex: activeSheet.workbookSheetIndex,
|
|
10923
|
+
sortStateAfter,
|
|
10924
|
+
sortStateBefore: sortState
|
|
10920
10925
|
});
|
|
10921
10926
|
redoStackRef.current = [];
|
|
10922
10927
|
setHistoryRevision((current) => current + 1);
|
|
10923
|
-
}, [activeCell, activeSheet, selection]);
|
|
10928
|
+
}, [activeCell, activeSheet, selection, sortState]);
|
|
10924
10929
|
const sortTable = React.useCallback((tableName, columnIndex, direction) => {
|
|
10925
10930
|
const worksheet = getActiveWorksheet();
|
|
10926
10931
|
const targetTable = tables.find((table) => table.name === tableName || table.displayName === tableName);
|
|
@@ -10972,8 +10977,13 @@ function useXlsxViewerController(options) {
|
|
|
10972
10977
|
const comparedText = left.sortText.localeCompare(right.sortText, void 0, { numeric: true, sensitivity: "base" });
|
|
10973
10978
|
return direction === "ascending" ? comparedText : -comparedText;
|
|
10974
10979
|
});
|
|
10980
|
+
const nextSortState = { columnIndex, direction, tableName: targetTable.name };
|
|
10975
10981
|
if (sortedRows.every((row, index) => row.index === rows[index]?.index)) {
|
|
10976
|
-
|
|
10982
|
+
if (sortState?.tableName === targetTable.name && sortState.columnIndex === columnIndex && sortState.direction === direction) {
|
|
10983
|
+
return;
|
|
10984
|
+
}
|
|
10985
|
+
setSortState(nextSortState);
|
|
10986
|
+
recordRangeEditHistory([], selection, activeCell, nextSortState);
|
|
10977
10987
|
return;
|
|
10978
10988
|
}
|
|
10979
10989
|
const mutations = [];
|
|
@@ -11001,8 +11011,8 @@ function useXlsxViewerController(options) {
|
|
|
11001
11011
|
}
|
|
11002
11012
|
maybeRecalculateWorkbook(workbook);
|
|
11003
11013
|
refreshWorkbookState(workbook);
|
|
11004
|
-
setSortState(
|
|
11005
|
-
recordRangeEditHistory(mutations, selection, activeCell);
|
|
11014
|
+
setSortState(nextSortState);
|
|
11015
|
+
recordRangeEditHistory(mutations, selection, activeCell, nextSortState);
|
|
11006
11016
|
}, [
|
|
11007
11017
|
activeCell,
|
|
11008
11018
|
activeSheet,
|
|
@@ -11012,6 +11022,7 @@ function useXlsxViewerController(options) {
|
|
|
11012
11022
|
recordRangeEditHistory,
|
|
11013
11023
|
refreshWorkbookState,
|
|
11014
11024
|
selection,
|
|
11025
|
+
sortState,
|
|
11015
11026
|
tables,
|
|
11016
11027
|
workbook
|
|
11017
11028
|
]);
|