"use strict";

exports.__esModule = true;
exports.useEditableTableCollection = void 0;
var _react = require("@wix/bex-core/react");
var _EditableTable = require("../state/EditableTable");
var _useOptionalCachedState = require("./useOptionalCachedState");
const useEditableTableCollection = config => {
  const container = (0, _react.useWixPatternsContainer)();
  const createCollection = (0, _react.useCreateCollection)();
  const createOptimisticActions = (0, _react.useCreateOptimisticActions)();
  const state = (0, _useOptionalCachedState.useOptionalCachedState)(() => {
    return new _EditableTable.EditableTableState({
      collection: createCollection(config),
      container,
      permissions: config.permissions,
      mutations: config.mutations,
      fieldActions: config.fieldActions,
      refresh: config.refresh,
      extraCellTypes: config.extraCellTypes,
      createOptimisticActions: collection => createOptimisticActions(collection, config.optimisticActionParams)
    });
  });
  return state;
};
exports.useEditableTableCollection = useEditableTableCollection;
//# sourceMappingURL=useEditableTableCollection.js.map