grid-view-spec 2.0.0__tar.gz
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.
- grid_view_spec-2.0.0/LICENSE +21 -0
- grid_view_spec-2.0.0/PKG-INFO +195 -0
- grid_view_spec-2.0.0/README.md +125 -0
- grid_view_spec-2.0.0/pyproject.toml +142 -0
- grid_view_spec-2.0.0/setup.cfg +4 -0
- grid_view_spec-2.0.0/src/grid_view_spec/__init__.py +23 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/__init__.py +43 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/ag_grid/__init__.py +26 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/ag_grid/export.py +26 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/ag_grid/server.py +235 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/apps.py +18 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/assets.py +152 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/conf.py +117 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/export.py +89 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/facets.py +68 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/grid_preferences.py +16 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/host.py +88 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/hrefs.py +30 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/i18n.py +24 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/lazy.py +60 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/migrations/0001_initial.py +33 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/migrations/__init__.py +0 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/models.py +26 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/pdf_response.py +16 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/prefs.py +53 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/queryset_search.py +112 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/search.py +47 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/templatetags.py +119 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/throttle.py +111 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/urls.py +35 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/views.py +242 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/django/wire_templates.py +31 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/fastapi/router.py +38 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/fragment/html.py +107 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/jinja2/renderer.py +21 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/json/__init__.py +5 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/json/wire.py +59 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/starlette/host.py +23 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/starlette/routes.py +31 -0
- grid_view_spec-2.0.0/src/grid_view_spec/backends/starlette/static.py +38 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/__init__.py +49 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/charts_png.py +51 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/columns.py +90 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/context.py +124 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/html.py +72 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/meta.py +120 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/payload.py +79 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/pdf/backends.py +44 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/pipeline.py +131 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/print.py +161 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/registry.py +100 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/rows.py +103 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/static_charts.py +216 -0
- grid_view_spec-2.0.0/src/grid_view_spec/export/xlsx.py +286 -0
- grid_view_spec-2.0.0/src/grid_view_spec/hosts/__init__.py +20 -0
- grid_view_spec-2.0.0/src/grid_view_spec/hosts/base.py +17 -0
- grid_view_spec-2.0.0/src/grid_view_spec/hosts/memory.py +77 -0
- grid_view_spec-2.0.0/src/grid_view_spec/i18n.py +118 -0
- grid_view_spec-2.0.0/src/grid_view_spec/locale/en/LC_MESSAGES/django.mo +0 -0
- grid_view_spec-2.0.0/src/grid_view_spec/locale/en/LC_MESSAGES/django.po +324 -0
- grid_view_spec-2.0.0/src/grid_view_spec/locale/uk/LC_MESSAGES/django.mo +0 -0
- grid_view_spec-2.0.0/src/grid_view_spec/locale/uk/LC_MESSAGES/django.po +330 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/__init__.py +23 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/__main__.py +10 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/a2ui.py +337 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/catalog.py +388 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/envelope.py +64 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/examples.py +131 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/fixtures.py +1188 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/normalize.py +62 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/schema.py +138 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/server.py +158 -0
- grid_view_spec-2.0.0/src/grid_view_spec/mcp/validate.py +48 -0
- grid_view_spec-2.0.0/src/grid_view_spec/py.typed +1 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/__init__.py +16 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/a2ui.py +277 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/action_urls.py +218 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/ag_grid.py +92 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/bind.py +101 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/block_registry.py +103 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/chart_runtime.py +51 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/chart_spec.py +97 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/charts_bind.py +265 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/column_settings.py +137 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/context.py +43 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/jinja.py +31 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/lazy.py +25 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/refs.py +25 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/request_state.py +109 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/row_template.py +53 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/spec_renderer.py +335 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/tab_panes.py +52 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/table_chart.py +36 -0
- grid_view_spec-2.0.0/src/grid_view_spec/render/table_edit.py +56 -0
- grid_view_spec-2.0.0/src/grid_view_spec/schema/grid-view-spec.v2.json +871 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/__init__.py +7 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/column.py +35 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/column_meta.py +35 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/column_scope.py +82 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/contract.py +318 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/engine.py +223 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/facet_registry.py +91 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/facets.py +166 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/params.py +8 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/query_commit.py +28 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/smart.py +319 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/syntax_tips.py +83 -0
- grid_view_spec-2.0.0/src/grid_view_spec/search/term_match.py +197 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-ag-grid-cdn.js +16 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-ag-grid-cdn.min.js +1 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-ag-grid-theme.css +250 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-ag-grid-theme.min.css +1 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-ag-grid.js +1965 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-ag-grid.min.js +1 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-charts.js +577 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec-charts.min.js +3 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec.css +3662 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec.js +7000 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec.min.css +1 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/gridviewspec.min.js +3 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/vendor/ag-grid-community.min.js +1 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/vendor/ag-grid.css +8644 -0
- grid_view_spec-2.0.0/src/grid_view_spec/static/grid_view_spec/vendor/ag-theme-quartz.css +865 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/export/base.html +67 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/export/blocks/charts.html +7 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/export/blocks/table.html +60 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/export/spec_report.html +12 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/assets/ag_grid_js.html +9 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/assets/css.html +15 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/assets/js.html +54 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/_action_button.html +12 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/_action_link.html +12 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/_column_settings_panel.html +25 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/_filter_bar.html +57 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/_icon.html +10 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/_semantic.html +17 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/actions.html +36 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/block.html +30 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/card_groups.html +17 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/cards.html +38 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/charts.html +15 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/content.html +15 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/filters.html +4 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/form.html +5 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/gallery.html +5 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/header.html +60 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/image.html +3 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/kpi.html +14 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/lazy_placeholder.html +9 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/nav.html +5 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/overlay.html +3 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/spec.html +46 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/table.html +336 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/table_pagination.html +106 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/tabs.html +47 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/template.html +7 -0
- grid_view_spec-2.0.0/src/grid_view_spec/templates/grid_view/spec/toolbar.html +175 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/__init__.py +183 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/a2ui.py +53 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/actions.py +81 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/ag_grid.py +45 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/assets.py +19 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/block_base.py +60 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/blocks.py +42 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/chart_palette.py +21 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/chart_server.py +106 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/chart_wire.py +81 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/content.py +215 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/filters_v2.py +160 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/form.py +122 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/grid_settings.py +13 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/header.py +47 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/host.py +47 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/json.py +50 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/layout.py +68 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/lazy.py +55 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/media.py +56 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/narrowing.py +13 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/nav.py +29 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/numbers.py +47 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/overlay.py +30 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/result.py +46 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/semantic.py +43 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/spec.py +32 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/spec_meta.py +22 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/table_v2.py +219 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/toolbar.py +58 -0
- grid_view_spec-2.0.0/src/grid_view_spec/types/wire.py +37 -0
- grid_view_spec-2.0.0/src/grid_view_spec/validate/__init__.py +31 -0
- grid_view_spec-2.0.0/src/grid_view_spec/validate/chart_options.py +21 -0
- grid_view_spec-2.0.0/src/grid_view_spec/validate/codes.py +32 -0
- grid_view_spec-2.0.0/src/grid_view_spec/validate/normalize.py +37 -0
- grid_view_spec-2.0.0/src/grid_view_spec/validate/refs.py +139 -0
- grid_view_spec-2.0.0/src/grid_view_spec/validate/validate.py +706 -0
- grid_view_spec-2.0.0/src/grid_view_spec/validate/wire.py +155 -0
- grid_view_spec-2.0.0/src/grid_view_spec/wire_decode.py +1054 -0
- grid_view_spec-2.0.0/src/grid_view_spec.egg-info/PKG-INFO +195 -0
- grid_view_spec-2.0.0/src/grid_view_spec.egg-info/SOURCES.txt +244 -0
- grid_view_spec-2.0.0/src/grid_view_spec.egg-info/dependency_links.txt +1 -0
- grid_view_spec-2.0.0/src/grid_view_spec.egg-info/entry_points.txt +2 -0
- grid_view_spec-2.0.0/src/grid_view_spec.egg-info/requires.txt +53 -0
- grid_view_spec-2.0.0/src/grid_view_spec.egg-info/top_level.txt +1 -0
- grid_view_spec-2.0.0/tests/test_ag_grid_assets.py +271 -0
- grid_view_spec-2.0.0/tests/test_ag_grid_expr_filter.py +77 -0
- grid_view_spec-2.0.0/tests/test_ag_grid_server.py +113 -0
- grid_view_spec-2.0.0/tests/test_ag_grid_spec_config.py +54 -0
- grid_view_spec-2.0.0/tests/test_chart_assets.py +43 -0
- grid_view_spec-2.0.0/tests/test_conf.py +98 -0
- grid_view_spec-2.0.0/tests/test_export_charts_png.py +141 -0
- grid_view_spec-2.0.0/tests/test_export_throttle.py +61 -0
- grid_view_spec-2.0.0/tests/test_facets.py +224 -0
- grid_view_spec-2.0.0/tests/test_grid_view_i18n.py +105 -0
- grid_view_spec-2.0.0/tests/test_grid_view_spec_assets.py +26 -0
- grid_view_spec-2.0.0/tests/test_grid_view_spec_tag_library.py +28 -0
- grid_view_spec-2.0.0/tests/test_grid_view_spec_urls.py +39 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_a2ui.py +127 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_assets.py +111 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_card_groups.py +86 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_column_settings.py +160 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_django_backend.py +28 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_django_search.py +76 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_django_views.py +217 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_docs_contract.py +43 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_edit.py +171 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_export.py +285 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_export_actions.py +227 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_hosts_memory.py +27 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_mcp.py +342 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_normalize.py +50 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_render_context.py +150 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_render_html.py +182 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_roundtrip.py +71 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_saved_searches.py +76 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_schema_drift.py +174 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_semantic_content.py +204 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_table_empty_state.py +68 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_table_interactive.py +134 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_tabs.py +141 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_typing_boundaries.py +109 -0
- grid_view_spec-2.0.0/tests/test_gridviewspec_validate.py +572 -0
- grid_view_spec-2.0.0/tests/test_kpi_conformance.py +32 -0
- grid_view_spec-2.0.0/tests/test_llm_context_build.py +24 -0
- grid_view_spec-2.0.0/tests/test_models.py +24 -0
- grid_view_spec-2.0.0/tests/test_search_operators.py +44 -0
- grid_view_spec-2.0.0/tests/test_templates.py +70 -0
- grid_view_spec-2.0.0/tests/test_ts_schema_parity.py +37 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oleksii Pylypchuk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: grid-view-spec
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Declarative GridViewSpec pages: tables, filters, KPI, charts, PDF/XLSX export; optional Django backend
|
|
5
|
+
Author-email: Oleksii Pylypchuk <alpi@keemail.me>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/alpiua/grid-view-spec
|
|
8
|
+
Project-URL: Repository, https://github.com/alpiua/grid-view-spec
|
|
9
|
+
Project-URL: Documentation, https://alpiua.github.io/grid-view-spec/
|
|
10
|
+
Project-URL: Issues, https://github.com/alpiua/grid-view-spec/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/alpiua/grid-view-spec/blob/main/CHANGELOG.md
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Web Environment
|
|
14
|
+
Classifier: Framework :: Django
|
|
15
|
+
Classifier: Framework :: Django :: 5
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: jinja2>=3.1
|
|
27
|
+
Provides-Extra: django
|
|
28
|
+
Requires-Dist: django<6.0,>=4.2; extra == "django"
|
|
29
|
+
Provides-Extra: mcp
|
|
30
|
+
Requires-Dist: fastmcp>=2.0.0; extra == "mcp"
|
|
31
|
+
Provides-Extra: starlette
|
|
32
|
+
Requires-Dist: starlette>=0.40; extra == "starlette"
|
|
33
|
+
Provides-Extra: fastapi
|
|
34
|
+
Requires-Dist: fastapi>=0.115; extra == "fastapi"
|
|
35
|
+
Requires-Dist: starlette>=0.40; extra == "fastapi"
|
|
36
|
+
Provides-Extra: static-charts
|
|
37
|
+
Requires-Dist: matplotlib>=3.8; extra == "static-charts"
|
|
38
|
+
Provides-Extra: pdf
|
|
39
|
+
Requires-Dist: weasyprint>=62; extra == "pdf"
|
|
40
|
+
Requires-Dist: jinja2>=3.1; extra == "pdf"
|
|
41
|
+
Provides-Extra: xlsx
|
|
42
|
+
Requires-Dist: xlsxwriter>=3.2.0; extra == "xlsx"
|
|
43
|
+
Provides-Extra: xlsx-all
|
|
44
|
+
Requires-Dist: xlsxwriter>=3.2.0; extra == "xlsx-all"
|
|
45
|
+
Requires-Dist: openpyxl>=3.1; extra == "xlsx-all"
|
|
46
|
+
Provides-Extra: docs
|
|
47
|
+
Requires-Dist: mkdocs>=1.6; extra == "docs"
|
|
48
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: basedpyright>=1.28.0; extra == "dev"
|
|
51
|
+
Requires-Dist: build>=1.2.0; extra == "dev"
|
|
52
|
+
Requires-Dist: django<6.0,>=4.2; extra == "dev"
|
|
53
|
+
Requires-Dist: django-stubs>=5.1.0; extra == "dev"
|
|
54
|
+
Requires-Dist: jinja2>=3.1; extra == "dev"
|
|
55
|
+
Requires-Dist: matplotlib>=3.8; extra == "dev"
|
|
56
|
+
Requires-Dist: matplotlib-stubs>=0.3.11; extra == "dev"
|
|
57
|
+
Requires-Dist: mkdocs>=1.6; extra == "dev"
|
|
58
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "dev"
|
|
59
|
+
Requires-Dist: openpyxl>=3.1; extra == "dev"
|
|
60
|
+
Requires-Dist: pre-commit>=4.0.0; extra == "dev"
|
|
61
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
62
|
+
Requires-Dist: pytest-django>=4.8.0; extra == "dev"
|
|
63
|
+
Requires-Dist: jsonschema>=4.23.0; extra == "dev"
|
|
64
|
+
Requires-Dist: ruff>=0.8.0; extra == "dev"
|
|
65
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
66
|
+
Requires-Dist: typing_extensions>=4.12.0; extra == "dev"
|
|
67
|
+
Requires-Dist: weasyprint>=62; extra == "dev"
|
|
68
|
+
Requires-Dist: xlsxwriter>=3.2.0; extra == "dev"
|
|
69
|
+
Dynamic: license-file
|
|
70
|
+
|
|
71
|
+
# Grid View Spec
|
|
72
|
+
|
|
73
|
+
[](https://pypi.org/project/grid-view-spec/)
|
|
74
|
+
[](https://pypi.org/project/grid-view-spec/)
|
|
75
|
+
[](https://alpiua.github.io/grid-view-spec/)
|
|
76
|
+
[](LICENSE)
|
|
77
|
+
|
|
78
|
+
**Declarative dashboard pages for Django and other hosts** — tables, filters, KPI strips, charts, and export from one typed **`GridViewSpec`** contract. You own SQL/ORM rows; the package owns layout, templates, browser runtime, and PDF/XLSX pipelines.
|
|
79
|
+
|
|
80
|
+
**[Documentation](https://alpiua.github.io/grid-view-spec/)** · **[MCP server](docs/tools/mcp-server.md)** · **[PyPI](https://pypi.org/project/grid-view-spec/)**
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Core idea
|
|
85
|
+
|
|
86
|
+
| Layer | Owner |
|
|
87
|
+
|-------|--------|
|
|
88
|
+
| **Data** | Host — querysets, aggregates, authorization |
|
|
89
|
+
| **Spec** | `GridViewSpec` — blocks (`GridViewTable`, `GridViewFilters`, …) + layout |
|
|
90
|
+
| **Render** | Package — Jinja/Django HTML, `gridviewspec.min.js`, export |
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from grid_view_spec import GridViewSpec, validate_spec
|
|
94
|
+
from grid_view_spec.types.layout import GridViewArea, GridViewLayout
|
|
95
|
+
from grid_view_spec.types.table_v2 import GridViewColumn, GridViewTable
|
|
96
|
+
|
|
97
|
+
spec = GridViewSpec(
|
|
98
|
+
id="orders",
|
|
99
|
+
blocks=(
|
|
100
|
+
GridViewTable(
|
|
101
|
+
id="orders_table",
|
|
102
|
+
backend="simple",
|
|
103
|
+
columns=(
|
|
104
|
+
GridViewColumn(id="name", label="Customer", field="name"),
|
|
105
|
+
GridViewColumn(id="amount", label="Amount", field="amount", type="currency"),
|
|
106
|
+
),
|
|
107
|
+
),
|
|
108
|
+
),
|
|
109
|
+
layout=GridViewLayout(root=GridViewArea(id="root", blocks=("orders_table",))),
|
|
110
|
+
)
|
|
111
|
+
validate_spec(spec)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```django
|
|
115
|
+
{% load grid_view_spec %}
|
|
116
|
+
{% grid_view_spec_assets part='css' %}
|
|
117
|
+
{% render_grid_view_spec spec rows %}
|
|
118
|
+
{% grid_view_spec_assets part='js' force_core=True %}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Install
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pip install "grid-view-spec[django]"
|
|
127
|
+
# optional:
|
|
128
|
+
pip install "grid-view-spec[django,pdf,xlsx,mcp]"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Django**
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
INSTALLED_APPS = ["grid_view_spec.backends.django"]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
python manage.py migrate grid_view_spec_django
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
urlpatterns = [
|
|
143
|
+
path("", include("grid_view_spec.backends.django.urls")),
|
|
144
|
+
]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
See [Getting started](docs/getting-started.md) and [Django integration](docs/integration/django.md).
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Export
|
|
152
|
+
|
|
153
|
+
Register builders that return **`GridViewExportJob(spec, rows, table_id=…)`**:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from grid_view_spec.export.registry import register_pdf_export, register_xlsx_export
|
|
157
|
+
from grid_view_spec.export.registry import GridViewExportJob
|
|
158
|
+
|
|
159
|
+
def register_exports():
|
|
160
|
+
def builder(host, ctx):
|
|
161
|
+
page = load_orders_page(ctx) # same loader as HTML view
|
|
162
|
+
return GridViewExportJob(spec=page.spec, rows=page.rows, table_id="orders_table")
|
|
163
|
+
|
|
164
|
+
register_pdf_export("orders", builder)
|
|
165
|
+
register_xlsx_export("orders", builder)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Browser links use `?builder=orders` plus current filter query params. Details: [Export page pattern](docs/export/page-pattern.md).
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## AG-Grid, charts, MCP
|
|
173
|
+
|
|
174
|
+
- **AG-Grid** — `GridViewTable(backend="ag_grid")` + host JSON API; helpers in `grid_view_spec.backends.django.ag_grid`
|
|
175
|
+
- **Charts / KPI** — spec blocks + ECharts; values always from host `rows`
|
|
176
|
+
- **MCP** — `gridviewspec-mcp` for validation, catalog, migration hints ([tools/mcp-server.md](docs/tools/mcp-server.md))
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
uv sync
|
|
184
|
+
uv run pytest -q
|
|
185
|
+
uv run basedpyright --warnings src/grid_view_spec tests
|
|
186
|
+
cd frontend && npm run build && npm run typecheck
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Pre-commit hooks: ruff, basedpyright, frontend typecheck/eslint, pytest.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Grid View Spec
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/grid-view-spec/)
|
|
4
|
+
[](https://pypi.org/project/grid-view-spec/)
|
|
5
|
+
[](https://alpiua.github.io/grid-view-spec/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
**Declarative dashboard pages for Django and other hosts** — tables, filters, KPI strips, charts, and export from one typed **`GridViewSpec`** contract. You own SQL/ORM rows; the package owns layout, templates, browser runtime, and PDF/XLSX pipelines.
|
|
9
|
+
|
|
10
|
+
**[Documentation](https://alpiua.github.io/grid-view-spec/)** · **[MCP server](docs/tools/mcp-server.md)** · **[PyPI](https://pypi.org/project/grid-view-spec/)**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Core idea
|
|
15
|
+
|
|
16
|
+
| Layer | Owner |
|
|
17
|
+
|-------|--------|
|
|
18
|
+
| **Data** | Host — querysets, aggregates, authorization |
|
|
19
|
+
| **Spec** | `GridViewSpec` — blocks (`GridViewTable`, `GridViewFilters`, …) + layout |
|
|
20
|
+
| **Render** | Package — Jinja/Django HTML, `gridviewspec.min.js`, export |
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from grid_view_spec import GridViewSpec, validate_spec
|
|
24
|
+
from grid_view_spec.types.layout import GridViewArea, GridViewLayout
|
|
25
|
+
from grid_view_spec.types.table_v2 import GridViewColumn, GridViewTable
|
|
26
|
+
|
|
27
|
+
spec = GridViewSpec(
|
|
28
|
+
id="orders",
|
|
29
|
+
blocks=(
|
|
30
|
+
GridViewTable(
|
|
31
|
+
id="orders_table",
|
|
32
|
+
backend="simple",
|
|
33
|
+
columns=(
|
|
34
|
+
GridViewColumn(id="name", label="Customer", field="name"),
|
|
35
|
+
GridViewColumn(id="amount", label="Amount", field="amount", type="currency"),
|
|
36
|
+
),
|
|
37
|
+
),
|
|
38
|
+
),
|
|
39
|
+
layout=GridViewLayout(root=GridViewArea(id="root", blocks=("orders_table",))),
|
|
40
|
+
)
|
|
41
|
+
validate_spec(spec)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```django
|
|
45
|
+
{% load grid_view_spec %}
|
|
46
|
+
{% grid_view_spec_assets part='css' %}
|
|
47
|
+
{% render_grid_view_spec spec rows %}
|
|
48
|
+
{% grid_view_spec_assets part='js' force_core=True %}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install "grid-view-spec[django]"
|
|
57
|
+
# optional:
|
|
58
|
+
pip install "grid-view-spec[django,pdf,xlsx,mcp]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Django**
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
INSTALLED_APPS = ["grid_view_spec.backends.django"]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
python manage.py migrate grid_view_spec_django
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
urlpatterns = [
|
|
73
|
+
path("", include("grid_view_spec.backends.django.urls")),
|
|
74
|
+
]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See [Getting started](docs/getting-started.md) and [Django integration](docs/integration/django.md).
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Export
|
|
82
|
+
|
|
83
|
+
Register builders that return **`GridViewExportJob(spec, rows, table_id=…)`**:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from grid_view_spec.export.registry import register_pdf_export, register_xlsx_export
|
|
87
|
+
from grid_view_spec.export.registry import GridViewExportJob
|
|
88
|
+
|
|
89
|
+
def register_exports():
|
|
90
|
+
def builder(host, ctx):
|
|
91
|
+
page = load_orders_page(ctx) # same loader as HTML view
|
|
92
|
+
return GridViewExportJob(spec=page.spec, rows=page.rows, table_id="orders_table")
|
|
93
|
+
|
|
94
|
+
register_pdf_export("orders", builder)
|
|
95
|
+
register_xlsx_export("orders", builder)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Browser links use `?builder=orders` plus current filter query params. Details: [Export page pattern](docs/export/page-pattern.md).
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## AG-Grid, charts, MCP
|
|
103
|
+
|
|
104
|
+
- **AG-Grid** — `GridViewTable(backend="ag_grid")` + host JSON API; helpers in `grid_view_spec.backends.django.ag_grid`
|
|
105
|
+
- **Charts / KPI** — spec blocks + ECharts; values always from host `rows`
|
|
106
|
+
- **MCP** — `gridviewspec-mcp` for validation, catalog, migration hints ([tools/mcp-server.md](docs/tools/mcp-server.md))
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uv sync
|
|
114
|
+
uv run pytest -q
|
|
115
|
+
uv run basedpyright --warnings src/grid_view_spec tests
|
|
116
|
+
cd frontend && npm run build && npm run typecheck
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Pre-commit hooks: ruff, basedpyright, frontend typecheck/eslint, pytest.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "grid-view-spec"
|
|
3
|
+
version = "2.0.0"
|
|
4
|
+
description = "Declarative GridViewSpec pages: tables, filters, KPI, charts, PDF/XLSX export; optional Django backend"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Oleksii Pylypchuk", email = "alpi@keemail.me" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Environment :: Web Environment",
|
|
15
|
+
"Framework :: Django",
|
|
16
|
+
"Framework :: Django :: 5",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"jinja2>=3.1",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/alpiua/grid-view-spec"
|
|
31
|
+
Repository = "https://github.com/alpiua/grid-view-spec"
|
|
32
|
+
Documentation = "https://alpiua.github.io/grid-view-spec/"
|
|
33
|
+
Issues = "https://github.com/alpiua/grid-view-spec/issues"
|
|
34
|
+
Changelog = "https://github.com/alpiua/grid-view-spec/blob/main/CHANGELOG.md"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
gridviewspec-mcp = "grid_view_spec.mcp.server:main"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
django = ["django>=4.2,<6.0"]
|
|
41
|
+
mcp = ["fastmcp>=2.0.0"]
|
|
42
|
+
starlette = ["starlette>=0.40"]
|
|
43
|
+
fastapi = ["fastapi>=0.115", "starlette>=0.40"]
|
|
44
|
+
static-charts = ["matplotlib>=3.8"]
|
|
45
|
+
pdf = ["weasyprint>=62", "jinja2>=3.1"]
|
|
46
|
+
xlsx = ["xlsxwriter>=3.2.0"]
|
|
47
|
+
xlsx-all = ["xlsxwriter>=3.2.0", "openpyxl>=3.1"]
|
|
48
|
+
docs = [
|
|
49
|
+
"mkdocs>=1.6",
|
|
50
|
+
"mkdocs-material>=9.5",
|
|
51
|
+
]
|
|
52
|
+
# Mirror of [dependency-groups] dev — for pip install grid-view-spec[dev,mcp]
|
|
53
|
+
dev = [
|
|
54
|
+
"basedpyright>=1.28.0",
|
|
55
|
+
"build>=1.2.0",
|
|
56
|
+
"django>=4.2,<6.0",
|
|
57
|
+
"django-stubs>=5.1.0",
|
|
58
|
+
"jinja2>=3.1",
|
|
59
|
+
"matplotlib>=3.8",
|
|
60
|
+
"matplotlib-stubs>=0.3.11",
|
|
61
|
+
"mkdocs>=1.6",
|
|
62
|
+
"mkdocs-material>=9.5",
|
|
63
|
+
"openpyxl>=3.1",
|
|
64
|
+
"pre-commit>=4.0.0",
|
|
65
|
+
"pytest>=8.0.0",
|
|
66
|
+
"pytest-django>=4.8.0",
|
|
67
|
+
"jsonschema>=4.23.0",
|
|
68
|
+
"ruff>=0.8.0",
|
|
69
|
+
"twine>=5.0.0",
|
|
70
|
+
"typing_extensions>=4.12.0",
|
|
71
|
+
"weasyprint>=62",
|
|
72
|
+
"xlsxwriter>=3.2.0",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[dependency-groups]
|
|
76
|
+
dev = [
|
|
77
|
+
"basedpyright>=1.28.0",
|
|
78
|
+
"build>=1.2.0",
|
|
79
|
+
"django>=4.2,<6.0",
|
|
80
|
+
"django-stubs>=5.1.0",
|
|
81
|
+
"jinja2>=3.1",
|
|
82
|
+
"matplotlib>=3.8",
|
|
83
|
+
"matplotlib-stubs>=0.3.11",
|
|
84
|
+
"mkdocs>=1.6",
|
|
85
|
+
"mkdocs-material>=9.5",
|
|
86
|
+
"openpyxl>=3.1",
|
|
87
|
+
"pre-commit>=4.0.0",
|
|
88
|
+
"pytest>=8.0.0",
|
|
89
|
+
"pytest-django>=4.8.0",
|
|
90
|
+
"jsonschema>=4.23.0",
|
|
91
|
+
"fastmcp>=2.0.0",
|
|
92
|
+
"ruff>=0.8.0",
|
|
93
|
+
"twine>=5.0.0",
|
|
94
|
+
"typing_extensions>=4.12.0",
|
|
95
|
+
"weasyprint>=62",
|
|
96
|
+
"xlsxwriter>=3.2.0",
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
[tool.uv]
|
|
100
|
+
default-groups = ["dev"]
|
|
101
|
+
|
|
102
|
+
[build-system]
|
|
103
|
+
requires = ["setuptools>=77.0"]
|
|
104
|
+
build-backend = "setuptools.build_meta"
|
|
105
|
+
|
|
106
|
+
[tool.setuptools.packages.find]
|
|
107
|
+
where = ["src"]
|
|
108
|
+
|
|
109
|
+
[tool.setuptools.package-data]
|
|
110
|
+
grid_view_spec = [
|
|
111
|
+
"py.typed",
|
|
112
|
+
"templates/**/*.html",
|
|
113
|
+
"schema/*.json",
|
|
114
|
+
"static/**/*",
|
|
115
|
+
"locale/**/*.po",
|
|
116
|
+
"locale/**/*.mo",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
[tool.pytest.ini_options]
|
|
120
|
+
addopts = "--ds=tests.settings"
|
|
121
|
+
pythonpath = ["src", ".", "tests"]
|
|
122
|
+
testpaths = ["tests"]
|
|
123
|
+
python_files = ["test_*.py"]
|
|
124
|
+
|
|
125
|
+
[tool.ruff]
|
|
126
|
+
target-version = "py311"
|
|
127
|
+
line-length = 100
|
|
128
|
+
exclude = ["*/migrations/*"]
|
|
129
|
+
|
|
130
|
+
[tool.django-stubs]
|
|
131
|
+
django_settings_module = "tests.settings"
|
|
132
|
+
|
|
133
|
+
[tool.basedpyright]
|
|
134
|
+
include = ["src/grid_view_spec", "tests"]
|
|
135
|
+
exclude = ["**/migrations/**", "**/__pycache__/**", "hooks/**"]
|
|
136
|
+
typeCheckingMode = "strict"
|
|
137
|
+
pythonVersion = "3.11"
|
|
138
|
+
reportMissingTypeStubs = false
|
|
139
|
+
stubPath = "typings"
|
|
140
|
+
|
|
141
|
+
[tool.ruff.lint]
|
|
142
|
+
select = ["E", "F", "I", "UP"]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Framework-agnostic GridViewSpec vNext contract (grid-view-spec 2.x)."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
from grid_view_spec.types import GridViewBlock, GridViewSpec, GridViewTable, GridViewToolbar
|
|
6
|
+
from grid_view_spec.validate import normalize_spec, spec_from_wire, spec_to_wire, validate_spec
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
__version__ = version("grid-view-spec")
|
|
10
|
+
except PackageNotFoundError:
|
|
11
|
+
__version__ = "2.0.0"
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"GridViewBlock",
|
|
15
|
+
"GridViewSpec",
|
|
16
|
+
"GridViewTable",
|
|
17
|
+
"GridViewToolbar",
|
|
18
|
+
"__version__",
|
|
19
|
+
"normalize_spec",
|
|
20
|
+
"spec_from_wire",
|
|
21
|
+
"spec_to_wire",
|
|
22
|
+
"validate_spec",
|
|
23
|
+
]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Django host backend adapters."""
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from grid_view_spec.backends.django.host import DjangoGridViewHost
|
|
6
|
+
from grid_view_spec.backends.django.prefs import DjangoOrmPrefs
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from grid_view_spec.backends.django.views import (
|
|
10
|
+
django_host,
|
|
11
|
+
export_pdf,
|
|
12
|
+
export_xlsx,
|
|
13
|
+
load_lazy_block,
|
|
14
|
+
render_lazy_block_response,
|
|
15
|
+
save_grid_prefs,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"DjangoGridViewHost",
|
|
20
|
+
"DjangoOrmPrefs",
|
|
21
|
+
"django_host",
|
|
22
|
+
"export_pdf",
|
|
23
|
+
"export_xlsx",
|
|
24
|
+
"load_lazy_block",
|
|
25
|
+
"render_lazy_block_response",
|
|
26
|
+
"save_grid_prefs",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def __getattr__(name: str) -> object:
|
|
31
|
+
if name in {
|
|
32
|
+
"django_host",
|
|
33
|
+
"export_pdf",
|
|
34
|
+
"export_xlsx",
|
|
35
|
+
"load_lazy_block",
|
|
36
|
+
"render_lazy_block_response",
|
|
37
|
+
"save_grid_prefs",
|
|
38
|
+
}:
|
|
39
|
+
from grid_view_spec.backends.django import views
|
|
40
|
+
|
|
41
|
+
return getattr(views, name)
|
|
42
|
+
msg = f"module {__name__!r} has no attribute {name!r}"
|
|
43
|
+
raise AttributeError(msg)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""AG-Grid infinite row model — server-side query helpers."""
|
|
2
|
+
|
|
3
|
+
from grid_view_spec.backends.django.ag_grid.export import (
|
|
4
|
+
EXPORT_COLS_PARAM,
|
|
5
|
+
parse_active_col_ids,
|
|
6
|
+
resolve_export_columns,
|
|
7
|
+
)
|
|
8
|
+
from grid_view_spec.backends.django.ag_grid.server import (
|
|
9
|
+
InfiniteGridParams,
|
|
10
|
+
apply_grid_filters,
|
|
11
|
+
apply_grid_sort,
|
|
12
|
+
parse_infinite_params,
|
|
13
|
+
)
|
|
14
|
+
from grid_view_spec.types.ag_grid import AgGridColumnSpec, AgGridPageSpec
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"AgGridColumnSpec",
|
|
18
|
+
"AgGridPageSpec",
|
|
19
|
+
"EXPORT_COLS_PARAM",
|
|
20
|
+
"InfiniteGridParams",
|
|
21
|
+
"apply_grid_filters",
|
|
22
|
+
"apply_grid_sort",
|
|
23
|
+
"parse_active_col_ids",
|
|
24
|
+
"parse_infinite_params",
|
|
25
|
+
"resolve_export_columns",
|
|
26
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Resolve AG-Grid export columns from page spec + optional live grid snapshot."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from django.http import HttpRequest
|
|
6
|
+
from grid_view_spec.types.ag_grid import AgGridPageSpec
|
|
7
|
+
|
|
8
|
+
EXPORT_COLS_PARAM = "export_cols"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def parse_active_col_ids(
|
|
12
|
+
request: HttpRequest,
|
|
13
|
+
*,
|
|
14
|
+
param: str = EXPORT_COLS_PARAM,
|
|
15
|
+
) -> tuple[str, ...]:
|
|
16
|
+
"""Read comma-separated active column ids synced from the browser grid."""
|
|
17
|
+
raw = request.GET.get(param, "")
|
|
18
|
+
return tuple(col_id.strip() for col_id in raw.split(",") if col_id.strip())
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def resolve_export_columns(
|
|
22
|
+
spec: AgGridPageSpec,
|
|
23
|
+
request: HttpRequest,
|
|
24
|
+
) -> list[str]:
|
|
25
|
+
"""Resolve export column order from *spec* and optional ``export_cols`` query param."""
|
|
26
|
+
return spec.resolve_export_columns(parse_active_col_ids(request))
|