mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-29 08:01:02 +03:00
feat(form-decompile,form-compile): листовые свойства полей + фикс Hiperlink (кластер L)
БАГ: у LabelField платформенный тег <Hiperlink> (опечатка 1С), компилятор эмитил <Hyperlink> — гиперссылка не работала и не роундтрипилась. Проверено по корпусу: LabelField→Hiperlink во всех версиях формата (2.17 и 2.20). - compiler PS1+PY: LabelField <Hiperlink>; EditMode (input/check/labelField); CheckBoxType (check, умный дефолт Auto + suppress как radioButtonType). - decompiler: editMode, checkBoxType (Auto→опустить), markIncomplete (раньше не ловился), labelField читает <Hiperlink>. - docs/form-dsl-spec: editMode, checkBoxType, примечание про Hiperlink. - tests: input-fields расширен (editMode/checkBoxType/labelField+hyperlink), сертифицирован. Регресс 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
f27a17139a
commit
b4fc9bf42c
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.29 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.30 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -1914,7 +1914,7 @@ function Emit-Element {
|
||||
# columnGroup-specific
|
||||
"showInHeader"=1
|
||||
# radio-specific
|
||||
"radioButtonType"=1;"choiceList"=1;"columnsCount"=1
|
||||
"radioButtonType"=1;"choiceList"=1;"columnsCount"=1;"checkBoxType"=1;"editMode"=1
|
||||
# naming & binding
|
||||
"name"=1;"path"=1;"title"=1
|
||||
# visibility & state
|
||||
@@ -2210,6 +2210,7 @@ function Emit-Input {
|
||||
if ($el.spinButton -eq $true) { X "$inner<SpinButton>true</SpinButton>" }
|
||||
if ($el.dropListButton -eq $true) { X "$inner<DropListButton>true</DropListButton>" }
|
||||
if ($el.markIncomplete -eq $true) { X "$inner<AutoMarkIncomplete>true</AutoMarkIncomplete>" }
|
||||
if ($el.editMode) { X "$inner<EditMode>$($el.editMode)</EditMode>" }
|
||||
if ($el.textEdit -eq $false) { X "$inner<TextEdit>false</TextEdit>" }
|
||||
Emit-Layout -el $el -indent $inner -multiLineDefault ([bool]($el.multiLine -eq $true))
|
||||
|
||||
@@ -2237,6 +2238,15 @@ function Emit-Check {
|
||||
Emit-Title -el $el -name $name -indent $inner -auto:(-not $el.path)
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
if ($el.editMode) { X "$inner<EditMode>$($el.editMode)</EditMode>" }
|
||||
# CheckBoxType: нет ключа → умный дефолт Auto; "" → подавить; значение → маппинг
|
||||
if ($null -ne $el.PSObject.Properties['checkBoxType']) {
|
||||
if ($el.checkBoxType) {
|
||||
$cbt = switch ("$($el.checkBoxType)".ToLower()) { 'auto' {'Auto'} 'checkbox' {'CheckBox'} 'switcher' {'Switcher'} 'tumbler' {'Tumbler'} default {"$($el.checkBoxType)"} }
|
||||
X "$inner<CheckBoxType>$cbt</CheckBoxType>"
|
||||
}
|
||||
} else { X "$inner<CheckBoxType>Auto</CheckBoxType>" }
|
||||
|
||||
Emit-TitleLocation -el $el -indent $inner -smartDefault "Right"
|
||||
|
||||
Emit-Layout -el $el -indent $inner
|
||||
@@ -2502,7 +2512,9 @@ function Emit-LabelField {
|
||||
Emit-Title -el $el -name $name -indent $inner -auto:(-not $el.path)
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" }
|
||||
if ($el.editMode) { X "$inner<EditMode>$($el.editMode)</EditMode>" }
|
||||
# ВНИМАНИЕ: у LabelField платформенный тег именно <Hiperlink> (опечатка 1С), не <Hyperlink>.
|
||||
if ($el.hyperlink -eq $true) { X "$inner<Hiperlink>true</Hiperlink>" }
|
||||
Emit-Layout -el $el -indent $inner
|
||||
|
||||
# Companions
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.29 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.30 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -1341,7 +1341,7 @@ KNOWN_KEYS = {
|
||||
"group", "columnGroup", "buttonGroup", "input", "check", "radio", "label", "labelField", "table", "pages", "page",
|
||||
"button", "picture", "picField", "calendar", "cmdBar", "popup",
|
||||
"showInHeader",
|
||||
"radioButtonType", "choiceList", "columnsCount",
|
||||
"radioButtonType", "choiceList", "columnsCount", "checkBoxType", "editMode",
|
||||
"name", "path", "title",
|
||||
"visible", "hidden", "enabled", "disabled", "readOnly", "userVisible",
|
||||
"on", "handlers",
|
||||
@@ -2013,6 +2013,8 @@ def emit_input(lines, el, name, eid, indent):
|
||||
lines.append(f'{inner}<DropListButton>true</DropListButton>')
|
||||
if el.get('markIncomplete') is True:
|
||||
lines.append(f'{inner}<AutoMarkIncomplete>true</AutoMarkIncomplete>')
|
||||
if el.get('editMode'):
|
||||
lines.append(f'{inner}<EditMode>{el["editMode"]}</EditMode>')
|
||||
if el.get('textEdit') is False:
|
||||
lines.append(f'{inner}<TextEdit>false</TextEdit>')
|
||||
emit_layout(lines, el, inner, multi_line_default=(el.get('multiLine') is True))
|
||||
@@ -2039,6 +2041,16 @@ def emit_check(lines, el, name, eid, indent):
|
||||
emit_title(lines, el, name, inner, auto=not el.get('path'))
|
||||
emit_common_flags(lines, el, inner)
|
||||
|
||||
if el.get('editMode'):
|
||||
lines.append(f'{inner}<EditMode>{el["editMode"]}</EditMode>')
|
||||
# CheckBoxType: нет ключа → умный дефолт Auto; "" → подавить; значение → маппинг
|
||||
_cbt_map = {'auto': 'Auto', 'checkbox': 'CheckBox', 'switcher': 'Switcher', 'tumbler': 'Tumbler'}
|
||||
if 'checkBoxType' in el:
|
||||
if el.get('checkBoxType'):
|
||||
lines.append(f'{inner}<CheckBoxType>{_cbt_map.get(str(el["checkBoxType"]).lower(), el["checkBoxType"])}</CheckBoxType>')
|
||||
else:
|
||||
lines.append(f'{inner}<CheckBoxType>Auto</CheckBoxType>')
|
||||
|
||||
emit_title_location(lines, el, inner, 'Right')
|
||||
|
||||
emit_layout(lines, el, inner)
|
||||
@@ -2150,8 +2162,11 @@ def emit_label_field(lines, el, name, eid, indent):
|
||||
emit_title(lines, el, name, inner, auto=not el.get('path'))
|
||||
emit_common_flags(lines, el, inner)
|
||||
|
||||
if el.get('editMode'):
|
||||
lines.append(f'{inner}<EditMode>{el["editMode"]}</EditMode>')
|
||||
# ВНИМАНИЕ: у LabelField платформенный тег <Hiperlink> (опечатка 1С), не <Hyperlink>.
|
||||
if el.get('hyperlink') is True:
|
||||
lines.append(f'{inner}<Hyperlink>true</Hyperlink>')
|
||||
lines.append(f'{inner}<Hiperlink>true</Hiperlink>')
|
||||
emit_layout(lines, el, inner)
|
||||
|
||||
# Companions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# form-decompile v0.7 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||
# form-decompile v0.8 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
||||
param(
|
||||
@@ -374,6 +374,8 @@ function Decompile-Element {
|
||||
Add-CommonProps $obj $node $name
|
||||
if ((Get-Child $node 'MultiLine') -eq 'true') { $obj['multiLine'] = $true }
|
||||
if ((Get-Child $node 'PasswordMode') -eq 'true') { $obj['passwordMode'] = $true }
|
||||
if ((Get-Child $node 'AutoMarkIncomplete') -eq 'true') { $obj['markIncomplete'] = $true }
|
||||
$em = Get-Child $node 'EditMode'; if ($em) { $obj['editMode'] = $em }
|
||||
$tl = Get-Child $node 'TitleLocation'; if ($tl) { $obj['titleLocation'] = $tl.ToLower() }
|
||||
$ih = $node.SelectSingleNode("lf:InputHint", $ns); if ($ih) { $t = Get-LangText $ih; if ($t) { $obj['inputHint'] = $t } }
|
||||
foreach ($p in @('ChoiceButton','ClearButton','SpinButton','DropListButton')) {
|
||||
@@ -384,6 +386,11 @@ function Decompile-Element {
|
||||
$obj[$key] = $name
|
||||
$dp = Get-Child $node 'DataPath'; if ($dp) { $obj['path'] = $dp }
|
||||
Add-CommonProps $obj $node $name
|
||||
$em = Get-Child $node 'EditMode'; if ($em) { $obj['editMode'] = $em }
|
||||
# CheckBoxType: Auto = умный дефолт → опустить; нет тега → ""; иначе значение
|
||||
$cbt = Get-Child $node 'CheckBoxType'
|
||||
if ($null -eq $cbt) { $obj['checkBoxType'] = '' }
|
||||
elseif ($cbt -ne 'Auto') { $obj['checkBoxType'] = $cbt.Substring(0,1).ToLower() + $cbt.Substring(1) }
|
||||
Add-TitleLocation $obj $node 'Right'
|
||||
}
|
||||
'RadioButtonField' {
|
||||
@@ -419,7 +426,9 @@ function Decompile-Element {
|
||||
$obj[$key] = $name
|
||||
$dp = Get-Child $node 'DataPath'; if ($dp) { $obj['path'] = $dp }
|
||||
Add-CommonProps $obj $node $name
|
||||
if ((Get-Child $node 'Hyperlink') -eq 'true') { $obj['hyperlink'] = $true }
|
||||
$em = Get-Child $node 'EditMode'; if ($em) { $obj['editMode'] = $em }
|
||||
# LabelField: тег <Hiperlink> (опечатка платформы), не <Hyperlink>
|
||||
if ((Get-Child $node 'Hiperlink') -eq 'true') { $obj['hyperlink'] = $true }
|
||||
}
|
||||
'PictureDecoration' {
|
||||
$obj[$key] = $name
|
||||
|
||||
Reference in New Issue
Block a user