'use client'; import clsx from 'clsx'; import { useState } from 'react'; import { IconReset } from '@/components/Icons'; import PickSchema from '@/components/select/PickSchema'; import Label from '@/components/ui/Label'; import MiniButton from '@/components/ui/MiniButton'; import Modal, { ModalProps } from '@/components/ui/Modal'; import { useLibrary } from '@/context/LibraryContext'; import { ILibraryItem, LibraryItemID, LibraryItemType } from '@/models/library'; import { IOperation, IOperationSchema } from '@/models/oss'; import { sortItemsForOSS } from '@/models/ossAPI'; interface DlgChangeInputSchemaProps extends Pick { oss: IOperationSchema; target: IOperation; onSubmit: (newSchema: LibraryItemID | undefined) => void; } function DlgChangeInputSchema({ oss, hideWindow, target, onSubmit }: DlgChangeInputSchemaProps) { const [selected, setSelected] = useState(target.result ?? undefined); const library = useLibrary(); const sortedItems = sortItemsForOSS(oss, library.items); const isValid = target.result !== selected; function baseFilter(item: ILibraryItem) { return !oss.schemas.includes(item.id) || item.id === selected || item.id === target.result; } function handleSelectLocation(newValue: LibraryItemID) { setSelected(newValue); } return ( onSubmit(selected)} className={clsx('w-[35rem]', 'pb-3 px-6 cc-column')} >
); } export default DlgChangeInputSchema;