import { ChooserColumn } from "../../../data/setting"; import FactoryRenderer from "../../../../../Renderer"; type DragDropContainer = { column: ChooserColumn; excludeIncludeToCard: (id: number) => void; toggleFreeze: (id: number) => void; onFieldAddOrRemove: (id: number) => void; }; const DragDropContainer = ({ column, excludeIncludeToCard, toggleFreeze, onFieldAddOrRemove, }: DragDropContainer) => { return (
{/* Deliberately NOT the ICON widget: that widget renders a Kendo
is not // associated with it — Kendo's own `label` prop used to do this, so // without it the caption text stops toggling the box and the input // loses its accessible name. widgetStyle={{ id: `include-card-${column.id}`, className: "tmpl-include-card tmpl-checkbox", }} label={{ position: "right", title: "Include in card", isApply: true, htmlFor: `include-card-${column.id}`, }} value={column.includeInCard} // The widget relays (callBack, screenDataField, value, event), not a // DOM event; the id is closed over, so no relayed arg is needed. onChange={() => { excludeIncludeToCard(column.id); }} /> {/* `toggleFreeze` is a BOUNDARY setter — it freezes every row up to the clicked one and unfreezes the rest — so it must run even when the radio is already checked (e.g. shrinking the frozen range by clicking the topmost frozen row). A controlled radio fires no change event in that case, so the trigger stays a click on the wrapper, reproducing the original Kendo `onClick` semantics. */}
toggleFreeze(column.id)}>
{column.primary !== true ? ( { if (column.primary !== true) { onFieldAddOrRemove(column.id); } }} /> ) : (
); }; export default DragDropContainer;