mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 09:30:59 +03:00
fix(form-compile): составной тип в shorthand параметра дин-списка (dcssch:valueType)
Parse-DLParamShorthand брал тип regex'ом (\S+) — один токен без пробелов. Составной тип (CatalogRef.X | CatalogRef.Y, с пробелами вокруг |) не матчился → вся строка уходила в name → компилятор эмитил <dcssch:name>Имя: TYPE | TYPE</…> и ТЕРЯЛ <dcssch:valueType>. Фикс: тип = ([^=]+?) (допускает пробелы/|, исключает '='-разделитель значения); составной резолвится по частям (per-part Resolve-TypeStr, rejoin ' | '). Emit-DLValueType уже split'ил по |, эмиссия корректна. Зеркало py. Выборка 2.17: TOTAL 38→12 (составной тип у дин-списков Task/прочих восстановлен). Кейс dynamic-list-parameters (+составной параметр DocumentRef | CatalogRef → два TypeSet) сертифицирован загрузкой в 1С. Регресс 40/40 (ps1+py). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e16b23968e
commit
2ff99d1b77
@@ -1,4 +1,4 @@
|
|||||||
# form-compile v1.99 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.100 — Compile 1C managed form from JSON or object metadata
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$JsonPath,
|
[string]$JsonPath,
|
||||||
@@ -4471,9 +4471,15 @@ function Parse-DLParamShorthand {
|
|||||||
if ($s -match '@valueList') { $result.valueListAllowed = $true; $s = $s -replace '\s*@valueList', '' }
|
if ($s -match '@valueList') { $result.valueListAllowed = $true; $s = $s -replace '\s*@valueList', '' }
|
||||||
if ($s -match '@hidden') { $result.hidden = $true; $s = $s -replace '\s*@hidden', '' }
|
if ($s -match '@hidden') { $result.hidden = $true; $s = $s -replace '\s*@hidden', '' }
|
||||||
if ($s -match '\[([^\]]*)\]') { $result.title = $Matches[1].Trim(); $s = ($s -replace '\s*\[[^\]]*\]\s*', ' ').Trim() }
|
if ($s -match '\[([^\]]*)\]') { $result.title = $Matches[1].Trim(); $s = ($s -replace '\s*\[[^\]]*\]\s*', ' ').Trim() }
|
||||||
if ($s -match '^([^:]+):\s*(\S+)(\s*=\s*(.*))?$') {
|
# Тип может быть СОСТАВНЫМ (A | B | C — с пробелами); значение — после '=' (тип '=' не содержит).
|
||||||
|
if ($s -match '^([^:]+):\s*([^=]+?)(\s*=\s*(.*))?$') {
|
||||||
$result.name = $Matches[1].Trim()
|
$result.name = $Matches[1].Trim()
|
||||||
$result.type = Resolve-TypeStr ($Matches[2].Trim())
|
$typeRaw = $Matches[2].Trim()
|
||||||
|
if ($typeRaw -match '[|+]') {
|
||||||
|
$result.type = (($typeRaw -split '\s*[|+]\s*') | ForEach-Object { Resolve-TypeStr ($_.Trim()) }) -join ' | '
|
||||||
|
} else {
|
||||||
|
$result.type = Resolve-TypeStr $typeRaw
|
||||||
|
}
|
||||||
if ($Matches[4]) {
|
if ($Matches[4]) {
|
||||||
$rhs = $Matches[4].Trim()
|
$rhs = $Matches[4].Trim()
|
||||||
$items = Split-DLValueListCsv $rhs
|
$items = Split-DLValueListCsv $rhs
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# form-compile v1.99 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.100 — Compile 1C managed form from JSON or object metadata
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import copy
|
import copy
|
||||||
@@ -4160,10 +4160,15 @@ def parse_dl_param_shorthand(s):
|
|||||||
if m:
|
if m:
|
||||||
result['title'] = m.group(1).strip()
|
result['title'] = m.group(1).strip()
|
||||||
s = re.sub(r'\s*\[[^\]]*\]\s*', ' ', s).strip()
|
s = re.sub(r'\s*\[[^\]]*\]\s*', ' ', s).strip()
|
||||||
m = re.match(r'^([^:]+):\s*(\S+)(\s*=\s*(.*))?$', s)
|
# Тип может быть СОСТАВНЫМ (A | B | C — с пробелами); значение — после '=' (тип '=' не содержит).
|
||||||
|
m = re.match(r'^([^:]+):\s*([^=]+?)(\s*=\s*(.*))?$', s)
|
||||||
if m:
|
if m:
|
||||||
result['name'] = m.group(1).strip()
|
result['name'] = m.group(1).strip()
|
||||||
result['type'] = resolve_type_str(m.group(2).strip())
|
type_raw = m.group(2).strip()
|
||||||
|
if re.search(r'[|+]', type_raw):
|
||||||
|
result['type'] = ' | '.join(resolve_type_str(p.strip()) for p in re.split(r'\s*[|+]\s*', type_raw))
|
||||||
|
else:
|
||||||
|
result['type'] = resolve_type_str(type_raw)
|
||||||
if m.group(4):
|
if m.group(4):
|
||||||
rhs = m.group(4).strip()
|
rhs = m.group(4).strip()
|
||||||
items = split_dl_valuelist_csv(rhs)
|
items = split_dl_valuelist_csv(rhs)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
"parameters": [
|
"parameters": [
|
||||||
"Артикул",
|
"Артикул",
|
||||||
"Маска: string = %",
|
"Маска: string = %",
|
||||||
|
"Получатель: DocumentRef | CatalogRef",
|
||||||
{ "name": "ВидЦен", "valueListAllowed": true },
|
{ "name": "ВидЦен", "valueListAllowed": true },
|
||||||
{ "name": "Период", "type": "dateTime", "useRestriction": false },
|
{ "name": "Период", "type": "dateTime", "useRestriction": false },
|
||||||
{
|
{
|
||||||
|
|||||||
+15
@@ -124,6 +124,21 @@
|
|||||||
<dcssch:value xsi:type="xs:string">%</dcssch:value>
|
<dcssch:value xsi:type="xs:string">%</dcssch:value>
|
||||||
<dcssch:useRestriction>true</dcssch:useRestriction>
|
<dcssch:useRestriction>true</dcssch:useRestriction>
|
||||||
</Parameter>
|
</Parameter>
|
||||||
|
<Parameter>
|
||||||
|
<dcssch:name>Получатель</dcssch:name>
|
||||||
|
<dcssch:title xsi:type="v8:LocalStringType">
|
||||||
|
<v8:item>
|
||||||
|
<v8:lang>ru</v8:lang>
|
||||||
|
<v8:content>Получатель</v8:content>
|
||||||
|
</v8:item>
|
||||||
|
</dcssch:title>
|
||||||
|
<dcssch:valueType>
|
||||||
|
<v8:TypeSet>cfg:DocumentRef</v8:TypeSet>
|
||||||
|
<v8:TypeSet>cfg:CatalogRef</v8:TypeSet>
|
||||||
|
</dcssch:valueType>
|
||||||
|
<dcssch:value xsi:nil="true"/>
|
||||||
|
<dcssch:useRestriction>true</dcssch:useRestriction>
|
||||||
|
</Parameter>
|
||||||
<Parameter>
|
<Parameter>
|
||||||
<dcssch:name>ВидЦен</dcssch:name>
|
<dcssch:name>ВидЦен</dcssch:name>
|
||||||
<dcssch:title xsi:type="v8:LocalStringType">
|
<dcssch:title xsi:type="v8:LocalStringType">
|
||||||
|
|||||||
Reference in New Issue
Block a user