mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-19 17:19:42 +03:00
fix(skd-decompile): не сохранять valueType для известных outputParameters keys
Compile имеет map outputParamTypes — для известных ключей (Заголовок,
ВыводитьПараметрыДанных, РасположениеИтогов и др.) тип эмитится
автоматически по имени параметра. Decompile же всегда оборачивал в
wrapper {value, valueType} для не-xs:* типов — лишний шум.
Зеркалирован тот же map в decompile (15 keys), при чтении проверяем
совпадение fullType с map → если auto-detect compile вернёт тот же
тип, валидируем как простое значение.
JSON outputParameters стал заметно компактнее. Эффект на diff
нейтральный (compile эмитит то же).
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# skd-decompile v0.87 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
# skd-decompile v0.88 — Decompile 1C DCS Template.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(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -1921,6 +1921,25 @@ function Build-ConditionalAppearance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Build outputParameters dict
|
# Build outputParameters dict
|
||||||
|
# Зеркало $script:outputParamTypes из skd-compile — для known keys compile auto-detect-ит
|
||||||
|
# тип по имени параметра, поэтому valueType в DSL не нужен (избыточный шум).
|
||||||
|
$script:outputParamTypesKnown = @{
|
||||||
|
'Заголовок' = 'mltext'
|
||||||
|
'ВыводитьЗаголовок' = 'dcsset:DataCompositionTextOutputType'
|
||||||
|
'ВыводитьПараметрыДанных' = 'dcsset:DataCompositionTextOutputType'
|
||||||
|
'ВыводитьОтбор' = 'dcsset:DataCompositionTextOutputType'
|
||||||
|
'МакетОформления' = 'xs:string'
|
||||||
|
'РасположениеПолейГруппировки' = 'dcsset:DataCompositionGroupFieldsPlacement'
|
||||||
|
'РасположениеРеквизитов' = 'dcsset:DataCompositionAttributesPlacement'
|
||||||
|
'ГоризонтальноеРасположениеОбщихИтогов' = 'dcscor:DataCompositionTotalPlacement'
|
||||||
|
'ВертикальноеРасположениеОбщихИтогов' = 'dcscor:DataCompositionTotalPlacement'
|
||||||
|
'РасположениеОбщихИтогов' = 'dcscor:DataCompositionTotalPlacement'
|
||||||
|
'РасположениеИтогов' = 'dcscor:DataCompositionTotalPlacement'
|
||||||
|
'РасположениеГруппировки' = 'dcsset:DataCompositionFieldGroupPlacement'
|
||||||
|
'РасположениеРесурсов' = 'dcsset:DataCompositionResourcesPlacement'
|
||||||
|
'ТипМакета' = 'dcsset:DataCompositionGroupTemplateType'
|
||||||
|
}
|
||||||
|
|
||||||
function Build-OutputParameters {
|
function Build-OutputParameters {
|
||||||
param($opNode)
|
param($opNode)
|
||||||
if (-not $opNode) { return $null }
|
if (-not $opNode) { return $null }
|
||||||
@@ -1981,11 +2000,21 @@ function Build-OutputParameters {
|
|||||||
$uspN = $it.SelectSingleNode("dcsset:userSettingPresentation", $ns)
|
$uspN = $it.SelectSingleNode("dcsset:userSettingPresentation", $ns)
|
||||||
# Если xsi:type — кастомный (dcsset:XXX, v8ui:XXX, и т.п., не xs:* и не LocalStringType/Font),
|
# Если xsi:type — кастомный (dcsset:XXX, v8ui:XXX, и т.п., не xs:* и не LocalStringType/Font),
|
||||||
# нужен wrap чтобы compile сохранил тип через valueType (default — xs:string).
|
# нужен wrap чтобы compile сохранил тип через valueType (default — xs:string).
|
||||||
$typeIsCustom = $fullType -and ($fullType -notmatch '^xs:') -and ($vType -ne 'LocalStringType') -and ($vType -ne 'Font')
|
# typeIsCustom: тип не покрыт auto-detect (compile сам сделает default).
|
||||||
|
# Если ключ — known (есть в outputParamTypesKnown) И значение xsi:type совпадает с map —
|
||||||
|
# auto-detect compile вернёт тот же тип → valueType в DSL не нужен.
|
||||||
|
$typeAutoDetected = $false
|
||||||
|
if ($script:outputParamTypesKnown.ContainsKey($pName)) {
|
||||||
|
$mapType = $script:outputParamTypesKnown[$pName]
|
||||||
|
# mltext в map ≡ LocalStringType в XML
|
||||||
|
if ($mapType -eq 'mltext' -and $vType -eq 'LocalStringType') { $typeAutoDetected = $true }
|
||||||
|
elseif ($fullType -eq $mapType) { $typeAutoDetected = $true }
|
||||||
|
}
|
||||||
|
$typeIsCustom = $fullType -and ($fullType -notmatch '^xs:') -and ($vType -ne 'LocalStringType') -and ($vType -ne 'Font') -and -not $typeAutoDetected
|
||||||
$hasExtras = ($useV -eq 'false') -or $vmN -or $usidV -or $uspN -or ($nestedItems.Count -gt 0) -or $typeIsCustom
|
$hasExtras = ($useV -eq 'false') -or $vmN -or $usidV -or $uspN -or ($nestedItems.Count -gt 0) -or $typeIsCustom
|
||||||
if ($hasExtras) {
|
if ($hasExtras) {
|
||||||
$wrap = [ordered]@{ value = $rawVal }
|
$wrap = [ordered]@{ value = $rawVal }
|
||||||
if ($fullType -and -not (($vType -eq 'LocalStringType') -or ($vType -eq 'Font'))) {
|
if ($fullType -and -not (($vType -eq 'LocalStringType') -or ($vType -eq 'Font')) -and -not $typeAutoDetected) {
|
||||||
$wrap['valueType'] = $fullType
|
$wrap['valueType'] = $fullType
|
||||||
}
|
}
|
||||||
if ($useV -eq 'false') { $wrap['use'] = $false }
|
if ($useV -eq 'false') { $wrap['use'] = $false }
|
||||||
|
|||||||
Reference in New Issue
Block a user