mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-19 00:59:40 +03:00
feat(skd-compile): dataParameters auto — наследовать variant для StandardPeriod
Для параметров типа StandardPeriod в режиме "dataParameters": "auto" эмитируется <dcscor:value> с variant из дефолта параметра (Custom, если не задан) — как это делает 1C Designer при сохранении SettingsParameterValue для периодов. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -142,7 +142,7 @@ Shorthand: `"Имя [Заголовок]: тип = значение @флаги"
|
||||
}
|
||||
```
|
||||
|
||||
В варианте настроек `"dataParameters": "auto"` автоматически генерирует записи для всех не-hidden параметров с `userSettingID`.
|
||||
В варианте настроек `"dataParameters": "auto"` автоматически генерирует записи для всех не-hidden параметров с `userSettingID`. Для `StandardPeriod` вариант периода наследуется из дефолта параметра (`Custom`, если не задан).
|
||||
|
||||
### Фильтры — shorthand
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.14 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.15 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -2170,6 +2170,21 @@ function Emit-SettingsVariants {
|
||||
$dpItem | Add-Member -NotePropertyName "parameter" -NotePropertyValue $ap.name
|
||||
$dpItem | Add-Member -NotePropertyName "use" -NotePropertyValue $false
|
||||
$dpItem | Add-Member -NotePropertyName "userSettingID" -NotePropertyValue "auto"
|
||||
# For StandardPeriod emit <dcscor:value> with variant inherited from
|
||||
# the parameter default (Custom if none) — matches how 1C Designer
|
||||
# persists SettingsParameterValue for period parameters.
|
||||
if ($ap.type -eq 'StandardPeriod') {
|
||||
$variant = 'Custom'
|
||||
$av = $ap.value
|
||||
if ($null -ne $av) {
|
||||
if (($av -is [PSCustomObject] -or $av -is [hashtable]) -and $av.variant) {
|
||||
$variant = "$($av.variant)"
|
||||
} elseif ("$av") {
|
||||
$variant = "$av"
|
||||
}
|
||||
}
|
||||
$dpItem | Add-Member -NotePropertyName "value" -NotePropertyValue @{ variant = $variant }
|
||||
}
|
||||
$autoDP += $dpItem
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.14 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.15 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -1819,11 +1819,24 @@ def emit_settings_variants(lines, defn):
|
||||
auto_dp = []
|
||||
for ap in _all_params:
|
||||
if not ap['hidden']:
|
||||
auto_dp.append({
|
||||
item = {
|
||||
'parameter': ap['name'],
|
||||
'use': False,
|
||||
'userSettingID': 'auto',
|
||||
})
|
||||
}
|
||||
# For StandardPeriod emit <dcscor:value> with variant inherited
|
||||
# from the parameter default (Custom if none) — matches how
|
||||
# 1C Designer persists SettingsParameterValue for period params.
|
||||
if ap.get('type') == 'StandardPeriod':
|
||||
variant = 'Custom'
|
||||
av = ap.get('value')
|
||||
if av is not None:
|
||||
if isinstance(av, dict) and av.get('variant'):
|
||||
variant = str(av['variant'])
|
||||
elif str(av):
|
||||
variant = str(av)
|
||||
item['value'] = {'variant': variant}
|
||||
auto_dp.append(item)
|
||||
if auto_dp:
|
||||
emit_data_parameters(lines, auto_dp, '\t\t\t')
|
||||
elif s.get('dataParameters'):
|
||||
|
||||
Reference in New Issue
Block a user