|
|
@ -7,10 +7,12 @@ import IconDate from '@material-ui/icons/DateRange';
|
|
|
|
import CommunicationCall from '@material-ui/icons/Call';
|
|
|
|
import CommunicationCall from '@material-ui/icons/Call';
|
|
|
|
import CommunicationChatBubble from '@material-ui/icons/ChatBubble';
|
|
|
|
import CommunicationChatBubble from '@material-ui/icons/ChatBubble';
|
|
|
|
import CommunicationEmail from '@material-ui/icons/Email';
|
|
|
|
import CommunicationEmail from '@material-ui/icons/Email';
|
|
|
|
|
|
|
|
import AssignmentIcon from '@material-ui/icons/Assignment';
|
|
|
|
|
|
|
|
|
|
|
|
import PimItemHeader from './PimItemHeader';
|
|
|
|
import PimItemHeader from './PimItemHeader';
|
|
|
|
|
|
|
|
|
|
|
|
import { ContactType } from '../pim-types';
|
|
|
|
import { ContactType } from '../pim-types';
|
|
|
|
|
|
|
|
import { IconButton } from '@material-ui/core';
|
|
|
|
|
|
|
|
|
|
|
|
class Contact extends React.PureComponent {
|
|
|
|
class Contact extends React.PureComponent {
|
|
|
|
public props: {
|
|
|
|
public props: {
|
|
|
@ -40,15 +42,30 @@ class Contact extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
return contact.comp.getAllProperties(propName).map((prop, idx) => {
|
|
|
|
return contact.comp.getAllProperties(propName).map((prop, idx) => {
|
|
|
|
const type = prop.toJSON()[1].type;
|
|
|
|
const type = prop.toJSON()[1].type;
|
|
|
|
const values = prop.getValues().map((val) => (
|
|
|
|
const values = prop.getValues().map((val) => {
|
|
|
|
|
|
|
|
const primaryText = primaryTransform ? primaryTransform(val, type) : val;
|
|
|
|
|
|
|
|
const clipboardButton = (
|
|
|
|
|
|
|
|
<IconButton
|
|
|
|
|
|
|
|
onClick={(e) => {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
(window as any).navigator.clipboard.writeText(primaryText);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<AssignmentIcon />
|
|
|
|
|
|
|
|
</IconButton>
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ListItem
|
|
|
|
<ListItem
|
|
|
|
key={idx}
|
|
|
|
key={idx}
|
|
|
|
href={valueToHref ? valueToHref(val, type) : undefined}
|
|
|
|
href={valueToHref ? valueToHref(val, type) : undefined}
|
|
|
|
primaryText={primaryTransform ? primaryTransform(val, type) : val}
|
|
|
|
primaryText={primaryText}
|
|
|
|
|
|
|
|
rightIcon={clipboardButton}
|
|
|
|
secondaryText={secondaryTransform ? secondaryTransform(val, type) : type}
|
|
|
|
secondaryText={secondaryTransform ? secondaryTransform(val, type) : type}
|
|
|
|
{...props}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
));
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
return values;
|
|
|
|
return values;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -57,7 +74,6 @@ class Contact extends React.PureComponent {
|
|
|
|
'tel',
|
|
|
|
'tel',
|
|
|
|
{
|
|
|
|
{
|
|
|
|
leftIcon: <CommunicationCall />,
|
|
|
|
leftIcon: <CommunicationCall />,
|
|
|
|
rightIcon: <CommunicationChatBubble />,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
(x) => ('tel:' + x)
|
|
|
|
(x) => ('tel:' + x)
|
|
|
|
));
|
|
|
|
));
|
|
|
|