Skip to content

Commit

Permalink
Merge pull request #717 from smartxworks/feat/event-component-tooltip
Browse files Browse the repository at this point in the history
feat(editor-sdk): add tooltip for too long ArrayTableRow
  • Loading branch information
tanbowensg authored Sep 5, 2023
2 parents 1516a31 + 1b9672e commit f7bcbb2
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 f7bcbb2

Please sign in to comment.