mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 07:29:24 +08:00
feat: gantt block code improve
This commit is contained in:
parent
5f35a24899
commit
f19ab3603b
@ -19,7 +19,7 @@ import { HorizontalScroll } from '../other/horizontal-scroll';
|
|||||||
import { removeHiddenTasks, sortTasks } from '../../helpers/other-helper';
|
import { removeHiddenTasks, sortTasks } from '../../helpers/other-helper';
|
||||||
import styles from './gantt.module.css';
|
import styles from './gantt.module.css';
|
||||||
import { GanttToolbarContext } from '../../context';
|
import { GanttToolbarContext } from '../../context';
|
||||||
import { SchemaComponent, SchemaComponentProvider } from '../../../../../schema-component';
|
import { useDesignable } from '../../../../../schema-component';
|
||||||
import { TableBlockProvider, useGanttBlockContext } from '../../../../../block-provider';
|
import { TableBlockProvider, useGanttBlockContext } from '../../../../../block-provider';
|
||||||
import { useProps } from '../../../../hooks/useProps';
|
import { useProps } from '../../../../hooks/useProps';
|
||||||
|
|
||||||
@ -146,8 +146,10 @@ function Toolbar(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
export const Gantt: any = (props) => {
|
export const Gantt: any = (props) => {
|
||||||
|
const { designable } = useDesignable();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
headerHeight = 65,
|
headerHeight = designable?65:55,
|
||||||
columnWidth = 60,
|
columnWidth = 60,
|
||||||
listCellWidth = '155px',
|
listCellWidth = '155px',
|
||||||
rowHeight = 55,
|
rowHeight = 55,
|
||||||
@ -208,14 +210,13 @@ export const Gantt: any = (props) => {
|
|||||||
const taskHeight = useMemo(() => (rowHeight * barFill) / 100, [rowHeight, barFill]);
|
const taskHeight = useMemo(() => (rowHeight * barFill) / 100, [rowHeight, barFill]);
|
||||||
const [selectedTask, setSelectedTask] = useState<BarTask>();
|
const [selectedTask, setSelectedTask] = useState<BarTask>();
|
||||||
const [failedTask, setFailedTask] = useState<BarTask | null>(null);
|
const [failedTask, setFailedTask] = useState<BarTask | null>(null);
|
||||||
|
const ctx = useGanttBlockContext();
|
||||||
const svgWidth = dateSetup.dates.length * columnWidth;
|
const svgWidth = dateSetup.dates.length * columnWidth;
|
||||||
const ganttFullHeight = barTasks.length * rowHeight;
|
const ganttFullHeight = barTasks.length * rowHeight;
|
||||||
|
|
||||||
const [scrollY, setScrollY] = useState(0);
|
const [scrollY, setScrollY] = useState(0);
|
||||||
const [scrollX, setScrollX] = useState(-1);
|
const [scrollX, setScrollX] = useState(-1);
|
||||||
const [ignoreScrollEvent, setIgnoreScrollEvent] = useState(false);
|
const [ignoreScrollEvent, setIgnoreScrollEvent] = useState(false);
|
||||||
console.log(fieldSchema)
|
|
||||||
// task change events
|
// task change events
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let filteredTasks: Task[];
|
let filteredTasks: Task[];
|
||||||
@ -516,7 +517,6 @@ console.log(fieldSchema)
|
|||||||
onClick,
|
onClick,
|
||||||
onDelete,
|
onDelete,
|
||||||
};
|
};
|
||||||
const ctx = useGanttBlockContext();
|
|
||||||
|
|
||||||
// const tableProps: TaskListProps = {
|
// const tableProps: TaskListProps = {
|
||||||
// rowHeight,
|
// rowHeight,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user