feat(form-compile): группировка колонок таблицы (ColumnGroup)

Новый DSL-ключ columnGroup со значением-ориентацией horizontal/vertical/inCell
для элемента <ColumnGroup> внутри columns таблицы. Поддерживает вложение,
showTitle/showInHeader/width, тихие синонимы ColumnGroup и ГруппаКолонок.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-05-04 11:48:35 +03:00
parent f3466e19fd
commit 4f9d9aee97
5 changed files with 192 additions and 7 deletions
+30
View File
@@ -62,6 +62,7 @@ powershell.exe -NoProfile -File .claude/skills/form-compile/scripts/form-compile
| DSL ключ | XML элемент | Значение ключа |
|--------------|-------------------|---------------------------------------------------|
| `"group"` | UsualGroup | `"horizontal"` / `"vertical"` / `"alwaysHorizontal"` / `"alwaysVertical"` / `"collapsible"` |
| `"columnGroup"` | ColumnGroup | `"horizontal"` / `"vertical"` / `"inCell"` — только внутри `columns` таблицы |
| `"input"` | InputField | имя элемента |
| `"check"` | CheckBoxField | имя |
| `"radio"` | RadioButtonField | имя |
@@ -210,6 +211,35 @@ powershell.exe -NoProfile -File .claude/skills/form-compile/scripts/form-compile
| `rowPictureDataPath` | Путь к картинке строки (напр. `"Список.DefaultPicture"`) |
| `tableAutofill: false` | Управление Autofill внутреннего AutoCommandBar |
Колонки можно группировать через `columnGroup` (см. ниже).
### Группа колонок (columnGroup)
Используется только внутри `columns` таблицы. Значение ключа задаёт ориентацию: `"horizontal"`, `"vertical"`, `"inCell"` (склеивает колонки в одну ячейку шапки). Допускается вложение `columnGroup` в `columnGroup`.
| Ключ | Описание |
|------|----------|
| `name` | Имя элемента (рекомендуется задавать явно) |
| `title` | Заголовок группы |
| `showTitle: false` | Скрыть заголовок |
| `showInHeader: true/false` | Показывать ли группу в шапке таблицы |
| `width` | Ширина |
| `horizontalStretch: false` | Растягивание |
| `children: [...]` | Колонки внутри группы (`input`, `labelField`, `picField`, вложенный `columnGroup` …) |
```json
{ "table": "Список", "path": "Список", "columns": [
{ "columnGroup": "horizontal", "name": "ГруппаДата", "title": "Срок", "children": [
{ "input": "СрокИсполнения", "path": "Список.СрокИсполнения" },
{ "labelField": "Просрочено", "path": "Список.Просрочено" }
]},
{ "columnGroup": "inCell", "name": "ГруппаИсполнитель", "showInHeader": true, "children": [
{ "input": "Исполнитель", "path": "Список.Исполнитель" }
]},
{ "input": "Комментарий", "path": "Список.Комментарий" }
]}
```
### Страницы (pages + page)
| Ключ (pages) | Описание |
@@ -1,4 +1,4 @@
# form-compile v1.19 — Compile 1C managed form from JSON or object metadata
# form-compile v1.20 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -1853,6 +1853,8 @@ function Emit-Element {
"UsualGroup" = "group"
"Группа" = "group"
"ОбычнаяГруппа" = "group"
"ColumnGroup" = "columnGroup"
"ГруппаКолонок" = "columnGroup"
"Pages" = "pages"
"ГруппаСтраниц" = "pages"
"Page" = "page"
@@ -1876,7 +1878,7 @@ function Emit-Element {
$typeKey = $null
$xmlTag = $null
foreach ($key in @("group","input","check","radio","label","labelField","table","pages","page","button","picture","picField","calendar","cmdBar","popup")) {
foreach ($key in @("columnGroup","group","input","check","radio","label","labelField","table","pages","page","button","picture","picField","calendar","cmdBar","popup")) {
if ($el.$key -ne $null) {
$typeKey = $key
break
@@ -1891,8 +1893,10 @@ function Emit-Element {
# Validate known keys — warn about typos and unknown properties
$knownKeys = @{
# type keys
"group"=1;"input"=1;"check"=1;"radio"=1;"label"=1;"labelField"=1;"table"=1;"pages"=1;"page"=1
"group"=1;"columnGroup"=1;"input"=1;"check"=1;"radio"=1;"label"=1;"labelField"=1;"table"=1;"pages"=1;"page"=1
"button"=1;"picture"=1;"picField"=1;"calendar"=1;"cmdBar"=1;"popup"=1
# columnGroup-specific
"showInHeader"=1
# radio-specific
"radioButtonType"=1;"choiceList"=1;"columnsCount"=1
# naming & binding
@@ -1939,6 +1943,7 @@ function Emit-Element {
switch ($typeKey) {
"group" { Emit-Group -el $el -name $name -id $id -indent $indent }
"columnGroup" { Emit-ColumnGroup -el $el -name $name -id $id -indent $indent }
"input" { Emit-Input -el $el -name $name -id $id -indent $indent }
"check" { Emit-Check -el $el -name $name -id $id -indent $indent }
"radio" { Emit-Radio -el $el -name $name -id $id -indent $indent }
@@ -2060,6 +2065,48 @@ function Emit-Group {
X "$indent</UsualGroup>"
}
function Emit-ColumnGroup {
param($el, [string]$name, [int]$id, [string]$indent)
X "$indent<ColumnGroup name=`"$name`" id=`"$id`">"
$inner = "$indent`t"
Emit-Title -el $el -name $name -indent $inner
# Group orientation (horizontal / vertical / inCell — последнее только здесь)
$groupVal = "$($el.columnGroup)"
$orientation = switch ($groupVal) {
"horizontal" { "Horizontal" }
"vertical" { "Vertical" }
"inCell" { "InCell" }
default { $null }
}
if ($orientation) { X "$inner<Group>$orientation</Group>" }
if ($el.showTitle -eq $false) { X "$inner<ShowTitle>false</ShowTitle>" }
if ($null -ne $el.showInHeader) {
$shVal = if ($el.showInHeader) { "true" } else { "false" }
X "$inner<ShowInHeader>$shVal</ShowInHeader>"
}
if ($el.width) { X "$inner<Width>$($el.width)</Width>" }
Emit-CommonFlags -el $el -indent $inner
# Companion: ExtendedTooltip
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
# Children
if ($el.children -and $el.children.Count -gt 0) {
X "$inner<ChildItems>"
foreach ($child in $el.children) {
Emit-Element -el $child -indent "$inner`t"
}
X "$inner</ChildItems>"
}
X "$indent</ColumnGroup>"
}
function Emit-Input {
param($el, [string]$name, [int]$id, [string]$indent)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.19 — Compile 1C managed form from JSON or object metadata
# form-compile v1.20 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -1338,8 +1338,9 @@ KNOWN_FORM_EVENTS = [
]
KNOWN_KEYS = {
"group", "input", "check", "radio", "label", "labelField", "table", "pages", "page",
"group", "columnGroup", "input", "check", "radio", "label", "labelField", "table", "pages", "page",
"button", "picture", "picField", "calendar", "cmdBar", "popup",
"showInHeader",
"radioButtonType", "choiceList", "columnsCount",
"name", "path", "title",
"visible", "hidden", "enabled", "disabled", "readOnly", "userVisible",
@@ -1362,7 +1363,7 @@ KNOWN_KEYS = {
"rowPictureDataPath", "tableAutofill",
}
TYPE_KEYS = ["group", "input", "check", "radio", "label", "labelField", "table", "pages", "page",
TYPE_KEYS = ["columnGroup", "group", "input", "check", "radio", "label", "labelField", "table", "pages", "page",
"button", "picture", "picField", "calendar", "cmdBar", "popup"]
# Synonyms: model often writes XML name or Russian (ПолеПереключателя/RadioButtonField → radio)
@@ -1390,6 +1391,8 @@ ELEMENT_TYPE_SYNONYMS = {
"UsualGroup": "group",
"Группа": "group",
"ОбычнаяГруппа": "group",
"ColumnGroup": "columnGroup",
"ГруппаКолонок": "columnGroup",
"Pages": "pages",
"ГруппаСтраниц": "pages",
"Page": "page",
@@ -1787,6 +1790,7 @@ def emit_element(lines, el, indent, in_cmd_bar=False):
emitters = {
'group': emit_group,
'columnGroup': emit_column_group,
'input': emit_input,
'check': emit_check,
'radio': emit_radio_button_field,
@@ -1870,6 +1874,43 @@ def emit_group(lines, el, name, eid, indent):
lines.append(f'{indent}</UsualGroup>')
def emit_column_group(lines, el, name, eid, indent):
lines.append(f'{indent}<ColumnGroup name="{name}" id="{eid}">')
inner = f'{indent}\t'
emit_title(lines, el, name, inner)
group_val = str(el.get('columnGroup', ''))
orientation_map = {
'horizontal': 'Horizontal',
'vertical': 'Vertical',
'inCell': 'InCell',
}
orientation = orientation_map.get(group_val)
if orientation:
lines.append(f'{inner}<Group>{orientation}</Group>')
if el.get('showTitle') is False:
lines.append(f'{inner}<ShowTitle>false</ShowTitle>')
if el.get('showInHeader') is not None:
sh_val = 'true' if el['showInHeader'] else 'false'
lines.append(f'{inner}<ShowInHeader>{sh_val}</ShowInHeader>')
if el.get('width'):
lines.append(f'{inner}<Width>{el["width"]}</Width>')
emit_common_flags(lines, el, inner)
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner)
if el.get('children') and len(el['children']) > 0:
lines.append(f'{inner}<ChildItems>')
for child in el['children']:
emit_element(lines, child, f'{inner}\t')
lines.append(f'{inner}</ChildItems>')
lines.append(f'{indent}</ColumnGroup>')
def emit_input(lines, el, name, eid, indent):
lines.append(f'{indent}<InputField name="{name}" id="{eid}">')
inner = f'{indent}\t'
+28 -1
View File
@@ -268,7 +268,7 @@
| Свойство | Тип | Описание |
|----------|-----|----------|
| `path` | string | DataPath |
| `columns` | array | Колонки (элементы input/check/labelField/picField) |
| `columns` | array | Колонки (элементы input/check/labelField/picField, либо `columnGroup` для группировки) |
| `representation` | string | `List`, `Tree`, `HierarchicalList` |
| `changeRowSet` | bool | Разрешить добавление/удаление строк |
| `changeRowOrder` | bool | Разрешить перемещение строк |
@@ -278,6 +278,33 @@
| `commandBarLocation` | string | `None`, `Top`, `Bottom`, `Auto` |
| `searchStringLocation` | string | `None`, `Top`, `Bottom`, `CommandBar`, `Auto` |
#### columnGroup — ColumnGroup
Группа колонок таблицы. Используется только внутри `columns` таблицы. Допускается вложение `columnGroup` в `columnGroup`.
```json
{ "table": "Список", "path": "Список", "columns": [
{ "columnGroup": "horizontal", "name": "ГруппаДата", "title": "Срок", "children": [
{ "input": "ДатаНачала", "path": "Список.ДатаНачала" },
{ "input": "ДатаОкончания", "path": "Список.ДатаОкончания" }
]},
{ "columnGroup": "inCell", "name": "ГруппаИсполнитель", "showInHeader": true, "children": [
{ "input": "Исполнитель", "path": "Список.Исполнитель" }
]}
]}
```
| Свойство | Тип | Описание |
|----------|-----|----------|
| `columnGroup` | string | Ориентация: `horizontal`, `vertical`, `inCell` (склейка колонок в одной ячейке шапки) |
| `name` | string | Имя элемента (рекомендуется задавать явно) |
| `title` | string/object | Заголовок группы |
| `showTitle` | bool | Показывать заголовок |
| `showInHeader` | bool | Показывать в шапке таблицы |
| `width` | int | Ширина |
| `horizontalStretch` | bool | Растягивание |
| `children` | array | Колонки внутри группы |
#### pages / page — Pages / Page
```json
@@ -0,0 +1,40 @@
{
"name": "Форма с группировкой колонок таблицы",
"preRun": [
{
"script": "meta-compile/scripts/meta-compile",
"input": { "type": "DataProcessor", "name": "Задачи" },
"args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" }
},
{
"script": "form-add/scripts/form-add",
"args": { "-ObjectPath": "{workDir}/DataProcessors/Задачи.xml", "-FormName": "Форма" }
}
],
"params": { "outputPath": "DataProcessors/Задачи/Forms/Форма/Ext/Form.xml" },
"validatePath": "DataProcessors/Задачи/Forms/Форма/Ext/Form.xml",
"input": {
"title": "Список задач",
"elements": [
{ "table": "Список", "path": "Список", "columns": [
{ "input": "Наименование", "path": "Список.Наименование" },
{ "columnGroup": "horizontal", "name": "ГруппаСрок", "title": "Срок", "children": [
{ "input": "ДатаНачала", "path": "Список.ДатаНачала" },
{ "input": "ДатаОкончания", "path": "Список.ДатаОкончания" }
]},
{ "columnGroup": "inCell", "name": "ГруппаИсполнитель", "showInHeader": true, "children": [
{ "input": "Исполнитель", "path": "Список.Исполнитель" }
]}
]}
],
"attributes": [
{ "name": "Объект", "type": "DataProcessorObject.Задачи", "main": true },
{ "name": "Список", "type": "ValueTable", "columns": [
{ "name": "Наименование", "type": "string(150)" },
{ "name": "ДатаНачала", "type": "date" },
{ "name": "ДатаОкончания", "type": "date" },
{ "name": "Исполнитель", "type": "string(100)" }
]}
]
}
}