SuperAPI AI Directory

form-compile

Coding & development

View repository

Updated 10-15 18:46

About this skill

/form-compile — Generating Form.xml from JSON DSL

Takes a compact JSON definition of a form (20–50 lines) and generates a complete, correct Form.xml (100–500+ lines) with namespace declarations, auto-generated companion elements, and sequential IDs.

When designing a form from scratch (5+ elements or vague requirements) — call /form-patterns to load the reference: archetypes, naming conventions, advanced patterns. For simple forms (1–3 fields, the user has described what is needed) — not necessary.

Usage

/form-compile <JsonPath> <OutputPath>

Parameters

Parameter Required Description
JsonPath yes Path to the JSON definition of the form
OutputPath yes Path to the output Form.xml file

Command

powershell.exe -NoProfile -File .claude/skills/form-compile/scripts/form-compile.ps1 -JsonPath "<json>" -OutputPath "<xml>"

JSON DSL — reference

Top-level structure

{
  "title": "Заголовок формы",
  "properties": { "autoTitle": false, ... },
  "events": { "OnCreateAtServer": "ПриСозданииНаСервере" },
  "excludedCommands": ["Reread"],
  "elements": [ ... ],
  "attributes": [ ... ],
  "commands": [ ... ],
  "parameters": [ ... ]
}
  • title — form title (multilingual). It can also be specified in properties, but it is better at the top level
  • properties — form properties: autoTitle, windowOpeningMode, commandBarLocation, saveDataInSettings, width, height and others
  • events — form event handlers (key: 1C event name, value: procedure name)
  • excludedCommands — excluded standard commands

Elements (the key determines the type)

DSL key XML element Key value
"group" UsualGroup "horizontal" / "vertical" / "alwaysHorizontal" / "alwaysVertical" / "collapsible"
"input" InputField element name
"check" CheckBoxField name
"label" LabelDecoration name (the text is specified via title)
"labelField" LabelField name
"table" Table name
"pages" Pages name
"page" Page name
"button" Button name
"picture" PictureDecoration name
"picField" PictureField name
"calendar" CalendarField name
"cmdBar" CommandBar name
"popup" Popup name

Common properties (all element types)

Key Description
name Override the name (by default = the value of the type key)
title Element title
visible: false Hide (synonym: hidden: true)
enabled: false Make unavailable (synonym: disabled: true)
readOnly: true Read-only
on: [...] Events with auto-naming of handlers
handlers: {...} Explicit handler names: {"OnChange": "МоёИмя"}

Valid event names (on)

The compiler warns about unknown events. Names are case-sensitive — use them exactly as specified.

Form (events): OnCreateAtServer, OnOpen, BeforeClose, OnClose, NotificationProcessing, ChoiceProcessing, OnReadAtServer, BeforeWriteAtServer, OnWriteAtServer, AfterWriteAtServer, BeforeWrite, AfterWrite, FillCheckProcessingAtServer, BeforeLoadDataFromSettingsAtServer, OnLoadDataFromSettingsAtServer, ExternalEvent, Opening

input / picField: OnChange, StartChoice, ChoiceProcessing, AutoComplete, TextEditEnd, Clearing, Creating, EditTextChange

check: OnChange

table: OnStartEdit, OnEditEnd, OnChange, Selection, ValueChoice, BeforeAddRow, BeforeDeleteRow, AfterDeleteRow, BeforeRowChange, BeforeEditEnd, OnActivateRow, OnActivateCell, Drag, DragStart, DragCheck, DragEnd

label / picture: Click, URLProcessing

labelField: OnChange, StartChoice, ChoiceProcessing, Click, URLProcessing, Clearing

button: Click

pages: OnCurrentPageChange

Input field (input)

Key Description Example
path DataPath — binding to data "Объект.Организация"
titleLocation Title placement "none", "left", "top"
multiLine: true Multiline field text field, comment
passwordMode: true Password mode (asterisks) password input field
choiceButton: true Selection button ("...") reference field
clearButton: true Clear button ("X")
spinButton: true Spin button numeric fields
dropListButton: true Drop-down list button
markIncomplete: true Mark as unfilled required fields
skipOnInput: true Skip when tabbing
inputHint Placeholder in empty field "Введите наименование..."
width / height Size numbers
autoMaxWidth: false Disable auto-width for fixed fields
horizontalStretch: true Stretch to width

Checkbox (check)

Key Description
path DataPath
titleLocation Title placement

Decoration label (label)

