mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-18 00:29:42 +03:00
feat(form-decompile,form-compile): HorizontalLocation у CommandBar (хвост дополнений)
Свойство horizontalLocation у элемента cmdBar (<CommandBar>): auto (дефолт, не эмитим) / left / right / center, forgiving + рус.синонимы. Переиспользует Get-HLocation от дополнений (+ добавлен center). Только у <CommandBar> в корпусе (104 шт, в осн. Right), не у ButtonGroup/Popup/AutoCommandBar. Компилятор (ps1+py байт-в-байт) + декомпилятор (захват <HorizontalLocation>). Форма с CommandBar HorizontalLocation → round-trip match. Кейс commands расширен, сертифицирован в 1С. Регресс 39/39 ps1+py. Закрывает остаток CommandBar>HorizontalLocation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# form-compile v1.74 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.75 — 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,
|
||||||
@@ -2351,6 +2351,7 @@ function Get-HLocation {
|
|||||||
'^(auto|авто)$' { return $null } # дефолт — не эмитим
|
'^(auto|авто)$' { return $null } # дефолт — не эмитим
|
||||||
'^(left|слева|лево)$' { return 'Left' }
|
'^(left|слева|лево)$' { return 'Left' }
|
||||||
'^(right|справа|право)$' { return 'Right' }
|
'^(right|справа|право)$' { return 'Right' }
|
||||||
|
'^(center|центр|по центру)$' { return 'Center' }
|
||||||
default { return "$v" }
|
default { return "$v" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3997,6 +3998,7 @@ function Emit-CommandBar {
|
|||||||
|
|
||||||
if ($el.autofill -eq $true) { X "$inner<Autofill>true</Autofill>" }
|
if ($el.autofill -eq $true) { X "$inner<Autofill>true</Autofill>" }
|
||||||
|
|
||||||
|
$hl = Get-HLocation $el; if ($hl) { X "$inner<HorizontalLocation>$hl</HorizontalLocation>" }
|
||||||
Emit-CommonFlags -el $el -indent $inner
|
Emit-CommonFlags -el $el -indent $inner
|
||||||
Emit-Layout -el $el -indent $inner
|
Emit-Layout -el $el -indent $inner
|
||||||
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip
|
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# form-compile v1.74 — Compile 1C managed form from JSON or object metadata
|
# form-compile v1.75 — 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
|
||||||
@@ -2369,6 +2369,8 @@ def get_hlocation(el):
|
|||||||
return 'Left'
|
return 'Left'
|
||||||
if s in ('right', 'справа', 'право'):
|
if s in ('right', 'справа', 'право'):
|
||||||
return 'Right'
|
return 'Right'
|
||||||
|
if s in ('center', 'центр', 'по центру'):
|
||||||
|
return 'Center'
|
||||||
return str(v)
|
return str(v)
|
||||||
|
|
||||||
|
|
||||||
@@ -3700,6 +3702,10 @@ def emit_command_bar(lines, el, name, eid, indent):
|
|||||||
if el.get('autofill') is True:
|
if el.get('autofill') is True:
|
||||||
lines.append(f'{inner}<Autofill>true</Autofill>')
|
lines.append(f'{inner}<Autofill>true</Autofill>')
|
||||||
|
|
||||||
|
_hl = get_hlocation(el)
|
||||||
|
if _hl:
|
||||||
|
lines.append(f'{inner}<HorizontalLocation>{_hl}</HorizontalLocation>')
|
||||||
|
|
||||||
emit_common_flags(lines, el, inner)
|
emit_common_flags(lines, el, inner)
|
||||||
emit_layout(lines, el, inner)
|
emit_layout(lines, el, inner)
|
||||||
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner, el.get('extendedTooltip'))
|
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner, el.get('extendedTooltip'))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# form-decompile v0.51 — Decompile 1C managed Form.xml to JSON DSL (draft)
|
# form-decompile v0.52 — 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(
|
||||||
@@ -1539,6 +1539,7 @@ function Decompile-Element {
|
|||||||
$obj[$key] = $name
|
$obj[$key] = $name
|
||||||
Add-CommonProps $obj $node $name
|
Add-CommonProps $obj $node $name
|
||||||
$cs = Get-Child $node 'CommandSource'; if ($cs) { $obj['commandSource'] = $cs }
|
$cs = Get-Child $node 'CommandSource'; if ($cs) { $obj['commandSource'] = $cs }
|
||||||
|
$hl = Get-Child $node 'HorizontalLocation'; if ($hl) { $obj['horizontalLocation'] = $hl.ToLower() }
|
||||||
if ((Get-Child $node 'Autofill') -eq 'true') { $obj['autofill'] = $true }
|
if ((Get-Child $node 'Autofill') -eq 'true') { $obj['autofill'] = $true }
|
||||||
$kids = Decompile-Children $node
|
$kids = Decompile-Children $node
|
||||||
if ($kids) { $obj['children'] = $kids }
|
if ($kids) { $obj['children'] = $kids }
|
||||||
|
|||||||
@@ -667,9 +667,11 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs
|
|||||||
#### cmdBar — CommandBar
|
#### cmdBar — CommandBar
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{ "cmdBar": "КоманднаяПанель", "children": [ ... ] }
|
{ "cmdBar": "КоманднаяПанель", "horizontalLocation": "right", "children": [ ... ] }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Свойства: `commandSource`, `autofill`, `horizontalLocation` (`<HorizontalLocation>`: `auto` дефолт / `left` / `right` / `center`, + рус. синонимы), `title`, `children` + общие флаги/layout.
|
||||||
|
|
||||||
#### popup — Popup
|
#### popup — Popup
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"input": {
|
"input": {
|
||||||
"title": "Форма с командами",
|
"title": "Форма с командами",
|
||||||
"elements": [
|
"elements": [
|
||||||
{ "cmdBar": "Панель", "children": [
|
{ "cmdBar": "Панель", "horizontalLocation": "right", "children": [
|
||||||
{ "button": "Выполнить", "command": "Выполнить", "defaultButton": true },
|
{ "button": "Выполнить", "command": "Выполнить", "defaultButton": true },
|
||||||
{ "button": "Закрыть", "stdCommand": "Close" }
|
{ "button": "Закрыть", "stdCommand": "Close" }
|
||||||
]},
|
]},
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@
|
|||||||
</AutoCommandBar>
|
</AutoCommandBar>
|
||||||
<ChildItems>
|
<ChildItems>
|
||||||
<CommandBar name="Панель" id="1">
|
<CommandBar name="Панель" id="1">
|
||||||
|
<HorizontalLocation>Right</HorizontalLocation>
|
||||||
<ExtendedTooltip name="ПанельРасширеннаяПодсказка" id="2"/>
|
<ExtendedTooltip name="ПанельРасширеннаяПодсказка" id="2"/>
|
||||||
<ChildItems>
|
<ChildItems>
|
||||||
<Button name="Выполнить" id="3">
|
<Button name="Выполнить" id="3">
|
||||||
|
|||||||
Reference in New Issue
Block a user