diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index c9da793b..54d4ec44 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.55 — Compile 1C managed form from JSON or object metadata +# form-compile v1.56 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2435,7 +2435,7 @@ function Emit-Element { # label/hyperlink "hyperlink"=1;"formatted"=1 # group-specific - "showTitle"=1;"united"=1;"collapsed"=1 + "showTitle"=1;"united"=1;"collapsed"=1;"behavior"=1 # hierarchy "children"=1;"columns"=1 # table-specific @@ -2635,23 +2635,27 @@ function Emit-Group { Emit-Title -el $el -name $name -indent $inner - # Group orientation - $groupVal = "$($el.group)" + # Group orientation (направление). Legacy: group:'collapsible' = Vertical + behavior collapsible. + $groupVal = "$($el.group)".ToLower() $orientation = switch ($groupVal) { "horizontal" { "Horizontal" } "vertical" { "Vertical" } - "alwaysHorizontal" { "AlwaysHorizontal" } - "alwaysVertical" { "AlwaysVertical" } + "alwayshorizontal" { "AlwaysHorizontal" } + "alwaysvertical" { "AlwaysVertical" } + "collapsible" { "Vertical" } default { $null } } if ($orientation) { X "$inner$orientation" } - # Behavior - if ($groupVal -eq "collapsible") { - X "$innerVertical" - X "$innerCollapsible" - if ($el.collapsed -eq $true) { X "$innertrue" } + # Behavior: ключ behavior (usual/collapsible/popup) → ; отсутствие = Авто (не эмитим). + # Legacy: group:'collapsible' эквивалентно behavior:'collapsible'. + $behaviorVal = if ($el.behavior) { "$($el.behavior)".ToLower() } elseif ($groupVal -eq "collapsible") { "collapsible" } else { $null } + $bmap = @{ "usual"="Usual"; "collapsible"="Collapsible"; "popup"="PopUp" } + if ($behaviorVal -and $bmap.ContainsKey($behaviorVal)) { + X "$inner$($bmap[$behaviorVal])" } + # Collapsed — у Collapsible и PopUp (не привязано к одному behavior) + if ($el.collapsed -eq $true) { X "$innertrue" } # Representation if ($el.representation) { diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 712a1b9e..dab697f9 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.55 — Compile 1C managed form from JSON or object metadata +# form-compile v1.56 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -1773,7 +1773,7 @@ KNOWN_KEYS = { "spinButton", "dropListButton", "markIncomplete", "skipOnInput", "inputHint", "textEdit", "hyperlink", "formatted", - "showTitle", "united", "collapsed", + "showTitle", "united", "collapsed", "behavior", "children", "columns", "changeRowSet", "changeRowOrder", "autoInsertNewRow", "rowFilter", "header", "footer", "commandBarLocation", "searchStringLocation", "viewStatusLocation", "searchControlLocation", @@ -2545,23 +2545,27 @@ def emit_group(lines, el, name, eid, indent): emit_title(lines, el, name, inner) # Group orientation - group_val = str(el.get('group', '')) + # Group orientation (направление). Legacy: group:'collapsible' = Vertical + behavior collapsible. + group_val = str(el.get('group', '')).lower() orientation_map = { 'horizontal': 'Horizontal', 'vertical': 'Vertical', - 'alwaysHorizontal': 'AlwaysHorizontal', - 'alwaysVertical': 'AlwaysVertical', + 'alwayshorizontal': 'AlwaysHorizontal', + 'alwaysvertical': 'AlwaysVertical', + 'collapsible': 'Vertical', } orientation = orientation_map.get(group_val) if orientation: lines.append(f'{inner}{orientation}') - # Behavior - if group_val == 'collapsible': - lines.append(f'{inner}Vertical') - lines.append(f'{inner}Collapsible') - if el.get('collapsed') is True: - lines.append(f'{inner}true') + # Behavior: ключ behavior (usual/collapsible/popup) → ; отсутствие = Авто (не эмитим). + behavior_val = str(el['behavior']).lower() if el.get('behavior') else ('collapsible' if group_val == 'collapsible' else None) + bmap = {'usual': 'Usual', 'collapsible': 'Collapsible', 'popup': 'PopUp'} + if behavior_val and behavior_val in bmap: + lines.append(f'{inner}{bmap[behavior_val]}') + # Collapsed — у Collapsible и PopUp (не привязано к одному behavior) + if el.get('collapsed') is True: + lines.append(f'{inner}true') # Representation if el.get('representation'): diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index abb46023..cdef99c7 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.37 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.38 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -989,12 +989,15 @@ function Decompile-Element { switch ($tag) { 'UsualGroup' { + # group = направление (); behavior = (Авто = нет тега → ключ опускаем). $g = Get-Child $node 'Group' $gmap = @{ 'Horizontal'='horizontal'; 'Vertical'='vertical'; 'AlwaysHorizontal'='alwaysHorizontal'; 'AlwaysVertical'='alwaysVertical' } + if ($g -and $gmap.ContainsKey($g)) { $obj[$key] = $gmap[$g] } else { $obj[$key] = 'vertical' } $behavior = Get-Child $node 'Behavior' - if ($behavior -eq 'Collapsible') { $obj[$key] = 'collapsible' } - elseif ($g -and $gmap.ContainsKey($g)) { $obj[$key] = $gmap[$g] } - else { $obj[$key] = 'vertical' } + if ($behavior) { + $bmap = @{ 'Usual'='usual'; 'Collapsible'='collapsible'; 'PopUp'='popup' } + if ($bmap.ContainsKey($behavior)) { $obj['behavior'] = $bmap[$behavior] } else { $obj['behavior'] = $behavior } + } $obj['name'] = $name Add-CommonProps $obj $node $name $rep = Get-Child $node 'Representation' diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index dd503373..baf49cd8 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -272,7 +272,9 @@ companion-панели с собственным контентом. Оба не | Свойство | Тип | Описание | |----------|-----|----------| -| `group` | string | Ориентация: `horizontal`, `vertical`, `alwaysHorizontal`, `alwaysVertical`, `collapsible` | +| `group` | string | Ориентация: `horizontal`, `vertical`, `alwaysHorizontal`, `alwaysVertical`. (Legacy: `collapsible` = `vertical` + `behavior:'collapsible'`) | +| `behavior` | string | Поведение (``): `usual`, `collapsible`, `popup`. **Отсутствие = Авто** (дефолт, не эмитится). Свёртываемая/всплывающая несут доп. свойства | +| `collapsed` | bool | Свёрнута (у `collapsible`/`popup`) | | `children` | array | Вложенные элементы | | `showTitle` | bool | Показывать заголовок группы | | `representation` | string | `none`, `normal`, `weak`, `strong` | diff --git a/tests/skills/cases/form-compile/groups.json b/tests/skills/cases/form-compile/groups.json index f8dacb58..50f31cb5 100644 --- a/tests/skills/cases/form-compile/groups.json +++ b/tests/skills/cases/form-compile/groups.json @@ -17,12 +17,12 @@ "title": "Группы", "elements": [ { "cmdBar": "КоманднаяПанель", "autofill": true }, - { "group": "horizontal", "name": "ГруппаШапка", "showTitle": true, "title": "Шапка", "horizontalStretch": true, "groupHorizontalAlign": "Right", "children": [ + { "group": "horizontal", "name": "ГруппаШапка", "behavior": "usual", "showTitle": true, "title": "Шапка", "horizontalStretch": true, "groupHorizontalAlign": "Right", "children": [ { "input": "Поле1", "path": "Поле1", "title": "Поле 1", "width": 20, "skipOnInput": true }, { "input": "Поле2", "path": "Поле2", "title": "Поле 2" }, { "labelField": "Метка", "path": "Поле1", "groupVerticalAlign": "Center" } ]}, - { "group": "vertical", "name": "ГруппаПодвал", "title": { "ru": "Подвал", "en": "Footer" }, "children": [ + { "group": "vertical", "name": "ГруппаПодвал", "behavior": "collapsible", "collapsed": true, "title": { "ru": "Подвал", "en": "Footer" }, "children": [ { "input": "Поле3", "path": "Поле3", "title": "Поле 3" } ]} ], diff --git a/tests/skills/cases/form-compile/snapshots/groups/DataProcessors/СГруппами/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/groups/DataProcessors/СГруппами/Forms/Форма/Ext/Form.xml index 4deed132..837f212b 100644 --- a/tests/skills/cases/form-compile/snapshots/groups/DataProcessors/СГруппами/Forms/Форма/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/groups/DataProcessors/СГруппами/Forms/Форма/Ext/Form.xml @@ -23,6 +23,7 @@ Horizontal + Usual true Right @@ -71,6 +72,8 @@ Vertical + Collapsible + true