From e5e6392b8cfaf55c8994e0b9bf7c69ee59e9b459 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Fri, 22 May 2026 17:25:18 +0300 Subject: [PATCH] =?UTF-8?q?feat(skd-decompile):=20=D1=87=D1=82=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20availableValues=20=D0=BD=D0=B0=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=D1=85=20dataSet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build-Field теперь читает на DataSetFieldField, типизирует value по xsi:type (boolean/decimal/string/dateTime), сохраняет presentation как multilang dict если возможно. Поле переходит в object form если есть availableValues. Co-Authored-By: Claude Opus 4.7 --- .../skd-decompile/scripts/skd-decompile.ps1 | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index d501a960..35cebfbd 100644 --- a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 +++ b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 @@ -1,4 +1,4 @@ -# skd-decompile v0.25 — Decompile 1C DCS Template.xml to JSON DSL (draft) +# skd-decompile v0.26 — Decompile 1C DCS Template.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -540,10 +540,33 @@ function Build-Field { $appNode = $fieldNode.SelectSingleNode("r:appearance", $ns) $appearance = Get-AppearanceDict $appNode $presExpr = Get-Text $fieldNode "r:presentationExpression" + # availableValues on dataset field + $avNodes = $fieldNode.SelectNodes("r:availableValue", $ns) + $availableValues = @() + foreach ($av in $avNodes) { + $avVN = $av.SelectSingleNode("r:value", $ns) + $avPN = $av.SelectSingleNode("r:presentation", $ns) + $avEntry = [ordered]@{} + if ($avVN) { + $avType = Get-LocalXsiType $avVN + $avText = $avVN.InnerText + if ($avType -eq 'boolean') { $avEntry['value'] = ($avText -eq 'true') } + elseif ($avType -eq 'decimal') { + if ($avText -match '^-?\d+$') { $avEntry['value'] = [int]$avText } + else { $avEntry['value'] = [double]$avText } + } + else { $avEntry['value'] = $avText } + } + if ($avPN) { + $avPres = Get-MLText $avPN + if ($avPres) { $avEntry['presentation'] = $avPres } + } + $availableValues += $avEntry + } # Можно ли роль положить в shorthand-строку? $roleInString = $roleRendered -and $roleRendered.isString - $needsObject = $title -or $appearance -or $presExpr -or ($typeShort -is [array]) -or ($roleRendered -and -not $roleInString) -or $orderExpression -or $inputParameters + $needsObject = $title -or $appearance -or $presExpr -or ($typeShort -is [array]) -or ($roleRendered -and -not $roleInString) -or $orderExpression -or $inputParameters -or ($availableValues.Count -gt 0) if (-not $needsObject) { # shorthand: "Name: type @role K=V #restrict" @@ -575,6 +598,7 @@ function Build-Field { if ($inputParameters) { $obj['inputParameters'] = $inputParameters } if ($restrictTokens) { $obj['restrict'] = ($restrictTokens | ForEach-Object { $_ -replace '^#','' }) } if ($presExpr) { $obj['presentationExpression'] = $presExpr } + if ($availableValues.Count -gt 0) { $obj['availableValues'] = $availableValues } if ($appearance) { $obj['appearance'] = $appearance } return $obj }