"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = useDataSet;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));

var _react = require("react");

var _dataset = _interopRequireDefault(require("choerodon-ui/dataset"));

var _useConfig = _interopRequireDefault(require("../../../lib/use-config"));

function useDataSet(factory, deps) {
  var context = (0, _useConfig["default"])();
  var getLocalConfig = context.getConfig;
  return (0, _react.useMemo)(function () {
    return new _dataset["default"](factory(), {
      getConfig: getLocalConfig
    });
  }, deps ? [getLocalConfig].concat((0, _toConsumableArray2["default"])(deps)) : [getLocalConfig]);
}
//# sourceMappingURL=index.js.map
