mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-14 18:04:58 +03:00
feat(form-decompile,form-compile): tooltipRepresentation элемента (кластер ToolTipRepresentation)
<ToolTipRepresentation> (режим показа подсказки: None/Button/ShowBottom/ShowTop/ ShowLeft/ShowRight/ShowAuto/Balloon) — общее свойство элемента (Button 13785, Popup 6417, ButtonGroup, InputField, CheckBoxField, LabelDecoration, группы и др.; None доминирует — 25241). Терялся: декомпилятор не читал, компилятор не эмитил. Введён общий passthrough-ключ tooltipRepresentation: - декомпилятор: захват в Add-CommonProps; - компилятор: эмиссия в Emit-Title (после ToolTip) — покрывает все эмиттеры, зовущие Emit-Title; плюс отдельно в Emit-Label (свой title-блок, не зовёт Emit-Title). Декомпилятор (ps1) + компилятор (ps1+py) + spec §4.1. Покрытие: input-fields (input, ShowBottom), events (label-декорация, Button) — сертифицировано в 1С 8.3.24. Раундтрип БанковскиеСчета/Wildberries: остаток ToolTipRepresentation = 0. Регресс ps+py 33/33. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.36 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.37 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -1959,7 +1959,7 @@ function Emit-Element {
|
||||
# radio-specific
|
||||
"radioButtonType"=1;"choiceList"=1;"columnsCount"=1;"checkBoxType"=1;"editMode"=1
|
||||
# naming & binding
|
||||
"name"=1;"path"=1;"title"=1;"tooltip"=1
|
||||
"name"=1;"path"=1;"title"=1;"tooltip"=1;"tooltipRepresentation"=1
|
||||
# visibility & state
|
||||
"visible"=1;"hidden"=1;"enabled"=1;"disabled"=1;"readOnly"=1;"userVisible"=1
|
||||
# events ("events" — основной формат; on/handlers — legacy, принимаются ради совместимости)
|
||||
@@ -2096,6 +2096,8 @@ function Emit-Title {
|
||||
}
|
||||
# ToolTip элемента (всплывающая подсказка) — по схеме сразу после Title.
|
||||
if ($el.tooltip) { Emit-MLText -tag "ToolTip" -text $el.tooltip -indent $indent }
|
||||
# ToolTipRepresentation — режим показа подсказки (None/Button/ShowBottom/…), после ToolTip.
|
||||
if ($el.tooltipRepresentation) { X "$indent<ToolTipRepresentation>$($el.tooltipRepresentation)</ToolTipRepresentation>" }
|
||||
}
|
||||
|
||||
function Map-TitleLoc {
|
||||
@@ -2531,6 +2533,7 @@ function Emit-Label {
|
||||
X "$inner</Title>"
|
||||
}
|
||||
if ($el.tooltip) { Emit-MLText -tag "ToolTip" -text $el.tooltip -indent $inner }
|
||||
if ($el.tooltipRepresentation) { X "$inner<ToolTipRepresentation>$($el.tooltipRepresentation)</ToolTipRepresentation>" }
|
||||
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.36 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.37 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -1356,7 +1356,7 @@ KNOWN_KEYS = {
|
||||
"button", "picture", "picField", "calendar", "cmdBar", "popup",
|
||||
"showInHeader",
|
||||
"radioButtonType", "choiceList", "columnsCount", "checkBoxType", "editMode",
|
||||
"name", "path", "title", "tooltip",
|
||||
"name", "path", "title", "tooltip", "tooltipRepresentation",
|
||||
"visible", "hidden", "enabled", "disabled", "readOnly", "userVisible",
|
||||
"events", "on", "handlers",
|
||||
"selectionMode", "showCurrentDate", "widthInMonths", "heightInMonths", "showMonthsPanel",
|
||||
@@ -1678,6 +1678,9 @@ def emit_title(lines, el, name, indent, auto=False):
|
||||
# ToolTip элемента (всплывающая подсказка) — по схеме сразу после Title.
|
||||
if el.get('tooltip'):
|
||||
emit_mltext(lines, indent, 'ToolTip', el['tooltip'])
|
||||
# ToolTipRepresentation — режим показа подсказки (None/Button/ShowBottom/…), после ToolTip.
|
||||
if el.get('tooltipRepresentation'):
|
||||
lines.append(f'{indent}<ToolTipRepresentation>{el["tooltipRepresentation"]}</ToolTipRepresentation>')
|
||||
|
||||
|
||||
_TITLE_LOC_MAP = {'none': 'None', 'left': 'Left', 'right': 'Right', 'top': 'Top', 'bottom': 'Bottom', 'auto': 'Auto'}
|
||||
@@ -2180,6 +2183,8 @@ def emit_label(lines, el, name, eid, indent):
|
||||
lines.append(f'{inner}</Title>')
|
||||
if el.get('tooltip'):
|
||||
emit_mltext(lines, inner, 'ToolTip', el['tooltip'])
|
||||
if el.get('tooltipRepresentation'):
|
||||
lines.append(f'{inner}<ToolTipRepresentation>{el["tooltipRepresentation"]}</ToolTipRepresentation>')
|
||||
|
||||
emit_common_flags(lines, el, inner)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# form-decompile v0.16 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||
# form-decompile v0.17 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
||||
param(
|
||||
@@ -241,6 +241,7 @@ function Add-CommonProps {
|
||||
}
|
||||
$ttNode = $node.SelectSingleNode("lf:ToolTip", $ns)
|
||||
if ($ttNode) { $tt = Get-LangText $ttNode; if ($null -ne $tt) { $obj['tooltip'] = $tt } }
|
||||
$ttr = Get-Child $node 'ToolTipRepresentation'; if ($ttr) { $obj['tooltipRepresentation'] = $ttr }
|
||||
$ev = Get-Events $node $elName
|
||||
if ($ev) { $obj['events'] = $ev }
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
| `events` | object | Обработчики событий: `{ "ИмяСобытия": "ИмяОбработчика" }` — тот же формат, что у событий формы (§3). Значение `null` → имя по конвенции (§4.2). См. §4.2 |
|
||||
| `titleLocation` | string | Расположение заголовка: `none`/`left`/`right`/`top`/`bottom`/`auto`. Эмитится при наличии (input, labelField, picField, table, calendar). У `check`/`radio` — особая семантика с умным дефолтом (см. их разделы) |
|
||||
| `tooltip` | string/object | Всплывающая подсказка элемента (`<ToolTip>`). Строка → ru, объект `{ "ru": …, "en": … }` → мультиязычный (как `title`). Эмитится сразу после `title` |
|
||||
| `tooltipRepresentation` | string | Режим показа подсказки (`<ToolTipRepresentation>`): `None`, `Button`, `ShowBottom`, `ShowTop`, `ShowLeft`, `ShowRight`, `ShowAuto`, `Balloon`. Эмитится при наличии |
|
||||
|
||||
### 4.1a. Общие layout-свойства
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"elements": [
|
||||
{ "input": "Организация", "path": "Организация", "events": { "OnChange": "ОрганизацияПриИзменении", "StartChoice": "ОрганизацияНачалоВыбора" } },
|
||||
{ "input": "Период", "path": "Период", "events": { "OnChange": "ПериодПриИзменении" } },
|
||||
{ "label": "Подсказка", "title": "Нажмите для перехода", "hyperlink": true, "events": { "Click": null } }
|
||||
{ "label": "Подсказка", "title": "Нажмите для перехода", "hyperlink": true, "tooltipRepresentation": "Button", "events": { "Click": null } }
|
||||
],
|
||||
"attributes": [
|
||||
{ "name": "Объект", "type": "DataProcessorObject.События", "main": true },
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"input": {
|
||||
"title": "Поля ввода",
|
||||
"elements": [
|
||||
{ "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "editMode": "EnterOnInput" },
|
||||
{ "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput" },
|
||||
{ "labelField": "Ссылка", "path": "ОбычноеПоле", "titleLocation": "left", "hyperlink": true },
|
||||
{ "input": "МногострочноеПоле", "path": "МногострочноеПоле", "multiLine": true, "height": 5, "title": "Комментарий" },
|
||||
{ "input": "ПолеПароля", "path": "ПолеПароля", "passwordMode": true, "title": "Пароль" },
|
||||
|
||||
+1
@@ -37,6 +37,7 @@
|
||||
<v8:content>Нажмите для перехода</v8:content>
|
||||
</v8:item>
|
||||
</Title>
|
||||
<ToolTipRepresentation>Button</ToolTipRepresentation>
|
||||
<Hyperlink>true</Hyperlink>
|
||||
<ContextMenu name="ПодсказкаКонтекстноеМеню" id="8"/>
|
||||
<ExtendedTooltip name="ПодсказкаРасширеннаяПодсказка" id="9"/>
|
||||
|
||||
+1
@@ -23,6 +23,7 @@
|
||||
<v8:content>Введите значение поля</v8:content>
|
||||
</v8:item>
|
||||
</ToolTip>
|
||||
<ToolTipRepresentation>ShowBottom</ToolTipRepresentation>
|
||||
<EditMode>EnterOnInput</EditMode>
|
||||
<ContextMenu name="ОбычноеПолеКонтекстноеМеню" id="2"/>
|
||||
<ExtendedTooltip name="ОбычноеПолеРасширеннаяПодсказка" id="3"/>
|
||||
|
||||
Reference in New Issue
Block a user