import _extends from "@babel/runtime-corejs3/helpers/extends";
import { traverseColumn } from '../utils';
import { warnTransformsDeprecated } from './warnTransformsDeprecated';
/** @deprecated transform 用法已经过时，请使用 pipeline 来对表格进行拓展 */

export function makeOrderFieldTransform() {
  var startOrder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  warnTransformsDeprecated('makeOrderFieldTransform');
  return traverseColumn(function (column) {
    var _a, _b;

    if (((_a = column.features) === null || _a === void 0 ? void 0 : _a.order) || ((_b = column.features) === null || _b === void 0 ? void 0 : _b.orderField)) {
      return _extends(_extends({}, column), {
        getValue: function getValue(record, index) {
          return index + startOrder;
        }
      });
    }

    return column;
  });
}