feat(skd): modify-parameter operation, availableValues/denyIncompleteValues support

- skd-edit: new modify-parameter operation — set use, denyIncompleteValues, add availableValue entries to existing parameters
- skd-compile: availableValues array and denyIncompleteValues in parameter JSON DSL
- Auto-detect DesignTimeValue type for reference values in availableValue entries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-04-06 19:19:32 +03:00
co-authored by Claude Opus 4.6
parent 87e636f644
commit d755c41233
4 changed files with 216 additions and 2 deletions
@@ -886,6 +886,33 @@ function Emit-SingleParam {
X "`t`t<valueListAllowed>true</valueListAllowed>"
}
# AvailableValues
if ($p -isnot [string] -and $p.availableValues) {
foreach ($av in $p.availableValues) {
$avVal = "$($av.value)"
$avType = "xs:string"
if ($avVal -match '^(Перечисление|Справочник|ПланСчетов|Документ|ПланВидовХарактеристик|ПланВидовРасчета)\.') {
$avType = "dcscor:DesignTimeValue"
}
X "`t`t<availableValue>"
X "`t`t`t<value xsi:type=`"$avType`">$(Esc-Xml $avVal)</value>"
if ($av.presentation) {
X "`t`t`t<presentation xsi:type=`"v8:LocalStringType`">"
X "`t`t`t`t<v8:item>"
X "`t`t`t`t`t<v8:lang>ru</v8:lang>"
X "`t`t`t`t`t<v8:content>$(Esc-Xml "$($av.presentation)")</v8:content>"
X "`t`t`t`t</v8:item>"
X "`t`t`t</presentation>"
}
X "`t`t</availableValue>"
}
}
# DenyIncompleteValues
if ($p -isnot [string] -and $p.denyIncompleteValues -eq $true) {
X "`t`t<denyIncompleteValues>true</denyIncompleteValues>"
}
# Use
if ($p -isnot [string] -and $p.use) {
X "`t`t<use>$(Esc-Xml "$($p.use)")</use>"
@@ -754,6 +754,28 @@ def emit_single_param(lines, p, parsed):
if parsed.get('valueListAllowed'):
lines.append('\t\t<valueListAllowed>true</valueListAllowed>')
# AvailableValues
if p is not None and not isinstance(p, str) and p.get('availableValues'):
for av in p['availableValues']:
av_val = str(av.get('value', ''))
av_type = 'xs:string'
if re.match(r'^(Перечисление|Справочник|ПланСчетов|Документ|ПланВидовХарактеристик|ПланВидовРасчета)\.', av_val):
av_type = 'dcscor:DesignTimeValue'
lines.append('\t\t<availableValue>')
lines.append(f'\t\t\t<value xsi:type="{av_type}">{esc_xml(av_val)}</value>')
if av.get('presentation'):
lines.append('\t\t\t<presentation xsi:type="v8:LocalStringType">')
lines.append('\t\t\t\t<v8:item>')
lines.append('\t\t\t\t\t<v8:lang>ru</v8:lang>')
lines.append(f'\t\t\t\t\t<v8:content>{esc_xml(str(av["presentation"]))}</v8:content>')
lines.append('\t\t\t\t</v8:item>')
lines.append('\t\t\t</presentation>')
lines.append('\t\t</availableValue>')
# DenyIncompleteValues
if p is not None and not isinstance(p, str) and p.get('denyIncompleteValues') is True:
lines.append('\t\t<denyIncompleteValues>true</denyIncompleteValues>')
# Use
if p is not None and not isinstance(p, str) and p.get('use'):
lines.append(f'\t\t<use>{esc_xml(str(p["use"]))}</use>')