mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-06 10:10:52 +03:00
feat(form-decompile,form-compile): встроенные картинки (xr:Abs) + TransparentPixel + Page Picture (категория картинок)
Закрыты картиночные потери из ROOT-секции корпуса: Page>Picture (702),
PictureField>ValuesPicture (abs), Button>Picture (abs), а также RowsPicture
и командные/popup-картинки. ColumnGroup>HeaderPicture уже ловился (Add-CommonProps),
бэклог-числа были от старого прогона v0.62.
Две системные дыры + один полный пробел (по корпусу 36707 форм):
- xr:Abs (встроенная картинка) игнорировался везде, кроме PictureDecoration:
Get-PictureRef и Button/Popup/Command picture брали только <xr:Ref>. Теперь
src с префиксом "abs:" → <xr:Abs> (как у PictureDecoration). ~358 ValuesPicture
+ ~153 Button + хвост.
- xr:TransparentPixel ловился только у PictureDecoration. Теперь — в объектной
форме картинки-ссылки {src, loadTransparent?, transparentPixel:{x,y}} у
ValuesPicture/HeaderPicture/FooterPicture/RowsPicture/Page и у командных картинок.
- Page>Picture не поддерживался ни компилятором, ни декомпилятором. Новый ключ
picture на Page (конвенция ValuesPicture: дефолт LoadTransparent=false, по корпусу
416/286). Позиция XSD: после Title/ToolTip/флагов, перед Group/ShowTitle.
Компилятор: Emit-PictureRef + Emit-CommandPicture расширены abs/transparentPixel;
Emit-Page эмитит picture; RowsPicture переведён на Emit-PictureRef (был кастомный
блок без abs/TP). Декомпилятор: Get-PictureRef ловит xr:Abs/TransparentPixel;
новый хелпер Set-CommandPicture (Button/Popup/Command — abs + TP через объектную
форму при наличии TP, иначе скаляр); Page и RowsPicture через Get-PictureRef.
Зеркало py (байт-в-байт). abs валидируется раундтрипом на корпусе (нужен встроенный
бинарь — в синтет-кейсы не кладём); transparentPixel + Page picture сертифицированы
загрузкой в 1С (кейсы picture-field/pages/commands). Регресс 43/43 (ps1+py).
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
73f1e6ec26
commit
606ac10fdb
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.111 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.112 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -2822,19 +2822,23 @@ function Emit-CommonElementProps {
|
||||
if ($el.headerHorizontalAlign) { X "$indent<HeaderHorizontalAlign>$($el.headerHorizontalAlign)</HeaderHorizontalAlign>" }
|
||||
}
|
||||
|
||||
# Картинка-ссылка с прозрачностью (HeaderPicture/FooterPicture/ValuesPicture).
|
||||
# Картинка-ссылка с прозрачностью (HeaderPicture/FooterPicture/ValuesPicture/Page Picture).
|
||||
# Платформа ВСЕГДА эмитит <xr:LoadTransparent> → пишем всегда (false по умолчанию).
|
||||
# Значение: скаляр (Ref) ИЛИ объект {src, loadTransparent}.
|
||||
# Значение: скаляр (Ref) ИЛИ объект {src, loadTransparent, transparentPixel}.
|
||||
# src с префиксом "abs:" → встроенная картинка <xr:Abs>; иначе именованная/стилевая <xr:Ref>.
|
||||
function Emit-PictureRef {
|
||||
param($val, [string]$picTag, [string]$indent)
|
||||
if (-not $val) { return }
|
||||
$src = $null; $lt = $false
|
||||
$src = $null; $lt = $false; $tpx = $null
|
||||
if ($val -is [string]) { $src = $val }
|
||||
else { $src = $val.src; if ($val.loadTransparent -eq $true) { $lt = $true } }
|
||||
else { $src = $val.src; if ($val.loadTransparent -eq $true) { $lt = $true }; $tpx = $val.transparentPixel }
|
||||
if (-not $src) { return }
|
||||
$srcStr = "$src"
|
||||
X "$indent<$picTag>"
|
||||
X "$indent`t<xr:Ref>$src</xr:Ref>"
|
||||
if ($srcStr -match '^abs:(.*)$') { X "$indent`t<xr:Abs>$(Esc-Xml $matches[1])</xr:Abs>" }
|
||||
else { X "$indent`t<xr:Ref>$(Esc-Xml $srcStr)</xr:Ref>" }
|
||||
X "$indent`t<xr:LoadTransparent>$(if ($lt) { 'true' } else { 'false' })</xr:LoadTransparent>"
|
||||
if ($tpx) { X "$indent`t<xr:TransparentPixel x=`"$($tpx.x)`" y=`"$($tpx.y)`"/>" }
|
||||
X "$indent</$picTag>"
|
||||
}
|
||||
|
||||
@@ -2854,14 +2858,17 @@ function Emit-ColumnPics {
|
||||
function Emit-CommandPicture {
|
||||
param($pic, $elemLt, [string]$indent)
|
||||
if (-not $pic) { return }
|
||||
$src = $null; $lt = $null
|
||||
$src = $null; $lt = $null; $tpx = $null
|
||||
if ($pic -is [string]) { $src = $pic }
|
||||
else { $src = $pic.src; if ($null -ne $pic.loadTransparent) { $lt = [bool]$pic.loadTransparent } }
|
||||
else { $src = $pic.src; if ($null -ne $pic.loadTransparent) { $lt = [bool]$pic.loadTransparent }; $tpx = $pic.transparentPixel }
|
||||
if (-not $src) { return }
|
||||
if ($null -eq $lt -and $null -ne $elemLt) { $lt = [bool]$elemLt }
|
||||
$srcStr = "$src"
|
||||
X "$indent<Picture>"
|
||||
X "$indent`t<xr:Ref>$src</xr:Ref>"
|
||||
if ($srcStr -match '^abs:(.*)$') { X "$indent`t<xr:Abs>$(Esc-Xml $matches[1])</xr:Abs>" }
|
||||
else { X "$indent`t<xr:Ref>$(Esc-Xml $srcStr)</xr:Ref>" }
|
||||
X "$indent`t<xr:LoadTransparent>$(if ($lt -eq $false) { 'false' } else { 'true' })</xr:LoadTransparent>"
|
||||
if ($tpx) { X "$indent`t<xr:TransparentPixel x=`"$($tpx.x)`" y=`"$($tpx.y)`"/>" }
|
||||
X "$indent</Picture>"
|
||||
}
|
||||
|
||||
@@ -4228,15 +4235,8 @@ function Emit-Table {
|
||||
if ($el.initialTreeView) { X "$inner<InitialTreeView>$($el.initialTreeView)</InitialTreeView>" }
|
||||
if ($null -ne $el.enableDrag) { X "$inner<EnableDrag>$(if ($el.enableDrag){'true'}else{'false'})</EnableDrag>" }
|
||||
if ($el.rowPictureDataPath) { X "$inner<RowPictureDataPath>$($el.rowPictureDataPath)</RowPictureDataPath>" }
|
||||
if ($el.rowsPicture) {
|
||||
# Строка = Ref (LoadTransparent дефолт false); объект {src, loadTransparent} → факт. значение
|
||||
$rpSrc = if ($el.rowsPicture -is [string]) { $el.rowsPicture } else { $el.rowsPicture.src }
|
||||
$rpLt = if ($el.rowsPicture -isnot [string] -and $el.rowsPicture.loadTransparent -eq $true) { 'true' } else { 'false' }
|
||||
X "$inner<RowsPicture>"
|
||||
X "$inner`t<xr:Ref>$rpSrc</xr:Ref>"
|
||||
X "$inner`t<xr:LoadTransparent>$rpLt</xr:LoadTransparent>"
|
||||
X "$inner</RowsPicture>"
|
||||
}
|
||||
# RowsPicture — та же конвенция, что ValuesPicture (дефолт LoadTransparent=false; abs/TransparentPixel)
|
||||
Emit-PictureRef -val $el.rowsPicture -picTag 'RowsPicture' -indent $inner
|
||||
# Блок свойств дин-список-таблицы (помечена эвристикой 11b.4)
|
||||
if ($el.PSObject.Properties["_dynList"] -and $el._dynList) { Emit-DynListTableBlock -el $el -indent $inner }
|
||||
if ($el.viewStatusLocation) { X "$inner<ViewStatusLocation>$($el.viewStatusLocation)</ViewStatusLocation>" }
|
||||
@@ -4323,6 +4323,10 @@ function Emit-Page {
|
||||
Emit-Title -el $el -name $name -indent $inner -auto
|
||||
Emit-CommonFlags -el $el -indent $inner
|
||||
|
||||
# Картинка страницы (иконка вкладки): после Title/флагов, перед Group (порядок XSD).
|
||||
# Конвенция как у ValuesPicture (дефолт LoadTransparent=false): скаляр-Ref/'abs:X' или объект.
|
||||
Emit-PictureRef -val $el.picture -picTag 'Picture' -indent $inner
|
||||
|
||||
if ($el.group) {
|
||||
# Доступные значения страницы/обычной группы: Vertical / HorizontalIfPossible / AlwaysHorizontal
|
||||
# (InCell — только у columnGroup). Horizontal/AlwaysVertical оставлены forgiving (legacy).
|
||||
|
||||
Reference in New Issue
Block a user