mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-03 00:30:52 +03:00
feat(form-decompile,form-compile): семантика TitleLocation (кластер G2)
Принцип: компилятор не эмитит значение, равное дефолту платформы (который платформа сама не пишет в XML). Умный дефолт (check→Right, radio→None) — отдельная вещь, эмитится (он ≠ дефолт платформы Left). - net ключа titleLocation → умный дефолт; titleLocation: "" → подавить (дефолт платформы); значение → эмитить с маппингом регистра. - compiler PS1+PY: Emit-TitleLocation/emit_title_location + Map-TitleLoc (общий маппинг; у check раньше его не было — сырьё). - decompiler: Add-TitleLocation (дефолт → опустить, нет тега → "", иначе значение). - docs/form-dsl-spec: семантика titleLocation у check/radio. - tests: input-fields расширен (Right-дефолт / ""-подавление / явный Top), сертифицирован. АварийныйРежим: полный MATCH. Регресс 32/32 PS1+PY, churn нулевой. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4ba1e595bf
commit
0941fc717d
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.26 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.27 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -2034,6 +2034,30 @@ function Emit-Title {
|
||||
}
|
||||
}
|
||||
|
||||
function Map-TitleLoc {
|
||||
param([string]$v)
|
||||
switch ("$v".ToLower()) {
|
||||
"none" { "None" }
|
||||
"left" { "Left" }
|
||||
"right" { "Right" }
|
||||
"top" { "Top" }
|
||||
"bottom" { "Bottom" }
|
||||
"auto" { "Auto" }
|
||||
default { "$v" }
|
||||
}
|
||||
}
|
||||
|
||||
# TitleLocation у check/radio: нет ключа → умный дефолт (Right/None), эмитится;
|
||||
# "" → подавить (= дефолт платформы, она его сама не пишет); значение → эмитить (маппинг регистра).
|
||||
function Emit-TitleLocation {
|
||||
param($el, [string]$indent, [string]$smartDefault)
|
||||
if ($null -ne $el.PSObject.Properties['titleLocation']) {
|
||||
if ($el.titleLocation) { X "$indent<TitleLocation>$(Map-TitleLoc "$($el.titleLocation)")</TitleLocation>" }
|
||||
} elseif ($smartDefault) {
|
||||
X "$indent<TitleLocation>$smartDefault</TitleLocation>"
|
||||
}
|
||||
}
|
||||
|
||||
function Emit-Group {
|
||||
param($el, [string]$name, [int]$id, [string]$indent)
|
||||
|
||||
@@ -2196,8 +2220,7 @@ function Emit-Check {
|
||||
Emit-Title -el $el -name $name -indent $inner -auto:(-not $el.path)
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
$tl = if ($el.titleLocation) { "$($el.titleLocation)" } else { "Right" }
|
||||
X "$inner<TitleLocation>$tl</TitleLocation>"
|
||||
Emit-TitleLocation -el $el -indent $inner -smartDefault "Right"
|
||||
|
||||
Emit-Layout -el $el -indent $inner
|
||||
|
||||
@@ -2337,18 +2360,7 @@ function Emit-Radio {
|
||||
Emit-Title -el $el -name $name -indent $inner -auto:(-not $el.path)
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
# TitleLocation default is None for radio (matches typical configurator behavior)
|
||||
$tl = if ($el.titleLocation) {
|
||||
switch ("$($el.titleLocation)") {
|
||||
"none" { "None" }
|
||||
"left" { "Left" }
|
||||
"right" { "Right" }
|
||||
"top" { "Top" }
|
||||
"bottom" { "Bottom" }
|
||||
default { "$($el.titleLocation)" }
|
||||
}
|
||||
} else { "None" }
|
||||
X "$inner<TitleLocation>$tl</TitleLocation>"
|
||||
Emit-TitleLocation -el $el -indent $inner -smartDefault "None"
|
||||
|
||||
# RadioButtonType: Auto | RadioButtons | Tumbler. Accept synonyms.
|
||||
$rbtRaw = if ($el.radioButtonType) { "$($el.radioButtonType)".Trim() } else { "Auto" }
|
||||
|
||||
Reference in New Issue
Block a user