@vuu-ui/vuu-layout 0.8.12 → 0.8.13

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.
@@ -1,17 +1,16 @@
1
- import { LayoutMetadata } from "@vuu-ui/vuu-shell";
2
- import { LayoutJSON, LayoutPersistenceManager } from "@vuu-ui/vuu-layout";
1
+ import { LayoutMetadata, LayoutMetadataDto } from "@vuu-ui/vuu-shell";
2
+ import { ApplicationJSON, LayoutJSON, LayoutPersistenceManager } from "@vuu-ui/vuu-layout";
3
3
  export declare class LocalLayoutPersistenceManager implements LayoutPersistenceManager {
4
4
  #private;
5
5
  constructor(urlKey?: string);
6
- createLayout(metadata: Omit<LayoutMetadata, "id">, layout: LayoutJSON): Promise<string>;
7
- updateLayout(id: string, newMetadata: Omit<LayoutMetadata, "id">, newLayout: LayoutJSON): Promise<void>;
6
+ createLayout(metadata: LayoutMetadataDto, layout: LayoutJSON): Promise<LayoutMetadata>;
7
+ updateLayout(id: string, newMetadata: LayoutMetadataDto, newLayout: LayoutJSON): Promise<void>;
8
8
  deleteLayout(id: string): Promise<void>;
9
9
  loadLayout(id: string): Promise<LayoutJSON>;
10
10
  loadMetadata(): Promise<LayoutMetadata[]>;
11
- loadApplicationLayout(): Promise<LayoutJSON>;
12
- saveApplicationLayout(layout: LayoutJSON): Promise<void>;
11
+ loadApplicationJSON(): Promise<ApplicationJSON>;
12
+ saveApplicationJSON(applicationJSON: ApplicationJSON): Promise<void>;
13
13
  private loadLayouts;
14
- private appendAndPersist;
15
14
  private saveLayoutsWithMetadata;
16
15
  private validateIds;
17
16
  private validateId;
@@ -0,0 +1,21 @@
1
+ import { LayoutMetadata, LayoutMetadataDto } from "@vuu-ui/vuu-shell";
2
+ import { LayoutPersistenceManager } from "./LayoutPersistenceManager";
3
+ import { ApplicationJSON, LayoutJSON } from "../layout-reducer";
4
+ export type CreateLayoutResponseDto = {
5
+ metadata: LayoutMetadata;
6
+ };
7
+ export type GetLayoutResponseDto = {
8
+ definition: LayoutJSON;
9
+ };
10
+ export type GetApplicationResponseDto = {
11
+ definition: ApplicationJSON;
12
+ };
13
+ export declare class RemoteLayoutPersistenceManager implements LayoutPersistenceManager {
14
+ createLayout(metadata: LayoutMetadataDto, layout: LayoutJSON): Promise<LayoutMetadata>;
15
+ updateLayout(id: string, metadata: LayoutMetadataDto, newLayoutJson: LayoutJSON): Promise<void>;
16
+ deleteLayout(id: string): Promise<void>;
17
+ loadLayout(id: string): Promise<LayoutJSON>;
18
+ loadMetadata(): Promise<LayoutMetadata[]>;
19
+ saveApplicationJSON(applicationJSON: ApplicationJSON): Promise<void>;
20
+ loadApplicationJSON(): Promise<ApplicationJSON>;
21
+ }
@@ -0,0 +1,4 @@
1
+ import { ApplicationJSON, LayoutJSON } from "../layout-reducer";
2
+ export declare const warningLayout: LayoutJSON;
3
+ export declare const loadingApplicationJson: Readonly<ApplicationJSON>;
4
+ export declare const defaultApplicationJson: ApplicationJSON;
@@ -1,4 +1,5 @@
1
- export * from "./data";
1
+ export * from "./defaultApplicationJson";
2
2
  export * from "./LayoutPersistenceManager";
3
3
  export * from "./LocalLayoutPersistenceManager";
4
+ export * from "./RemoteLayoutPersistenceManager";
4
5
  export * from "./useLayoutContextMenuItems";
@@ -1,8 +1,6 @@
1
1
  import { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-data-types";
2
- import { ReactElement } from "react";
3
- export declare const useLayoutContextMenuItems: () => {
2
+ import { SetDialog } from "@vuu-ui/vuu-popups";
3
+ export declare const useLayoutContextMenuItems: (setDialogState: SetDialog) => {
4
4
  buildMenuOptions: MenuBuilder<string, unknown>;
5
- dialogContent: ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
6
- handleCloseDialog: () => void;
7
5
  handleMenuAction: MenuActionHandler;
8
6
  };
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, ReactElement } from "react";
2
- import { DragStartAction, LayoutReducerAction, SaveAction } from "../layout-reducer";
3
- export type LayoutProviderDispatch = Dispatch<LayoutReducerAction | SaveAction | DragStartAction>;
2
+ import { DragStartAction, LayoutReducerAction, QueryAction, SaveAction } from "../layout-reducer";
3
+ export type LayoutProviderDispatch = Dispatch<LayoutReducerAction | SaveAction | DragStartAction | QueryAction>;
4
4
  export interface LayoutProviderContextProps {
5
5
  createNewChild?: (index?: number) => ReactElement;
6
6
  dispatchLayoutProvider: LayoutProviderDispatch;
@@ -17,6 +17,16 @@ export interface LayoutRoot extends WithProps {
17
17
  children?: ReactElement[];
18
18
  type: string;
19
19
  }
20
+ export interface ApplicationSettings {
21
+ leftNav?: {
22
+ activeTabIndex: number;
23
+ expanded: boolean;
24
+ };
25
+ }
26
+ export interface ApplicationJSON {
27
+ layout: LayoutJSON;
28
+ settings?: ApplicationSettings;
29
+ }
20
30
  export interface LayoutJSON extends WithType {
21
31
  active?: number;
22
32
  children?: LayoutJSON[];
@@ -41,6 +51,7 @@ export declare const LayoutActionType: {
41
51
  readonly MAXIMIZE: "maximize";
42
52
  readonly MINIMIZE: "minimize";
43
53
  readonly MOVE_CHILD: "move-child";
54
+ readonly QUERY: "query";
44
55
  readonly REMOVE: "remove";
45
56
  readonly REPLACE: "replace";
46
57
  readonly RESTORE: "restore";
@@ -77,6 +88,11 @@ export type MoveChildAction = {
77
88
  path: string;
78
89
  type: typeof LayoutActionType.MOVE_CHILD;
79
90
  };
91
+ export type QueryAction = {
92
+ path?: string;
93
+ query: string;
94
+ type: typeof LayoutActionType.QUERY;
95
+ };
80
96
  export type RemoveAction = {
81
97
  path?: string;
82
98
  type: typeof LayoutActionType.REMOVE;
@@ -161,7 +177,7 @@ export type DragStartAction = {
161
177
  type: typeof LayoutActionType.DRAG_START;
162
178
  };
163
179
  export type LayoutLevelChange = "switch-active-tab" | "edit-feature-title" | "save-feature-props" | "resize-component" | "remove-component" | "drag-drop-operation";
164
- export type ApplicationLevelChange = "switch-active-layout" | "open-layout" | "close-layout" | "rename-layout";
180
+ export type ApplicationLevelChange = "switch-active-layout" | "open-layout" | "close-layout" | "rename-layout" | "resize-application-chrome";
165
181
  export type LayoutChangeReason = LayoutLevelChange | ApplicationLevelChange;
166
182
  export type LayoutChangeHandler = (layout: LayoutJSON, layoutChangeReason: LayoutChangeReason) => void;
167
183
  export declare const isApplicationLevelChange: (layoutChangeReason: LayoutChangeReason) => layoutChangeReason is ApplicationLevelChange;
@@ -1,6 +1,7 @@
1
1
  import { dimension } from "@vuu-ui/vuu-utils";
2
2
  import React, { CSSProperties, ReactElement } from "react";
3
3
  import { ComponentWithId } from "../registry/ComponentRegistry";
4
+ import { TabLabelFactory } from "../stack";
4
5
  import { LayoutJSON, LayoutModel, layoutType } from "./layoutTypes";
5
6
  export declare const getManagedDimension: (style: CSSProperties) => [dimension, dimension];
6
7
  export declare const applyLayoutProps: (component: ReactElement, path?: string) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -29,3 +30,9 @@ export declare function componentToJson(component: ReactElement): LayoutJSON;
29
30
  export declare function serializeProps(props?: LayoutProps): {
30
31
  [key: string]: any;
31
32
  } | undefined;
33
+ export type LayoutQuery = "PARENT_CONTAINER";
34
+ export declare const layoutQuery: (query: LayoutQuery, path?: string, layoutRoot?: ReactElement) => {
35
+ parentContainerId: any;
36
+ parentContainerType: string | undefined;
37
+ } | undefined;
38
+ export declare const getDefaultTabLabel: TabLabelFactory;
@@ -1,3 +1,3 @@
1
- import React, { ReactElement } from 'react';
2
- import { RemoveAction } from './layoutTypes';
1
+ import React, { ReactElement } from "react";
2
+ import { RemoveAction } from "./layoutTypes";
3
3
  export declare function removeChild(layoutRoot: ReactElement, { path }: RemoveAction): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -6,4 +6,4 @@ export interface LayoutSpec {
6
6
  flexDirection: "column" | "row";
7
7
  showTabs?: boolean;
8
8
  }
9
- export declare function wrap(container: ReactElement, existingComponent: any, newComponent: any, pos: DropPos, clientRect?: DropTarget["clientRect"], dropRect?: DropTarget["dropRect"]): ReactElement;
9
+ export declare function wrap(container: ReactElement, existingComponent: ReactElement, newComponent: any, pos: DropPos, clientRect?: DropTarget["clientRect"], dropRect?: DropTarget["dropRect"]): ReactElement;
@@ -1,6 +1,9 @@
1
1
  import React, { SyntheticEvent } from "react";
2
2
  import { ViewAction } from "./viewTypes";
3
- export type ViewDispatch = <Action extends ViewAction = ViewAction>(action: Action, evt?: SyntheticEvent) => Promise<boolean | void>;
3
+ export type QueryReponse = {
4
+ [key: string]: unknown;
5
+ };
6
+ export type ViewDispatch = <Action extends ViewAction = ViewAction>(action: Action, evt?: SyntheticEvent) => Promise<boolean | QueryReponse | void>;
4
7
  /**
5
8
  * This API is available to any Feature hosted within Vuu (as all Features are wrapped
6
9
  * with View component). It offers metadata about the View as well as access to the
@@ -8,7 +11,7 @@ export type ViewDispatch = <Action extends ViewAction = ViewAction>(action: Acti
8
11
  */
9
12
  export interface ViewContextAPI {
10
13
  /**
11
- * disdpatcher for View actions. These are a subset of LayoutActions, specifically for
14
+ * dispatcher for View actions. These are a subset of LayoutActions, specifically for
12
15
  * View manipulation
13
16
  */
14
17
  dispatch?: ViewDispatch | null;
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent, HTMLAttributes } from "react";
2
2
  import { HeaderProps } from "../layout-header";
3
- import { AddToolbarContributionViewAction, MaximizeAction, MinimizeAction, MousedownViewAction, RemoveAction, RemoveToolbarContributionViewAction, RestoreAction, TearoutAction } from "../layout-reducer";
4
- export type ViewAction = MaximizeAction | MinimizeAction | MousedownViewAction | RemoveAction | RestoreAction | TearoutAction | AddToolbarContributionViewAction | RemoveToolbarContributionViewAction;
3
+ import { AddToolbarContributionViewAction, MaximizeAction, MinimizeAction, MousedownViewAction, QueryAction, RemoveAction, RemoveToolbarContributionViewAction, RestoreAction, TearoutAction } from "../layout-reducer";
4
+ export type ViewAction = MaximizeAction | MinimizeAction | MousedownViewAction | QueryAction | RemoveAction | RestoreAction | TearoutAction | AddToolbarContributionViewAction | RemoveToolbarContributionViewAction;
5
5
  export type ResizeStrategy = "defer" | "responsive";
6
6
  export interface ViewProps extends HTMLAttributes<HTMLDivElement> {
7
7
  Header?: FunctionComponent<HeaderProps>;
@@ -2,6 +2,12 @@ import { HTMLAttributes } from "react";
2
2
  import { MeasuredSize } from "./useMeasuredContainer";
3
3
  import "./MeasuredContainer.css";
4
4
  export interface MeasuredContainerProps extends HTMLAttributes<HTMLDivElement> {
5
+ /**
6
+ * A numeric value for height will result in a fixed height. To adapt to container
7
+ * use either a percentage height or 'auto'. Always use 'auto' when rendering
8
+ * within a column based flex container, together with a flex value (use the
9
+ * --vuuMeasuredContainer-flex CSS custom property))
10
+ */
5
11
  height?: number | string;
6
12
  onResize?: (size: MeasuredSize) => void;
7
13
  width?: number | string;
@@ -12,7 +12,7 @@ export declare const useOverflowContainer: ({ allowDragDrop, itemCount, onMoveIt
12
12
  draggedItemIndex?: number | undefined;
13
13
  isDragging: boolean;
14
14
  isScrolling: import("react").RefObject<boolean>;
15
- revealOverflowedItems: boolean;
15
+ revealOverflowedItems?: boolean | undefined;
16
16
  menuActionHandler: MenuActionHandler;
17
17
  menuBuilder: MenuBuilder<string, unknown>;
18
18
  onItemMouseDown: import("react").MouseEventHandler<Element> | undefined;
@@ -0,0 +1,6 @@
1
+ import { HTMLAttributes } from "react";
2
+ import "./LayoutStartPanel.css";
3
+ export interface LayoutStartPanelProps extends HTMLAttributes<HTMLDivElement> {
4
+ label?: string;
5
+ }
6
+ export declare const LayoutStartPanel: (htmlAttributes: LayoutStartPanelProps) => JSX.Element | null;
@@ -1,12 +1,18 @@
1
- import { HTMLAttributes } from "react";
1
+ /// <reference types="react" />
2
+ import { ViewProps } from "@vuu-ui/vuu-layout";
2
3
  import "./Placeholder.css";
3
- export interface PlaceholderProps extends HTMLAttributes<HTMLDivElement> {
4
+ export interface PlaceholderProps extends ViewProps {
4
5
  closeable?: boolean;
5
6
  flexFill?: boolean;
6
7
  resizeable?: boolean;
8
+ showStartMenu?: boolean;
9
+ /**
10
+ * shim is only when we're dealing with intrinsically sized children, which is never
11
+ * in an actual application. Intrinsic sizing is still experimental.
12
+ */
7
13
  shim?: boolean;
8
14
  }
9
15
  export declare const Placeholder: {
10
- ({ className, closeable, flexFill, resizeable, shim, ...props }: PlaceholderProps): JSX.Element;
16
+ ({ className: classNameProp, showStartMenu, ...viewProps }: PlaceholderProps): JSX.Element;
11
17
  displayName: string;
12
18
  };
@@ -1,11 +1,12 @@
1
1
  import { TabstripProps } from "@vuu-ui/vuu-ui-controls";
2
2
  import { HTMLAttributes, MouseEvent, ReactElement, ReactNode } from "react";
3
+ export type TabLabelFactory = (component: ReactElement, index: number, existingLabels: string[]) => string;
3
4
  export type TabPosition = "top" | "left" | "right" | "bottom";
4
5
  export interface StackProps extends Omit<HTMLAttributes<HTMLDivElement>, "onMouseDown"> {
5
6
  active?: number;
6
7
  createNewChild?: (index: number) => ReactElement;
7
8
  getTabIcon?: (component: ReactElement, index: number) => string | undefined;
8
- getTabLabel?: (component: ReactElement, index: number) => string | undefined;
9
+ getTabLabel?: TabLabelFactory;
9
10
  keyBoardActivation?: "automatic" | "manual";
10
11
  onAddTab?: () => void;
11
12
  onMoveTab?: (fromIndex: number, toIndex: number) => void;
@@ -6,6 +6,7 @@ export type ActiveItemChangeHandler = (itemIndex: number[]) => void;
6
6
  export type NavigationOutOfBoundsHandler = (direction: "start" | "end") => void;
7
7
  export interface ToolbarProps extends OverflowContainerProps {
8
8
  activeItemIndex?: number[];
9
+ alignItems?: "start" | "center" | "end";
9
10
  defaultActiveItemIndex?: number[];
10
11
  onActiveChange?: ActiveItemChangeHandler;
11
12
  /**
@@ -15,5 +16,6 @@ export interface ToolbarProps extends OverflowContainerProps {
15
16
  */
16
17
  onNavigateOutOfBounds?: NavigationOutOfBoundsHandler;
17
18
  selectionStrategy?: SelectionStrategy | SpecialKeyMultipleSelection;
19
+ showSeparators?: boolean;
18
20
  }
19
- export declare const Toolbar: ({ activeItemIndex: activeItemIndexProp, defaultActiveItemIndex, children, className: classNameProp, id: idProp, onActiveChange, onNavigateOutOfBounds, orientation, selectionStrategy, ...props }: ToolbarProps) => JSX.Element;
21
+ export declare const Toolbar: ({ activeItemIndex: activeItemIndexProp, alignItems, defaultActiveItemIndex, children, className, id: idProp, onActiveChange, onNavigateOutOfBounds, orientation, selectionStrategy, showSeparators, ...props }: ToolbarProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- import { LayoutJSON } from "../layout-reducer";
2
- export declare const warningLayout: LayoutJSON;
3
- export declare const defaultLayout: LayoutJSON;