feat(form-decompile,form-compile): HorizontalStretch/VerticalStretch — захват явного false

Растягивание (<HorizontalStretch>/<VerticalStretch>) платформа эмитит явным значением
(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 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-07 15:11:12 +03:00
parent 701d56b075
commit 5112dbec9e
6 changed files with 17 additions and 14 deletions
@@ -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<MaxHeight>$($el.maxHeight)</MaxHeight>" }
if ($el.width) { X "$indent<Width>$($el.width)</Width>" }
if (-not $skipHeight -and $el.height) { X "$indent<Height>$($el.height)</Height>" }
if ($el.horizontalStretch -eq $true) { X "$indent<HorizontalStretch>true</HorizontalStretch>" }
if ($el.verticalStretch -eq $true) { X "$indent<VerticalStretch>true</VerticalStretch>" }
if ($null -ne $el.horizontalStretch) { X "$indent<HorizontalStretch>$(if ($el.horizontalStretch){'true'}else{'false'})</HorizontalStretch>" }
if ($null -ne $el.verticalStretch) { X "$indent<VerticalStretch>$(if ($el.verticalStretch){'true'}else{'false'})</VerticalStretch>" }
if ($el.groupHorizontalAlign) { X "$indent<GroupHorizontalAlign>$($el.groupHorizontalAlign)</GroupHorizontalAlign>" }
if ($el.groupVerticalAlign) { X "$indent<GroupVerticalAlign>$($el.groupVerticalAlign)</GroupVerticalAlign>" }
if ($el.horizontalAlign) { X "$indent<HorizontalAlign>$($el.horizontalAlign)</HorizontalAlign>" }
@@ -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}<Width>{el['width']}</Width>")
if not skip_height and el.get('height'):
lines.append(f"{indent}<Height>{el['height']}</Height>")
if el.get('horizontalStretch') is True:
lines.append(f"{indent}<HorizontalStretch>true</HorizontalStretch>")
if el.get('verticalStretch') is True:
lines.append(f"{indent}<VerticalStretch>true</VerticalStretch>")
if el.get('horizontalStretch') is not None:
lines.append(f'{indent}<HorizontalStretch>{"true" if el["horizontalStretch"] else "false"}</HorizontalStretch>')
if el.get('verticalStretch') is not None:
lines.append(f'{indent}<VerticalStretch>{"true" if el["verticalStretch"] else "false"}</VerticalStretch>')
if el.get('groupHorizontalAlign'):
lines.append(f"{indent}<GroupHorizontalAlign>{el['groupHorizontalAlign']}</GroupHorizontalAlign>")
if el.get('groupVerticalAlign'):
@@ -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 }
+2 -2
View File
@@ -203,8 +203,8 @@ companion-панели с собственным контентом. Оба не
|----------|-----|----------|
| `width` | `<Width>` | число |
| `height` | `<Height>` | число (у `table``<HeightInTableRows>`, высота в строках) |
| `horizontalStretch` | `<HorizontalStretch>` | `true` |
| `verticalStretch` | `<VerticalStretch>` | `true` |
| `horizontalStretch` | `<HorizontalStretch>` | `true`/`false` (эмитится явное значение; отсутствие = дефолт) |
| `verticalStretch` | `<VerticalStretch>` | `true`/`false` (аналогично) |
| `autoMaxWidth` | `<AutoMaxWidth>` | `false` (у `input` при `multiLine` подставляется автоматически) |
| `autoMaxHeight` | `<AutoMaxHeight>` | `false` |
| `maxWidth` | `<MaxWidth>` | число |
@@ -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": "Пароль" },
@@ -25,6 +25,8 @@
</ToolTip>
<ToolTipRepresentation>ShowBottom</ToolTipRepresentation>
<EditMode>EnterOnInput</EditMode>
<HorizontalStretch>false</HorizontalStretch>
<VerticalStretch>false</VerticalStretch>
<ContextMenu name="ОбычноеПолеКонтекстноеМеню" id="2"/>
<ExtendedTooltip name="ОбычноеПолеРасширеннаяПодсказка" id="3"/>
</InputField>