mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-11 16:34:57 +03:00
Emit Auto items only at group level, not top-level settings
Real DCS files place SelectedItemAuto and OrderItemAuto exclusively inside StructureItem elements (groups, tables, charts), never at the top-level settings. Added -skipAuto switch to Emit-Selection and Emit-Order, applied at settings level. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -910,7 +910,7 @@ function Emit-GroupTemplates {
|
||||
# === Settings Variants ===
|
||||
|
||||
function Emit-Selection {
|
||||
param($items, [string]$indent)
|
||||
param($items, [string]$indent, [switch]$skipAuto)
|
||||
|
||||
if (-not $items -or $items.Count -eq 0) { return }
|
||||
|
||||
@@ -918,7 +918,9 @@ function Emit-Selection {
|
||||
foreach ($item in $items) {
|
||||
if ($item -is [string]) {
|
||||
if ($item -eq "Auto") {
|
||||
X "$indent`t<dcsset:item xsi:type=`"dcsset:SelectedItemAuto`"/>"
|
||||
if (-not $skipAuto) {
|
||||
X "$indent`t<dcsset:item xsi:type=`"dcsset:SelectedItemAuto`"/>"
|
||||
}
|
||||
} else {
|
||||
X "$indent`t<dcsset:item xsi:type=`"dcsset:SelectedItemField`">"
|
||||
X "$indent`t`t<dcsset:field>$(Esc-Xml $item)</dcsset:field>"
|
||||
@@ -1053,7 +1055,7 @@ function Emit-Filter {
|
||||
}
|
||||
|
||||
function Emit-Order {
|
||||
param($items, [string]$indent)
|
||||
param($items, [string]$indent, [switch]$skipAuto)
|
||||
|
||||
if (-not $items -or $items.Count -eq 0) { return }
|
||||
|
||||
@@ -1061,7 +1063,9 @@ function Emit-Order {
|
||||
foreach ($item in $items) {
|
||||
if ($item -is [string]) {
|
||||
if ($item -eq "Auto") {
|
||||
X "$indent`t<dcsset:item xsi:type=`"dcsset:OrderItemAuto`"/>"
|
||||
if (-not $skipAuto) {
|
||||
X "$indent`t<dcsset:item xsi:type=`"dcsset:OrderItemAuto`"/>"
|
||||
}
|
||||
} else {
|
||||
$parts = $item -split '\s+'
|
||||
$field = $parts[0]
|
||||
@@ -1409,9 +1413,9 @@ function Emit-SettingsVariants {
|
||||
|
||||
$s = $v.settings
|
||||
|
||||
# Selection
|
||||
# Selection (Auto items only belong at group level, not top-level settings)
|
||||
if ($s.selection) {
|
||||
Emit-Selection -items $s.selection -indent "`t`t`t"
|
||||
Emit-Selection -items $s.selection -indent "`t`t`t" -skipAuto
|
||||
}
|
||||
|
||||
# Filter
|
||||
@@ -1419,9 +1423,9 @@ function Emit-SettingsVariants {
|
||||
Emit-Filter -items $s.filter -indent "`t`t`t"
|
||||
}
|
||||
|
||||
# Order
|
||||
# Order (Auto items only belong at group level, not top-level settings)
|
||||
if ($s.order) {
|
||||
Emit-Order -items $s.order -indent "`t`t`t"
|
||||
Emit-Order -items $s.order -indent "`t`t`t" -skipAuto
|
||||
}
|
||||
|
||||
# OutputParameters
|
||||
|
||||
@@ -420,7 +420,7 @@
|
||||
```
|
||||
|
||||
- Строка → `SelectedItemField`
|
||||
- `"Auto"` → `SelectedItemAuto`
|
||||
- `"Auto"` → `SelectedItemAuto` (только на уровне группировок; на верхнем уровне settings игнорируется)
|
||||
- Объект с `field`/`title` → `SelectedItemField` с `lwsTitle`
|
||||
|
||||
### filter
|
||||
@@ -498,7 +498,7 @@
|
||||
- `"Field"` → `OrderItemField`, `orderType=Asc`
|
||||
- `"Field desc"` → `OrderItemField`, `orderType=Desc`
|
||||
- `"Field asc"` → `OrderItemField`, `orderType=Asc`
|
||||
- `"Auto"` → `OrderItemAuto`
|
||||
- `"Auto"` → `OrderItemAuto` (только на уровне группировок; на верхнем уровне settings игнорируется)
|
||||
|
||||
### outputParameters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user