UNPKG

geostyler

Version:
35 lines (34 loc) 982 B
import { jsx as o } from "react/jsx-runtime"; import { createElement as c } from "react"; import { HolderOutlined as d } from "@ant-design/icons"; import { useSortable as b } from "@dnd-kit/sortable"; import { CSS as p } from "@dnd-kit/utilities"; const x = ({ "data-row-key": r, children: e, ...i }) => { const { attributes: n, listeners: s, transform: a, transition: m, setNodeRef: f, setActivatorNodeRef: l, isDragging: t } = b({ id: r }), g = { transform: p.Transform.toString(a), transition: m, backgroundColor: "white", // the currently dragged element must be visually above the other ones ...t ? { position: "relative", zIndex: 9999 } : {} }; return /* @__PURE__ */ c("tr", { ...i, key: r, ref: f, ...n, style: g }, /* @__PURE__ */ o( "td", { ref: l, ...s, style: { cursor: t ? "grabbing" : "grab" }, children: /* @__PURE__ */ o(d, {}) } ), e); }; export { x as DraggableRow };