import React from 'react'; import { usePassport } from '@sensoro/core'; import SelectDeviceModal, { Data } from './select-device-modal'; import SelectDevice from '../select-device'; import MapDeviceInject from '../map-device-inject'; import { useModal } from '@pansy/hooks'; import { filter } from 'lodash'; interface MapDeviceProps { className?: string; style?: React.CSSProperties; relatedCameraIds?: string[]; value?: string[]; onChange?: (value: string[]) => void; deviceKey?: string; } const MapDevice: React.FC = props => { const { className, style, relatedCameraIds, value, onChange, deviceKey = 'cid', ...rest } = props; const { visible, initValue, openModal, closeModal } = useModal(); const { merchant } = usePassport(); return (
{(devices: any[], props: any) => ( <> value && value.indexOf(item[deviceKey]) > -1, )} className={className} style={style} value={value} onSelectDeviceClick={() => openModal({ devices: devices, relatedCameraIds: value, }) } /> closeModal()} onChange={onChange} data={initValue} /> )}
); }; export default MapDevice;