MosaicChangeMeta
react-mosaic-component / MosaicChangeMeta
Type Alias: MosaicChangeMeta<T>
MosaicChangeMeta<
T> = {node:MosaicNode<T>;path:MosaicPath;type:"remove"; } | {path:MosaicPath;percentage:number;type:"expand"; } | {path:MosaicPath;splitPercentages:number[];type:"resize"; } | {node:MosaicNode<T>;path:MosaicPath;type:"split"; } | {node:MosaicNode<T>;path:MosaicPath;previous:MosaicNode<T> |null;type:"replace"; } | {destinationPath:MosaicPath;node:MosaicNode<T>;position?:"top"|"bottom"|"left"|"right";sourcePath:MosaicPath;swap?:true;tabIndex?:number;type:"drop"; } | {path:MosaicPath;type:"drag-start"; } | {path:MosaicPath;type:"drag-cancel"; } | {path:MosaicPath;tab:T;type:"tab-add"; } | {index:number;path:MosaicPath;tab:T;type:"tab-remove"; } | {index:number;path:MosaicPath;type:"tab-select"; } | {type:"migrate"; } | {type:"update"; }
Defined in: libs/react-mosaic-component/src/lib/types.ts:121
Describes what caused a tree change. Passed as the second argument of
onChange and onRelease. Paths refer to the tree before the change.
Type Parameters
T
T extends MosaicKey
Union Members
Type Literal
{ node: MosaicNode<T>; path: MosaicPath; type: "remove"; }
A node was removed (remove button, mosaicActions.remove). node is the removed subtree.
Type Literal
{ path: MosaicPath; percentage: number; type: "expand"; }
The node at path was expanded to percentage (expand button, mosaicActions.expand).
Type Literal
{ path: MosaicPath; splitPercentages: number[]; type: "resize"; }
A split bar was dragged. path is the split node; fires on every move and on release.
Type Literal
{ node: MosaicNode<T>; path: MosaicPath; type: "split"; }
The node at path was split, node is the newly created one (split buttons).
Type Literal
{ node: MosaicNode<T>; path: MosaicPath; previous: MosaicNode<T> | null; type: "replace"; }
The node at path was replaced by node (replace button, zero state,
mosaicActions.replaceWith). previous is what was there before, null
for an empty layout.
Type Literal
{ destinationPath: MosaicPath; node: MosaicNode<T>; position?: "top" | "bottom" | "left" | "right"; sourcePath: MosaicPath; swap?: true; tabIndex?: number; type: "drop"; }
A window, tab group or tab was dropped. position is set for edge drops.
tabIndex is set for drops at a position in a tab bar: it is the insertion
slot in the tab list before the move, not the tab's resulting index.
destinationPath
destinationPath:
MosaicPath
node
node:
MosaicNode<T>
position?
optionalposition?:"top"|"bottom"|"left"|"right"
sourcePath
sourcePath:
MosaicPath
swap?
optionalswap?:true
true when the drop swapped the two nodes (see dropBehavior)
tabIndex?
optionaltabIndex?:number
type
type:
"drop"
Type Literal
{ path: MosaicPath; type: "drag-start"; }
A window or tab group drag started and the node at path was temporarily
hidden. No onRelease. Always followed by a drop or a drag-cancel.
Dragging a single tab out of a tab bar emits neither drag-start nor
drag-cancel, only the final drop.
Type Literal
{ path: MosaicPath; type: "drag-cancel"; }
A window or tab group drag was cancelled and the node at path was shown
again. No onRelease. Also emitted by mosaicActions.show(path).
Type Literal
{ path: MosaicPath; tab: T; type: "tab-add"; }
tab was added to the tab group at path (created from a leaf if needed).
Type Literal
{ index: number; path: MosaicPath; tab: T; type: "tab-remove"; }
The tab at index (tab) was closed in the tab group at path.
Type Literal
{ index: number; path: MosaicPath; type: "tab-select"; }
The tab at index became active in the tab group at path.
Type Literal
{ type: "migrate"; }
A legacy (v6 binary) controlled value was converted to the n-ary format. No onRelease.
Type Literal
{ type: "update"; }
Any other change, e.g. mosaicActions.updateTree called without a meta.