mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-14 18:04:58 +03:00
feat(skd-compile): use=false wrapper в outputParameters
outputParameters item тоже может иметь <dcscor:use>false</dcscor:use>
(например — отключённый «Заголовок» в варианте). Emit-OutputParameters
теперь распознаёт wrapper {value, use: false} и эмитит <dcscor:use>
в начале item, как уже делал Emit-AppearanceValue.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.59 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.60 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -2314,6 +2314,15 @@ function Emit-OutputParameters {
|
||||
foreach ($prop in $params.PSObject.Properties) {
|
||||
$key = $prop.Name
|
||||
$rawVal = $prop.Value
|
||||
# Распознаём wrapper {use: false, value: ...} (отличаем от multilang dict)
|
||||
$useWrapper = $false
|
||||
if ($rawVal -is [PSCustomObject] -and $rawVal.PSObject.Properties['use'] -and $rawVal.use -eq $false -and $rawVal.PSObject.Properties['value']) {
|
||||
$useWrapper = $true
|
||||
$rawVal = $rawVal.value
|
||||
} elseif (($rawVal -is [hashtable] -or $rawVal -is [System.Collections.IDictionary]) -and $rawVal.Contains('use') -and $rawVal['use'] -eq $false -and $rawVal.Contains('value')) {
|
||||
$useWrapper = $true
|
||||
$rawVal = $rawVal['value']
|
||||
}
|
||||
$ptype = $script:outputParamTypes[$key]
|
||||
if (-not $ptype) { $ptype = "xs:string" }
|
||||
# Auto-promote to mltext if value is a multilang dict ({ru, en, ...})
|
||||
@@ -2322,6 +2331,7 @@ function Emit-OutputParameters {
|
||||
}
|
||||
|
||||
X "$indent`t<dcscor:item xsi:type=`"dcsset:SettingsParameterValue`">"
|
||||
if ($useWrapper) { X "$indent`t`t<dcscor:use>false</dcscor:use>" }
|
||||
X "$indent`t`t<dcscor:parameter>$(Esc-Xml $key)</dcscor:parameter>"
|
||||
if ($ptype -eq "mltext") {
|
||||
Emit-MLText -tag "dcscor:value" -text $rawVal -indent "$indent`t`t"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.59 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.60 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -1931,12 +1931,19 @@ def emit_output_parameters(lines, params, indent):
|
||||
|
||||
lines.append(f'{indent}<dcsset:outputParameters>')
|
||||
for key, val in params.items():
|
||||
# Распознаём wrapper {use: false, value: ...} — отличаем от multilang dict
|
||||
use_wrapper = False
|
||||
if isinstance(val, dict) and val.get('use') is False and 'value' in val:
|
||||
use_wrapper = True
|
||||
val = val['value']
|
||||
ptype = OUTPUT_PARAM_TYPES.get(key, 'xs:string')
|
||||
# Auto-promote to mltext if value is a multilang dict ({ru, en, ...})
|
||||
if isinstance(val, dict):
|
||||
ptype = 'mltext'
|
||||
|
||||
lines.append(f'{indent}\t<dcscor:item xsi:type="dcsset:SettingsParameterValue">')
|
||||
if use_wrapper:
|
||||
lines.append(f'{indent}\t\t<dcscor:use>false</dcscor:use>')
|
||||
lines.append(f'{indent}\t\t<dcscor:parameter>{esc_xml(key)}</dcscor:parameter>')
|
||||
if ptype == 'mltext':
|
||||
emit_mltext(lines, f'{indent}\t\t', 'dcscor:value', val)
|
||||
|
||||
Reference in New Issue
Block a user