diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 624681d1..84011099 100644 --- a/.claude/skills/form-compile/scripts/form-compile.ps1 +++ b/.claude/skills/form-compile/scripts/form-compile.ps1 @@ -1,4 +1,4 @@ -# form-compile v1.120 — Compile 1C managed form from JSON or object metadata +# form-compile v1.121 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2356,7 +2356,7 @@ function Emit-Events { $script:companionStructKeys = @( 'width','autoMaxWidth','maxWidth','height','autoMaxHeight','maxHeight','verticalAlign','titleHeight', 'horizontalStretch','verticalStretch','horizontalAlign','groupHorizontalAlign','groupVerticalAlign', - 'visible','hidden','enabled','disabled','hyperlink', + 'visible','hidden','enabled','disabled','hyperlink','events', 'textColor','backColor','borderColor','font','border','цветтекста','цветфона','цветрамки','шрифт','рамка' ) function Test-CompanionStructured { @@ -2405,6 +2405,8 @@ function Emit-Companion { Emit-Layout -el $content -indent $inner Emit-Appearance -el $content -indent $inner -profile 'decoration' if ($txtPresent) { Emit-CompanionTitle -content $content -indent $inner } + # События компаньона (ExtendedTooltip = LabelDecoration: напр. URLProcessing у hyperlink-подсказки) + Emit-Events -el $content -elementName $name -indent $inner -typeKey 'label' } else { Emit-CompanionTitle -content $content -indent $inner } diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 688e8016..635120e9 100644 --- a/.claude/skills/form-compile/scripts/form-compile.py +++ b/.claude/skills/form-compile/scripts/form-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# form-compile v1.120 — Compile 1C managed form from JSON or object metadata +# form-compile v1.121 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -2391,7 +2391,7 @@ def resolve_ml_formatted(val): COMPANION_STRUCT_KEYS = { 'width', 'autoMaxWidth', 'maxWidth', 'height', 'autoMaxHeight', 'maxHeight', 'verticalAlign', 'titleHeight', 'horizontalStretch', 'verticalStretch', 'horizontalAlign', 'groupHorizontalAlign', 'groupVerticalAlign', - 'visible', 'hidden', 'enabled', 'disabled', 'hyperlink', + 'visible', 'hidden', 'enabled', 'disabled', 'hyperlink', 'events', 'textColor', 'backColor', 'borderColor', 'font', 'border', 'цветтекста', 'цветфона', 'цветрамки', 'шрифт', 'рамка', } @@ -2420,6 +2420,8 @@ def emit_companion(lines, tag, name, indent, content=None): emit_appearance(lines, content, inner, 'decoration') if 'text' in content: emit_companion_title(lines, content, inner) + # События компаньона (ExtendedTooltip = LabelDecoration: напр. URLProcessing у hyperlink-подсказки) + emit_events(lines, content, name, inner, 'label') else: emit_companion_title(lines, content, inner) lines.append(f'{indent}') diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index 22df1abb..e048ae9c 100644 --- a/.claude/skills/form-decompile/scripts/form-decompile.ps1 +++ b/.claude/skills/form-decompile/scripts/form-decompile.ps1 @@ -1,4 +1,4 @@ -# form-decompile v0.96 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.97 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -1895,8 +1895,7 @@ function Decompile-Element { Add-Layout $obj $node Add-GenericScalars $obj $node # extendedTooltip: companion (это LabelDecoration). Текст-форма (только ) → - # строка/{text,formatted}. Own-content (layout/оформление/флаги/hyperlink) → объект { text?, … }. - # Events компаньона пока НЕ захватываем (хвост — требует имя-обработчик). + # строка/{text,formatted}. Own-content (layout/оформление/флаги/hyperlink/events) → объект { text?, … }. $etNode = $node.SelectSingleNode("lf:ExtendedTooltip", $ns) if ($etNode) { $etTitle = $etNode.SelectSingleNode("lf:Title", $ns) @@ -1908,6 +1907,8 @@ function Decompile-Element { if ((Get-Child $etNode 'Visible') -eq 'false') { $etObj['hidden'] = $true } if ((Get-Child $etNode 'Enabled') -eq 'false') { $etObj['disabled'] = $true } if ((Get-Child $etNode 'Hyperlink') -eq 'true') { $etObj['hyperlink'] = $true } + # События компаньона (напр. URLProcessing у hyperlink-подсказки) — переиспользуем механизм событий элемента + $etEv = Get-Events $etNode $name; if ($etEv) { $etObj['events'] = $etEv } if ($etObj.Count -gt 0) { if ($null -ne $textVal) { if ($textVal -is [System.Collections.IDictionary] -and $textVal.Contains('text')) { $etObj['text'] = $textVal['text']; if ($textVal['formatted']) { $etObj['formatted'] = $true } } diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index 4e30ef4f..afbbbbc2 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -132,7 +132,7 @@ | `tooltip` | string/object | Всплывающая подсказка элемента (`<ToolTip>`). Строка → ru, объект `{ "ru": …, "en": … }` → мультиязычный (как `title`). Эмитится сразу после `title` | | `tooltipRepresentation` | string | Режим показа подсказки (`<ToolTipRepresentation>`): `None`, `Button`, `ShowBottom`, `ShowTop`, `ShowLeft`, `ShowRight`, `ShowAuto`, `Balloon`. Эмитится при наличии | | `displayImportance` | string | Важность отображения (атрибут открывающего тега `DisplayImportance`): `VeryHigh`, `High`, `Usual`, `Low`, `VeryLow`. Адаптивная раскладка (моб./узкие формы). Применимо к любому элементу | -| `extendedTooltip` | string/object | Расширенная подсказка (companion `<ExtendedTooltip>`, по сути LabelDecoration). **Текст-форма**: строка / ML / `{text, formatted}`. **Own-content форма** (объект с layout/оформлением/флагами): `{ text?, formatted?, width?, autoMaxWidth?, maxWidth?, height?, horizontalStretch?, verticalAlign?, titleHeight?, hyperlink?, visible?, enabled?, textColor?, font?, … }` — own-content эмитится перед `Title`. (События компаньона пока не поддержаны.) Синоним: `extTooltip` | +| `extendedTooltip` | string/object | Расширенная подсказка (companion `<ExtendedTooltip>`, по сути LabelDecoration). **Текст-форма**: строка / ML / `{text, formatted}`. **Own-content форма** (объект с layout/оформлением/флагами): `{ text?, formatted?, width?, autoMaxWidth?, maxWidth?, height?, horizontalStretch?, verticalAlign?, titleHeight?, hyperlink?, visible?, enabled?, textColor?, font?, … }` — own-content эмитится перед `Title`. **События** компаньона — ключ `events` (та же грамматика, что у элемента; напр. `{ "URLProcessing": "Обработчик" }` у hyperlink-подсказки), эмитится после `Title`. Синоним: `extTooltip` | #### Форма ML-текста и `formatted` diff --git a/tests/skills/cases/form-compile/input-fields.json b/tests/skills/cases/form-compile/input-fields.json index 9a1cce44..606274bf 100644 --- a/tests/skills/cases/form-compile/input-fields.json +++ b/tests/skills/cases/form-compile/input-fields.json @@ -16,7 +16,7 @@ "input": { "title": "Поля ввода", "elements": [ - { "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput", "multiLine": false, "shortcut": "Ctrl+Shift+O", "horizontalStretch": false, "verticalStretch": false, "format": "ЧДЦ=2", "editFormat": "ЧДЦ=2; ЧН=", "extendedTooltip": { "width": 30, "autoMaxWidth": false, "text": "Расширенная подсказка поля" } }, + { "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput", "multiLine": false, "shortcut": "Ctrl+Shift+O", "horizontalStretch": false, "verticalStretch": false, "format": "ЧДЦ=2", "editFormat": "ЧДЦ=2; ЧН=", "extendedTooltip": { "width": 30, "autoMaxWidth": false, "hyperlink": true, "text": "Расширенная подсказка поля", "events": { "URLProcessing": "ОбычноеПолеРасширеннаяПодсказкаОбработкаНавигационнойСсылки" } } }, { "labelField": "Ссылка", "path": "ОбычноеПоле", "titleLocation": "left", "hyperlink": true, "format": { "ru": "ДЛФ=D", "en": "DLF=D" }, "warningOnEdit": "Поле только для чтения" }, { "input": "МногострочноеПоле", "path": "МногострочноеПоле", "multiLine": true, "height": 5, "title": "Комментарий", "wrap": false, "showInHeader": false, "showInFooter": false, "autoCellHeight": true, "footerHorizontalAlign": "Right", "openButton": false, "chooseType": false }, { "input": "ПолеПароля", "path": "ПолеПароля", "passwordMode": true, "title": "Пароль" }, diff --git a/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml index 7a56601f..05b50d80 100644 --- a/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/input-fields/DataProcessors/ПоляВвода/Forms/Форма/Ext/Form.xml @@ -43,6 +43,7 @@ </EditFormat> <ContextMenu name="ОбычноеПолеКонтекстноеМеню" id="2"/> <ExtendedTooltip name="ОбычноеПолеРасширеннаяПодсказка" id="3"> + <Hyperlink>true</Hyperlink> <AutoMaxWidth>false</AutoMaxWidth> <Width>30</Width> <Title formatted="false"> @@ -51,6 +52,9 @@ <v8:content>Расширенная подсказка поля</v8:content> </v8:item> + + ОбычноеПолеРасширеннаяПодсказкаОбработкаНавигационнойСсылки +