mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-16 07:45:17 +03:00
fix(form-decompile,form-compile): formatted у LabelDecoration независим от hyperlink (кластер formatted)
Компилятор выводил <Title formatted="…"> из hyperlink (formatted = hyperlink), но это неверно: атрибут formatted НЕЗАВИСИМ. По корпусу acc+erp: - 9080 label'ов: hyperlink есть, formatted=false (компилятор давал true); - 6545: formatted=true без hyperlink (компилятор давал false). Итого ~15625 расхождений. Введён отдельный ключ formatted (bool, выводится при true): - декомпилятор: захват атрибута <Title formatted> у LabelDecoration (независимо от <Hyperlink>); - компилятор Emit-Label: formatted из ключа, не из hyperlink. Декомпилятор (ps1) + компилятор (ps1+py) + spec (label.formatted). Снэпшот events обновлён: label с hyperlink:true теперь даёт formatted="false" (фиксирует развязку) — сертифицирован в 1С 8.3.24. Регресс ps+py 33/33. Остаток <Title formatted> в раундтрипе принадлежит ExtendedTooltip-с-контентом и PictureDecoration — отдельные кластеры (в BACKLOG). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# form-compile v1.37 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.38 — Compile 1C managed form from JSON or object metadata
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$JsonPath,
|
[string]$JsonPath,
|
||||||
@@ -1974,7 +1974,7 @@ function Emit-Element {
|
|||||||
"spinButton"=1;"dropListButton"=1;"markIncomplete"=1;"skipOnInput"=1;"inputHint"=1
|
"spinButton"=1;"dropListButton"=1;"markIncomplete"=1;"skipOnInput"=1;"inputHint"=1
|
||||||
"textEdit"=1
|
"textEdit"=1
|
||||||
# label/hyperlink
|
# label/hyperlink
|
||||||
"hyperlink"=1
|
"hyperlink"=1;"formatted"=1
|
||||||
# group-specific
|
# group-specific
|
||||||
"showTitle"=1;"united"=1;"collapsed"=1
|
"showTitle"=1;"united"=1;"collapsed"=1
|
||||||
# hierarchy
|
# hierarchy
|
||||||
@@ -2527,7 +2527,8 @@ function Emit-Label {
|
|||||||
$hasTitleKey = $null -ne $el.PSObject.Properties['title']
|
$hasTitleKey = $null -ne $el.PSObject.Properties['title']
|
||||||
$labelTitle = if ($hasTitleKey) { $el.title } else { Title-FromName -name $name }
|
$labelTitle = if ($hasTitleKey) { $el.title } else { Title-FromName -name $name }
|
||||||
if ($labelTitle) {
|
if ($labelTitle) {
|
||||||
$formatted = if ($el.hyperlink -eq $true) { "true" } else { "false" }
|
# formatted — независимое свойство (НЕ выводится из hyperlink): ссылка может быть не-форматированной и наоборот.
|
||||||
|
$formatted = if ($el.formatted -eq $true) { "true" } else { "false" }
|
||||||
X "$inner<Title formatted=`"$formatted`">"
|
X "$inner<Title formatted=`"$formatted`">"
|
||||||
Emit-MLItems -val $labelTitle -indent "$inner`t"
|
Emit-MLItems -val $labelTitle -indent "$inner`t"
|
||||||
X "$inner</Title>"
|
X "$inner</Title>"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# form-compile v1.37 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.38 — Compile 1C managed form from JSON or object metadata
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import copy
|
import copy
|
||||||
@@ -1367,7 +1367,7 @@ KNOWN_KEYS = {
|
|||||||
"multiLine", "passwordMode", "choiceButton", "clearButton",
|
"multiLine", "passwordMode", "choiceButton", "clearButton",
|
||||||
"spinButton", "dropListButton", "markIncomplete", "skipOnInput", "inputHint",
|
"spinButton", "dropListButton", "markIncomplete", "skipOnInput", "inputHint",
|
||||||
"textEdit",
|
"textEdit",
|
||||||
"hyperlink",
|
"hyperlink", "formatted",
|
||||||
"showTitle", "united", "collapsed",
|
"showTitle", "united", "collapsed",
|
||||||
"children", "columns",
|
"children", "columns",
|
||||||
"changeRowSet", "changeRowOrder", "header", "footer",
|
"changeRowSet", "changeRowOrder", "header", "footer",
|
||||||
@@ -2177,7 +2177,8 @@ def emit_label(lines, el, name, eid, indent):
|
|||||||
|
|
||||||
label_title = el['title'] if 'title' in el else title_from_name(name)
|
label_title = el['title'] if 'title' in el else title_from_name(name)
|
||||||
if label_title:
|
if label_title:
|
||||||
formatted = 'true' if el.get('hyperlink') is True else 'false'
|
# formatted — независимое свойство (НЕ выводится из hyperlink).
|
||||||
|
formatted = 'true' if el.get('formatted') is True else 'false'
|
||||||
lines.append(f'{inner}<Title formatted="{formatted}">')
|
lines.append(f'{inner}<Title formatted="{formatted}">')
|
||||||
emit_ml_items(lines, f'{inner}\t', label_title)
|
emit_ml_items(lines, f'{inner}\t', label_title)
|
||||||
lines.append(f'{inner}</Title>')
|
lines.append(f'{inner}</Title>')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# form-decompile v0.17 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
# form-decompile v0.18 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
||||||
param(
|
param(
|
||||||
@@ -399,6 +399,9 @@ function Decompile-Element {
|
|||||||
$obj[$key] = $name
|
$obj[$key] = $name
|
||||||
Add-CommonProps $obj $node $name
|
Add-CommonProps $obj $node $name
|
||||||
if ((Get-Child $node 'Hyperlink') -eq 'true') { $obj['hyperlink'] = $true }
|
if ((Get-Child $node 'Hyperlink') -eq 'true') { $obj['hyperlink'] = $true }
|
||||||
|
# formatted — атрибут <Title formatted="…">, НЕЗАВИСИМ от hyperlink (true → ключ, false → опускаем)
|
||||||
|
$tiNode = $node.SelectSingleNode("lf:Title", $ns)
|
||||||
|
if ($tiNode -and $tiNode.GetAttribute('formatted') -eq 'true') { $obj['formatted'] = $true }
|
||||||
}
|
}
|
||||||
'LabelField' {
|
'LabelField' {
|
||||||
$obj[$key] = $name
|
$obj[$key] = $name
|
||||||
|
|||||||
@@ -276,6 +276,7 @@
|
|||||||
|----------|-----|----------|
|
|----------|-----|----------|
|
||||||
| `title` | string | Текст надписи |
|
| `title` | string | Текст надписи |
|
||||||
| `hyperlink` | bool | Режим гиперссылки |
|
| `hyperlink` | bool | Режим гиперссылки |
|
||||||
|
| `formatted` | bool | Форматированный текст (`<Title formatted="true">`). **Независим от `hyperlink`** — выводится только при `true` |
|
||||||
| `width` | int | Ширина |
|
| `width` | int | Ширина |
|
||||||
| `height` | int | Высота |
|
| `height` | int | Высота |
|
||||||
| `autoMaxWidth` | bool | Автомаксимальная ширина |
|
| `autoMaxWidth` | bool | Автомаксимальная ширина |
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
</Events>
|
</Events>
|
||||||
</InputField>
|
</InputField>
|
||||||
<LabelDecoration name="Подсказка" id="7">
|
<LabelDecoration name="Подсказка" id="7">
|
||||||
<Title formatted="true">
|
<Title formatted="false">
|
||||||
<v8:item>
|
<v8:item>
|
||||||
<v8:lang>ru</v8:lang>
|
<v8:lang>ru</v8:lang>
|
||||||
<v8:content>Нажмите для перехода</v8:content>
|
<v8:content>Нажмите для перехода</v8:content>
|
||||||
|
|||||||
Reference in New Issue
Block a user