From d5d525aa2705b10c806b7cedebf3256a87576487 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 7 Jun 2026 21:03:18 +0300 Subject: [PATCH] =?UTF-8?q?feat(form-compile):=20=D0=BE=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B3=D1=80=D1=83=D0=BF?= =?UTF-8?q?=D0=BF/=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86/picField/calendar?= =?UTF-8?q?=20+=20=D0=B4=D0=B5=D0=BA=D0=BE=D0=B4=20\u-=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B5=D0=B2=20(?= =?UTF-8?q?=D1=85=D0=B2=D0=BE=D1=81=D1=82=20Appearance)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Развёл Emit-Appearance ещё в 5 эмиттеров: UsualGroup/ColumnGroup/Table/PictureField/CalendarField (профиль field; декомпилятор их уже захватывал в Add-CommonProps — теперь компилятор эмитит). Порядок собственного оформления по корпусу: группа TitleTextColor/TitleFont/BackColor; таблица BackColor/BorderColor — укладываются в field-профиль. Зеркало PS+Python. PictureDecoration НЕ разведён намеренно: его XSD расщепляет оформление вокруг (TextColor/Font до Title, Border после) + позиция <Picture> — отдельный мелкий кластер (2 строки). Сертификация загрузкой в 1С 8.3.24: element-appearance (+ группа с BackColor), dynamic-list-parameters (+ Table backColor/borderColor, колонка titleTextColor/border) — чисто. Регресс 36/36 ps+py. Harness 1177→1146 (−31; весь кластер Appearance 1326→1146 = −180), остаток appearance LOST = PictureDecoration 2, ADDED-регрессий 0. Попутно: декодированы garbled \u-escape в КОММЕНТАРИЯХ form-compile.py (артефакт Edit-инструмента, переэкранирующего кириллицу под ASCII-конвенцию файла; в комментариях \u не интерпретируется). Строковые литералы (имена компаньонов) остаются \u-escaped — там escape функционален. Версия form-compile v1.66. --- .../form-compile/scripts/form-compile.ps1 | 20 ++++++++++++++++++- .../form-compile/scripts/form-compile.py | 20 ++++++++++++++++++- docs/form-dsl-spec.md | 2 +- .../form-compile/dynamic-list-parameters.json | 4 ++-- .../form-compile/element-appearance.json | 7 +++++-- .../Товары/Forms/ФормаСписка/Ext/Form.xml | 6 ++++++ .../Товары/Forms/ФормаЭлемента/Ext/Form.xml | 14 ++++++++++++- 7 files changed, 65 insertions(+), 8 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 4e6dc8b2..79c51d10 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.65 — Compile 1C managed form from JSON or object metadata +# form-compile v1.66 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2830,6 +2830,9 @@ function Emit-Group { Emit-CommonFlags -el $el -indent $inner Emit-Layout -el $el -indent $inner + # Оформление (цвета/шрифты/граница) — перед компаньоном + Emit-Appearance -el $el -indent $inner -profile 'field' + # Companion: ExtendedTooltip Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip @@ -2869,6 +2872,9 @@ function Emit-ColumnGroup { Emit-CommonFlags -el $el -indent $inner Emit-Layout -el $el -indent $inner + # Оформление (цвета/шрифты/граница) — перед компаньоном + Emit-Appearance -el $el -indent $inner -profile 'field' + # Companion: ExtendedTooltip Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip @@ -3381,6 +3387,9 @@ function Emit-Table { X "$inner</CommandSet>" } + # Оформление (цвета/граница таблицы) — перед компаньонами + Emit-Appearance -el $el -indent $inner -profile 'field' + # Companions Emit-CompanionPanel -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner -panel $el.contextMenu # AutoCommandBar: приоритет commandBar-свойства (контент); иначе tableAutofill-shorthand; иначе пусто. @@ -3598,6 +3607,9 @@ function Emit-PictureDecoration { if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" } Emit-Layout -el $el -indent $inner + # Оформление PictureDecoration: XSD расщепляет appearance вокруг Title (Border после Title) + # + позиция Picture — отдельный кластер, пока не разводим (декомпилятор захватывает в keys). + # Companions Emit-CompanionPanel -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner -panel $el.contextMenu Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip @@ -3629,6 +3641,9 @@ function Emit-PictureField { # Скаляр (Ref) или объект {src, loadTransparent}; LoadTransparent эмитится всегда. Emit-PictureRef -val $el.valuesPicture -picTag 'ValuesPicture' -indent $inner + # Оформление (цвета/шрифты/граница) — перед компаньонами + Emit-Appearance -el $el -indent $inner -profile 'field' + # Companions Emit-CompanionPanel -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner -panel $el.contextMenu Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip @@ -3671,6 +3686,9 @@ function Emit-Calendar { if ($null -ne $el.heightInMonths) { X "$inner<HeightInMonths>$($el.heightInMonths)</HeightInMonths>" } if ($null -ne $el.showMonthsPanel) { $v = if ($el.showMonthsPanel) { "true" } else { "false" }; X "$inner<ShowMonthsPanel>$v</ShowMonthsPanel>" } + # Оформление (цвета/шрифты/граница) — перед компаньонами + Emit-Appearance -el $el -indent $inner -profile 'field' + # Companions Emit-CompanionPanel -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner -panel $el.contextMenu Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 737845cd..3d7a6b3d 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.65 — Compile 1C managed form from JSON or object metadata +# form-compile v1.66 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -2744,6 +2744,9 @@ def emit_group(lines, el, name, eid, indent): emit_common_flags(lines, el, inner) emit_layout(lines, el, inner) + # Оформление (цвета/шрифты/граница) — перед компаньоном + emit_appearance(lines, el, inner, 'field') + # Companion: ExtendedTooltip emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner, el.get('extendedTooltip')) @@ -2780,6 +2783,9 @@ def emit_column_group(lines, el, name, eid, indent): emit_common_flags(lines, el, inner) emit_layout(lines, el, inner) + # Оформление (цвета/шрифты/граница) — перед компаньоном + emit_appearance(lines, el, inner, 'field') + emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner, el.get('extendedTooltip')) if el.get('children') and len(el['children']) > 0: @@ -3101,6 +3107,9 @@ def emit_table(lines, el, name, eid, indent): lines.append(f'{inner}\t<ExcludedCommand>{cmd}</ExcludedCommand>') lines.append(f'{inner}</CommandSet>') + # Оформление (цвета/граница таблицы) — перед компаньонами + emit_appearance(lines, el, inner, 'field') + # Companions emit_companion_panel(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner, el.get('contextMenu')) # AutoCommandBar — with optional Autofill control @@ -3293,6 +3302,9 @@ def emit_picture_decoration(lines, el, name, eid, indent): lines.append(f'{inner}<Hyperlink>true</Hyperlink>') emit_layout(lines, el, inner) + # Оформление PictureDecoration: XSD расщепляет appearance вокруг Title (Border после Title) + # + позиция Picture — отдельный кластер, пока не разводим (декомпилятор захватывает в keys). + # Companions emit_companion_panel(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner, el.get('contextMenu')) emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner, el.get('extendedTooltip')) @@ -3325,6 +3337,9 @@ def emit_picture_field(lines, el, name, eid, indent): # Скаляр (Ref) или объект {src, loadTransparent}; LoadTransparent эмитится всегда. emit_picture_ref(lines, el.get('valuesPicture'), 'ValuesPicture', inner) + # Оформление (цвета/шрифты/граница) — перед компаньонами + emit_appearance(lines, el, inner, 'field') + # Companions emit_companion_panel(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner, el.get('contextMenu')) emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner, el.get('extendedTooltip')) @@ -3363,6 +3378,9 @@ def emit_calendar(lines, el, name, eid, indent): if el.get('showMonthsPanel') is not None: lines.append(f'{inner}<ShowMonthsPanel>{"true" if el["showMonthsPanel"] else "false"}</ShowMonthsPanel>') + # Оформление (цвета/шрифты/граница) — перед компаньонами + emit_appearance(lines, el, inner, 'field') + # Companions emit_companion_panel(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner, el.get('contextMenu')) emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner, el.get('extendedTooltip')) diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index b0d7973e..d19a7f84 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -197,7 +197,7 @@ companion-панели с собственным контентом. Оба не ### 4.1e. Оформление элемента (цвета / шрифты / граница) -Прямые свойства оформления элемента. Ключи — англ. camelCase 1:1 с тегами; **принимаются рус. синонимы** (forgiving). Применимо к полям (input/check/radio/labelField), декорациям (label) и кнопкам (button); порядок тегов в XML — по базовому типу (профиль), компилятор расставляет сам. +Прямые свойства оформления элемента. Ключи — англ. camelCase 1:1 с тегами; **принимаются рус. синонимы** (forgiving). Применимо к полям (input/check/radio/labelField/picField/calendar), декорациям (label), кнопкам (button), группам (group/columnGroup) и таблицам (table); порядок тегов в XML — по базовому типу (профиль), компилятор расставляет сам. (PictureDecoration пока не поддержан — у него XSD расщепляет оформление вокруг `<Title>`.) | Ключ | Тег | Рус. синоним | |------|-----|--------------| diff --git a/tests/skills/cases/form-compile/dynamic-list-parameters.json b/tests/skills/cases/form-compile/dynamic-list-parameters.json index 8db393a7..538f5b5e 100644 --- a/tests/skills/cases/form-compile/dynamic-list-parameters.json +++ b/tests/skills/cases/form-compile/dynamic-list-parameters.json @@ -38,9 +38,9 @@ } } ], "elements": [ - { "table": "Список", "path": "Список", "columns": [ + { "table": "Список", "path": "Список", "backColor": "web:Honeydew", "borderColor": "style:BorderColor", "columns": [ { "input": "Код", "path": "Список.Код" }, - { "input": "Наименование", "path": "Список.Наименование" } + { "input": "Наименование", "path": "Список.Наименование", "titleTextColor": "web:FireBrick", "border": { "width": 1, "style": "Single" } } ]} ] } diff --git a/tests/skills/cases/form-compile/element-appearance.json b/tests/skills/cases/form-compile/element-appearance.json index 8808bdd4..5dcace61 100644 --- a/tests/skills/cases/form-compile/element-appearance.json +++ b/tests/skills/cases/form-compile/element-appearance.json @@ -1,5 +1,5 @@ { - "name": "Оформление элементов — цвета/шрифты/граница на decoration/input/button (профили порядка)", + "name": "Оформление элементов — цвета/шрифты/граница на decoration/input/button/group (профили порядка)", "preRun": [ { "script": "meta-compile/scripts/meta-compile", @@ -33,7 +33,10 @@ { "button": "ОК", "title": "ОК", "backColor": "web:Honeydew", "borderColor": "style:BorderColor", - "font": "style:NormalTextFont" } + "font": "style:NormalTextFont" }, + { "group": "ГруппаОформление", "backColor": "web:Honeydew", "children": [ + { "input": "Цена2", "path": "Объект.Цена", "textColor": "web:DimGray" } + ]} ] } } diff --git a/tests/skills/cases/form-compile/snapshots/dynamic-list-parameters/Catalogs/Товары/Forms/ФормаСписка/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/dynamic-list-parameters/Catalogs/Товары/Forms/ФормаСписка/Ext/Form.xml index f8f9f3f4..dc375f64 100644 --- a/tests/skills/cases/form-compile/snapshots/dynamic-list-parameters/Catalogs/Товары/Forms/ФормаСписка/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/dynamic-list-parameters/Catalogs/Товары/Forms/ФормаСписка/Ext/Form.xml @@ -27,6 +27,8 @@ <AllowRootChoice>false</AllowRootChoice> <UpdateOnDataChange>Auto</UpdateOnDataChange> <AllowGettingCurrentRowURL>true</AllowGettingCurrentRowURL> + <BackColor>web:Honeydew</BackColor> + <BorderColor>style:BorderColor</BorderColor> <ContextMenu name="СписокКонтекстноеМеню" id="2"/> <AutoCommandBar name="СписокКоманднаяПанель" id="3"> <Autofill>false</Autofill> @@ -64,6 +66,10 @@ </InputField> <InputField name="Наименование" id="17"> <DataPath>Список.Наименование</DataPath> + <TitleTextColor>web:FireBrick</TitleTextColor> + <Border width="1"> + <v8ui:style xsi:type="v8ui:ControlBorderType">Single</v8ui:style> + </Border> <ContextMenu name="НаименованиеКонтекстноеМеню" id="18"/> <ExtendedTooltip name="НаименованиеРасширеннаяПодсказка" id="19"/> </InputField> diff --git a/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml index ea05bd7e..6e7d0b98 100644 --- a/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/element-appearance/Catalogs/Товары/Forms/ФормаЭлемента/Ext/Form.xml @@ -56,9 +56,21 @@ <Font ref="style:NormalTextFont" kind="StyleItem"/> <ExtendedTooltip name="ОКРасширеннаяПодсказка" id="11"/> </Button> + <UsualGroup name="ГруппаОформление" id="12"> + <BackColor>web:Honeydew</BackColor> + <ExtendedTooltip name="ГруппаОформлениеРасширеннаяПодсказка" id="13"/> + <ChildItems> + <InputField name="Цена2" id="14"> + <DataPath>Объект.Цена</DataPath> + <TextColor>web:DimGray</TextColor> + <ContextMenu name="Цена2КонтекстноеМеню" id="15"/> + <ExtendedTooltip name="Цена2РасширеннаяПодсказка" id="16"/> + </InputField> + </ChildItems> + </UsualGroup> </ChildItems> <Attributes> - <Attribute name="Объект" id="12"> + <Attribute name="Объект" id="17"> <Type> <v8:Type>cfg:CatalogObject.Товары</v8:Type> </Type>