Skip to content

Commit

Permalink
feat(editor-sdk): add tooltip for too long ArrayTableRow
Browse files Browse the repository at this point in the history
  • Loading branch information
tanbowensg committed Aug 29, 2023
1 parent 59d5e6a commit 1b9672e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/editor-sdk/src/components/Form/ArrayTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo, useCallback } from 'react';
import { css } from '@emotion/css';
import { IconButton, Table, Thead, Tbody, Tr, Th, Td } from '@chakra-ui/react';
import { IconButton, Table, Thead, Tbody, Tr, Th, Td, Tooltip } from '@chakra-ui/react';
import { AddIcon, SettingsIcon } from '@chakra-ui/icons';
import { generateDefaultValueFromSpec, isJSONSchema } from '@sunmao-ui/shared';
import { JSONSchema7 } from 'json-schema';
Expand Down Expand Up @@ -125,11 +125,15 @@ const TableRow: React.FC<RowProps> = props => {
? propertyValue
: JSON.stringify(propertyValue);

return (
<Td key={key} title={propertyValueString}>
{propertyValueString}
</Td>
);
let ele = <span>{propertyValueString}</span>;
if (propertyValueString.length > 10) {
ele = (
<Tooltip label={propertyValueString} placement="top">
{ele}
</Tooltip>
);
}
return <Td key={key}>{ele}</Td>;
})}
<Td key="button">
<ArrayButtonGroup index={itemIndex} value={value} onChange={onChange} />
Expand Down

0 comments on commit 1b9672e

Please sign in to comment.