mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-11 16:34:57 +03:00
docs(skd-compile): описать presentationExpression и appearance на поле
В DSL skd-compile уже поддерживались ключи presentationExpression и
appearance в объектной форме поля DataSet, но в SKILL.md они не были
задокументированы — фичи существовали де-факто, но обнаружить их можно
было только чтением скрипта.
Заодно зафиксирован детерминизм порядка ключей appearance: PS5.1
hashtable не сохраняет порядок вставки, из-за чего PS- и PY-рантаймы
давали разный XML на одном входе. Заменено на [ordered]@{}.
- SKILL.md: новый блок «Дополнительные ключи объектной формы» в разделе «Поля»
- skd-compile.ps1/py: appearance = [ordered]@{} вместо @{}, версия v1.19
- tests: новый snapshot-кейс field-appearance-and-presentation,
проходит на обоих рантаймах
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -96,6 +96,15 @@ powershell.exe -NoProfile -File .claude/skills/skd-compile/scripts/skd-compile.p
|
||||
|
||||
В объектной форме: `"useRestriction": { "field": true, "condition": true, "group": true, "order": true }` или `"restrict": ["noField", "noFilter"]`.
|
||||
|
||||
Дополнительные ключи объектной формы:
|
||||
- `"presentationExpression": "<выражение>"` — что показывать вместо значения поля. Исходное значение остаётся «под капотом» для перехода/расшифровки.
|
||||
- `"appearance": { "<параметр>": "<значение>" }` — оформление колонки по умолчанию (применяется во всех вариантах настроек). Ключи — параметры платформы (`ГоризонтальноеПоложение`, `МинимальнаяШирина`, `Формат`, `Текст` и т.п.).
|
||||
|
||||
```json
|
||||
{ "field": "Сумма", "title": "Сумма продажи", "type": "decimal(15,2)",
|
||||
"appearance": { "ГоризонтальноеПоложение": "Right", "МинимальнаяШирина": "80" } }
|
||||
```
|
||||
|
||||
### Вычисляемые поля (calculatedFields)
|
||||
|
||||
Shorthand: `"Имя [Заголовок]: тип = Выражение #noField #noFilter #noGroup #noOrder"` — все части кроме имени опциональны.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.18 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.19 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -259,7 +259,7 @@ function Parse-FieldShorthand {
|
||||
|
||||
$result = @{
|
||||
dataPath = ""; field = ""; title = ""; type = ""
|
||||
roles = @(); restrict = @(); appearance = @{}
|
||||
roles = @(); restrict = @(); appearance = [ordered]@{}
|
||||
}
|
||||
|
||||
# Extract @roles
|
||||
@@ -600,7 +600,7 @@ function Emit-Field {
|
||||
type = if ($fieldDef.type) { Resolve-TypeStr "$($fieldDef.type)" } else { "" }
|
||||
roles = @()
|
||||
restrict = @()
|
||||
appearance = @{}
|
||||
appearance = [ordered]@{}
|
||||
}
|
||||
# Parse role
|
||||
if ($fieldDef.role) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.18 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.19 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "appearance и presentationExpression на поле DataSet",
|
||||
"params": { "outputPath": "Template.xml" },
|
||||
"input": {
|
||||
"dataSets": [{
|
||||
"name": "ЖурналОшибок",
|
||||
"objectName": "ЖурналОшибок",
|
||||
"fields": [
|
||||
{
|
||||
"field": "ТекстСообщения",
|
||||
"title": "Текст сообщения",
|
||||
"type": "string(150)",
|
||||
"appearance": {
|
||||
"МинимальнаяШирина": "100",
|
||||
"РастягиватьПоГоризонтали": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"field": "Расшифровка",
|
||||
"title": "Описание",
|
||||
"type": "CatalogRef.Организации",
|
||||
"presentationExpression": "ТекстСообщения",
|
||||
"appearance": {
|
||||
"ГоризонтальноеПоложение": "Right"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
"validatePath": "Template.xml",
|
||||
"expect": {
|
||||
"files": ["Template.xml"]
|
||||
}
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<DataCompositionSchema xmlns="http://v8.1c.ru/8.1/data-composition-system/schema"
|
||||
xmlns:dcscom="http://v8.1c.ru/8.1/data-composition-system/common"
|
||||
xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core"
|
||||
xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:v8ui="http://v8.1c.ru/8.1/data/ui"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<dataSource>
|
||||
<name>ИсточникДанных1</name>
|
||||
<dataSourceType>Local</dataSourceType>
|
||||
</dataSource>
|
||||
<dataSet xsi:type="DataSetObject">
|
||||
<name>ЖурналОшибок</name>
|
||||
<field xsi:type="DataSetFieldField">
|
||||
<dataPath>ТекстСообщения</dataPath>
|
||||
<field>ТекстСообщения</field>
|
||||
<title xsi:type="v8:LocalStringType">
|
||||
<v8:item>
|
||||
<v8:lang>ru</v8:lang>
|
||||
<v8:content>Текст сообщения</v8:content>
|
||||
</v8:item>
|
||||
</title>
|
||||
<valueType>
|
||||
<v8:Type>xs:string</v8:Type>
|
||||
<v8:StringQualifiers>
|
||||
<v8:Length>150</v8:Length>
|
||||
<v8:AllowedLength>Variable</v8:AllowedLength>
|
||||
</v8:StringQualifiers>
|
||||
</valueType>
|
||||
<appearance>
|
||||
<dcscor:item xsi:type="dcsset:SettingsParameterValue">
|
||||
<dcscor:parameter>МинимальнаяШирина</dcscor:parameter>
|
||||
<dcscor:value xsi:type="xs:string">100</dcscor:value>
|
||||
</dcscor:item>
|
||||
<dcscor:item xsi:type="dcsset:SettingsParameterValue">
|
||||
<dcscor:parameter>РастягиватьПоГоризонтали</dcscor:parameter>
|
||||
<dcscor:value xsi:type="xs:string">true</dcscor:value>
|
||||
</dcscor:item>
|
||||
</appearance>
|
||||
</field>
|
||||
<field xsi:type="DataSetFieldField">
|
||||
<dataPath>Расшифровка</dataPath>
|
||||
<field>Расшифровка</field>
|
||||
<title xsi:type="v8:LocalStringType">
|
||||
<v8:item>
|
||||
<v8:lang>ru</v8:lang>
|
||||
<v8:content>Описание</v8:content>
|
||||
</v8:item>
|
||||
</title>
|
||||
<valueType>
|
||||
<v8:Type xmlns:d5p1="http://v8.1c.ru/8.1/data/enterprise/current-config">d5p1:CatalogRef.Организации</v8:Type>
|
||||
</valueType>
|
||||
<appearance>
|
||||
<dcscor:item xsi:type="dcsset:SettingsParameterValue">
|
||||
<dcscor:parameter>ГоризонтальноеПоложение</dcscor:parameter>
|
||||
<dcscor:value xsi:type="v8ui:HorizontalAlign">Right</dcscor:value>
|
||||
</dcscor:item>
|
||||
</appearance>
|
||||
<presentationExpression>ТекстСообщения</presentationExpression>
|
||||
</field>
|
||||
<dataSource>ИсточникДанных1</dataSource>
|
||||
<objectName>ЖурналОшибок</objectName>
|
||||
</dataSet>
|
||||
<settingsVariant>
|
||||
<dcsset:name>Основной</dcsset:name>
|
||||
<dcsset:presentation xsi:type="v8:LocalStringType">
|
||||
<v8:item>
|
||||
<v8:lang>ru</v8:lang>
|
||||
<v8:content>Основной</v8:content>
|
||||
</v8:item>
|
||||
</dcsset:presentation>
|
||||
<dcsset:settings xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows">
|
||||
<dcsset:selection>
|
||||
</dcsset:selection>
|
||||
<dcsset:item xsi:type="dcsset:StructureItemGroup">
|
||||
<dcsset:order>
|
||||
<dcsset:item xsi:type="dcsset:OrderItemAuto"/>
|
||||
</dcsset:order>
|
||||
<dcsset:selection>
|
||||
<dcsset:item xsi:type="dcsset:SelectedItemAuto"/>
|
||||
</dcsset:selection>
|
||||
</dcsset:item>
|
||||
</dcsset:settings>
|
||||
</settingsVariant>
|
||||
</DataCompositionSchema>
|
||||
Reference in New Issue
Block a user