import React, { Component, HTMLAttributes } from 'react';
import { ReactListProps } from '@jswork/react-list';
import * as _jswork_event_mitt from '@jswork/event-mitt';
import { EventMittNamespace } from '@jswork/event-mitt';

type OnChangeCallbackOptions = {
    name?: string;
    options: any;
    action: string;
    payload?: any;
    oldValue: any[];
    newValue: any[];
    [key: string]: any;
};
type StdCallback = (value: any) => void;
type OnChangeCallback = (value: any, options?: OnChangeCallbackOptions) => void;
type RemoveOptions = number | {
    index: number;
    action: string;
    payload?: any;
};
type NotifyOptions = {
    action: string;
    payload?: any;
};
type UpdateOptions = {
    index: number;
    item: any;
    action: string;
    payload?: any;
};
type ReactInteractiveListProps = {
    /**
     * The extended className for component.
     * @default ''
     */
    className?: string;
    /**
     * The identity name.
     * @default '@'
     */
    name?: string;
    /**
     * The initial size.
     * @default 0
     */
    initial?: number;
    /**
     * The minimum size.
     * @default 0
     */
    min: number;
    /**
     * The max size.
     * @default 100
     */
    max: number;
    /**
     * The data source.
     * @default []
     */
    value: any[];
    /**
     * Whether use jsx template.
     * @default false
     */
    hookable?: boolean;
    /**
     * The data item template.
     * @default null
     */
    template: ReactListProps['template'];
    /**
     * The empty template.
     * @default null
     */
    templateEmpty?: ReactListProps['templateEmpty'];
    /**
     * The extra options for template function.
     * @default null
     */
    options?: any;
    /**
     * The empty create template.
     * @default null
     */
    defaults: () => any;
    /**
     * The change handler.
     * @default null
     */
    onChange?: OnChangeCallback;
    /**
     * When trigger max/min boundary.
     * @default null
     */
    onError?: StdCallback;
    /**
     * Forwards a ref to the underlying div element.
     * @default null
     */
    forwardedRef?: any;
    /**
     * The props for react-list.
     * @default null
     */
    listProps?: ReactListProps;
} & HTMLAttributes<HTMLDivElement>;
interface ReactInteractiveListState {
    value: any[];
}
declare class ReactInteractiveList extends Component<ReactInteractiveListProps, ReactInteractiveListState> {
    private harmonyEvents;
    static displayName: string;
    static event: EventMittNamespace.EventMitt;
    static events: string[];
    static defaultProps: {
        name: string;
        initial: number;
        min: number;
        max: number;
        value: never[];
    };
    eventBus: EventMittNamespace.EventMitt;
    private currentAction;
    private currentPayload;
    get emptyArgs(): {
        options: any;
        items: never[];
        item: null;
        index: number;
    };
    get length(): number;
    get stateValue(): any[];
    get isLteMin(): boolean;
    get isGteMax(): boolean;
    get listView(): React.JSX.Element;
    constructor(inProps: ReactInteractiveListProps);
    private checkInitial;
    add: () => void;
    remove: (options: RemoveOptions) => void;
    update: (options: UpdateOptions) => void;
    set: (inValue: any[]) => void;
    up: (inIndex: number) => void;
    down: (inIndex: number) => void;
    top: (index: number) => void;
    bottom: (index: number) => void;
    clear: () => void;
    notify: (options?: NotifyOptions) => void;
    componentDidUpdate(): void;
    componentDidMount(): void;
    componentWillUnmount(): void;
    template: ({ item, index }: {
        item: any;
        index: any;
    }) => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
    templateEmpty: () => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
    handleChange: (inValue: any[]) => void;
    render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
}

declare const useCommand: (inName?: string) => {
    listen: (cmd: string, callback: any) => _jswork_event_mitt.EventMittNamespace.EventListener;
    add: () => void;
    remove: (opts: RemoveOptions) => void;
    notify: (opts?: NotifyOptions) => void;
    update: (opts: UpdateOptions) => void;
    set: (items: any[]) => void;
    up: (index: number) => void;
    down: (index: number) => void;
    clear: () => void;
    top: (index: number) => void;
    bottom: (index: number) => void;
};

declare const _default: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;

export { ReactInteractiveList, _default as default, useCommand };
