Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced search table #1539

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class ArrayDataSource

constructor({
aggregations,
baseFilterSpec,
// different from RemoteDataSource
columnDescriptors,
data,
Expand Down Expand Up @@ -176,6 +177,7 @@ export class ArrayDataSource
this.config = {
...this._config,
aggregations: aggregations || this._config.aggregations,
baseFilterSpec,
columns,
filterSpec: filterSpec || this._config.filterSpec,
groupBy: groupBy || this._config.groupBy,
Expand All @@ -190,6 +192,7 @@ export class ArrayDataSource
viewport = this.viewport ?? (this.viewport = uuid()),
columns,
aggregations,
baseFilterSpec,
range,
selectedIndexValues,
selectedKeyValues,
Expand Down Expand Up @@ -220,6 +223,7 @@ export class ArrayDataSource
config = {
...config,
aggregations: aggregations || this._config.aggregations,
baseFilterSpec: baseFilterSpec || this._config.baseFilterSpec,
columns: columns || this._config.columns,
filterSpec: filterSpec || this._config.filterSpec,
groupBy: groupBy || this._config.groupBy,
Expand Down
20 changes: 20 additions & 0 deletions vuu-ui/packages/vuu-icons/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vuu-ui/packages/vuu-layout/src/flexbox/Flexbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@
.vuuView.flex-fill {
border-color: red;
}

3 changes: 1 addition & 2 deletions vuu-ui/packages/vuu-layout/src/flexbox/Flexbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const classBase = "hwFlexbox";

const Flexbox = forwardRef(function Flexbox(
props: FlexboxProps,
ref: ForwardedRef<HTMLDivElement>
ref: ForwardedRef<HTMLDivElement>,
) {
const {
breakPoints,
Expand Down Expand Up @@ -42,7 +42,6 @@ const Flexbox = forwardRef(function Flexbox(

const { content, rootRef } = useSplitterResizing({
children,
// cols: colsProp,
onSplitterMoved,
style,
});
Expand Down
4 changes: 3 additions & 1 deletion vuu-ui/packages/vuu-layout/src/flexbox/flexboxTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export interface LayoutContainerProps {
resizeable?: boolean;
}

export type SplitterMoveHandler = (content: ContentMeta[]) => void;

export interface FlexboxProps
extends LayoutContainerProps,
HTMLAttributes<HTMLDivElement> {
Expand All @@ -21,7 +23,7 @@ export interface FlexboxProps
fullPage?: number;
flexFill?: boolean;
gap?: number;
onSplitterMoved?: (content: ContentMeta[]) => void;
onSplitterMoved?: SplitterMoveHandler;
row?: true;
spacing?: number;
splitterSize?: number;
Expand Down
33 changes: 20 additions & 13 deletions vuu-ui/packages/vuu-layout/src/flexbox/useSplitterResizing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export const useSplitterResizing = ({
Array.isArray(childrenProp)
? childrenProp
: React.isValidElement(childrenProp)
? [childrenProp]
: [],
[childrenProp]
? [childrenProp]
: [],
[childrenProp],
);

const handleDragStart = useCallback(
Expand All @@ -61,7 +61,7 @@ export const useSplitterResizing = ({
if (contentMeta) {
const [participants, bystanders] = identifyResizeParties(
contentMeta,
index
index,
);
if (participants) {
participants.forEach((index) => {
Expand All @@ -81,10 +81,14 @@ export const useSplitterResizing = ({
}
});
}

if (rootRef.current) {
rootRef.current.classList.add("vuuSplitterResizing");
}
}
}
},
[dimension]
[dimension],
);

const handleDrag = useCallback(
Expand All @@ -95,18 +99,21 @@ export const useSplitterResizing = ({
contentRef.current,
metaRef.current,
distance,
dimension
)
dimension,
),
);
}
},
[dimension]
[dimension],
);

const handleDragEnd = useCallback(() => {
const contentMeta = metaRef.current;
if (contentMeta) {
onSplitterMoved?.(contentMeta.filter(originalContentOnly));
if (rootRef.current) {
rootRef.current.classList.remove("vuuSplitterResizing");
}
}
contentMeta?.forEach((meta) => {
meta.currentSize = undefined;
Expand All @@ -126,15 +133,15 @@ export const useSplitterResizing = ({
onDragStart: handleDragStart,
});
},
[handleDrag, handleDragEnd, handleDragStart, isColumn]
[handleDrag, handleDragEnd, handleDragStart, isColumn],
);

useMemo(() => {
const [content, meta] = buildContent(
children,
dimension,
createSplitter,
assignedKeys.current
assignedKeys.current,
);
metaRef.current = meta;
contentRef.current = content;
Expand All @@ -150,7 +157,7 @@ function buildContent(
children: ReactElement[],
dimension: "width" | "height",
createSplitter: SplitterFactory,
keys: any[]
keys: any[],
): [any[], ContentMeta[]] {
const childMeta = gatherChildMeta(children, dimension);
const splitterAndPlaceholderPositions =
Expand Down Expand Up @@ -186,7 +193,7 @@ function resizeContent(
content: ReactElement[],
contentMeta: ContentMeta[],
distance: number,
dimension: "width" | "height"
dimension: "width" | "height",
) {
const metaUpdated = updateMeta(contentMeta, distance);
if (!metaUpdated) {
Expand Down Expand Up @@ -260,7 +267,7 @@ function createPlaceholder(index: number) {

function measureElement(
el: HTMLElement,
dimension: "width" | "height"
dimension: "width" | "height",
): FlexSize {
const { [dimension]: size } = el.getBoundingClientRect();
const style = getComputedStyle(el);
Expand Down
Loading
Loading