chore(react/collections): fix the rest of client type errors

This commit is contained in:
Elian Doran 2025-09-14 10:53:54 +03:00
parent e77e0c54f0
commit 6077da0df8
No known key found for this signature in database
3 changed files with 10 additions and 16 deletions

View File

@ -3,9 +3,9 @@ import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } fr
import FNote from "../../entities/fnote";
import "./NoteList.css";
import { ListView, GridView } from "./legacy/ListOrGridView";
import { useEffect, useMemo, useRef, useState } from "preact/hooks";
import { useEffect, useRef, useState } from "preact/hooks";
import GeoView from "./geomap";
import ViewModeStorage from "../view_widgets/view_mode_storage";
import ViewModeStorage from "./view_mode_storage";
import CalendarView from "./calendar";
import TableView from "./table";
import BoardView from "./board";

View File

@ -2,8 +2,9 @@ import { useContext, useEffect, useLayoutEffect, useRef } from "preact/hooks";
import { EventCallBackMethods, Module, Options, Tabulator as VanillaTabulator } from "tabulator-tables";
import "tabulator-tables/dist/css/tabulator.css";
import "../../../../src/stylesheets/table.css";
import { JSX, RefObject, VNode } from "preact";
import { ParentComponent, renderReactWidget } from "../../react/react_utils";
import { JSX } from "preact/jsx-runtime";
import { isValidElement, RefObject } from "preact";
interface TableProps<T> extends Omit<Options, "data" | "footerElement" | "index"> {
tabulatorRef: RefObject<VanillaTabulator>;
@ -12,7 +13,7 @@ interface TableProps<T> extends Omit<Options, "data" | "footerElement" | "index"
modules?: (new (table: VanillaTabulator) => Module)[];
events?: Partial<EventCallBackMethods>;
index: keyof T;
footerElement?: JSX.Element;
footerElement?: string | HTMLElement | JSX.Element;
}
export default function Tabulator<T>({ className, columns, data, modules, tabulatorRef: externalTabulatorRef, footerElement, events, index, ...restProps }: TableProps<T>) {
@ -33,7 +34,7 @@ export default function Tabulator<T>({ className, columns, data, modules, tabula
const tabulator = new VanillaTabulator(containerRef.current, {
columns,
data,
footerElement: (parentComponent && footerElement ? renderReactWidget(parentComponent, footerElement)[0] : undefined),
footerElement: (parentComponent && isValidElement(footerElement) ? renderReactWidget(parentComponent, footerElement)[0] : undefined),
index: index as string | number | undefined,
...restProps
});

View File

@ -148,19 +148,12 @@ export function TouchBarButton({ label, icon, click, enabled }: ButtonProps) {
export function TouchBarSegmentedControl({ mode, segments, selectedIndex, onChange }: SegmentedControlProps) {
const api = useContext(TouchBarContext);
const processedSegments = segments.map((segment) => {
if (segment.icon) {
if (!api) return undefined;
return {
...segment,
icon: buildIcon(api?.nativeImage, segment.icon)
}
} else {
return segment;
}
});
if (api) {
const processedSegments: Electron.SegmentedControlSegment[] = segments.map(({icon, ...restProps}) => ({
...restProps,
icon: icon ? buildIcon(api.nativeImage, icon) : undefined
}));
const item = new api.TouchBar.TouchBarSegmentedControl({
mode, selectedIndex,
segments: processedSegments,