Aller au contenu

Transfer between views

Declarative tables and graphs accept a transfer block in their config:

"transfer": {
"export": { "kind": "my-plugin/item" },
"accept": ["my-plugin/item"],
"dropEvent": "my-plugin/view.drop"
}
  • export: table rows (grip handle, checked rows included) and graph nodes (Alt+drag) become TransferItem { kind, id, label?, source: { pluginId, viewId, tabId, params } }. Ctrl+C copies the active row / selected node into the application clipboard.
  • accept + dropEvent: dropped or pasted (Ctrl+V) items reach dropEvent as { ...params, items, operation: "drop" | "paste", position?, laneId?, context }; graphs give the drop point in graph coordinates and the lane under it.
  • Alignment guides: during a plain drag of one node (no Ctrl, Shift or Alt), a thin green line across the graph shows when its centre is within ~8 px of the centre Y of a neighbour (upstream or downstream), or of the midpoint of two upstream (or two downstream) neighbours consecutive in Y. On release the node Y snaps to it; moveEvent receives the snapped position. Boxes are never references; edges to a box count for the tasks inside it.
  • The shell never changes data: the receiving plugin validates and applies the items in its handler (one transaction, so one undo step).
  • Graphs also accept removeEvent, emitted with { nodeIds, edgeIds } (the selected nodes and edges) on Delete or Backspace; the owner decides what removal means for each.
  • Compound nodes: a node with parentId is drawn inside its parent, whose box (translucent, dashed, title in the header) wraps its children; nesting may be several levels deep, unknown parents and cycles are ignored. Edges may target a container. moveEvent carries { nodeId, position, laneId, parentId, nodePositions }: moving a container lists its leaf descendants’ absolute positions; a plain drag highlights the innermost node under the dragged node and dropping there reparents into it, dropping outside the original box takes it out (parentId: null), otherwise the parent is kept. Children inherit their ancestor’s lane (laneId is null for a node in a container). A dropEvent over a node also receives targetNodeId.
  • Frozen columns: a column declared "pinned": true stays on the left while the table scrolls horizontally. Users freeze/unfreeze from the header context menu (“Freeze up to here”) or the lock in the Columns tool; the choice is stored per view in TableViewState.columns[].pinned.
  • Export: "export": true or { "fileName": "<i18n key>" } adds an Export button (CSV or Excel). It writes the shown columns, in their order, and the filtered, sorted rows (paged providers are read page by page). Option values are written as their labels.
  • Import: "import": { "event": "<event>", "keyColumn": "id" } adds an Import button. The shell reads a CSV or Excel file, matches its headers to column titles/keys, lets the user change the mapping and converts cells with the column types (options by value or label, numbers, ISO or dd/mm/yyyy dates, yes/no). The plugin receives { ...params, rows, columns, context } (TableImportPayload) and decides whether to create or update; doing it in one handler gives one undo step.
{ "export": { "fileName": "tree.tasks" }, "import": { "event": "notes-tsx/task.import", "keyColumn": "id" } }

Documentation sous licence CC BY 4.0 · © les contributeurs de SCFlow ·Retour à supplychainflow.org