@brizy/media-gallery
Version:
73 lines (72 loc) • 4.74 kB
TypeScript
import { Base, GenericState } from "~/redux/types/state/Base";
import { Item } from "./types";
import { InsertFilesTypes } from "~/types/Context";
export declare enum Types {
Init = "page:project:stockPhotos:init",
LoadError = "page:project:stockPhotos:loadError",
Ready = "page:project:stockPhotos:ready",
NothingSelected = "page:project:stockPhotos:nothingSelected",
BulkSelectReady = "page:project:stockPhotos:bulkSelectReady",
BulkSelectNothing = "page:project:stockPhotos:bulkSelectNothing",
BulkSelectMultiple = "page:project:stockPhotos:bulkSelectMultipleSelected",
InsertFromReady = "page:project:stockPhotos:insertFromReady",
InsertFromBulkSelectReady = "page:project:stockPhotos:insertFromBulkSelectReady",
InsertFromBulkSelectMultiple = "page:project:stockPhotos:insertFromBulkSelectMultiple"
}
interface InitPayload {
page: number;
search: string;
height: string | undefined;
insertFilesType: InsertFilesTypes;
}
export type Init = Base<Types.Init> & InitPayload;
export declare const init: ({ page, search, height, insertFilesType }: InitPayload) => Init;
export declare const isInit: (s: State) => s is Init;
interface LoadErrorPayload extends InitPayload {
message: string;
}
export type LoadError = Base<Types.LoadError> & LoadErrorPayload;
export declare const loadError: ({ message, page, search, height, insertFilesType }: LoadErrorPayload) => LoadError;
export declare const isLoadError: (s: State) => s is LoadError;
interface ReadyPayload extends Omit<InitPayload, "isFirstSelected"> {
items: Item[];
isLastPage: boolean;
selectedItem: Item;
newSearch: string;
}
export interface Ready extends Base<Types.Ready>, ReadyPayload {
}
export declare const ready: ({ page, search, height, insertFilesType, items, isLastPage, newSearch, selectedItem, }: ReadyPayload) => Ready;
export declare const isReady: (s: State) => s is Ready;
export interface InsertFromReady extends Base<Types.InsertFromReady>, ReadyPayload {
}
export declare const insertFromReady: ({ page, search, height, insertFilesType, items, isLastPage, selectedItem, newSearch, }: ReadyPayload) => InsertFromReady;
export declare const isInsertFromReady: (s: State) => s is InsertFromReady;
export interface BulkSelectReady extends Base<Types.BulkSelectReady>, ReadyPayload {
}
export declare const bulkSelectReady: ({ page, search, height, insertFilesType, items, isLastPage, selectedItem, newSearch, }: ReadyPayload) => BulkSelectReady;
export declare const isBulkSelectReady: (s: State) => s is BulkSelectReady;
export interface InsertFromBulkSelectReady extends Base<Types.InsertFromBulkSelectReady>, ReadyPayload {
}
export declare const insertFromBulkSelectReady: ({ page, search, height, insertFilesType, items, isLastPage, selectedItem, newSearch, }: ReadyPayload) => InsertFromBulkSelectReady;
export declare const isInsertFromBulkSelectReady: (s: State) => s is InsertFromBulkSelectReady;
type NothingOrMultiplePayload = Omit<ReadyPayload, "selectedItem">;
export interface NothingSelected extends Base<Types.NothingSelected>, NothingOrMultiplePayload {
}
export declare const nothingSelected: ({ page, search, height, insertFilesType, items, isLastPage, newSearch, }: NothingOrMultiplePayload) => NothingSelected;
export declare const isNothingSelected: (s: State) => s is NothingSelected;
export interface BulkSelectNothing extends Base<Types.BulkSelectNothing>, NothingOrMultiplePayload {
}
export declare const bulkSelectNothing: ({ page, search, height, insertFilesType, items, isLastPage, newSearch, }: NothingOrMultiplePayload) => BulkSelectNothing;
export declare const isBulkSelectNothing: (s: State) => s is BulkSelectNothing;
export interface BulkSelectMultiple extends Base<Types.BulkSelectMultiple>, NothingOrMultiplePayload {
}
export declare const bulkSelectMultiple: ({ page, search, height, insertFilesType, items, isLastPage, newSearch, }: NothingOrMultiplePayload) => BulkSelectMultiple;
export declare const isBulkSelectMultiple: (s: State) => s is BulkSelectMultiple;
export interface InsertFromBulkSelectMultiple extends Base<Types.InsertFromBulkSelectMultiple>, NothingOrMultiplePayload {
}
export declare const insertFromBulkSelectMultiple: ({ page, search, height, insertFilesType, items, isLastPage, newSearch, }: NothingOrMultiplePayload) => InsertFromBulkSelectMultiple;
export declare const isInsertFromBulkSelectMultiple: (s: State) => s is InsertFromBulkSelectMultiple;
export type State = Init | LoadError | Ready | NothingSelected | BulkSelectReady | BulkSelectNothing | BulkSelectMultiple | InsertFromReady | InsertFromBulkSelectReady | InsertFromBulkSelectMultiple;
export declare const isState: (s: GenericState) => s is State;
export {};