feat(form-decompile,form-compile): размазанный блок скаляров InputField + общие cell-свойства полей

Партия простых скаляров полей, которые не захватывались (платформа эмитит явное
не-дефолтное значение):
  - InputField-специфичные: Wrap, OpenButton, ListChoiceMode, ExtendedEditMultipleValues,
    ChooseType, ChoiceButtonRepresentation — в Emit-Input / InputField-кейс.
  - Общие cell-свойства поля-колонки (Input/Label/Picture/CheckBox/ColumnGroup):
    ShowInHeader, ShowInFooter, AutoCellHeight, FooterHorizontalAlign, HeaderHorizontalAlign —
    вынесены в общий Emit-CommonElementProps / Add-Layout (захват «как есть»).
    ColumnGroup: собственная эмиссия ShowInHeader убрана (общий путь покрывает) —
    устранён двойной эмит.

TOTAL diff lines выборки 2.17: 3179 → 2912 (-267), match 17 → 20 (+3 чистых формы).
Все обработанные скаляры residual → 0. Снапшот input-fields (+скаляры) сертифицирован
в 1С (8.3.24). Регресс form-compile 34/34 зелёный на ps + python.
decompile v0.39, compile v1.57.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-07 14:58:17 +03:00
co-authored by Claude Opus 4.8
parent 27f5da4829
commit 701d56b075
6 changed files with 72 additions and 13 deletions
@@ -1,4 +1,4 @@
# form-compile v1.56 — Compile 1C managed form from JSON or object metadata
# form-compile v1.57 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -2432,6 +2432,9 @@ function Emit-Element {
"multiLine"=1;"passwordMode"=1;"choiceButton"=1;"clearButton"=1
"spinButton"=1;"dropListButton"=1;"markIncomplete"=1;"skipOnInput"=1;"inputHint"=1
"textEdit"=1
"wrap"=1;"openButton"=1;"listChoiceMode"=1;"showInFooter"=1
"extendedEditMultipleValues"=1;"chooseType"=1;"autoCellHeight"=1
"choiceButtonRepresentation"=1;"footerHorizontalAlign"=1;"headerHorizontalAlign"=1
# label/hyperlink
"hyperlink"=1;"formatted"=1
# group-specific
@@ -2543,6 +2546,12 @@ function Emit-CommonElementProps {
}
if ($el.enableStartDrag -eq $true) { X "$indent<EnableStartDrag>true</EnableStartDrag>" }
if ($el.fileDragMode) { X "$indent<FileDragMode>$($el.fileDragMode)</FileDragMode>" }
# Cell-свойства поля в таблице (общие для Input/Label/Picture/CheckBox): захват «как есть»
foreach ($p in @(@('showInHeader','ShowInHeader'), @('showInFooter','ShowInFooter'), @('autoCellHeight','AutoCellHeight'))) {
if ($null -ne $el.($p[0])) { X "$indent<$($p[1])>$(if ($el.($p[0])){'true'}else{'false'})</$($p[1])>" }
}
if ($el.footerHorizontalAlign) { X "$indent<FooterHorizontalAlign>$($el.footerHorizontalAlign)</FooterHorizontalAlign>" }
if ($el.headerHorizontalAlign) { X "$indent<HeaderHorizontalAlign>$($el.headerHorizontalAlign)</HeaderHorizontalAlign>" }
}
function Emit-Layout {
@@ -2712,10 +2721,7 @@ function Emit-ColumnGroup {
if ($orientation) { X "$inner<Group>$orientation</Group>" }
if ($el.showTitle -eq $false) { X "$inner<ShowTitle>false</ShowTitle>" }
if ($null -ne $el.showInHeader) {
$shVal = if ($el.showInHeader) { "true" } else { "false" }
X "$inner<ShowInHeader>$shVal</ShowInHeader>"
}
# showInHeader эмитится общим Emit-CommonElementProps (через Emit-Layout)
Emit-CommonFlags -el $el -indent $inner
Emit-Layout -el $el -indent $inner
@@ -2768,6 +2774,14 @@ function Emit-Input {
if ($el.markIncomplete -eq $true) { X "$inner<AutoMarkIncomplete>true</AutoMarkIncomplete>" }
if ($el.editMode) { X "$inner<EditMode>$($el.editMode)</EditMode>" }
if ($el.textEdit -eq $false) { X "$inner<TextEdit>false</TextEdit>" }
# InputField-специфичные скаляры (захват «как есть»: платформа эмитит явное не-дефолтное значение)
foreach ($p in @(
@('wrap','Wrap'), @('openButton','OpenButton'), @('listChoiceMode','ListChoiceMode'),
@('extendedEditMultipleValues','ExtendedEditMultipleValues'), @('chooseType','ChooseType')
)) {
if ($null -ne $el.($p[0])) { X "$inner<$($p[1])>$(if ($el.($p[0])){'true'}else{'false'})</$($p[1])>" }
}
if ($el.choiceButtonRepresentation) { X "$inner<ChoiceButtonRepresentation>$($el.choiceButtonRepresentation)</ChoiceButtonRepresentation>" }
Emit-Layout -el $el -indent $inner -multiLineDefault ([bool]($el.multiLine -eq $true))
if ($el.inputHint) {
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.56 — Compile 1C managed form from JSON or object metadata
# form-compile v1.57 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -1771,7 +1771,10 @@ KNOWN_KEYS = {
"groupHorizontalAlign", "groupVerticalAlign", "horizontalAlign",
"multiLine", "passwordMode", "choiceButton", "clearButton",
"spinButton", "dropListButton", "markIncomplete", "skipOnInput", "inputHint",
"textEdit",
"textEdit", "choiceList",
"wrap", "openButton", "listChoiceMode", "showInHeader", "showInFooter",
"extendedEditMultipleValues", "chooseType", "autoCellHeight",
"choiceButtonRepresentation", "footerHorizontalAlign", "headerHorizontalAlign",
"hyperlink", "formatted",
"showTitle", "united", "collapsed", "behavior",
"children", "columns",
@@ -2198,6 +2201,14 @@ def emit_common_element_props(lines, el, indent):
lines.append(f"{indent}<EnableStartDrag>true</EnableStartDrag>")
if el.get('fileDragMode'):
lines.append(f"{indent}<FileDragMode>{el['fileDragMode']}</FileDragMode>")
# Cell-свойства поля в таблице (общие для Input/Label/Picture/CheckBox): захват «как есть»
for key, tag in (('showInHeader', 'ShowInHeader'), ('showInFooter', 'ShowInFooter'), ('autoCellHeight', 'AutoCellHeight')):
if el.get(key) is not None:
lines.append(f'{indent}<{tag}>{"true" if el[key] else "false"}</{tag}>')
if el.get('footerHorizontalAlign'):
lines.append(f"{indent}<FooterHorizontalAlign>{el['footerHorizontalAlign']}</FooterHorizontalAlign>")
if el.get('headerHorizontalAlign'):
lines.append(f"{indent}<HeaderHorizontalAlign>{el['headerHorizontalAlign']}</HeaderHorizontalAlign>")
def emit_layout(lines, el, indent, skip_height=False, multi_line_default=False):
@@ -2620,9 +2631,7 @@ def emit_column_group(lines, el, name, eid, indent):
if el.get('showTitle') is False:
lines.append(f'{inner}<ShowTitle>false</ShowTitle>')
if el.get('showInHeader') is not None:
sh_val = 'true' if el['showInHeader'] else 'false'
lines.append(f'{inner}<ShowInHeader>{sh_val}</ShowInHeader>')
# showInHeader эмитится общим emit_common_element_props (через emit_layout)
emit_common_flags(lines, el, inner)
emit_layout(lines, el, inner)
@@ -2673,6 +2682,13 @@ def emit_input(lines, el, name, eid, indent):
lines.append(f'{inner}<EditMode>{el["editMode"]}</EditMode>')
if el.get('textEdit') is False:
lines.append(f'{inner}<TextEdit>false</TextEdit>')
# InputField-специфичные скаляры (захват «как есть»: платформа эмитит явное не-дефолтное значение)
for key, tag in (('wrap', 'Wrap'), ('openButton', 'OpenButton'), ('listChoiceMode', 'ListChoiceMode'),
('extendedEditMultipleValues', 'ExtendedEditMultipleValues'), ('chooseType', 'ChooseType')):
if el.get(key) is not None:
lines.append(f'{inner}<{tag}>{"true" if el[key] else "false"}</{tag}>')
if el.get('choiceButtonRepresentation'):
lines.append(f'{inner}<ChoiceButtonRepresentation>{el["choiceButtonRepresentation"]}</ChoiceButtonRepresentation>')
emit_layout(lines, el, inner, multi_line_default=(el.get('multiLine') is True))
if el.get('inputHint'):
@@ -1,4 +1,4 @@
# form-decompile v0.38 — Decompile 1C managed Form.xml to JSON DSL (draft)
# form-decompile v0.39 — Decompile 1C managed Form.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
param(
@@ -753,6 +753,12 @@ function Add-Layout {
$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 }
# Cell-свойства поля в таблице (общие для Input/Label/Picture/CheckBox): захват «как есть»
foreach ($p in @('ShowInHeader','ShowInFooter','AutoCellHeight')) {
$v = Get-Child $node $p; if ($null -ne $v) { $obj[($p.Substring(0,1).ToLower()+$p.Substring(1))] = ($v -eq 'true') }
}
$fha = Get-Child $node 'FooterHorizontalAlign'; if ($fha) { $obj['footerHorizontalAlign'] = $fha }
$hha = Get-Child $node 'HeaderHorizontalAlign'; if ($hha) { $obj['headerHorizontalAlign'] = $hha }
}
# TitleLocation у check/radio (зеркало Emit-TitleLocation):
@@ -1032,6 +1038,11 @@ function Decompile-Element {
foreach ($p in @('ChoiceButton','ClearButton','SpinButton','DropListButton')) {
$v = Get-Child $node $p; if ($null -ne $v) { $obj[($p.Substring(0,1).ToLower()+$p.Substring(1))] = (To-Bool $v) }
}
# InputField-специфичные скаляры (захват «как есть»)
foreach ($p in @('Wrap','OpenButton','ListChoiceMode','ExtendedEditMultipleValues','ChooseType')) {
$v = Get-Child $node $p; if ($null -ne $v) { $obj[($p.Substring(0,1).ToLower()+$p.Substring(1))] = (To-Bool $v) }
}
$cbr = Get-Child $node 'ChoiceButtonRepresentation'; if ($cbr) { $obj['choiceButtonRepresentation'] = $cbr }
$cl = Decompile-ChoiceList $node; if ($cl) { $obj['choiceList'] = $cl }
}
'CheckBoxField' {
+12 -1
View File
@@ -216,8 +216,13 @@ companion-панели с собственным контентом. Оба не
| `defaultItem` | `<DefaultItem>` | `true` (элемент активируется по умолчанию) |
| `enableStartDrag` | `<EnableStartDrag>` | `true` (разрешить начало перетаскивания) |
| `fileDragMode` | `<FileDragMode>` | `AsFile`/… (режим drag-n-drop файлов) |
| `showInHeader` | `<ShowInHeader>` | bool — показывать в шапке таблицы (поле-колонка) |
| `showInFooter` | `<ShowInFooter>` | bool — показывать в подвале таблицы |
| `autoCellHeight` | `<AutoCellHeight>` | bool — авто-высота ячейки |
| `footerHorizontalAlign` | `<FooterHorizontalAlign>` | `Left`/`Right`/`Center` |
| `headerHorizontalAlign` | `<HeaderHorizontalAlign>` | `Left`/`Right`/`Center`/`Auto` |
> `defaultItem`/`enableStartDrag`/`fileDragMode`/`skipOnInput` — общие для любого типа элемента (таблица, поле, надпись, картинка, кнопка), не только таблицы.
> `defaultItem`/`enableStartDrag`/`fileDragMode`/`skipOnInput` + cell-свойства (`showInHeader`/`showInFooter`/`autoCellHeight`/`footerHorizontalAlign`/`headerHorizontalAlign`) — общие для любого поля-колонки (input, label, picField, check).
### 4.2. События элемента и автоименование обработчиков
@@ -301,6 +306,12 @@ companion-панели с собственным контентом. Оба не
| `skipOnInput` | bool | Пропускать при вводе |
| `inputHint` | string | Подсказка ввода (placeholder) |
| `choiceList` | array | Список выбора: массив `{ value, presentation?/title? }` — та же грамматика, что у `radio` (см. ниже) |
| `wrap` | bool | Перенос по словам (`<Wrap>`) |
| `openButton` | bool | Кнопка открытия (`<OpenButton>`) |
| `listChoiceMode` | bool | Режим выбора из списка (`<ListChoiceMode>`) |
| `extendedEditMultipleValues` | bool | Расширенное редактирование нескольких значений |
| `chooseType` | bool | Выбор типа (`<ChooseType>`) |
| `choiceButtonRepresentation` | string | `ShowInInputField`, `ShowInDropList`, `ShowInDropListAndInInputField` |
| `width` | int | Ширина |
| `height` | int | Высота |
| `horizontalStretch` | bool | Растягивание по горизонтали |
@@ -18,7 +18,7 @@
"elements": [
{ "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput" },
{ "labelField": "Ссылка", "path": "ОбычноеПоле", "titleLocation": "left", "hyperlink": true },
{ "input": "МногострочноеПоле", "path": "МногострочноеПоле", "multiLine": true, "height": 5, "title": "Комментарий" },
{ "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": "Пароль" },
{ "input": "ПолеСКнопками", "path": "ПолеСКнопками", "choiceButton": true, "clearButton": true, "title": "Выбор" },
{ "input": "ПолеСписокВыбора", "path": "ПолеСписокВыбора", "title": "Список выбора", "choiceList": [
@@ -44,6 +44,13 @@
</v8:item>
</Title>
<MultiLine>true</MultiLine>
<Wrap>false</Wrap>
<OpenButton>false</OpenButton>
<ChooseType>false</ChooseType>
<ShowInHeader>false</ShowInHeader>
<ShowInFooter>false</ShowInFooter>
<AutoCellHeight>true</AutoCellHeight>
<FooterHorizontalAlign>Right</FooterHorizontalAlign>
<AutoMaxWidth>false</AutoMaxWidth>
<Height>5</Height>
<ContextMenu name="МногострочноеПолеКонтекстноеМеню" id="8"/>