mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-17 07:15:21 +03:00
feat(form-decompile,form-compile): геометрия/layout единым хелпером (кластер E)
- compiler PS1+PY: общий Emit-Layout/emit_layout (width/height/stretch/maxWidth/ maxHeight/autoMax*/skipOnInput/groupHorizontalAlign/groupVerticalAlign/ horizontalAlign), вызывается во всех эмиттерах; inline-дубли убраны. Спец-квирки сохранены (input multiLine→autoMaxWidth, table height→HeightInTableRows). - PictureDecoration LoadTransparent больше не захардкожен true — управляется loadTransparent (дефолт false). - decompiler: Add-Layout (DRY, один вызов на элемент), table HeightInTableRows, picture loadTransparent. - docs/form-dsl-spec: блок общих layout-свойств (4.1a), loadTransparent у picture. - tests: groups расширен layout-свойствами (+snapshot, сертифицирован в 1С). Churn снапшотов нулевой. АварийныйРежим: LOST полностью закрыт (остаток — над-генерация). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
67eaa1c3c8
commit
e777ded8d2
@@ -1,4 +1,4 @@
|
|||||||
# form-compile v1.24 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.25 — 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,
|
||||||
@@ -1909,6 +1909,7 @@ function Emit-Element {
|
|||||||
"titleLocation"=1;"representation"=1;"width"=1;"height"=1
|
"titleLocation"=1;"representation"=1;"width"=1;"height"=1
|
||||||
"horizontalStretch"=1;"verticalStretch"=1;"autoMaxWidth"=1;"autoMaxHeight"=1
|
"horizontalStretch"=1;"verticalStretch"=1;"autoMaxWidth"=1;"autoMaxHeight"=1
|
||||||
"maxWidth"=1;"maxHeight"=1
|
"maxWidth"=1;"maxHeight"=1
|
||||||
|
"groupHorizontalAlign"=1;"groupVerticalAlign"=1;"horizontalAlign"=1
|
||||||
# input-specific
|
# input-specific
|
||||||
"multiLine"=1;"passwordMode"=1;"choiceButton"=1;"clearButton"=1
|
"multiLine"=1;"passwordMode"=1;"choiceButton"=1;"clearButton"=1
|
||||||
"spinButton"=1;"dropListButton"=1;"markIncomplete"=1;"skipOnInput"=1;"inputHint"=1
|
"spinButton"=1;"dropListButton"=1;"markIncomplete"=1;"skipOnInput"=1;"inputHint"=1
|
||||||
@@ -1975,6 +1976,31 @@ function Emit-CommonFlags {
|
|||||||
if ($el.readOnly -eq $true) { X "$indent<ReadOnly>true</ReadOnly>" }
|
if ($el.readOnly -eq $true) { X "$indent<ReadOnly>true</ReadOnly>" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Общие layout-свойства — применимы ко всем элементам. Порядок согласован с
|
||||||
|
# историческим выводом input/label, чтобы не сдвигать существующие снапшоты.
|
||||||
|
# -skipHeight: для Table (height → HeightInTableRows, эмитится в Emit-Table).
|
||||||
|
# -multiLineDefault: input без явного autoMaxWidth при multiLine → AutoMaxWidth=false.
|
||||||
|
function Emit-Layout {
|
||||||
|
param($el, [string]$indent, [switch]$skipHeight, [bool]$multiLineDefault = $false)
|
||||||
|
if ($el.skipOnInput -eq $true) { X "$indent<SkipOnInput>true</SkipOnInput>" }
|
||||||
|
$amwExplicit = ($el.PSObject.Properties.Name -contains 'autoMaxWidth')
|
||||||
|
if ($amwExplicit) {
|
||||||
|
if ($el.autoMaxWidth -eq $false) { X "$indent<AutoMaxWidth>false</AutoMaxWidth>" }
|
||||||
|
} elseif ($multiLineDefault) {
|
||||||
|
X "$indent<AutoMaxWidth>false</AutoMaxWidth>"
|
||||||
|
}
|
||||||
|
if ($null -ne $el.maxWidth) { X "$indent<MaxWidth>$($el.maxWidth)</MaxWidth>" }
|
||||||
|
if ($el.autoMaxHeight -eq $false) { X "$indent<AutoMaxHeight>false</AutoMaxHeight>" }
|
||||||
|
if ($null -ne $el.maxHeight) { X "$indent<MaxHeight>$($el.maxHeight)</MaxHeight>" }
|
||||||
|
if ($el.width) { X "$indent<Width>$($el.width)</Width>" }
|
||||||
|
if (-not $skipHeight -and $el.height) { X "$indent<Height>$($el.height)</Height>" }
|
||||||
|
if ($el.horizontalStretch -eq $true) { X "$indent<HorizontalStretch>true</HorizontalStretch>" }
|
||||||
|
if ($el.verticalStretch -eq $true) { X "$indent<VerticalStretch>true</VerticalStretch>" }
|
||||||
|
if ($el.groupHorizontalAlign) { X "$indent<GroupHorizontalAlign>$($el.groupHorizontalAlign)</GroupHorizontalAlign>" }
|
||||||
|
if ($el.groupVerticalAlign) { X "$indent<GroupVerticalAlign>$($el.groupVerticalAlign)</GroupVerticalAlign>" }
|
||||||
|
if ($el.horizontalAlign) { X "$indent<HorizontalAlign>$($el.horizontalAlign)</HorizontalAlign>" }
|
||||||
|
}
|
||||||
|
|
||||||
function Title-FromName {
|
function Title-FromName {
|
||||||
param([string]$name)
|
param([string]$name)
|
||||||
if (-not $name) { return '' }
|
if (-not $name) { return '' }
|
||||||
@@ -2051,6 +2077,7 @@ function Emit-Group {
|
|||||||
if ($el.united -eq $false) { X "$inner<United>false</United>" }
|
if ($el.united -eq $false) { X "$inner<United>false</United>" }
|
||||||
|
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companion: ExtendedTooltip
|
# Companion: ExtendedTooltip
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2090,9 +2117,9 @@ function Emit-ColumnGroup {
|
|||||||
$shVal = if ($el.showInHeader) { "true" } else { "false" }
|
$shVal = if ($el.showInHeader) { "true" } else { "false" }
|
||||||
X "$inner<ShowInHeader>$shVal</ShowInHeader>"
|
X "$inner<ShowInHeader>$shVal</ShowInHeader>"
|
||||||
}
|
}
|
||||||
if ($el.width) { X "$inner<Width>$($el.width)</Width>" }
|
|
||||||
|
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companion: ExtendedTooltip
|
# Companion: ExtendedTooltip
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2141,20 +2168,7 @@ function Emit-Input {
|
|||||||
if ($el.dropListButton -eq $true) { X "$inner<DropListButton>true</DropListButton>" }
|
if ($el.dropListButton -eq $true) { X "$inner<DropListButton>true</DropListButton>" }
|
||||||
if ($el.markIncomplete -eq $true) { X "$inner<AutoMarkIncomplete>true</AutoMarkIncomplete>" }
|
if ($el.markIncomplete -eq $true) { X "$inner<AutoMarkIncomplete>true</AutoMarkIncomplete>" }
|
||||||
if ($el.textEdit -eq $false) { X "$inner<TextEdit>false</TextEdit>" }
|
if ($el.textEdit -eq $false) { X "$inner<TextEdit>false</TextEdit>" }
|
||||||
if ($el.skipOnInput -eq $true) { X "$inner<SkipOnInput>true</SkipOnInput>" }
|
Emit-Layout -el $el -indent $inner -multiLineDefault ([bool]($el.multiLine -eq $true))
|
||||||
$hasAmw = $el.PSObject.Properties.Name -contains 'autoMaxWidth'
|
|
||||||
if ($hasAmw) {
|
|
||||||
if ($el.autoMaxWidth -eq $false) { X "$inner<AutoMaxWidth>false</AutoMaxWidth>" }
|
|
||||||
} elseif ($el.multiLine -eq $true) {
|
|
||||||
X "$inner<AutoMaxWidth>false</AutoMaxWidth>"
|
|
||||||
}
|
|
||||||
if ($null -ne $el.maxWidth) { X "$inner<MaxWidth>$($el.maxWidth)</MaxWidth>" }
|
|
||||||
if ($el.autoMaxHeight -eq $false) { X "$inner<AutoMaxHeight>false</AutoMaxHeight>" }
|
|
||||||
if ($null -ne $el.maxHeight) { X "$inner<MaxHeight>$($el.maxHeight)</MaxHeight>" }
|
|
||||||
if ($el.width) { X "$inner<Width>$($el.width)</Width>" }
|
|
||||||
if ($el.height) { X "$inner<Height>$($el.height)</Height>" }
|
|
||||||
if ($el.horizontalStretch -eq $true) { X "$inner<HorizontalStretch>true</HorizontalStretch>" }
|
|
||||||
if ($el.verticalStretch -eq $true) { X "$inner<VerticalStretch>true</VerticalStretch>" }
|
|
||||||
|
|
||||||
if ($el.inputHint) {
|
if ($el.inputHint) {
|
||||||
Emit-MLText -tag "InputHint" -text "$($el.inputHint)" -indent $inner
|
Emit-MLText -tag "InputHint" -text "$($el.inputHint)" -indent $inner
|
||||||
@@ -2183,6 +2197,8 @@ function Emit-Check {
|
|||||||
$tl = if ($el.titleLocation) { "$($el.titleLocation)" } else { "Right" }
|
$tl = if ($el.titleLocation) { "$($el.titleLocation)" } else { "Right" }
|
||||||
X "$inner<TitleLocation>$tl</TitleLocation>"
|
X "$inner<TitleLocation>$tl</TitleLocation>"
|
||||||
|
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2401,6 +2417,8 @@ function Emit-Radio {
|
|||||||
X "$inner</ChoiceList>"
|
X "$inner</ChoiceList>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2430,12 +2448,7 @@ function Emit-Label {
|
|||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
|
||||||
if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" }
|
if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" }
|
||||||
if ($el.autoMaxWidth -eq $false) { X "$inner<AutoMaxWidth>false</AutoMaxWidth>" }
|
Emit-Layout -el $el -indent $inner
|
||||||
if ($null -ne $el.maxWidth) { X "$inner<MaxWidth>$($el.maxWidth)</MaxWidth>" }
|
|
||||||
if ($el.autoMaxHeight -eq $false) { X "$inner<AutoMaxHeight>false</AutoMaxHeight>" }
|
|
||||||
if ($null -ne $el.maxHeight) { X "$inner<MaxHeight>$($el.maxHeight)</MaxHeight>" }
|
|
||||||
if ($el.width) { X "$inner<Width>$($el.width)</Width>" }
|
|
||||||
if ($el.height) { X "$inner<Height>$($el.height)</Height>" }
|
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
@@ -2458,6 +2471,7 @@ function Emit-LabelField {
|
|||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
|
||||||
if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" }
|
if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" }
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
@@ -2499,6 +2513,7 @@ function Emit-Table {
|
|||||||
if ($el.enableStartDrag -eq $true) { X "$inner<EnableStartDrag>true</EnableStartDrag>" }
|
if ($el.enableStartDrag -eq $true) { X "$inner<EnableStartDrag>true</EnableStartDrag>" }
|
||||||
if ($el.enableDrag -eq $true) { X "$inner<EnableDrag>true</EnableDrag>" }
|
if ($el.enableDrag -eq $true) { X "$inner<EnableDrag>true</EnableDrag>" }
|
||||||
if ($el.rowPictureDataPath) { X "$inner<RowPictureDataPath>$($el.rowPictureDataPath)</RowPictureDataPath>" }
|
if ($el.rowPictureDataPath) { X "$inner<RowPictureDataPath>$($el.rowPictureDataPath)</RowPictureDataPath>" }
|
||||||
|
Emit-Layout -el $el -indent $inner -skipHeight
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
@@ -2541,6 +2556,7 @@ function Emit-Pages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companion
|
# Companion
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2578,6 +2594,7 @@ function Emit-Page {
|
|||||||
}
|
}
|
||||||
if ($orientation) { X "$inner<Group>$orientation</Group>" }
|
if ($orientation) { X "$inner<Group>$orientation</Group>" }
|
||||||
}
|
}
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companion
|
# Companion
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2674,6 +2691,7 @@ function Emit-Button {
|
|||||||
if ($el.locationInCommandBar) {
|
if ($el.locationInCommandBar) {
|
||||||
X "$inner<LocationInCommandBar>$($el.locationInCommandBar)</LocationInCommandBar>"
|
X "$inner<LocationInCommandBar>$($el.locationInCommandBar)</LocationInCommandBar>"
|
||||||
}
|
}
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companion
|
# Companion
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2694,15 +2712,15 @@ function Emit-PictureDecoration {
|
|||||||
|
|
||||||
if ($el.picture -or $el.src) {
|
if ($el.picture -or $el.src) {
|
||||||
$ref = if ($el.src) { "$($el.src)" } else { "$($el.picture)" }
|
$ref = if ($el.src) { "$($el.src)" } else { "$($el.picture)" }
|
||||||
|
$lt = if ($el.loadTransparent -eq $true) { "true" } else { "false" }
|
||||||
X "$inner<Picture>"
|
X "$inner<Picture>"
|
||||||
X "$inner`t<xr:Ref>$ref</xr:Ref>"
|
X "$inner`t<xr:Ref>$ref</xr:Ref>"
|
||||||
X "$inner`t<xr:LoadTransparent>true</xr:LoadTransparent>"
|
X "$inner`t<xr:LoadTransparent>$lt</xr:LoadTransparent>"
|
||||||
X "$inner</Picture>"
|
X "$inner</Picture>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" }
|
if ($el.hyperlink -eq $true) { X "$inner<Hyperlink>true</Hyperlink>" }
|
||||||
if ($el.width) { X "$inner<Width>$($el.width)</Width>" }
|
Emit-Layout -el $el -indent $inner
|
||||||
if ($el.height) { X "$inner<Height>$($el.height)</Height>" }
|
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
@@ -2734,8 +2752,7 @@ function Emit-PictureField {
|
|||||||
X "$inner</ValuesPicture>"
|
X "$inner</ValuesPicture>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($el.width) { X "$inner<Width>$($el.width)</Width>" }
|
Emit-Layout -el $el -indent $inner
|
||||||
if ($el.height) { X "$inner<Height>$($el.height)</Height>" }
|
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
@@ -2756,6 +2773,7 @@ function Emit-Calendar {
|
|||||||
|
|
||||||
Emit-Title -el $el -name $name -indent $inner -auto:(-not $el.path)
|
Emit-Title -el $el -name $name -indent $inner -auto:(-not $el.path)
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
Emit-Companion -tag "ContextMenu" -name "${name}КонтекстноеМеню" -indent $inner
|
||||||
@@ -2775,6 +2793,7 @@ function Emit-CommandBar {
|
|||||||
if ($el.autofill -eq $true) { X "$inner<Autofill>true</Autofill>" }
|
if ($el.autofill -eq $true) { X "$inner<Autofill>true</Autofill>" }
|
||||||
|
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Children
|
# Children
|
||||||
if ($el.children -and $el.children.Count -gt 0) {
|
if ($el.children -and $el.children.Count -gt 0) {
|
||||||
@@ -2801,6 +2820,7 @@ function Emit-ButtonGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Companion: ExtendedTooltip
|
# Companion: ExtendedTooltip
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner
|
||||||
@@ -2836,6 +2856,7 @@ function Emit-Popup {
|
|||||||
if ($el.representation) {
|
if ($el.representation) {
|
||||||
X "$inner<Representation>$($el.representation)</Representation>"
|
X "$inner<Representation>$($el.representation)</Representation>"
|
||||||
}
|
}
|
||||||
|
Emit-Layout -el $el -indent $inner
|
||||||
|
|
||||||
# Children
|
# Children
|
||||||
if ($el.children -and $el.children.Count -gt 0) {
|
if ($el.children -and $el.children.Count -gt 0) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# form-compile v1.24 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.25 — 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
|
||||||
@@ -1348,6 +1348,7 @@ KNOWN_KEYS = {
|
|||||||
"titleLocation", "representation", "width", "height",
|
"titleLocation", "representation", "width", "height",
|
||||||
"horizontalStretch", "verticalStretch", "autoMaxWidth", "autoMaxHeight",
|
"horizontalStretch", "verticalStretch", "autoMaxWidth", "autoMaxHeight",
|
||||||
"maxWidth", "maxHeight",
|
"maxWidth", "maxHeight",
|
||||||
|
"groupHorizontalAlign", "groupVerticalAlign", "horizontalAlign",
|
||||||
"multiLine", "passwordMode", "choiceButton", "clearButton",
|
"multiLine", "passwordMode", "choiceButton", "clearButton",
|
||||||
"spinButton", "dropListButton", "markIncomplete", "skipOnInput", "inputHint",
|
"spinButton", "dropListButton", "markIncomplete", "skipOnInput", "inputHint",
|
||||||
"textEdit",
|
"textEdit",
|
||||||
@@ -1560,6 +1561,40 @@ def emit_common_flags(lines, el, indent):
|
|||||||
lines.append(f"{indent}<ReadOnly>true</ReadOnly>")
|
lines.append(f"{indent}<ReadOnly>true</ReadOnly>")
|
||||||
|
|
||||||
|
|
||||||
|
def emit_layout(lines, el, indent, skip_height=False, multi_line_default=False):
|
||||||
|
# Общие layout-свойства — применимы ко всем элементам. Порядок согласован
|
||||||
|
# с историческим выводом input/label, чтобы не сдвигать существующие снапшоты.
|
||||||
|
# skip_height: для Table (height → HeightInTableRows, эмитится в emit_table).
|
||||||
|
# multi_line_default: input без явного autoMaxWidth при multiLine → AutoMaxWidth=false.
|
||||||
|
if el.get('skipOnInput') is True:
|
||||||
|
lines.append(f"{indent}<SkipOnInput>true</SkipOnInput>")
|
||||||
|
if 'autoMaxWidth' in el:
|
||||||
|
if el.get('autoMaxWidth') is False:
|
||||||
|
lines.append(f"{indent}<AutoMaxWidth>false</AutoMaxWidth>")
|
||||||
|
elif multi_line_default:
|
||||||
|
lines.append(f"{indent}<AutoMaxWidth>false</AutoMaxWidth>")
|
||||||
|
if el.get('maxWidth') is not None:
|
||||||
|
lines.append(f"{indent}<MaxWidth>{el['maxWidth']}</MaxWidth>")
|
||||||
|
if el.get('autoMaxHeight') is False:
|
||||||
|
lines.append(f"{indent}<AutoMaxHeight>false</AutoMaxHeight>")
|
||||||
|
if el.get('maxHeight') is not None:
|
||||||
|
lines.append(f"{indent}<MaxHeight>{el['maxHeight']}</MaxHeight>")
|
||||||
|
if el.get('width'):
|
||||||
|
lines.append(f"{indent}<Width>{el['width']}</Width>")
|
||||||
|
if not skip_height and el.get('height'):
|
||||||
|
lines.append(f"{indent}<Height>{el['height']}</Height>")
|
||||||
|
if el.get('horizontalStretch') is True:
|
||||||
|
lines.append(f"{indent}<HorizontalStretch>true</HorizontalStretch>")
|
||||||
|
if el.get('verticalStretch') is True:
|
||||||
|
lines.append(f"{indent}<VerticalStretch>true</VerticalStretch>")
|
||||||
|
if el.get('groupHorizontalAlign'):
|
||||||
|
lines.append(f"{indent}<GroupHorizontalAlign>{el['groupHorizontalAlign']}</GroupHorizontalAlign>")
|
||||||
|
if el.get('groupVerticalAlign'):
|
||||||
|
lines.append(f"{indent}<GroupVerticalAlign>{el['groupVerticalAlign']}</GroupVerticalAlign>")
|
||||||
|
if el.get('horizontalAlign'):
|
||||||
|
lines.append(f"{indent}<HorizontalAlign>{el['horizontalAlign']}</HorizontalAlign>")
|
||||||
|
|
||||||
|
|
||||||
def title_from_name(name):
|
def title_from_name(name):
|
||||||
"""СуммаДокумента → 'Сумма документа'. НДСВключен → 'НДС включен'."""
|
"""СуммаДокумента → 'Сумма документа'. НДСВключен → 'НДС включен'."""
|
||||||
if not name:
|
if not name:
|
||||||
@@ -1862,6 +1897,7 @@ def emit_group(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{inner}<United>false</United>')
|
lines.append(f'{inner}<United>false</United>')
|
||||||
|
|
||||||
emit_common_flags(lines, el, inner)
|
emit_common_flags(lines, el, inner)
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companion: ExtendedTooltip
|
# Companion: ExtendedTooltip
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
||||||
@@ -1897,10 +1933,9 @@ def emit_column_group(lines, el, name, eid, indent):
|
|||||||
if el.get('showInHeader') is not None:
|
if el.get('showInHeader') is not None:
|
||||||
sh_val = 'true' if el['showInHeader'] else 'false'
|
sh_val = 'true' if el['showInHeader'] else 'false'
|
||||||
lines.append(f'{inner}<ShowInHeader>{sh_val}</ShowInHeader>')
|
lines.append(f'{inner}<ShowInHeader>{sh_val}</ShowInHeader>')
|
||||||
if el.get('width'):
|
|
||||||
lines.append(f'{inner}<Width>{el["width"]}</Width>')
|
|
||||||
|
|
||||||
emit_common_flags(lines, el, inner)
|
emit_common_flags(lines, el, inner)
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner)
|
||||||
|
|
||||||
@@ -1946,27 +1981,7 @@ def emit_input(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{inner}<AutoMarkIncomplete>true</AutoMarkIncomplete>')
|
lines.append(f'{inner}<AutoMarkIncomplete>true</AutoMarkIncomplete>')
|
||||||
if el.get('textEdit') is False:
|
if el.get('textEdit') is False:
|
||||||
lines.append(f'{inner}<TextEdit>false</TextEdit>')
|
lines.append(f'{inner}<TextEdit>false</TextEdit>')
|
||||||
if el.get('skipOnInput') is True:
|
emit_layout(lines, el, inner, multi_line_default=(el.get('multiLine') is True))
|
||||||
lines.append(f'{inner}<SkipOnInput>true</SkipOnInput>')
|
|
||||||
if 'autoMaxWidth' in el:
|
|
||||||
if el['autoMaxWidth'] is False:
|
|
||||||
lines.append(f'{inner}<AutoMaxWidth>false</AutoMaxWidth>')
|
|
||||||
elif el.get('multiLine') is True:
|
|
||||||
lines.append(f'{inner}<AutoMaxWidth>false</AutoMaxWidth>')
|
|
||||||
if el.get('maxWidth') is not None:
|
|
||||||
lines.append(f'{inner}<MaxWidth>{el["maxWidth"]}</MaxWidth>')
|
|
||||||
if el.get('autoMaxHeight') is False:
|
|
||||||
lines.append(f'{inner}<AutoMaxHeight>false</AutoMaxHeight>')
|
|
||||||
if el.get('maxHeight') is not None:
|
|
||||||
lines.append(f'{inner}<MaxHeight>{el["maxHeight"]}</MaxHeight>')
|
|
||||||
if el.get('width'):
|
|
||||||
lines.append(f'{inner}<Width>{el["width"]}</Width>')
|
|
||||||
if el.get('height'):
|
|
||||||
lines.append(f'{inner}<Height>{el["height"]}</Height>')
|
|
||||||
if el.get('horizontalStretch') is True:
|
|
||||||
lines.append(f'{inner}<HorizontalStretch>true</HorizontalStretch>')
|
|
||||||
if el.get('verticalStretch') is True:
|
|
||||||
lines.append(f'{inner}<VerticalStretch>true</VerticalStretch>')
|
|
||||||
|
|
||||||
if el.get('inputHint'):
|
if el.get('inputHint'):
|
||||||
emit_mltext(lines, inner, 'InputHint', str(el['inputHint']))
|
emit_mltext(lines, inner, 'InputHint', str(el['inputHint']))
|
||||||
@@ -1993,6 +2008,8 @@ def emit_check(lines, el, name, eid, indent):
|
|||||||
tl = el.get('titleLocation') or 'Right'
|
tl = el.get('titleLocation') or 'Right'
|
||||||
lines.append(f'{inner}<TitleLocation>{tl}</TitleLocation>')
|
lines.append(f'{inner}<TitleLocation>{tl}</TitleLocation>')
|
||||||
|
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
||||||
@@ -2057,6 +2074,8 @@ def emit_radio_button_field(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{item_indent}</xr:Item>')
|
lines.append(f'{item_indent}</xr:Item>')
|
||||||
lines.append(f'{inner}</ChoiceList>')
|
lines.append(f'{inner}</ChoiceList>')
|
||||||
|
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}КонтекстноеМеню', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}КонтекстноеМеню', inner)
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner)
|
||||||
|
|
||||||
@@ -2083,18 +2102,7 @@ def emit_label(lines, el, name, eid, indent):
|
|||||||
|
|
||||||
if el.get('hyperlink') is True:
|
if el.get('hyperlink') is True:
|
||||||
lines.append(f'{inner}<Hyperlink>true</Hyperlink>')
|
lines.append(f'{inner}<Hyperlink>true</Hyperlink>')
|
||||||
if el.get('autoMaxWidth') is False:
|
emit_layout(lines, el, inner)
|
||||||
lines.append(f'{inner}<AutoMaxWidth>false</AutoMaxWidth>')
|
|
||||||
if el.get('maxWidth') is not None:
|
|
||||||
lines.append(f'{inner}<MaxWidth>{el["maxWidth"]}</MaxWidth>')
|
|
||||||
if el.get('autoMaxHeight') is False:
|
|
||||||
lines.append(f'{inner}<AutoMaxHeight>false</AutoMaxHeight>')
|
|
||||||
if el.get('maxHeight') is not None:
|
|
||||||
lines.append(f'{inner}<MaxHeight>{el["maxHeight"]}</MaxHeight>')
|
|
||||||
if el.get('width'):
|
|
||||||
lines.append(f'{inner}<Width>{el["width"]}</Width>')
|
|
||||||
if el.get('height'):
|
|
||||||
lines.append(f'{inner}<Height>{el["height"]}</Height>')
|
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
||||||
@@ -2117,6 +2125,7 @@ def emit_label_field(lines, el, name, eid, indent):
|
|||||||
|
|
||||||
if el.get('hyperlink') is True:
|
if el.get('hyperlink') is True:
|
||||||
lines.append(f'{inner}<Hyperlink>true</Hyperlink>')
|
lines.append(f'{inner}<Hyperlink>true</Hyperlink>')
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
||||||
@@ -2165,6 +2174,7 @@ def emit_table(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{inner}<EnableDrag>true</EnableDrag>')
|
lines.append(f'{inner}<EnableDrag>true</EnableDrag>')
|
||||||
if el.get('rowPictureDataPath'):
|
if el.get('rowPictureDataPath'):
|
||||||
lines.append(f'{inner}<RowPictureDataPath>{el["rowPictureDataPath"]}</RowPictureDataPath>')
|
lines.append(f'{inner}<RowPictureDataPath>{el["rowPictureDataPath"]}</RowPictureDataPath>')
|
||||||
|
emit_layout(lines, el, inner, skip_height=True)
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
||||||
@@ -2202,6 +2212,7 @@ def emit_pages(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{inner}<PagesRepresentation>{el["pagesRepresentation"]}</PagesRepresentation>')
|
lines.append(f'{inner}<PagesRepresentation>{el["pagesRepresentation"]}</PagesRepresentation>')
|
||||||
|
|
||||||
emit_common_flags(lines, el, inner)
|
emit_common_flags(lines, el, inner)
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companion
|
# Companion
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
||||||
@@ -2235,6 +2246,7 @@ def emit_page(lines, el, name, eid, indent):
|
|||||||
orientation = orientation_map.get(str(el['group']))
|
orientation = orientation_map.get(str(el['group']))
|
||||||
if orientation:
|
if orientation:
|
||||||
lines.append(f'{inner}<Group>{orientation}</Group>')
|
lines.append(f'{inner}<Group>{orientation}</Group>')
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companion
|
# Companion
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
||||||
@@ -2316,6 +2328,7 @@ def emit_button(lines, el, name, eid, indent, in_cmd_bar=False):
|
|||||||
|
|
||||||
if el.get('locationInCommandBar'):
|
if el.get('locationInCommandBar'):
|
||||||
lines.append(f'{inner}<LocationInCommandBar>{el["locationInCommandBar"]}</LocationInCommandBar>')
|
lines.append(f'{inner}<LocationInCommandBar>{el["locationInCommandBar"]}</LocationInCommandBar>')
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companion
|
# Companion
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner)
|
||||||
@@ -2334,17 +2347,15 @@ def emit_picture_decoration(lines, el, name, eid, indent):
|
|||||||
|
|
||||||
if el.get('picture') or el.get('src'):
|
if el.get('picture') or el.get('src'):
|
||||||
ref = str(el.get('src') or el.get('picture'))
|
ref = str(el.get('src') or el.get('picture'))
|
||||||
|
lt = 'true' if el.get('loadTransparent') is True else 'false'
|
||||||
lines.append(f'{inner}<Picture>')
|
lines.append(f'{inner}<Picture>')
|
||||||
lines.append(f'{inner}\t<xr:Ref>{ref}</xr:Ref>')
|
lines.append(f'{inner}\t<xr:Ref>{ref}</xr:Ref>')
|
||||||
lines.append(f'{inner}\t<xr:LoadTransparent>true</xr:LoadTransparent>')
|
lines.append(f'{inner}\t<xr:LoadTransparent>{lt}</xr:LoadTransparent>')
|
||||||
lines.append(f'{inner}</Picture>')
|
lines.append(f'{inner}</Picture>')
|
||||||
|
|
||||||
if el.get('hyperlink') is True:
|
if el.get('hyperlink') is True:
|
||||||
lines.append(f'{inner}<Hyperlink>true</Hyperlink>')
|
lines.append(f'{inner}<Hyperlink>true</Hyperlink>')
|
||||||
if el.get('width'):
|
emit_layout(lines, el, inner)
|
||||||
lines.append(f'{inner}<Width>{el["width"]}</Width>')
|
|
||||||
if el.get('height'):
|
|
||||||
lines.append(f'{inner}<Height>{el["height"]}</Height>')
|
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
||||||
@@ -2375,10 +2386,7 @@ def emit_picture_field(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{inner}\t<xr:LoadTransparent>true</xr:LoadTransparent>')
|
lines.append(f'{inner}\t<xr:LoadTransparent>true</xr:LoadTransparent>')
|
||||||
lines.append(f'{inner}</ValuesPicture>')
|
lines.append(f'{inner}</ValuesPicture>')
|
||||||
|
|
||||||
if el.get('width'):
|
emit_layout(lines, el, inner)
|
||||||
lines.append(f'{inner}<Width>{el["width"]}</Width>')
|
|
||||||
if el.get('height'):
|
|
||||||
lines.append(f'{inner}<Height>{el["height"]}</Height>')
|
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
||||||
@@ -2398,6 +2406,7 @@ def emit_calendar(lines, el, name, eid, indent):
|
|||||||
|
|
||||||
emit_title(lines, el, name, inner, auto=not el.get('path'))
|
emit_title(lines, el, name, inner, auto=not el.get('path'))
|
||||||
emit_common_flags(lines, el, inner)
|
emit_common_flags(lines, el, inner)
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companions
|
# Companions
|
||||||
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
emit_companion(lines, 'ContextMenu', f'{name}\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435\u041c\u0435\u043d\u044e', inner)
|
||||||
@@ -2416,6 +2425,7 @@ def emit_command_bar(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{inner}<Autofill>true</Autofill>')
|
lines.append(f'{inner}<Autofill>true</Autofill>')
|
||||||
|
|
||||||
emit_common_flags(lines, el, inner)
|
emit_common_flags(lines, el, inner)
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Children
|
# Children
|
||||||
if el.get('children') and len(el['children']) > 0:
|
if el.get('children') and len(el['children']) > 0:
|
||||||
@@ -2442,6 +2452,7 @@ def emit_popup(lines, el, name, eid, indent):
|
|||||||
|
|
||||||
if el.get('representation'):
|
if el.get('representation'):
|
||||||
lines.append(f'{inner}<Representation>{el["representation"]}</Representation>')
|
lines.append(f'{inner}<Representation>{el["representation"]}</Representation>')
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Children
|
# Children
|
||||||
if el.get('children') and len(el['children']) > 0:
|
if el.get('children') and len(el['children']) > 0:
|
||||||
@@ -2463,6 +2474,7 @@ def emit_button_group(lines, el, name, eid, indent):
|
|||||||
lines.append(f'{inner}<Representation>{el["representation"]}</Representation>')
|
lines.append(f'{inner}<Representation>{el["representation"]}</Representation>')
|
||||||
|
|
||||||
emit_common_flags(lines, el, inner)
|
emit_common_flags(lines, el, inner)
|
||||||
|
emit_layout(lines, el, inner)
|
||||||
|
|
||||||
# Companion: ExtendedTooltip
|
# Companion: ExtendedTooltip
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner)
|
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# form-decompile v0.3 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
# form-decompile v0.4 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
|
||||||
param(
|
param(
|
||||||
@@ -184,6 +184,25 @@ function Convert-TypedValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Общие layout-свойства → в $obj (симметрично Emit-Layout компилятора).
|
||||||
|
# Вызывается один раз для любого элемента. Height тут — пиксельная высота
|
||||||
|
# (<Height>); Table хранит высоту в строках (<HeightInTableRows>) и ловит её сам.
|
||||||
|
function Add-Layout {
|
||||||
|
param($obj, $node)
|
||||||
|
if ((Get-Child $node 'SkipOnInput') -eq 'true') { $obj['skipOnInput'] = $true }
|
||||||
|
if ((Get-Child $node 'AutoMaxWidth') -eq 'false') { $obj['autoMaxWidth'] = $false }
|
||||||
|
$mw = Get-Child $node 'MaxWidth'; if ($mw) { $obj['maxWidth'] = [int]$mw }
|
||||||
|
if ((Get-Child $node 'AutoMaxHeight') -eq 'false') { $obj['autoMaxHeight'] = $false }
|
||||||
|
$mh = Get-Child $node 'MaxHeight'; if ($mh) { $obj['maxHeight'] = [int]$mh }
|
||||||
|
$w = Get-Child $node 'Width'; if ($w) { $obj['width'] = [int]$w }
|
||||||
|
$h = Get-Child $node 'Height'; if ($h) { $obj['height'] = [int]$h }
|
||||||
|
if ((Get-Child $node 'HorizontalStretch') -eq 'true') { $obj['horizontalStretch'] = $true }
|
||||||
|
if ((Get-Child $node 'VerticalStretch') -eq 'true') { $obj['verticalStretch'] = $true }
|
||||||
|
$gha = Get-Child $node 'GroupHorizontalAlign'; if ($gha) { $obj['groupHorizontalAlign'] = $gha }
|
||||||
|
$gva = Get-Child $node 'GroupVerticalAlign'; if ($gva) { $obj['groupVerticalAlign'] = $gva }
|
||||||
|
$ha = Get-Child $node 'HorizontalAlign'; if ($ha) { $obj['horizontalAlign'] = $ha }
|
||||||
|
}
|
||||||
|
|
||||||
# Суффиксы авто-имён обработчиков (инверсия компилятора)
|
# Суффиксы авто-имён обработчиков (инверсия компилятора)
|
||||||
$HANDLER_SUFFIX = @{
|
$HANDLER_SUFFIX = @{
|
||||||
'OnChange'='ПриИзменении'; 'StartChoice'='НачалоВыбора'; 'ChoiceProcessing'='ОбработкаВыбора';
|
'OnChange'='ПриИзменении'; 'StartChoice'='НачалоВыбора'; 'ChoiceProcessing'='ОбработкаВыбора';
|
||||||
@@ -396,6 +415,7 @@ function Decompile-Element {
|
|||||||
$obj[$key] = $name
|
$obj[$key] = $name
|
||||||
Add-CommonProps $obj $node $name
|
Add-CommonProps $obj $node $name
|
||||||
$ref = $node.SelectSingleNode("lf:Picture/xr:Ref", $ns); if ($ref) { $obj['src'] = $ref.InnerText }
|
$ref = $node.SelectSingleNode("lf:Picture/xr:Ref", $ns); if ($ref) { $obj['src'] = $ref.InnerText }
|
||||||
|
$lt = $node.SelectSingleNode("lf:Picture/xr:LoadTransparent", $ns); if ($lt -and $lt.InnerText -eq 'true') { $obj['loadTransparent'] = $true }
|
||||||
if ((Get-Child $node 'Hyperlink') -eq 'true') { $obj['hyperlink'] = $true }
|
if ((Get-Child $node 'Hyperlink') -eq 'true') { $obj['hyperlink'] = $true }
|
||||||
}
|
}
|
||||||
'PictureField' {
|
'PictureField' {
|
||||||
@@ -418,6 +438,7 @@ function Decompile-Element {
|
|||||||
if ((Get-Child $node 'ChangeRowOrder') -eq 'true') { $obj['changeRowOrder'] = $true }
|
if ((Get-Child $node 'ChangeRowOrder') -eq 'true') { $obj['changeRowOrder'] = $true }
|
||||||
if ((Get-Child $node 'Header') -eq 'false') { $obj['header'] = $false }
|
if ((Get-Child $node 'Header') -eq 'false') { $obj['header'] = $false }
|
||||||
if ((Get-Child $node 'Footer') -eq 'true') { $obj['footer'] = $true }
|
if ((Get-Child $node 'Footer') -eq 'true') { $obj['footer'] = $true }
|
||||||
|
$htr = Get-Child $node 'HeightInTableRows'; if ($htr) { $obj['height'] = [int]$htr }
|
||||||
$cbl = Get-Child $node 'CommandBarLocation'; if ($cbl) { $obj['commandBarLocation'] = $cbl }
|
$cbl = Get-Child $node 'CommandBarLocation'; if ($cbl) { $obj['commandBarLocation'] = $cbl }
|
||||||
$cols = Decompile-Children $node
|
$cols = Decompile-Children $node
|
||||||
if ($cols) { $obj['columns'] = $cols }
|
if ($cols) { $obj['columns'] = $cols }
|
||||||
@@ -478,6 +499,7 @@ function Decompile-Element {
|
|||||||
if ($kids) { $obj['children'] = $kids }
|
if ($kids) { $obj['children'] = $kids }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Add-Layout $obj $node
|
||||||
return $obj
|
return $obj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,6 +117,25 @@
|
|||||||
| `on` | string[] | Массив имён событий |
|
| `on` | string[] | Массив имён событий |
|
||||||
| `handlers` | object | Явные имена обработчиков: `{"OnChange": "МойОбработчик"}` |
|
| `handlers` | object | Явные имена обработчиков: `{"OnChange": "МойОбработчик"}` |
|
||||||
|
|
||||||
|
### 4.1a. Общие layout-свойства
|
||||||
|
|
||||||
|
Применимы к любому элементу (размеры, растягивание, выравнивание внутри родителя). Эмитятся только при указании.
|
||||||
|
|
||||||
|
| Свойство | XML | Значения |
|
||||||
|
|----------|-----|----------|
|
||||||
|
| `width` | `<Width>` | число |
|
||||||
|
| `height` | `<Height>` | число (у `table` → `<HeightInTableRows>`, высота в строках) |
|
||||||
|
| `horizontalStretch` | `<HorizontalStretch>` | `true` |
|
||||||
|
| `verticalStretch` | `<VerticalStretch>` | `true` |
|
||||||
|
| `autoMaxWidth` | `<AutoMaxWidth>` | `false` (у `input` при `multiLine` подставляется автоматически) |
|
||||||
|
| `autoMaxHeight` | `<AutoMaxHeight>` | `false` |
|
||||||
|
| `maxWidth` | `<MaxWidth>` | число |
|
||||||
|
| `maxHeight` | `<MaxHeight>` | число |
|
||||||
|
| `groupHorizontalAlign` | `<GroupHorizontalAlign>` | `Left`, `Center`, `Right` |
|
||||||
|
| `groupVerticalAlign` | `<GroupVerticalAlign>` | `Top`, `Center`, `Bottom` |
|
||||||
|
| `horizontalAlign` | `<HorizontalAlign>` | `Left`, `Center`, `Right` |
|
||||||
|
| `skipOnInput` | `<SkipOnInput>` | `true` |
|
||||||
|
|
||||||
### 4.2. Автоименование обработчиков
|
### 4.2. Автоименование обработчиков
|
||||||
|
|
||||||
При указании `"on"` без `"handlers"` имя обработчика генерируется автоматически:
|
При указании `"on"` без `"handlers"` имя обработчика генерируется автоматически:
|
||||||
@@ -345,6 +364,7 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs
|
|||||||
| Свойство | Тип | Описание |
|
| Свойство | Тип | Описание |
|
||||||
|----------|-----|----------|
|
|----------|-----|----------|
|
||||||
| `src` или `picture` (как свойство) | string | Ссылка на картинку |
|
| `src` или `picture` (как свойство) | string | Ссылка на картинку |
|
||||||
|
| `loadTransparent` | bool | `true` → загружать прозрачной. По умолчанию `false` |
|
||||||
| `hyperlink` | bool | Режим гиперссылки |
|
| `hyperlink` | bool | Режим гиперссылки |
|
||||||
| `width` | int | Ширина |
|
| `width` | int | Ширина |
|
||||||
| `height` | int | Высота |
|
| `height` | int | Высота |
|
||||||
|
|||||||
@@ -17,9 +17,10 @@
|
|||||||
"title": "Группы",
|
"title": "Группы",
|
||||||
"elements": [
|
"elements": [
|
||||||
{ "cmdBar": "КоманднаяПанель", "autofill": true },
|
{ "cmdBar": "КоманднаяПанель", "autofill": true },
|
||||||
{ "group": "horizontal", "name": "ГруппаШапка", "showTitle": true, "title": "Шапка", "children": [
|
{ "group": "horizontal", "name": "ГруппаШапка", "showTitle": true, "title": "Шапка", "horizontalStretch": true, "groupHorizontalAlign": "Right", "children": [
|
||||||
{ "input": "Поле1", "path": "Поле1", "title": "Поле 1" },
|
{ "input": "Поле1", "path": "Поле1", "title": "Поле 1", "width": 20, "skipOnInput": true },
|
||||||
{ "input": "Поле2", "path": "Поле2", "title": "Поле 2" }
|
{ "input": "Поле2", "path": "Поле2", "title": "Поле 2" },
|
||||||
|
{ "labelField": "Метка", "path": "Поле1", "groupVerticalAlign": "Center" }
|
||||||
]},
|
]},
|
||||||
{ "group": "vertical", "name": "ГруппаПодвал", "children": [
|
{ "group": "vertical", "name": "ГруппаПодвал", "children": [
|
||||||
{ "input": "Поле3", "path": "Поле3", "title": "Поле 3" }
|
{ "input": "Поле3", "path": "Поле3", "title": "Поле 3" }
|
||||||
|
|||||||
+19
-9
@@ -22,6 +22,8 @@
|
|||||||
</v8:item>
|
</v8:item>
|
||||||
</Title>
|
</Title>
|
||||||
<Group>Horizontal</Group>
|
<Group>Horizontal</Group>
|
||||||
|
<HorizontalStretch>true</HorizontalStretch>
|
||||||
|
<GroupHorizontalAlign>Right</GroupHorizontalAlign>
|
||||||
<ExtendedTooltip name="ГруппаШапкаРасширеннаяПодсказка" id="3"/>
|
<ExtendedTooltip name="ГруппаШапкаРасширеннаяПодсказка" id="3"/>
|
||||||
<ChildItems>
|
<ChildItems>
|
||||||
<InputField name="Поле1" id="4">
|
<InputField name="Поле1" id="4">
|
||||||
@@ -32,6 +34,8 @@
|
|||||||
<v8:content>Поле 1</v8:content>
|
<v8:content>Поле 1</v8:content>
|
||||||
</v8:item>
|
</v8:item>
|
||||||
</Title>
|
</Title>
|
||||||
|
<SkipOnInput>true</SkipOnInput>
|
||||||
|
<Width>20</Width>
|
||||||
<ContextMenu name="Поле1КонтекстноеМеню" id="5"/>
|
<ContextMenu name="Поле1КонтекстноеМеню" id="5"/>
|
||||||
<ExtendedTooltip name="Поле1РасширеннаяПодсказка" id="6"/>
|
<ExtendedTooltip name="Поле1РасширеннаяПодсказка" id="6"/>
|
||||||
</InputField>
|
</InputField>
|
||||||
@@ -46,13 +50,19 @@
|
|||||||
<ContextMenu name="Поле2КонтекстноеМеню" id="8"/>
|
<ContextMenu name="Поле2КонтекстноеМеню" id="8"/>
|
||||||
<ExtendedTooltip name="Поле2РасширеннаяПодсказка" id="9"/>
|
<ExtendedTooltip name="Поле2РасширеннаяПодсказка" id="9"/>
|
||||||
</InputField>
|
</InputField>
|
||||||
|
<LabelField name="Метка" id="10">
|
||||||
|
<DataPath>Поле1</DataPath>
|
||||||
|
<GroupVerticalAlign>Center</GroupVerticalAlign>
|
||||||
|
<ContextMenu name="МеткаКонтекстноеМеню" id="11"/>
|
||||||
|
<ExtendedTooltip name="МеткаРасширеннаяПодсказка" id="12"/>
|
||||||
|
</LabelField>
|
||||||
</ChildItems>
|
</ChildItems>
|
||||||
</UsualGroup>
|
</UsualGroup>
|
||||||
<UsualGroup name="ГруппаПодвал" id="10">
|
<UsualGroup name="ГруппаПодвал" id="13">
|
||||||
<Group>Vertical</Group>
|
<Group>Vertical</Group>
|
||||||
<ExtendedTooltip name="ГруппаПодвалРасширеннаяПодсказка" id="11"/>
|
<ExtendedTooltip name="ГруппаПодвалРасширеннаяПодсказка" id="14"/>
|
||||||
<ChildItems>
|
<ChildItems>
|
||||||
<InputField name="Поле3" id="12">
|
<InputField name="Поле3" id="15">
|
||||||
<DataPath>Поле3</DataPath>
|
<DataPath>Поле3</DataPath>
|
||||||
<Title>
|
<Title>
|
||||||
<v8:item>
|
<v8:item>
|
||||||
@@ -60,20 +70,20 @@
|
|||||||
<v8:content>Поле 3</v8:content>
|
<v8:content>Поле 3</v8:content>
|
||||||
</v8:item>
|
</v8:item>
|
||||||
</Title>
|
</Title>
|
||||||
<ContextMenu name="Поле3КонтекстноеМеню" id="13"/>
|
<ContextMenu name="Поле3КонтекстноеМеню" id="16"/>
|
||||||
<ExtendedTooltip name="Поле3РасширеннаяПодсказка" id="14"/>
|
<ExtendedTooltip name="Поле3РасширеннаяПодсказка" id="17"/>
|
||||||
</InputField>
|
</InputField>
|
||||||
</ChildItems>
|
</ChildItems>
|
||||||
</UsualGroup>
|
</UsualGroup>
|
||||||
</ChildItems>
|
</ChildItems>
|
||||||
<Attributes>
|
<Attributes>
|
||||||
<Attribute name="Объект" id="15">
|
<Attribute name="Объект" id="18">
|
||||||
<Type>
|
<Type>
|
||||||
<v8:Type>cfg:DataProcessorObject.СГруппами</v8:Type>
|
<v8:Type>cfg:DataProcessorObject.СГруппами</v8:Type>
|
||||||
</Type>
|
</Type>
|
||||||
<MainAttribute>true</MainAttribute>
|
<MainAttribute>true</MainAttribute>
|
||||||
</Attribute>
|
</Attribute>
|
||||||
<Attribute name="Поле1" id="16">
|
<Attribute name="Поле1" id="19">
|
||||||
<Title>
|
<Title>
|
||||||
<v8:item>
|
<v8:item>
|
||||||
<v8:lang>ru</v8:lang>
|
<v8:lang>ru</v8:lang>
|
||||||
@@ -88,7 +98,7 @@
|
|||||||
</v8:StringQualifiers>
|
</v8:StringQualifiers>
|
||||||
</Type>
|
</Type>
|
||||||
</Attribute>
|
</Attribute>
|
||||||
<Attribute name="Поле2" id="17">
|
<Attribute name="Поле2" id="20">
|
||||||
<Title>
|
<Title>
|
||||||
<v8:item>
|
<v8:item>
|
||||||
<v8:lang>ru</v8:lang>
|
<v8:lang>ru</v8:lang>
|
||||||
@@ -104,7 +114,7 @@
|
|||||||
</v8:NumberQualifiers>
|
</v8:NumberQualifiers>
|
||||||
</Type>
|
</Type>
|
||||||
</Attribute>
|
</Attribute>
|
||||||
<Attribute name="Поле3" id="18">
|
<Attribute name="Поле3" id="21">
|
||||||
<Title>
|
<Title>
|
||||||
<v8:item>
|
<v8:item>
|
||||||
<v8:lang>ru</v8:lang>
|
<v8:lang>ru</v8:lang>
|
||||||
|
|||||||
Reference in New Issue
Block a user