mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-26 22:51:03 +03:00
feat(form-decompile,form-compile): StandardBeginningDate — короткая форма значения (строка-вариант)
Добавлена короткая запись значения фильтра StandardBeginningDate (как в skd для
StandardPeriod): именованный вариант → просто строка "BeginningOfThisDay" (без даты);
Custom → объект {variant:"Custom", date:"…"} (нужна дата). Компилятор Emit-FilterItem
принимает обе формы (строка → variant-only; объект → variant+date); декомпилятор
эмитит строку для именованных вариантов, объект для Custom.
Зеркало py. Кейс input-fields: именованный вариант переведён на короткую строку
(snapshot байт-в-байт = объектной форме). Round-trip: Custom→объект,
BeginningOfThisDay→строка. Регресс 43/43, SBD-корпус (40 форм) без регрессий.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
3ce71d436f
commit
89bb58a101
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.117 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.118 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -1465,14 +1465,18 @@ def emit_filter_item(lines, item, indent):
|
||||
vt = _value_type_for(v, item.get('valueType'))
|
||||
v_str = str(v).lower() if isinstance(v, bool) else esc_xml(str(v))
|
||||
lines.append(f'{indent}\t<dcsset:right xsi:type="{vt}">{v_str}</dcsset:right>')
|
||||
elif val is not None and isinstance(val, dict) and re.search(r'Standard(Beginning|End)Date$', str(item.get('valueType') or '')):
|
||||
# Стандартная дата начала/окончания: структурное значение {variant, date?}.
|
||||
# Custom несёт <v8:date>; именованные варианты (BeginningOfThisDay/…) — без даты.
|
||||
elif val is not None and re.search(r'Standard(Beginning|End)Date$', str(item.get('valueType') or '')):
|
||||
# Стандартная дата начала/окончания. Две формы: объект {variant, date?} (Custom несёт
|
||||
# <v8:date>) или строка-вариант "BeginningOfThisDay" (short, именованный без даты).
|
||||
sd_type = re.sub(r'^v8:', '', str(item['valueType']))
|
||||
if isinstance(val, dict):
|
||||
variant = str(val.get('variant', '')); date_v = val.get('date')
|
||||
else:
|
||||
variant = str(val); date_v = None
|
||||
lines.append(f'{indent}\t<dcsset:right xsi:type="v8:{sd_type}">')
|
||||
lines.append(f'{indent}\t\t<v8:variant xsi:type="v8:{sd_type}Variant">{esc_xml(str(val.get("variant", "")))}</v8:variant>')
|
||||
if 'date' in val:
|
||||
lines.append(f'{indent}\t\t<v8:date>{esc_xml(str(val["date"]))}</v8:date>')
|
||||
lines.append(f'{indent}\t\t<v8:variant xsi:type="v8:{sd_type}Variant">{esc_xml(variant)}</v8:variant>')
|
||||
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 val is not None:
|
||||
vt = _value_type_for(val, item.get('valueType'))
|
||||
|
||||
Reference in New Issue
Block a user