diff --git a/client/src/components/SubdirectoryFieldConfig.tsx b/client/src/components/SubdirectoryFieldConfig.tsx index f797dd3..3a414e1 100644 --- a/client/src/components/SubdirectoryFieldConfig.tsx +++ b/client/src/components/SubdirectoryFieldConfig.tsx @@ -47,11 +47,6 @@ export default function SubdirectoryFieldConfig({ const subdirectories = subdirectoriesData?.subdirectories || []; const showSubdirectory = !!field.options?.showSubdirectory; - const selectedSubdirectoryId = field.options?.subdirectoryId as number | undefined; - - const selectedSubdirectory = useMemo(() => { - return subdirectories.find((s) => s.id === selectedSubdirectoryId || s.childTableId === selectedSubdirectoryId); - }, [subdirectories, selectedSubdirectoryId]); const selectedTable = useMemo(() => { return tablesData?.tables?.find((t) => t.id === tableId); @@ -65,7 +60,6 @@ export default function SubdirectoryFieldConfig({ tableId: undefined, displayColumn: undefined, showSubdirectory: undefined, - subdirectoryId: undefined, }, }); return; @@ -78,7 +72,6 @@ export default function SubdirectoryFieldConfig({ tableId: newTableId, displayColumn: newSelectedTable?.columns?.[0]?.name || undefined, showSubdirectory: undefined, - subdirectoryId: undefined, }, }); }; @@ -88,18 +81,6 @@ export default function SubdirectoryFieldConfig({ options: { ...field.options, showSubdirectory: checked, - subdirectoryId: checked ? field.options?.subdirectoryId : undefined, - }, - }); - }; - - const handleSubdirectoryChange = (value: string) => { - const newSubdirectory = value === 'none' ? undefined : subdirectories.find((s) => s.id?.toString() === value || s.childTableId?.toString() === value); - updateField(index, { - options: { - ...field.options, - subdirectoryId: newSubdirectory?.id, - childTableId: newSubdirectory?.childTableId, }, }); }; @@ -178,32 +159,12 @@ export default function SubdirectoryFieldConfig({ {showSubdirectory && ( -
- Подсправочник показывается при выборе привязанных строк родителя. -
- )} -+ При выборе строки родительского справочника будет показан подсправочник, привязанный к этой строке. + {subdirectories.length > 0 + ? ` Найдено подсправочников: ${subdirectories.length}.` + : ' Нет привязанных подсправочников.'} +
)} )} diff --git a/client/src/components/TableFieldWithSubdirectory.tsx b/client/src/components/TableFieldWithSubdirectory.tsx index 8b8f189..a07a8fe 100644 --- a/client/src/components/TableFieldWithSubdirectory.tsx +++ b/client/src/components/TableFieldWithSubdirectory.tsx @@ -65,7 +65,6 @@ export default function TableFieldWithSubdirectory({ const opts = options && !Array.isArray(options) ? (options as Record