feat(form-compile): пустое значение фильтра "_" → self-closing <dcsset:right> (а не литеральный _)

Маркер пустого значения "_" (Get-FilterValue для пустого <dcsset:right xsi:type="X"/>)
эмитился компилятором как литеральный `_` (<dcsset:right xsi:type="dcscor:Field">_</...>)
в объектной форме фильтра (когда форсится valueType/userSettingPresentation). Платформа
хранит self-closing пустой тег (напр. сравнение с незаданным полем dcscor:Field, или
пустой xs:string). Фикс: value=="_" → <dcsset:right xsi:type="$vt"/> (vt из valueType
или xs:string). Зеркало py.

Формы ОтправкиОтчетности/ФормаЭлемента (dcscor:Field) → match; чинит и Новости
(xs:string пустой в object-форме). Кейс input-fields (+CA фильтр с пустым dcscor:Field)
сертифицирован в 1С. Регресс 43/43 (ps1+py).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-11 21:02:17 +03:00
parent 9900f8f656
commit 2ab1b5bc14
4 changed files with 30 additions and 3 deletions
@@ -1,4 +1,4 @@
# form-compile v1.121 — Compile 1C managed form from JSON or object metadata
# form-compile v1.122 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -1742,6 +1742,11 @@ function Emit-FilterItem {
X "$indent`t`t<v8:variant xsi:type=`"v8:${sdType}Variant`">$(Esc-Xml $variant)</v8:variant>"
if ($hasDate) { X "$indent`t`t<v8:date>$(Esc-Xml $dateV)</v8:date>" }
X "$indent`t</dcsset:right>"
} elseif ("$($item.value)" -eq '_') {
# "_" — маркер пустого значения: платформа эмитит пустой self-closing <dcsset:right>
# (напр. <dcsset:right xsi:type="dcscor:Field"/> — сравнение с незаданным полем).
$vt = if ($item.valueType) { "$($item.valueType)" } else { 'xs:string' }
X "$indent`t<dcsset:right xsi:type=`"$vt`"/>"
} elseif ($null -ne $item.value) {
$vt = if ($item.valueType) { "$($item.valueType)" } else { "" }
if (-not $vt) {
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.121 — Compile 1C managed form from JSON or object metadata
# form-compile v1.122 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -1483,6 +1483,11 @@ def emit_filter_item(lines, item, indent):
if date_v is not None:
lines.append(f'{indent}\t\t<v8:date>{esc_xml(str(date_v))}</v8:date>')
lines.append(f'{indent}\t</dcsset:right>')
elif str(val) == '_':
# "_" — маркер пустого значения: платформа эмитит пустой self-closing <dcsset:right>
# (напр. <dcsset:right xsi:type="dcscor:Field"/> — сравнение с незаданным полем).
vt = str(item['valueType']) if item.get('valueType') else 'xs:string'
lines.append(f'{indent}\t<dcsset:right xsi:type="{vt}"/>')
elif val is not None:
vt = _value_type_for(val, item.get('valueType'))
v_str = str(val).lower() if isinstance(val, bool) else esc_xml(str(val))
@@ -77,7 +77,8 @@
{ "filter": ["ЧисловоеПоле = 1"], "appearance": { "Текст": { "field": "ОбычноеПоле" } } },
{ "filter": [{ "field": "ДатаПоля", "op": "=", "value": "3999-12-31T23:59:59" }], "appearance": { "ЦветТекста": "web:Gray" } },
{ "filter": ["ДатаПоля > 2020-01-01T00:00:00"], "appearance": { "ЦветТекста": "web:Olive" } },
{ "filter": [{ "field": "ДатаПоля", "op": ">=", "value": "BeginningOfThisDay", "valueType": "v8:StandardBeginningDate" }], "appearance": { "ЦветТекста": "web:Silver" } }
{ "filter": [{ "field": "ДатаПоля", "op": ">=", "value": "BeginningOfThisDay", "valueType": "v8:StandardBeginningDate" }], "appearance": { "ЦветТекста": "web:Silver" } },
{ "filter": [{ "field": "ОбычноеПоле", "op": "=", "value": "_", "valueType": "dcscor:Field" }], "appearance": { "ЦветТекста": "web:Maroon" } }
]
}
}
@@ -776,6 +776,22 @@
</dcscor:item>
</dcsset:appearance>
</dcsset:item>
<dcsset:item>
<dcsset:selection/>
<dcsset:filter>
<dcsset:item xsi:type="dcsset:FilterItemComparison">
<dcsset:left xsi:type="dcscor:Field">ОбычноеПоле</dcsset:left>
<dcsset:comparisonType>Equal</dcsset:comparisonType>
<dcsset:right xsi:type="dcscor:Field"/>
</dcsset:item>
</dcsset:filter>
<dcsset:appearance>
<dcscor:item xsi:type="dcsset:SettingsParameterValue">
<dcscor:parameter>ЦветТекста</dcscor:parameter>
<dcscor:value xsi:type="v8ui:Color">web:Maroon</dcscor:value>
</dcscor:item>
</dcsset:appearance>
</dcsset:item>
</ConditionalAppearance>
</Attributes>
</Form>