"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.makeVisibleTransform = makeVisibleTransform;

var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));

var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));

var _utils = require("../utils");

var _warnTransformsDeprecated = require("./warnTransformsDeprecated");

/** @deprecated transform 用法已经过时，请使用 pipeline 来对表格进行拓展 */
function makeVisibleTransform(visibleCodes) {
  (0, _warnTransformsDeprecated.warnTransformsDeprecated)('makeVisibleTransform');
  var set = new _set.default(visibleCodes);
  return (0, _utils.traverseColumn)(function (column) {
    if (!(0, _utils.isLeafNode)(column)) {
      return column;
    }

    return set.has(column.code) ? column : (0, _extends2.default)((0, _extends2.default)({}, column), {
      hidden: true
    });
  });
}