import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
import _extends from "@babel/runtime-corejs3/helpers/extends";
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
export var footerRowMetaSymbol = _Symbol('footer-row');
export function footerDataSource() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  return function footerDataSourceStep(pipeline) {
    var _a, _b;
    var footerDataSource = (_a = opts.dataSource) !== null && _a !== void 0 ? _a : pipeline.getFooterDataSource();
    var footerRowMetaKey = (_b = opts.footerRowMetaKey) !== null && _b !== void 0 ? _b : footerRowMetaSymbol;
    pipeline.setFeatureOptions('footerRowMetaKey', footerRowMetaKey);
    if (footerDataSource) {
      pipeline.footerDataSource(_mapInstanceProperty(footerDataSource).call(footerDataSource, function (row) {
        return _extends(_defineProperty({}, footerRowMetaKey, true), row);
      }));
    } else {
      console.warn('调用 pipeline.use(features.footerDataSource()) 前请先设置页脚数据源，设置方法有：pipeline.use(features.footerDataSource({dataSource:any[]})) 或者 pipeline.footerDataSource(any[])');
    }
    return pipeline;
  };
}