feat(form-decompile,form-compile): commandSource у ButtonGroup/CommandBar

ButtonGroup/CommandBar несут <CommandSource> (источник команд группы): Form (2478),
FormCommandPanelGlobalCommands (1267), Item.<ИмяЭлемента> (команды конкретного
элемента-таблицы). Декомпилятор не захватывал → LOST в форменных/элементных панелях.

Добавлен ключ commandSource (эмитится «как есть», после Title до Representation/Autofill).
Декомпилятор захватывает у ButtonGroup и CommandBar.

TOTAL diff lines выборки 2.17: 5189 → 5149 (-40). ButtonGroup/CommandBar CommandSource
LOST → 0. Снапшот button-group (группа глобальных команд с commandSource) сертифицирован
в 1С (8.3.24). Регресс form-compile 33/33 зелёный на ps + python.
decompile v0.32, compile v1.50.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-06 22:18:41 +03:00
parent c998139c89
commit 7eb825b3a7
6 changed files with 29 additions and 9 deletions
@@ -1,4 +1,4 @@
# form-compile v1.49 — Compile 1C managed form from JSON or object metadata
# form-compile v1.50 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -2400,6 +2400,8 @@ function Emit-Element {
"name"=1;"path"=1;"title"=1;"tooltip"=1;"tooltipRepresentation"=1;"extendedTooltip"=1
# companion-панели (свойства): командная панель + контекстное меню
"commandBar"=1;"contextMenu"=1
# источник команд группы/панели (ButtonGroup/CommandBar)
"commandSource"=1
# visibility & state
"visible"=1;"hidden"=1;"enabled"=1;"disabled"=1;"readOnly"=1;"userVisible"=1
# events ("events" — основной формат; on/handlers — legacy, принимаются ради совместимости)
@@ -3488,6 +3490,8 @@ function Emit-CommandBar {
Emit-Title -el $el -name $name -indent $inner
if ($el.commandSource) { X "$inner<CommandSource>$($el.commandSource)</CommandSource>" }
if ($el.autofill -eq $true) { X "$inner<Autofill>true</Autofill>" }
Emit-CommonFlags -el $el -indent $inner
@@ -3514,6 +3518,8 @@ function Emit-ButtonGroup {
Emit-Title -el $el -name $name -indent $inner
if ($el.commandSource) { X "$inner<CommandSource>$($el.commandSource)</CommandSource>" }
if ($el.representation) {
X "$inner<Representation>$($el.representation)</Representation>"
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.49 — Compile 1C managed form from JSON or object metadata
# form-compile v1.50 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -1780,7 +1780,7 @@ KNOWN_KEYS = {
"excludedCommands",
"pagesRepresentation",
"type", "command", "commandName", "stdCommand", "defaultButton", "locationInCommandBar",
"commandBar", "contextMenu",
"commandBar", "contextMenu", "commandSource",
"src", "valuesPicture", "loadTransparent",
"autofill",
"choiceMode", "initialTreeView", "enableDrag", "enableStartDrag",
@@ -3173,6 +3173,9 @@ def emit_command_bar(lines, el, name, eid, indent):
emit_title(lines, el, name, inner)
if el.get('commandSource'):
lines.append(f'{inner}<CommandSource>{el["commandSource"]}</CommandSource>')
if el.get('autofill') is True:
lines.append(f'{inner}<Autofill>true</Autofill>')
@@ -3224,6 +3227,9 @@ def emit_button_group(lines, el, name, eid, indent):
emit_title(lines, el, name, inner)
if el.get('commandSource'):
lines.append(f'{inner}<CommandSource>{el["commandSource"]}</CommandSource>')
if el.get('representation'):
lines.append(f'{inner}<Representation>{el["representation"]}</Representation>')
@@ -1,4 +1,4 @@
# form-decompile v0.31 — Decompile 1C managed Form.xml to JSON DSL (draft)
# form-decompile v0.32 — Decompile 1C managed Form.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
param(
@@ -1130,6 +1130,7 @@ function Decompile-Element {
'ButtonGroup' {
$obj[$key] = $name
Add-CommonProps $obj $node $name
$cs = Get-Child $node 'CommandSource'; if ($cs) { $obj['commandSource'] = $cs }
$rep = Get-Child $node 'Representation'; if ($rep) { $obj['representation'] = $rep }
$kids = Decompile-Children $node
if ($kids) { $obj['children'] = $kids }
@@ -1137,6 +1138,7 @@ function Decompile-Element {
'CommandBar' {
$obj[$key] = $name
Add-CommonProps $obj $node $name
$cs = Get-Child $node 'CommandSource'; if ($cs) { $obj['commandSource'] = $cs }
if ((Get-Child $node 'Autofill') -eq 'true') { $obj['autofill'] = $true }
$kids = Decompile-Children $node
if ($kids) { $obj['children'] = $kids }
+1
View File
@@ -565,6 +565,7 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs
|----------|-----|----------|
| `buttonGroup` | string | Имя элемента |
| `title` | string/object | Заголовок группы |
| `commandSource` | string | Источник команд группы (`<CommandSource>`): `Form`, `FormCommandPanelGlobalCommands`, `Item.<ИмяЭлемента>`. Также у `cmdBar`. Эмитится «как есть» |
| `representation` | string | `Auto`, `Picture`, `Text`, `PictureAndText` |
| `children` | array | Кнопки (`button`) внутри группы |
@@ -21,7 +21,8 @@
{ "buttonGroup": "ГруппаПереместить", "title": "Переместить", "children": [
{ "button": "Вверх", "command": "Вверх" },
{ "button": "Вниз", "command": "Вниз" }
]}
]},
{ "buttonGroup": "ГруппаГлобальныеКоманды", "commandSource": "FormCommandPanelGlobalCommands" }
]}
],
"attributes": [
@@ -41,11 +41,15 @@
</Button>
</ChildItems>
</ButtonGroup>
<ButtonGroup name="ГруппаГлобальныеКоманды" id="11">
<CommandSource>FormCommandPanelGlobalCommands</CommandSource>
<ExtendedTooltip name="ГруппаГлобальныеКомандыРасширеннаяПодсказка" id="12"/>
</ButtonGroup>
</ChildItems>
</CommandBar>
</ChildItems>
<Attributes>
<Attribute name="Объект" id="11">
<Attribute name="Объект" id="13">
<Type>
<v8:Type>cfg:DataProcessorObject.ГруппыКнопок</v8:Type>
</Type>
@@ -53,7 +57,7 @@
</Attribute>
</Attributes>
<Commands>
<Command name="Выполнить" id="12">
<Command name="Выполнить" id="14">
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
@@ -69,7 +73,7 @@
<Action>ВыполнитьОбработка</Action>
<Shortcut>Ctrl+Enter</Shortcut>
</Command>
<Command name="Вверх" id="13">
<Command name="Вверх" id="15">
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
@@ -79,7 +83,7 @@
<Action>ВверхОбработка</Action>
<CurrentRowUse>DontUse</CurrentRowUse>
</Command>
<Command name="Вниз" id="14">
<Command name="Вниз" id="16">
<Title>
<v8:item>
<v8:lang>ru</v8:lang>