Key Description
title Label text (required)
hyperlink: true Make it a link
width / height Size

Group (group)

The key value sets the orientation: "horizontal", "vertical", "alwaysHorizontal", "alwaysVertical", "collapsible".

Key Description
showTitle: true Show group title
united: false Do not merge the frame
representation "none", "normal", "weak", "strong"
children: [...] Nested elements

Table (table)

Important: the table requires a linked form attribute of type ValueTable with columns (see the "Bindings" section).

Key Description
path DataPath (binding to a table attribute)
columns: [...] Columns — an array of elements (usually input)
changeRowSet: true Allow adding/removing rows
changeRowOrder: true Allow moving rows
height Height in table rows
header: false Hide header
footer: true Show footer
commandBarLocation "None", "Top", "Auto"
searchStringLocation "None", "Top", "Auto"

Pages (pages + page)

Key (pages) Description
pagesRepresentation "None", "TabsOnTop", "TabsOnBottom" etc.
children: [...] Array page
Key (page) Description
title Tab title
group Orientation within the page
children: [...] Page content

Button (button)

Key Description
command Form command name → Form.Command.Имя
stdCommand Standard command: "Close" → Form.StandardCommand.Close; with a dot: "Товары.Add" → Form.Item.Товары.StandardCommand.Add
defaultButton: true Default button
type "usual", "hyperlink", "commandBar"
picture Button image
representation "Auto", "Text", "Picture", "PictureAndText"
locationInCommandBar "Auto", "InCommandBar", "InAdditionalSubmenu"

Command bar (cmdBar)

Key Description
autofill: true Autofill with standard commands
children: [...] Bar buttons

Drop-down menu (popup)

Key Description
title Submenu title
children: [...] Submenu buttons

Used inside cmdBar to group buttons into a submenu:

{ "cmdBar": "Панель", "children": [
  { "popup": "Добавить", "title": "Добавить", "children": [
    { "button": "ДобавитьСтроку", "stdCommand": "Товары.Add" },
    { "button": "ДобавитьИзДокумента", "command": "ДобавитьИзДокумента", "title": "Из документа" }
  ]}
]}

Attributes (attributes)

{ "name": "Объект", "type": "DataProcessorObject.Загрузка", "main": true }
{ "name": "Итого", "type": "decimal(15,2)" }
{ "name": "Таблица", "type": "ValueTable", "columns": [
    { "name": "Номенклатура", "type": "CatalogRef.Номенклатура" },
    { "name": "Количество", "type": "decimal(10,3)" }
]}
  • savedData: true — stored data

Commands (commands)

{ "name": "Загрузить", "action": "ЗагрузитьОбработка", "shortcut": "Ctrl+Enter" }
  • title — title (if different from name)
  • picture — command image

Type system

DSL XML
"string" / "string(100)" xs:string + StringQualifiers
"decimal(15,2)" xs:decimal + NumberQualifiers
"decimal(10,0,nonneg)" с AllowedSign=Nonnegative
"boolean" xs:boolean
"date" / "dateTime" / "time" xs:dateTime + DateFractions
"CatalogRef.XXX" cfg:CatalogRef.XXX
"DocumentRef.XXX" cfg:DocumentRef.XXX
"ValueTable" v8:ValueTable
"ValueList" v8:ValueListType
"Type1 | Type2" composite type

Bindings: element + attribute

A table and some fields require a linked attribute. The element references the attribute via path.

Table — element table + attribute ValueTable:

{
  "elements": [
    { "table": "Товары", "path": "Объект.Товары", "columns": [
      { "input": "Номенклатура", "path": "Объект.Товары.Номенклатура" }
    ]}
  ],
  "attributes": [
    { "name": "Объект", "type": "DataProcessorObject.Загрузка", "main": true,
      "columns": [
        { "name": "Товары", "type": "ValueTable", "columns": [
          { "name": "Номенклатура", "type": "CatalogRef.Номенклатура" }
        ]}
      ]
    }
  ]
}

Or, if the table is bound to a form attribute (not to Object):

{
  "elements": [
    { "table": "ТаблицаДанных", "path": "ТаблицаДанных", "columns": [
      { "input": "Наименование", "path": "ТаблицаДанных.Наименование" }
    ]}
  ],
  "attributes": [
    { "name": "ТаблицаДанных", "type": "ValueTable", "columns": [
      { "name": "Наименование", "type": "string(150)" }
    ]}
  ]
}

Patterns

File upload dialog

