mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 09:29:24 +00:00
Merge branch 'V2' of github.com:Stirling-Tools/Stirling-PDF into feature/V2/RemovePages
This commit is contained in:
commit
7bca8315d8
@ -6,12 +6,12 @@ import { ToolOperationHook } from './useToolOperation';
|
|||||||
import { BaseParametersHook } from './useBaseParameters';
|
import { BaseParametersHook } from './useBaseParameters';
|
||||||
import { StirlingFile } from '../../../types/fileContext';
|
import { StirlingFile } from '../../../types/fileContext';
|
||||||
|
|
||||||
interface BaseToolReturn<TParams> {
|
interface BaseToolReturn<TParams, TParamsHook extends BaseParametersHook<TParams>> {
|
||||||
// File management
|
// File management
|
||||||
selectedFiles: StirlingFile[];
|
selectedFiles: StirlingFile[];
|
||||||
|
|
||||||
// Tool-specific hooks
|
// Tool-specific hooks
|
||||||
params: BaseParametersHook<TParams>;
|
params: TParamsHook;
|
||||||
operation: ToolOperationHook<TParams>;
|
operation: ToolOperationHook<TParams>;
|
||||||
|
|
||||||
// Endpoint validation
|
// Endpoint validation
|
||||||
@ -33,13 +33,13 @@ interface BaseToolReturn<TParams> {
|
|||||||
/**
|
/**
|
||||||
* Base tool hook for tool components. Manages standard behaviour for tools.
|
* Base tool hook for tool components. Manages standard behaviour for tools.
|
||||||
*/
|
*/
|
||||||
export function useBaseTool<TParams>(
|
export function useBaseTool<TParams, TParamsHook extends BaseParametersHook<TParams>>(
|
||||||
toolName: string,
|
toolName: string,
|
||||||
useParams: () => BaseParametersHook<TParams>,
|
useParams: () => TParamsHook,
|
||||||
useOperation: () => ToolOperationHook<TParams>,
|
useOperation: () => ToolOperationHook<TParams>,
|
||||||
props: BaseToolProps,
|
props: BaseToolProps,
|
||||||
options?: { minFiles?: number }
|
options?: { minFiles?: number }
|
||||||
): BaseToolReturn<TParams> {
|
): BaseToolReturn<TParams, TParamsHook> {
|
||||||
const minFiles = options?.minFiles ?? 1;
|
const minFiles = options?.minFiles ?? 1;
|
||||||
const { onPreviewFile, onComplete, onError } = props;
|
const { onPreviewFile, onComplete, onError } = props;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user