From 1d75456f4e99bf6bb87cae91aaf3ac596d261743 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Fri, 22 May 2026 17:05:18 +0300 Subject: [PATCH] =?UTF-8?q?feat(skd-compile):=20userFields=20=D0=B2=20sett?= =?UTF-8?q?ings=20(UserFieldExpression/UserFieldCase)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Пользовательские вычисляемые поля — отдельный блок в начале settings. Два подтипа: - UserFieldExpression: dataPath + title + detail{expression,presentation} + total{expression,presentation} - UserFieldCase: dataPath + title + cases[{filter, value, presentation}] DSL: тип определяется наличием 'cases' (case-форма) vs detail/total (expression-форма) — без явного 'type'. В SKILL.md не упоминаем (редкая фича — обычно настраивается пользователем через UI «Изменить вариант»). Описано в spec. Co-Authored-By: Claude Opus 4.7 --- .../skd-compile/scripts/skd-compile.ps1 | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) 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')