0.1.07 文件树拖拽与多思维导图

This commit is contained in:
liaibo
2026-01-08 06:28:14 +08:00
parent 9de2d69c55
commit 9af8b9e489
30 changed files with 817 additions and 410 deletions
@@ -155,7 +155,7 @@ const FullScreenTableEditor: React.FC<FullScreenTableEditorProps> = ({ tableId,
}, [tableData]);
const normalizedSheets = useMemo(() => {
return luckysheetSheets.map((sheet) => ({
return luckysheetSheets.map((sheet: any) => ({
...sheet,
celldata: Array.isArray(sheet.celldata) ? sheet.celldata : [],
config: {
@@ -380,7 +380,7 @@ const FullScreenTableEditor: React.FC<FullScreenTableEditorProps> = ({ tableId,
if (editor && document.activeElement === editor && isInlineEditorVisible()) {
return;
}
luckysheetInstance.enterEditMode();
luckysheetInstance.enterEditMode?.();
focusLuckysheetEditor();
}, 0);
},
@@ -395,7 +395,7 @@ const FullScreenTableEditor: React.FC<FullScreenTableEditorProps> = ({ tableId,
if (!container) {
return;
}
const handlePointerUp = (event: PointerEvent | MouseEvent | TouchEvent) => {
const handlePointerUp: EventListener = (event) => {
const target = event.target instanceof Node ? event.target : null;
if (target && !container.contains(target)) {
return;
@@ -412,7 +412,7 @@ const FullScreenTableEditor: React.FC<FullScreenTableEditorProps> = ({ tableId,
tryEnterSingleClickEdit(normalized);
});
};
const events: Array<keyof DocumentEventMap> = ["pointerup", "mouseup", "touchend"];
const events = ["pointerup", "mouseup", "touchend"] as const;
events.forEach((eventName) => {
container.addEventListener(eventName, handlePointerUp, true);
});
@@ -437,7 +437,7 @@ const FullScreenTableEditor: React.FC<FullScreenTableEditorProps> = ({ tableId,
isApplyingSnapshotRef.current = true;
if (containerRef.current.children.length > 0) {
window.luckysheet.destroy(LUCKY_SHEET_CONTAINER_ID);
window.luckysheet?.destroy?.(LUCKY_SHEET_CONTAINER_ID);
containerRef.current.innerHTML = "";
}
@@ -507,7 +507,7 @@ const FullScreenTableEditor: React.FC<FullScreenTableEditorProps> = ({ tableId,
console.log("[FullScreenTableEditor] init luckysheet", { tableId, sheets: options.data });
}
try {
window.luckysheet.create(options);
window.luckysheet?.create?.(options as any);
} catch (error) {
console.error("Luckysheet 初始化失败", error);
setTableError("Luckysheet 初始化失败,请重试");
@@ -522,7 +522,7 @@ const FullScreenTableEditor: React.FC<FullScreenTableEditorProps> = ({ tableId,
return () => {
if (window.luckysheet) {
window.luckysheet.destroy(LUCKY_SHEET_CONTAINER_ID);
window.luckysheet?.destroy?.(LUCKY_SHEET_CONTAINER_ID);
}
if (containerRef.current) {
containerRef.current.innerHTML = "";