Skip to content

Commit

Permalink
type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
heswell committed Oct 18, 2023
1 parent 0aca3eb commit d3daec5
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export class ArrayBackedMovingWindow {
const internalIndex = index - this.#range.from;
//TODO measure the performance impact of this check
if (dataIsUnchanged(row, this.internalData[internalIndex])) {
console.log("data unchanged");
return false;
}
const isWithinClientRange = this.isWithinClientRange(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { DataSource } from "@finos/vuu-data";
import { DataSourceFilter, MenuActionHandler } from "@finos/vuu-data-types";
import { KeyedColumnDescriptor } from "@finos/vuu-datagrid-types";
import { MenuActionClosePopup } from "@finos/vuu-popups";
import { removeColumnFromFilter, setAggregations } from "@finos/vuu-utils";
import { MenuActionClosePopup } from "packages/vuu-popups/src";
import { AggregationType } from "../constants";
import { GridModelDispatch } from "../grid-context";
import { GridModelType } from "../grid-model/gridModelTypes";
Expand Down
17 changes: 2 additions & 15 deletions vuu-ui/packages/vuu-popups/src/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Scrim } from "@salt-ds/lab";
import cx from "classnames";
import { HTMLAttributes, useCallback, useRef, useState } from "react";
import { HTMLAttributes, useCallback, useRef } from "react";
import { Portal } from "../portal";
import { DialogHeader } from "../dialog-header";

Expand All @@ -24,30 +24,17 @@ export const Dialog = ({
...props
}: DialogProps) => {
const root = useRef<HTMLDivElement>(null);
const [posX] = useState(0);
const [posY] = useState(0);

const close = useCallback(() => {
onClose?.();
}, [onClose]);

const handleRender = useCallback(() => {
// if (center && isOpen && root.current) {
// const { width, height } = root.current.getBoundingClientRect();
// const { innerWidth, innerHeight } = window;
// const x = innerWidth / 2 - width / 2;
// const y = innerHeight / 2 - height / 2;
// setPosX(x);
// setPosY(y);
// }
}, []);

if (!isOpen) {
return null;
}

return (
<Portal onRender={handleRender} x={posX} y={posY}>
<Portal>
<Scrim className={`${classBase}-scrim`} open={isOpen} autoFocusRef={root}>
<div {...props} className={cx(classBase, className)} ref={root}>
<DialogHeader
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-popups/src/menu/useContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { ContextMenu, ContextMenuProps } from "./ContextMenu";
import { MenuItem, MenuItemGroup } from "./MenuList";
import { ContextMenuContext } from "./context-menu-provider";
import { useThemeAttributes } from "packages/vuu-shell/src";
import { useThemeAttributes } from "@finos/vuu-shell";

export type ContextMenuOptions = {
[key: string]: unknown;
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-table/src/table/dataTableTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TableHeadings,
TableSelectionModel,
} from "@finos/vuu-datagrid-types";
import { VuuDataRow } from "packages/vuu-protocol-types";
import { VuuDataRow } from "@finos/vuu-protocol-types";
import { FC, HTMLAttributes, MouseEvent } from "react";
import { RowProps } from "../table-next/Row";

Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-table/src/table/useSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
metadataKeys,
selectItem,
} from "@finos/vuu-utils";
import { DataSourceRow } from "packages/vuu-data-types";
import { DataSourceRow } from "@finos/vuu-data-types";
import { useCallback, useRef } from "react";
import { RowClickHandler } from "./dataTableTypes";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PortalDeprecated } from "@finos/vuu-popups";
import { Portal } from "@finos/vuu-popups";
import { forwardRef } from "react";
import { Rect } from "./dragDropTypesNext";

Expand All @@ -10,12 +10,12 @@ export const DropIndicator = forwardRef<
>(function DropIndicator({ rect }, forwardedRef) {
const { left, top, width, height } = rect;
return (
<PortalDeprecated>
<Portal>
<div
className={`vuuDropIndicator`}
ref={forwardedRef}
style={{ left, top, width, height }}
/>
</PortalDeprecated>
</Portal>
);
});
12 changes: 6 additions & 6 deletions vuu-ui/showcase/src/examples/UiControls/Dropdown.examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SyntheticEvent, useCallback, useMemo, useRef, useState } from "react";

import {
Dropdown,
SelectionChangeHandler,
MultiSelectionHandler,
SingleSelectionHandler,
} from "@finos/vuu-ui-controls";
import { Button, ToggleButton, ToggleButtonGroup } from "@salt-ds/core";
Expand Down Expand Up @@ -30,7 +30,7 @@ export const DefaultDropdown = () => {
DefaultDropdown.displaySequence = displaySequence++;

export const SizedDropdown = () => {
const handleChange: SelectionChangeHandler = (event, selectedItem) => {
const handleChange: SingleSelectionHandler = (event, selectedItem) => {
console.log("selection changed", selectedItem);
};
return (
Expand Down Expand Up @@ -113,7 +113,7 @@ FullyControlledDropdown.displaySequence = displaySequence++;
export const DataOnDemand = () => {
const [data, setData] = useState(["EUR"]);

const handleChange: SelectionChangeHandler = (event, selectedItem) => {
const handleChange: SingleSelectionHandler = (event, selectedItem) => {
console.log("selection changed", selectedItem);
};

Expand Down Expand Up @@ -158,7 +158,7 @@ export const SwitchDataSource = () => {
}
}, []);

const handleSelectionChange = useCallback<SelectionChangeHandler>(
const handleSelectionChange = useCallback<SingleSelectionHandler>(
(evt, value) => {
if (value !== null) {
selectedRef.current = value;
Expand Down Expand Up @@ -195,14 +195,14 @@ export const SwitchDataSource = () => {
SwitchDataSource.displaySequence = displaySequence++;

export const MultiSelectDropdown = () => {
const handleSelectionChange = useCallback<SelectionChangeHandler<string>>(
const handleSelectionChange = useCallback<MultiSelectionHandler<string>>(
(event, selected) => {
console.log(`selectionChange ${JSON.stringify(selected)}`);
},
[]
);
return (
<Dropdown<string>
<Dropdown
defaultSelected={[usa_states[0]]}
onSelectionChange={handleSelectionChange}
selectionStrategy="multiple"
Expand Down
4 changes: 2 additions & 2 deletions vuu-ui/showcase/src/examples/UiControls/List.examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
dragStrategy,
List,
ListItem,
MultiSelectionChangeHandler,
MultiSelectionHandler,
SelectHandler,
SingleSelectionHandler,
VirtualizedList,
Expand Down Expand Up @@ -111,7 +111,7 @@ export const InlineListItems = () => {
InlineListItems.displaySequence = displaySequence++;

export const ListExtendedSelection = () => {
const handleSelectionChange = useCallback<MultiSelectionChangeHandler>(
const handleSelectionChange = useCallback<MultiSelectionHandler>(
(evt, selected) => {
console.log(`handleSelectionChange`, { selected });
},
Expand Down

0 comments on commit d3daec5

Please sign in to comment.