diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index f2702358..184aa66e 100644 --- a/.claude/skills/skd-compile/scripts/skd-compile.ps1 +++ b/.claude/skills/skd-compile/scripts/skd-compile.ps1 @@ -1,4 +1,4 @@ -# skd-compile v1.39 — Compile 1C DCS from JSON +# skd-compile v1.40 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -2365,6 +2365,63 @@ function Parse-StructureShorthand { return ,$result } +function Emit-UserFields { + param($items, [string]$indent) + if (-not $items -or $items.Count -eq 0) { return } + X "$indent" + foreach ($uf in $items) { + # Type detection: cases → UserFieldCase, otherwise UserFieldExpression + $uType = if ($uf.cases) { "UserFieldCase" } else { "UserFieldExpression" } + X "$indent`t" + if ($uf.dataPath) { + X "$indent`t`t$(Esc-Xml "$($uf.dataPath)")" + } + if ($uf.title) { + Emit-MLText -tag "dcsset:lwsTitle" -text $uf.title -indent "$indent`t`t" -NoXsiType + } + if ($uType -eq "UserFieldExpression") { + if ($uf.detail) { + if ($uf.detail.expression) { X "$indent`t`t$(Esc-Xml "$($uf.detail.expression)")" } + if ($uf.detail.presentation) { X "$indent`t`t$(Esc-Xml "$($uf.detail.presentation)")" } + } + if ($uf.total) { + if ($uf.total.expression) { X "$indent`t`t$(Esc-Xml "$($uf.total.expression)")" } + if ($uf.total.presentation) { X "$indent`t`t$(Esc-Xml "$($uf.total.presentation)")" } + } + } else { + # UserFieldCase + if ($uf.cases.Count -eq 0) { + X "$indent`t`t" + } else { + X "$indent`t`t" + foreach ($c in $uf.cases) { + X "$indent`t`t`t" + if ($c.filter) { + Emit-Filter -items $c.filter -indent "$indent`t`t`t`t" + } + if ($null -ne $c.value) { + $cv = $c.value + if ($cv -is [bool]) { + X "$indent`t`t`t`t$(("$cv").ToLower())" + } elseif ($cv -is [int] -or $cv -is [long] -or $cv -is [double]) { + X "$indent`t`t`t`t$cv" + } else { + X "$indent`t`t`t`t$(Esc-Xml "$cv")" + } + } + if ($c.presentation) { + Emit-MLText -tag "dcsset:lwsPresentationValue" -text $c.presentation -indent "$indent`t`t`t`t" -NoXsiType + } + X "$indent`t`t`t" + } + X "$indent`t`t" + } + } + X "$indent`t" + } + X "$indent" +} + # Shared emitter for table column/row and chart point/series. # Emits groupItems, filter, order, selection, outputParameters — each conditional on JSON presence. function Emit-TableAxisBlock { @@ -2562,6 +2619,11 @@ function Emit-SettingsVariants { return $null } + # userFields — пользовательские вычисляемые поля (Expression / Case) + if ($s.userFields -and $s.userFields.Count -gt 0) { + Emit-UserFields -items $s.userFields -indent "`t`t`t" + } + # Selection (Auto items only belong at group level, not top-level settings) if ($s.selection) { Emit-Selection -items $s.selection -indent "`t`t`t" -skipAuto -blockViewMode (Get-BlockVM 'selection')