fix(skd-compile): widths-unwrap и indent в template cell appearance

Две bug-фиксы для шаблонов:

1. PS-quirk: \$widths = if (\$t.widths) { @(\$t.widths) } else { @() }
   разворачивал одно-элементный массив в строку, после чего \$widths[0]
   возвращал первый Char (например '1' для "15.625"), а [double][Char]'1'=49.
   Заменил if-expression на обычный if-statement.

2. Indent в <dcsat:appearance>: компайлер ставил 4 таба вместо 5
   (и 5 вместо 6 у items внутри). Поправлено в обоих рантаймах.

sample30: −552 строки (2666 → 2114).
This commit is contained in:
Nick Shirokov
2026-05-23 17:18:50 +03:00
parent 5793f91ebb
commit 5ca8ce2b64
21 changed files with 2715 additions and 2738 deletions
@@ -1304,8 +1304,8 @@ def _emit_color_value(lines, color, indent):
def _emit_cell_appearance(lines, style, width=0, v_merge=False, h_merge=False, min_height=0, extra_items=None):
ind = '\t\t\t\t\t'
lines.append('\t\t\t\t<dcsat:appearance>')
ind = '\t\t\t\t\t\t'
lines.append('\t\t\t\t\t<dcsat:appearance>')
# Background color
if style.get('bgColor'):
lines.append(f'{ind}<dcscor:item>')
@@ -1396,7 +1396,7 @@ def _emit_cell_appearance(lines, style, width=0, v_merge=False, h_merge=False, m
if extra_items:
for ei in extra_items:
lines.append(ei)
lines.append('\t\t\t\t</dcsat:appearance>')
lines.append('\t\t\t\t\t</dcsat:appearance>')
# Cell может быть string ("text"/"{param}"/"|"/">"/null) или объектом {value, style}.
@@ -1501,10 +1501,10 @@ def _emit_area_template_dsl(lines, t):
# Build drilldown appearance extra items
if param_name in drilldown_map:
dd_val = drilldown_map[param_name]
cell_extra_items.append('\t\t\t\t\t<dcscor:item>')
cell_extra_items.append(f'\t\t\t\t\t\t<dcscor:parameter>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430</dcscor:parameter>')
cell_extra_items.append(f'\t\t\t\t\t\t<dcscor:value xsi:type="dcscor:Parameter">\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430_{dd_val}</dcscor:value>')
cell_extra_items.append('\t\t\t\t\t</dcscor:item>')
cell_extra_items.append('\t\t\t\t\t\t<dcscor:item>')
cell_extra_items.append(f'\t\t\t\t\t\t\t<dcscor:parameter>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430</dcscor:parameter>')
cell_extra_items.append(f'\t\t\t\t\t\t\t<dcscor:value xsi:type="dcscor:Parameter">\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430_{dd_val}</dcscor:value>')
cell_extra_items.append('\t\t\t\t\t\t</dcscor:item>')
else:
lines.append('\t\t\t\t\t<dcsat:item xsi:type="dcsat:Field">')
emit_mltext(lines, '\t\t\t\t\t\t', 'dcsat:value', cell_str)