Change Value Used in DB Plugin
Summary: - Add value for null type to use `.value` easier - Add value to string by directly converting to string if possible; otherwise null Reviewed By: jknoxville Differential Revision: D21788242 fbshipit-source-id: f3a9f995de6b4cb1b304981c8adaaba70105c988
This commit is contained in:
committed by
Facebook GitHub Bot
parent
741f3591e6
commit
df480bd57a
@@ -91,7 +91,11 @@ export {
|
|||||||
default as ManagedTable_immutable,
|
default as ManagedTable_immutable,
|
||||||
ManagedTableProps_immutable,
|
ManagedTableProps_immutable,
|
||||||
} from './ui/components/table/ManagedTable_immutable';
|
} from './ui/components/table/ManagedTable_immutable';
|
||||||
export {Value, renderValue} from './ui/components/table/TypeBasedValueRenderer';
|
export {
|
||||||
|
Value,
|
||||||
|
renderValue,
|
||||||
|
valueToNullableString,
|
||||||
|
} from './ui/components/table/TypeBasedValueRenderer';
|
||||||
export {
|
export {
|
||||||
DataValueExtractor,
|
DataValueExtractor,
|
||||||
DataInspectorExpanded,
|
DataInspectorExpanded,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export type Value =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'null';
|
type: 'null';
|
||||||
|
value: null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const WrappingText = styled(Text)({
|
const WrappingText = styled(Text)({
|
||||||
@@ -59,6 +60,10 @@ const BooleanValue = styled(NonWrappingText)<{active?: boolean}>((props) => ({
|
|||||||
}));
|
}));
|
||||||
BooleanValue.displayName = 'TypeBasedValueRenderer:BooleanValue';
|
BooleanValue.displayName = 'TypeBasedValueRenderer:BooleanValue';
|
||||||
|
|
||||||
|
export function valueToNullableString(val: Value): string | null {
|
||||||
|
return val.value?.toString() ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
export function renderValue(val: Value, wordWrap?: boolean) {
|
export function renderValue(val: Value, wordWrap?: boolean) {
|
||||||
const TextComponent = wordWrap ? WrappingText : NonWrappingText;
|
const TextComponent = wordWrap ? WrappingText : NonWrappingText;
|
||||||
switch (val.type) {
|
switch (val.type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user