Metadata-Version: 2.4
Name: streamlit-advanced-dataframe
Version: 0.1.0
Summary: Streamlitの標準st.dataframeを拡張した高機能カスタムコンポーネント
License: MIT
Project-URL: Homepage, https://github.com/j4rviscmd/streamlit-advanced-dataframe
Project-URL: Repository, https://github.com/j4rviscmd/streamlit-advanced-dataframe
Project-URL: Issues, https://github.com/j4rviscmd/streamlit-advanced-dataframe/issues
Keywords: streamlit,dataframe,table,component,tanstack-table
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.0.0
Requires-Dist: streamlit>=1.52.0
Dynamic: license-file

# streamlit-advanced-dataframe

Streamlit's `st.dataframe` with advanced features using TanStack Table.

## Installation

```bash
pip install streamlit-advanced-dataframe
```

## Usage

```python
import pandas as pd
from streamlit_advanced_dataframe import advanced_dataframe

df = pd.DataFrame({
    "name": ["Alice", "Bob", "Charlie"],
    "age": [25, 30, 35],
    "city": ["Tokyo", "Osaka", "Kyoto"]
})

# Basic usage
advanced_dataframe(data=df, height=400, key="my_table")

# Single row selection
selected = advanced_dataframe(
    data=df,
    selection_mode="single-row",
    key="selectable_table"
)
if selected:
    st.write(f"Selected rows: {selected}")  # Returns list[int]

# Multi-row selection
selected = advanced_dataframe(
    data=df,
    selection_mode="multi-row",
    key="multi_selectable_table"
)
if selected:
    st.dataframe(df.iloc[selected])  # Show selected rows

# Filter columns
advanced_dataframe(
    data=df,
    filterable_columns=["name", "age", "city"],
    show_row_count=True,
    key="filterable_table"
)

# Header groups
advanced_dataframe(
    data=df,
    header_groups=[
        {"header": "Personal Info", "columns": ["name", "age"]},
        {"header": "Location", "columns": ["city"]}
    ],
    key="grouped_table"
)

# Column config (prefix/suffix)
df_sales = pd.DataFrame({
    "product": ["Product A", "Product B"],
    "price": [1000, 2000],
    "discount": [10, 20]
})
advanced_dataframe(
    data=df_sales,
    column_config={
        "price": {"prefix": "$"},
        "discount": {"suffix": "%"}
    },
    key="config_table"
)
```

## Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `data` | `pd.DataFrame` | required | DataFrame to display |
| `height` | `int` | `600` | Table height in pixels |
| `use_container_width` | `bool` | `False` | Use full container width |
| `selection_mode` | `"single-row"` \| `"multi-row"` \| `None` | `None` | Row selection mode |
| `filterable_columns` | `list[str]` \| `None` | `None` | Columns to enable filtering |
| `show_row_count` | `bool` | `False` | Show filtered row count |
| `column_order` | `list[str]` \| `None` | `None` | Columns to display (in order) |
| `header_groups` | `list[dict]` \| `None` | `None` | Header group configuration |
| `expandable` | `bool` | `False` | Enable row expansion |
| `sub_rows_key` | `str` | `"subRows"` | Key for sub-row data |
| `show_summary` | `bool` | `True` | Show summary row |
| `column_config` | `dict[str, dict]` \| `None` | `None` | Per-column display config (prefix/suffix) |
| `key` | `str` \| `None` | `None` | Streamlit component key |

## Returns

`list[int]` - List of selected row indices (0-based). Returns an empty list `[]` when no rows are selected or `selection_mode` is `None`.
