# Gantt Task Editor Dialog
URL: https://pro.rv-grid.com/api/gantt-task-editor-dialog/
Source: src/content/docs/api/gantt-task-editor-dialog.md
## Module Extensions

### `HTMLRevoGridElement` (Extended from `global`)

```ts
interface HTMLRevoGridElement {
  ganttTaskEditorDialog?: GanttTaskEditorDialogOptions;
  'gantt-task-editor-dialog'?: GanttTaskEditorDialogOptions
}
```

## Plugin API

### `DependencyEditor`

```ts
export function DependencyEditor(;
```

---

### `DependencyEditorProps`

```ts
interface DependencyEditorProps {
  readonly direction: 'predecessors' | 'successors';
  readonly task: TaskEntity | null;
  readonly tasks: readonly TaskEntity[];
  readonly drafts: readonly GanttTaskEditorDialogDependencyDraft[];
  readonly localeText: GanttTaskEditorDialogLocaleText;
  readonly onChange: (drafts: readonly GanttTaskEditorDialogDependencyDraft[]) => void
}
```

---

### `FieldControl`

```ts
export function FieldControl(;
```

---

### `ResourceSelection`

```ts
interface ResourceSelection {
  readonly resources: readonly ResourceEntity[];
  readonly selectedResourceIds: readonly ResourceId[];
  readonly onChange: (resourceIds: readonly ResourceId[]) => void
}
```

---

### `FieldControlProps`

```ts
interface FieldControlProps {
  readonly field: TaskEditorFieldSchema;
  readonly values: TaskEditorFormValues;
  readonly localeText: GanttTaskEditorDialogLocaleText;
  readonly dateFormatProject?: GanttPluginConfig | null;
  readonly dateTimeEnabled?: boolean;
  readonly resourceSelection?: ResourceSelection;
  readonly onChange: (values: TaskEditorFormValues) => void;
  readonly onDateTimeToggle?: (enabled: boolean) => void
}
```

---

### `TaskEditorTabId`

```ts
export type TaskEditorTabId = 'details' | 'advanced' | 'predecessors' | 'successors' | 'assignments';
```

---

### `DETAIL_FIELDS`

```ts
DETAIL_FIELDS: readonly TaskEditorFieldId[];
```

---

### `ADVANCED_FIELDS`

```ts
ADVANCED_FIELDS: readonly TaskEditorFieldId[];
```

---

### `ASSIGNMENT_FIELDS`

```ts
ASSIGNMENT_FIELDS: readonly TaskEditorFieldId[];
```

---

### `DEFAULT_FIELDS`

```ts
DEFAULT_FIELDS: readonly TaskEditorFieldId[];
```

---

### `TAB_LABELS`

```ts
TAB_LABELS: {
  details: string;
  advanced: string;
  predecessors: string;
  successors: string;
  assignments: string;
};
```

---

### `DEPENDENCY_TYPE_OPTIONS`

```ts
DEPENDENCY_TYPE_OPTIONS: readonly { readonly label: string; readonly value: DependencyType; }[];
```

---

### `createTaskEditorDialogLocaleText`

```ts
export function createTaskEditorDialogLocaleText(
  localeText: GanttTaskEditorDialogLocaleTextOptions | undefined,
): GanttTaskEditorDialogLocaleText;
```

---

### `DEFAULT_TASK_EDITOR_DIALOG_LOCALE_TEXT`

