@yusr_systems/ui 2.1.3 → 2.1.5

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/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { ActionCreatorWithPayload } from '@reduxjs/toolkit';
2
2
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
3
  import { AsyncThunk } from '@reduxjs/toolkit';
4
+ import { AsyncThunkConfig } from '@reduxjs/toolkit';
4
5
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
5
6
  import { BaseApiService } from '@yusr_systems/core';
6
7
  import { BaseEntity } from '@yusr_systems/core';
7
8
  import { BaseFilterableApiService } from '@yusr_systems/core';
9
+ import { CaseReducerActions } from '@reduxjs/toolkit';
8
10
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
9
11
  import { ClassProp } from 'class-variance-authority/types';
10
12
  import { ClassValue } from 'clsx';
@@ -34,7 +36,7 @@ import { PropsWithChildren } from 'react';
34
36
  import * as React_2 from 'react';
35
37
  import { ReactNode } from 'react';
36
38
  import * as RechartsPrimitive from 'recharts';
37
- import { Reducer } from '@reduxjs/toolkit';
39
+ import { Reducer } from 'redux';
38
40
  import { RefObject } from 'react';
39
41
  import { RequestResult } from '@yusr_systems/core';
40
42
  import { ResourcePermissions } from '@yusr_systems/core';
@@ -43,6 +45,7 @@ import * as SelectPrimitive from '@radix-ui/react-select';
43
45
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
44
46
  import { SetStateAction } from 'react';
45
47
  import { Slice } from '@reduxjs/toolkit';
48
+ import { SliceCaseReducers } from '@reduxjs/toolkit';
46
49
  import { SliceSelectors } from '@reduxjs/toolkit';
47
50
  import { StorageFile } from '@yusr_systems/core';
48
51
  import * as SwitchPrimitive from '@radix-ui/react-switch';
@@ -402,9 +405,35 @@ export declare function createGenericDialogSlice<T>(sliceName: string): Slice<ID
402
405
  }, action: PayloadAction<boolean>) => void;
403
406
  }, string, string, SliceSelectors<IDialogState<T>>>;
404
407
 
405
- export declare function createGenericEntitySlice<T extends BaseEntity>(sliceName: string, service: BaseFilterableApiService<T>, filterMethod?: FilterMethodType<T>): {
408
+ export declare function createGenericEntitySlice<T extends BaseEntity, CR extends SliceCaseReducers<IEntityState<T>> = {}>(sliceName: string, service: BaseFilterableApiService<T>, filterMethod?: FilterMethodType<T>, customReducers?: CR): {
406
409
  reducer: Reducer<IEntityState<T>>;
407
- actions: EntityActions<T>;
410
+ actions: CaseReducerActions<{
411
+ setCurrentPage: (state: {
412
+ entities: {
413
+ data: Draft<T>[] | undefined;
414
+ count: number;
415
+ };
416
+ isLoaded: boolean;
417
+ isLoading: boolean;
418
+ currentPage: number;
419
+ rowsPerPage: number;
420
+ }, action: PayloadAction<number>) => void;
421
+ refresh: (state: {
422
+ entities: {
423
+ data: Draft<T>[] | undefined;
424
+ count: number;
425
+ };
426
+ isLoaded: boolean;
427
+ isLoading: boolean;
428
+ currentPage: number;
429
+ rowsPerPage: number;
430
+ }, action: PayloadAction<{
431
+ data?: T;
432
+ deletedId?: number;
433
+ }>) => void;
434
+ } & CR, string> & {
435
+ filter: AsyncThunk<FilterResult<T> | undefined, FilterCondition | undefined, AsyncThunkConfig>;
436
+ };
408
437
  };
409
438
 
410
439
  export declare interface CrudActions<T extends BaseEntity> {
@@ -634,15 +663,6 @@ declare type EmptyTablePreviewProps = {
634
663
 
635
664
  export declare function EmptyTitle({ className, ...props }: React.ComponentProps<"div">): JSX.Element;
636
665
 
637
- export declare type EntityActions<T> = {
638
- setCurrentPage: ActionCreatorWithPayload<number, string>;
639
- refresh: ActionCreatorWithPayload<{
640
- data?: T;
641
- deletedId?: number;
642
- }, string>;
643
- filter: AsyncThunk<FilterResult<T> | undefined, FilterCondition | undefined, any>;
644
- };
645
-
646
666
  export declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): JSX.Element;
647
667
 
648
668
  export declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): JSX.Element;