Skip to content

Commit

Permalink
Improve typings and export missing PineFilterOption interface
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
JSReds committed Jan 27, 2025
1 parent 0107876 commit 26680ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/RJST/components/Filters/FocusSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export const FocusSearch = <T extends { id: number; [key: string]: any }>({
rowKey = 'id',
}: FocusSearchProps<T>) => {
const navigate = useNavigate();
const [searchResults, setSearchResults] = React.useState<T[]>([]);
const [searchResults, setSearchResults] = React.useState<
T[] | null | undefined
>(null);
const [isLoading, setIsLoading] = React.useState<boolean>(false);
const inputSearch = rjstContext.sdk?.inputSearch;

Expand All @@ -76,7 +78,7 @@ export const FocusSearch = <T extends { id: number; [key: string]: any }>({
} else if (searchFilter) {
setSearchResults(ajvFilter(searchFilter, filtered) || []);
} else {
setSearchResults([]);
setSearchResults(null);
}
setIsLoading(false);
}, 300),
Expand Down
2 changes: 1 addition & 1 deletion src/components/RJST/models/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const rjstDefaultPermissions = {
export const rjstRunTransformers = <
T extends Dictionary<any>,
TResult extends T,
TContext,
TContext = null,
>(
data: T | undefined,
transformers: Transformers<T, Omit<TResult, keyof T>, TContext>,
Expand Down
4 changes: 3 additions & 1 deletion src/components/RJST/schemaOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ export interface RJSTAction<T> {

export interface RJSTSdk<T> {
tags?: RJSTTagsSdk<T>;
inputSearch?: (filter?: PineFilterObject) => Promise<Array<Subset<T>>>;
inputSearch?: (
filter?: PineFilterObject,
) => Promise<Array<Subset<T>> | null | undefined>;
}

export interface RJSTContext<T> {
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export {
removeRefSchemeSeparatorsFromFilters,
} from './components/RJST/Filters/utils';

export type { PineFilterObject } from './components/RJST/oData/jsonToOData';

export {
type FormData,
FULL_TEXT_SLUG,
Expand Down

0 comments on commit 26680ac

Please sign in to comment.