```ts
DEFAULT_TASK_EDITOR_DIALOG_LOCALE_TEXT: {
  title: string;
  description: string;
  fallbackTaskTitle: string;
  closeLabel: string;
  closeButtonText: string;
  applyLabel: string;
  resetLabel: string;
  menuItemName: string;
  tabListAriaLabel: string;
  readOnlyLabel: string;
  noResourcesAvailable: string;
  noAssignedResources: string;
  assignedResourcesAriaLabel: string;
  projectDefaultOption: string;
  noConstraintOption: string;
  timeToggleLabel: string;
  switchOnLabel: string;
  switchOffLabel: string;
  manualSchedulingOnLabel: string;
  manualSchedulingOffLabel: string;
  dependencyTargetLabel: { predecessors: string; successors: string; };
  dependencyEmptyLabel: { predecessors: string; successors: string; };
  dependencySearch: { predecessors: { placeholder: string; ariaLabel: string; empty: string; }; successors: { placeholder: string; ariaLabel: string; empty: string; }; };
  resourcesSearch: { placeholder: string; ariaLabel: string; empty: string; };
  dependencyTypeLabel: string;
  dependencyLagDaysLabel: string;
  removeDependencyLabel: (targetLabel: string) => string;
  removeDependencyButton: string;
  addDependencyButton: { predecessors: string; successors: string; };
  tabs: { details: string; advanced: string; predecessors: string; successors: string; assignments: string; };
  dependencyTypes: { 'finish-to-start': string; 'start-to-start': string; 'finish-to-finish': string; 'start-to-finish': string; };
  fields: Partial<Record<TaskEditorFieldId, string>>;
  fieldOptions: Partial<Record<TaskEditorFieldId, readonly TaskEditorFieldOption<string>[]>>;
  status: { ready: string; closed: string; changesSaved: string; noChangesToSave: string; readOnlyProject: string; fixValidationErrors: string; saveFailed: string; };
  validation: { checkRequiredFields: string; couldNotSave: string; fieldError: (error: TaskEditorSubmitError) => string; resourceNotFound: (resourceId: string) => string; taskCannotDependOnItself: string; predecessorTaskNotFound: (taskId: string) => string; successorTaskNotFound: (taskId: string) => string; dependencyMustIncludeCurrentTask: string; duplicateDependencyLinks: string; };
};
```

---

### `GanttTaskEditorDialog`

```ts
export function GanttTaskEditorDialog(;
```

---

### `GanttTaskEditorDialogSubmitContext`

```ts
interface GanttTaskEditorDialogSubmitContext {
  readonly grid: HTMLRevoGridElement;
  readonly task: TaskEntity;
  readonly values: TaskEditorFormValues;
  readonly result: TaskEditorSubmitSuccess;
  readonly assignmentResourceIds: readonly ResourceId[];
  readonly assignments: readonly AssignmentEntity[];
  readonly assignmentsChanged: boolean;
  readonly dependencyDrafts: readonly GanttTaskEditorDialogDependencyDraft[];
  readonly dependencies: readonly DependencyEntity[];
  readonly dependenciesChanged: boolean
}
```

---

### `GanttTaskEditorDialogResourcesOptions`

```ts
interface GanttTaskEditorDialogResourcesOptions {
  readonly editable?: boolean;
  readonly defaultAllocationUnits?: number;
  readonly defaultResponsibility?: string
}
```

---

### `GanttTaskEditorDialogDependencyDraft`

```ts
interface GanttTaskEditorDialogDependencyDraft {
  readonly id?: DependencyId;
  readonly predecessorTaskId: TaskId | '';
  readonly successorTaskId: TaskId | '';
  readonly type: DependencyType;
  readonly lagDays: number
}
```

---

### `GanttTaskEditorDialogSearchText`

```ts
interface GanttTaskEditorDialogSearchText {
  readonly placeholder: string;
  readonly ariaLabel: string;
  readonly empty: string
}
```

---

### `GanttTaskEditorDialogStatusText`

```ts
interface GanttTaskEditorDialogStatusText {
  readonly ready: string;
  readonly closed: string;
  readonly changesSaved: string;
  readonly noChangesToSave: string;
  readonly readOnlyProject: string;
  readonly fixValidationErrors: string;
  readonly saveFailed: string
}
```

---

### `GanttTaskEditorDialogValidationText`

```ts
interface GanttTaskEditorDialogValidationText {
  readonly checkRequiredFields: string;
  readonly couldNotSave: string;
  readonly fieldError: (error: TaskEditorSubmitError, fieldLabel: string) => string;
  readonly resourceNotFound: (resourceId: ResourceId) => string;
  readonly taskCannotDependOnItself: string;
  readonly predecessorTaskNotFound: (taskId: TaskId) => string;
  readonly successorTaskNotFound: (taskId: TaskId) => string;
  readonly dependencyMustIncludeCurrentTask: string;
  readonly duplicateDependencyLinks: string
}
```

