37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import * as React from "react";
|
|
import { ColumnProps } from "primereact/column";
|
|
import { IColumn } from "./IColumn";
|
|
import IGetColumnPropsArgs from "./IGetColumnPropsArgs";
|
|
|
|
export interface IDragDropColumnProps {
|
|
/** Fix the column while scrolling horizontally */
|
|
frozen?: boolean;
|
|
}
|
|
|
|
export const DragDropColumnClassName = "p-datatable-drag-drop-cell";
|
|
|
|
/**
|
|
* @beta
|
|
*/
|
|
const DragDropColumn: React.FC<IDragDropColumnProps> & IColumn = (props: IDragDropColumnProps) => {
|
|
// Note this class is only for intellisense with typescript.
|
|
// The column component for a datagrid is never rendered. It is only used to propagate props.
|
|
// Component lifecycle and constructor will never be called.
|
|
// Don't put any logic here. It will never be called.
|
|
|
|
// In case you didn't read above, DO NOT PUT ANY LOGIC HERE.
|
|
return null;
|
|
}
|
|
|
|
DragDropColumn.className = "DragDropColumn";
|
|
|
|
DragDropColumn.getColumnProps = (args: IGetColumnPropsArgs): ColumnProps => {
|
|
|
|
return {
|
|
frozen: args.props.frozen,
|
|
className: DragDropColumnClassName,
|
|
rowReorder: true
|
|
}
|
|
}
|
|
|
|
export default DragDropColumn; |