feat(skd): placement в SelectedItemFolder (selection)

SelectedItemFolder (группа полей с заголовком в selection) имеет
<dcsset:placement> — может быть Auto/Horizontally/Vertically/Special.
Мы захардкоженно эмитили Auto, теряя non-default значения.

decompile: читаем placement, сохраняем если ≠ Auto.
compile: эмитим из item.placement (default Auto для bit-perfect-default).

PS и Py compile синхронизированы.
This commit is contained in:
Nick Shirokov
2026-05-24 15:59:25 +03:00
parent 2ad35f484c
commit fe9d8500dc
3 changed files with 11 additions and 5 deletions
@@ -1,4 +1,4 @@
# skd-compile v1.88 — Compile 1C DCS from JSON
# skd-compile v1.89 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$DefinitionFile,
@@ -1991,7 +1991,8 @@ function Emit-SelectionItem {
foreach ($sub in $item.items) {
Emit-SelectionItem -item $sub -indent "$indent`t"
}
X "$indent`t<dcsset:placement>Auto</dcsset:placement>"
$pl = if ($item.placement) { "$($item.placement)" } else { 'Auto' }
X "$indent`t<dcsset:placement>$(Esc-Xml $pl)</dcsset:placement>"
X "$indent</dcsset:item>"
return
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# skd-compile v1.88 — Compile 1C DCS from JSON
# skd-compile v1.89 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import json
@@ -1645,7 +1645,8 @@ def emit_selection_item(lines, item, indent):
emit_mltext(lines, f'{indent}\t', 'dcsset:lwsTitle', item['folder'], no_xsi_type=True)
for sub in (item.get('items') or []):
emit_selection_item(lines, sub, f'{indent}\t')
lines.append(f'{indent}\t<dcsset:placement>Auto</dcsset:placement>')
pl = str(item.get('placement') or 'Auto')
lines.append(f'{indent}\t<dcsset:placement>{esc_xml(pl)}</dcsset:placement>')
lines.append(f'{indent}</dcsset:item>')
return
# field with optional title / use=false / viewMode
@@ -1,4 +1,4 @@
# skd-decompile v0.71 — Decompile 1C DCS Template.xml to JSON DSL (draft)
# skd-decompile v0.72 — Decompile 1C DCS Template.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[Parameter(Mandatory)]
@@ -1587,6 +1587,10 @@ function Build-SelectionItem {
# folder может также иметь свой <dcsset:field> (редко, но встречается)
$folderField = Get-Text $item "dcsset:field"
if ($folderField) { $entry['field'] = $folderField }
$plN = $item.SelectSingleNode("dcsset:placement", $ns)
if ($plN -and $plN.InnerText -and $plN.InnerText -ne 'Auto') {
$entry['placement'] = $plN.InnerText
}
return $entry
}
default {