-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Picker table support * update-dh-packages script now excludes jsapi-types package from custom target version since it has its own version cadence * Updated DHC packages to ^0.71.0 * Updated jsapi-types to ^1.0.0-dev0.33.3
- Loading branch information
Showing
8 changed files
with
635 additions
and
487 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,48 @@ | ||
import React from 'react'; | ||
import React, { ReactElement } from 'react'; | ||
import { | ||
Picker as DHPicker, | ||
PickerProps as DHPickerProps, | ||
} from '@deephaven/components'; | ||
import { | ||
Picker as DHPickerJSApi, | ||
PickerProps as DHPickerJSApiProps, | ||
useTableClose, | ||
} from '@deephaven/jsapi-components'; | ||
import { isElementOfType, usePromiseFactory } from '@deephaven/react-hooks'; | ||
import { SerializedPickerEventProps, usePickerProps } from './usePickerProps'; | ||
import ObjectView, { ObjectViewProps } from './ObjectView'; | ||
import { fetchReexportedTable } from './ElementUtils'; | ||
|
||
type WrappedDHPickerJSApiProps = Omit<DHPickerJSApiProps, 'table'> & { | ||
children: ReactElement<ObjectViewProps>; | ||
}; | ||
|
||
function Picker(props: DHPickerProps & SerializedPickerEventProps) { | ||
export type PickerProps = (DHPickerProps | WrappedDHPickerJSApiProps) & | ||
SerializedPickerEventProps; | ||
|
||
function Picker({ children, ...props }: PickerProps) { | ||
const pickerProps = usePickerProps(props); | ||
|
||
const isObjectView = isElementOfType(children, ObjectView); | ||
|
||
const maybeExportedTable = | ||
isObjectView && children.props.object.type === 'Table' | ||
? children.props.object | ||
: null; | ||
|
||
const { data: table } = usePromiseFactory(fetchReexportedTable, [ | ||
maybeExportedTable, | ||
]); | ||
|
||
useTableClose(table); | ||
|
||
if (isObjectView) { | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
return table && <DHPickerJSApi {...pickerProps} table={table} />; | ||
} | ||
|
||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
return <DHPicker {...pickerProps} />; | ||
return <DHPicker {...pickerProps}>{children}</DHPicker>; | ||
} | ||
|
||
export default Picker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters