'use strict';
import { jsx } from 'react/jsx-runtime';
import { BrowserDialog } from '../../../browsers/browser/browser-dialog/BrowserDialog.js';
import { TableHeaderActionButton } from '../../../table/header-cell/TableHeaderCellActionButton.js';
import { iconNames } from '../../../../fd-component-toolbox/icon/Icon.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function ManyToOneTableHeaderCellTemplate({
  parentResourcePropertyMeta,
  resourceId,
  multiListItem,
  onViewMultiListRelationChange,
  onCustomAction
}) {
  return /* @__PURE__ */jsx(BrowserDialog, {
    propertyMeta: parentResourcePropertyMeta,
    currentResourceId: resourceId,
    closeDialog: newRelatedResource => newRelatedResource?.id && (onViewMultiListRelationChange(multiListItem, newRelatedResource), onCustomAction()),
    trigger: /* @__PURE__ */jsx(TableHeaderActionButton, {
      tooltipText: "Change",
      icon: iconNames.link
    })
  });
}
__name(ManyToOneTableHeaderCellTemplate, "ManyToOneTableHeaderCellTemplate");

export { ManyToOneTableHeaderCellTemplate };
