"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.makeOrderFieldTransform = makeOrderFieldTransform;
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
var _utils = require("../utils");
var _warnTransformsDeprecated = require("./warnTransformsDeprecated");
/** @deprecated transform 用法已经过时，请使用 pipeline 来对表格进行拓展 */
function makeOrderFieldTransform() {
  var startOrder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  (0, _warnTransformsDeprecated.warnTransformsDeprecated)('makeOrderFieldTransform');
  return (0, _utils.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 (0, _extends2.default)((0, _extends2.default)({}, column), {
        getValue: function getValue(record, index) {
          return index + startOrder;
        }
      });
    }
    return column;
  });
}