Skip to content

Commit

Permalink
Merge pull request #43 from ScottLogic/sync-with-finos-main
Browse files Browse the repository at this point in the history
Sync with Finos main
  • Loading branch information
pling-scottlogic authored Sep 18, 2023
2 parents 3ed1917 + fc5115f commit dbe29bd
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 26 deletions.
3 changes: 0 additions & 3 deletions vuu-ui/packages/vuu-layout/src/drag-drop/Draggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ function dragMouseupHandler() {
}

function onDragEnd() {
if (!_dragContainer) {
return
}
if (_dropTarget) {
const dropTarget =
_dropTargetRenderer.hoverDropTarget ||
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-layout/src/drag-drop/DropTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Measurements,
Position,
positionValues,
RelativeDropPosition
RelativeDropPosition,
} from "./BoxModel";
import { DragDropRect, DropPos, DropPosTab } from "./dragDropTypes";
import { DragState } from "./DragState";
Expand Down
10 changes: 8 additions & 2 deletions vuu-ui/packages/vuu-layout/src/flexbox/Flexbox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useForkRef } from "@salt-ds/core";
import cx from "classnames";
import { CSSProperties, forwardRef } from "react";
import { CSSProperties, ForwardedRef, forwardRef } from "react";
import { FlexboxProps } from "./flexboxTypes";
import { useSplitterResizing } from "./useSplitterResizing";

Expand All @@ -9,10 +10,12 @@ const classBase = "hwFlexbox";

const Flexbox = forwardRef(function Flexbox(
props: FlexboxProps,
ref: ForwardedRef<HTMLDivElement>
) {
const {
breakPoints,
children,
// cols: colsProp,
column,
className: classNameProp,
flexFill,
Expand All @@ -28,8 +31,9 @@ const Flexbox = forwardRef(function Flexbox(
...rest
} = props;

const { content } = useSplitterResizing({
const { content, rootRef } = useSplitterResizing({
children,
// cols: colsProp,
onSplitterMoved,
style,
});
Expand All @@ -45,8 +49,10 @@ const Flexbox = forwardRef(function Flexbox(
<div
{...rest}
className={className}
// data-cols={cols}
data-resizeable={resizeable || undefined}
id={id}
ref={useForkRef(rootRef, ref)}
style={
{
...style,
Expand Down
25 changes: 12 additions & 13 deletions vuu-ui/packages/vuu-layout/src/flexbox/FlexboxLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useCallback } from 'react';
import { useLayoutProviderDispatch } from '../layout-provider';
import { registerComponent } from '../registry/ComponentRegistry';
import Flexbox from './Flexbox';

type FlexboxLayoutProps = {
path: string
}
import { useCallback } from "react";
import { Action } from "../layout-action";
import { useLayoutProviderDispatch } from "../layout-provider";
import { SplitterResizeAction } from "../layout-reducer";
import { registerComponent } from "../registry/ComponentRegistry";
import Flexbox from "./Flexbox";
import { FlexboxLayoutProps } from "./flexboxTypes";

export const FlexboxLayout = function FlexboxLayout(props: FlexboxLayoutProps) {
const { path } = props;
Expand All @@ -14,16 +13,16 @@ export const FlexboxLayout = function FlexboxLayout(props: FlexboxLayoutProps) {
const handleSplitterMoved = useCallback(
(sizes) => {
dispatch({
type: "splitter-resize",
type: Action.SPLITTER_RESIZE,
path,
sizes
});
sizes,
} as SplitterResizeAction);
},
[dispatch, path]
);

return <Flexbox {...props} onSplitterMoved={handleSplitterMoved} />;
};
FlexboxLayout.displayName = 'Flexbox';
FlexboxLayout.displayName = "Flexbox";

registerComponent('Flexbox', FlexboxLayout, 'container');
registerComponent("Flexbox", FlexboxLayout, "container");
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-layout/src/flexbox/flexboxTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
HTMLAttributes,
MutableRefObject,
ReactElement,
ReactNode
ReactNode,
} from "react";
import { SplitterProps } from "./Splitter";

Expand Down
6 changes: 3 additions & 3 deletions vuu-ui/packages/vuu-layout/src/flexbox/useSplitterResizing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {
useCallback,
useMemo,
useRef,
useState
useState,
} from "react";
import { Placeholder } from "../placeholder";
import { Splitter } from "./Splitter";
Expand All @@ -14,14 +14,14 @@ import {
gatherChildMeta,
identifyResizeParties,
PLACEHOLDER,
SPLITTER
SPLITTER,
} from "./flexbox-utils";
import {
ContentMeta,
FlexSize,
SplitterFactory,
SplitterHookProps,
SplitterHookResult
SplitterHookResult,
} from "./flexboxTypes";

const originalContentOnly = (meta: ContentMeta) =>
Expand Down
5 changes: 3 additions & 2 deletions vuu-ui/packages/vuu-layout/src/layout-reducer/layoutUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {
ComponentWithId,
ComponentRegistry,
isContainer,
isLayoutComponent
isLayoutComponent,
} from "../registry/ComponentRegistry";
import {
getPersistentState,
hasPersistentState,
setPersistentState
setPersistentState,
} from "../use-persistent-state";
import { expandFlex, getProps, typeOf } from "../utils";
import { LayoutJSON, LayoutModel, layoutType } from "./layoutTypes";
Expand Down Expand Up @@ -234,6 +234,7 @@ export function layoutFromJson(
id,
...props,
key: id,
path,
},
children
? children.map((child, i) => layoutFromJson(child, `${path}.${i}`))
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-layout/src/palette/Palette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
HTMLAttributes,
memo,
MouseEvent,
ReactElement
ReactElement,
} from "react";
import { useLayoutProviderDispatch } from "../layout-provider";
import { View, ViewProps } from "../layout-view";
Expand Down

0 comments on commit dbe29bd

Please sign in to comment.