pyreportkit 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyreportkit-0.1.0.dist-info/METADATA +187 -0
- pyreportkit-0.1.0.dist-info/RECORD +222 -0
- pyreportkit-0.1.0.dist-info/WHEEL +5 -0
- pyreportkit-0.1.0.dist-info/licenses/LICENSE +21 -0
- pyreportkit-0.1.0.dist-info/top_level.txt +1 -0
- reportkit/__init__.py +0 -0
- reportkit/components/__init__.py +45 -0
- reportkit/components/document/__init__.py +6 -0
- reportkit/components/document/footer.py +12 -0
- reportkit/components/document/header.py +12 -0
- reportkit/components/document/page.py +18 -0
- reportkit/components/document/report.py +12 -0
- reportkit/components/information/__init__.py +4 -0
- reportkit/components/information/info_grid.py +23 -0
- reportkit/components/information/key_value.py +28 -0
- reportkit/components/layout/__init__.py +9 -0
- reportkit/components/layout/box.py +10 -0
- reportkit/components/layout/column.py +15 -0
- reportkit/components/layout/divider.py +10 -0
- reportkit/components/layout/grid.py +12 -0
- reportkit/components/layout/row.py +15 -0
- reportkit/components/layout/section.py +10 -0
- reportkit/components/layout/spacer.py +12 -0
- reportkit/components/media/__init__.py +4 -0
- reportkit/components/media/chart.py +14 -0
- reportkit/components/media/image.py +25 -0
- reportkit/components/pagination/__init__.py +5 -0
- reportkit/components/pagination/page_break.py +10 -0
- reportkit/components/pagination/page_count.py +10 -0
- reportkit/components/pagination/page_number.py +21 -0
- reportkit/components/table/__init__.py +7 -0
- reportkit/components/table/cell.py +27 -0
- reportkit/components/table/column.py +29 -0
- reportkit/components/table/row.py +25 -0
- reportkit/components/table/style.py +18 -0
- reportkit/components/table/table.py +27 -0
- reportkit/components/typography/__init__.py +6 -0
- reportkit/components/typography/heading.py +13 -0
- reportkit/components/typography/rich_text.py +23 -0
- reportkit/components/typography/text.py +12 -0
- reportkit/components/typography/text_span.py +24 -0
- reportkit/core/__init__.py +4 -0
- reportkit/core/component.py +12 -0
- reportkit/core/container.py +66 -0
- reportkit/core/exceptions.py +0 -0
- reportkit/core/factory.py +53 -0
- reportkit/core/registry.py +50 -0
- reportkit/core/serializer.py +90 -0
- reportkit/exporters/__init__.py +0 -0
- reportkit/exporters/base.py +17 -0
- reportkit/exporters/excel/__init__.py +8 -0
- reportkit/exporters/excel/exceptions.py +4 -0
- reportkit/exporters/excel/exporter.py +68 -0
- reportkit/exporters/excel/renderers/__init__.py +34 -0
- reportkit/exporters/excel/renderers/base.py +27 -0
- reportkit/exporters/excel/renderers/information.py +55 -0
- reportkit/exporters/excel/renderers/layout/__init__.py +7 -0
- reportkit/exporters/excel/renderers/layout/columns.py +48 -0
- reportkit/exporters/excel/renderers/layout/data.py +46 -0
- reportkit/exporters/excel/renderers/layout/page.py +24 -0
- reportkit/exporters/excel/renderers/layout/spacing.py +30 -0
- reportkit/exporters/excel/renderers/layout/stack.py +13 -0
- reportkit/exporters/excel/renderers/media.py +46 -0
- reportkit/exporters/excel/renderers/registry.py +22 -0
- reportkit/exporters/excel/renderers/table/__init__.py +4 -0
- reportkit/exporters/excel/renderers/table/cells.py +17 -0
- reportkit/exporters/excel/renderers/table/data.py +38 -0
- reportkit/exporters/excel/renderers/table/renderer.py +64 -0
- reportkit/exporters/excel/renderers/table/widths.py +29 -0
- reportkit/exporters/excel/renderers/text.py +40 -0
- reportkit/exporters/excel/styles.py +130 -0
- reportkit/exporters/excel/values/__init__.py +5 -0
- reportkit/exporters/excel/values/cells.py +60 -0
- reportkit/exporters/excel/values/components.py +16 -0
- reportkit/exporters/excel/values/formats.py +31 -0
- reportkit/exporters/excel/values/numbers.py +19 -0
- reportkit/exporters/excel/workbook/__init__.py +5 -0
- reportkit/exporters/excel/workbook/data.py +48 -0
- reportkit/exporters/excel/workbook/formatted.py +63 -0
- reportkit/exporters/excel/workbook/styles.py +27 -0
- reportkit/exporters/excel/workbook/workbook.py +65 -0
- reportkit/exporters/excel/worksheet/__init__.py +5 -0
- reportkit/exporters/excel/worksheet/borders.py +30 -0
- reportkit/exporters/excel/worksheet/cells.py +38 -0
- reportkit/exporters/excel/worksheet/constants.py +12 -0
- reportkit/exporters/excel/worksheet/data.py +51 -0
- reportkit/exporters/excel/worksheet/formatted.py +158 -0
- reportkit/exporters/excel/worksheet/page.py +23 -0
- reportkit/exporters/html/__init__.py +6 -0
- reportkit/exporters/html/assets.py +87 -0
- reportkit/exporters/html/direction.py +15 -0
- reportkit/exporters/html/engine.py +37 -0
- reportkit/exporters/html/exporter.py +38 -0
- reportkit/exporters/html/page/__init__.py +3 -0
- reportkit/exporters/html/page/components.py +47 -0
- reportkit/exporters/html/page/margins.py +24 -0
- reportkit/exporters/html/page/numbering.py +31 -0
- reportkit/exporters/html/page/resolver.py +37 -0
- reportkit/exporters/html/page/running.py +30 -0
- reportkit/exporters/html/page/styles.py +22 -0
- reportkit/exporters/html/page/validator.py +76 -0
- reportkit/exporters/html/registry.py +45 -0
- reportkit/exporters/html/renderers/__init__.py +37 -0
- reportkit/exporters/html/renderers/base.py +20 -0
- reportkit/exporters/html/renderers/document/__init__.py +6 -0
- reportkit/exporters/html/renderers/document/footer.py +18 -0
- reportkit/exporters/html/renderers/document/header.py +18 -0
- reportkit/exporters/html/renderers/document/page.py +17 -0
- reportkit/exporters/html/renderers/document/report.py +16 -0
- reportkit/exporters/html/renderers/information/__init__.py +4 -0
- reportkit/exporters/html/renderers/information/info_grid.py +26 -0
- reportkit/exporters/html/renderers/information/key_value.py +18 -0
- reportkit/exporters/html/renderers/layout/__init__.py +9 -0
- reportkit/exporters/html/renderers/layout/box.py +17 -0
- reportkit/exporters/html/renderers/layout/column.py +41 -0
- reportkit/exporters/html/renderers/layout/divider.py +16 -0
- reportkit/exporters/html/renderers/layout/grid.py +48 -0
- reportkit/exporters/html/renderers/layout/row.py +35 -0
- reportkit/exporters/html/renderers/layout/section.py +17 -0
- reportkit/exporters/html/renderers/layout/spacer.py +18 -0
- reportkit/exporters/html/renderers/media/__init__.py +3 -0
- reportkit/exporters/html/renderers/media/image.py +18 -0
- reportkit/exporters/html/renderers/pagination/__init__.py +4 -0
- reportkit/exporters/html/renderers/pagination/page_break.py +15 -0
- reportkit/exporters/html/renderers/pagination/page_number.py +15 -0
- reportkit/exporters/html/renderers/table/__init__.py +4 -0
- reportkit/exporters/html/renderers/table/cell.py +77 -0
- reportkit/exporters/html/renderers/table/table.py +69 -0
- reportkit/exporters/html/renderers/typography/__init__.py +5 -0
- reportkit/exporters/html/renderers/typography/heading.py +18 -0
- reportkit/exporters/html/renderers/typography/rich_text.py +28 -0
- reportkit/exporters/html/renderers/typography/text.py +16 -0
- reportkit/exporters/html/static/base.css +45 -0
- reportkit/exporters/html/static/information.css +83 -0
- reportkit/exporters/html/static/layout.css +81 -0
- reportkit/exporters/html/static/media.css +10 -0
- reportkit/exporters/html/static/pdf.css +96 -0
- reportkit/exporters/html/static/print.css +91 -0
- reportkit/exporters/html/static/table.css +222 -0
- reportkit/exporters/html/static/tokens.css +68 -0
- reportkit/exporters/html/static/typography.css +54 -0
- reportkit/exporters/html/styles.py +167 -0
- reportkit/exporters/html/templates/components/document/footer.html +3 -0
- reportkit/exporters/html/templates/components/document/header.html +3 -0
- reportkit/exporters/html/templates/components/document/page.html +8 -0
- reportkit/exporters/html/templates/components/document/report.html +3 -0
- reportkit/exporters/html/templates/components/information/info_grid.html +6 -0
- reportkit/exporters/html/templates/components/information/key_value.html +9 -0
- reportkit/exporters/html/templates/components/layout/box.html +3 -0
- reportkit/exporters/html/templates/components/layout/column.html +3 -0
- reportkit/exporters/html/templates/components/layout/divider.html +1 -0
- reportkit/exporters/html/templates/components/layout/grid.html +3 -0
- reportkit/exporters/html/templates/components/layout/row.html +3 -0
- reportkit/exporters/html/templates/components/layout/section.html +3 -0
- reportkit/exporters/html/templates/components/layout/spacer.html +1 -0
- reportkit/exporters/html/templates/components/media/image.html +8 -0
- reportkit/exporters/html/templates/components/pagination/page_break.html +1 -0
- reportkit/exporters/html/templates/components/pagination/page_number.html +4 -0
- reportkit/exporters/html/templates/components/table/cell.html +7 -0
- reportkit/exporters/html/templates/components/table/table.html +34 -0
- reportkit/exporters/html/templates/components/typography/heading.html +1 -0
- reportkit/exporters/html/templates/components/typography/rich_text.html +5 -0
- reportkit/exporters/html/templates/components/typography/text.html +1 -0
- reportkit/exporters/html/templates/document.html +17 -0
- reportkit/exporters/html/templates.py +30 -0
- reportkit/exporters/json.py +0 -0
- reportkit/exporters/pdf/__init__.py +8 -0
- reportkit/exporters/pdf/conversion.py +104 -0
- reportkit/exporters/pdf/dependencies.py +12 -0
- reportkit/exporters/pdf/exceptions.py +4 -0
- reportkit/exporters/pdf/exporter.py +16 -0
- reportkit/exporters/pdf/resources/__init__.py +4 -0
- reportkit/exporters/pdf/resources/fetcher.py +37 -0
- reportkit/exporters/pdf/resources/policy.py +60 -0
- reportkit/exporters/registry.py +50 -0
- reportkit/exporters/word/__init__.py +8 -0
- reportkit/exporters/word/document/__init__.py +4 -0
- reportkit/exporters/word/document/document.py +74 -0
- reportkit/exporters/word/document/engine.py +71 -0
- reportkit/exporters/word/exceptions.py +4 -0
- reportkit/exporters/word/exporter.py +32 -0
- reportkit/exporters/word/renderers/__init__.py +24 -0
- reportkit/exporters/word/renderers/base.py +56 -0
- reportkit/exporters/word/renderers/information.py +30 -0
- reportkit/exporters/word/renderers/layout/__init__.py +6 -0
- reportkit/exporters/word/renderers/layout/columns.py +82 -0
- reportkit/exporters/word/renderers/layout/page.py +38 -0
- reportkit/exporters/word/renderers/layout/spacing.py +33 -0
- reportkit/exporters/word/renderers/layout/stack.py +50 -0
- reportkit/exporters/word/renderers/media.py +49 -0
- reportkit/exporters/word/renderers/registry.py +22 -0
- reportkit/exporters/word/renderers/table/__init__.py +3 -0
- reportkit/exporters/word/renderers/table/cells.py +39 -0
- reportkit/exporters/word/renderers/table/renderer.py +95 -0
- reportkit/exporters/word/renderers/table/widths.py +12 -0
- reportkit/exporters/word/renderers/text.py +40 -0
- reportkit/exporters/word/styles/__init__.py +3 -0
- reportkit/exporters/word/styles/text.py +90 -0
- reportkit/exporters/word/styles/xml.py +147 -0
- reportkit/exporters/word/values.py +36 -0
- reportkit/formatting/__init__.py +0 -0
- reportkit/formatting/cell.py +12 -0
- reportkit/formatting/cells.py +41 -0
- reportkit/formatting/values.py +106 -0
- reportkit/rendering/__init__.py +0 -0
- reportkit/rendering/context.py +31 -0
- reportkit/rendering/table.py +56 -0
- reportkit/rendering/tracks.py +51 -0
- reportkit/rendering/visitor.py +55 -0
- reportkit/report.py +0 -0
- reportkit/styles/__init__.py +0 -0
- reportkit/styles/borders.py +6 -0
- reportkit/styles/style.py +117 -0
- reportkit/styles/table.py +37 -0
- reportkit/styles/theme.py +45 -0
- reportkit/styles/tokens.py +29 -0
- reportkit/validators/__init__.py +3 -0
- reportkit/validators/table/__init__.py +3 -0
- reportkit/validators/table/cell.py +38 -0
- reportkit/validators/table/column.py +62 -0
- reportkit/validators/table/row.py +37 -0
- reportkit/validators/table/table.py +63 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from .....components.table import TableCell
|
|
3
|
+
from .....formatting.cells import TableCellFormatter
|
|
4
|
+
from .....styles.style import Style
|
|
5
|
+
from ...direction import text_direction
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True, kw_only=True)
|
|
9
|
+
class HtmlTableCell:
|
|
10
|
+
"""
|
|
11
|
+
Hold a prepared HTML table cell.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
display: str = ""
|
|
15
|
+
content: str | None = None
|
|
16
|
+
css_class: str = ""
|
|
17
|
+
style: str = ""
|
|
18
|
+
colspan: int = 1
|
|
19
|
+
rowspan: int = 1
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def lines(self):
|
|
23
|
+
"""
|
|
24
|
+
Split display text into lines with their text directions.
|
|
25
|
+
"""
|
|
26
|
+
return [(line, text_direction(line)) for line in self.display.split("\n")]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class TableCellRenderer:
|
|
30
|
+
"""
|
|
31
|
+
Prepare table cells for HTML rendering.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def render(self, value, column, context, engine):
|
|
35
|
+
"""
|
|
36
|
+
Render a value using its column definition.
|
|
37
|
+
"""
|
|
38
|
+
if isinstance(value, TableCell):
|
|
39
|
+
return self.render_cell(value, context, engine, column)
|
|
40
|
+
formatted = TableCellFormatter.format(value, column)
|
|
41
|
+
return self.build(display=formatted.display, align=formatted.align, column=column, tone=formatted.tone, engine=engine)
|
|
42
|
+
|
|
43
|
+
def render_cell(self, cell, context, engine, column=None):
|
|
44
|
+
"""
|
|
45
|
+
Render an explicit table cell.
|
|
46
|
+
"""
|
|
47
|
+
content = "".join(engine.render(child, context) for child in cell.children) if cell.children else None
|
|
48
|
+
display = "" if cell.value is None else str(cell.value)
|
|
49
|
+
align = cell.align or (column.align if column else "start")
|
|
50
|
+
return self.build(display=display, content=content, align=align, column=column, style=cell.style, colspan=cell.colspan, rowspan=cell.rowspan, engine=engine)
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def build(cls, display, align, column, engine, content=None, tone=None, style=None, colspan=1, rowspan=1):
|
|
54
|
+
"""
|
|
55
|
+
Build the prepared HTML table cell.
|
|
56
|
+
"""
|
|
57
|
+
return HtmlTableCell(display=display, content=content, css_class=cls.get_class(column, tone), style=cls.get_style(align, column, style, engine), colspan=colspan, rowspan=rowspan)
|
|
58
|
+
|
|
59
|
+
@staticmethod
|
|
60
|
+
def get_class(column, tone=None):
|
|
61
|
+
"""
|
|
62
|
+
Get the table cell CSS classes.
|
|
63
|
+
"""
|
|
64
|
+
classes = ["rk-table-cell"]
|
|
65
|
+
if tone:
|
|
66
|
+
classes.append(f"rk-table-cell--{tone}")
|
|
67
|
+
if column and column.nowrap:
|
|
68
|
+
classes.append("rk-table-cell--nowrap")
|
|
69
|
+
return " ".join(classes)
|
|
70
|
+
|
|
71
|
+
@staticmethod
|
|
72
|
+
def get_style(align, column, style, engine):
|
|
73
|
+
"""
|
|
74
|
+
Get the resolved table cell style.
|
|
75
|
+
"""
|
|
76
|
+
base = Style(text_align=align, vertical_align=column.vertical_align if column else None)
|
|
77
|
+
return engine.styles.resolve(base.merge(style) if style else base)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from .....validators.table.table import TableValidator
|
|
2
|
+
from ...direction import text_direction
|
|
3
|
+
from ..base import BaseHtmlRenderer
|
|
4
|
+
from .cell import TableCellRenderer
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TableRenderer(BaseHtmlRenderer):
|
|
8
|
+
"""
|
|
9
|
+
Render tables, headers and rows using TableCellRenderer.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
template_name = "components/table/table.html"
|
|
13
|
+
|
|
14
|
+
def __init__(self, cells=None):
|
|
15
|
+
"""
|
|
16
|
+
Initialize the table cell renderer.
|
|
17
|
+
"""
|
|
18
|
+
self.cells = cells if cells is not None else TableCellRenderer()
|
|
19
|
+
|
|
20
|
+
def render(self, component, context, engine):
|
|
21
|
+
"""
|
|
22
|
+
Render the table.
|
|
23
|
+
"""
|
|
24
|
+
style = engine.styles.resolve(context.resolve_style(component))
|
|
25
|
+
rows = self.prepare_rows(component, context, engine)
|
|
26
|
+
footer = self.prepare_row(component.footer, component.columns, context, engine) if component.footer else None
|
|
27
|
+
header = [self.prepare_header(column) for column in component.columns]
|
|
28
|
+
return engine.templates.render(self.template_name, container_class=self.get_container_class(component.table_style), table_class=self.get_class(component.table_style), columns=component.columns, header=header, caption=component.header, rows=rows, footer=footer, show_header=component.table_style.show_header, style=style)
|
|
29
|
+
|
|
30
|
+
def prepare_rows(self, component, context, engine):
|
|
31
|
+
"""
|
|
32
|
+
Prepare table rows lazily.
|
|
33
|
+
"""
|
|
34
|
+
for row in component.rows:
|
|
35
|
+
yield self.prepare_row(row, component.columns, context, engine)
|
|
36
|
+
|
|
37
|
+
def prepare_row(self, row, columns, context, engine):
|
|
38
|
+
"""
|
|
39
|
+
Prepare one table row.
|
|
40
|
+
"""
|
|
41
|
+
TableValidator.validate_row(row)
|
|
42
|
+
if row.cells is not None:
|
|
43
|
+
cells = [self.cells.render_cell(cell, context, engine) for cell in row.cells]
|
|
44
|
+
else:
|
|
45
|
+
cells = [self.cells.render(row.values.get(column.key), column, context, engine) for column in columns]
|
|
46
|
+
return {"css_class": f"rk-table-row rk-table-{row.kind}", "style": engine.styles.resolve(row.style), "cells": cells}
|
|
47
|
+
|
|
48
|
+
@staticmethod
|
|
49
|
+
def prepare_header(column):
|
|
50
|
+
"""
|
|
51
|
+
Prepare one table header cell.
|
|
52
|
+
"""
|
|
53
|
+
return {"title": column.title, "subtitle": column.subtitle, "title_dir": text_direction(column.title), "subtitle_dir": text_direction(column.subtitle), "align": column.header_align or column.align, "nowrap": column.nowrap}
|
|
54
|
+
|
|
55
|
+
@staticmethod
|
|
56
|
+
def get_class(table_style):
|
|
57
|
+
"""
|
|
58
|
+
Get the table CSS classes.
|
|
59
|
+
"""
|
|
60
|
+
flags = ("bordered", "striped", "hover", "compact", "ruled", "repeat_header", "avoid_row_break")
|
|
61
|
+
names = [f"rk-table--{flag.replace('_', '-')}" for flag in flags if getattr(table_style, flag)]
|
|
62
|
+
return " ".join(["rk-table", f"rk-table--layout-{table_style.layout}", *names])
|
|
63
|
+
|
|
64
|
+
@staticmethod
|
|
65
|
+
def get_container_class(table_style):
|
|
66
|
+
"""
|
|
67
|
+
Get the table container CSS classes.
|
|
68
|
+
"""
|
|
69
|
+
return "rk-table-container rk-table-container--ruled" if table_style.ruled else "rk-table-container"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from ..base import BaseHtmlRenderer
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class HeadingRenderer(BaseHtmlRenderer):
|
|
5
|
+
"""
|
|
6
|
+
Render heading components using HTML templates.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
template_name = "components/typography/heading.html"
|
|
10
|
+
|
|
11
|
+
def render(self, component, context, engine):
|
|
12
|
+
"""
|
|
13
|
+
Render a heading with its resolved visual style.
|
|
14
|
+
"""
|
|
15
|
+
if not 1 <= component.level <= 6:
|
|
16
|
+
raise ValueError("Heading level must be between 1 and 6.")
|
|
17
|
+
style = engine.styles.resolve(context.resolve_style(component))
|
|
18
|
+
return engine.templates.render(self.template_name, component=component, style=style)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from ..base import BaseHtmlRenderer
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class RichTextRenderer(BaseHtmlRenderer):
|
|
5
|
+
"""
|
|
6
|
+
Render styled text fragments into HTML.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
template_name = "components/typography/rich_text.html"
|
|
10
|
+
|
|
11
|
+
def render(self, component, context, engine):
|
|
12
|
+
"""
|
|
13
|
+
Render rich text with independently styled spans.
|
|
14
|
+
"""
|
|
15
|
+
style = engine.styles.resolve(context.resolve_style(component))
|
|
16
|
+
spans = [self.prepare_span(span, engine) for span in component.spans]
|
|
17
|
+
return engine.templates.render(self.template_name, spans=spans, align=component.align, style=style)
|
|
18
|
+
|
|
19
|
+
def prepare_span(self, span, engine):
|
|
20
|
+
"""
|
|
21
|
+
Prepare one text fragment for rendering.
|
|
22
|
+
"""
|
|
23
|
+
return {
|
|
24
|
+
"value": span.value,
|
|
25
|
+
"style": engine.styles.resolve(span.style),
|
|
26
|
+
"language": span.language,
|
|
27
|
+
"direction": span.direction,
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from ..base import BaseHtmlRenderer
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TextRenderer(BaseHtmlRenderer):
|
|
5
|
+
"""
|
|
6
|
+
Render text components using HTML templates.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
template_name = "components/typography/text.html"
|
|
10
|
+
|
|
11
|
+
def render(self, component, context, engine):
|
|
12
|
+
"""
|
|
13
|
+
Render text with its resolved visual style.
|
|
14
|
+
"""
|
|
15
|
+
style = engine.styles.resolve(context.resolve_style(component))
|
|
16
|
+
return engine.templates.render(self.template_name, component=component, style=style)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
html {
|
|
8
|
+
background: #f1f5f9;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
body {
|
|
12
|
+
margin: 0;
|
|
13
|
+
color: var(--rk-color-text);
|
|
14
|
+
font-family: var(--rk-font-family);
|
|
15
|
+
font-size: var(--rk-font-md);
|
|
16
|
+
line-height: 1.7;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.rk-report {
|
|
20
|
+
max-width: 210mm;
|
|
21
|
+
margin: 0 auto;
|
|
22
|
+
padding: 0;
|
|
23
|
+
background: var(--rk-color-surface);
|
|
24
|
+
border: 1px solid var(--rk-color-border);
|
|
25
|
+
border-radius: var(--rk-radius-lg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.rk-page {
|
|
29
|
+
min-width: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.rk-divider {
|
|
33
|
+
height: 1px;
|
|
34
|
+
margin: var(--rk-space-5) 0;
|
|
35
|
+
border: 0;
|
|
36
|
+
background: var(--rk-color-border);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[dir="rtl"] {
|
|
40
|
+
text-align: right;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[dir="ltr"] {
|
|
44
|
+
text-align: left;
|
|
45
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
.rk-key-value {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
gap: 8px;
|
|
7
|
+
min-width: 0;
|
|
8
|
+
padding: 7px 10px;
|
|
9
|
+
border-bottom: 1px solid var(--rk-color-border);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.rk-key-value--vertical {
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
align-items: stretch;
|
|
15
|
+
justify-content: flex-start;
|
|
16
|
+
gap: 4px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.rk-key-value__labels {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 6px;
|
|
24
|
+
min-width: 0;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.rk-key-value--vertical .rk-key-value__labels {
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: stretch;
|
|
31
|
+
gap: 3px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rk-key-value__label {
|
|
35
|
+
font-size: 11px;
|
|
36
|
+
line-height: 1.4;
|
|
37
|
+
color: var(--rk-color-muted);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rk-key-value__secondary {
|
|
41
|
+
font-size: 10px;
|
|
42
|
+
line-height: 1.4;
|
|
43
|
+
color: var(--rk-color-muted);
|
|
44
|
+
opacity: 0.85;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.rk-key-value__value {
|
|
48
|
+
min-width: 0;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
line-height: 1.4;
|
|
52
|
+
overflow-wrap: anywhere;
|
|
53
|
+
font-variant-numeric: tabular-nums;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.rk-info-grid {
|
|
57
|
+
display: grid;
|
|
58
|
+
grid-template-columns: repeat(var(--rk-info-columns), minmax(0, 1fr));
|
|
59
|
+
gap: var(--rk-info-gap);
|
|
60
|
+
width: 100%;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.rk-info-grid > * {
|
|
65
|
+
min-width: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (max-width: 640px) {
|
|
69
|
+
.rk-info-grid {
|
|
70
|
+
grid-template-columns: 1fr;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media print {
|
|
75
|
+
.rk-key-value {
|
|
76
|
+
break-inside: avoid;
|
|
77
|
+
page-break-inside: avoid;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.rk-info-grid {
|
|
81
|
+
break-inside: auto;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
.rk-section {
|
|
3
|
+
margin-bottom: var(--rk-space-6);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.rk-box {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
min-width: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.rk-box > *:first-child {
|
|
12
|
+
margin-top: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rk-box > *:last-child {
|
|
16
|
+
margin-bottom: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.rk-row {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
align-items: flex-start;
|
|
23
|
+
gap: var(--rk-space-4);
|
|
24
|
+
min-width: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.rk-row > * {
|
|
28
|
+
min-width: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.rk-column {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: stretch;
|
|
35
|
+
gap: var(--rk-space-4);
|
|
36
|
+
min-width: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.rk-column > * {
|
|
40
|
+
min-width: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.rk-grid {
|
|
44
|
+
display: grid;
|
|
45
|
+
grid-template-columns: minmax(0, 1fr);
|
|
46
|
+
gap: var(--rk-space-4);
|
|
47
|
+
width: 100%;
|
|
48
|
+
min-width: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.rk-grid > * {
|
|
52
|
+
min-width: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.rk-spacer {
|
|
56
|
+
display: block;
|
|
57
|
+
width: 100%;
|
|
58
|
+
flex-shrink: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.rk-divider {
|
|
62
|
+
display: block;
|
|
63
|
+
width: 100%;
|
|
64
|
+
height: 0;
|
|
65
|
+
margin: var(--rk-space-4) 0;
|
|
66
|
+
border: 0;
|
|
67
|
+
border-top: 1px solid var(--rk-color-border);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.rk-card {
|
|
71
|
+
padding: var(--rk-space-5);
|
|
72
|
+
background: var(--rk-color-surface);
|
|
73
|
+
border: 1px solid var(--rk-color-border);
|
|
74
|
+
border-radius: var(--rk-radius-md);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.rk-surface {
|
|
78
|
+
padding: var(--rk-space-4);
|
|
79
|
+
background: var(--rk-color-subtle);
|
|
80
|
+
border-radius: var(--rk-radius-md);
|
|
81
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* PDF-only rules (loaded by PdfExporter, never by the browser).
|
|
3
|
+
* WeasyPrint 70 ignores `direction` when placing grid items, so RTL grids are mirrored explicitly:
|
|
4
|
+
* child k of an N-column row goes to column N - k + 1, and dense flow keeps every row filled in order.
|
|
5
|
+
*/
|
|
6
|
+
.rk-grid--rtl {
|
|
7
|
+
grid-auto-flow: row dense;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rk-grid--rtl.rk-grid--cols-2 > :nth-child(2n+1) { grid-column: 2; }
|
|
11
|
+
.rk-grid--rtl.rk-grid--cols-2 > :nth-child(2n+2) { grid-column: 1; }
|
|
12
|
+
|
|
13
|
+
.rk-grid--rtl.rk-grid--cols-3 > :nth-child(3n+1) { grid-column: 3; }
|
|
14
|
+
.rk-grid--rtl.rk-grid--cols-3 > :nth-child(3n+2) { grid-column: 2; }
|
|
15
|
+
.rk-grid--rtl.rk-grid--cols-3 > :nth-child(3n+3) { grid-column: 1; }
|
|
16
|
+
|
|
17
|
+
.rk-grid--rtl.rk-grid--cols-4 > :nth-child(4n+1) { grid-column: 4; }
|
|
18
|
+
.rk-grid--rtl.rk-grid--cols-4 > :nth-child(4n+2) { grid-column: 3; }
|
|
19
|
+
.rk-grid--rtl.rk-grid--cols-4 > :nth-child(4n+3) { grid-column: 2; }
|
|
20
|
+
.rk-grid--rtl.rk-grid--cols-4 > :nth-child(4n+4) { grid-column: 1; }
|
|
21
|
+
|
|
22
|
+
.rk-grid--rtl.rk-grid--cols-5 > :nth-child(5n+1) { grid-column: 5; }
|
|
23
|
+
.rk-grid--rtl.rk-grid--cols-5 > :nth-child(5n+2) { grid-column: 4; }
|
|
24
|
+
.rk-grid--rtl.rk-grid--cols-5 > :nth-child(5n+3) { grid-column: 3; }
|
|
25
|
+
.rk-grid--rtl.rk-grid--cols-5 > :nth-child(5n+4) { grid-column: 2; }
|
|
26
|
+
.rk-grid--rtl.rk-grid--cols-5 > :nth-child(5n+5) { grid-column: 1; }
|
|
27
|
+
|
|
28
|
+
.rk-grid--rtl.rk-grid--cols-6 > :nth-child(6n+1) { grid-column: 6; }
|
|
29
|
+
.rk-grid--rtl.rk-grid--cols-6 > :nth-child(6n+2) { grid-column: 5; }
|
|
30
|
+
.rk-grid--rtl.rk-grid--cols-6 > :nth-child(6n+3) { grid-column: 4; }
|
|
31
|
+
.rk-grid--rtl.rk-grid--cols-6 > :nth-child(6n+4) { grid-column: 3; }
|
|
32
|
+
.rk-grid--rtl.rk-grid--cols-6 > :nth-child(6n+5) { grid-column: 2; }
|
|
33
|
+
.rk-grid--rtl.rk-grid--cols-6 > :nth-child(6n+6) { grid-column: 1; }
|
|
34
|
+
|
|
35
|
+
.rk-grid--rtl.rk-grid--cols-7 > :nth-child(7n+1) { grid-column: 7; }
|
|
36
|
+
.rk-grid--rtl.rk-grid--cols-7 > :nth-child(7n+2) { grid-column: 6; }
|
|
37
|
+
.rk-grid--rtl.rk-grid--cols-7 > :nth-child(7n+3) { grid-column: 5; }
|
|
38
|
+
.rk-grid--rtl.rk-grid--cols-7 > :nth-child(7n+4) { grid-column: 4; }
|
|
39
|
+
.rk-grid--rtl.rk-grid--cols-7 > :nth-child(7n+5) { grid-column: 3; }
|
|
40
|
+
.rk-grid--rtl.rk-grid--cols-7 > :nth-child(7n+6) { grid-column: 2; }
|
|
41
|
+
.rk-grid--rtl.rk-grid--cols-7 > :nth-child(7n+7) { grid-column: 1; }
|
|
42
|
+
|
|
43
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+1) { grid-column: 8; }
|
|
44
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+2) { grid-column: 7; }
|
|
45
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+3) { grid-column: 6; }
|
|
46
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+4) { grid-column: 5; }
|
|
47
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+5) { grid-column: 4; }
|
|
48
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+6) { grid-column: 3; }
|
|
49
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+7) { grid-column: 2; }
|
|
50
|
+
.rk-grid--rtl.rk-grid--cols-8 > :nth-child(8n+8) { grid-column: 1; }
|
|
51
|
+
|
|
52
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+1) { grid-column: 9; }
|
|
53
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+2) { grid-column: 8; }
|
|
54
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+3) { grid-column: 7; }
|
|
55
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+4) { grid-column: 6; }
|
|
56
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+5) { grid-column: 5; }
|
|
57
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+6) { grid-column: 4; }
|
|
58
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+7) { grid-column: 3; }
|
|
59
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+8) { grid-column: 2; }
|
|
60
|
+
.rk-grid--rtl.rk-grid--cols-9 > :nth-child(9n+9) { grid-column: 1; }
|
|
61
|
+
|
|
62
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+1) { grid-column: 10; }
|
|
63
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+2) { grid-column: 9; }
|
|
64
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+3) { grid-column: 8; }
|
|
65
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+4) { grid-column: 7; }
|
|
66
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+5) { grid-column: 6; }
|
|
67
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+6) { grid-column: 5; }
|
|
68
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+7) { grid-column: 4; }
|
|
69
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+8) { grid-column: 3; }
|
|
70
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+9) { grid-column: 2; }
|
|
71
|
+
.rk-grid--rtl.rk-grid--cols-10 > :nth-child(10n+10) { grid-column: 1; }
|
|
72
|
+
|
|
73
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+1) { grid-column: 11; }
|
|
74
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+2) { grid-column: 10; }
|
|
75
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+3) { grid-column: 9; }
|
|
76
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+4) { grid-column: 8; }
|
|
77
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+5) { grid-column: 7; }
|
|
78
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+6) { grid-column: 6; }
|
|
79
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+7) { grid-column: 5; }
|
|
80
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+8) { grid-column: 4; }
|
|
81
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+9) { grid-column: 3; }
|
|
82
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+10) { grid-column: 2; }
|
|
83
|
+
.rk-grid--rtl.rk-grid--cols-11 > :nth-child(11n+11) { grid-column: 1; }
|
|
84
|
+
|
|
85
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+1) { grid-column: 12; }
|
|
86
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+2) { grid-column: 11; }
|
|
87
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+3) { grid-column: 10; }
|
|
88
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+4) { grid-column: 9; }
|
|
89
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+5) { grid-column: 8; }
|
|
90
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+6) { grid-column: 7; }
|
|
91
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+7) { grid-column: 6; }
|
|
92
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+8) { grid-column: 5; }
|
|
93
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+9) { grid-column: 4; }
|
|
94
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+10) { grid-column: 3; }
|
|
95
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+11) { grid-column: 2; }
|
|
96
|
+
.rk-grid--rtl.rk-grid--cols-12 > :nth-child(12n+12) { grid-column: 1; }
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
@page {
|
|
2
|
+
size: A4;
|
|
3
|
+
margin: 15mm;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.rk-page {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
width: 100%;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
max-width: 210mm;
|
|
11
|
+
min-height: 297mm;
|
|
12
|
+
margin: 0 auto;
|
|
13
|
+
padding: 10mm;
|
|
14
|
+
background: #ffffff;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.rk-page[data-page-orientation="landscape"] {
|
|
18
|
+
max-width: 297mm;
|
|
19
|
+
min-height: 210mm;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.rk-page-break {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rk-header {
|
|
27
|
+
width: 100%;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.rk-footer {
|
|
32
|
+
width: 100%;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media print {
|
|
37
|
+
html,
|
|
38
|
+
body {
|
|
39
|
+
background: #ffffff;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.rk-report {
|
|
43
|
+
max-width: none;
|
|
44
|
+
margin: 0;
|
|
45
|
+
padding: 0;
|
|
46
|
+
border: none;
|
|
47
|
+
border-radius: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.rk-card {
|
|
51
|
+
break-inside: avoid;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.rk-page-break {
|
|
55
|
+
break-after: page;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rk-no-print {
|
|
59
|
+
display: none !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rk-page {
|
|
63
|
+
max-width: none;
|
|
64
|
+
min-height: 0;
|
|
65
|
+
padding: 0;
|
|
66
|
+
break-after: page;
|
|
67
|
+
page-break-after: always;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.rk-page:last-child {
|
|
71
|
+
break-after: auto;
|
|
72
|
+
page-break-after: auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.rk-page-break {
|
|
76
|
+
display: block;
|
|
77
|
+
break-before: page;
|
|
78
|
+
page-break-before: always;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.rk-page-number {
|
|
82
|
+
font-size: 11px;
|
|
83
|
+
color: #64748b;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.rk-header,
|
|
87
|
+
.rk-footer {
|
|
88
|
+
break-inside: avoid;
|
|
89
|
+
page-break-inside: avoid;
|
|
90
|
+
}
|
|
91
|
+
}
|