From cab0b4d26b899c15392f0d67389aab6cb50c4df3 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Fri, 22 May 2026 20:32:38 +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=20attributeUseRestriction=20=D0=BD=D0=B0=20DataSet?= =?UTF-8?q?=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DataSet field может иметь наравне с — те же 4 подэлемента (field/condition/group/order), но ограничения применяются к атрибутам ссылочного поля (например, "запретить выбирать атрибуты Контрагента в фильтре"). Compile-side уже принимал attrRestrict в JSON; decompile теперь его заполняет. Item переходит в object form при наличии attrRestrict. Эффект на sample30: −257 строк diff. Co-Authored-By: Claude Opus 4.7 --- .claude/skills/skd-decompile/scripts/skd-decompile.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index 26cf4d2e..c7f0fbb8 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.39 — Decompile 1C DCS Template.xml to JSON DSL (draft) +# skd-decompile v0.40 — Decompile 1C DCS Template.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -541,6 +541,8 @@ function Build-Field { $roleExtras = if ($roleInfo) { $roleInfo.extras } else { [ordered]@{} } $roleRendered = Render-Role -tokens $roleTokens -extras $roleExtras $restrictTokens = Get-RestrictionTokens $fieldNode.SelectSingleNode("r:useRestriction", $ns) + # — те же 4 флага, но для атрибутов ссылочного поля + $attrRestrictTokens = Get-RestrictionTokens $fieldNode.SelectSingleNode("r:attributeUseRestriction", $ns) $appNode = $fieldNode.SelectSingleNode("r:appearance", $ns) $appearance = Get-AppearanceDict $appNode $presExpr = Get-Text $fieldNode "r:presentationExpression" @@ -570,7 +572,7 @@ function Build-Field { # Можно ли роль положить в 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 -or ($availableValues.Count -gt 0) + $needsObject = $title -or $appearance -or $presExpr -or ($typeShort -is [array]) -or ($roleRendered -and -not $roleInString) -or $orderExpression -or $inputParameters -or ($availableValues.Count -gt 0) -or ($attrRestrictTokens -and $attrRestrictTokens.Count -gt 0) if (-not $needsObject) { # shorthand: "Name: type @role K=V #restrict" @@ -601,6 +603,9 @@ function Build-Field { if ($orderExpression) { $obj['orderExpression'] = $orderExpression } if ($inputParameters) { $obj['inputParameters'] = $inputParameters } if ($restrictTokens) { $obj['restrict'] = ($restrictTokens | ForEach-Object { $_ -replace '^#','' }) } + if ($attrRestrictTokens -and $attrRestrictTokens.Count -gt 0) { + $obj['attrRestrict'] = ($attrRestrictTokens | ForEach-Object { $_ -replace '^#','' }) + } if ($presExpr) { $obj['presentationExpression'] = $presExpr } if ($availableValues.Count -gt 0) { $obj['availableValues'] = $availableValues } if ($appearance) { $obj['appearance'] = $appearance }