From e905d5f576e792a91192803056fdf4029b7128c4 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sat, 6 Jun 2026 17:14:32 +0300 Subject: [PATCH] =?UTF-8?q?feat(form-decompile,form-compile):=20=D1=82?= =?UTF-8?q?=D0=B0=D0=B1=D0=BB=D0=B8=D1=87=D0=BD=D1=8B=D0=B5=20=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=D0=BB=D1=8F=D1=80=D1=8B=20ChoiceMode/SelectionMode/RowSe?= =?UTF-8?q?lectionMode/Vertical-HorizontalLines=20+=20=D0=B4=D0=B5=D0=B3?= =?UTF-8?q?=D0=B5=D0=B9=D1=82=20UseAlternationRowColor/InitialTreeView/Row?= =?UTF-8?q?PictureDataPath/RowsPicture=20(=D0=BA=D0=BB=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D0=B5=D1=80=20Table=20scalars)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Свойства таблицы, терявшиеся на раундтрипе. Часть была захвачена в декомпиляторе под gate динсписка () → терялась на обычных ValueTable-таблицах. Новые скаляры (захват + эмиссия, все типы таблиц): - choiceMode (компилятор уже эмитил — добавлен захват), selectionMode (SingleRow/…), rowSelectionMode (Row/…), verticalLines/horizontalLines (явное false). Дегейт (вынесены из блока динсписка в общую обработку Table — ловятся на ЛЮБОЙ таблице): - useAlternationRowColor, initialTreeView, rowsPicture — захват/эмиссия без gate. - rowPictureDataPath — инверсия умного дефолта DefaultPicture осталась дин-список-only; обычные таблицы захватывают/эмитят литерал. Зеркало form-compile.py идентично (py==ps1 проверено). Валидация: все 7 целевых — 0 LOST / 0 ADDED; round-trip на ValueTable-формах (АдреснаяКнига и др.); регресс 33/33 ps+py; harness 8448→8368 (на честной метрике после фикса атрибуции), 0 fail. Остаток по таблицам — companion-контент (ExtendedTooltip/AutoCommandBar/ContextMenu) и цвета/шрифты — отдельные кластеры. Co-Authored-By: Claude Opus 4.8 --- .../form-compile/scripts/form-compile.ps1 | 12 +++++--- .../form-compile/scripts/form-compile.py | 18 ++++++++---- .../form-decompile/scripts/form-decompile.ps1 | 28 ++++++++++--------- docs/form-dsl-spec.md | 9 ++++-- 4 files changed, 43 insertions(+), 24 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 67845d3a..f850aded 100644 --- a/.claude/skills/form-compile/scripts/form-compile.ps1 +++ b/.claude/skills/form-compile/scripts/form-compile.ps1 @@ -1,4 +1,4 @@ -# form-compile v1.42 — Compile 1C managed form from JSON or object metadata +# form-compile v1.43 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2342,6 +2342,7 @@ function Emit-Element { "excludedCommands"=1 "choiceMode"=1;"initialTreeView"=1;"enableDrag"=1;"enableStartDrag"=1 "rowPictureDataPath"=1;"tableAutofill"=1 + "rowSelectionMode"=1;"verticalLines"=1;"horizontalLines"=1 # dynamic-list table block "defaultItem"=1;"useAlternationRowColor"=1;"fileDragMode"=1;"autoRefresh"=1 "autoRefreshPeriod"=1;"choiceFoldersAndItems"=1;"restoreCurrentRow"=1;"showRoot"=1 @@ -2972,9 +2973,7 @@ function Emit-LabelField { # DSL-ключ переопределяет; декомпилятор инвертирует (опускает значения = дефолту). function Emit-DynListTableBlock { param($el, [string]$indent) - # UseAlternationRowColor — специфично для list-таблицы (defaultItem/fileDragMode/ - # enableStartDrag — общие, эмитятся в Emit-Layout) - if ($el.useAlternationRowColor -eq $true) { X "$indenttrue" } + # (useAlternationRowColor — общее свойство таблицы, эмитится в Emit-Table) # Group A (гарант. блок, n=5079): дефолт + override $ar = if ($el.autoRefresh -eq $true) { "true" } else { "false" } X "$indent$ar" @@ -3037,6 +3036,11 @@ function Emit-Table { X "$inner$($el.searchStringLocation)" } if ($el.choiceMode -eq $true) { X "$innertrue" } + if ($el.useAlternationRowColor -eq $true) { X "$innertrue" } + if ($el.selectionMode) { X "$inner$($el.selectionMode)" } + if ($el.rowSelectionMode) { X "$inner$($el.rowSelectionMode)" } + if ($el.verticalLines -eq $false) { X "$innerfalse" } + if ($el.horizontalLines -eq $false) { X "$innerfalse" } if ($el.initialTreeView) { X "$inner$($el.initialTreeView)" } if ($el.enableDrag -eq $true) { X "$innertrue" } if ($el.rowPictureDataPath) { X "$inner$($el.rowPictureDataPath)" } diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index fd508f9c..fec14f8c 100644 --- a/.claude/skills/form-compile/scripts/form-compile.py +++ b/.claude/skills/form-compile/scripts/form-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# form-compile v1.42 — Compile 1C managed form from JSON or object metadata +# form-compile v1.43 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -1783,6 +1783,7 @@ KNOWN_KEYS = { "src", "valuesPicture", "loadTransparent", "autofill", "choiceMode", "initialTreeView", "enableDrag", "enableStartDrag", + "rowSelectionMode", "verticalLines", "horizontalLines", "rowPictureDataPath", "tableAutofill", # dynamic-list table block "defaultItem", "useAlternationRowColor", "fileDragMode", "autoRefresh", @@ -2671,10 +2672,7 @@ def emit_label_field(lines, el, name, eid, indent): # Блок свойств таблицы, привязанной к динамическому списку (Group A defaults + B/C). def emit_dynlist_table_block(lines, el, indent): - # UseAlternationRowColor — специфично для list-таблицы (defaultItem/fileDragMode/ - # enableStartDrag — общие, эмитятся в emit_layout) - if el.get('useAlternationRowColor') is True: - lines.append(f'{indent}true') + # (useAlternationRowColor — общее свойство таблицы, эмитится в emit_table) # Group A (гарант. блок): дефолт + override ar = 'true' if el.get('autoRefresh') is True else 'false' lines.append(f'{indent}{ar}') @@ -2740,6 +2738,16 @@ def emit_table(lines, el, name, eid, indent): if el.get('choiceMode') is True: lines.append(f'{inner}true') + if el.get('useAlternationRowColor') is True: + lines.append(f'{inner}true') + if el.get('selectionMode'): + lines.append(f'{inner}{el["selectionMode"]}') + if el.get('rowSelectionMode'): + lines.append(f'{inner}{el["rowSelectionMode"]}') + if el.get('verticalLines') is False: + lines.append(f'{inner}false') + if el.get('horizontalLines') is False: + lines.append(f'{inner}false') if el.get('initialTreeView'): lines.append(f'{inner}{el["initialTreeView"]}') if el.get('enableDrag') is True: diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index 15db297c..751b0510 100644 --- a/.claude/skills/form-decompile/scripts/form-decompile.ps1 +++ b/.claude/skills/form-decompile/scripts/form-decompile.ps1 @@ -1,4 +1,4 @@ -# form-decompile v0.24 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.25 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -986,10 +986,18 @@ function Decompile-Element { $ssl = Get-Child $node 'SearchStringLocation'; if ($ssl) { $obj['searchStringLocation'] = $ssl } $vsl = Get-Child $node 'ViewStatusLocation'; if ($vsl) { $obj['viewStatusLocation'] = $vsl } $scl = Get-Child $node 'SearchControlLocation'; if ($scl) { $obj['searchControlLocation'] = $scl } - # --- Блок свойств дин-список-таблицы (признак: дочерний ) --- + # --- Общие свойства таблицы (любой тип таблицы, не только динсписок) --- + if ((Get-Child $node 'ChoiceMode') -eq 'true') { $obj['choiceMode'] = $true } + $selm = Get-Child $node 'SelectionMode'; if ($selm) { $obj['selectionMode'] = $selm } + $rsm = Get-Child $node 'RowSelectionMode'; if ($rsm) { $obj['rowSelectionMode'] = $rsm } + if ((Get-Child $node 'VerticalLines') -eq 'false') { $obj['verticalLines'] = $false } + if ((Get-Child $node 'HorizontalLines') -eq 'false') { $obj['horizontalLines'] = $false } + if ((Get-Child $node 'UseAlternationRowColor') -eq 'true') { $obj['useAlternationRowColor'] = $true } + $itv = Get-Child $node 'InitialTreeView'; if ($itv) { $obj['initialTreeView'] = $itv } + $rpRef = $node.SelectSingleNode("lf:RowsPicture/xr:Ref", $ns); if ($rpRef) { $obj['rowsPicture'] = $rpRef.InnerText } + $rpdp = Get-Child $node 'RowPictureDataPath' + # --- Блок дин-список-таблицы (признак: дочерний ) --- if (Has-Child $node 'UpdateOnDataChange') { - $listName = Get-Child $node 'DataPath' - # Group A (инверсия дефолтов) if ((Get-Child $node 'AutoRefresh') -eq 'true') { $obj['autoRefresh'] = $true } $arp = Get-Child $node 'AutoRefreshPeriod'; if ($arp -and $arp -ne '60') { $obj['autoRefreshPeriod'] = [int]$arp } $cfi = Get-Child $node 'ChoiceFoldersAndItems'; if ($cfi -and $cfi -ne 'Items') { $obj['choiceFoldersAndItems'] = $cfi } @@ -998,17 +1006,11 @@ function Decompile-Element { if ((Get-Child $node 'AllowRootChoice') -eq 'true') { $obj['allowRootChoice'] = $true } $uodc = Get-Child $node 'UpdateOnDataChange'; if ($uodc -and $uodc -ne 'Auto') { $obj['updateOnDataChange'] = $uodc } if ((Get-Child $node 'AllowGettingCurrentRowURL') -eq 'false') { $obj['allowGettingCurrentRowURL'] = $false } - # list-таблица: useAlternationRowColor/initialTreeView (defaultItem/enableStartDrag/ - # fileDragMode — общие, ловятся в Add-Layout) - if ((Get-Child $node 'UseAlternationRowColor') -eq 'true') { $obj['useAlternationRowColor'] = $true } - $itv = Get-Child $node 'InitialTreeView'; if ($itv) { $obj['initialTreeView'] = $itv } - # Group C - $rpdp = Get-Child $node 'RowPictureDataPath' + # RowPictureDataPath: инверсия умного дефолта <Список>.DefaultPicture if ($null -eq $rpdp) { $obj['rowPictureDataPath'] = '' } - elseif ($rpdp -ne "$listName.DefaultPicture") { $obj['rowPictureDataPath'] = $rpdp } - $rpRef = $node.SelectSingleNode("lf:RowsPicture/xr:Ref", $ns); if ($rpRef) { $obj['rowsPicture'] = $rpRef.InnerText } + elseif ($rpdp -ne "$($obj['path']).DefaultPicture") { $obj['rowPictureDataPath'] = $rpdp } $usg = Get-Child $node 'UserSettingsGroup'; if ($usg) { $obj['userSettingsGroup'] = $usg } - } + } elseif ($rpdp) { $obj['rowPictureDataPath'] = $rpdp } $csNode = $node.SelectSingleNode("lf:CommandSet", $ns) if ($csNode) { $exc = New-Object System.Collections.ArrayList diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index d5af86d0..e17b8671 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -320,6 +320,13 @@ | `autoInsertNewRow` | bool | Автодобавление новой строки | | `enableDrag` | bool | Разрешить перетаскивание из таблицы | | `rowFilter` | null | Отбор строк (nil-плейсхолдер ``); значение всегда `null` | +| `choiceMode` | bool | Режим выбора | +| `useAlternationRowColor` | bool | Чередование цвета строк | +| `selectionMode` | string | Режим выделения (`SingleRow`, …) | +| `rowSelectionMode` | string | Режим выделения строки (`Row`, …) | +| `verticalLines` / `horizontalLines` | bool | Линии сетки (эмитится явное `false`) | +| `initialTreeView` | string | `ExpandTopLevel`, `ExpandAllLevels`, `NoExpand` | +| `rowsPicture` | string | Картинка строк (`CommonPicture.X`) | | `height` | int | Высота в строках таблицы | | `header` | bool | Показывать шапку | | `footer` | bool | Показывать подвал | @@ -336,8 +343,6 @@ | Свойство | Тип | Умолчание | Описание | |----------|-----|-----------|----------| | `rowPictureDataPath` | string | `<Список>.DefaultPicture` (если есть осн. таблица) | Путь к картинке строки. `""` — подавить авто-вывод | -| `useAlternationRowColor` | bool | — | Чередование цвета строк | -| `initialTreeView` | string | — | `ExpandTopLevel`, `ExpandAllLevels`, `NoExpand` | | `autoRefresh` | bool | `false` | Автообновление | | `autoRefreshPeriod` | int | `60` | Период автообновления, сек | | `choiceFoldersAndItems` | string | `Items` | `Items`, `Folders`, `FoldersAndItems` |