import { ToolbarCollectionState, } from './ToolbarCollectionState';
import { makeObservable, observable } from 'mobx';
export class GridState {
    constructor(params) {
        this._subGrids = [];
        this._sizePreset = undefined;
        this.onAddItemActionComplete = async (items) => {
            return this.toolbar.onAddItemActionComplete(items);
        };
        this.container = params.container;
        this.collection = params.collection;
        this.toolbar =
            params.toolbar ??
                new ToolbarCollectionState({
                    collection: params.collection,
                    container: params.container,
                    componentType: 'Grid',
                });
        makeObservable(this, {
            _sizePreset: observable.ref,
        });
    }
    init(params) {
        const disposers = [this.toolbar.init(params)];
        return () => {
            for (const disposer of disposers) {
                disposer();
            }
        };
    }
}
//# sourceMappingURL=GridState.js.map