+ {selectedColumns.map((colName, index) => {
+ const col = columnsData.find(c => c.name === colName);
+ return (
+
{
+ e.dataTransfer.setData('index', String(index));
+ }}
+ onDragOver={(e) => {
+ e.preventDefault();
+ }}
+ onDrop={(e) => {
+ const fromIndex = parseInt(e.dataTransfer.getData('index'));
+ const toIndex = index;
+ if (fromIndex !== toIndex) {
+ const newSelected = [...selectedColumns];
+ const [removed] = newSelected.splice(fromIndex, 1);
+ newSelected.splice(toIndex, 0, removed);
+ setSelectedColumns(newSelected);
+ }
+ }}
+ >
+ {col?.description || colName}
+
+ {index + 1}
+
+
+ );
+ })}
+