---

### `GanttTaskEditorDialogLocaleText`

```ts
interface GanttTaskEditorDialogLocaleText {
  readonly title: string;
  readonly description: string;
  readonly fallbackTaskTitle: string;
  readonly closeLabel: string;
  readonly closeButtonText: string;
  readonly applyLabel: string;
  readonly resetLabel: string;
  readonly menuItemName: string;
  readonly tabListAriaLabel: string;
  readonly readOnlyLabel: string;
  readonly noResourcesAvailable: string;
  readonly noAssignedResources: string;
  readonly assignedResourcesAriaLabel: string;
  readonly projectDefaultOption: string;
  readonly noConstraintOption: string;
  readonly timeToggleLabel: string;
  readonly switchOnLabel: string;
  readonly switchOffLabel: string;
  readonly manualSchedulingOnLabel: string;
  readonly manualSchedulingOffLabel: string;
  readonly dependencyTargetLabel: {
      readonly predecessors: string;
      readonly successors: string;
    };
  readonly dependencyEmptyLabel: {
      readonly predecessors: string;
      readonly successors: string;
    };
  readonly dependencySearch: {
      readonly predecessors: GanttTaskEditorDialogSearchText;
      readonly successors: GanttTaskEditorDialogSearchText;
    };
  readonly resourcesSearch: GanttTaskEditorDialogSearchText;
  readonly dependencyTypeLabel: string;
  readonly dependencyLagDaysLabel: string;
  readonly removeDependencyLabel: (targetLabel: string) => string;
  readonly removeDependencyButton: string;
  readonly addDependencyButton: {
      readonly predecessors: string;
      readonly successors: string;
    };
  readonly tabs: Record<TaskEditorTabId, string>;
  readonly dependencyTypes: Record<DependencyType, string>;
  readonly fields: Partial<Record<TaskEditorFieldId, string>>;
  readonly fieldOptions: Partial<Record<TaskEditorFieldId, readonly TaskEditorFieldOption[]>>;
  readonly status: GanttTaskEditorDialogStatusText;
  readonly validation: GanttTaskEditorDialogValidationText
}
```

---

### `GanttTaskEditorDialogLocaleTextOptions` (Extended from `gantt-task-editor-dialog.types.ts`)

```ts
export type GanttTaskEditorDialogLocaleTextOptions = Partial<Omit<
  GanttTaskEditorDialogLocaleText,
  | 'dependencyTargetLabel'
  | 'dependencyEmptyLabel'
  | 'dependencySearch'
  | 'resourcesSearch'
  | 'addDependencyButton'
  | 'tabs'
  | 'dependencyTypes'
  | 'fields'
  | 'fieldOptions'
  | 'status'
  | 'validation'
>> & {
  readonly dependencyTargetLabel?: Partial<GanttTaskEditorDialogLocaleText['dependencyTargetLabel']>;
  readonly dependencyEmptyLabel?: Partial<GanttTaskEditorDialogLocaleText['dependencyEmptyLabel']>;
  readonly dependencySearch?: {
    readonly predecessors?: Partial<GanttTaskEditorDialogSearchText>;
    readonly successors?: Partial<GanttTaskEditorDialogSearchText>;
  };
  readonly resourcesSearch?: Partial<GanttTaskEditorDialogSearchText>;
  readonly addDependencyButton?: Partial<GanttTaskEditorDialogLocaleText['addDependencyButton']>;
  readonly tabs?: Partial<Record<TaskEditorTabId, string>>;
  readonly dependencyTypes?: Partial<Record<DependencyType, string>>;
  readonly fields?: Partial<Record<TaskEditorFieldId, string>>;
  readonly fieldOptions?: Partial<Record<TaskEditorFieldId, readonly TaskEditorFieldOption[]>>;
  readonly status?: Partial<GanttTaskEditorDialogStatusText>;
  readonly validation?: Partial<GanttTaskEditorDialogValidationText>;
};
```

---

### `GanttTaskEditorDialogOptions`

