Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/ui / dist / state / SelectionState.d.ts
Size: Mime:
export interface SelectableItemAction {
    (item: SelectableItem): void;
    isMobxAction?: boolean;
}
export interface SelectableListAction {
    (list: SelectableList): void;
    isMobxAction?: boolean;
}
export declare type SelectableList = Array<SelectableItem>;
export interface SelectableListProps {
    list: SelectableList;
    onChange?: SelectableItemOnClick;
    readonly ref?: any;
}
export interface DecorateItem {
    (item: SelectableItem, index?: number): void;
}
export interface SelectableState {
    list: SelectableItem[];
    isVisible: boolean;
    selectItem: SelectableItemAction;
    unselectItem: SelectableItemAction;
    unselectList: SelectableListAction;
    decorateItem: DecorateItem;
    handleToggleVisibility(): void;
}
export interface SelectableItemOnClick {
    (event: Event, item: SelectableItem, state: SelectableState): void;
    isMobxAction?: boolean;
    isDecorated?: boolean;
}
export interface SelectableItem {
    isSelected?: boolean;
    isDisabled?: boolean;
    identifier?: string;
    label?: string;
    value?: any;
    onClick?: SelectableItemOnClick;
}
/**
 * @todo belongs in deps...
 */
export declare const isSatisfiedByIsSelected: (item: any) => any;
/**
 * props | props.list | props.options | []
 */
export declare const toList: (props: SelectableListProps) => SelectableItem[];
/**
 * optimizations...
 */
export declare const isDecorated: (item: SelectableItem) => boolean;
export declare const isEveryItemInListDecoratedWithOnClick: (props: SelectableListProps) => boolean;
/**
 * This way we can provide the selction state in a list
 */
declare class SelectionState implements SelectableState {
    list: SelectableList;
    isVisible: boolean;
    props: SelectableListProps;
    /**
     * @todo @name toggleIsVisible
     */
    handleToggleVisibility(): void;
    setIsVisible(isVisible: boolean): void;
    /**
     * This function selects the particular item
     */
    selectItem(item: SelectableItem): void;
    /**
     * This function deSelects the item in the array list
     *
     * .bound because @see this.unselectList
     */
    unselectItem(item: SelectableItem): void;
    /**
     * This function loops the items in the array list
     */
    unselectList(list: SelectableList): void;
    /**
     * here we set properties on each item so we can handle each click
     */
    decorateItem(item: SelectableItem, index?: number): void;
    readonly selectedItem: SelectableItem | undefined;
    /**
     * was named unSelectedListWithSelectedItem
     */
    decorateWithProps(props: SelectableListProps): void;
}
declare function toSelectionState(props: SelectableListProps): SelectionState;
export { SelectionState, toSelectionState };
export default SelectionState;