feat(form-decompile,form-compile): MobileDeviceCommandBarContent (состав моб-панели)

Форменное свойство <MobileDeviceCommandBarContent> = список имён командных
панелей/кнопок для командной панели мобильного устройства. DSL:
mobileCommandBarContent: ["Имя1", "Имя2", …] (массив строк).

Константы подтверждены по корпусу (161 файл): Presentation пустой,
CheckState=0, Value xsi:type=xs:string всегда — варьируется только имя-Value.
Компилятор ставит константы, эмитит перед AutoCommandBar; декомпилятор
собирает список имён.

Зеркало py (байт-в-байт). Форма BusinessProcesses/Задание/ФормаСписка →
round-trip match. Кейс commands сертифицирован в 1С. Регресс 39/39 ps1+py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-08 21:11:18 +03:00
co-authored by Claude Opus 4.8
parent ea43522b5a
commit 8915e99ac8
6 changed files with 53 additions and 3 deletions
@@ -1,4 +1,4 @@
# form-compile v1.81 — Compile 1C managed form from JSON or object metadata
# form-compile v1.82 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -5029,6 +5029,20 @@ if ($def.excludedCommands -and $def.excludedCommands.Count -gt 0) {
X "`t</CommandSet>"
}
# 12c2. MobileDeviceCommandBarContent — форменный список имён командных панелей/кнопок
# (Presentation пустой, CheckState=0, тип xs:string — константы; варьируется только имя-Value).
if ($def.mobileCommandBarContent -and @($def.mobileCommandBarContent).Count -gt 0) {
X "`t<MobileDeviceCommandBarContent>"
foreach ($nm in @($def.mobileCommandBarContent)) {
X "`t`t<xr:Item>"
X "`t`t`t<xr:Presentation/>"
X "`t`t`t<xr:CheckState>0</xr:CheckState>"
X "`t`t`t<xr:Value xsi:type=`"xs:string`">$(Esc-Xml "$nm")</xr:Value>"
X "`t`t</xr:Item>"
}
X "`t</MobileDeviceCommandBarContent>"
}
# 12d. AutoCommandBar (always present, id=-1)
$acbAutofill = Compute-MainAcbAutofill
$acbName = "ФормаКоманднаяПанель"
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.81 — Compile 1C managed form from JSON or object metadata
# form-compile v1.82 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -4877,6 +4877,18 @@ def main():
lines.append(f'\t\t<ExcludedCommand>{cmd}</ExcludedCommand>')
lines.append('\t</CommandSet>')
# MobileDeviceCommandBarContent — форменный список имён командных панелей/кнопок
# (Presentation пустой, CheckState=0, тип xs:string — константы; варьируется только имя-Value).
if defn.get('mobileCommandBarContent') and len(defn['mobileCommandBarContent']) > 0:
lines.append('\t<MobileDeviceCommandBarContent>')
for nm in defn['mobileCommandBarContent']:
lines.append('\t\t<xr:Item>')
lines.append('\t\t\t<xr:Presentation/>')
lines.append('\t\t\t<xr:CheckState>0</xr:CheckState>')
lines.append(f'\t\t\t<xr:Value xsi:type="xs:string">{esc_xml(str(nm))}</xr:Value>')
lines.append('\t\t</xr:Item>')
lines.append('\t</MobileDeviceCommandBarContent>')
# AutoCommandBar (always present, id=-1)
acb_autofill = _compute_main_acb_autofill()
acb_name = '\u0424\u043e\u0440\u043c\u0430\u041a\u043e\u043c\u0430\u043d\u0434\u043d\u0430\u044f\u041f\u0430\u043d\u0435\u043b\u044c'
@@ -1,4 +1,4 @@
# form-decompile v0.57 — Decompile 1C managed Form.xml to JSON DSL (draft)
# form-decompile v0.58 — Decompile 1C managed Form.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
param(
@@ -1655,6 +1655,16 @@ foreach ($pn in $KNOWN_FORM_PROPS) {
if ($dsl.Contains('title') -and $props.Contains('autoTitle') -and $props['autoTitle'] -eq $false) { $props.Remove('autoTitle') }
if ($props.Count -gt 0) { $dsl['properties'] = $props }
# MobileDeviceCommandBarContent (form-level) → список имён командных панелей/кнопок
$mdcb = $root.SelectSingleNode("lf:MobileDeviceCommandBarContent", $ns)
if ($mdcb) {
$names = New-Object System.Collections.ArrayList
foreach ($it in @($mdcb.SelectNodes("xr:Item", $ns))) {
$v = $it.SelectSingleNode("xr:Value", $ns); if ($v) { [void]$names.Add($v.InnerText) }
}
if ($names.Count -gt 0) { $dsl['mobileCommandBarContent'] = @($names) }
}
# excludedCommands (form-level <CommandSet>)
$csForm = $root.SelectSingleNode("lf:CommandSet", $ns)
if ($csForm) {