From 5112dbec9e17aa6ba07186b678ce0d4d562d211d Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 7 Jun 2026 15:11:12 +0300 Subject: [PATCH] =?UTF-8?q?feat(form-decompile,form-compile):=20Horizontal?= =?UTF-8?q?Stretch/VerticalStretch=20=E2=80=94=20=D0=B7=D0=B0=D1=85=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=20=D1=8F=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20false?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Растягивание (/) платформа эмитит явным значением (false 38145 / true 25002 для HS; на Input/Label/Picture/Group/CommandBar). Декомпилятор/ компилятор работали только с true → явный false терялся. Теперь захват и эмиссия фактического значения (true И false); отсутствие = дефолт (не эмитим). Бэк-совместимо: true как раньше, +false. Раньше декомпилятор писал ключ лишь при true — теперь и при false. TOTAL diff lines выборки 2.17: 2912 → 2727 (-185), match 20 → 22. Stretch residual 92 → 1 (остаток — на companion ExtendedTooltip, отдельный кластер). Снапшот input-fields (+stretch false) сертифицирован в 1С (8.3.24). Регресс form-compile 34/34 зелёный на ps + python. decompile v0.40, compile v1.58. Co-Authored-By: Claude Opus 4.8 --- .claude/skills/form-compile/scripts/form-compile.ps1 | 6 +++--- .claude/skills/form-compile/scripts/form-compile.py | 10 +++++----- .../skills/form-decompile/scripts/form-decompile.ps1 | 7 ++++--- docs/form-dsl-spec.md | 4 ++-- tests/skills/cases/form-compile/input-fields.json | 2 +- .../DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml | 2 ++ 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 3e11f62c..532fbff3 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.57 — Compile 1C managed form from JSON or object metadata +# form-compile v1.58 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2568,8 +2568,8 @@ function Emit-Layout { if ($null -ne $el.maxHeight) { X "$indent$($el.maxHeight)" } if ($el.width) { X "$indent$($el.width)" } if (-not $skipHeight -and $el.height) { X "$indent$($el.height)" } - if ($el.horizontalStretch -eq $true) { X "$indenttrue" } - if ($el.verticalStretch -eq $true) { X "$indenttrue" } + if ($null -ne $el.horizontalStretch) { X "$indent$(if ($el.horizontalStretch){'true'}else{'false'})" } + if ($null -ne $el.verticalStretch) { X "$indent$(if ($el.verticalStretch){'true'}else{'false'})" } if ($el.groupHorizontalAlign) { X "$indent$($el.groupHorizontalAlign)" } if ($el.groupVerticalAlign) { X "$indent$($el.groupVerticalAlign)" } if ($el.horizontalAlign) { X "$indent$($el.horizontalAlign)" } diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index c1ee2f0a..4a8be6f8 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.57 — Compile 1C managed form from JSON or object metadata +# form-compile v1.58 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -2232,10 +2232,10 @@ def emit_layout(lines, el, indent, skip_height=False, multi_line_default=False): lines.append(f"{indent}{el['width']}") if not skip_height and el.get('height'): lines.append(f"{indent}{el['height']}") - if el.get('horizontalStretch') is True: - lines.append(f"{indent}true") - if el.get('verticalStretch') is True: - lines.append(f"{indent}true") + if el.get('horizontalStretch') is not None: + lines.append(f'{indent}{"true" if el["horizontalStretch"] else "false"}') + if el.get('verticalStretch') is not None: + lines.append(f'{indent}{"true" if el["verticalStretch"] else "false"}') if el.get('groupHorizontalAlign'): lines.append(f"{indent}{el['groupHorizontalAlign']}") if el.get('groupVerticalAlign'): diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index f5604d5b..5d352865 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.39 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.40 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -748,8 +748,9 @@ function Add-Layout { $mh = Get-Child $node 'MaxHeight'; if ($mh) { $obj['maxHeight'] = [int]$mh } $w = Get-Child $node 'Width'; if ($w) { $obj['width'] = [int]$w } $h = Get-Child $node 'Height'; if ($h) { $obj['height'] = [int]$h } - if ((Get-Child $node 'HorizontalStretch') -eq 'true') { $obj['horizontalStretch'] = $true } - if ((Get-Child $node 'VerticalStretch') -eq 'true') { $obj['verticalStretch'] = $true } + # Stretch: захват фактического значения (true И false — платформа эмитит явное) + $hs = Get-Child $node 'HorizontalStretch'; if ($null -ne $hs) { $obj['horizontalStretch'] = ($hs -eq 'true') } + $vs = Get-Child $node 'VerticalStretch'; if ($null -ne $vs) { $obj['verticalStretch'] = ($vs -eq 'true') } $gha = Get-Child $node 'GroupHorizontalAlign'; if ($gha) { $obj['groupHorizontalAlign'] = $gha } $gva = Get-Child $node 'GroupVerticalAlign'; if ($gva) { $obj['groupVerticalAlign'] = $gva } $ha = Get-Child $node 'HorizontalAlign'; if ($ha) { $obj['horizontalAlign'] = $ha } diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index 052bcf65..313cf8d6 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -203,8 +203,8 @@ companion-панели с собственным контентом. Оба не |----------|-----|----------| | `width` | `` | число | | `height` | `` | число (у `table` → ``, высота в строках) | -| `horizontalStretch` | `` | `true` | -| `verticalStretch` | `` | `true` | +| `horizontalStretch` | `` | `true`/`false` (эмитится явное значение; отсутствие = дефолт) | +| `verticalStretch` | `` | `true`/`false` (аналогично) | | `autoMaxWidth` | `` | `false` (у `input` при `multiLine` подставляется автоматически) | | `autoMaxHeight` | `` | `false` | | `maxWidth` | `` | число | diff --git a/tests/skills/cases/form-compile/input-fields.json b/tests/skills/cases/form-compile/input-fields.json index ab843b18..714591a4 100644 --- a/tests/skills/cases/form-compile/input-fields.json +++ b/tests/skills/cases/form-compile/input-fields.json @@ -16,7 +16,7 @@ "input": { "title": "Поля ввода", "elements": [ - { "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput" }, + { "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput", "horizontalStretch": false, "verticalStretch": false }, { "labelField": "Ссылка", "path": "ОбычноеПоле", "titleLocation": "left", "hyperlink": true }, { "input": "МногострочноеПоле", "path": "МногострочноеПоле", "multiLine": true, "height": 5, "title": "Комментарий", "wrap": false, "showInHeader": false, "showInFooter": false, "autoCellHeight": true, "footerHorizontalAlign": "Right", "openButton": false, "chooseType": false }, { "input": "ПолеПароля", "path": "ПолеПароля", "passwordMode": true, "title": "Пароль" }, diff --git a/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml index 4300ab90..1e20b1d9 100644 --- a/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml @@ -25,6 +25,8 @@ ShowBottom EnterOnInput + false + false