mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 09:30:59 +03:00
feat(form-decompile,form-compile): InputField availableTypes + typeDomainEnabled (ограничение доступных типов)
Раундтрип терял блок ограничения типов у поля ввода на составном/характеристика-типе: <TypeDomainEnabled> + <AvailableTypes> (напр. ЯндексМаркетВитринаФулфилмент/РегламентноеЗадание — поле ИмяПользователя с AvailableTypes=xs:string Length=0 Variable). Корпус (acc+erp 8.3.24): AvailableTypes встречается в 18 местах, ВСЕ — на InputField (полное покрытие scope). Содержимое — стандартный 1С type-description (<v8:Type>+qualifiers), тот же формат, что у реквизитов → переиспользуем существующий механизм типов: - decompile: Decompile-Type на узле <AvailableTypes> → компактная DSL-строка (одиночная/мультитип "a | b") - compile (ps1+py): Emit-Type с tag='AvailableTypes' (сам разбирает мультитип); TypeDomainEnabled — bool pass-through availableTypes — формат типа реквизита (§Типы): одиночный или составной через "|". Верификация: таргет-раундтрип всех 17 форм с AvailableTypes → 15 match, остаток 6 строк в 2 формах — ДРУГИЕ категории (ExtendedTooltip/Value), не AvailableTypes; целевая форма match (было 8 → 0). Регресс form-compile 43/43 (ps1+py); 1С-cert кейса input-fields (поле с мультитип AvailableTypes грузится в платформу). spec обновлён. 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
da1d8c9297
commit
75b77caf9b
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.127 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.128 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -3640,6 +3640,10 @@ function Emit-Input {
|
||||
)) {
|
||||
if ($null -ne $el.($p[0])) { X "$inner<$($p[1])>$(if ($el.($p[0])){'true'}else{'false'})</$($p[1])>" }
|
||||
}
|
||||
# Ограничение доступных типов (поле на составном типе): домен типов + явный набор.
|
||||
# availableTypes — формат типа реквизита (§type); Emit-Type сам разбирает мультитип "a | b".
|
||||
if ($null -ne $el.typeDomainEnabled) { X "$inner<TypeDomainEnabled>$(if ($el.typeDomainEnabled){'true'}else{'false'})</TypeDomainEnabled>" }
|
||||
if ($el.availableTypes) { Emit-Type -typeStr $el.availableTypes -indent $inner -tag 'AvailableTypes' }
|
||||
# InputField-специфичные value-скаляры
|
||||
foreach ($p in @(
|
||||
@('choiceForm','ChoiceForm'), @('choiceHistoryOnInput','ChoiceHistoryOnInput'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.127 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.128 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -3728,6 +3728,12 @@ def emit_input(lines, el, name, eid, indent):
|
||||
('quickChoice', 'QuickChoice'), ('autoChoiceIncomplete', 'AutoChoiceIncomplete')):
|
||||
if el.get(key) is not None:
|
||||
lines.append(f'{inner}<{tag}>{"true" if el[key] else "false"}</{tag}>')
|
||||
# Ограничение доступных типов (поле на составном типе): домен типов + явный набор.
|
||||
# availableTypes — формат типа реквизита (§type); emit_type сам разбирает мультитип "a | b".
|
||||
if el.get('typeDomainEnabled') is not None:
|
||||
lines.append(f'{inner}<TypeDomainEnabled>{"true" if el["typeDomainEnabled"] else "false"}</TypeDomainEnabled>')
|
||||
if el.get('availableTypes'):
|
||||
emit_type(lines, el['availableTypes'], inner, tag='AvailableTypes')
|
||||
# InputField-специфичные value-скаляры
|
||||
for key, tag in (('choiceForm', 'ChoiceForm'), ('choiceHistoryOnInput', 'ChoiceHistoryOnInput'),
|
||||
('choiceFoldersAndItems', 'ChoiceFoldersAndItems'), ('footerDataPath', 'FooterDataPath')):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# form-decompile v1.01 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||
# form-decompile v1.02 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
||||
param(
|
||||
@@ -1651,6 +1651,10 @@ function Decompile-Element {
|
||||
} else { $obj[$key] = $txt }
|
||||
}
|
||||
}
|
||||
# Ограничение доступных типов (поле на составном/характеристика-типе): домен типов + явный набор.
|
||||
# availableTypes — тот же формат типа, что у реквизитов (§type), захват через Decompile-Type.
|
||||
$tde = Get-Child $node 'TypeDomainEnabled'; if ($null -ne $tde) { $obj['typeDomainEnabled'] = (To-Bool $tde) }
|
||||
$atNode = $node.SelectSingleNode("lf:AvailableTypes", $ns); if ($atNode) { $at = Decompile-Type $atNode; if ($at) { $obj['availableTypes'] = $at } }
|
||||
$cbr = Get-Child $node 'ChoiceButtonRepresentation'; if ($cbr) { $obj['choiceButtonRepresentation'] = $cbr }
|
||||
$cbp = Get-PictureRef $node 'ChoiceButtonPicture'; if ($null -ne $cbp) { $obj['choiceButtonPicture'] = $cbp }
|
||||
if ((Get-Child $node 'TextEdit') -eq 'false') { $obj['textEdit'] = $false }
|
||||
|
||||
Reference in New Issue
Block a user