mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-12 17:04:57 +03:00
feat(skd-edit): clear-conditionalAppearance + multiline patch-query (доки)
- Новая операция clear-conditionalAppearance в стиле clear-selection/ order/filter. Закрывает потребность "заменить набор правил оформления" через clear + re-add. - patch-query: многострочные подстроки уже работали (string.Replace корректно обрабатывает \n). Зафиксировано в SKILL.md. - add-total: shorthand-шаблон с тремя случаями (Func, Func(expr), identity-выражение) — после fix Bug 6 поведение нужно явно объяснить. - Косметика: убрана утечка XML-внутренностей в комментарии примера set-field-role @period. - Пример patch-query @once заменён на более типовой случай уникальной подстроки (КАК ВТ_СтароеИмя вместо ЛЕВОЕ СОЕДИНЕНИЕ). Регресс: 33/33 PS, 33/33 PY, 33/33 платформенный verify. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,9 +54,12 @@ Shorthand: `"Имя [Заголовок]: тип @роль #ограничени
|
|||||||
|
|
||||||
### add-total — добавить итог
|
### add-total — добавить итог
|
||||||
|
|
||||||
|
Shorthand: `"<dataPath>: <выражение>"`. Если выражение — известная аггрегатная функция без скобок (`Сумма`, `Количество`, `Минимум`, `Максимум`, `Среднее`), оно автоматически оборачивается в `Func(dataPath)`. Если функция со скобками или произвольное выражение — используется как есть.
|
||||||
|
|
||||||
```
|
```
|
||||||
"Цена: Среднее"
|
"Цена: Среднее" # → Среднее(Цена)
|
||||||
"Стоимость: Сумма(Кол * Цена)"
|
"Стоимость: Сумма(Кол * Цена)" # → как есть
|
||||||
|
"Проверка: Проверка" # identity: выражение = Проверка
|
||||||
```
|
```
|
||||||
|
|
||||||
### add-calculated-field — добавить вычисляемое поле
|
### add-calculated-field — добавить вычисляемое поле
|
||||||
@@ -257,11 +260,13 @@ Shorthand: `"старое => новое [@once]"`. По умолчанию за
|
|||||||
|
|
||||||
```
|
```
|
||||||
"СубконтоДт1) В => СубконтоКт1) В"
|
"СубконтоДт1) В => СубконтоКт1) В"
|
||||||
"ЛЕВОЕ СОЕДИНЕНИЕ => ВНУТРЕННЕЕ СОЕДИНЕНИЕ @once"
|
"КАК ВТ_СтароеИмя => КАК ВТ_НовоеИмя @once"
|
||||||
```
|
```
|
||||||
|
|
||||||
`@once` — упасть с ошибкой, если в запросе не **ровно одно** вхождение. Защищает от случайных замен в комментариях и однотипных идентификаторах.
|
`@once` — упасть с ошибкой, если в запросе не **ровно одно** вхождение. Защищает от случайных замен в комментариях и однотипных идентификаторах.
|
||||||
|
|
||||||
|
Многострочные подстроки поддерживаются — переводы строк в `старое`/`новое` сравниваются буквально (включая отступы).
|
||||||
|
|
||||||
### set-outputParameter — установить параметр вывода
|
### set-outputParameter — установить параметр вывода
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -311,7 +316,7 @@ Shorthand: `"<dataPath> [@флаги] [kv=значение]"`. **Полност
|
|||||||
"СуммаОстаток @balance" # простая балансовая роль
|
"СуммаОстаток @balance" # простая балансовая роль
|
||||||
"СуммаНач @balance balanceGroupName=Сумма balanceType=OpeningBalance" # с уточнением
|
"СуммаНач @balance balanceGroupName=Сумма balanceType=OpeningBalance" # с уточнением
|
||||||
"Контрагент @dimension parentDimension=Группа"
|
"Контрагент @dimension parentDimension=Группа"
|
||||||
"Период @period" # period → periodNumber=1 + periodType=Main
|
"Период @period" # роль периода
|
||||||
```
|
```
|
||||||
|
|
||||||
Флаги: `@balance`, `@dimension`, `@account`, `@period`, `@required`, `@autoOrder`, `@ignoreNullValues`.
|
Флаги: `@balance`, `@dimension`, `@account`, `@period`, `@required`, `@autoOrder`, `@ignoreNullValues`.
|
||||||
@@ -346,6 +351,7 @@ KV: `balanceGroupName`, `balanceType` (OpeningBalance/ClosingBalance), `parentDi
|
|||||||
| `clear-selection` | `*` | Очищает все элементы selection |
|
| `clear-selection` | `*` | Очищает все элементы selection |
|
||||||
| `clear-order` | `*` | Очищает все элементы order |
|
| `clear-order` | `*` | Очищает все элементы order |
|
||||||
| `clear-filter` | `*` | Очищает все элементы filter |
|
| `clear-filter` | `*` | Очищает все элементы filter |
|
||||||
|
| `clear-conditionalAppearance` | `*` | Очищает все правила условного оформления |
|
||||||
|
|
||||||
## Верификация
|
## Верификация
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# skd-edit v1.17 — Atomic 1C DCS editor
|
# skd-edit v1.18 — Atomic 1C DCS editor
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -13,7 +13,7 @@ param(
|
|||||||
"set-query","patch-query","set-outputParameter","set-structure",
|
"set-query","patch-query","set-outputParameter","set-structure",
|
||||||
"modify-field","modify-filter","modify-dataParameter","modify-parameter","modify-structure","set-field-role",
|
"modify-field","modify-filter","modify-dataParameter","modify-parameter","modify-structure","set-field-role",
|
||||||
"rename-parameter","reorder-parameters",
|
"rename-parameter","reorder-parameters",
|
||||||
"clear-selection","clear-order","clear-filter",
|
"clear-selection","clear-order","clear-filter","clear-conditionalAppearance",
|
||||||
"remove-field","remove-total","remove-calculated-field","remove-parameter","remove-filter")]
|
"remove-field","remove-total","remove-calculated-field","remove-parameter","remove-filter")]
|
||||||
[string]$Operation,
|
[string]$Operation,
|
||||||
|
|
||||||
@@ -2858,6 +2858,18 @@ switch ($Operation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"clear-conditionalAppearance" {
|
||||||
|
$settings = Resolve-VariantSettings
|
||||||
|
$varName = Get-VariantName
|
||||||
|
$caEl = Find-FirstElement $settings @("conditionalAppearance") $setNs
|
||||||
|
if ($caEl) {
|
||||||
|
Clear-ContainerChildren $caEl
|
||||||
|
Write-Host "[OK] ConditionalAppearance cleared in variant `"$varName`""
|
||||||
|
} else {
|
||||||
|
Write-Host "[INFO] No conditionalAppearance section in variant `"$varName`""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
"modify-filter" {
|
"modify-filter" {
|
||||||
$settings = Resolve-VariantSettings
|
$settings = Resolve-VariantSettings
|
||||||
$varName = Get-VariantName
|
$varName = Get-VariantName
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# skd-edit v1.17 — Atomic 1C DCS editor (Python port)
|
# skd-edit v1.18 — Atomic 1C DCS editor (Python port)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
@@ -20,7 +20,7 @@ VALID_OPS = [
|
|||||||
"set-query", "patch-query", "set-outputParameter", "set-structure",
|
"set-query", "patch-query", "set-outputParameter", "set-structure",
|
||||||
"modify-field", "modify-filter", "modify-dataParameter", "modify-parameter", "modify-structure", "set-field-role",
|
"modify-field", "modify-filter", "modify-dataParameter", "modify-parameter", "modify-structure", "set-field-role",
|
||||||
"rename-parameter", "reorder-parameters",
|
"rename-parameter", "reorder-parameters",
|
||||||
"clear-selection", "clear-order", "clear-filter",
|
"clear-selection", "clear-order", "clear-filter", "clear-conditionalAppearance",
|
||||||
"remove-field", "remove-total", "remove-calculated-field", "remove-parameter", "remove-filter",
|
"remove-field", "remove-total", "remove-calculated-field", "remove-parameter", "remove-filter",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2380,6 +2380,16 @@ elif operation == "clear-filter":
|
|||||||
else:
|
else:
|
||||||
print(f'[INFO] No filter section in variant "{var_name}"')
|
print(f'[INFO] No filter section in variant "{var_name}"')
|
||||||
|
|
||||||
|
elif operation == "clear-conditionalAppearance":
|
||||||
|
settings = resolve_variant_settings()
|
||||||
|
var_name = get_variant_name()
|
||||||
|
ca_el = find_first_element(settings, ["conditionalAppearance"], SET_NS)
|
||||||
|
if ca_el is not None:
|
||||||
|
clear_container_children(ca_el)
|
||||||
|
print(f'[OK] ConditionalAppearance cleared in variant "{var_name}"')
|
||||||
|
else:
|
||||||
|
print(f'[INFO] No conditionalAppearance section in variant "{var_name}"')
|
||||||
|
|
||||||
elif operation == "modify-filter":
|
elif operation == "modify-filter":
|
||||||
settings = resolve_variant_settings()
|
settings = resolve_variant_settings()
|
||||||
var_name = get_variant_name()
|
var_name = get_variant_name()
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "clear-conditionalAppearance: очистить все правила оформления варианта",
|
||||||
|
"preRun": [
|
||||||
|
{
|
||||||
|
"script": "skd-compile/scripts/skd-compile",
|
||||||
|
"input": {
|
||||||
|
"dataSets": [{
|
||||||
|
"name": "Основной",
|
||||||
|
"query": "ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т",
|
||||||
|
"fields": ["Сумма: decimal(15,2)"]
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"args": { "-DefinitionFile": "{inputFile}", "-OutputPath": "{workDir}/Template.xml" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"script": "skd-edit/scripts/skd-edit",
|
||||||
|
"args": { "-TemplatePath": "{workDir}/Template.xml", "-Operation": "add-conditionalAppearance", "-Value": "ЦветТекста = web:Red when Сумма < 0 ;; ЦветФона = web:LightGreen when Сумма > 1000" }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"params": {
|
||||||
|
"templatePath": "Template.xml",
|
||||||
|
"operation": "clear-conditionalAppearance",
|
||||||
|
"value": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?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="DataSetQuery">
|
||||||
|
<name>Основной</name>
|
||||||
|
<field xsi:type="DataSetFieldField">
|
||||||
|
<dataPath>Сумма</dataPath>
|
||||||
|
<field>Сумма</field>
|
||||||
|
<valueType>
|
||||||
|
<v8:Type>xs:decimal</v8:Type>
|
||||||
|
<v8:NumberQualifiers>
|
||||||
|
<v8:Digits>15</v8:Digits>
|
||||||
|
<v8:FractionDigits>2</v8:FractionDigits>
|
||||||
|
<v8:AllowedSign>Any</v8:AllowedSign>
|
||||||
|
</v8:NumberQualifiers>
|
||||||
|
</valueType>
|
||||||
|
</field>
|
||||||
|
<dataSource>ИсточникДанных1</dataSource>
|
||||||
|
<query>ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т</query>
|
||||||
|
</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:conditionalAppearance>
|
||||||
|
</dcsset:conditionalAppearance>
|
||||||
|
<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