"use strict";

exports.__esModule = true;
exports.useOrFolderActionCellColumn = useOrFolderActionCellColumn;
var _ActionCell = require("../ActionCell");
var _react = require("react");
var _state = require("../../state");
function useOrFolderActionCellColumn(params) {
  const {
    state: {
      items,
      folders
    },
    actionCell,
    folderActionCell,
    actionCellProps,
    actionCellWidth
  } = params;
  const baseColumn = (0, _ActionCell.useActionCellColumnBase)({
    actionCellProps,
    actionCellWidth
  });
  const renderItem = (0, _ActionCell.useRenderActionCellColumn)({
    actionCell,
    sticky: true,
    collection: items
  });
  const renderFolder = (0, _ActionCell.useRenderActionCellColumn)({
    actionCell: folderActionCell,
    sticky: true,
    collection: folders
  });
  return (0, _react.useMemo)(() => {
    if (renderItem == null && renderFolder == null) {
      return null;
    }
    return {
      ...baseColumn,
      render: (keyedItem, rowNum) => {
        if ((0, _state.isItemKeyedItem)(keyedItem)) {
          return renderItem == null ? void 0 : renderItem(keyedItem.item.originalKeyedItem, rowNum);
        }
        if ((0, _state.isFolderKeyedItem)(keyedItem)) {
          return renderFolder == null ? void 0 : renderFolder(keyedItem.item.originalKeyedItem, rowNum);
        }
        return null;
      }
    };
  }, [baseColumn, renderItem, renderFolder]);
}
//# sourceMappingURL=useOrFolderActionCellColumn.js.map