From 65f5dbd48b5be5df612a74e834a5ae482bcced7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B8=D0=BC=D0=B8=D0=BD?= Date: Tue, 2 Jun 2026 11:50:16 +0000 Subject: [PATCH] =?UTF-8?q?feat(dict):=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D1=86=D0=B0=20=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BE=D1=87=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0=20=E2=80=94=20=D0=B2=D1=81=D0=B5=20scalar=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8F=20=D1=81=D1=85=D0=B5=D0=BC=D1=8B=20?= =?UTF-8?q?=D0=B2=20pool=20=D0=BA=D0=BE=D0=BB=D0=BE=D0=BD=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/routes/dictionaries.$name.tsx | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/ordinis-admin-ui/src/routes/dictionaries.$name.tsx b/ordinis-admin-ui/src/routes/dictionaries.$name.tsx index 3982995..29a1ea4 100644 --- a/ordinis-admin-ui/src/routes/dictionaries.$name.tsx +++ b/ordinis-admin-ui/src/routes/dictionaries.$name.tsx @@ -586,26 +586,31 @@ function DictionaryDetail() { ) } - // Schema-driven extra columns: enum + reference поля — самые info-dense - // не-локализованные scalar'ы. Skip name/code/businessKey (уже показаны), - // всё нескалярное (object/array/localized). + // Schema-driven extra columns: ВСЕ scalar non-localized поля schema'ы + // редактируемые в drawer'е — те же что и в edit-form. Юзер сам через + // ColumnVisibilityMenu выбирает что показывать (стейт persisted в + // localStorage per dict). // - // Раньше cap = 2, чтобы строка comfortably fits на 1280px. Сейчас cap - // снят — все eligible колонки в pool, юзер выбирает через - // ColumnVisibilityMenu (стейт persisted в localStorage per dict). - // Soft cap 8 — защита от absurd schemas (50+ enum полей сломали бы - // toolbar layout до того как user успел зайти в menu). + // Skip: name/code/businessKey (primary identifier уже отдельной колонкой), + // localized (требует locale-aware рендер, не подходит для compact pill), + // array/object (рендеримся как [object Object] — бесполезно в строке). + // + // Cap 30 — soft защита от absurd schemas. На практике справочники ЦУОД + // имеют 5-15 полей, drawer показывает их все — таблица теперь + // паритетна. FK маркеры (x-references) подсвечиваются accent цветом + // в строке row, остальные — нейтральный ink pill. const extraColumns = useMemo<{ key: string; label: string; isFk: boolean }[]>(() => { const props = detailQuery.data?.schemaJson?.properties ?? {} const interesting: { key: string; label: string; isFk: boolean }[] = [] for (const [key, prop] of Object.entries(props)) { - if (interesting.length >= 8) break + if (interesting.length >= 30) break if (key === 'name' || key === 'code' || key === 'businessKey') continue - const isLocalized = Boolean(prop['x-localized']) - if (isLocalized) continue - const isEnum = Array.isArray(prop.enum) && prop.enum.length > 0 + if (Boolean(prop['x-localized'])) continue + const type = prop.type + // Array / object не рендерятся в pill — String([1,2,3]) = "1,2,3" + // ОК, но String({...}) = "[object Object]". Пропускаем оба. + if (type === 'array' || type === 'object') continue const isFk = typeof prop['x-references'] === 'string' && Boolean(prop['x-references']) - if (!isEnum && !isFk) continue interesting.push({ key, label: humanize(key), isFk }) } return interesting