diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 957010de..669a0f3e 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.71 — Compile 1C managed form from JSON or object metadata +# form-compile v1.72 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2439,6 +2439,7 @@ function Emit-Element { "wrap"=1;"openButton"=1;"listChoiceMode"=1;"showInFooter"=1 "extendedEditMultipleValues"=1;"chooseType"=1;"autoCellHeight"=1 "choiceButtonRepresentation"=1;"footerHorizontalAlign"=1;"headerHorizontalAlign"=1 + "format"=1;"editFormat"=1;"choiceParameters"=1;"choiceParameterLinks"=1;"typeLink"=1 # label/hyperlink "hyperlink"=1;"formatted"=1 # group-specific @@ -2938,6 +2939,10 @@ function Emit-Input { Emit-MLText -tag "InputHint" -text $el.inputHint -indent $inner } + # Формат / формат редактирования (LocalStringType — строка или {ru,en}) + if ($el.format) { Emit-MLText -tag "Format" -text $el.format -indent $inner } + if ($el.editFormat) { Emit-MLText -tag "EditFormat" -text $el.editFormat -indent $inner } + Emit-ChoiceList -el $el -indent $inner # Связи по типу / связи параметров выбора / параметры выбора @@ -2982,6 +2987,10 @@ function Emit-Check { Emit-Layout -el $el -indent $inner + # Формат / формат редактирования (LocalStringType — строка или {ru,en}) + if ($el.format) { Emit-MLText -tag "Format" -text $el.format -indent $inner } + if ($el.editFormat) { Emit-MLText -tag "EditFormat" -text $el.editFormat -indent $inner } + # Оформление (цвета/шрифты/граница) — перед компаньонами Emit-Appearance -el $el -indent $inner -profile 'field' @@ -3448,6 +3457,10 @@ function Emit-LabelField { if ($el.hyperlink -eq $true) { X "$innertrue" } Emit-Layout -el $el -indent $inner + # Формат / формат редактирования (LocalStringType — строка или {ru,en}) + if ($el.format) { Emit-MLText -tag "Format" -text $el.format -indent $inner } + if ($el.editFormat) { Emit-MLText -tag "EditFormat" -text $el.editFormat -indent $inner } + # Оформление (цвета/шрифты/граница + header/footer) — перед компаньонами Emit-Appearance -el $el -indent $inner -profile 'field' diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 826cb63c..8570e1bc 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.71 — Compile 1C managed form from JSON or object metadata +# form-compile v1.72 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -1775,6 +1775,7 @@ KNOWN_KEYS = { "wrap", "openButton", "listChoiceMode", "showInHeader", "showInFooter", "extendedEditMultipleValues", "chooseType", "autoCellHeight", "choiceButtonRepresentation", "footerHorizontalAlign", "headerHorizontalAlign", + "format", "editFormat", "choiceParameters", "choiceParameterLinks", "typeLink", "hyperlink", "formatted", "showTitle", "united", "collapsed", "behavior", "children", "columns", @@ -3008,6 +3009,12 @@ def emit_input(lines, el, name, eid, indent): if el.get('inputHint'): emit_mltext(lines, inner, 'InputHint', el['inputHint']) + # Формат / формат редактирования (LocalStringType — строка или {ru,en}) + if el.get('format'): + emit_mltext(lines, inner, 'Format', el['format']) + if el.get('editFormat'): + emit_mltext(lines, inner, 'EditFormat', el['editFormat']) + emit_choice_list(lines, el, inner) # Связи по типу / связи параметров выбора / параметры выбора @@ -3052,6 +3059,12 @@ def emit_check(lines, el, name, eid, indent): emit_layout(lines, el, inner) + # Формат / формат редактирования (LocalStringType — строка или {ru,en}) + if el.get('format'): + emit_mltext(lines, inner, 'Format', el['format']) + if el.get('editFormat'): + emit_mltext(lines, inner, 'EditFormat', el['editFormat']) + # Оформление (цвета/шрифты/граница) — перед компаньонами emit_appearance(lines, el, inner, 'field') @@ -3159,6 +3172,12 @@ def emit_label_field(lines, el, name, eid, indent): lines.append(f'{inner}true') emit_layout(lines, el, inner) + # Формат / формат редактирования (LocalStringType — строка или {ru,en}) + if el.get('format'): + emit_mltext(lines, inner, 'Format', el['format']) + if el.get('editFormat'): + emit_mltext(lines, inner, 'EditFormat', el['editFormat']) + # Оформление (цвета/шрифты/граница + header/footer) — перед компаньонами emit_appearance(lines, el, inner, 'field') diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index e1413bb8..6ac1cd1a 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.49 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.50 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -1249,6 +1249,13 @@ function Decompile-TypeLink { return $o } +# Захват / (LocalStringType) → format/editFormat (строка или {ru,en}). +function Add-FormatProps { + param($obj, $node) + $fmt = $node.SelectSingleNode("lf:Format", $ns); if ($fmt) { $t = Get-LangText $fmt; if ($null -ne $t -and $t -ne '') { $obj['format'] = $t } } + $efmt = $node.SelectSingleNode("lf:EditFormat", $ns); if ($efmt) { $t = Get-LangText $efmt; if ($null -ne $t -and $t -ne '') { $obj['editFormat'] = $t } } +} + function Decompile-Element { param($node) $tag = $node.LocalName @@ -1315,6 +1322,7 @@ function Decompile-Element { } $cbr = Get-Child $node 'ChoiceButtonRepresentation'; if ($cbr) { $obj['choiceButtonRepresentation'] = $cbr } $cl = Decompile-ChoiceList $node; if ($cl) { $obj['choiceList'] = $cl } + Add-FormatProps $obj $node # Параметры выбора / Связи параметров выбора / Связь по типу $cp = Decompile-ChoiceParameters $node; if ($cp) { $obj['choiceParameters'] = $cp } $cpl = Decompile-ChoiceParameterLinks $node; if ($cpl) { $obj['choiceParameterLinks'] = $cpl } @@ -1330,6 +1338,7 @@ function Decompile-Element { 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' + Add-FormatProps $obj $node } 'RadioButtonField' { $obj[$key] = $name @@ -1356,6 +1365,7 @@ function Decompile-Element { $em = Get-Child $node 'EditMode'; if ($em) { $obj['editMode'] = $em } # LabelField: тег (опечатка платформы), не if ((Get-Child $node 'Hiperlink') -eq 'true') { $obj['hyperlink'] = $true } + Add-FormatProps $obj $node } 'PictureDecoration' { $obj[$key] = $name diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index 6d9f20f2..2fbb32d7 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -352,6 +352,8 @@ companion-панели с собственным контентом. Оба не | `skipOnInput` | bool | Пропускать при вводе | | `inputHint` | string | Подсказка ввода (placeholder) | | `choiceList` | array | Список выбора: массив `{ value, presentation?/title? }` — та же грамматика, что у `radio` (см. ниже) | +| `format` | string/object | Формат значения (``). Строка форматной строки 1С (`ЧДЦ=2`, `ДЛФ=D`, `БЛ=Нет; БИ=Да`) или мультиязык `{ru, en}`. Так же у `labelField` и `check` | +| `editFormat` | string/object | Формат редактирования (``). Та же грамматика, что `format` | | `wrap` | bool | Перенос по словам (``) | | `openButton` | bool | Кнопка открытия (``) | | `listChoiceMode` | bool | Режим выбора из списка (``) | diff --git a/tests/skills/cases/form-compile/input-fields.json b/tests/skills/cases/form-compile/input-fields.json index 197e6386..08bd8735 100644 --- a/tests/skills/cases/form-compile/input-fields.json +++ b/tests/skills/cases/form-compile/input-fields.json @@ -16,8 +16,8 @@ "input": { "title": "Поля ввода", "elements": [ - { "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput", "horizontalStretch": false, "verticalStretch": false }, - { "labelField": "Ссылка", "path": "ОбычноеПоле", "titleLocation": "left", "hyperlink": true }, + { "input": "ОбычноеПоле", "path": "ОбычноеПоле", "title": "Обычное поле", "tooltip": "Введите значение поля", "tooltipRepresentation": "ShowBottom", "editMode": "EnterOnInput", "horizontalStretch": false, "verticalStretch": false, "format": "ЧДЦ=2", "editFormat": "ЧДЦ=2; ЧН=" }, + { "labelField": "Ссылка", "path": "ОбычноеПоле", "titleLocation": "left", "hyperlink": true, "format": { "ru": "ДЛФ=D", "en": "DLF=D" } }, { "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": "Пароль" }, { "input": "ПолеСКнопками", "path": "ПолеСКнопками", "choiceButton": true, "clearButton": true, "title": "Выбор" }, @@ -48,7 +48,7 @@ { "check": "Флаг", "path": "Флаг", "title": "Включено" }, { "check": "ФлагПлатформенный", "path": "ФлагПлатформенный", "title": "Слева", "titleLocation": "" }, { "check": "ФлагЯвный", "path": "ФлагЯвный", "title": "Сверху", "titleLocation": "top" }, - { "check": "ФлагТумблер", "path": "ФлагТумблер", "title": "Тумблер", "checkBoxType": "switcher" } + { "check": "ФлагТумблер", "path": "ФлагТумблер", "title": "Тумблер", "checkBoxType": "switcher", "format": "БЛ=Нет; БИ=Да" } ], "attributes": [ { "name": "Объект", "type": "DataProcessorObject.ПоляВвода", "main": true }, 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 f7d01670..3b8dbff8 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 @@ -27,6 +27,18 @@ EnterOnInput false false + + + ru + ЧДЦ=2 + + + + + ru + ЧДЦ=2; ЧН= + + @@ -34,6 +46,16 @@ ОбычноеПоле Left true + + + ru + ДЛФ=D + + + en + DLF=D + + @@ -323,6 +345,12 @@ Switcher Right + + + ru + БЛ=Нет; БИ=Да + +