"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.GridState = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _ToolbarCollectionState = require("./ToolbarCollectionState");
var _mobx = require("mobx");
class GridState {
  constructor(params) {
    (0, _defineProperty2.default)(this, "toolbar", void 0);
    (0, _defineProperty2.default)(this, "container", void 0);
    (0, _defineProperty2.default)(this, "collection", void 0);
    (0, _defineProperty2.default)(this, "_subGrids", []);
    (0, _defineProperty2.default)(this, "_sizePreset", undefined);
    (0, _defineProperty2.default)(this, "_sections", void 0);
    (0, _defineProperty2.default)(this, "onAddItemActionComplete", async items => {
      return this.toolbar.onAddItemActionComplete(items);
    });
    this.container = params.container;
    this.collection = params.collection;
    this.toolbar = params.toolbar ?? new _ToolbarCollectionState.ToolbarCollectionState({
      collection: params.collection,
      container: params.container,
      componentType: 'Grid'
    });
    (0, _mobx.makeObservable)(this, {
      _sizePreset: _mobx.observable.ref
    });
  }
  init(params) {
    const disposers = [this.toolbar.init(params)];
    return () => {
      for (const disposer of disposers) {
        disposer();
      }
    };
  }
}
exports.GridState = GridState;
//# sourceMappingURL=GridState.js.map