```ts
interface GanttTaskEditorDialogOptions {
  readonly fields?: readonly TaskEditorFieldId[];
  readonly localeText?: GanttTaskEditorDialogLocaleTextOptions;
  readonly menuItemName?: string;
  readonly title?: string;
  readonly description?: string;
  readonly applyLabel?: string;
  readonly resetLabel?: string;
  readonly closeLabel?: string;
  /**
     * Controls the packaged row context-menu entry for opening the task editor.
     * Defaults to the Gantt context-menu setting. Set to `false` to remove only
     * the editor menu item, or `true` to keep it when `gantt.contextMenu` is
     * disabled.
     */
    readonly contextMenu?: boolean;
  /**
     * Opens the dialog immediately after the Gantt plugin creates a task. Defaults
     * to `true`. Set to `false` to keep task creation silent. This
     * covers task creation from the toolbar, row context menu, and custom
     * dispatches of the task-create event.
     */
    readonly openOnCreate?: boolean;
  /**
     * Controls the built-in resource assignment picker. Set to `false` to keep
     * the resources field read-only.
     */
    readonly resources?: false | GanttTaskEditorDialogResourcesOptions;
  /**
     * Shows the normalized TaskUpdate JSON preview. Intended for documentation,
     * diagnostics, and custom developer tooling; hidden by default for end-user UI.
     */
    readonly preview?: boolean;
  readonly readOnly?: boolean;
  readonly onSubmit?: (context: GanttTaskEditorDialogSubmitContext) => boolean | void | Promise<boolean | void>;
  readonly getTask?: (taskId: TaskId, grid: HTMLRevoGridElement) => TaskEntity | null | undefined
}
```

---

### `GanttTaskEditorDialogState`

```ts
interface GanttTaskEditorDialogState {
  readonly taskId: TaskId | null;
  readonly task: TaskEntity | null;
  readonly values: TaskEditorFormValues;
  readonly status: string
}
```

---

### `formatValue`

```ts
export function formatValue(value: unknown): string;
```

---

### `formatDateInputValue`

```ts
export function formatDateInputValue(value: unknown): string;
```

---

### `formatDateTimeInputValue`

```ts
export function formatDateTimeInputValue(value: unknown): string;
```

---

### `isEditableInputField`

```ts
export function isEditableInputField(field: TaskEditorFieldSchema): boolean;
```

---

### `cloneValues`

```ts
export function cloneValues(values: TaskEditorFormValues): TaskEditorFormValues;
```

---

### `hasActiveConstraint`

```ts
export function hasActiveConstraint(values: TaskEditorFormValues): boolean;
```

---

### `createNormalizedDialogValues`

```ts
export function createNormalizedDialogValues(values: TaskEditorFormValues): TaskEditorFormValues;
```

---

### `hasTimeGranularity`

```ts
export function hasTimeGranularity(value: unknown): boolean;
```

---

### `createUtcDateTimeValue`

```ts
export function createUtcDateTimeValue(value: string): string;
```

---

### `createInitialDateTimeFieldIds`

```ts
export function createInitialDateTimeFieldIds(
  values: TaskEditorFormValues,
  fields: readonly TaskEditorFieldSchema[],
): readonly TaskEditorFieldId[];
```

---

### `isTaskEntity`

```ts
export function isTaskEntity(model: unknown): model is TaskEntity;
```

---

### `getGridTasks`

```ts
export function getGridTasks(grid: HTMLRevoGridElement): readonly TaskEntity[];
```

---

### `createDependencyDrafts`

```ts
export function createDependencyDrafts(
  task: TaskEntity | null,
  dependencies: readonly DependencyEntity[],
): readonly GanttTaskEditorDialogDependencyDraft[];
```

---

### `areDependencyDraftsEqual`

```ts
export function areDependencyDraftsEqual(
  left: readonly GanttTaskEditorDialogDependencyDraft[],
  right: readonly GanttTaskEditorDialogDependencyDraft[],
): boolean;
```

---

### `normalizeDependencyLagDaysInput`

```ts
export function normalizeDependencyLagDaysInput(value: unknown): number;
```

---

### `getFieldsForTab`

