mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 07:29:24 +08:00
feat: table actions suport config
This commit is contained in:
parent
8b44a3b762
commit
71aeeee6b4
@ -1,5 +1,5 @@
|
|||||||
import { ArrayField } from '@formily/core';
|
|
||||||
import { useField } from '@formily/react';
|
import { useField } from '@formily/react';
|
||||||
|
import { Spin } from 'antd';
|
||||||
import React, { createContext, useContext, useEffect, useState } from 'react';
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||||
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ export function mockTasks() {
|
|||||||
return tasks;
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatData = (data = [], fieldNames, tasks = [], projectId = undefined) => {
|
const formatData = (data = [], fieldNames, tasks: any[] = [], projectId: any = undefined) => {
|
||||||
data.forEach((item) => {
|
data.forEach((item: any) => {
|
||||||
if (item.children && item.children.length) {
|
if (item.children && item.children.length) {
|
||||||
tasks.push({
|
tasks.push({
|
||||||
start: new Date(item[fieldNames.start]),
|
start: new Date(item[fieldNames.start]),
|
||||||
@ -103,12 +103,12 @@ const formatData = (data = [], fieldNames, tasks = [], projectId = undefined) =>
|
|||||||
return tasks;
|
return tasks;
|
||||||
};
|
};
|
||||||
const InternalGanttBlockProvider = (props) => {
|
const InternalGanttBlockProvider = (props) => {
|
||||||
const { fieldNames, timeRange } = props;
|
const { fieldNames, timeRange, resource } = props;
|
||||||
const field = useField();
|
const field = useField();
|
||||||
const { resource, service } = useBlockRequestContext();
|
const { service } = useBlockRequestContext();
|
||||||
// if (service.loading) {
|
if (service.loading) {
|
||||||
// return <Spin />;
|
return <Spin />;
|
||||||
// }
|
}
|
||||||
return (
|
return (
|
||||||
<GanttBlockContext.Provider
|
<GanttBlockContext.Provider
|
||||||
value={{
|
value={{
|
||||||
@ -125,6 +125,7 @@ const InternalGanttBlockProvider = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const GanttBlockProvider = (props) => {
|
export const GanttBlockProvider = (props) => {
|
||||||
|
console.log(props);
|
||||||
return (
|
return (
|
||||||
<BlockProvider {...props} params={{ ...props.params, paginate: false }}>
|
<BlockProvider {...props} params={{ ...props.params, paginate: false }}>
|
||||||
<InternalGanttBlockProvider {...props} />
|
<InternalGanttBlockProvider {...props} />
|
||||||
@ -138,9 +139,9 @@ export const useGanttBlockContext = () => {
|
|||||||
|
|
||||||
export const useGanttBlockProps = () => {
|
export const useGanttBlockProps = () => {
|
||||||
const ctx = useGanttBlockContext();
|
const ctx = useGanttBlockContext();
|
||||||
const [tasks, setTasks] = useState([]);
|
const [tasks, setTasks] = useState<any>([]);
|
||||||
const onExpanderClick = (task: any) => {
|
const onExpanderClick = (task: any) => {
|
||||||
setTasks(tasks.map((t) => (t.id === task.id ? task : t)));
|
setTasks(tasks.map((t: any) => (t.id === task.id ? task : t)));
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ctx?.service?.loading) {
|
if (!ctx?.service?.loading) {
|
||||||
|
@ -70,7 +70,6 @@ export const GridBody: React.FC<GridBodyProps> = ({
|
|||||||
}
|
}
|
||||||
tickX += columnWidth;
|
tickX += columnWidth;
|
||||||
}
|
}
|
||||||
console.log(gridRows, rowLines, ticks, today);
|
|
||||||
return (
|
return (
|
||||||
<g className="gridBody">
|
<g className="gridBody">
|
||||||
<g className="rows">{gridRows}</g>
|
<g className="rows">{gridRows}</g>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user