{
  "title": "Загрузка из файла",
  "properties": { "autoTitle": false },
  "events": { "OnCreateAtServer": "ПриСозданииНаСервере" },
  "elements": [
    { "group": "horizontal", "name": "ГруппаФайл", "children": [
      { "input": "ИмяФайла", "path": "ИмяФайла", "title": "Файл", "inputHint": "Выберите файл...", "choiceButton": true, "on": ["StartChoice"] },
      { "check": "ПерваяСтрокаЗаголовок", "path": "ПерваяСтрокаЗаголовок" }
    ]},
    { "input": "Результат", "path": "Результат", "multiLine": true, "height": 8, "readOnly": true, "title": "Лог" },
    { "group": "horizontal", "name": "ГруппаКнопок", "children": [
      { "button": "Загрузить", "command": "Загрузить", "defaultButton": true },
      { "button": "Закрыть", "stdCommand": "Close" }
    ]}
  ],
  "attributes": [
    { "name": "Объект", "type": "ExternalDataProcessorObject.ЗагрузкаИзФайла", "main": true },
    { "name": "ИмяФайла", "type": "string" },
    { "name": "ПерваяСтрокаЗаголовок", "type": "boolean" },
    { "name": "Результат", "type": "string" }
  ],
  "commands": [
    { "name": "Загрузить", "action": "ЗагрузитьОбработка", "shortcut": "Ctrl+Enter" }
  ]
}

Wizard with steps

{
  "title": "Мастер настройки",
  "properties": { "autoTitle": false },
  "elements": [
    { "pages": "СтраницыМастера", "pagesRepresentation": "None", "children": [
      { "page": "Шаг1", "title": "Параметры", "children": [
        { "input": "Параметр1", "path": "Параметр1" }
      ]},
      { "page": "Шаг2", "title": "Результат", "children": [
        { "input": "Итог", "path": "Итог", "readOnly": true }
      ]}
    ]},
    { "group": "horizontal", "name": "Навигация", "children": [
      { "button": "Назад", "command": "Назад", "title": "< Назад" },
      { "button": "Далее", "command": "Далее", "title": "Далее >" }
    ]}
  ],
  "attributes": [
    { "name": "Объект", "type": "ExternalDataProcessorObject.Мастер", "main": true },
    { "name": "Параметр1", "type": "string" },
    { "name": "Итог", "type": "string" }
  ],
  "commands": [
    { "name": "Назад", "action": "НазадОбработка" },
    { "name": "Далее", "action": "ДалееОбработка" }
  ]
}

List with filter and table

{
  "title": "Просмотр данных",
  "elements": [
    { "group": "horizontal", "name": "Фильтр", "children": [
      { "input": "Период", "path": "Период", "on": ["OnChange"] },
      { "input": "Организация", "path": "Организация", "on": ["OnChange"] }
    ]},
    { "table": "Данные", "path": "Данные", "changeRowSet": true, "columns": [
      { "input": "Дата", "path": "Данные.Дата" },
      { "input": "Сумма", "path": "Данные.Сумма" },
      { "input": "Комментарий", "path": "Данные.Комментарий" }
    ]}
  ],
  "attributes": [
    { "name": "Объект", "type": "ExternalDataProcessorObject.Просмотр", "main": true },
    { "name": "Период", "type": "date" },
    { "name": "Организация", "type": "string" },
    { "name": "Данные", "type": "ValueTable", "columns": [
      { "name": "Дата", "type": "date" },
      { "name": "Сумма", "type": "decimal(15,2)" },
      { "name": "Комментарий", "type": "string(200)" }
    ]}
  ]
}

Autogeneration

  • Companion elements: ContextMenu, ExtendedTooltip, etc. are created automatically
  • Event handlers: "on": ["OnChange"] → ОрганизацияПриИзменении
  • Namespace: all 17 namespace declarations
  • ID: sequential numbering, AutoCommandBar = id="-1"
  • Unknown keys: a warning is displayed about unrecognized keys

Verification

/form-validate <OutputPath>    — проверка корректности XML
/form-info <OutputPath>        — визуальная сводка структуры

Specifics for external data processors (EPF)

  • Main attribute type: ExternalDataProcessorObject.ИмяОбработки (not DataProcessorObject)
  • DataPath: use form attributes (ИмяРеквизита), not Объект.ИмяРеквизита — external data processors do not have object attributes in the metadata
  • Reference types: CatalogRef.XXX, DocumentRef.XXX are allowed in XML, but building an EPF will require a database with the target configuration (see /epf-build)