```ts
export function getFieldsForTab(
  tab: TaskEditorTabId,
  fields: readonly TaskEditorFieldSchema[],
): readonly TaskEditorFieldSchema[];
```

---

### `areResourceIdsEqual`

```ts
export function areResourceIdsEqual(left: readonly ResourceId[], right: readonly ResourceId[]): boolean;
```

---

### `createSelectedResourceIds`

```ts
export function createSelectedResourceIds(
  task: TaskEntity | null,
  assignments: readonly AssignmentEntity[],
): readonly ResourceId[];
```

---

### `createErrors`

```ts
export function createErrors(
  errors: readonly TaskEditorSubmitError[],
  fields: readonly TaskEditorFieldSchema[],
  localeText: GanttTaskEditorDialogLocaleText,
): Map<string, string>;
```

---

### `shouldShowStatusMessage`

```ts
export function shouldShowStatusMessage(status: string, statusText: GanttTaskEditorDialogStatusText): boolean;
```

---

### `compareTextAscending`

```ts
export function compareTextAscending(left: string, right: string): number;
```

---

### `includesSearchText`

```ts
export function includesSearchText(value: string, searchText: string): boolean;
```

---

### `getFieldLabel`

```ts
export function getFieldLabel(
  field: TaskEditorFieldSchema,
  localeText: GanttTaskEditorDialogLocaleText,
): string;
```

---

### `getSortedFieldOptions`

```ts
export function getSortedFieldOptions(
  field: TaskEditorFieldSchema,
  localeText: GanttTaskEditorDialogLocaleText,
): readonly;
```

---

### `EMPTY_RESOURCES`

```ts
EMPTY_RESOURCES: readonly ResourceEntity[];
```

---

### `EMPTY_ASSIGNMENTS`

```ts
EMPTY_ASSIGNMENTS: readonly AssignmentEntity[];
```

---

### `EMPTY_DEPENDENCIES`

```ts
EMPTY_DEPENDENCIES: readonly DependencyEntity[];
```

---

### `ganttTaskEditorDialogDependencies`

#### Dependencies

- **Optional** `GanttPlugin`: Uses Gantt task metadata, resource assignments, and read-only state when present.
- **Auto-installed** `ContextMenuPlugin`: Adds the Edit action to the row context menu.

```ts
ganttTaskEditorDialogDependencies: PluginDependency[];
```

---

### `GanttTaskEditorDialogPlugin`

```ts
class GanttTaskEditorDialogPlugin {
  openTask(taskId: TaskId | null): void;

  closeTaskEditor(): void;

  destroy(): void;
}
```

---

### `ResourcePicker`

```ts
export function ResourcePicker(;
```

---

### `ResourcePickerProps`

```ts
interface ResourcePickerProps {
  readonly resources: readonly ResourceEntity[];
  readonly selectedResourceIds: readonly ResourceId[];
  readonly localeText: GanttTaskEditorDialogLocaleText;
  readonly onChange: (resourceIds: readonly ResourceId[]) => void
}
```

---

### `TaskEditorField`

```ts
export function TaskEditorField(;
```

---

### `TaskEditorFieldProps`

```ts
interface TaskEditorFieldProps {
  readonly field: TaskEditorFieldSchema;
  readonly values: TaskEditorFormValues;
  readonly errors: ReadonlyMap<string, string>;
  readonly localeText: GanttTaskEditorDialogLocaleText;
  readonly dateFormatProject?: GanttPluginConfig | null;
  readonly dateTimeEnabled?: boolean;
  readonly resourceSelection?: ResourceSelection;
  readonly onChange: (values: TaskEditorFormValues) => void;
  readonly onDateTimeToggle?: (fieldId: TaskEditorFieldId, enabled: boolean) => void
}
```

---

### `TaskEditorTabs`

```ts
export function TaskEditorTabs(;
```

---

### `TaskEditorTabsProps`

```ts
interface TaskEditorTabsProps {
  readonly activeTab: TaskEditorTabId;
  readonly tabs: readonly TaskEditorTabId[];
  readonly localeText: GanttTaskEditorDialogLocaleText;
  readonly onChange: (tab: TaskEditorTabId) => void
}
```
