mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-27 07:01:02 +03:00
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:
co-authored by
Claude Opus 4.8
parent
c998139c89
commit
7eb825b3a7
@@ -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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$JsonPath,
|
[string]$JsonPath,
|
||||||
@@ -2400,6 +2400,8 @@ function Emit-Element {
|
|||||||
"name"=1;"path"=1;"title"=1;"tooltip"=1;"tooltipRepresentation"=1;"extendedTooltip"=1
|
"name"=1;"path"=1;"title"=1;"tooltip"=1;"tooltipRepresentation"=1;"extendedTooltip"=1
|
||||||
# companion-панели (свойства): командная панель + контекстное меню
|
# companion-панели (свойства): командная панель + контекстное меню
|
||||||
"commandBar"=1;"contextMenu"=1
|
"commandBar"=1;"contextMenu"=1
|
||||||
|
# источник команд группы/панели (ButtonGroup/CommandBar)
|
||||||
|
"commandSource"=1
|
||||||
# visibility & state
|
# visibility & state
|
||||||
"visible"=1;"hidden"=1;"enabled"=1;"disabled"=1;"readOnly"=1;"userVisible"=1
|
"visible"=1;"hidden"=1;"enabled"=1;"disabled"=1;"readOnly"=1;"userVisible"=1
|
||||||
# events ("events" — основной формат; on/handlers — legacy, принимаются ради совместимости)
|
# events ("events" — основной формат; on/handlers — legacy, принимаются ради совместимости)
|
||||||
@@ -3488,6 +3490,8 @@ function Emit-CommandBar {
|
|||||||
|
|
||||||
Emit-Title -el $el -name $name -indent $inner
|
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>" }
|
if ($el.autofill -eq $true) { X "$inner<Autofill>true</Autofill>" }
|
||||||
|
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
@@ -3514,6 +3518,8 @@ function Emit-ButtonGroup {
|
|||||||
|
|
||||||
Emit-Title -el $el -name $name -indent $inner
|
Emit-Title -el $el -name $name -indent $inner
|
||||||
|
|
||||||
|
if ($el.commandSource) { X "$inner<CommandSource>$($el.commandSource)</CommandSource>" }
|
||||||
|
|
||||||
if ($el.representation) {
|
if ($el.representation) {
|
||||||
X "$inner<Representation>$($el.representation)</Representation>"
|
X "$inner<Representation>$($el.representation)</Representation>"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import copy
|
import copy
|
||||||
@@ -1780,7 +1780,7 @@ KNOWN_KEYS = {
|
|||||||
"excludedCommands",
|
"excludedCommands",
|
||||||
"pagesRepresentation",
|
"pagesRepresentation",
|
||||||
"type", "command", "commandName", "stdCommand", "defaultButton", "locationInCommandBar",
|
"type", "command", "commandName", "stdCommand", "defaultButton", "locationInCommandBar",
|
||||||
"commandBar", "contextMenu",
|
"commandBar", "contextMenu", "commandSource",
|
||||||
"src", "valuesPicture", "loadTransparent",
|
"src", "valuesPicture", "loadTransparent",
|
||||||
"autofill",
|
"autofill",
|
||||||
"choiceMode", "initialTreeView", "enableDrag", "enableStartDrag",
|
"choiceMode", "initialTreeView", "enableDrag", "enableStartDrag",
|
||||||
@@ -3173,6 +3173,9 @@ def emit_command_bar(lines, el, name, eid, indent):
|
|||||||
|
|
||||||
emit_title(lines, el, name, inner)
|
emit_title(lines, el, name, inner)
|
||||||
|
|
||||||
|
if el.get('commandSource'):
|
||||||
|
lines.append(f'{inner}<CommandSource>{el["commandSource"]}</CommandSource>')
|
||||||
|
|
||||||
if el.get('autofill') is True:
|
if el.get('autofill') is True:
|
||||||
lines.append(f'{inner}<Autofill>true</Autofill>')
|
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)
|
emit_title(lines, el, name, inner)
|
||||||
|
|
||||||
|
if el.get('commandSource'):
|
||||||
|
lines.append(f'{inner}<CommandSource>{el["commandSource"]}</CommandSource>')
|
||||||
|
|
||||||
if el.get('representation'):
|
if el.get('representation'):
|
||||||
lines.append(f'{inner}<Representation>{el["representation"]}</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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
||||||
param(
|
param(
|
||||||
@@ -1130,6 +1130,7 @@ function Decompile-Element {
|
|||||||
'ButtonGroup' {
|
'ButtonGroup' {
|
||||||
$obj[$key] = $name
|
$obj[$key] = $name
|
||||||
Add-CommonProps $obj $node $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 }
|
$rep = Get-Child $node 'Representation'; if ($rep) { $obj['representation'] = $rep }
|
||||||
$kids = Decompile-Children $node
|
$kids = Decompile-Children $node
|
||||||
if ($kids) { $obj['children'] = $kids }
|
if ($kids) { $obj['children'] = $kids }
|
||||||
@@ -1137,6 +1138,7 @@ function Decompile-Element {
|
|||||||
'CommandBar' {
|
'CommandBar' {
|
||||||
$obj[$key] = $name
|
$obj[$key] = $name
|
||||||
Add-CommonProps $obj $node $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 }
|
if ((Get-Child $node 'Autofill') -eq 'true') { $obj['autofill'] = $true }
|
||||||
$kids = Decompile-Children $node
|
$kids = Decompile-Children $node
|
||||||
if ($kids) { $obj['children'] = $kids }
|
if ($kids) { $obj['children'] = $kids }
|
||||||
|
|||||||
@@ -565,6 +565,7 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs
|
|||||||
|----------|-----|----------|
|
|----------|-----|----------|
|
||||||
| `buttonGroup` | string | Имя элемента |
|
| `buttonGroup` | string | Имя элемента |
|
||||||
| `title` | string/object | Заголовок группы |
|
| `title` | string/object | Заголовок группы |
|
||||||
|
| `commandSource` | string | Источник команд группы (`<CommandSource>`): `Form`, `FormCommandPanelGlobalCommands`, `Item.<ИмяЭлемента>`. Также у `cmdBar`. Эмитится «как есть» |
|
||||||
| `representation` | string | `Auto`, `Picture`, `Text`, `PictureAndText` |
|
| `representation` | string | `Auto`, `Picture`, `Text`, `PictureAndText` |
|
||||||
| `children` | array | Кнопки (`button`) внутри группы |
|
| `children` | array | Кнопки (`button`) внутри группы |
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
{ "buttonGroup": "ГруппаПереместить", "title": "Переместить", "children": [
|
{ "buttonGroup": "ГруппаПереместить", "title": "Переместить", "children": [
|
||||||
{ "button": "Вверх", "command": "Вверх" },
|
{ "button": "Вверх", "command": "Вверх" },
|
||||||
{ "button": "Вниз", "command": "Вниз" }
|
{ "button": "Вниз", "command": "Вниз" }
|
||||||
]}
|
]},
|
||||||
|
{ "buttonGroup": "ГруппаГлобальныеКоманды", "commandSource": "FormCommandPanelGlobalCommands" }
|
||||||
]}
|
]}
|
||||||
],
|
],
|
||||||
"attributes": [
|
"attributes": [
|
||||||
|
|||||||
+8
-4
@@ -41,11 +41,15 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</ChildItems>
|
</ChildItems>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
<ButtonGroup name="ГруппаГлобальныеКоманды" id="11">
|
||||||
|
<CommandSource>FormCommandPanelGlobalCommands</CommandSource>
|
||||||
|
<ExtendedTooltip name="ГруппаГлобальныеКомандыРасширеннаяПодсказка" id="12"/>
|
||||||
|
</ButtonGroup>
|
||||||
</ChildItems>
|
</ChildItems>
|
||||||
</CommandBar>
|
</CommandBar>
|
||||||
</ChildItems>
|
</ChildItems>
|
||||||
<Attributes>
|
<Attributes>
|
||||||
<Attribute name="Объект" id="11">
|
<Attribute name="Объект" id="13">
|
||||||
<Type>
|
<Type>
|
||||||
<v8:Type>cfg:DataProcessorObject.ГруппыКнопок</v8:Type>
|
<v8:Type>cfg:DataProcessorObject.ГруппыКнопок</v8:Type>
|
||||||
</Type>
|
</Type>
|
||||||
@@ -53,7 +57,7 @@
|
|||||||
</Attribute>
|
</Attribute>
|
||||||
</Attributes>
|
</Attributes>
|
||||||
<Commands>
|
<Commands>
|
||||||
<Command name="Выполнить" id="12">
|
<Command name="Выполнить" id="14">
|
||||||
<Title>
|
<Title>
|
||||||
<v8:item>
|
<v8:item>
|
||||||
<v8:lang>ru</v8:lang>
|
<v8:lang>ru</v8:lang>
|
||||||
@@ -69,7 +73,7 @@
|
|||||||
<Action>ВыполнитьОбработка</Action>
|
<Action>ВыполнитьОбработка</Action>
|
||||||
<Shortcut>Ctrl+Enter</Shortcut>
|
<Shortcut>Ctrl+Enter</Shortcut>
|
||||||
</Command>
|
</Command>
|
||||||
<Command name="Вверх" id="13">
|
<Command name="Вверх" id="15">
|
||||||
<Title>
|
<Title>
|
||||||
<v8:item>
|
<v8:item>
|
||||||
<v8:lang>ru</v8:lang>
|
<v8:lang>ru</v8:lang>
|
||||||
@@ -79,7 +83,7 @@
|
|||||||
<Action>ВверхОбработка</Action>
|
<Action>ВверхОбработка</Action>
|
||||||
<CurrentRowUse>DontUse</CurrentRowUse>
|
<CurrentRowUse>DontUse</CurrentRowUse>
|
||||||
</Command>
|
</Command>
|
||||||
<Command name="Вниз" id="14">
|
<Command name="Вниз" id="16">
|
||||||
<Title>
|
<Title>
|
||||||
<v8:item>
|
<v8:item>
|
||||||
<v8:lang>ru</v8:lang>
|
<v8:lang>ru</v8:lang>
|
||||||
|
|||||||
Reference in New Issue
Block a user