feat(skd): block-level viewMode/userSettingID на <dcsset:order> внутри structure group

Раньше теряли viewMode/userSettingID, которые platform пишет прямо в блок order
(не в item). Build-Structure теперь читает их как orderViewMode/orderUserSettingID,
Emit-Order принимает -blockUserSettingID параметр.

sample30: −10 строк (1778 → 1768).
This commit is contained in:
Nick Shirokov
2026-05-23 19:25:20 +03:00
parent fb9d29408c
commit 64c2037fe1
3 changed files with 20 additions and 7 deletions
@@ -1,4 +1,4 @@
# skd-compile v1.75 — Compile 1C DCS from JSON
# skd-compile v1.76 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$DefinitionFile,
@@ -2155,7 +2155,7 @@ function Emit-Filter {
}
function Emit-Order {
param($items, [string]$indent, [switch]$skipAuto, $blockViewMode = $null)
param($items, [string]$indent, [switch]$skipAuto, $blockViewMode = $null, $blockUserSettingID = $null)
if (-not $items -or $items.Count -eq 0) { return }
@@ -2202,6 +2202,10 @@ function Emit-Order {
if ($null -ne $blockViewMode) {
X "$indent`t<dcsset:viewMode>$(Esc-Xml "$blockViewMode")</dcsset:viewMode>"
}
if ($null -ne $blockUserSettingID) {
$uid = if ("$blockUserSettingID" -eq 'auto') { New-Guid-String } else { "$blockUserSettingID" }
X "$indent`t<dcsset:userSettingID>$(Esc-Xml $uid)</dcsset:userSettingID>"
}
X "$indent</dcsset:order>"
}
@@ -2806,7 +2810,7 @@ function Emit-StructureItem {
# Emit order/selection only if specified — platform doesn't always emit them on group
if ($item.order) {
Emit-Order -items $item.order -indent "$indent`t"
Emit-Order -items $item.order -indent "$indent`t" -blockViewMode $item.orderViewMode -blockUserSettingID $item.orderUserSettingID
}
if ($item.selection) {
Emit-Selection -items $item.selection -indent "$indent`t"
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# skd-compile v1.75 — Compile 1C DCS from JSON
# skd-compile v1.76 — Compile 1C DCS from JSON
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import json
@@ -1788,7 +1788,7 @@ def emit_filter(lines, items, indent, block_view_mode=None):
lines.append(f'{indent}</dcsset:filter>')
def emit_order(lines, items, indent, skip_auto=False, block_view_mode=None):
def emit_order(lines, items, indent, skip_auto=False, block_view_mode=None, block_user_setting_id=None):
if not items or len(items) == 0:
return
@@ -1831,6 +1831,9 @@ def emit_order(lines, items, indent, skip_auto=False, block_view_mode=None):
lines.append(f'{indent}\t</dcsset:item>')
if block_view_mode is not None:
lines.append(f'{indent}\t<dcsset:viewMode>{esc_xml(str(block_view_mode))}</dcsset:viewMode>')
if block_user_setting_id is not None:
uid = new_uuid() if str(block_user_setting_id) == 'auto' else str(block_user_setting_id)
lines.append(f'{indent}\t<dcsset:userSettingID>{esc_xml(uid)}</dcsset:userSettingID>')
lines.append(f'{indent}</dcsset:order>')
@@ -2268,7 +2271,7 @@ def emit_structure_item(lines, item, indent):
# Emit order/selection only if specified — platform doesn't always emit them on group
if item.get('order'):
emit_order(lines, item['order'], f'{indent}\t')
emit_order(lines, item['order'], f'{indent}\t', block_view_mode=item.get('orderViewMode'), block_user_setting_id=item.get('orderUserSettingID'))
if item.get('selection'):
emit_selection(lines, item['selection'], f'{indent}\t')
@@ -1,4 +1,4 @@
# skd-decompile v0.58 — Decompile 1C DCS Template.xml to JSON DSL (draft)
# skd-decompile v0.59 — Decompile 1C DCS Template.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[Parameter(Mandatory)]
@@ -2047,6 +2047,12 @@ function Build-Structure {
if ($ordNode) {
$ordItems = Build-Order -ordNode $ordNode -loc "$loc/order"
if ($ordItems.Count -gt 0) { $entry['order'] = $ordItems }
# Block-level viewMode/userSettingID на <dcsset:order>
foreach ($ch in $ordNode.ChildNodes) {
if ($ch.NodeType -ne 'Element' -or $ch.NamespaceURI -ne 'http://v8.1c.ru/8.1/data-composition-system/settings') { continue }
if ($ch.LocalName -eq 'viewMode') { $entry['orderViewMode'] = $ch.InnerText }
elseif ($ch.LocalName -eq 'userSettingID') { $entry['orderUserSettingID'] = 'auto' }
}
}
# Local filter
$filterNode = $it.SelectSingleNode("dcsset:filter", $ns)