Skip to main content

Editor

Description

Editor helper

A standalone Editor component based on SVAR Editor that allows adding task editor dialog with a set of fields (controls) for viewing and editing task data.

You can import the component from wx-svelte-gantt .

Usage

interface EditorConfig {
// Configuration for the editor items
items: Array<Record<string, any>>;
// Automatically apply changes to the data object
autoSave?: boolean;
// Define the current active batch for the editor
activeBatch?: string;
// Configuration for the top toolbar
topBar?: {
// Array of items for the toolbar
items: Array<Record<string, any>>;
};
// Configuration for the bottom toolbar
bottomBar?: {
// Array of items for the toolbar
items: Array<Record<string, any>>;
};
// Additional CSS class for the editor's box
css?: string;
// Initial values for the editor fields
values?: Record<string, any>;
// Placement of the editor (inline, modal, sidebar)
placement?: "inline" | "modal" | "sidebar";
// Set the editor to readonly mode
readonly?: boolean;
// Define layout for the editor
layout?: "columns" | "default";
// Function to handle action events
onaction?: (ev: OnActionResult) => void;
// Function to handle change events
onchange?: (ev: OnChangeResult) => void;
// Function to handle save events
onsave?: (ev: OnSaveResult) => void;
// Function to handle validation events
onvalidation?: (ev: OnValidationResult) => void;
}

Parameters

Gantt Editor has the same API as Basic SVAR Editor. Its API is described here: Editor API

Example

The example below shows how to remove the "Description" field (which uses the key "details") from the editor:

<script>
import { Gantt, Editor, defaultEditorItems } from "wx-svelte-gantt";

let api = $state();

const items = defaultEditorItems.filter(item => item.key !== "details");
</script>

<Gantt bind:this={api} />
<Editor {api} {items} />

Related articles: