@vuu-ui/grid-layout 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +141 -0
- package/package.json +40 -0
- package/src/GridCommand.js +395 -0
- package/src/GridComponentSettings.js +163 -0
- package/src/GridController.js +359 -0
- package/src/GridDragCoordinator.js +293 -0
- package/src/GridGeometry.js +1298 -0
- package/src/GridLayout.css.js +119 -0
- package/src/GridLayout.js +120 -0
- package/src/GridLayoutContext.js +58 -0
- package/src/GridLayoutDocument.js +307 -0
- package/src/GridLayoutDocumentIds.js +110 -0
- package/src/GridLayoutItem.css.js +46 -0
- package/src/GridLayoutItem.js +147 -0
- package/src/GridLayoutLegacyCompatibility.js +66 -0
- package/src/GridLayoutModel.js +138 -0
- package/src/GridLayoutProvider.js +263 -0
- package/src/GridLayoutStackedItem.css.js +26 -0
- package/src/GridLayoutStackedtem.js +140 -0
- package/src/GridModel.js +1289 -0
- package/src/GridPlaceholder.css.js +9 -0
- package/src/GridPlaceholder.js +24 -0
- package/src/GridSnapshot.js +11 -0
- package/src/GridSplitter.css.js +62 -0
- package/src/GridSplitter.js +26 -0
- package/src/GridStack.js +277 -0
- package/src/Icon.css.js +8 -0
- package/src/Icon.js +26 -0
- package/src/IconButton.css.js +9 -0
- package/src/IconButton.js +28 -0
- package/src/TabDialog.css.js +10 -0
- package/src/TabDialog.js +77 -0
- package/src/TabMenu.css.js +8 -0
- package/src/TabMenu.js +78 -0
- package/src/componentToJson.js +41 -0
- package/src/drag-drop-next/DragContextNext.js +173 -0
- package/src/drag-drop-next/DragDropProviderNext.css.js +72 -0
- package/src/drag-drop-next/DragDropProviderNext.js +91 -0
- package/src/drag-drop-next/SpaceMan.js +256 -0
- package/src/drag-drop-next/TemplateDragSession.js +36 -0
- package/src/drag-drop-next/tabstrip-drag-drop.js +251 -0
- package/src/grid-dom-utils.js +57 -0
- package/src/grid-layout-utils.js +39 -0
- package/src/grid-snapshot-adapters.js +435 -0
- package/src/index.js +24 -0
- package/src/json-value.js +56 -0
- package/src/layoutFromJson.js +15 -0
- package/src/layoutToJson.js +5 -0
- package/src/propUtils.js +15 -0
- package/src/react-element-utils.js +15 -0
- package/src/typeOf.js +15 -0
- package/src/useAsDropTarget.js +229 -0
- package/src/useDraggable.js +46 -0
- package/src/useEditTabName.js +70 -0
- package/src/useGridChildProps.js +47 -0
- package/src/useGridControllerSnapshot.js +21 -0
- package/src/useGridLayout.js +727 -0
- package/src/useGridSplitterResizing.js +262 -0
- package/src/useNotDropTarget.js +2 -0
- package/types/AddTabDialog.d.ts +5 -0
- package/types/GridCommand.d.ts +146 -0
- package/types/GridComponentSettings.d.ts +71 -0
- package/types/GridController.d.ts +50 -0
- package/types/GridDragCoordinator.d.ts +80 -0
- package/types/GridGeometry.d.ts +331 -0
- package/types/GridLayout.d.ts +20 -0
- package/types/GridLayoutContext.d.ts +141 -0
- package/types/GridLayoutDocument.d.ts +61 -0
- package/types/GridLayoutDocumentIds.d.ts +15 -0
- package/types/GridLayoutItem.d.ts +28 -0
- package/types/GridLayoutLegacyCompatibility.d.ts +57 -0
- package/types/GridLayoutModel.d.ts +72 -0
- package/types/GridLayoutProvider.d.ts +59 -0
- package/types/GridLayoutStackedtem.d.ts +10 -0
- package/types/GridModel.d.ts +504 -0
- package/types/GridPlaceholder.d.ts +5 -0
- package/types/GridSnapshot.d.ts +49 -0
- package/types/GridSplitter.d.ts +10 -0
- package/types/GridStack.d.ts +160 -0
- package/types/Icon.d.ts +6 -0
- package/types/IconButton.d.ts +6 -0
- package/types/TabDialog.d.ts +9 -0
- package/types/TabMenu.d.ts +7 -0
- package/types/componentToJson.d.ts +38 -0
- package/types/drag-drop-next/DragContextNext.d.ts +92 -0
- package/types/drag-drop-next/DragDropProviderNext.d.ts +23 -0
- package/types/drag-drop-next/SpaceMan.d.ts +35 -0
- package/types/drag-drop-next/TemplateDragSession.d.ts +21 -0
- package/types/drag-drop-next/tabstrip-drag-drop.d.ts +3 -0
- package/types/grid-dom-utils.d.ts +17 -0
- package/types/grid-layout-utils.d.ts +18 -0
- package/types/grid-matrix.d.ts +5 -0
- package/types/grid-snapshot-adapters.d.ts +22 -0
- package/types/index.d.ts +24 -0
- package/types/json-value.d.ts +23 -0
- package/types/layoutFromJson.d.ts +4 -0
- package/types/layoutToJson.d.ts +3 -0
- package/types/propUtils.d.ts +5 -0
- package/types/react-element-utils.d.ts +3 -0
- package/types/src/AddTabDialog.d.ts +5 -0
- package/types/src/GridLayout.d.ts +14 -0
- package/types/src/GridLayoutContext.d.ts +88 -0
- package/types/src/GridLayoutItem.d.ts +28 -0
- package/types/src/GridLayoutModel.d.ts +59 -0
- package/types/src/GridLayoutProvider.d.ts +37 -0
- package/types/src/GridLayoutStackedtem.d.ts +10 -0
- package/types/src/GridModel.d.ts +350 -0
- package/types/src/GridPlaceholder.d.ts +5 -0
- package/types/src/GridSplitter.d.ts +9 -0
- package/types/src/Icon.d.ts +6 -0
- package/types/src/IconButton.d.ts +6 -0
- package/types/src/TabMenu.d.ts +6 -0
- package/types/src/componentToJson.d.ts +32 -0
- package/types/src/drag-drop-next/DragContextNext.d.ts +73 -0
- package/types/src/drag-drop-next/DragDropProviderNext.d.ts +20 -0
- package/types/src/drag-drop-next/SpaceMan.d.ts +35 -0
- package/types/src/drag-drop-next/tabstrip-drag-drop.d.ts +3 -0
- package/types/src/grid-dom-utils.d.ts +17 -0
- package/types/src/grid-layout-utils.d.ts +80 -0
- package/types/src/grid-matrix.d.ts +5 -0
- package/types/src/index.d.ts +10 -0
- package/types/src/layoutFromJson.d.ts +3 -0
- package/types/src/layoutToJson.d.ts +2 -0
- package/types/src/propUtils.d.ts +5 -0
- package/types/src/react-element-utils.d.ts +3 -0
- package/types/src/typeOf.d.ts +6 -0
- package/types/src/useAsDropTarget.d.ts +7 -0
- package/types/src/useDraggable.d.ts +23 -0
- package/types/src/useGridChildProps.d.ts +13 -0
- package/types/src/useGridLayout.d.ts +43 -0
- package/types/src/useGridSplitterResizing.d.ts +12 -0
- package/types/src/useNotDropTarget.d.ts +1 -0
- package/types/typeOf.d.ts +6 -0
- package/types/useAsDropTarget.d.ts +7 -0
- package/types/useDraggable.d.ts +24 -0
- package/types/useEditTabName.d.ts +11 -0
- package/types/useGridChildProps.d.ts +13 -0
- package/types/useGridControllerSnapshot.d.ts +7 -0
- package/types/useGridLayout.d.ts +53 -0
- package/types/useGridSplitterResizing.d.ts +14 -0
- package/types/useNotDropTarget.d.ts +1 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EventEmitter, type GridLayoutSplitDirection, type OptionalProperty } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import { type GridGeometryTransition, type GridInsertTrackTransition, type GridRemoveItemTransition, type GridReplaceItemTransition } from "./GridGeometry";
|
|
3
|
+
import type { TrackType, GridLayoutModelCoordinates, GridModel, GridModelChildItem, GridModelEvents, GridTrackResizeConstraint, ISplitter } from "./GridModel";
|
|
4
|
+
export type GridLayoutModelPosition = {
|
|
5
|
+
end: number;
|
|
6
|
+
start: number;
|
|
7
|
+
};
|
|
8
|
+
export type ResizeState = {
|
|
9
|
+
maxMousePos: number;
|
|
10
|
+
minMousePos: number;
|
|
11
|
+
proportionalTrackGroups?: {
|
|
12
|
+
after: number[];
|
|
13
|
+
before: number[];
|
|
14
|
+
};
|
|
15
|
+
proportionalTrackConstraints?: {
|
|
16
|
+
after: GridTrackResizeConstraint[];
|
|
17
|
+
before: GridTrackResizeConstraint[];
|
|
18
|
+
};
|
|
19
|
+
proportionalInitialTrackSizes?: number[];
|
|
20
|
+
proportionalMoveBy?: number;
|
|
21
|
+
resizeTrackIsShared: boolean;
|
|
22
|
+
mousePos: number;
|
|
23
|
+
splitter: ISplitter;
|
|
24
|
+
};
|
|
25
|
+
export type GridItemRemoveReason = "drag" | "close" | "placeholder" | "unstack";
|
|
26
|
+
export type GridLayoutResizeOperation = "contract" | "expand";
|
|
27
|
+
export type GridLayoutResizeDirection = "vertical" | "horizontal";
|
|
28
|
+
export type GridLayoutRelativePosition = "aboveInSameColumn" | "belowInSameColumn" | "rightInSameRow" | "leftInSameRow";
|
|
29
|
+
export type GridLayoutTrack = "column" | "row";
|
|
30
|
+
export type GridLayoutModelItemType = "content" | "placeholder" | "splitter" | "stacked-content";
|
|
31
|
+
type OneOrBothGridLayoutModelCoordinates = GridLayoutModelCoordinates | OptionalProperty<GridLayoutModelCoordinates, TrackType>;
|
|
32
|
+
export type GridItemUpdate = [string, OneOrBothGridLayoutModelCoordinates];
|
|
33
|
+
export type GridLayoutModelEvents = Pick<GridModelEvents, "child-position-updates">;
|
|
34
|
+
export declare class GridLayoutModel extends EventEmitter<GridLayoutModelEvents> {
|
|
35
|
+
private gridModel;
|
|
36
|
+
private splitters;
|
|
37
|
+
constructor(gridModel: GridModel);
|
|
38
|
+
/**
|
|
39
|
+
* Hydrate a pure remove transition and notify listeners exactly as the
|
|
40
|
+
* legacy engine did: positions are broadcast before placeholders are
|
|
41
|
+
* regenerated.
|
|
42
|
+
*/
|
|
43
|
+
applyRemoveTransition(transition: GridRemoveItemTransition): void;
|
|
44
|
+
removeGridItem(gridItemId: string, reason: GridItemRemoveReason): void;
|
|
45
|
+
/** Hydrate a pure centre replacement transition. */
|
|
46
|
+
applyReplaceTransition(transition: GridReplaceItemTransition): void;
|
|
47
|
+
dropReplaceGridItem(droppedItemId: string, targetItemId: string): GridModelChildItem;
|
|
48
|
+
createSplitters(): ISplitter[];
|
|
49
|
+
getSplitterById(splitterId: string): ISplitter;
|
|
50
|
+
getSplitter(gridLayoutItem: GridModelChildItem, resizeDirection: GridLayoutResizeDirection): ISplitter;
|
|
51
|
+
/** Hydrate a pure track insertion transition. */
|
|
52
|
+
applyInsertTrackTransition(trackType: TrackType, transition: GridInsertTrackTransition): void;
|
|
53
|
+
/**
|
|
54
|
+
* We're going to resize a gridItem that shares a grid line with one or
|
|
55
|
+
* more other grid items. We need to insert a new grid line, then anchor
|
|
56
|
+
* the griditem to be resized to the new grid line.
|
|
57
|
+
*/
|
|
58
|
+
addTrackForResize(trackType: TrackType, newTrackSize: number, resizeOperation: GridLayoutResizeOperation, index: number, state: ResizeState): void;
|
|
59
|
+
/** Hydrate a pure split transition. */
|
|
60
|
+
applySplitTransition(transition: GridGeometryTransition): void;
|
|
61
|
+
/**
|
|
62
|
+
* Dragged child item has been dropped on (NESW) quadrant of target.
|
|
63
|
+
* Split the target in two, respecting targetted quadrant and
|
|
64
|
+
* assign layout positions of each child item.
|
|
65
|
+
*/
|
|
66
|
+
dropSplitGridItem(droppedItemId: string, targetItemId: string, splitDirection: GridLayoutSplitDirection, resizeDirection?: import("./GridGeometry").GridGeometryResizeDirection): boolean;
|
|
67
|
+
canSplitGridItem(targetItemId: string, splitDirection: GridLayoutSplitDirection): boolean;
|
|
68
|
+
removeTrack(trackIndex: number, resizeDirection: GridLayoutResizeDirection): GridItemUpdate[];
|
|
69
|
+
isResizeTrackShared(splitter: ISplitter): boolean;
|
|
70
|
+
toDebugString(): string;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type DragEvent, type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import type { GridComponentRendererRegistry, GridComponentSettingsInput, GridComponentSettingsRegistry } from "./GridComponentSettings";
|
|
3
|
+
import { type GridLayoutDocument, type GridLayoutDocumentError } from "./GridLayoutDocument";
|
|
4
|
+
import { type LegacyDeserializedGridLayout, type LegacySerializedComponentMap, type SerializedGridLayout } from "./GridLayoutLegacyCompatibility";
|
|
5
|
+
import type { ComponentTemplate } from "./GridLayoutContext";
|
|
6
|
+
import type { GridCommittedTransition } from "./GridController";
|
|
7
|
+
type GridLayoutOptions = {
|
|
8
|
+
newChildItem: {
|
|
9
|
+
header: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** @deprecated Use GridLayoutDocument component records. */
|
|
13
|
+
export type SerializedComponentMap = LegacySerializedComponentMap;
|
|
14
|
+
/** @deprecated Use a decoded GridLayoutDocument. */
|
|
15
|
+
export type DeserializedGridLayout = LegacyDeserializedGridLayout;
|
|
16
|
+
export type { SerializedGridLayout } from "./GridLayoutLegacyCompatibility";
|
|
17
|
+
export type GridLayoutDragEndHandler = (evt: DragEvent<HTMLElement>, dropped: boolean) => void;
|
|
18
|
+
export interface GridLayoutProviderProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
componentRenderers?: GridComponentRendererRegistry;
|
|
21
|
+
componentSettings?: readonly GridComponentSettingsInput[];
|
|
22
|
+
document?: unknown;
|
|
23
|
+
documentController?: GridLayoutDocumentController;
|
|
24
|
+
onDocumentChange?: GridLayoutDocumentChangeHandler;
|
|
25
|
+
onDocumentError?: (error: GridLayoutDocumentError) => void;
|
|
26
|
+
options?: GridLayoutOptions;
|
|
27
|
+
settingsCodecs?: GridComponentSettingsRegistry;
|
|
28
|
+
/**
|
|
29
|
+
* Read-only compatibility input. Changes are never written to this shape.
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Use document with settingsCodecs and componentRenderers.
|
|
32
|
+
*/
|
|
33
|
+
serializedLayout?: SerializedGridLayout;
|
|
34
|
+
}
|
|
35
|
+
export interface GridLayoutDocumentChange {
|
|
36
|
+
readonly document: GridLayoutDocument;
|
|
37
|
+
readonly kind: GridCommittedTransition["kind"];
|
|
38
|
+
readonly removedComponentInstanceIds: readonly string[];
|
|
39
|
+
readonly revision: number;
|
|
40
|
+
}
|
|
41
|
+
export type GridLayoutDocumentChangeHandler = (document: GridLayoutDocument, change: GridLayoutDocumentChange) => void;
|
|
42
|
+
export type GridLayoutDocumentStoreListener = () => void;
|
|
43
|
+
export declare class GridLayoutDocumentController {
|
|
44
|
+
#private;
|
|
45
|
+
constructor(document?: GridLayoutDocument);
|
|
46
|
+
getSnapshot: () => GridLayoutDocument | undefined;
|
|
47
|
+
getChange: () => GridLayoutDocumentChange | undefined;
|
|
48
|
+
subscribe: (listener: GridLayoutDocumentStoreListener) => () => boolean;
|
|
49
|
+
replace(document: GridLayoutDocument | undefined): void;
|
|
50
|
+
publish(change: GridLayoutDocumentChange): void;
|
|
51
|
+
}
|
|
52
|
+
export declare const GridLayoutProvider: (props: GridLayoutProviderProps) => ReactElement;
|
|
53
|
+
export declare const useGridChangeHandler: () => {
|
|
54
|
+
onCommittedSnapshot: ((transition: GridCommittedTransition, placeholderIds: readonly string[]) => void) | undefined;
|
|
55
|
+
releaseTemplateComponent: ((id: string) => void) | undefined;
|
|
56
|
+
renderTemplateComponent: ((template: ComponentTemplate, id: string) => ReactElement | undefined) | undefined;
|
|
57
|
+
};
|
|
58
|
+
export declare const useSavedGrid: () => ((id: string) => LegacyDeserializedGridLayout | undefined) | undefined;
|
|
59
|
+
export declare const useGridLayoutOptions: () => GridLayoutOptions | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type ComponentTemplateWithoutLabel } from "./GridLayoutContext";
|
|
3
|
+
import type { GridLayoutItemProps } from "./GridLayoutItem";
|
|
4
|
+
export interface GridLayoutStackedItemProps extends GridLayoutItemProps {
|
|
5
|
+
allowAddTab?: boolean;
|
|
6
|
+
getNewComponent?: () => ComponentTemplateWithoutLabel;
|
|
7
|
+
showMenu?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const GridLayoutStackedItem: ({ allowAddTab, children, className: classNameProp, header, id, getNewComponent, minHeight, minWidth, resizeable, showMenu, style: styleProp, title, ...htmlAttributes }: GridLayoutStackedItemProps) => import("react").JSX.Element;
|
|
10
|
+
export declare const isGridLayoutStackedItem: (element: ReactElement) => boolean;
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { EventEmitter, type OptionalProperty } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
import type { DropPosition } from "./drag-drop-next/DragContextNext";
|
|
4
|
+
import { type GridGeometry, type GridGeometryItem, type GridGeometryResult, type GridGeometryTrack, type GridGeometryUpdate, type GridMeasurements, type GridTrackTransition, type TrackMetrics } from "./GridGeometry";
|
|
5
|
+
import type { GridItemRemoveReason, GridItemUpdate, GridLayoutModelPosition, GridLayoutResizeDirection } from "./GridLayoutModel";
|
|
6
|
+
import { type GridStackResult, type GridStackState, type GridStackTransition } from "./GridStack";
|
|
7
|
+
import type { GridItemId, StackId } from "./GridSnapshot";
|
|
8
|
+
export type TrackUnit = "px" | "fr";
|
|
9
|
+
export type CSSFraction = `${number}fr`;
|
|
10
|
+
export type CSSPixels = `${number}px`;
|
|
11
|
+
export type TrackSize = CSSFraction | CSSPixels;
|
|
12
|
+
export declare const DEFAULT_MIN_GRID_ITEM_SIZE = 80;
|
|
13
|
+
export declare const resolveMinimumGridItemSize: (minimum: number | undefined, styleMinimum: CSSProperties["minWidth"]) => number | undefined;
|
|
14
|
+
export declare const isFractionUnit: (trackSize: TrackSize) => trackSize is CSSFraction;
|
|
15
|
+
export declare const isPixelUnit: (trackSize: TrackSize) => trackSize is CSSPixels;
|
|
16
|
+
/**
|
|
17
|
+
* Convert pure geometry updates into the legacy update tuples broadcast to
|
|
18
|
+
* position listeners.
|
|
19
|
+
*/
|
|
20
|
+
export declare const toGridItemUpdates: (updates: readonly GridGeometryUpdate[]) => GridItemUpdate[];
|
|
21
|
+
export interface GridLayoutChildItemDescriptor {
|
|
22
|
+
componentId?: string;
|
|
23
|
+
contentVisible?: boolean;
|
|
24
|
+
dropTarget?: boolean | string;
|
|
25
|
+
gridArea: string;
|
|
26
|
+
header?: boolean;
|
|
27
|
+
minHeight?: number;
|
|
28
|
+
minWidth?: number;
|
|
29
|
+
resizeable?: GridModelItemResizeable;
|
|
30
|
+
/**
|
|
31
|
+
* For GridLayoutItems that are 'stacked' (e.g. displayed in tabbed container)
|
|
32
|
+
* this is the id of the associated StackedLayoutItem.
|
|
33
|
+
*/
|
|
34
|
+
stackId?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface GridLayoutChildItemDescriptorWithComponentId extends GridLayoutChildItemDescriptor {
|
|
38
|
+
componentId: string;
|
|
39
|
+
}
|
|
40
|
+
export type GridLayoutChildItemDescriptors = Record<string, GridLayoutChildItemDescriptor>;
|
|
41
|
+
export interface GridColumnsAndRows {
|
|
42
|
+
cols: TrackSize[];
|
|
43
|
+
rows: TrackSize[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Describes a GridLayout
|
|
47
|
+
* grid rows and columns
|
|
48
|
+
* layout details of gridItems
|
|
49
|
+
*
|
|
50
|
+
* @deprecated This is the v1 compatibility descriptor. Persist and observe
|
|
51
|
+
* canonical GridSnapshot values through GridLayoutDocument/GridController.
|
|
52
|
+
*/
|
|
53
|
+
export interface GridLayoutDescriptor extends GridColumnsAndRows {
|
|
54
|
+
gridLayoutItems?: GridLayoutChildItemDescriptors;
|
|
55
|
+
}
|
|
56
|
+
export interface GridLayoutModelCoordinates {
|
|
57
|
+
column: GridLayoutModelPosition;
|
|
58
|
+
row: GridLayoutModelPosition;
|
|
59
|
+
}
|
|
60
|
+
export interface GridModelChildItemProps extends Omit<GridLayoutChildItemDescriptor, "gridArea"> {
|
|
61
|
+
contentVisible?: boolean;
|
|
62
|
+
fixed?: boolean;
|
|
63
|
+
height?: number;
|
|
64
|
+
id: string;
|
|
65
|
+
style?: GridChildItemStyle;
|
|
66
|
+
type?: GridModelItemType;
|
|
67
|
+
width?: number;
|
|
68
|
+
}
|
|
69
|
+
export type GridModelTrack = "column" | "row";
|
|
70
|
+
export type AssignDirection = "bwd" | "fwd";
|
|
71
|
+
export type TrackInsertionPosition = {
|
|
72
|
+
index: number;
|
|
73
|
+
position: "before" | "after";
|
|
74
|
+
};
|
|
75
|
+
/** @deprecated Use committed GridLayoutDocument changes from GridLayoutProvider. */
|
|
76
|
+
export type GridLayoutChangeHandler = (gridId: string, gridLayoutDescriptor: GridLayoutDescriptor) => void;
|
|
77
|
+
export type GridTrackAddedEvent = {
|
|
78
|
+
gridId: string;
|
|
79
|
+
trackType: TrackType;
|
|
80
|
+
newTrackIndex: number;
|
|
81
|
+
newTracks: GridTrack[];
|
|
82
|
+
};
|
|
83
|
+
export type GridTrackAddedHandler = (evt: GridTrackAddedEvent) => void;
|
|
84
|
+
export type NonContentResetOptions = {
|
|
85
|
+
placeholders?: boolean;
|
|
86
|
+
splitters?: boolean;
|
|
87
|
+
};
|
|
88
|
+
export declare const NonContentResetOptions: NonContentResetOptions;
|
|
89
|
+
export type GridChildPositionChangeHandler = (updates: GridItemUpdate[], nonContentResetOptions?: NonContentResetOptions) => void;
|
|
90
|
+
export type TabsChangeHandler = (tabsId: string, active: number, tabs: TabStateTab[]) => void;
|
|
91
|
+
export type TabSelectionChangeHandler = (tabsId: string, active: number) => void;
|
|
92
|
+
export type GridModelEvents = {
|
|
93
|
+
"grid-layout-change": GridLayoutChangeHandler;
|
|
94
|
+
"grid-track-added": GridTrackAddedHandler;
|
|
95
|
+
"child-position-updates": GridChildPositionChangeHandler;
|
|
96
|
+
"tabs-change": TabsChangeHandler;
|
|
97
|
+
"tabs-created": (stackItem: GridModelChildItem) => void;
|
|
98
|
+
"tabs-removed": (tabsId: string) => void;
|
|
99
|
+
"tab-selection-change": TabSelectionChangeHandler;
|
|
100
|
+
};
|
|
101
|
+
export type GridModelPosition = {
|
|
102
|
+
end: number;
|
|
103
|
+
start: number;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Describes position of component within grid container. Position
|
|
107
|
+
* is grid column and row start and end values.
|
|
108
|
+
*/
|
|
109
|
+
export interface GridModelCoordinates {
|
|
110
|
+
column: GridModelPosition;
|
|
111
|
+
row: GridModelPosition;
|
|
112
|
+
}
|
|
113
|
+
export type GridModelItemResizeable = "h" | "v" | "hv" | false;
|
|
114
|
+
export type GridModelItemType = "content" | "placeholder" | "splitter" | "stacked-content";
|
|
115
|
+
/**
|
|
116
|
+
* The set of attributes that allow the management of layout and behaviour of a
|
|
117
|
+
* component laid out in a grid container.
|
|
118
|
+
*/
|
|
119
|
+
export interface IGridModelChildItem extends GridModelCoordinates {
|
|
120
|
+
childId?: string[];
|
|
121
|
+
closeable?: boolean;
|
|
122
|
+
componentInstanceId?: string;
|
|
123
|
+
contentVisible?: boolean;
|
|
124
|
+
dropTarget?: boolean | string;
|
|
125
|
+
fixed?: boolean;
|
|
126
|
+
header?: boolean;
|
|
127
|
+
height?: number;
|
|
128
|
+
id: string;
|
|
129
|
+
minHeight?: number;
|
|
130
|
+
minWidth?: number;
|
|
131
|
+
stackId?: string;
|
|
132
|
+
resizeable?: GridModelItemResizeable;
|
|
133
|
+
title?: string;
|
|
134
|
+
type: GridModelItemType;
|
|
135
|
+
width?: number;
|
|
136
|
+
}
|
|
137
|
+
export interface IPlaceholder extends IGridModelChildItem {
|
|
138
|
+
type: "placeholder";
|
|
139
|
+
}
|
|
140
|
+
export type GridChildItemStyle = Omit<CSSProperties, "gridArea"> & {
|
|
141
|
+
gridArea: string;
|
|
142
|
+
};
|
|
143
|
+
type StackedGridModelChildItem = GridModelChildItem & {
|
|
144
|
+
stackId: string;
|
|
145
|
+
};
|
|
146
|
+
export declare const isStackedItem: (i: GridModelChildItem) => i is StackedGridModelChildItem;
|
|
147
|
+
export type GridModelStackedChildItem = GridModelChildItem & {
|
|
148
|
+
type: "stacked-content";
|
|
149
|
+
};
|
|
150
|
+
export declare class GridModelChildItem implements IGridModelChildItem {
|
|
151
|
+
#private;
|
|
152
|
+
id: string;
|
|
153
|
+
column: GridModelPosition;
|
|
154
|
+
componentInstanceId?: string;
|
|
155
|
+
contentDetached?: boolean;
|
|
156
|
+
contentVisible?: boolean;
|
|
157
|
+
dropTarget?: boolean | string;
|
|
158
|
+
header?: boolean;
|
|
159
|
+
height?: number;
|
|
160
|
+
horizontalSplitter: boolean;
|
|
161
|
+
minHeight?: number;
|
|
162
|
+
minWidth?: number;
|
|
163
|
+
stackId?: string;
|
|
164
|
+
resizeable: GridModelItemResizeable;
|
|
165
|
+
row: GridModelPosition;
|
|
166
|
+
title?: string;
|
|
167
|
+
type: GridModelItemType;
|
|
168
|
+
verticalSplitter: boolean;
|
|
169
|
+
width?: number;
|
|
170
|
+
constructor({ componentInstanceId, header, height, id, minHeight, minWidth, row, column, dropTarget, stackId, resizeable, title, type, width, contentVisible, }: OptionalProperty<IGridModelChildItem, "type">);
|
|
171
|
+
get dragging(): boolean;
|
|
172
|
+
set dragging(isDragging: boolean);
|
|
173
|
+
get gridArea(): string;
|
|
174
|
+
}
|
|
175
|
+
export type AriaOrientation = "horizontal" | "vertical";
|
|
176
|
+
export type SplitterAlign = "start" | "end";
|
|
177
|
+
export interface ISplitter extends GridLayoutModelCoordinates {
|
|
178
|
+
align: SplitterAlign;
|
|
179
|
+
ariaOrientation: AriaOrientation;
|
|
180
|
+
controls: string;
|
|
181
|
+
id: string;
|
|
182
|
+
orientation: GridLayoutResizeDirection;
|
|
183
|
+
/**
|
|
184
|
+
* Index values of the two grid tracks (column or row) whose
|
|
185
|
+
* dimension (width for columns, height for rows) can be
|
|
186
|
+
* manipulated with this splitter. The tracks will usually,
|
|
187
|
+
* but not always, be adjacent.
|
|
188
|
+
*/
|
|
189
|
+
resizedGridTracks: [number, number];
|
|
190
|
+
resizedChildItems: {
|
|
191
|
+
before: string[];
|
|
192
|
+
after: string[];
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export type TabStateEvent = (tabState: TabState) => void;
|
|
196
|
+
export type TabStateTabEvents = {
|
|
197
|
+
"active-change": TabStateEvent;
|
|
198
|
+
"tab-added": (tabState: TabState, tab: TabStateTab) => void;
|
|
199
|
+
"tab-detached": TabStateEvent;
|
|
200
|
+
"tabs-change": (tabsId: string, active: number, tabs: TabStateTab[]) => void;
|
|
201
|
+
"tabs-removed": (tabsId: string) => void;
|
|
202
|
+
};
|
|
203
|
+
export type TabStateTab = {
|
|
204
|
+
id: string;
|
|
205
|
+
label: string;
|
|
206
|
+
};
|
|
207
|
+
export declare class TabState extends EventEmitter<TabStateTabEvents> {
|
|
208
|
+
id: string;
|
|
209
|
+
active: number;
|
|
210
|
+
tabs: TabStateTab[];
|
|
211
|
+
detachedTab: TabStateTab | undefined;
|
|
212
|
+
constructor(id: string, active: number, tabs: TabStateTab[]);
|
|
213
|
+
setActiveTab(value: string): void;
|
|
214
|
+
setActiveTabById(id: string): void;
|
|
215
|
+
/**
|
|
216
|
+
* A Tab is detached when a drag operation commences. It is removed from Tabstrip, but associated component
|
|
217
|
+
* remains in DOM. The 'next' tab is selected and the associated TabPanel made visible. The tab panel associated
|
|
218
|
+
* with the detached tab remains below the selected tab panel. This allows a dragged tab panel to be repositioned
|
|
219
|
+
* vis drag drop without removing it from DOM, triggering React unmount/remount.
|
|
220
|
+
*/
|
|
221
|
+
detachTab(value: string): void;
|
|
222
|
+
restoreDetachedTab(value: string): void;
|
|
223
|
+
setNextActiveTab(): void;
|
|
224
|
+
moveTab(tab: TabStateTab, { position, target }: DropPosition, activateTab?: boolean): void;
|
|
225
|
+
moveTabById(tabId: string, targetId: string, position: "after" | "before", activateTab?: boolean): void;
|
|
226
|
+
addTab(tab: TabStateTab, dropPosition?: DropPosition): void;
|
|
227
|
+
removeTab(id: string): void;
|
|
228
|
+
renameTab(id: string, label: string): void;
|
|
229
|
+
get activeTab(): TabStateTab;
|
|
230
|
+
private getNextActiveTab;
|
|
231
|
+
private indexOfTab;
|
|
232
|
+
}
|
|
233
|
+
export type TrackType = "column" | "row";
|
|
234
|
+
export type GridTrackResizeHandler = (trackType: TrackType, tracks: GridTrack[]) => void;
|
|
235
|
+
export type GridTrackEvents = {
|
|
236
|
+
"grid-track-added": GridTrackAddedHandler;
|
|
237
|
+
"grid-track-resize": GridTrackResizeHandler;
|
|
238
|
+
};
|
|
239
|
+
export type GridTrackResizeConstraint = {
|
|
240
|
+
minimum: number;
|
|
241
|
+
trackIndices: number[];
|
|
242
|
+
};
|
|
243
|
+
export declare class GridTrack {
|
|
244
|
+
#private;
|
|
245
|
+
static fromTrackSize: (trackSize: TrackSize) => GridTrack;
|
|
246
|
+
constructor(trackSize: TrackSize);
|
|
247
|
+
get hasBeenMeasured(): boolean;
|
|
248
|
+
get isFraction(): boolean;
|
|
249
|
+
get isPixelValue(): boolean;
|
|
250
|
+
get isMeasured(): boolean;
|
|
251
|
+
get measuredValue(): number;
|
|
252
|
+
set measuredValue(value: number);
|
|
253
|
+
convertUnitsToPixels(): void;
|
|
254
|
+
get hasNumericValue(): boolean;
|
|
255
|
+
get numericValue(): number;
|
|
256
|
+
get trackSize(): TrackSize;
|
|
257
|
+
set trackSize(trackSize: TrackSize);
|
|
258
|
+
addFraction(trackSize: TrackSize): void;
|
|
259
|
+
increment(value: number): void;
|
|
260
|
+
toString: () => TrackSize;
|
|
261
|
+
}
|
|
262
|
+
type GridTrackCheckpoint = {
|
|
263
|
+
readonly track: GridTrack;
|
|
264
|
+
readonly measuredValue: number;
|
|
265
|
+
readonly size: TrackSize;
|
|
266
|
+
};
|
|
267
|
+
type GridTracksCheckpoint = {
|
|
268
|
+
readonly columns: readonly GridTrackCheckpoint[];
|
|
269
|
+
readonly rows: readonly GridTrackCheckpoint[];
|
|
270
|
+
};
|
|
271
|
+
export declare class GridTracks extends EventEmitter<GridTrackEvents> {
|
|
272
|
+
#private;
|
|
273
|
+
private gridId;
|
|
274
|
+
constructor(gridId: string, columns: TrackSize[], rows: TrackSize[]);
|
|
275
|
+
get columns(): TrackSize[];
|
|
276
|
+
set columns(columns: TrackSize[]);
|
|
277
|
+
get rows(): TrackSize[];
|
|
278
|
+
set rows(rows: TrackSize[]);
|
|
279
|
+
get colCount(): number;
|
|
280
|
+
get rowCount(): number;
|
|
281
|
+
getTracks(trackType: TrackType): GridTrack[];
|
|
282
|
+
createCheckpoint(): GridTracksCheckpoint;
|
|
283
|
+
restoreCheckpoint({ columns, rows }: GridTracksCheckpoint): void;
|
|
284
|
+
/**
|
|
285
|
+
* Set the numeric track values from values read from DOM. This is invoked from a callbackRef
|
|
286
|
+
* as soom as GridLayout container is rendered into dom.
|
|
287
|
+
*/
|
|
288
|
+
measure(trackType: TrackType): void;
|
|
289
|
+
/**
|
|
290
|
+
* The immutable measurement input for a track type. Measured values are -1
|
|
291
|
+
* for tracks that have not been measured.
|
|
292
|
+
*/
|
|
293
|
+
getTrackMetrics(trackType: TrackType): TrackMetrics;
|
|
294
|
+
private readGeometryTracks;
|
|
295
|
+
/**
|
|
296
|
+
* Run a pure track transition. Measurement is the only browser input the
|
|
297
|
+
* geometry needs; when a transition reports that it is missing, tracks are
|
|
298
|
+
* measured and the transition is retried.
|
|
299
|
+
*/
|
|
300
|
+
runTrackGeometry<T>(trackType: TrackType, compute: (tracks: readonly GridGeometryTrack[]) => GridGeometryResult<T>): GridGeometryResult<T>;
|
|
301
|
+
private runTrackTransition;
|
|
302
|
+
/**
|
|
303
|
+
* Hydrate a pure track transition. Track instances are reused wherever the
|
|
304
|
+
* transition identifies the track they derive from, so that measured values
|
|
305
|
+
* survive transitions which leave a track untouched.
|
|
306
|
+
*/
|
|
307
|
+
applyTrackTransition(trackType: TrackType, { sources, tracks: nextTracks }: GridTrackTransition): void;
|
|
308
|
+
getBisectingTrack(trackType: TrackType, startIndex: number, endIndex: number): number;
|
|
309
|
+
/**
|
|
310
|
+
* Split a single track into 2 equal sized tracks
|
|
311
|
+
*/
|
|
312
|
+
splitTrack(trackType: TrackType, trackIndex: number): void;
|
|
313
|
+
/**
|
|
314
|
+
* Given multiple tracks (columns/rows), create a new grid line that exactly bisects
|
|
315
|
+
* given tracks.
|
|
316
|
+
*/
|
|
317
|
+
splitTracks(trackType: TrackType, fromTrackLine: number, toTrackLine: number): number;
|
|
318
|
+
/**
|
|
319
|
+
* In the trackInsertionPosition, the index always indicates where the new track
|
|
320
|
+
* will be inserted. The position indicates where it falls, conceptually, in relation
|
|
321
|
+
* to the existing two tracks that it will fall between. It will overlap one, but not
|
|
322
|
+
* both of the existing track positions.
|
|
323
|
+
*/
|
|
324
|
+
insertTrack(trackType: TrackType, { index, position }: TrackInsertionPosition, trackSize: number): void;
|
|
325
|
+
removeTrack(trackType: TrackType, index: number, assignDirection?: AssignDirection): void;
|
|
326
|
+
resizeTo(trackType: TrackType, trackIndex: number, value: TrackSize): void;
|
|
327
|
+
resizeBy(trackType: "row" | "column", trackIndex: number, contraTrackIndex: number, value: number): void;
|
|
328
|
+
resizeGroupsProportionally(trackType: TrackType, beforeTrackIndices: number[], afterTrackIndices: number[], value: number, beforeConstraints?: GridTrackResizeConstraint[], afterConstraints?: GridTrackResizeConstraint[], initialTrackSizes?: number[]): void;
|
|
329
|
+
getProportionalResizeAllowance(trackType: TrackType, trackIndices: number[], constraints: GridTrackResizeConstraint[]): number;
|
|
330
|
+
get css(): Pick<CSSProperties, "gridTemplateColumns" | "gridTemplateRows">;
|
|
331
|
+
serialize(): {
|
|
332
|
+
cols: TrackSize[];
|
|
333
|
+
rows: TrackSize[];
|
|
334
|
+
};
|
|
335
|
+
toString(): string;
|
|
336
|
+
}
|
|
337
|
+
type GridModelChildItemCheckpoint = {
|
|
338
|
+
readonly item: GridModelChildItem;
|
|
339
|
+
readonly state: {
|
|
340
|
+
readonly column: GridModelPosition;
|
|
341
|
+
readonly contentDetached: boolean | undefined;
|
|
342
|
+
readonly contentVisible: boolean | undefined;
|
|
343
|
+
readonly dragging: boolean;
|
|
344
|
+
readonly dropTarget: boolean | string | undefined;
|
|
345
|
+
readonly header: boolean | undefined;
|
|
346
|
+
readonly height: number | undefined;
|
|
347
|
+
readonly horizontalSplitter: boolean;
|
|
348
|
+
readonly minHeight: number | undefined;
|
|
349
|
+
readonly minWidth: number | undefined;
|
|
350
|
+
readonly resizeable: GridModelItemResizeable;
|
|
351
|
+
readonly row: GridModelPosition;
|
|
352
|
+
readonly stackId: string | undefined;
|
|
353
|
+
readonly title: string | undefined;
|
|
354
|
+
readonly type: GridModelItemType;
|
|
355
|
+
readonly verticalSplitter: boolean;
|
|
356
|
+
readonly width: number | undefined;
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
type TabStateCheckpoint = {
|
|
360
|
+
readonly active: number;
|
|
361
|
+
readonly detachedTab: TabStateTab | undefined;
|
|
362
|
+
readonly tabs: readonly TabStateTab[];
|
|
363
|
+
readonly tabState: TabState;
|
|
364
|
+
};
|
|
365
|
+
export type GridModelCheckpoint = {
|
|
366
|
+
readonly childItems: readonly GridModelChildItemCheckpoint[];
|
|
367
|
+
readonly stackStates: readonly (readonly [StackId, GridStackState])[];
|
|
368
|
+
readonly tabStates: readonly TabStateCheckpoint[];
|
|
369
|
+
readonly tracks: GridTracksCheckpoint;
|
|
370
|
+
};
|
|
371
|
+
export declare class GridModel extends EventEmitter<GridModelEvents> {
|
|
372
|
+
#private;
|
|
373
|
+
id: string;
|
|
374
|
+
tracks: GridTracks;
|
|
375
|
+
createCheckpoint(): GridModelCheckpoint;
|
|
376
|
+
restoreCheckpoint({ childItems, stackStates, tabStates, tracks, }: GridModelCheckpoint): void;
|
|
377
|
+
constructor(id: string, { cols, gridLayoutItems, rows }: GridLayoutDescriptor);
|
|
378
|
+
get childItems(): GridModelChildItem[];
|
|
379
|
+
private handleTabsChange;
|
|
380
|
+
private handleTabsRemoved;
|
|
381
|
+
private handleTabSelectionChange;
|
|
382
|
+
private handleTabAdded;
|
|
383
|
+
private handleTabDetached;
|
|
384
|
+
getTabState: (tabsId: string, fallbackAction?: "throw" | "create") => TabState;
|
|
385
|
+
setTabState(stackId: string, childItems: GridModelChildItem[], activeItem?: number): TabState;
|
|
386
|
+
/**
|
|
387
|
+
* Canonical stack state. Membership, order, identity and selection are read
|
|
388
|
+
* from the canonical store — they are never re-derived from the mutable
|
|
389
|
+
* runtime projection once a stack exists. Placement and durable layout
|
|
390
|
+
* metadata are read from the grid item, which the geometry engine owns.
|
|
391
|
+
*/
|
|
392
|
+
getStackState: (stackId: StackId) => GridStackState;
|
|
393
|
+
/** Every stack currently present in the layout, in child item order. */
|
|
394
|
+
getStackStates(): GridStackState[];
|
|
395
|
+
/**
|
|
396
|
+
* Project a canonical stack transition onto the compatibility runtime. The
|
|
397
|
+
* legacy TabState is written from canonical state, never the other way
|
|
398
|
+
* round; observers are then notified exactly as the legacy engine notified
|
|
399
|
+
* them, for presentation only.
|
|
400
|
+
*/
|
|
401
|
+
applyStackTransition(transition: GridStackTransition): void;
|
|
402
|
+
/** Create a stack from two existing grid items. */
|
|
403
|
+
createStack(targetId: GridItemId, itemId: GridItemId, stackId?: StackId): GridStackResult<GridStackTransition>;
|
|
404
|
+
/** Register a new grid item and add it to a stack in one transition. */
|
|
405
|
+
addStackItem(stackId: StackId, childItem: GridModelChildItem, dropPosition?: DropPosition): GridStackResult<GridStackTransition>;
|
|
406
|
+
/** Add an existing grid item to a stack. */
|
|
407
|
+
addStackMember(stackId: StackId, itemId: GridItemId, dropPosition?: DropPosition): GridStackResult<GridStackTransition>;
|
|
408
|
+
/** Remove a member from a stack, dissolving the stack when it empties. */
|
|
409
|
+
removeStackItem(stackId: StackId, itemId: GridItemId): GridStackResult<GridStackTransition>;
|
|
410
|
+
/** Select a stack member by its stable id. */
|
|
411
|
+
selectStackItem(stackId: StackId, itemId: GridItemId): GridStackResult<GridStackTransition>;
|
|
412
|
+
/** Move a stack member relative to another member. */
|
|
413
|
+
reorderStackItem(stackId: StackId, request: {
|
|
414
|
+
activate?: boolean;
|
|
415
|
+
itemId: GridItemId;
|
|
416
|
+
placement: "after" | "before";
|
|
417
|
+
targetItemId: GridItemId;
|
|
418
|
+
}): GridStackResult<GridStackTransition>;
|
|
419
|
+
activateStackedChildItem(stackId: string, { id }: TabStateTab): void;
|
|
420
|
+
detachStackedChildItem(stackId: string, { id }: TabStateTab): void;
|
|
421
|
+
/**
|
|
422
|
+
* A tab is detached when a drag operation commences: it is removed from the
|
|
423
|
+
* TabStrip but its content remains in the DOM. Selection moves to the
|
|
424
|
+
* neighbouring member, chosen from canonical order.
|
|
425
|
+
*/
|
|
426
|
+
detachTab(stackId: StackId, label: string): void;
|
|
427
|
+
restoreDetachedTab(stackId: StackId, label: string): void;
|
|
428
|
+
moveItemWithinTabs(tabsId: string, tab: TabStateTab, { position, target }: DropPosition, selectMovedTab: boolean): void;
|
|
429
|
+
moveItemBetweenTabs(fromTabsId: string, toTabsId: string, tab: TabStateTab, dropPosition: DropPosition): void;
|
|
430
|
+
notifyChange(): void;
|
|
431
|
+
restoreLayout({ cols, gridLayoutItems, rows }: GridLayoutDescriptor): void;
|
|
432
|
+
toGridLayoutDescriptor(): GridLayoutDescriptor;
|
|
433
|
+
splitGridTrack(trackType: TrackType, trackIndex: number): void;
|
|
434
|
+
splitGridTracks(trackType: TrackType, fromTrackLine: number, toTrackLine: number): number;
|
|
435
|
+
private updateChildItemsToAccommodateNewTrack;
|
|
436
|
+
insertGridTrack(trackType: TrackType, { index, position }: TrackInsertionPosition, trackSize: number): void;
|
|
437
|
+
removeGridTrack(trackType: TrackType, trackIndex: number, assignDirection?: AssignDirection, updateChildItems?: boolean): void;
|
|
438
|
+
/**
|
|
439
|
+
* Read an immutable geometry snapshot. This is the input to every pure
|
|
440
|
+
* geometry transition; the model itself is never read by those transitions.
|
|
441
|
+
*/
|
|
442
|
+
toGeometry(): GridGeometry;
|
|
443
|
+
/** The current measurement input for both track types. */
|
|
444
|
+
getMeasurements(): GridMeasurements;
|
|
445
|
+
/**
|
|
446
|
+
* Run a pure geometry transition, measuring tracks and retrying once if the
|
|
447
|
+
* transition reports that it needs measurement it was not given.
|
|
448
|
+
*/
|
|
449
|
+
runGeometry<T>(compute: (measurements: GridMeasurements) => GridGeometryResult<T>): GridGeometryResult<T>;
|
|
450
|
+
/**
|
|
451
|
+
* Hydrate the item positions described by a pure geometry into the model.
|
|
452
|
+
*/
|
|
453
|
+
applyGeometryPositions(geometry: GridGeometry): void;
|
|
454
|
+
applyUpdates(updates: GridItemUpdate[]): void;
|
|
455
|
+
private addChildItems;
|
|
456
|
+
addChildItem(childItem: GridModelChildItem, dropPosition?: DropPosition): void;
|
|
457
|
+
updateChildTitle(childItemId: string, title: string): void;
|
|
458
|
+
updateChildColumn(childItemId: string, { start, end }: GridModelPosition): void;
|
|
459
|
+
updateChildRow(childItemId: string, { start, end }: GridModelPosition): void;
|
|
460
|
+
/**
|
|
461
|
+
* How we handle removal depends on context (the remove reason).
|
|
462
|
+
* If the child item is being deleted, we clear all references to the
|
|
463
|
+
* item in our internal structures. If the item is being dragged, we
|
|
464
|
+
* can expect it to be dropped again. We preserve some references,
|
|
465
|
+
* but mark the item as dragging.
|
|
466
|
+
*/
|
|
467
|
+
removeChildItem(childItemId: string, reason: GridItemRemoveReason): void;
|
|
468
|
+
stackChildItems(targetId: string, stackedChildId: string): void;
|
|
469
|
+
getChildItem(childItemId: string, throwIfNotFound: true): GridModelChildItem;
|
|
470
|
+
getChildItem(childItemId: string, throwIfNotFound?: false): GridModelChildItem | undefined;
|
|
471
|
+
getStackedChildItems(): Map<string, StackedGridModelChildItem[]>;
|
|
472
|
+
getStackedChildItems(stackId: string): GridModelChildItem[];
|
|
473
|
+
validateChildId(childItemId: string): string;
|
|
474
|
+
clearPlaceholders(): void;
|
|
475
|
+
findUnusedGridLines(): number[][];
|
|
476
|
+
createPlaceholders(): void;
|
|
477
|
+
/**
|
|
478
|
+
* Hydrate the placeholders described by a pure placeholder transition.
|
|
479
|
+
*/
|
|
480
|
+
applyPlaceholderTransition({ added, removedIds, }: {
|
|
481
|
+
added: readonly GridGeometryItem[];
|
|
482
|
+
removedIds: readonly string[];
|
|
483
|
+
}): void;
|
|
484
|
+
getPlaceholders(): GridModelChildItem[];
|
|
485
|
+
getSplitters(): ISplitter[];
|
|
486
|
+
toDebugString(): string;
|
|
487
|
+
/**
|
|
488
|
+
* Given a column, return all childItems starting at that column
|
|
489
|
+
*/
|
|
490
|
+
findByColumnStart(col: number, childItems?: GridModelChildItem[]): GridModelChildItem[] | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* Given a column, return all childItems ending at that column
|
|
493
|
+
*/
|
|
494
|
+
findByColumnEnd(col: number, childItems?: GridModelChildItem[]): GridModelChildItem[] | undefined;
|
|
495
|
+
/**
|
|
496
|
+
* Given a row, return all childItems starting at that row
|
|
497
|
+
*/
|
|
498
|
+
findByRowStart(row: number, childItems?: GridModelChildItem[]): GridModelChildItem[] | undefined;
|
|
499
|
+
/**
|
|
500
|
+
* Given a row, return all childItems ending at that row
|
|
501
|
+
*/
|
|
502
|
+
findByRowEnd(row: number, childItems?: GridModelChildItem[]): GridModelChildItem[] | undefined;
|
|
503
|
+
}
|
|
504
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
export interface GridPlaceholderProps extends Omit<HTMLAttributes<HTMLDivElement>, "onDrop"> {
|
|
3
|
+
debugLabel?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const GridPlaceholder: ({ ...htmlAttributes }: GridPlaceholderProps) => import("react").JSX.Element;
|