@factorialco/f0-react 1.237.0 → 1.238.1
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/experimental.d.ts +109 -0
- package/dist/experimental.js +5792 -5781
- package/dist/f0.js +2 -2
- package/dist/{hooks-dUvLXJ7v.js → hooks-Cut8s-iM.js} +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/experimental.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ import { ReactElement } from 'react';
|
|
|
63
63
|
import { ReactNode } from 'react';
|
|
64
64
|
import * as RechartsPrimitive from 'recharts';
|
|
65
65
|
import { RefAttributes } from 'react';
|
|
66
|
+
import { RefObject } from 'react';
|
|
66
67
|
import { ScrollAreaProps } from '@radix-ui/react-scroll-area';
|
|
67
68
|
import { StatusCellValue } from './types/status.tsx';
|
|
68
69
|
import { StatusCellValue as StatusCellValue_2 } from '../../value-display/types/status';
|
|
@@ -1350,6 +1351,15 @@ export declare type CurrentFilters<F extends FilterOptions<string>> = F extends
|
|
|
1350
1351
|
|
|
1351
1352
|
declare type CustomEmptyStates = Partial<Record<EmptyStateType, Partial<EmptyState>>>;
|
|
1352
1353
|
|
|
1354
|
+
export declare type CustomVisualizationProps<Source extends {
|
|
1355
|
+
dataAdapter: DataCollectionDataAdapter<any, any, any>;
|
|
1356
|
+
}> = {
|
|
1357
|
+
onSelectItems: OnSelectItemsCallback<InferRecord<Source>, InferFilters<Source>>;
|
|
1358
|
+
onLoadData: OnLoadDataCallback<InferRecord<Source>, InferFilters<Source>>;
|
|
1359
|
+
onLoadError: OnLoadErrorCallback;
|
|
1360
|
+
source: Source;
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1353
1363
|
export declare const Dashboard: ForwardRefExoticComponent<DashboardProps & RefAttributes<HTMLDivElement>> & {
|
|
1354
1364
|
Skeleton: () => JSX_2.Element;
|
|
1355
1365
|
};
|
|
@@ -1363,6 +1373,12 @@ declare type DashboardProps_2 = {
|
|
|
1363
1373
|
children: ReactNode[];
|
|
1364
1374
|
};
|
|
1365
1375
|
|
|
1376
|
+
declare type Data<R extends RecordType> = {
|
|
1377
|
+
records: WithGroupId<R>[];
|
|
1378
|
+
type: "grouped" | "flat";
|
|
1379
|
+
groups: GroupRecord<R>[];
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1366
1382
|
/**
|
|
1367
1383
|
* Combined type for all possible data adapter configurations
|
|
1368
1384
|
* @template R - The type of records in the collection
|
|
@@ -2518,6 +2534,11 @@ export declare const granularityDefinitions: Record<string, GranularityDefinitio
|
|
|
2518
2534
|
|
|
2519
2535
|
export declare type GranularityDefinitionSimple = Pick<GranularityDefinition, "toRangeString" | "toString">;
|
|
2520
2536
|
|
|
2537
|
+
/**
|
|
2538
|
+
* Symbol used to identify the groupId in the data
|
|
2539
|
+
*/
|
|
2540
|
+
declare const GROUP_ID_SYMBOL: unique symbol;
|
|
2541
|
+
|
|
2521
2542
|
/**
|
|
2522
2543
|
* Defines the structure and configuration of a grouping options for a data source.
|
|
2523
2544
|
* @template RecordType - The type of records in the collection
|
|
@@ -2555,6 +2576,13 @@ export declare type GroupingState<R extends RecordType, Grouping extends Groupin
|
|
|
2555
2576
|
order?: SortOrder;
|
|
2556
2577
|
} | undefined;
|
|
2557
2578
|
|
|
2579
|
+
declare type GroupRecord<RecordType> = {
|
|
2580
|
+
key: string;
|
|
2581
|
+
label: string | Promise<string>;
|
|
2582
|
+
itemCount: number | undefined | Promise<number | undefined>;
|
|
2583
|
+
records: RecordType[];
|
|
2584
|
+
};
|
|
2585
|
+
|
|
2558
2586
|
declare type HeaderProps = {
|
|
2559
2587
|
module: {
|
|
2560
2588
|
id: ModuleId;
|
|
@@ -2637,6 +2665,19 @@ export declare interface IndicatorsListProps {
|
|
|
2637
2665
|
items: ComponentProps<typeof Indicator>[];
|
|
2638
2666
|
}
|
|
2639
2667
|
|
|
2668
|
+
declare type InferFilters<S> = S extends {
|
|
2669
|
+
dataAdapter: DataCollectionDataAdapter<any, infer F, any>;
|
|
2670
|
+
} ? F : never;
|
|
2671
|
+
|
|
2672
|
+
/**
|
|
2673
|
+
* Returns the custom visualization props based on the data collection source.
|
|
2674
|
+
*
|
|
2675
|
+
* @template Source - The data collection source
|
|
2676
|
+
*/
|
|
2677
|
+
declare type InferRecord<S> = S extends {
|
|
2678
|
+
dataAdapter: DataCollectionDataAdapter<infer R, any, any>;
|
|
2679
|
+
} ? R : never;
|
|
2680
|
+
|
|
2640
2681
|
declare type InferSchema<T extends SchemaType> = z.infer<T>;
|
|
2641
2682
|
|
|
2642
2683
|
declare type InFilterDefinition<T = unknown> = BaseFilterDefinition<"in"> & {
|
|
@@ -4352,6 +4393,11 @@ declare interface SidebarProps {
|
|
|
4352
4393
|
|
|
4353
4394
|
declare type SidebarState = "locked" | "unlocked" | "hidden";
|
|
4354
4395
|
|
|
4396
|
+
/**
|
|
4397
|
+
* Response structure for non-paginated data
|
|
4398
|
+
*/
|
|
4399
|
+
declare type SimpleResult<T> = T[];
|
|
4400
|
+
|
|
4355
4401
|
declare const sizes: readonly ["sm", "md", "lg"];
|
|
4356
4402
|
|
|
4357
4403
|
declare const skeletonVariants: (props?: ({
|
|
@@ -4942,12 +4988,71 @@ export declare function useAiChat(): AiChatProviderReturnValue;
|
|
|
4942
4988
|
|
|
4943
4989
|
export declare function useAiPromotionChat(): AiPromotionChatProviderReturnValue;
|
|
4944
4990
|
|
|
4991
|
+
export declare type UseDataCollectionData<R extends RecordType> = UseDataCollectionDataReturn<R> & {
|
|
4992
|
+
summaries?: R;
|
|
4993
|
+
};
|
|
4994
|
+
|
|
4995
|
+
export declare function useDataCollectionData<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<R>>(source: DataCollectionSource<R, Filters, Sortings, Summaries, ItemActionsDefinition<R>, NavigationFilters, Grouping>, options?: UseDataOptions<R, Filters>): UseDataCollectionData<R>;
|
|
4996
|
+
|
|
4997
|
+
/**
|
|
4998
|
+
* Hook return type for useData
|
|
4999
|
+
*/
|
|
5000
|
+
declare type UseDataCollectionDataReturn<R extends RecordType> = UseDataReturn<R> & {
|
|
5001
|
+
summaries?: R;
|
|
5002
|
+
};
|
|
5003
|
+
|
|
4945
5004
|
export declare const useDataCollectionSource: <R extends RecordType = RecordType, FiltersSchema extends FiltersDefinition = FiltersDefinition, Sortings extends SortingsDefinition = SortingsDefinition, Summaries extends SummariesDefinition = SummariesDefinition, ItemActions extends ItemActionsDefinition<R> = ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition = NavigationFiltersDefinition, Grouping extends GroupingDefinition<R> = GroupingDefinition<R>>(source: DataCollectionSourceDefinition<R, FiltersSchema, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>, deps?: ReadonlyArray<unknown>) => DataCollectionSource<R, FiltersSchema, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>;
|
|
4946
5005
|
|
|
5006
|
+
/**
|
|
5007
|
+
* Hook options for useData
|
|
5008
|
+
*/
|
|
5009
|
+
declare interface UseDataOptions<R extends RecordType, Filters extends FiltersDefinition> {
|
|
5010
|
+
filters?: Partial<FiltersState<Filters>>;
|
|
5011
|
+
/**
|
|
5012
|
+
* A function that is called when an error occurs during data fetching.
|
|
5013
|
+
* It is called with the error object.
|
|
5014
|
+
* @param error - The error object.
|
|
5015
|
+
*/
|
|
5016
|
+
onError?: (error: DataError) => void;
|
|
5017
|
+
/**
|
|
5018
|
+
* A function that provides the fetch parameters for the data source.
|
|
5019
|
+
* It is called before each fetch request and can be used to modify the fetch parameters.
|
|
5020
|
+
* @param options - The fetch parameters for the data source.
|
|
5021
|
+
* @returns The fetch parameters for the data source.
|
|
5022
|
+
*/
|
|
5023
|
+
fetchParamsProvider?: <O extends BaseFetchOptions<Filters>>(options: O) => O;
|
|
5024
|
+
/**
|
|
5025
|
+
* A function that is called when the data is fetched successfully.
|
|
5026
|
+
* It is called with the response data.
|
|
5027
|
+
* @param response - The response data.
|
|
5028
|
+
*/
|
|
5029
|
+
onResponse?: (response: PaginatedResponse<R> | SimpleResult<R>) => void;
|
|
5030
|
+
}
|
|
5031
|
+
|
|
5032
|
+
/**
|
|
5033
|
+
* Hook return type for useData
|
|
5034
|
+
*/
|
|
5035
|
+
declare interface UseDataReturn<R extends RecordType> {
|
|
5036
|
+
data: Data<R>;
|
|
5037
|
+
isInitialLoading: boolean;
|
|
5038
|
+
isLoading: boolean;
|
|
5039
|
+
isLoadingMore: boolean;
|
|
5040
|
+
error: DataError | null;
|
|
5041
|
+
paginationInfo: PaginationInfo | null;
|
|
5042
|
+
setPage: (page: number) => void;
|
|
5043
|
+
loadMore: () => void;
|
|
5044
|
+
totalItems: number | undefined;
|
|
5045
|
+
mergedFilters: FiltersState<FiltersDefinition>;
|
|
5046
|
+
}
|
|
5047
|
+
|
|
4947
5048
|
export { useForm }
|
|
4948
5049
|
|
|
4949
5050
|
export declare function useFormSchema<Schema extends SchemaType, FormData extends InferSchema<Schema>>(schema: Schema, options: UseFormProps<FormData>, onSubmit: OnSubmitHandler<FormData>): FormType<Schema, FormData>;
|
|
4950
5051
|
|
|
5052
|
+
export declare const useInfiniteScrollPagination: (paginationInfo: PaginationInfo | null, isLoading: boolean, isLoadingMore: boolean, loadMore: () => void) => {
|
|
5053
|
+
loadingIndicatorRef: RefObject<HTMLTableCellElement>;
|
|
5054
|
+
};
|
|
5055
|
+
|
|
4951
5056
|
export declare interface User {
|
|
4952
5057
|
id: string;
|
|
4953
5058
|
fullname: string;
|
|
@@ -5205,6 +5310,10 @@ export declare const WidgetStrip: ForwardRefExoticComponent<DashboardProps_2 & R
|
|
|
5205
5310
|
|
|
5206
5311
|
declare type WidgetWidth = "sm" | "md" | "lg";
|
|
5207
5312
|
|
|
5313
|
+
declare type WithGroupId<RecordType> = RecordType & {
|
|
5314
|
+
[GROUP_ID_SYMBOL]: unknown | undefined;
|
|
5315
|
+
};
|
|
5316
|
+
|
|
5208
5317
|
declare type WithOptionalSorting<R extends RecordType, Sortings extends SortingsDefinition> = Omit<PropertyDefinition_2<R>, "hide"> & {
|
|
5209
5318
|
sorting?: SortingKey<Sortings>;
|
|
5210
5319
|
/**
|