gantt-renderer
    Preparing search index...

    Function buildTaskTree

    • Builds a typed tree from a flat task array. Order of tasks[] is irrelevant — parents need not precede children.

      Parameters

      • tasks: (
            | {
                color?: string;
                data?: Record<string, unknown>;
                endDate: string;
                id: number;
                kind: "task";
                parent?: number;
                percentComplete: number;
                readonly?: boolean;
                startDate: string;
                text: string;
            }
            | {
                color?: string;
                data?: Record<string, unknown>;
                endDate: string;
                id: number;
                kind: "project";
                open: boolean;
                parent?: number;
                percentComplete: number;
                readonly?: boolean;
                startDate: string;
                text: string;
            }
            | {
                color?: string;
                data?: Record<string, unknown>;
                id: number;
                kind: "milestone";
                parent?: number;
                readonly?: boolean;
                startDate: string;
                text: string;
            }
        )[]

        The flat array of tasks to convert into a tree.

        • {
              color?: string;
              data?: Record<string, unknown>;
              endDate: string;
              id: number;
              kind: "task";
              parent?: number;
              percentComplete: number;
              readonly?: boolean;
              startDate: string;
              text: string;
          }
          • Optionalcolor?: string

            Optional CSS color value for the task bar. Overrides the default color assignment.

          • Optionaldata?: Record<string, unknown>

            Optional arbitrary metadata for consumer use. Preserved in the parsed output.

          • endDate: string

            ISO date: YYYY-MM-DD

          • id: number

            Unique positive integer identifier for the task.

          • kind: "task"
          • Optionalparent?: number

            Optional id of the parent task. When set, this task is a child in the hierarchy.

          • percentComplete: number

            0–100 completion percentage (integer).

          • Optionalreadonly?: boolean

            When true, the task bar cannot be dragged or resized.

          • startDate: string

            ISO date: YYYY-MM-DD

          • text: string

            Display name / label of the task.

        • {
              color?: string;
              data?: Record<string, unknown>;
              endDate: string;
              id: number;
              kind: "project";
              open: boolean;
              parent?: number;
              percentComplete: number;
              readonly?: boolean;
              startDate: string;
              text: string;
          }
          • Optionalcolor?: string

            Optional CSS color value for the task bar. Overrides the default color assignment.

          • Optionaldata?: Record<string, unknown>

            Optional arbitrary metadata for consumer use. Preserved in the parsed output.

          • endDate: string

            ISO date: YYYY-MM-DD

          • id: number

            Unique positive integer identifier for the task.

          • kind: "project"
          • open: boolean

            Initial expanded state for tree hierarchy. When false, children of this task are hidden on initial render.

            true
            
          • Optionalparent?: number

            Optional id of the parent task. When set, this task is a child in the hierarchy.

          • percentComplete: number

            0–100 completion percentage (integer).

          • Optionalreadonly?: boolean

            When true, the task bar cannot be dragged or resized.

          • startDate: string

            ISO date: YYYY-MM-DD

          • text: string

            Display name / label of the task.

        • {
              color?: string;
              data?: Record<string, unknown>;
              id: number;
              kind: "milestone";
              parent?: number;
              readonly?: boolean;
              startDate: string;
              text: string;
          }
          • Optionalcolor?: string

            Optional CSS color value for the task bar. Overrides the default color assignment.

          • Optionaldata?: Record<string, unknown>

            Optional arbitrary metadata for consumer use. Preserved in the parsed output.

          • id: number

            Unique positive integer identifier for the task.

          • kind: "milestone"
          • Optionalparent?: number

            Optional id of the parent task. When set, this task is a child in the hierarchy.

          • Optionalreadonly?: boolean

            When true, the task bar cannot be dragged or resized.

          • startDate: string

            ISO date: YYYY-MM-DD

          • text: string

            Display name / label of the task.

      Returns TaskNode[]

      Root-level TaskNode instances with populated children.

      When a task references a parent id that does not exist, when a parent cycle is detected, or when a parent points to a milestone or leaf task.