diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 7ab7a1ff..19c8b0d1 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.82 — Compile 1C managed form from JSON or object metadata +# form-compile v1.83 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -3609,16 +3609,15 @@ function Emit-Label { X "$indent" $inner = "$indent`t" - Emit-DecorationTitle -el $el -name $name -indent $inner -auto - + # Порядок как у платформы: own-content (флаги/hyperlink/layout/оформление) ПЕРЕД Title + # (корпус layout-first 16970 vs 44 — заодно убирает шум атрибуции харнесса на многострочном Title). Emit-CommonFlags -el $el -indent $inner - if ($el.hyperlink -eq $true) { X "$innertrue" } Emit-Layout -el $el -indent $inner - - # Оформление (цвета/шрифт/граница) — перед компаньонами (профиль декорации) Emit-Appearance -el $el -indent $inner -profile 'decoration' + Emit-DecorationTitle -el $el -name $name -indent $inner -auto + # Companions Emit-CompanionPanel -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner -panel $el.contextMenu Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip @@ -3967,11 +3966,14 @@ function Emit-PictureDecoration { Emit-DecorationTitle -el $el -name $name -indent $inner Emit-CommonFlags -el $el -indent $inner - if ($el.picture -or $el.src) { - $ref = if ($el.src) { "$($el.src)" } else { "$($el.picture)" } + # Источник картинки — ТОЛЬКО $el.src (у PictureDecoration ключ 'picture' = тип/имя элемента, не источник). + # Префикс "abs:" → встроенная картинка ; иначе именованная/стилевая . + if ($el.src) { + $srcStr = "$($el.src)" $lt = if ($el.loadTransparent -eq $true) { "true" } else { "false" } X "$inner" - X "$inner`t$ref" + if ($srcStr -match '^abs:(.*)$') { X "$inner`t$(Esc-Xml $matches[1])" } + else { X "$inner`t$(Esc-Xml $srcStr)" } X "$inner`t$lt" X "$inner" } diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 84e32c3f..a3504e0b 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.82 — Compile 1C managed form from JSON or object metadata +# form-compile v1.83 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -3314,17 +3314,16 @@ def emit_label(lines, el, name, eid, indent): lines.append(f'{indent}') inner = f'{indent}\t' - emit_decoration_title(lines, el, name, inner, auto=True) - + # Порядок как у платформы: own-content (флаги/hyperlink/layout/оформление) ПЕРЕД Title + # (корпус layout-first 16970 vs 44 — заодно убирает шум атрибуции харнесса на многострочном Title). emit_common_flags(lines, el, inner) - if el.get('hyperlink') is True: lines.append(f'{inner}true') emit_layout(lines, el, inner) - - # Оформление (цвета/шрифт/граница) — перед компаньонами (профиль декорации) emit_appearance(lines, el, inner, 'decoration') + emit_decoration_title(lines, el, name, inner, auto=True) + # Companions emit_companion_panel(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner, el.get('contextMenu')) emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner, el.get('extendedTooltip')) @@ -3663,11 +3662,16 @@ def emit_picture_decoration(lines, el, name, eid, indent): emit_decoration_title(lines, el, name, inner) emit_common_flags(lines, el, inner) - if el.get('picture') or el.get('src'): - ref = str(el.get('src') or el.get('picture')) + # Источник картинки — ТОЛЬКО src (ключ 'picture' = тип/имя элемента, не источник). + # Префикс "abs:" → встроенная картинка ; иначе именованная/стилевая . + if el.get('src'): + src_str = str(el['src']) lt = 'true' if el.get('loadTransparent') is True else 'false' lines.append(f'{inner}') - lines.append(f'{inner}\t{ref}') + if src_str.startswith('abs:'): + lines.append(f'{inner}\t{esc_xml(src_str[4:])}') + else: + lines.append(f'{inner}\t{esc_xml(src_str)}') lines.append(f'{inner}\t{lt}') lines.append(f'{inner}') diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index 330774ed..c29b1e7a 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.58 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.59 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -1436,7 +1436,9 @@ function Decompile-Element { # title декорации — единая ML-text форма с formatted (атрибут у PictureDecoration) $tiNode = $node.SelectSingleNode("lf:Title", $ns) if ($tiNode) { $tv = Get-MLFormattedValue $tiNode; if ($null -ne $tv) { $obj['title'] = $tv } } - $ref = $node.SelectSingleNode("lf:Picture/xr:Ref", $ns); if ($ref) { $obj['src'] = $ref.InnerText } + $ref = $node.SelectSingleNode("lf:Picture/xr:Ref", $ns) + $abs = $node.SelectSingleNode("lf:Picture/xr:Abs", $ns) + if ($ref) { $obj['src'] = $ref.InnerText } elseif ($abs) { $obj['src'] = "abs:$($abs.InnerText)" } # встроенная картинка → префикс abs: $lt = $node.SelectSingleNode("lf:Picture/xr:LoadTransparent", $ns); if ($lt -and $lt.InnerText -eq 'true') { $obj['loadTransparent'] = $true } if ((Get-Child $node 'Hyperlink') -eq 'true') { $obj['hyperlink'] = $true } } diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index 684b9109..ad0e4c6a 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -636,7 +636,7 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs | Свойство | Тип | Описание | |----------|-----|----------| -| `src` или `picture` (как свойство) | string | Ссылка на картинку | +| `src` (у `picture`-декорации — только `src`, не имя) | string | Ссылка на картинку: `StdPicture.X`/`CommonPicture.X`/`style:X` → `<xr:Ref>`. Префикс `abs:` (напр. `"abs:Picture.png"`) → встроенная картинка `<xr:Abs>` | | `loadTransparent` | bool | `true` → загружать прозрачной. По умолчанию `false` | | `hyperlink` | bool | Режим гиперссылки | | `width` | int | Ширина | diff --git a/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml index 3d72ed01..8ff4dafd 100644 --- a/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml @@ -10,17 +10,17 @@ <AutoCommandBar name="ФормаКоманднаяПанель" id="-1"/> <ChildItems> <LabelDecoration name="Внимание!" id="1"> + <TextColor>web:FireBrick</TextColor> + <Font faceName="Arial" height="12" bold="true" italic="false" underline="false" strikeout="false" kind="Absolute" scale="100"/> + <Border width="1"> + <v8ui:style xsi:type="v8ui:ControlBorderType">Single</v8ui:style> + </Border> <Title formatted="false"> <v8:item> <v8:lang>ru</v8:lang> <v8:content>Внимание!</v8:content> </v8:item> - web:FireBrick - - - Single - @@ -32,15 +32,15 @@ + web:DimGray + + <v8:item> <v8:lang>ru</v8:lang> <v8:content>Из стиля</v8:content> </v8:item> - web:DimGray - - diff --git a/tests/skills/cases/form-compile/snapshots/events/DataProcessors/События/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/events/DataProcessors/События/Forms/Форма/Ext/Form.xml index 18c07411..f0c27925 100644 --- a/tests/skills/cases/form-compile/snapshots/events/DataProcessors/События/Forms/Форма/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/events/DataProcessors/События/Forms/Форма/Ext/Form.xml @@ -31,6 +31,7 @@ + true <v8:item> <v8:lang>ru</v8:lang> @@ -38,7 +39,6 @@ </v8:item> Button - true