import _objectSpread from "@babel/runtime/helpers/objectSpread2";
// @ts-ignore
export function addEvent(el, event, handler, inputOptions) {
  if (!el) return;

  var options = _objectSpread({
    capture: true
  }, inputOptions);

  if (el.addEventListener) {
    el.addEventListener(event, handler, options);
  } else if (el.attachEvent) {
    el.attachEvent('on' + event, handler);
  } else {
    // $FlowIgnore: Doesn't think elements are indexable
    el['on' + event] = handler;
  }
}
export function removeEvent(el, event, handler, inputOptions) {
  if (!el) return;

  var options = _objectSpread({
    capture: true
  }, inputOptions);

  if (el.removeEventListener) {
    el.removeEventListener(event, handler, options);
  } else if (el.detachEvent) {
    el.detachEvent('on' + event, handler);
  } else {
    // $FlowIgnore: Doesn't think elements are indexable
    el['on' + event] = null;
  }
}
export function findHiddenKeys(children, columns) {
  var hiddenColumnKeys = [];

  if (children && children.length) {
    Array.from(children).map(function (child) {
      if (child.props && child.props.hidden) {
        var columnChildren = child.props.children;
        hiddenColumnKeys.push(columnChildren[1].props.dataKey);
      }
    });
  }

  if (columns && columns.length) {
    Array.from(columns).map(function (child) {
      if (child && child.hidden) {
        hiddenColumnKeys.push(child.dataIndex);
      }
    });
  }

  return hiddenColumnKeys;
}
export function getColumnKey(_ref) {
  var dataIndex = _ref.dataIndex,
      key = _ref.key;
  return key || dataIndex;
}
export function getColumnFixed(fixed) {
  if (fixed === true) {
    return 'left';
  }

  if (fixed) {
    return fixed;
  }

  return false;
}
//# sourceMappingURL=domFns.js.map
