diff --git a/.claude/agents/docs-reviewer.md b/.claude/agents/docs-reviewer.md new file mode 100644 index 00000000..7496c067 --- /dev/null +++ b/.claude/agents/docs-reviewer.md @@ -0,0 +1,562 @@ +--- +name: docs-reviewer +description: Documentation reviewer that ensures consistency in structure, style, and code samples across all parts of the documentation. +tools: Read, Grep, Glob, Bash +--- + +# Your role + +You are a senior documentation reviewer ensuring that all parts of the documentation maintain consistent structure, style, formatting, and code quality. Your goal is to create a seamless reading experience where users can navigate through all docs without encountering jarring inconsistencies in organization, writing style, or code examples. + +## When invoked + +1. Read all documentation files under the docs directory and understand the context +2. Review the target document against the Review Checklist below +3. Output and save a docs review report named `docs_review_report_docs__.md` in the reviews directory + +## Review Checklist + +### 1. Structure and Organization + +#### 1.1 Section Hierarchy +- **Consistent heading levels**: All parts must follow the same heading hierarchy pattern: + - Part title: `# Part N: Title` + - Major sections: `## N.N Title` + - Subsections: `### Subsection Title` + - Sub-subsections: `#### Detail Title` +- **Maximum nesting depth**: Headings should not exceed 4 levels deep (####) +- **Parallel structure**: Similar content types across parts should use the same heading levels + +#### 1.2 Section Ordering +Each part should follow this standard structure where applicable: +1. **Introduction paragraph(s)**: Brief overview of the part's topic +2. **Core concepts**: Main technical content organized by subsections +3. **Code examples**: Practical demonstrations with explanations +4. **Best practices**: Guidelines and recommendations (if applicable) +5. **Common pitfalls**: Warnings and cautions (if applicable) +6. **Cross-references**: Links to related parts or sections + +#### 1.3 How-To Guide Structure +For how-to guides and method comparison documents, verify the presence of these standard sections: + +**Opening Summary ("This guide shows you:")** +- Must appear at the top of the document after frontmatter +- 2-4 bullet points outlining what the user will learn +- Sets clear expectations about the guide's scope +- Example: + ```markdown + **This guide shows you:** + - How to translate between language variants (e.g., `en-US` to `en-GB`) + - Which method to choose: Write API, style rules, or custom instructions + - Example workflow for converting American English to British English + ``` + +**Method Sections with "When to use" Guidance** +- Each method/approach should have its own subsection +- Include a "**When to use this:**" section with clear decision-making bullets +- Focus on use cases, not just features +- Example: + ```markdown + ### 1. Method Name + + Brief description of the method. + + **When to use this:** + - Use case scenario 1 + - Use case scenario 2 + - Use case scenario 3 + ``` + +**Method Comparison Table** +- When document presents multiple approaches, include a comparison table +- Rows should be use cases, columns should be methods +- Use ✅, ❌, or ⚠️ for at-a-glance comparison +- Include practical use cases like "Short texts", "Longer texts", "Reusable rules" + +**Technical Details Section** +- Should include subsections for: + - **Cost**: Billing information for parameters + - **Limits**: Size limits, rate limits, parameter limits + - **Recommendations**: Best practices for the feature (e.g., model type recommendations) +- Place before "Next steps" section + +**Next Steps Section** +- Must be titled "Next steps" (not "Related Documentation") +- Opening sentence: "Now that you understand [topic]:" +- Use bold lead-ins for each bullet point +- Lead-ins should be action-oriented: "Try it yourself:", "Learn about:", "Explore:" +- Example: + ```markdown + ## Next steps + + Now that you understand how to translate between language variants: + + - **Try it yourself:** Review the [API reference](/link) for specifications + - **Learn about X:** Explore the [feature](/link) for advanced usage + ``` + +### 2. Document Style + +#### 2.1 Writing Voice and Tone +- **Active voice**: Prefer active voice +- **Present tense**: Use "returns" not "will return" for describing behavior +- **Second person**: Address the reader as "you" for instructions +- **Consistent terminology**: Remain consistent throughout the docs + +#### 2.2 Technical Explanations +- **Progressive disclosure**: Introduce simple concepts before complex ones +- **Concrete before abstract**: Show examples before deep technical details +- **Real-world context**: Connect technical features to practical use cases +- **Consistent metaphors**: If using analogies, ensure they're appropriate and consistent + +#### 2.3 Developer Documentation Tone (API Docs, Technical Guides) + +For developer-facing API documentation and technical guides, prioritize technical precision and conciseness: + +**Avoid Marketing Language:** +- Flag promotional language: "best-in-class", "major step forward", "significant improvements", "game-changing" +- Replace with technical descriptors: "improved algorithm", "enhanced performance", "optimized for" +- Example: + - ❌ "The new v2 represents a major step forward for customers who need best-in-class handling" + - ✅ "V2 is an improved algorithm for translating XML and HTML content" + +**Frame Version Comparisons Neutrally:** +- Focus on what the new version provides, not what the old version "lacked" or "failed at" +- Be explicit but neutral about limitations: "feature X is not available in v1", "v2 uses strict parsing" +- Avoid blame language: never say v1 was "bad", "broken", or "wrong" +- Example: + - ❌ "V2 fixes several v1 issues: dropped tags, duplicate tags, broken hierarchy" + - ✅ "V2 improves structural integrity through complete tag preservation and consistent placement" + +**Prefer Conciseness Over Hierarchical Structure:** +- Don't add subsections just for organization if 2-3 paragraphs or bullets suffice +- Recognize when subsections add bureaucracy without value +- Example: + - ❌ "### Translation Quality vs. Formatting [paragraph] ### Robustness [paragraph] ### Architecture [paragraph]" + - ✅ "Two concise paragraphs covering all three topics without subsections" + +**Action-Oriented Descriptions:** +- Description fields (YAML frontmatter) should tell developers what they'll learn or accomplish +- Prefer "Learn how to X" or "How to migrate from X to Y" over "Information about X" +- Example: + - ❌ `description: "Information on the improved version 2"` + - ✅ `description: "Learn about the benefits of tag handling v2 and how to migrate"` + +**Consolidate Related Examples:** +- Look for opportunities to combine related examples into tabs rather than separate sections +- Place the most common use case first (e.g., HTML before XML if HTML is more common) +- Example: + - ❌ "### XML Translation [example] ### HTML Translation [example]" + - ✅ Single tabbed interface with HTML tab first, then multiple XML tabs + +**Add Forward-Looking Context:** +- When noting limitations or incompatibilities, mention if they're temporary +- Example: "currently only compatible with X. Support for Y will be added in a future update" +- Avoid indefinite phrases like "for the time being" without specifics + +**Technical Bullets Over Explanatory Prose:** +- In migration guides and technical sections, prefer concise technical bullets +- Example: + - ❌ "Run v2 translations on representative samples of your content, especially content that has complex nested tags, inline markup, attributes, and special characters" + - ✅ "- Text with deep tag hierarchies\n- Text with inline markup, attributes, and special characters" + +#### 2.4 Cross-references and Links +- **Format**: Use relative links for internal docs: `[text](part2_live_request_queue.md#section)` +- **Link text**: Should be descriptive: "See [Part 4: Response Modalities](part4_run_config.md#response-modalities)" not "See [here](part4_run_config.md#response-modalities)" +- **Source references**: Use consistent format: `> 📖 **Source Reference**: [`filename`](github-url)` +- **Demo references**: Use consistent format: `> 📖 **Demo Implementation**: Description at [`path`](../src/demo/path)` +- **Learn more**: Use consistent format: `> 💡 **Learn More**: [Description of related content]` for directing readers to other sections or parts + +#### 2.5 Lists and Bullets +- **Sentence fragments**: Bullet points should start with capital letters and end without periods (unless multi-sentence) +- **Bold before colons**: Avoid the pattern of bolded words before a colon +- **Parallel construction**: All items in a list should follow the same grammatical structure +- **Consistent markers**: Use `-` for unordered lists, numbers for sequential steps + +### 3. Sample Code Style + +#### 3.1 Code Block Formatting +- **Language tags**: All code blocks must specify language: ```python, ```bash, ```json +- **Indentation**: Use 4 spaces for Python (not tabs) +- **Line length**: Prefer breaking lines at 80-88 characters for readability +- **Comments**: + - Use `#` for inline comments in Python + - Comments should explain "why" not "what" (code should be self-documenting) + - Avoid redundant comments like `# Send content` when code is `send_content()` + +#### 3.2 Code Example Structure +Each code example should include: +1. **Brief introduction**: One sentence explaining what the example demonstrates +2. **Complete code block**: Runnable code (or clearly marked pseudo-code) +3. **Explanation**: Key points explained after the code +4. **Variations** (if applicable): Alternative approaches with pros/cons + +#### 3.3 Inline Method Examples +For how-to guides that present multiple methods/approaches, each method section should include a short, focused code example: + +**Requirements:** +- **Placement**: Code example should appear immediately after the "When to use this:" bullets +- **Labels**: Use proper labels like "Example cURL request" or "Example request" +- **Request AND Response**: Always show both the request and the response +- **Brevity**: Keep examples short and focused on the key differentiator of the method +- **Consistency**: Use the same example text/scenario across all methods for easy comparison + +**Example structure:** +```markdown +### 1. Method Name + +Brief description of the method. + +**When to use this:** +- Use case 1 +- Use case 2 + +```bash Example cURL request +curl -X POST 'https://api.example.com/endpoint' \ +--header 'Authorization: API-Key [yourKey]' \ +--data '{ + "parameter": "value" +}' +``` + +```json Example response +{ + "result": "output" +} +``` + + +Any warnings or caveats specific to this method. + +``` + +**When NOT to include inline examples:** +- If the guide has a comprehensive example section later (but this should be rare) +- If the method requires setup steps that can't be shown inline +- In these cases, add a note directing users to the detailed example section + +#### 3.4 Code Consistency +- **Import statements**: Show imports when first introducing a concept +- **Variable naming**: + - Use descriptive names: `live_request_queue` not `lrq` + - Follow Python conventions: `snake_case` for variables/functions, `PascalCase` for classes +- **Type hints**: Include type hints in function signatures when helpful for understanding +- **Error handling**: Show error handling in production-like examples, omit in minimal examples + +#### 3.5 Code Example Types +Distinguish between: +- **Minimal examples**: Simplest possible demonstration of a concept +- **Production-like examples**: Include error handling, logging, edge cases +- **Anti-patterns**: Clearly marked with explanation of what NOT to do + +Example format for anti-patterns: +```python +# ❌ INCORRECT: Don't do this +bad_example() + +# ✅ CORRECT: Do this instead +good_example() +``` + +#### 3.6 Code Comments and Documentation + +**Commenting Philosophy:** + +The documentation uses code comments strategically based on the example's purpose. Follow this consistent standard across all parts: + +**1. Teaching Examples (Introductory/Concept-focused)** + +Use detailed explanatory comments to teach concepts. These examples prioritize education over brevity: + +```python +# Phase 1: Application initialization (once at startup) +agent = Agent( + model="gemini-2.0-flash-live-001", + tools=[google_search], # Tools the agent can use + instruction="You are a helpful assistant." +) + +# Phase 2: Session initialization (once per streaming session) +run_config = RunConfig( + streaming_mode=StreamingMode.BIDI, # Bidirectional streaming + response_modalities=["TEXT"] # Text-only responses +) +``` + +**When to use:** +- First introduction of a concept in a part +- Complex multi-step processes (like the FastAPI example in Part 1) +- Examples showing complete workflows +- When explaining architectural patterns + +**Characteristics:** +- Comments explain "why" and provide context +- Phase labels organize multi-step processes +- Inline comments clarify non-obvious parameters +- Section headers demarcate major steps + +**2. Production-like Examples (Minimal Comments)** + +Use minimal or no comments when the code is self-documenting. These examples show production patterns: + +```python +session = await session_service.get_session( + app_name="my-streaming-app", + user_id="user123", + session_id="session456" +) +if not session: + await session_service.create_session( + app_name="my-streaming-app", + user_id="user123", + session_id="session456" + ) +``` + +**When to use:** +- Straightforward API usage examples +- Code demonstrating patterns already explained in text +- After a concept has been introduced with detailed comments +- Simple configuration examples + +**Characteristics:** +- Let descriptive variable/function names speak for themselves +- No redundant comments (avoid `# Send content` when code says `send_content()`) +- Code structure provides clarity + +**3. Complex Logic (Always Comment)** + +Always add comments for non-obvious logic, especially async patterns and edge cases: + +```python +async def upstream_task(): + """Receive messages from client and forward to model.""" + try: + async for message in websocket.iter_text(): + data = json.loads(message) + + # Convert WebSocket message to LiveRequest format + content = types.Content(parts=[types.Part(text=data["text"])]) + live_request_queue.send_content(content) + except asyncio.CancelledError: + # Graceful shutdown on cancellation + pass +``` + +**When to use:** +- Async/await patterns that aren't obvious +- Error handling with specific recovery strategies +- Edge cases or gotchas +- Performance-critical sections + +**Characteristics:** +- Explains the "why" behind non-obvious decisions +- Clarifies timing or ordering requirements +- Documents error handling rationale + +**4. Anti-pattern Examples** + +Clearly mark incorrect vs correct approaches: + +```python +# ❌ INCORRECT: Don't reuse LiveRequestQueue across sessions +queue = LiveRequestQueue() +await runner.run_live(..., live_request_queue=queue) +await runner.run_live(..., live_request_queue=queue) # BUG! + +# ✅ CORRECT: Create fresh queue for each session +queue1 = LiveRequestQueue() +await runner.run_live(..., live_request_queue=queue1) + +queue2 = LiveRequestQueue() # New queue for new session +await runner.run_live(..., live_request_queue=queue2) +``` + +**When to use:** +- Demonstrating common mistakes +- Showing what NOT to do alongside correct approach +- Security or safety considerations + +**Characteristics:** +- Use ❌ and ✅ markers consistently +- Include brief explanation of why it's wrong +- Always show correct alternative + +**General Guidelines:** + +- **Avoid redundant comments**: Don't comment obvious code + ```python + # ❌ BAD: Redundant + live_request_queue.send_content(content) # Send content + + # ✅ GOOD: No comment needed (self-documenting) + live_request_queue.send_content(content) + ``` + +- **Comment "why" not "what"**: The code shows what; comments explain why + ```python + # ❌ BAD: States the obvious + queue.close() # Close the queue + + # ✅ GOOD: Explains the reason + queue.close() # Ensure graceful termination before cleanup + ``` + +- **Use inline comments sparingly**: Prefer explanatory text before/after code blocks + ```markdown + # ✅ GOOD: Explanation in prose + + The get-or-create pattern safely handles both new sessions and resumption: + + ```python + session = await session_service.get_session(...) + if not session: + await session_service.create_session(...) + ``` + + This approach is idempotent and works correctly for reconnections. + ``` + +- **Consistency within examples**: All examples in the same section should use similar commenting density +- **Progressive detail reduction**: Use detailed comments in Part 1, lighter comments in later parts as readers gain familiarity + +**Checklist for Code Comments:** + +- [ ] Teaching examples have explanatory comments for all non-obvious steps +- [ ] Production examples avoid redundant comments +- [ ] Complex async/await patterns are explained +- [ ] Anti-patterns are clearly marked with ❌/✅ +- [ ] Comments explain "why" not "what" +- [ ] Comment density is consistent within each part +- [ ] No TODO, FIXME, or placeholder comments in documentation + +### 4. Table Formatting + +#### 4.1 Column Alignment +Consistent table formatting improves readability. Follow these alignment rules: + +- **Text columns**: Left-align (use `---` or `|---|`) + - Model names, descriptions, notes, explanations + - Any column containing paragraphs or sentences + +- **Status/Symbol columns**: Center-align (use `:---:` or `|:---:|`) + - Columns containing only checkmarks (✅/❌) + - Single-character or symbol-only columns + - Boolean indicators + +- **Numeric columns**: Right-align (use `---:` or `|---:|`) + - Numbers, percentages, counts + - Measurements and statistics + +**Example of correct alignment:** + +```markdown +| Feature | Status | Count | Description | +|---------|:---:|---:|-------------| +| Audio | ✅ | 100 | All text here is left-aligned | +| Video | ❌ | 50 | Status centered, count right-aligned | +``` + +#### 4.2 Header Formatting +- All table headers should use **bold** text: `| **Feature** | **Status** |` +- Headers should be concise and descriptive +- Use title case for headers + +#### 4.3 Cell Content +- Use code formatting for code terms: `` `response_modalities` `` +- Use line breaks (`
`) sparingly, only when necessary for readability +- Keep cell content concise - tables should be scannable + +#### 4.4 Table Consistency Across Parts +- All tables across all parts should follow the same alignment rules +- Similar table types (e.g., feature matrices, comparison tables) should use the same structure +- Platform comparison tables should use consistent column ordering + +### 5. Cross-Part Consistency + +#### 5.1 Terminology Consistency +- Verify the same technical terms are used consistently across all parts +- Check that acronyms are defined on first use in each part +- Ensure consistent capitalization of product names and technical terms + +#### 5.2 Navigation and Flow +- Each part should naturally lead to the next +- Cross-references should be bidirectional where appropriate +- Concepts introduced in earlier parts should not be re-explained in depth later + +#### 5.3 Example Progression +- Code examples should increase in complexity across parts +- Earlier parts should use simpler examples +- Later parts can reference or build upon earlier examples + +## The Review Report + +The review report should include: + +### Review Report Summary +- Overall assessment of documentation consistency +- Major themes or patterns identified +- Quick statistics (e.g., total issues found per category) + +### Issues by Category + +Organize issues into: + +#### Critical Issues (C1, C2, ...) +Must fix - these severely impact readability or correctness: +- Incorrect code examples +- Broken cross-references +- Major structural inconsistencies +- Incorrect technical information + +#### Warnings (W1, W2, ...) +Should fix - these impact consistency and quality: +- Minor style inconsistencies +- Missing cross-references +- Inconsistent terminology +- Formatting issues + +#### Suggestions (S1, S2, ...) +Consider improving - these would enhance quality: +- Opportunities for better examples +- Areas for clearer explanations +- Suggestions for additional content +- Minor wording improvements + +### Issue Format + +For each issue: + +**[Issue Number]: [Issue Title]** + +- **Category**: Structure/Style/Code +- **Parts Affected**: part1, part3, etc. +- **Problem**: Clear description of the inconsistency or issue +- **Current State**: + - Filename: line number(s) + - Code/text snippet showing the issue +- **Expected State**: What it should look like for consistency +- **Recommendation**: Specific action to resolve + +**Example:** + +**W1: Inconsistent heading levels for code examples** + +- **Category**: Structure +- **Parts Affected**: part2, part4 +- **Problem**: Code examples use different heading levels across parts +- **Current State**: + - part2_live_request_queue.md:64 uses `### Text Content` + - part4_run_config.md:120 uses `#### Configuration Examples` +- **Expected State**: All code examples in main sections should use `###` level +- **Recommendation**: Update part4_run_config.md:120 to use `###` for consistency + +## Review Focus Areas + +When reviewing, pay special attention to: + +1. **First-time reader experience**: Does the documentation flow naturally across the docs? +2. **Code runability**: Can readers copy-paste examples and have them work? +3. **Cross-reference accuracy**: Do all links work and point to the right content? +4. **Technical accuracy**: Are all ADK APIs and patterns used correctly? +5. **Visual consistency**: Do diagrams, code blocks, and callouts follow the same patterns? \ No newline at end of file diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 00000000..5e5c81bf --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,5 @@ +{ + "enabledPlugins": { + "diataxis-documentation@deepl-claude-code-marketplace": true + } +} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..5bbb91d8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,13 @@ +on: + #schedule: + # - cron: "0 0 * * *" # Everday at midnight + workflow_dispatch: + +jobs: + remove-stale-branches: + name: Remove Stale Branches + runs-on: ubuntu-latest + steps: + - uses: fpicalausa/remove-stale-branches@v2.4.0 + with: + dry-run: true # Check out the console output before setting this to false diff --git a/.gitignore b/.gitignore index bc8a670e..569e6e60 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -.idea/* \ No newline at end of file +.idea/* +reviews/* +.DS_Store +.DS_Store? +.tool-versions diff --git a/.mintignore b/.mintignore new file mode 100644 index 00000000..34472b6f --- /dev/null +++ b/.mintignore @@ -0,0 +1 @@ +reviews/* diff --git a/README.md b/README.md index b2c5de35..72a5c20f 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,8 @@ # DeepL Developer Docs -Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including +This repo is home to the [DeepL Developer Docs](https://developers.deepl.com/). -- Guide pages -- Navigation -- Customizations -- API Reference pages -- Use of popular components - -### Development +## Development Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command @@ -22,6 +16,8 @@ Run the following command at the root of your documentation (where docs.json is) mintlify dev ``` +It may take you directly to `localhost:3000` which has no content. Nav to `http://localhost:3000/docs/getting-started/intro` to see our docs page. + ### Publishing Changes Install our Github App to auto propagate changes from your repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard. @@ -29,4 +25,70 @@ Install our Github App to auto propagate changes from your repo to your deployme #### Troubleshooting - Mintlify dev isn't running - Run `mintlify install` it'll re-install dependencies. -- Page loads as a 404 - Make sure you are running in a folder with `docs.json` \ No newline at end of file +- Page loads as a 404 - Make sure you are running in a folder with `docs.json` + +## AI Workflow + +### Setting Up the DeepL Claude Code Marketplace (DeepL Internal Only) + +**DeepL team members:** Install our internal Claude Code marketplace to access the `diataxis-documentation` plugin for structured technical writing: + +1. **Add the marketplace:** +``` +/plugin marketplace add https://git.deepl.dev/deepl/devex/ai-tooling/claude-code-marketplace.git +``` + +2. **Install the diataxis-documentation plugin:** +``` +/plugin install diataxis-documentation@deepl-claude-code-marketplace +``` + +This gives you access to the Diátaxis framework for creating tutorials, how-to guides, references, and explanations. + +**The skill activates automatically** when you ask Claude to: +- "write documentation", "create tutorial", "create guide" +- "write how-to", "document this", "add documentation" +- "review documentation", "improve docs", "check documentation quality" +- Mention "technical writing", "reference docs", "explanation" + +When creating new documentation, the skill will: +1. Help identify the correct documentation type (tutorial, how-to, reference, or explanation) +2. Guide you through following Diátaxis writing principles +3. Provide examples of good documentation structure + +### Subagents (Available to Everyone) + +We have a custom subagent in `.claude/agents/` that is **automatically available to anyone** who clones this repo (no installation required): + +- **`docs-reviewer.md`**: Designed to help edit our docs. Based on a sub-agent created by a GCP technical writer. (Read more in [this article](https://medium.com/google-cloud/supercharge-tech-writing-with-claude-code-subagents-and-agent-skills-44eb43e5a9b7), or [this repo](https://github.com/kazunori279/gcp-blogs/blob/main/.claude/agents/docs-reviewer.md).) + +### Recommended Documentation Review Workflow + +For the highest quality documentation, use both the diataxis plugin and docs-reviewer subagent together: + +1. **Write or update documentation** - Simply ask Claude naturally: + - "Create a tutorial for [feature]" + - "Write a how-to guide for [task]" + - "Document this API endpoint" + + The diataxis skill will activate automatically and ensure your content follows the correct documentation type (tutorial, how-to, reference, or explanation). + + If you prefer to write the documentation by hand, you can also say "Review this documentation". + +2. **Review with the docs-reviewer subagent:** + ``` + Use the docs-reviewer subagent on [filename] + ``` + This checks for style, clarity, and consistency with our documentation standards. + +This two-pass approach ensures both structural correctness (via diataxis) and editorial quality (via docs-reviewer). + +3. **Check for broken links:** + +Finally, you can run `mint broken-links` and `mint broken-links --check-anchors` to ensure all links are correct. + +### Future Plans + +- Add a subagent to search our codebase and backstage +- Further customize subagents to match our writing style + diff --git a/_archive/home-from-mintlify-team.mdx b/_archive/home-from-mintlify-team.mdx deleted file mode 100644 index fe96df9c..00000000 --- a/_archive/home-from-mintlify-team.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -mode: "custom" -public: true ---- - -import { IntroCard } from '/snippets/intro-card.mdx'; - -export function openSearch() { - document.getElementById('search-bar-entry').click(); -} - -
-
- -
-

- Welcome to DeepL Docs -

-

How can we help

-
- -
-
-
- -
-

Let's Get Started

- - - - - - - - - - -
diff --git a/_assets/images/discord-logo-black.png b/_assets/images/discord-logo-black.png deleted file mode 100644 index 03936731..00000000 Binary files a/_assets/images/discord-logo-black.png and /dev/null differ diff --git a/_assets/images/discord-logo-white.png b/_assets/images/discord-logo-white.png deleted file mode 100644 index 3518047c..00000000 Binary files a/_assets/images/discord-logo-white.png and /dev/null differ diff --git a/_assets/images/php-proxy-screenshot.png b/_assets/images/php-proxy-screenshot.png new file mode 100644 index 00000000..42d2b48f Binary files /dev/null and b/_assets/images/php-proxy-screenshot.png differ diff --git a/analytics.js b/analytics.js index 58b347dd..83a17f86 100644 --- a/analytics.js +++ b/analytics.js @@ -18,6 +18,9 @@ class AnalyticsTracker { static EVENT_ID_NETWORK_REQUEST = 5000; static EVENT_ID_SEARCH_INPUT = 5001; // TODO change this after DAP update + static CONSENT_KEY = 'deepl_cookie_consent'; + static CONSENT_ACCEPTED = 'accepted'; + static isProdStage = window.location.hostname === "developers.deepl.com"; static statisticsUrl = this.isProdStage ? "https://s.deepl.com/web/statistics" @@ -149,7 +152,7 @@ class AnalyticsTracker { // console.log('Fetched data: ', data); return data; } catch (error) { - console.error('Fetch error: ', error); + console.error('[Analytics] Fetch error: ', error); } } @@ -377,10 +380,25 @@ class AnalyticsTracker { } }; + // ======================== + // Consent Checker + // ======================== + static hasConsent() { + // Check localStorage for consent + return localStorage.getItem(this.CONSENT_KEY) === this.CONSENT_ACCEPTED; + } + // ======================== // Initialization // ======================== static init() { + // Only initialize analytics if user has consented + if (!this.hasConsent()) { + console.log('[Analytics] User has not consented to tracking. Analytics disabled.'); + return; + } + + console.log('[Analytics] User consent verified. Initializing analytics...'); this.PageNavigationTracker.setupNavigationTrackers(); this.NetworkRequestTracker.setupNetworkRequestTracking(); // this.SearchInputTracker.setupSearchInputTracking(); // Disable this for now diff --git a/api-reference/admin-api/get-usage-analytics.mdx b/api-reference/admin-api/get-usage-analytics.mdx new file mode 100644 index 00000000..e844752e --- /dev/null +++ b/api-reference/admin-api/get-usage-analytics.mdx @@ -0,0 +1,5 @@ +--- +openapi: get /v2/admin/analytics +title: "Get usage analytics" +--- + diff --git a/api-reference/admin-api/organization-usage-analytics.mdx b/api-reference/admin-api/organization-usage-analytics.mdx new file mode 100644 index 00000000..869f5f4d --- /dev/null +++ b/api-reference/admin-api/organization-usage-analytics.mdx @@ -0,0 +1,54 @@ +--- +title: "Accessing organization usage analytics" +description: "Learn how admins can retrieve and analyze usage data across their organization." +public: true +--- + +The Admin API allows admins to retrieve detailed usage statistics for their organization through the [Get usage analytics](/api-reference/admin-api/get-usage-analytics) endpoint. + +This analytics functionality enables you to: +* Track character usage across your entire organization +* Monitor usage by individual API keys +* Analyze usage patterns over time +* Generate reports for specific date ranges +* Break down usage by service type (text translation, document translation, text improvement) + +## Usage statistics endpoint + +The analytics endpoint provides detailed usage information for a specified date range with flexible grouping options. + +### Date range queries + +Retrieve usage statistics by specifying a start and end date. Both `start_date` and `end_date` parameters are required and support the following formats (all in UTC): +* `YYYY-MM-DD` - Simple date format (e.g., `2025-09-29`) +* `YYYY-MM-DDTHH:MM:SS` - Full datetime format (e.g., `2025-09-29T14:30:00`) + +The maximum date range is 366 days. + +### Grouping options + +The optional `group_by` parameter allows you to organize usage data in different ways: + +* **No grouping** (default): Returns total usage for the entire date range across all API keys +* **`key`**: Groups usage by individual API key, showing totals for each key over the entire date range +* **`key_and_day`**: Groups usage by both API key and day, providing daily breakdowns for each key + +### Usage breakdown + +All responses include a breakdown of usage by service type: +* **Total characters**: Combined usage across all services +* **Text translation characters**: Characters used for text translation +* **Document translation characters**: Characters used for document translation +* **Text improvement characters**: Characters used for text improvement (rephrasing) +* **Speech-to-text minutes**: Duration of speech-to-text usage in minutes + +## Use cases + +The account-level analytics endpoint is particularly useful for: + +* **Cost monitoring**: Track usage to stay within budget limits and forecast costs +* **Resource allocation**: Identify which teams or projects (represented by API keys) are using the most resources +* **Usage trends**: Analyze daily or weekly usage patterns to optimize resource planning +* **Compliance and auditing**: Generate detailed usage reports for compliance requirements +* **Performance tracking**: Monitor adoption and usage of different DeepL services within your organization + diff --git a/api-reference/agent-api.mdx b/api-reference/agent-api.mdx new file mode 100644 index 00000000..592ba12a --- /dev/null +++ b/api-reference/agent-api.mdx @@ -0,0 +1,262 @@ +--- +title: "DeepL Agent API" +public: true +sidebarTitle: "Overview" +description: "API reference to trigger DeepL Agent workflows and retrieve task results." +--- + +## Get started + + + The DeepL Agent API is only available to a limited set of DeepL Agent subscribers. Contact your DeepL customer success manager or our support team to enable access for your account. + + +Once enabled, follow the instructions in [Managing API keys](/docs/getting-started/managing-api-keys#basic-api-key-management) +to create an API key. +With the API key, you can trigger a DeepL Agent workflow and retrieve the results. +For more information on the DeepL Agent, visit the [HelpCenter](https://support.deepl.com/hc/en-us/categories/22974438575516-DeepL-Agent). + +There's no integration of the Agent API in the official DeepL SDKs yet. Use the HTTP examples below to integrate directly. + +We also provide specs that are auto-generated from DeepL's Agent OpenAPI file: [Trigger workflow](/api-reference/agent-api/trigger-workflow) and [Get task results](/api-reference/agent-api/get-task-result). + +## Trigger a workflow +Workflows are triggered with the help of the workflow ID. For more information on how to obtain a workflow ID, see the [HelpCenter](https://support.deepl.com/hc/en-us/articles/25472835912348). The `input` object's fields are defined by the individual workflow's configuration. +Refer to your workflow in the DeepL Agent interface to determine which input fields are required. +Once triggered the workflow runs in a task. + + + + This endpoint is only available on `https://api.deepl.com`. It is not available on the API Free endpoint (`https://api-free.deepl.com`). + ```sh Example request: Trigger a workflow + curl -X POST 'https://api.deepl.com/v1/unstable/agent/workflows/e1d78ccb-22e0-4a42-90e4-61884cf10af2/trigger' \ + --header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ + --form 'workflow_request={"input":{"Airline Link": "https://lufthansa.com","Departure Airport": "FRA","Destination Airport": "HND","Outbound Date": "2026-01-09 15:30:00","Inbound Date": "2026-01-17 17:30:00","Cabin Class": "economy","Number of passengers": "1"}}' + ``` + ```json Example response + { + "task_id": "e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "ui_url": "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "polling_url": "/v1/unstable/agent/tasks/e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "last_modified_date": "2025-12-05T12:32:02.191089+00:00" + } + ``` + + + This endpoint is only available on `https://api.deepl.com`. It is not available on the API Free endpoint (`https://api-free.deepl.com`). + ```http Example request: Trigger a workflow + POST /v1/unstable/agent/workflows/e1d78ccb-22e0-4a42-90e4-61884cf10af2/trigger HTTP/2 + Host: api.deepl.com + Authorization: DeepL-Auth-Key [yourAuthKey] + User-Agent: YourApp/1.2.3 + Content-Type: multipart/form-data; boundary=----WebKitFormBoundary + + ------WebKitFormBoundary + Content-Disposition: form-data; name="workflow_request" + + {"input":{"Airline Link": "https://lufthansa.com","Departure Airport": "FRA","Destination Airport": "HND","Outbound Date": "2026-01-09 15:30:00","Inbound Date": "2026-01-17 17:30:00","Cabin Class": "economy","Number of passengers": "1"}} + ------WebKitFormBoundary-- + ``` + ```json Example response + { + "task_id": "e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "ui_url": "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "polling_url": "/v1/unstable/agent/tasks/e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "last_modified_date": "2025-12-05T12:32:02.191089+00:00" + } + ``` + + + +These examples are for demonstration purposes only. In production code, the authentication key should not be hard-coded but instead fetched from a configuration file or environment variable. + +### Request body descriptions + + JSON string containing the workflow input parameters. The `input` object's fields are defined by the individual workflow's configuration. + Refer to your workflow in the DeepL Agent interface to determine which input fields are required. + + + Workflow-specific key-value pairs. + + +### Response body descriptions + + Unique identifier for the triggered task. + + + Relative URL to poll for task status. + + + URL to view the task in the DeepL Agent interface. + + + ISO 8601 timestamp. + + +## Get the task status and result +Check the status of the task in which the workflow is running, as well as the results once the workflow is completed. If the task isn’t finished, the result is an empty object. + +The maximum number of requests allowed per minute is 12 per IP address. +Poll at regular intervals (for example, every 5 seconds) with exponential backoff. + + + + This endpoint is only available on `https://api.deepl.com`. It is not available on the API Free endpoint (`https://api-free.deepl.com`). + ```sh Example request: Get task status and results + curl -X GET 'https://api.deepl.com/v1/unstable/agent/tasks/[yourTaskId]' \ + --header 'Authorization: DeepL-Auth-Key [yourAuthKey]' + ``` + ```json Example response + { + "status": "Completed", + "last_modified_date": "2026-02-27T09:57:50.863818+00:00", + "ui_url": "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "result": { + "screenshot": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8", + "response": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjUzOGU4OWFmLTNkN2QtNGEwZi04MDYxLWMyOTUzZjExZWEzOCIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.c88919cdc7bb9f7fc22ac7bd9b23c5c325a772d31310f437d4a04672c86cba32", + "data": null + }, + "result_data": [ + { + "artifactId": "9a2856bf-5333-4fd8-9500-3ea267b729b6", + "contentUrl": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8", + "name": "final_screenshot", + "description": "Final browser screenshot", + "schema": null + }, + { + "artifactId": "5e381ed3-1642-40f7-b8de-69338fc4698f", + "contentUrl": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjVlMzgxZWQzLTE2NDItNDBmNy1iOGRlLTY5MzM4ZmM0Njk4ZiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.f8bd75650b8112fff05b6bef8eae83d2472db96266b795f36c6820659c1feaf2", + "name": "Vodafone_News_Last_7_Days.md", + "description": "Top 10 news articles about Vodafone from the last 7 days", + "schema": null + } + ] + } + ``` + + + This endpoint is only available on `https://api.deepl.com`. It is not available on the API Free endpoint (`https://api-free.deepl.com`). + ```http Example request: Get task status and results + GET /v1/unstable/agent/tasks/[yourTaskId] HTTP/2 + Host: api.deepl.com + Authorization: DeepL-Auth-Key [yourAuthKey] + User-Agent: YourApp/1.2.3 + ``` + ```json Example response + { + "status": "Completed", + "last_modified_date": "2026-02-27T09:57:50.863818+00:00", + "ui_url": "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3", + "result": { + "screenshot": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8", + "response": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjUzOGU4OWFmLTNkN2QtNGEwZi04MDYxLWMyOTUzZjExZWEzOCIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.c88919cdc7bb9f7fc22ac7bd9b23c5c325a772d31310f437d4a04672c86cba32", + "data": null + }, + "result_data": [ + { + "artifactId": "9a2856bf-5333-4fd8-9500-3ea267b729b6", + "contentUrl": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8", + "name": "final_screenshot", + "description": "Final browser screenshot", + "schema": null + }, + { + "artifactId": "5e381ed3-1642-40f7-b8de-69338fc4698f", + "contentUrl": "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjVlMzgxZWQzLTE2NDItNDBmNy1iOGRlLTY5MzM4ZmM0Njk4ZiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.f8bd75650b8112fff05b6bef8eae83d2472db96266b795f36c6820659c1feaf2", + "name": "Vodafone_News_Last_7_Days.md", + "description": "Top 10 news articles about Vodafone from the last 7 days", + "schema": null + } + ] + } + ``` + + +These examples are for demonstration purposes only. In production code, the authentication key should not be hard-coded but instead fetched from a configuration file or environment variable. + +### Task status response body descriptions + + Current task status. + + + The date the task was last modified. + + + URL to the task in the DeepL Agent. + + + Workflow result containing presigned URLs to retrieve output artifacts. Present in all responses; empty object `{}` while the task is in progress. + + + Presigned URL to retrieve the primary workflow result content. Valid for five minutes. + + + Presigned URL to retrieve a screenshot artifact from the workflow. Valid for five minutes. + + + Optional additional workflow result data. Not used – deprecated. + + + List of all artifacts produced by the workflow, with metadata and presigned content URLs. + + + Unique identifier of the artifact. + + + Presigned URL to retrieve the artifact content. Valid for five minutes. + + + Filename or identifier of the artifact. + + + Human-readable description of the artifact. + + + Optional schema describing the artifact's data structure. + + +## Retrieve the workflow result + +Once the task status is `Completed`, retrieve the workflow result by fetching the presigned URL returned in the `result.response` field. +Use the presigned URL exactly as returned in `result.response` — it is hosted on `agent.deepl.com` and is valid for five minutes. + + + ```sh Example request: Get content from the presigned URL + # Replace with your presigned URL + curl 'https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjUzOGU4OWFmLTNkN2QtNGEwZi04MDYxLWMyOTUzZjExZWEzOCIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.c88919cdc7bb9f7fc22ac7bd9b23c5c325a772d31310f437d4a04672c86cba32' + ``` + ```json Example response + { + "message": "I've successfully completed the flight price research for your Frankfurt (FRA) to Tokyo Haneda (HND) trip.\n\n**Flight Details:**\n- Route: Frankfurt (FRA) \u2192 Tokyo Haneda (HND)\n- Dates: January 9-17, 2026\n- Passengers: 1\n- Class: Economy\n\n**Best Price Found:**\n- **EUR 514.43** for Economy class\n- Flight: 11:35 FRA \u2192 08:45+1 HND (next day arrival)\n- Direct flight (0 stops)\n- Operated by All Nippon Airways\n- Duration: 13h 10m\n\n**Other Options:**\n- Premium Economy: from EUR 1,464.43\n- Business Class: from EUR 2,189.43\n\n**Results Document:** [results.json](artifact://4c31b6a4-d9f0-43e7-9f0c-dd851334d5b8)\n\n**Screenshot:** [Flight Search Results](artifact://24a01ad9-c64e-4a27-9d2c-6246fb341be2)\n\nThe pricing is displayed in Euros and includes all available cabin classes for your selected dates.", + "content_type": "text", + "language": "en" + } + ``` + + + ```http Example request: Get content from the presigned URL + GET /api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjUzOGU4OWFmLTNkN2QtNGEwZi04MDYxLWMyOTUzZjExZWEzOCIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.c88919cdc7bb9f7fc22ac7bd9b23c5c325a772d31310f437d4a04672c86cba32 HTTP/2 + Host: agent.deepl.com + ``` + ```json Example response + { + "message": "I've successfully completed the flight price research for your Frankfurt (FRA) to Tokyo Haneda (HND) trip.\n\n**Flight Details:**\n- Route: Frankfurt (FRA) \u2192 Tokyo Haneda (HND)\n- Dates: January 9-17, 2026\n- Passengers: 1\n- Class: Economy\n\n**Best Price Found:**\n- **EUR 514.43** for Economy class\n- Flight: 11:35 FRA \u2192 08:45+1 HND (next day arrival)\n- Direct flight (0 stops)\n- Operated by All Nippon Airways\n- Duration: 13h 10m\n\n**Other Options:**\n- Premium Economy: from EUR 1,464.43\n- Business Class: from EUR 2,189.43\n\n**Results Document:** [results.json](artifact://4c31b6a4-d9f0-43e7-9f0c-dd851334d5b8)\n\n**Screenshot:** [Flight Search Results](artifact://24a01ad9-c64e-4a27-9d2c-6246fb341be2)\n\nThe pricing is displayed in Euros and includes all available cabin classes for your selected dates.", + "content_type": "text", + "language": "en" + } + ``` + + + +### Presigned URL response body descriptions + + The workflow result as a text string. + + + The type of content returned. For example, `text`. + + + The language code of the returned content. For example, `en`. + + diff --git a/api-reference/agent-api/agent-api.yaml b/api-reference/agent-api/agent-api.yaml new file mode 100644 index 00000000..93514a51 --- /dev/null +++ b/api-reference/agent-api/agent-api.yaml @@ -0,0 +1,285 @@ +openapi: 3.0.3 +info: + title: DeepL Agent API + description: > + API for triggering and monitoring agentic workflows. These endpoints allow users to trigger + workflows with custom inputs and poll for task completion status. + version: 1.0.0 +servers: + - url: https://api.deepl.com + description: Production server +tags: + - name: agent + description: DeepL Agent workflow operations + +paths: + /v1/unstable/agent/workflows/{workflowId}/trigger: + post: + summary: Trigger a workflow + description: > + Triggers an agentic workflow with the specified ID. The workflow will be executed + asynchronously, and a task ID will be returned to poll for status updates. + operationId: trigger_workflow + tags: + - agent + security: + - auth_header: [] + parameters: + - name: workflowId + in: path + description: Unique identifier of the workflow to trigger + required: true + schema: + type: string + format: uuid + example: "e1d78ccb-22e0-4a42-90e4-61884cf10af2" + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + required: + - workflow_request + properties: + workflow_request: + type: string + description: JSON string containing the workflow input parameters + example: '{"input": {"language": "American English"}}' + responses: + 200: + description: Successfully triggered the workflow + content: + application/json: + schema: + $ref: '#/components/schemas/TriggerWorkflowResponse' + example: + task_id: "e634159a-3414-4f66-a5cd-a1d48ff42ce3" + ui_url: "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3" + polling_url: "/v1/unstable/agent/tasks/e634159a-3414-4f66-a5cd-a1d48ff42ce3" + last_modified_date: "2025-12-04T10:30:00Z" + 400: + description: Bad request - invalid workflow_request JSON or missing required fields + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + message: "Invalid JSON in workflow_request field" + 401: + description: Unauthorized - invalid or missing API key, or account is not configured for agentic API use + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + 404: + description: Workflow not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + message: "Workflow with ID 'e1d78ccb-22e0-4a42-90e4-61884cf10af2' not found" + + /v1/unstable/agent/tasks/{taskId}: + get: + summary: Get task status + description: > + Retrieves the current status and result of a previously triggered workflow task. + Use this endpoint to poll for task completion after triggering a workflow. + operationId: get_task_status + tags: + - agent + security: + - auth_header: [] + parameters: + - name: taskId + in: path + description: Unique identifier of the task to retrieve + required: true + schema: + type: string + format: uuid + example: "e634159a-3414-4f66-a5cd-a1d48ff42ce3" + responses: + 200: + description: Successfully retrieved task status + content: + application/json: + schema: + $ref: '#/components/schemas/GetTaskResponse' + examples: + in_progress: + summary: Task in progress + value: + status: "InProgress" + last_modified_date: "2025-12-04T10:30:00Z" + ui_url: "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3" + result: {} + completed: + summary: Task completed + value: + status: "Completed" + last_modified_date: "2026-02-27T09:57:50.863818+00:00" + ui_url: "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3" + result: + screenshot: "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8" + response: "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjUzOGU4OWFmLTNkN2QtNGEwZi04MDYxLWMyOTUzZjExZWEzOCIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.c88919cdc7bb9f7fc22ac7bd9b23c5c325a772d31310f437d4a04672c86cba32" + data: null + result_data: + - artifactId: "9a2856bf-5333-4fd8-9500-3ea267b729b6" + contentUrl: "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8" + name: "final_screenshot" + description: "Final browser screenshot" + schema: null + - artifactId: "5e381ed3-1642-40f7-b8de-69338fc4698f" + contentUrl: "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjVlMzgxZWQzLTE2NDItNDBmNy1iOGRlLTY5MzM4ZmM0Njk4ZiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.f8bd75650b8112fff05b6bef8eae83d2472db96266b795f36c6820659c1feaf2" + name: "Vodafone_News_Last_7_Days.md" + description: "Top 10 news articles about Vodafone from the last 7 days" + schema: null + 401: + description: Unauthorized - invalid or missing API key, or account is not configured for agentic API use + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + 404: + description: Task not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + message: "Task with ID 'e634159a-3414-4f66-a5cd-a1d48ff42ce3' not found" + +components: + schemas: + TriggerWorkflowResponse: + type: object + required: + - task_id + - last_modified_date + properties: + task_id: + type: string + description: Unique identifier for the triggered workflow task + example: "e634159a-3414-4f66-a5cd-a1d48ff42ce3" + ui_url: + type: string + nullable: true + description: URL to view the task in the agentic system user interface + example: "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3" + polling_url: + type: string + nullable: true + description: Relative URL endpoint to poll for task status updates + example: "/v1/unstable/agent/tasks/e634159a-3414-4f66-a5cd-a1d48ff42ce3" + last_modified_date: + type: string + format: date-time + description: Timestamp of when the task was last modified (ISO 8601 format) + example: "2025-12-04T10:30:00Z" + + GetTaskResponse: + type: object + required: + - status + - last_modified_date + - result + properties: + status: + $ref: '#/components/schemas/TaskStatus' + last_modified_date: + type: string + format: date-time + description: Timestamp of when the task was last modified (ISO 8601 format) + example: "2025-12-04T10:35:00Z" + ui_url: + type: string + nullable: true + description: URL to view the task in the agentic UI + example: "https://agent.deepl.com/static/chat/e634159a-3414-4f66-a5cd-a1d48ff42ce3" + result: + type: object + description: Workflow result containing presigned URLs to retrieve output artifacts. Present in all responses; empty object `{}` while the task is in progress. + properties: + response: + type: string + nullable: true + description: Presigned URL to retrieve the primary workflow result content. Valid for five minutes. + example: "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjUzOGU4OWFmLTNkN2QtNGEwZi04MDYxLWMyOTUzZjExZWEzOCIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.c88919cdc7bb9f7fc22ac7bd9b23c5c325a772d31310f437d4a04672c86cba32" + screenshot: + type: string + nullable: true + description: Presigned URL to retrieve a screenshot artifact from the workflow. Valid for five minutes. + example: "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8" + data: + nullable: true + description: Additional workflow result data. Structure is workflow-specific. + result_data: + type: array + nullable: true + description: List of all artifacts produced by the workflow, with metadata and presigned content URLs. + items: + $ref: '#/components/schemas/ResultArtifact' + + TaskStatus: + type: string + description: Current status of the task + enum: + - Archived + - InProgress + - Completed + - Canceled + - Error + - FeedbackNeeded + example: "Completed" + + ResultArtifact: + type: object + required: + - artifactId + - contentUrl + - name + - description + properties: + artifactId: + type: string + format: uuid + description: Unique identifier of the artifact. + example: "9a2856bf-5333-4fd8-9500-3ea267b729b6" + contentUrl: + type: string + description: Presigned URL to retrieve the artifact content. Valid for five minutes. + example: "https://agent.deepl.com/api/experimental/content/eyJhcnRpZmFjdF9pZCI6IjlhMjg1NmJmLTUzMzMtNGZkOC05NTAwLTNlYTI2N2I3MjliNiIsInZlcnNpb24iOjEsIm93bmVyX2lkIjoiNWM3YmIyNTQtZTU3NC00MjcyLTk0NTktZGJjN2JiM2JiMmVhIiwiZXhwaXJlcyI6MTc3MjE4NjYyM30=.686af5947238ed6920c29d83436bfc98c9d6c4015da0594e56007fff234f06e8" + name: + type: string + description: Filename or identifier of the artifact. + example: "final_screenshot" + description: + type: string + description: Human-readable description of the artifact. + example: "Final browser screenshot" + schema: + nullable: true + description: Optional schema describing the artifact's data structure. + + ErrorResponse: + type: object + required: + - message + properties: + message: + type: string + description: Human-readable error message + example: "Workflow with ID 'e1d78ccb-22e0-4a42-90e4-61884cf10af2' not found" + + securitySchemes: + auth_header: + type: apiKey + description: > + Authentication with `Authorization` header and + `DeepL-Auth-Key` authentication scheme. Example: + `DeepL-Auth-Key ` + name: Authorization + in: header \ No newline at end of file diff --git a/api-reference/agent-api/get-task-result.mdx b/api-reference/agent-api/get-task-result.mdx new file mode 100644 index 00000000..f25718ba --- /dev/null +++ b/api-reference/agent-api/get-task-result.mdx @@ -0,0 +1,4 @@ +--- +openapi: /api-reference/agent-api/agent-api.yaml get /v1/unstable/agent/tasks/{taskId} +title: "Get task results" +--- \ No newline at end of file diff --git a/api-reference/agent-api/trigger-workflow.mdx b/api-reference/agent-api/trigger-workflow.mdx new file mode 100644 index 00000000..85a8d813 --- /dev/null +++ b/api-reference/agent-api/trigger-workflow.mdx @@ -0,0 +1,4 @@ +--- +openapi: /api-reference/agent-api/agent-api.yaml post /v1/unstable/agent/workflows/{workflowId}/trigger +title: "Trigger workflow" +--- \ No newline at end of file diff --git a/api-reference/document.mdx b/api-reference/document.mdx index 1d5fda95..6b99401c 100644 --- a/api-reference/document.mdx +++ b/api-reference/document.mdx @@ -14,12 +14,13 @@ The document translation API allows you to translate whole documents and support * `txt` - Plain Text Document * `xlf / xliff` - XLIFF Document, version 2.1 * `srt` - SRT (SubRip Subtitle) Document +* `jpeg` / `jpg` / `png` - Image (currently in beta) Please note that with every submitted document of type .pptx, .docx, .doc, .xlsx, or .pdf, you are billed a minimum of 50,000 characters with the DeepL API plan, no matter how many characters are included in the document. The maximum upload limit for documents is [available here](/docs/resources/usage-limits#maximum-upload-limits-per-document-format) and may vary based on API plan and document type. -We also provide specs that is auto-generated from DeepL's OpenAPI file. [You can find it here](/api-reference/document/upload-and-translate-a-document). +We also provide specs that are auto-generated from DeepL's OpenAPI file. [You can find it here](/api-reference/document/upload-and-translate-a-document). When translating a `doc` file, you will receive a `docx` file as the output format. @@ -136,7 +137,9 @@ These examples are for demonstration purposes only. In production code, the auth
  • `pdf`: Portable Document Format
  • `htm / .html`: HTML Document
  • `txt`: Plain Text Document
  • -
  • `xlf / .xliff`: XLIFF Document, version 2.1
  • +
  • `xlf / xliff`: XLIFF Document, version 2.1
  • +
  • `srt` - SRT (SubRip Subtitle) Document
  • +
  • `jpeg` / `jpg` / `png` - Image (currently in beta)
  • @@ -159,6 +162,9 @@ These examples are for demonstration purposes only. In production code, the auth File extension of desired format of translated file, for example: `pdf`. If unspecified, by default the translated file will be in the same format as the input file. Note: Not all combinations of input file and translation file extensions are permitted. See Document format conversions for the permitted combinations. + + No languages are currently in beta. This parameter has no effect on translations but is maintained for backward compatibility. + ### Step 2: check the document status and wait for translation to complete @@ -296,7 +302,7 @@ Content-Type: application/json The examples on this page show how to translate documents with DeepL using the API directly. -DeepL's [client libraries](/api-reference/client-libraries) simplify API document translation by providing a convenience function to upload the document, check translation status and download the translated document with a single function call. +DeepL's [client libraries](/docs/getting-started/client-libraries) simplify API document translation by providing a convenience function to upload the document, check translation status and download the translated document with a single function call. ### Document format conversions diff --git a/api-reference/glossaries.mdx b/api-reference/glossaries.mdx index 70900fef..416315d8 100644 --- a/api-reference/glossaries.mdx +++ b/api-reference/glossaries.mdx @@ -8,12 +8,10 @@ description: "Manage glossaries using the v2 endpoints" This page documents `v2` glossary endpoints, legacy endpoints that let you create and manage glossaries for a single language pair. -[See here](/api-reference/multilingual-glossaries) for information on `v3` endpoints, which allow you to create, manage, and edit glossaries with entries in multiple language pairs. [See here](/api-reference/glossaries/v2-vs-v3-endpoints) for an overview of the difference. +[See here](/api-reference/multilingual-glossaries) for information on current `v3` endpoints. Using `v3` allows you to create, manage, and edit glossaries with entries in multiple language pairs, while still supporting monolingual functionality. [See here](/api-reference/glossaries/v2-vs-v3-endpoints) for an overview of the difference. -This page describes how to use the `v2` endpoints to work with _monolingual_ glossaries - glossaries that map phrases in one language to phrases in another language. If you're new to glossaries, we suggest you use `v3` instead. `v3` allows you to work with multilingual glossaries, and it lets you edit any glossaries as well. - -### Create a glossary +This page describes how to use the `v2` endpoints to work with _monolingual_ glossaries - glossaries that map phrases in one language to phrases in another language. If you're new to glossaries, we suggest you use `v3` instead. @@ -296,7 +294,11 @@ User-Agent: YourApp/1.2.3 ### Listing language pairs -The `/glossary-language-pairs` endpoint lists all the language pairs - the source and target languages - that glossaries support. Since glossaries now work for all languages DeepL supports, this list will be quite long. We recommend that you instead use [the /languages endpoint](/api-reference/languages). +The `/glossary-language-pairs` endpoint lists all the language pairs - the source and target languages - that glossaries support. + + +Since DeepL supports many glossary languages, the list of potential pairs is quite long. [This list of glossary languages](/docs/getting-started/supported-languages#glossary-languages) may also be useful. + diff --git a/api-reference/glossaries/v2-vs-v3-endpoints.mdx b/api-reference/glossaries/v2-vs-v3-endpoints.mdx index 7f25f631..590b03bf 100644 --- a/api-reference/glossaries/v2-vs-v3-endpoints.mdx +++ b/api-reference/glossaries/v2-vs-v3-endpoints.mdx @@ -6,9 +6,9 @@ sidebarTitle: "v2 vs v3 endpoints" ## Overview -With the [`v2 endpoints`](/api-reference/glossaries/), you can create, delete, and retrieve information on _monolingual_ glossaries - glossaries that map one language to another. +With the [v2 endpoints](/api-reference/glossaries/), you can create, delete, and retrieve information on _monolingual_ glossaries - glossaries that map one language to another. -The [`v3 endpoints`](/api-reference/multilingual-glossaries) include all the functionality of `v2` endpoints, plus: +The [v3 endpoints](/api-reference/multilingual-glossaries) include all the functionality of `v2` endpoints, plus: - `v3` lets you edit glossaries - `v3` lets you work with _multilingual_ glossaries - a collection of mappings for a set of language pairs. @@ -17,7 +17,7 @@ Thus, we recommend you use `v3`. `v2` is kept for backward compatibility. If yo We strongly discourage using both `v2` and `v3` endpoints in your code. If you use `v3` endpoints to edit a glossary, `v2` endpoints may return unexpected results for that glossary, and `v2` endpoints will no longer be able to delete it. -Glossaries from either endpoint can be used in all translation endpoints - which includes both [`/translate`](../translate/) and [`/document`](../document/) . +Glossaries from either endpoint can be used in all translation endpoints - which includes both [/translate](../translate/) and [/document](../document/) . Going forward, we will continue to add features and functionality to `v3`. At present, the `/v3` endpoint is only used for editing glossaries and working with multilingual glossaries. diff --git a/api-reference/languages.mdx b/api-reference/languages.mdx index 1a5281d1..9097163c 100644 --- a/api-reference/languages.mdx +++ b/api-reference/languages.mdx @@ -73,6 +73,11 @@ curl -X GET 'https://api.deepl.com/v2/languages?type=target' \ "name": "Spanish", "supports_formality": true }, + { + "language": "ES-419", + "name": "Spanish (Latin American)", + "supports_formality": true + }, { "language": "ET", "name": "Estonian", @@ -250,6 +255,11 @@ User-Agent: YourApp/1.2.3 "name": "Spanish", "supports_formality": true }, + { + "language": "ES-419", + "name": "Spanish (Latin American)", + "supports_formality": true + }, { "language": "ET", "name": "Estonian", diff --git a/api-reference/languages/retrieve-supported-languages.mdx b/api-reference/languages/retrieve-supported-languages.mdx index 0ccc95a8..13b12c48 100644 --- a/api-reference/languages/retrieve-supported-languages.mdx +++ b/api-reference/languages/retrieve-supported-languages.mdx @@ -1,5 +1,4 @@ --- openapi: get /v2/languages title: "Retrieve supported languages" -playground: none --- \ No newline at end of file diff --git a/api-reference/multilingual-glossaries.mdx b/api-reference/multilingual-glossaries.mdx index 41e0e2b5..d6702792 100644 --- a/api-reference/multilingual-glossaries.mdx +++ b/api-reference/multilingual-glossaries.mdx @@ -6,16 +6,17 @@ description: "Manage and use DeepL glossaries" --- - This page documents `v3` glossary endpoints, which let you edit glossaries and makes them multilingual. [See here](/api-reference/glossaries) for information on `v2` glossaries. [See here](/api-reference/glossaries/v2-vs-v3-endpoints) for an overview of the difference. - - At present, the `v3` endpoint is only used for working with multilingual glossaries. + This page documents `v3` glossary endpoints, which let you **edit** glossaries and allow for **multilingual** functionality. + + The current`v3` endpoints are used for working with **both multilingual and monolingual** glossaries. Thus, we recommend you start using the `v3` endpoints described below for all glossary needs. + + The previously used [v2 glossary endpoints](/api-reference/glossaries) can only be used with **monolingual** glossaries. [See here](/api-reference/glossaries/v2-vs-v3-endpoints) for more on the difference between `v2` and `v3` glossary endpoints. -## Overview -The `glossaries` endpoints let you work with [DeepL glossaries](https://support.deepl.com/hc/en-us/articles/360021634540-About-the-glossary), which let you specify specific translations for words or short phrases. Each glossary contains a mapping of source phrases to target phrases. During translation, DeepL intelligently flexes entries to account for case, gender, tense, and other grammar features (if the target language has flexion). +## Overview -Currently you can create glossaries with [any of the languages DeepL supports](../docs/getting-started/supported-languages). Any updates will be noted here, as well as in [the /languages endpoint and documentation](../docs/getting-started/supported-languages). +The `glossaries` endpoints let you work with [DeepL glossaries](https://support.deepl.com/hc/en-us/articles/360021634540-About-the-glossary), which let you specify specific translations for words or short phrases. Each glossary contains a mapping of source phrases to target phrases. During translation, DeepL intelligently flexes entries to account for case, gender, tense, and other grammar features (if the target language has flexion). You can create glossaries with [any of the languages listed here](/docs/getting-started/supported-languages#glossary-languages). A **glossary** contains (several) **dictionaries**. A **dictionary** is a mapping of source phrases to target phrases for a single language pair, like this: @@ -33,6 +34,9 @@ Note that this mapping occurs only in one direction, which is all you need durin | exquisito | delicieux | | mouse | mouse | +Both glossaries and style rules are unique to each of DeepL's global data centers and are not shared between them. Clients using the `api-us.deepl.com` endpoint will not be able to access glossaries or style rules created in the UI at this time. + + ## Creating glossaries ### Formats @@ -154,7 +158,7 @@ This example creates a modest glossary with two dictionaries. One maps "Hello" i -## Using +## Using a glossary `POST /v2/translate` @@ -423,7 +427,7 @@ Currently you can only retrieve glossary contents in TSV format. To retrieve the contents of an entire glossary, iterate through each of dictionaries, retrieving the content of each. While we work to provide the ability to retrieve a whole glossary in a single call, [your feedback here](/docs/resources/deepl-developer-community) is valuable as we strive to improve our API.
    -## Editing +## Editing a glossary ### Add a new dictionary, or replace an existing one @@ -683,11 +687,15 @@ Use this method to delete a dictionary for a specific language pair. ## Notes on usage +### Languages supported + +The DeepL API supports [these languages for glossaries](/docs/getting-started/supported-languages#glossary-languages). + ### Language variants Glossaries apply to languages, not specific language variants. A glossary for a language applies to any variant of that language. -For example, if you create a glossary with target language `EN` , that glossary will apply to `EN-US` and `EN-GB`. A glossary with target language `PR` will apply to `PT-PT` and `PT-BR`. +For example, if you create a glossary with target language `EN` , that glossary will apply to `EN-US` and `EN-GB`. A glossary with target language `PT` will apply to `PT-PT` and `PT-BR`. ### Source language detection diff --git a/api-reference/multilingual-glossaries/list-language-pairs-supported-by-glossaries.mdx b/api-reference/multilingual-glossaries/list-language-pairs-supported-by-glossaries.mdx index 6243fcf0..2246d91f 100644 --- a/api-reference/multilingual-glossaries/list-language-pairs-supported-by-glossaries.mdx +++ b/api-reference/multilingual-glossaries/list-language-pairs-supported-by-glossaries.mdx @@ -1,4 +1,8 @@ --- -openapi: get /v2/glossary-language-pairs +openapi: "get /v2/glossary-language-pairs" title: "List language pairs supported for glossaries" ---- \ No newline at end of file +playground: none +--- + +This endpoint returns all possible language pairs for glossaries. +[This list of supported languages](/docs/getting-started/supported-languages#glossary-languages) may also be useful. \ No newline at end of file diff --git a/api-reference/openapi.yaml b/api-reference/openapi.yaml index 306618b0..b242b4b2 100644 --- a/api-reference/openapi.yaml +++ b/api-reference/openapi.yaml @@ -9,7 +9,7 @@ info: contact: name: DeepL - Contact us url: https://www.deepl.com/contact-us - version: 3.2.0 + version: 3.6.0 externalDocs: description: DeepL Pro - Plans and pricing url: https://www.deepl.com/pro#developer @@ -33,6 +33,7 @@ tags: * `txt` - Plain Text Document * `xlf / xliff` - XLIFF Document, version 2.1 * `srt` - SRT Document + * `jpeg` / `jpg` / `png` - Image (currently in beta) - name: RephraseText description: |- The `rephrase` endpoint is used to make corrections and adjustments to texts based on style or tone. @@ -44,7 +45,7 @@ tags: A dictionary is a mapping of source phrases to target phrases for a single language pair. If you encounter issues, please let us know at support@DeepL.com. - Currently you can create glossaries with any of the languages DeepL supports. + Currently you can create glossaries with any of the languages DeepL supports (with the exception of Thai). The maximum size limit for a glossary is 10 MiB = 10485760 bytes and each source/target text, as well as the name of the glossary, is limited to 1024 UTF-8 bytes. @@ -68,12 +69,131 @@ tags: `glossary_id` parameter. If you encounter issues, please let us know at support@DeepL.com. - Currently you can create glossaries with any of the languages DeepL supports. + Currently you can create glossaries with any of the languages DeepL supports (with the exception of Thai). - name: MetaInformation description: Information about API usage and value ranges +- name: VoiceAPI + description: |- + The Voice API provides real-time voice transcription and translation services. + Use a two-step flow: first request a streaming URL via REST, then establish a WebSocket connection for streaming audio and receiving transcriptions. x-hideTryItPanel: true x-codeSamples: false paths: + /v2/admin/analytics: + get: + tags: + - AdminApi + summary: Get usage statistics as an admin + operationId: adminGetAnalytics + description: |- + Retrieve usage statistics for the organization within a specified date range. + Optionally group the results by API key or by API key and day. + parameters: + - name: start_date + in: query + required: true + description: Start date for the usage report (ISO 8601 date format). + schema: + type: string + format: date + example: "2025-09-29" + - name: end_date + in: query + required: true + description: End date for the usage report (ISO 8601 date format). + schema: + type: string + format: date + example: "2025-10-01" + - name: group_by + in: query + required: false + description: |- + Optional parameter to group usage statistics. Possible values: + * `key` - Group by API key + * `key_and_day` - Group by API key and usage date + schema: + type: string + enum: + - key + - key_and_day + example: "key_and_day" + responses: + 200: + description: The usage statistics for the specified date range. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' + content: + application/json: + schema: + $ref: '#/components/schemas/AdminUsageReport' + examples: + withGrouping: + summary: Usage report grouped by key and day + value: + usage_report: + total_usage: + total_characters: 9619 + text_translation_characters: 4892 + document_translation_characters: 0 + text_improvement_characters: 4727 + speech_to_text_minutes: 107.46 + group_by: "key_and_day" + start_date: "2025-09-29T00:00:00" + end_date: "2025-10-01T00:00:00" + key_and_day_usages: + - api_key: "dc88****3a2c" + api_key_label: "Staging API Key" + usage_date: "2025-09-29T00:00:00Z" + usage: + total_characters: 315 + text_translation_characters: 159 + document_translation_characters: 0 + text_improvement_characters: 156 + speech_to_text_minutes: 11.94 + withoutGrouping: + summary: Usage report without grouping + value: + usage_report: + total_usage: + total_characters: 9619 + text_translation_characters: 4892 + document_translation_characters: 0 + text_improvement_characters: 4727 + speech_to_text_minutes: 107.46 + start_date: "2025-09-29T00:00:00" + end_date: "2025-10-01T00:00:00" + 400: + description: Bad request. Please check error message and your parameters. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' + content: + application/json: + schema: + type: object + properties: + message: + type: string + description: Error message describing the issue. + examples: + dateRangeExceeded: + summary: Date range exceeds maximum allowed + value: + message: "Bad request. Reason: Date range cannot exceed 366 days" + invalidGroupBy: + summary: Invalid group_by parameter value + value: + message: "Value for 'group_by' not supported. Allowed: '', 'key', 'key_and_day'." + 403: + $ref: '#/components/responses/Forbidden' + 404: + $ref: '#/components/responses/NotFound' + 500: + $ref: '#/components/responses/InternalServerError' + security: + - auth_header: [ ] /v2/admin/developer-keys: post: tags: @@ -92,6 +212,9 @@ paths: responses: 200: description: The create function returns a JSON representation of the created API key. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -114,6 +237,9 @@ paths: responses: 200: description: The get function returns a JSON representation of all developer API keys in the organization. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -150,6 +276,9 @@ paths: responses: 200: description: The deactivate function returns a JSON representation of the deactivated API key. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -189,6 +318,9 @@ paths: responses: 200: description: The set label function returns a JSON representation of the renamed API key. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -222,9 +354,14 @@ paths: $ref: '#/components/schemas/ApiKeyId' characters: $ref: '#/components/schemas/ApiKeyUsageCharacters' + speech_to_text_milliseconds: + $ref: '#/components/schemas/ApiKeyUsageSpeechToTextMilliseconds' responses: 200: description: The set usage limits function returns a JSON representation of the modified API key. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -267,7 +404,7 @@ paths: source_lang: $ref: '#/components/schemas/SourceLanguage' target_lang: - $ref: '#/components/schemas/TargetLanguageText' + $ref: '#/components/schemas/TargetLanguage' context: $ref: '#/components/schemas/Context' show_billed_characters: @@ -287,10 +424,37 @@ paths: request. type: string example: def3a26b-3e84-45b3-84ae-0c0aaf3525f7 + style_id: + description: |- + Specify the [style rule list](/api-reference/style-rules) to use for the translation. + + **Important:** The target language has to match the language of the style rule list. + + **Note:** Any request with the `style_id` parameter enabled will use `quality_optimized` models. Requests combining `style_id` and `model_type: latency_optimized` will be rejected. + type: string + example: 7ff9bfd6-cd85-4190-8503-d6215a321519 + custom_instructions: + description: |- + Specify a list of instructions to customize the translation behavior. Up to 10 custom instructions can be specified, each with a maximum of 300 characters. + + **Important:** The target language must be `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `zh` or any variants of these languages. + + **Note:** Any request with the `custom_instructions` parameter enabled will default to use the `quality_optimized` model type. Requests combining `custom_instructions` and `model_type: latency_optimized` will be rejected. + type: array + items: + type: string + example: "Use a friendly, diplomatic tone" tag_handling: $ref: '#/components/schemas/TagHandlingOption' + tag_handling_version: + $ref: '#/components/schemas/TagHandlingVersionOption' outline_detection: $ref: '#/components/schemas/OutlineDetectionOption' + enable_beta_languages: + description: |- + No languages are currently in beta. This parameter is maintained for backward compatibility and has no effect. + type: boolean + default: false non_splitting_tags: description: Comma-separated list of XML tags which never split sentences. type: array @@ -327,7 +491,7 @@ paths: source_lang: $ref: '#/components/schemas/SourceLanguage' target_lang: - $ref: '#/components/schemas/TargetLanguageText' + $ref: '#/components/schemas/TargetLanguage' context: $ref: '#/components/schemas/Context' show_billed_characters: @@ -351,6 +515,11 @@ paths: $ref: '#/components/schemas/TagHandlingOption' outline_detection: $ref: '#/components/schemas/OutlineDetectionOptionStr' + enable_beta_languages: + description: |- + No languages are currently in Beta. This parameter is maintained for backward compatibility and has no effect. Previously enabled 81 languages that are now part of the standard language list. See the [full list](/docs/getting-started/supported-languages). + type: boolean + default: false non_splitting_tags: description: Comma-separated list of XML tags which never split sentences. type: array @@ -377,6 +546,9 @@ paths: 200: description: The translate function returns a JSON representation of the translations in the order the text parameters have been specified. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -477,6 +649,7 @@ paths: * `txt` - Plain Text Document * `xlf / xliff` - XLIFF Document, version 2.1 * `srt` - SRT Document + * `jpeg` / `jpg` / `png` - Image (currently in beta) filename: type: string description: The name of the uploaded file. Can be used as an alternative @@ -489,6 +662,11 @@ paths: $ref: '#/components/schemas/Formality' glossary_id: $ref: '#/components/schemas/GlossaryId' + enable_beta_languages: + description: |- + No languages are currently in Beta. This parameter is maintained for backward compatibility and has no effect. Previously enabled 81 languages that are now part of the standard language list. See the [full list](/docs/getting-started/supported-languages). + type: boolean + default: false responses: 200: description: The document function returns a JSON object containing the @@ -497,6 +675,9 @@ paths: generated encryption key. This key is not persistently stored on the server. Therefore, it must be stored by the client and sent back to the server with every subsequent request that refers to this particular document. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -567,6 +748,9 @@ paths: the current status of the translation process. While the translation is running, the estimated number of seconds remaining until the process is done is also included in the response. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -684,6 +868,9 @@ paths: description: The document is provided as a download. There is no other data included in the response besides the document data. The content type used in the response corresponds to the document type. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/octet-stream: schema: @@ -726,6 +913,9 @@ paths: 200: description: A JSON object containing the language pairs in its `supported_languages` property. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -813,6 +1003,9 @@ paths: description: The function for creating a glossary returns a JSON object containing the ID of the newly created glossary and a boolean flag that indicates if the created glossary can already be used in translate requests. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -851,6 +1044,9 @@ paths: responses: 200: description: JSON object containing a the glossaries. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -907,6 +1103,9 @@ paths: responses: 200: description: JSON object containing the glossary meta-information. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -973,6 +1172,9 @@ paths: responses: 200: description: JSON object containing the glossary meta-information. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1070,6 +1272,9 @@ paths: responses: 200: description: The entries in tsv, wrapped in a JSON object. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1159,6 +1364,9 @@ paths: responses: 200: description: JSON object containing the dictionary meta-information. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1219,6 +1427,9 @@ paths: description: The function for creating a glossary returns a JSON object containing the ID of the newly created glossary and a boolean flag that indicates if the created glossary can already be used in translate requests. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1257,6 +1468,9 @@ paths: responses: 200: description: JSON object containing a the glossaries. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1312,6 +1526,9 @@ paths: responses: 200: description: JSON object containing the glossary meta-information. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1411,6 +1628,9 @@ paths: responses: 200: description: The entries in the requested format. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: text/tab-separated-values: example: "Hello!\tGuten Tag!" @@ -1488,6 +1708,9 @@ paths: responses: 200: description: Successful text improvement. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1518,6 +1741,9 @@ paths: responses: 200: description: The account's usage and limits. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1535,13 +1761,27 @@ paths: character_limit: 1000000000000 products: - product_type: write + billing_unit: characters + api_key_unit_count: 0 + account_unit_count: 5643 api_key_character_count: 0 character_count: 5643 - product_type: translate + billing_unit: characters + api_key_unit_count: 636 + account_unit_count: 5941580 api_key_character_count: 636 character_count: 5941580 + - product_type: speech_to_text + billing_unit: milliseconds + api_key_unit_count: 1800000 + account_unit_count: 1800000 + api_key_character_count: 0 + character_count: 0 api_key_character_count: 636 api_key_character_limit: 1000000000000 + speech_to_text_milliseconds_count: 1800000 + speech_to_text_milliseconds_limit: 36000000 start_time: '2025-05-13T09:18:42Z' end_time: '2025-06-13T09:18:42Z' 400: @@ -1589,6 +1829,9 @@ paths: responses: 200: description: JSON array where each item represents a supported language. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' content: application/json: schema: @@ -1615,106 +1858,70 @@ paths: example: - language: AR name: Arabic - supports_formality: false - language: BG name: Bulgarian - supports_formality: false - language: CS name: Czech - supports_formality: false - language: DA name: Danish - supports_formality: false - language: DE name: German - supports_formality: true - language: EL name: Greek - supports_formality: false - - language: EN-GB - name: English (British) - supports_formality: false - - language: EN-US - name: English (American) - supports_formality: false + - language: EN + name: English - language: ES name: Spanish - supports_formality: true - language: ET name: Estonian - supports_formality: false - language: FI name: Finnish - supports_formality: false - language: FR name: French - supports_formality: true + - language: HE + name: Hebrew - language: HU name: Hungarian - supports_formality: false - language: ID name: Indonesian - supports_formality: false - language: IT name: Italian - supports_formality: true - language: JA name: Japanese - supports_formality: true - language: KO name: Korean - supports_formality: false - language: LT name: Lithuanian - supports_formality: false - language: LV name: Latvian - supports_formality: false - language: NB - name: Norwegian (Bokmål) - supports_formality: false + name: Norwegian - language: NL name: Dutch - supports_formality: true - language: PL name: Polish - supports_formality: true - - language: PT-BR - name: Portuguese (Brazilian) - supports_formality: true - - language: PT-PT - name: Portuguese (European) - supports_formality: true + - language: PT + name: Portuguese - language: RO name: Romanian - supports_formality: false - language: RU name: Russian - supports_formality: true - language: SK name: Slovak - supports_formality: false - language: SL name: Slovenian - supports_formality: false - language: SV name: Swedish - supports_formality: false + - language: TH + name: Thai - language: TR name: Turkish - supports_formality: false - language: UK name: Ukrainian - supports_formality: false + - language: VI + name: Vietnamese - language: ZH - name: Chinese (simplified) - supports_formality: false - - language: ZH-HANS - name: Chinese (simplified) - supports_formality: false - - language: ZH-HANT - name: Chinese (traditional) - supports_formality: false + name: Chinese 400: $ref: '#/components/responses/BadRequest' 403: @@ -1735,7 +1942,189 @@ paths: $ref: '#/components/responses/TooManyRequests' security: - auth_header: [ ] + /v3/style_rules: + get: + summary: Retrieve style rule lists + operationId: getStyleRuleLists + parameters: + - name: page + in: query + schema: + type: integer + default: 0 + description: The index of the first page to return. Use with `page_size` to get the next page of rule lists + - name: page_size + in: query + schema: + type: integer + default: 10 + minimum: 1 + maximum: 25 + description: The maximum number of style rule lists to return. + - name: detailed + in: query + schema: + type: boolean + default: false + description: Determines if the rule list's `configured_rules` and `custom_instructions` should be included in the response body. + responses: + 200: + description: JSON object containing the style rule lists. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' + content: + application/json: + schema: + type: object + properties: + style_rules: + type: array + items: + $ref: '#/components/schemas/StyleRuleList' + 401: + $ref: '#/components/responses/Unauthorized' + 403: + $ref: '#/components/responses/Forbidden' + 429: + $ref: '#/components/responses/TooManyRequests' + 500: + $ref: '#/components/responses/InternalServerError' + 503: + $ref: '#/components/responses/ServiceUnavailable' + security: + - auth_header: [] + /v3/voice/realtime: + servers: + - url: https://api.deepl.com + description: Override base path for all operations with the /v3/voice path + post: + tags: + - VoiceAPI + summary: Get Streaming URL + operationId: getVoiceStreamingUrl + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - source_media_content_type + properties: + source_media_content_type: + $ref: '#/components/schemas/VoiceSourceMediaContentType' + source_language: + $ref: '#/components/schemas/VoiceSourceLanguage' + source_language_mode: + $ref: '#/components/schemas/VoiceSourceLanguageMode' + target_languages: + $ref: '#/components/schemas/VoiceTargetLanguages' + message_format: + $ref: '#/components/schemas/VoiceMessageFormat' + glossary_id: + $ref: '#/components/schemas/GlossaryId' + formality: + $ref: '#/components/schemas/VoiceFormality' + examples: + basic: + summary: Basic configuration + value: + source_media_content_type: 'audio/ogg; codecs=opus' + source_language: 'en' + source_language_mode: 'auto' + target_languages: ['de', 'fr', 'es'] + message_format: 'json' + with_glossary: + summary: With glossary and formality + value: + source_media_content_type: 'audio/pcm; encoding=s16le; rate=16000' + source_language: 'en' + source_language_mode: 'fixed' + target_languages: ['de', 'fr'] + message_format: 'msgpack' + glossary_id: 'def3a26b-3e84-45b3-84ae-0c0aaf3525f7' + formality: 'formal' + responses: + 200: + description: Successfully obtained streaming URL and token. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceStreamingResponse' + example: + streaming_url: 'wss://api.deepl.com/v3/voice/realtime/connect' + token: 'VGhpcyBpcyBhIGZha2UgdG9rZW4K' + session_id: '4f911080-cfe2-41d4-8269-0e6ec15a0354' + 400: + $ref: '#/components/responses/BadRequest' + 401: + $ref: '#/components/responses/Unauthorized' + 403: + $ref: '#/components/responses/Forbidden' + 429: + $ref: '#/components/responses/TooManyRequests' + 456: + $ref: '#/components/responses/QuotaExceeded' + 500: + $ref: '#/components/responses/InternalServerError' + 503: + $ref: '#/components/responses/ServiceUnavailable' + security: + - auth_header: [] + get: + tags: + - VoiceAPI + summary: Request Reconnection + operationId: requestReconnection + parameters: + - name: token + in: query + required: true + description: The latest ephemeral token obtained for the stream. + schema: + type: string + example: 'VGhpcyBpcyBhIGZha2UgdG9rZW4K' + responses: + 200: + description: Successfully obtained streaming URL and reconnection token. + headers: + X-Trace-ID: + $ref: '#/components/headers/X-Trace-ID' + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceStreamingResponse' + example: + streaming_url: 'wss://api.deepl.com/v3/voice/realtime/connect' + token: 'VGhpcyBpcyBhIGZha2UgdG9rZW4K' + session_id: '4f911080-cfe2-41d4-8269-0e6ec15a0354' + 400: + $ref: '#/components/responses/BadRequest' + 401: + $ref: '#/components/responses/Unauthorized' + 403: + $ref: '#/components/responses/Forbidden' + 429: + $ref: '#/components/responses/TooManyRequests' + 456: + $ref: '#/components/responses/QuotaExceeded' + 500: + $ref: '#/components/responses/InternalServerError' + 503: + $ref: '#/components/responses/ServiceUnavailable' + security: + - auth_header: [] components: + headers: + X-Trace-ID: + description: A unique identifier for the request that can be included in bug reports to DeepL support. + schema: + type: string + example: 501c3d93cc0c4f11ae2f60a226c2f0f0 parameters: DocumentID: name: document_id @@ -1867,6 +2256,13 @@ components: Setting the limit to `null` disables the limit, effectively allowing unlimited usage. type: number example: 5000 + ApiKeyUsageSpeechToTextMilliseconds: + description: | + Restricts the number of milliseconds of speech-to-text that can be consumed by an API key in a one-month usage period. + Setting the limit to `0` means the API key will not be able to consume speech-to-text milliseconds. + Setting the limit to `null` disables the limit, effectively allowing unlimited usage. + type: number + example: 3600000 ApiKey: description: The API key. type: object @@ -1893,6 +2289,1251 @@ components: properties: characters: $ref: '#/components/schemas/ApiKeyUsageCharacters' + speech_to_text_milliseconds: + $ref: '#/components/schemas/ApiKeyUsageSpeechToTextMilliseconds' + ConfiguredRules: + description: The enabled rules for the style rule list including what option + was selected for each rule. This schema combines rules from all supported + languages. + type: object + properties: + dates_and_times: + type: object + properties: + calendar_era: + type: string + description: Formatting options for Calendar Era + enum: + - use_bc_and_ad + - use_bce_and_ce + centuries: + type: string + description: Formatting options for Centuries + enum: + - spell_out + - use_arabic_numerals + - use_numerals + - use_roman_numerals + date_format: + type: string + description: Formatting options for Date Format + enum: + - use_dd_period_mm_period_yy_with_leading_zeros_for_single_digit_days_and_months + - use_dd_period_mm_period_yyyy + - use_dd_period_mm_period_yyyy_with_leading_zeros_for_single_digit_days_and_months + - use_dd_period_space_abbreviated_month_yyyy_with_abbreviations_jan_period_feb_period_mrz_period_apr_period_mai_jun_period_jul_period_aug_period_sep_period_okt_period_nov_period_dez_period_without_leading_zeros_for_single_digit_days + - use_dd_period_space_abbreviated_month_yyyy_with_abbreviations_jan_period_febr_period_maerz_apr_period_mai_juni_juli_aug_period_sept_period_okt_period_nov_period_dez_period_without_leading_zeros_for_single_digit_days + - use_dd_period_space_month_yyyy_without_leading_zeros_for_single_digit_days + - use_dd_slash_mm_slash_yyyy + - use_dd_slash_mm_slash_yyyy_with_leading_zeros_for_single_digit_days_and_months + - use_dd_space_spelled_out_month_space_yyyy + - use_dd_space_spelled_out_month_space_yyyy_and_use_spanish_word_septiembre_for_ninth_month + - use_dd_space_spelled_out_month_space_yyyy_and_use_spanish_word_setiembre_for_ninth_month + - use_dd_space_spelled_out_month_space_yyyy_without_leading_zeros_for_single_digit_days + - use_historical_eras_and_write_numbers_in_chinese_followed_by_chinese_word_公元前_or_公元后_with_arabic_numerals_in_parentheses + - use_mm_slash_dd_slash_yyyy_with_leading_zeros_for_single_digit_days_and_months + - use_numerals_only_with_leading_zero_for_single_digits + - use_numerals_only_without_leading_zero_for_single_digits + - use_spelled_out_month_space_dd_comma_space_yyyy_and_use_spanish_word_septiembre_for_ninth_month + - use_spelled_out_month_space_dd_comma_space_yyyy_without_leading_zeros_for_single_digit_days + - use_traditional_calendar_system_with_chinese_numbers + - use_yyyy_chinese_word_年_mm_chinese_word_月_dd_chinese_word_日_with_chinese_numbers + - use_yyyy_chinese_word_年_mm_chinese_word_月_dd_chinese_word_日_without_leading_zero_for_single_digit_months_and_days + - use_yyyy_hyphen_mm_hyphen_dd_with_leading_zero_for_single_digit_days_and_months + - use_yyyy_hyphen_mm_hyphen_dd_with_leading_zeros_for_single_digit_days_and_months + - use_yyyy_korean word_년_space_mm_korean word_월_space_dd_korean word_일_without_leading_zero_for_single_digit_days_and_months + - use_yyyy_period_mm_period_dd + - use_yyyy_period_space_mm_period_space_dd_period_space_without_leading_zero_for_single_digit_days_and_months + - use_yyyy_slash_mm_slash_dd + - use_yyyy_slash_mm_slash_dd_with_leading_zero_for_single_digit_days_and_months + dates_in_numerical_form: + type: string + description: Formatting options for Dates In Numerical Form + enum: + - use_dd_hyphen_mm_hyphen_yyyy + - use_dd_period_mm_period_yyyy + - use_dd_slash_mm_slash_yyyy + decades: + type: string + description: Formatting options for Decades + enum: + - spell_out + - use_apostrophe_yy + - use_yy_for_20th_century_but_yyyy_for_other_centuries + - use_yy_without_apostrophe + - use_yyyy + hours_minutes_seconds_separator: + type: string + description: Formatting options for Hours Minutes Seconds Separator + enum: + - use_colon + - use_period + hours_minutes_separator: + type: string + description: Formatting options for Hours Minutes Separator + enum: + - use_colon_without_spaces + - use_letter_h_with_regular_space_on_either_side + - use_letter_h_without_spaces + midnight_in_numerals: + type: string + description: Formatting options for Midnight In Numerals + enum: + - use_00_00 + - use_24_00 + single_digit_days_and_months: + type: string + description: Formatting options for Single Digit Days And Months + enum: + - do_not_use_leading_zero + - use_leading_zero + single_digit_hours: + type: string + description: Formatting options for Single Digit Hours + enum: + - do_not_use_leading_zero + - use_leading_zero + time_format: + type: string + description: Formatting options for Time Format + enum: + - spell_out_time_in_words + - use_12_hour_clock_and_do_not_specify_morning_or_evening + - use_12_hour_clock_and_lowercase_am_or_pm_with_periods + - use_12_hour_clock_and_lowercase_am_or_pm_with_periods_except_use_noon_and_midnight_instead_of_12_am_and_12_pm + - use_12_hour_clock_and_lowercase_am_or_pm_without_periods + - use_12_hour_clock_and_lowercase_am_or_pm_without_periods_except_use_noon_and_midnight_instead_of_12_am_and_12_pm + - use_12_hour_clock_and_specify_morning_or_evening + - use_12_hour_clock_and_uppercase_am_or_pm_with_periods + - use_12_hour_clock_and_uppercase_am_or_pm_with_periods_except_use_noon_and_midnight_instead_of_12_am_and_12_pm + - use_12_hour_clock_and_uppercase_am_or_pm_without_periods + - use_12_hour_clock_and_uppercase_am_or_pm_without_periods_except_use_noon_and_midnight_instead_of_12_am_and_12_pm + - use_12_hour_clock_and_write_chinese_word_上午_or_下午_or_chinese_word_早上_or_晚上_followed_by_arabic_numerals + - use_12_hour_clock_and_write_chinese_word_上午_or_下午_or_chinese_word_早上_or_晚上_followed_by_arabic_numerals_with_chinese_word_点_for_hours + - use_12_hour_clock_and_write_chinese_word_上午_or_下午_or_chinese_word_早上_or_晚上_followed_by_arabic_numerals_with_chinese_words_时_and_分_for_hours_and_minutes + - use_12_hour_clock_and_write_chinese_word_上午_or_下午_or_chinese_word_早上_or_晚上_followed_by_chinese_numbers_with_chinese_words_时_and_分_for_hours_and_minutes + - use_12_hour_clock_with_arabic_numerals_and_colon + - use_12_hour_clock_with_korean_words_시_and_분 + - use_12_hour_clock_without_leading_zero_or_minutes_for_full_hours_use_colon_as_separator_and_lowercase_am_or_pm_without_periods + - use_12_hour_clock_without_leading_zero_or_minutes_for_full_hours_use_colon_as_separator_and_uppercase_am_or_pm_without_periods + - use_12_hour_clock_without_leading_zero_use_period_as_separator_and_lowercase_am_or_pm_with_periods_and_spaces + - use_24_hour_clock + - use_24_hour_clock_with_arabic_numerals_and_colon + - use_24_hour_clock_with_colon_as_separator + - use_24_hour_clock_with_korean_words_시_and_분 + - use_24_hour_clock_with_period_as_separator + - use_hh_colon_mm_german_word_uhr_with_leading_zeros_for_single_digit_hours + - use_hh_colon_mm_german_word_uhr_without_leading_zeros_for_single_digit_hours + - use_hh_period_mm_german_word_uhr_with_leading_zeros_for_single_digit_hours + - use_hh_period_mm_german_word_uhr_without_leading_zeros_for_single_digit_hours + - use_hh_period_mm_german_word_uhr_without_leading_zeros_for_single_digit_hours_and_for_full_hours_state_hour_only + writing_dates: + type: string + description: Formatting options for Writing Dates + enum: + - use_dd_space_spelled_out_month_space_yyyy + - use_numerals + years: + type: string + description: Formatting options for Years + enum: + - use_apostrophe_yy + - use_common_era + - use_japanese_imperial_era + - use_yyyy + formatting: + type: object + properties: + email_address_format: + type: string + description: Formatting options for Email Address Format + enum: + - place_domain_in_parentheses + - replace_at_symbol_with_english_word_at_in_brackets_and_replace_periods_with_english_word_dot_in_brackets + - replace_at_symbol_with_english_word_at_in_brackets_with_space_on_either_side + - replace_at_symbol_with_english_word_at_in_parentheses_with_space_on_either_side + - replace_at_symbol_with_english_word_at_with_space_on_either_side + - use_standard_format + email_address_website_url: + type: string + description: Formatting options for Email Address Website Url + enum: + - use_lowercase_for_email_addresses_and_website_urls_except_when_url_includes_case_sensitive_elements + headings_case_style: + type: string + description: Formatting options for Headings Case Style + enum: + - use_sentence_case_for_titles_and_headings + - use_title_case_for_titles_and_headings + phone_number_country_code_format: + type: string + description: Formatting options for Phone Number Country Code Format + enum: + - use_00_before_country_code + - use_plus_sign_before_country_code + phone_number_format: + type: string + description: Formatting options for Phone Number Format + enum: + - do_not_use_spaces + - do_not_use_spaces_or_special_characters_between_digits_of_phone_number + - keep_original_format + - place_area_code_in_parentheses_followed_by_space + - separate_area_code_and_phone_number_with_slash + - separate_area_code_and_phone_number_with_space + - separate_country_code_area_code_local_prefix_and_last_four_digits_with_hyphens + - separate_country_code_area_code_local_prefix_and_last_four_digits_with_periods + - separate_country_code_area_code_local_prefix_and_last_four_digits_with_spaces + - use_north_american_numbering_plan_format + - use_space_after_country_code + space_between_arabic_numerals_and_unit: + type: string + description: Formatting options for Space Between Arabic Numerals And + Unit + enum: + - do_not_use + space_between_chinese_and_english: + type: string + description: Formatting options for Space Between Chinese And English + enum: + - do_not_use + space_between_chinese_characters_and_arabic_numerals: + type: string + description: Formatting options for Space Between Chinese Characters + And Arabic Numerals + enum: + - do_not_use + titles_headings_punctuation: + type: string + description: Formatting options for Titles Headings Punctuation + enum: + - do_not_use_colon_at_end_of_titles_or_headings + - do_not_use_colons_or_periods_at_end_of_titles_or_headings + numbers: + type: object + properties: + approximate_numbers: + type: string + description: Formatting options for Approximate Numbers + enum: + - use_kanji_numbers + currency_format: + type: string + description: Formatting options for Currency Format + enum: + - spell_out + - spell_out_currency_name_followed_by_amount_in_arabic_numerals_without_space + - spell_out_currency_name_followed_by_amount_in_chinese + - use_amount_followed_by_currency_symbol_without_space + - use_amount_followed_by_space_then_currency_symbol + - use_amount_followed_by_space_then_iso_code + - use_amount_followed_by_space_then_spell_out_currency_name + - use_amount_followed_by_space_then_spell_out_currency_name_in_lowercase + - use_amount_followed_by_spelled_out_currency_name_in_japanese_without_space + - use_amount_followed_by_spelled_out_currency_name_without_space + - use_currency_symbol_but_spell_out_if_no_symbol_exists + - use_currency_symbol_but_use_iso_code_if_no_symbol_exists + - use_currency_symbol_followed_by_amount_in_arabic_numerals_without_space + - use_currency_symbol_followed_by_amount_without_space + - use_currency_symbol_followed_by_space_then_amount + - use_currency_symbol_followed_by_space_then_amount_in_arabic_numerals + - use_full_width_currency_symbol_followed_by_amount_without_space + - use_half_width_currency_symbol_followed_by_amount_without_space + - use_half_width_currency_symbol_followed_by_space_then_amount + - use_iso_code + - use_iso_code_followed_by_space_then_amount + - use_iso_code_followed_by_space_then_amount_in_arabic_numerals + decimal_numbers_less_than_one: + type: string + description: Formatting options for Decimal Numbers Less Than One + enum: + - always_use_0_before_decimal_separator + decimal_separator: + type: string + description: Formatting options for Decimal Separator + enum: + - use_comma_and_do_not_use_thousands_separator + - use_comma_as_decimal_separator + - use_comma_do_not_use_thousands_separator_and_use_period_only_for_radio_stations + - use_period_and_do_not_use_thousands_separator + - use_period_as_decimal_separator + dimensions_separator: + type: string + description: Formatting options for Dimensions Separator + enum: + - use_multiplication_sign_between_dimensions_with_space_on_either_side + - use_multiplication_sign_between_dimensions_without_space_on_either_side + - use_x_between_dimensions_with_space_on_either_side + - use_x_between_dimensions_without_space_on_either_side + equation_formula_reference: + type: string + description: Formatting options for Equation Formula Reference + enum: + - always_use_arabic_numerals_to_number_equations_or_formulas_referenced_in_text + kanji_numbers: + type: string + description: Formatting options for Kanji Numbers + enum: + - use_kanji_numbers_for_numbers_in_phrases_and_counting_method_based_on_native_japanese_readings + large_number_format: + type: string + description: Formatting options for Large Number Format + enum: + - always_use_arabic_numerals + - spell_out_large_numbers + - use_abbreviations_for_large_numbers + - use_chinese_characters_for_ten_thousands_and_hundred_millions + - use_comma_to_separate_large_numbers_into_units_of_three_except_for_calendar_years + - use_kanji_for_trillions_hundred_millions_and_ten_thousands + - use_korean_words_만_억_조_with_space + - use_korean_words_만_억_조_without_space + large_sums_of_money: + type: string + description: Formatting options for Large Sums Of Money + enum: + - spell_out_italian_words_milione_and_miliardo + - use_italian_words_mio_and_mrd_instead_of_italian_words_milione_and_miliardo + large_sums_of_money_format: + type: string + description: Formatting options for Large Sums Of Money Format + enum: + - use_amount_followed_by_abbreviation_for_million_or_billion_without_space + - use_amount_followed_by_space_then_abbreviation_for_million_or_billion + - use_amount_followed_by_space_then_english_word_million_or_billion + list_of_measurements_with_units: + type: string + description: Formatting options for List Of Measurements With Units + enum: + - repeat_unit_for_each_measurement_in_list + mathematical_expression_spacing: + type: string + description: Formatting options for Mathematical Expression Spacing + enum: + - use_space_between_elements_of_mathematical_expression_or_equation + number_format: + type: string + description: Formatting options for Number Format + enum: + - use_half_width_comma_to_separate_large_numbers_into_units_of_three_except_for_calendar_years_and_use_half_width_period_as_decimal_separator + number_separator: + type: string + description: Formatting options for Number Separator + enum: + - do_not_use_chinese_comma_to_separate_numbers_indicating_approximate_value + - use_chinese_comma_to_separate_numbers_in_abbreviations + numbers_of_5_digits_or_more: + type: string + description: Formatting options for Numbers Of 5 Digits Or More + enum: + - use_comma_as_decimal_separator_and_period_as_thousands_separator + - use_comma_as_decimal_separator_and_space_as_thousands_separator + - use_comma_as_decimal_separator_period_as_thousands_separator_and_period_for_radio_stations + - use_comma_as_decimal_separator_space_as_thousands_separator_and_period_for_radio_stations + - use_period_as_decimal_separator_and_comma_as_thousands_separator + - use_period_as_decimal_separator_and_space_as_thousands_separator + numbers_up_to_4_digits: + type: string + description: Formatting options for Numbers Up To 4 Digits + enum: + - use_comma_as_decimal_separator_and_period_as_thousands_separator + - use_comma_as_decimal_separator_and_space_as_thousands_separator + - use_comma_as_decimal_separator_period_as_thousands_separator_and_period_for_radio_stations + - use_comma_as_decimal_separator_space_as_thousands_separator_and_period_for_radio_stations + - use_period_as_decimal_separator_and_comma_as_thousands_separator + - use_period_as_decimal_separator_and_space_as_thousands_separator + percentage_format: + type: string + description: Formatting options for Percentage Format + enum: + - use_arabic_numerals_followed_by_percent_symbol_without_space + - use_chinese_numbers_followed_by_chinese_word_百分之 + - use_numerals_followed_by_full_width_percent_symbol_without_space + - use_numerals_followed_by_japanese_word_パーセント_without_space + - use_numerals_followed_by_korean_word_퍼센트 + - use_numerals_followed_by_percent_symbol + - use_numerals_followed_by_space_then_german_word_prozent + - use_numerals_followed_by_space_then_half_width_percent_symbol + - use_numerals_followed_by_space_then_italian_word_per_cento + - use_numerals_followed_by_space_then_italian_word_percento + - use_numerals_followed_by_space_then_korean_word_퍼센트 + - use_numerals_followed_by_space_then_percent_symbol + - use_numerals_followed_by_space_then_spell_out_per_cent + - use_numerals_followed_by_space_then_spell_out_percent + - use_spanish_word_por_cien + - use_spanish_word_por_ciento + reference_to_symbol: + type: string + description: Formatting options for Reference To Symbol + enum: + - spell_out_symbol_name_followed_by_symbol_in_parentheses + spelling_out_units: + type: string + description: Formatting options for Spelling Out Units + enum: + - abbreviate_units_of_measure_when_used_with_numeral_but_spell_out_when_used_without_numeral + - always_abbreviate_units_of_measure + - always_spell_out_units_of_measure + - spell_out_units_in_korean + - spell_out_units_of_measure_when_used_with_spelled_out_numbers_but_abbreviate_when_used_with_numeral + - spell_out_units_of_measure_with_katakana_or_katakana_and_kanji + - use_si_symbols + - use_unit_symbols + temperature_format: + type: string + description: Formatting options for Temperature Format + enum: + - spell_out_unit + - spell_out_unit_followed_by_numerals_then_korean_word_도 + - use_arabic_numerals_followed_by_space_then_spell_out_unit + - use_arabic_numerals_followed_by_unit_symbol_without_space + - use_arabic_numerals_then_spell_out_unit + - use_chinese_numbers_then_spell_out_unit + - use_italian_word_grado_and_do_not_specify_temperature_scale + - use_numerals_followed_by_japanese_word_度_without_space + - use_numerals_followed_by_korean_word_도 + - use_numerals_followed_by_space_then_spell_out_unit + - use_numerals_followed_by_space_then_unit_symbol + - use_numerals_followed_by_unit_symbol_without_space + - use_spanish_word_grado_and_do_not_specify_temperature_scale + thousands_separator: + type: string + description: Formatting options for Thousands Separator + enum: + - do_not_use + - do_not_use_thousands_separator + - use_comma + - use_comma_to_separate_large_numbers_into_units_of_three + - use_period + - use_period_as_thousands_separator + - use_space + - use_space_as_thousands_separator + - use_space_to_separate_large_numbers_into_units_of_three + - use_straight_apostrophe_as_thousands_separator + units_of_measure_spacing: + type: string + description: Formatting options for Units Of Measure Spacing + enum: + - do_not_use_space_between_numeral_and_unit_of_measure + - use_space_between_numeral_and_unit_of_measure + use_of_hiragana_and_kanji: + type: string + description: Formatting options for Use Of Hiragana And Kanji + enum: + - use_hiragana_japanese_word_か所_or_か月_when_using_arabic_numerals_in_horizontal_writing_but_use_kanji_japanese_word_箇所_or_箇月_when_using_kanji_numbers + writing_numbers: + type: string + description: Formatting options for Writing Numbers + enum: + - always_use_kanji_numbers + - use_arabic_numerals + - use_full_width_arabic_numerals_and_only_use_kanji_numbers_where_it_would_otherwise_sound_unnatural + - use_half_width_arabic_numerals_and_only_use_kanji_numbers_where_it_would_otherwise_sound_unnatural + zero_format: + type: string + description: Formatting options for Zero Format + enum: + - use_chinese_word_〇_for_numbering + - use_chinese_word_零_for_measurement + punctuation: + type: object + properties: + abbreviations: + type: string + description: Formatting options for Abbreviations + enum: + - do_not_separate_abbreviated_words + - separate_each_abbreviated_word_with_period_and_space + - separate_each_abbreviated_word_with_period_without_space + - separate_each_abbreviated_word_with_space_without_period + acronyms: + type: string + description: Formatting options for Acronyms + enum: + - do_not_use_periods + ampersand_abbreviation_spacing: + type: string + description: Formatting options for Ampersand Abbreviation Spacing + enum: + - do_not_use_spaces_before_and_after_ampersand_as_part_of_abbreviation + - use_spaces_before_and_after_ampersand_as_part_of_abbreviation + ampersand_usage: + type: string + description: Formatting options for Ampersand Usage + enum: + - use_english_word_and_except_in_company_names_common_abbreviations_titles_software_code_and_mathematical_equations + - use_full_width_ampersand + - use_german_word_und_except_in_company_names_common_abbreviations_titles_software_code_and_mathematical_equations + - use_half_width_ampersand + apostrophe: + type: string + description: Formatting options for Apostrophe + enum: + - use_curly_apostrophes + - use_straight_apostrophes + bracket: + type: string + description: Formatting options for Bracket + enum: + - use_hexagonal_brackets + - use_lenticular_brackets + - use_parentheses + - use_square_brackets_for_nationality_and_hexagonal_brackets_for_historical_period + chinese_mixed_with_english: + type: string + description: Formatting options for Chinese Mixed With English + enum: + - do_not_place_english_in_quotation_marks + - place_english_in_quotation_marks + colon: + type: string + description: Formatting options for Colon + enum: + - use_full_width_colon + - use_half_width_colon + colon_between_hours_and_minutes_or_chapters_and_verses: + type: string + description: Formatting options for Colon Between Hours And Minutes + Or Chapters And Verses + enum: + - do_not_use_space_before_or_after_colon + colon_in_heading: + type: string + description: Formatting options for Colon In Heading + enum: + - use_space_after_colon_not_before + colon_to_replace_versus_or_to: + type: string + description: Formatting options for Colon To Replace Versus Or To + enum: + - do_not_use_space_before_or_after_colon + comma_after_conjunctive_adverbs: + type: string + description: Formatting options for Comma After Conjunctive Adverbs + enum: + - do_not_use + - use + comma_after_i_e_and_e_g: + type: string + description: Formatting options for Comma After I E And E G + enum: + - do_not_use + - use + comma_after_short_introductory_phrase: + type: string + description: Formatting options for Comma After Short Introductory Phrase + enum: + - do_not_use + - use + comma_and_semicolon: + type: string + description: Formatting options for Comma And Semicolon + enum: + - use_comma_between_clauses + - use_semicolon_between_clauses + corner_bracket_and_periods: + type: string + description: Formatting options for Corner Bracket And Periods + enum: + - add_period_after_closing_corner_bracket_at_end_of_sentence + corner_brackets_and_periods: + type: string + description: Formatting options for Corner Brackets And Periods + enum: + - do_not_add_period_before_closing_corner_bracket_when_sentence_continues + dash: + type: string + description: Formatting options for Dash + enum: + - use_em_dash + - use_hyphen + - use_tilde + ellipsis: + type: string + description: Formatting options for Ellipsis + enum: + - use_ellipsis_character + - use_one_ellipsis_character + - use_six_dots_at_the_bottom + - use_six_dots_in_the_center + - use_three_dots_at_the_bottom + - use_three_dots_in_the_center + - use_three_ellipsis_characters + - use_three_periods + - use_three_periods_without_spaces + - use_three_spaced_periods + - use_two_ellipsis_characters + em_dash: + type: string + description: Formatting options for Em Dash + enum: + - use_double_em_dash + emphasis: + type: string + description: Formatting options for Emphasis + enum: + - use_double_corner_brackets + exclamation_marks: + type: string + description: Formatting options for Exclamation Marks + enum: + - do_not_use + explanatory_note_indicator: + type: string + description: Formatting options for Explanatory Note Indicator + enum: + - use_double_em_dash + - use_parentheses + full_sentence_in_round_brackets: + type: string + description: Formatting options for Full Sentence In Round Brackets + enum: + - add_period_before_closing_round_bracket + highlighting_specific_expressions: + type: string + description: Formatting options for Highlighting Specific Expressions + enum: + - use_single_curly_quotation_marks + - use_single_straight_quotation_marks + japanese_reference_materials: + type: string + description: Formatting options for Japanese Reference Materials + enum: + - use_double_corner_brackets + parentheses_for_supplementary_information: + type: string + description: Formatting options for Parentheses For Supplementary Information + enum: + - use_parentheses_without_space_on_either_side + passage_of_time_and_movement_between_locations: + type: string + description: Formatting options for Passage Of Time And Movement Between + Locations + enum: + - use_double_em_dash + periods_and_commas: + type: string + description: Formatting options for Periods And Commas + enum: + - use_full_width_japanese_periods_and_full_width_japanese_commas + - use_full_width_japanese_periods_and_full_width_non_japanese_commas + - use_full_width_non_japanese_periods_and_full_width_japanese_commas + - use_full_width_non_japanese_periods_and_full_width_non_japanese_commas + periods_in_academic_degrees: + type: string + description: Formatting options for Periods In Academic Degrees + enum: + - do_not_use + - use + periods_in_direct_quotes: + type: string + description: Formatting options for Periods In Direct Quotes + enum: + - do_not_use + - use + periods_in_uppercase_initialisms_and_acronyms: + type: string + description: Formatting options for Periods In Uppercase Initialisms + And Acronyms + enum: + - do_not_use + plus_sign_usage: + type: string + description: Formatting options for Plus Sign Usage + enum: + - do_not_use_plus_sign_to_symbolize_english_word_and_unless_it_is_part_of_a_proper_noun + possessives_of_proper_names_ending_in_s_style: + type: string + description: Formatting options for Possessives Of Proper Names Ending + In S Style + enum: + - add_apostrophe_only + - add_apostrophe_s + quotation_mark: + type: string + description: Formatting options for Quotation Mark + enum: + - use_curly_quotation_marks + - use_double_curly_quotation_marks + - use_double_straight_quotation_marks + - use_guillemets + - use_straight_quotation_marks + quotation_mark_and_apostrophe: + type: string + description: Formatting options for Quotation Mark And Apostrophe + enum: + - use_curly_quotation_marks_and_apostrophes + - use_double_and_single_curly_quotation_marks_and_curly_apostrophes + - use_double_and_single_straight_quotation_marks_and_straight_apostrophes + - use_guillemets_and_curly_apostrophes + - use_guillemets_and_straight_apostrophes + - use_straight_quotation_marks_and_apostrophes + quotation_style: + type: string + description: Formatting options for Quotation Style + enum: + - use_corner_brackets_for_primary_quotations_and_double_corner_brackets_for_secondary_quotations + - use_double_curly_quotation_marks_for_primary_quotations_and_single_curly_quotation_marks_for_secondary_quotations + - use_double_curly_quotation_marks_for_primary_quotations_then_alternate_with_single_curly_quotation_marks_for_nested_quotations + - use_double_german_quotation_marks_for_primary_quotations_and_single_german_quotation_marks_for_secondary_quotations + - use_double_quotation_marks_for_primary_quotations_and_single_quotation_marks_for_secondary_quotations + - use_double_straight_quotation_marks_for_primary_quotations_and_single_straight_quotation_marks_for_secondary_quotations + - use_double_straight_quotation_marks_for_primary_quotations_then_alternate_with_single_straight_quotation_marks_for_nested_quotations + - use_guillemets_for_primary_quotations_and_double_curly_quotation_marks_for_secondary_quotations + - use_guillemets_for_primary_quotations_and_double_straight_quotation_marks_for_secondary_quotations + - use_guillemets_for_primary_quotations_and_single_guillemets_for_secondary_quotations + - use_guillemets_for_primary_quotations_double_curly_quotation_marks_for_secondary_quotations_and_single_curly_quotation_marks_for_further_nested_quotations + - use_reversed_guillemets_for_primary_quotations_and_single_reversed_guillemets_for_secondary_quotations + - use_single_quotation_marks_for_primary_quotations_and_double_quotation_marks_for_secondary_quotations + range_indicator: + type: string + description: Formatting options for Range Indicator + enum: + - use_en_dash_with_spaces + - use_en_dash_without_space_on_either_side + - use_en_dash_without_spaces + - use_english_word_to + - use_full_width_dash + - use_full_width_wave_dash + - use_german_word_bis + - use_half_width_dash + - use_hyphen + - use_hyphen_with_space_on_either_side + - use_hyphen_with_spaces + - use_hyphen_without_space_on_either_side + - use_hyphen_without_spaces + - use_italian_words_da_a + - use_japanese_word_から + - use_korean_words_부터_까지 + - use_spanish_words_de_a + - use_tilde + related_phrases_indicator: + type: string + description: Formatting options for Related Phrases Indicator + enum: + - use_comma + - use_hyphen + - use_middle_dot + round_brackets: + type: string + description: Formatting options for Round Brackets + enum: + - use_full_width_round_brackets + - use_half_width_round_brackets + salutation: + type: string + description: Formatting options for Salutation + enum: + - do_not_use_comma_after_salutation_capitalize_following_word + - use_colon_after_salutation + - use_comma_after_salutation + - use_exclamation_mark_after_salutation + sentence_break_indicator: + type: string + description: Formatting options for Sentence Break Indicator + enum: + - use_em_dash_with_space_on_either_side + - use_em_dash_without_space_on_either_side + - use_en_dash_with_space_on_either_side + serial_comma: + type: string + description: Formatting options for Serial Comma + enum: + - do_not_use + - do_not_use_serial_comma_when_using_chinese_comma + - use + - use_serial_comma_when_using_comma + setting_off_non_quoted_phrases: + type: string + description: Formatting options for Setting Off Non Quoted Phrases + enum: + - use_full_width_quotation_marks + - use_half_width_quotation_marks + slash: + type: string + description: Formatting options for Slash + enum: + - do_not_use_spaces_before_and_after_slashes + - use_spaces_before_and_after_slashes + - use_spaces_before_and_after_slashes_if_there_are_multiple_words_before_and_after_slash + - use_spaces_before_and_after_slashes_if_there_are_multiple_words_before_or_after_slash + slash_usage: + type: string + description: Formatting options for Slash Usage + enum: + - do_not_use_slash_to_symbolize_english_word_or + spacing_and_punctuation: + type: string + description: Formatting options for Spacing And Punctuation + enum: + - do_not_use_space + - use_regular_space + text_in_round_brackets_referring_to_previous_sentence: + type: string + description: Formatting options for Text In Round Brackets Referring + To Previous Sentence + enum: + - add_period_after_closing_round_bracket + - add_period_before_closing_round_bracket + text_in_round_brackets_supplementing_preceding_text: + type: string + description: Formatting options for Text In Round Brackets Supplementing + Preceding Text + enum: + - add_period_after_closing_round_bracket + titles_of_books_and_newspapers: + type: string + description: Formatting options for Titles Of Books And Newspapers + enum: + - use_double_angle_brackets + - use_double_corner_brackets + - use_double_straight_quotation_marks + titles_of_creative_works_trade_names_laws_and_regulations: + type: string + description: Formatting options for Titles Of Creative Works Trade Names + Laws And Regulations + enum: + - use_single_angle_brackets + - use_single_corner_brackets + - use_single_straight_quotation_marks + uppercase_acronyms: + type: string + description: Formatting options for Uppercase Acronyms + enum: + - do_not_use_spaces + - use_spaces + spelling_and_grammar: + type: object + properties: + abbreviating_french_word_numero: + type: string + description: Formatting options for Abbreviating French Word Numero + enum: + - abbreviate_as_n_then_degree_symbol + - abbreviate_as_n_then_o_in_superscript + - abbreviate_as_no + abbreviation_usage: + type: string + description: Formatting options for Abbreviation Usage + enum: + - do_not_use_abbreviations + - do_not_use_abbreviations_unless_necessary + - use_abbreviations + - use_abbreviations_as_needed + accents_and_cedillas: + type: string + description: Formatting options for Accents And Cedillas + enum: + - do_not_use_on_capital_letters + - never_use + - use_even_on_capital_letters + accents_in_verbs_conjugated_like_french_word_céder: + type: string + description: Formatting options for Accents In Verbs Conjugated Like + French Word Céder + enum: + - use_acute_accent + - use_grave_accent + accents_with_subject_verb_inversion: + type: string + description: Formatting options for Accents With Subject Verb Inversion + enum: + - use_acute_accent + - use_grave_accent + active_passive_voice: + type: string + description: Formatting options for Active Passive Voice + enum: + - use_active_voice_if_subject_is_prominent_and_agent_is_clear + - use_active_voice_to_describe_operations_with_user_as_subject + - use_active_voice_unless_agent_is_unknown_or_irrelevant + - use_passive_voice_as_needed + - use_passive_voice_for_automatic_operations_from_user_perspective + - use_passive_voice_if_agent_is_unknown_or_irrelevant + all_caps: + type: string + description: Formatting options for All Caps + enum: + - do_not_use_all_caps_except_for_acronyms_initialisms_or_proper_nouns + - do_not_use_all_caps_except_for_acronyms_or_brand_names + complete_sentences: + type: string + description: Formatting options for Complete Sentences + enum: + - always_write_complete_sentences + compound_nouns: + type: string + description: Formatting options for Compound Nouns + enum: + - write_as_one_word + - write_with_hyphen + conjunctions: + type: string + description: Formatting options for Conjunctions + enum: + - never_start_sentence_with_coordinating_conjunction + contractions: + type: string + description: Formatting options for Contractions + enum: + - do_not_use_contractions + - use_contractions + - use_contractions_but_avoid_negative_contractions + email_address_website_url: + type: string + description: Formatting options for Email Address Website Url + enum: + - use_lowercase_for_email_addresses_and_website_urls_except_when_url_includes_case_sensitive_elements + established_loanwords: + type: string + description: Formatting options for Established Loanwords + enum: + - use_as_is + - use_native_or_sino_korean_equivalents + eszett: + type: string + description: Formatting options for Eszett + enum: + - replace_eszett_with_ss + foreign_word_translation: + type: string + description: Formatting options for Foreign Word Translation + enum: + - use_equivalent_expressions_in_chinese + - use_foreign_forms_or_abbreviations_for_technical_terms_or_brand_names + - use_literal_translation + - use_localized_names_for_brands_with_official_chinese_translations + - use_mixture_of_transliteration_and_translation + - use_transliteration + french_verbs_ending_in_eler_and_eter: + type: string + description: Formatting options for French Verbs Ending In Eler And + Eter + enum: + - transcribe_open_e_sound_by_doubling_next_consonant + - transcribe_open_e_sound_with_grave_accent + i_and_u_with_circumflex_accents: + type: string + description: Formatting options for I And U With Circumflex Accents + enum: + - do_not_use_circumflex_accents_except_in_verbs_and_to_distinguish_homophones + - use_circumflex_accents + informal_address_pronouns: + type: string + description: Formatting options for Informal Address Pronouns + enum: + - capitalize_informal_address_pronouns + - do_not_capitalize_informal_address_pronouns + latin_abbreviations: + type: string + description: Formatting options for Latin Abbreviations + enum: + - do_not_use_latin_abbreviations + passive_voice: + type: string + description: Formatting options for Passive Voice + enum: + - avoid_passive_voice_when_agent_is_known + past_participle_of_french_word_laisser_followed_by_infinitive: + type: string + description: Formatting options for Past Participle Of French Word Laisser + Followed By Infinitive + enum: + - make_french_word_laisser_agree_with_direct_object_complement_if_it_appears_before_verb + - use_invariable_form_french_word_laissé + personal_titles: + type: string + description: Formatting options for Personal Titles + enum: + - abbreviate + - do_not_abbreviate + pluralizing_foreign_words: + type: string + description: Formatting options for Pluralizing Foreign Words + enum: + - use_french_spelling_rules + - use_original_language_spelling + quotation_modification: + type: string + description: Formatting options for Quotation Modification + enum: + - do_not_modify_text_in_quotation_marks + - modify_text_in_quotation_marks_according_to_custom_rules + spanish_word_solo: + type: string + description: Formatting options for Spanish Word Solo + enum: + - never_use_acute_accent + - use_acute_accent_when_used_as_adverb + special_characters: + type: string + description: Formatting options for Special Characters + enum: + - never_use_symbols + spelled_out_numbers: + type: string + description: Formatting options for Spelled Out Numbers + enum: + - use_hyphens + - use_hyphens_between_elements_under_100_and_not_separated_by_french_word_et + umlauts: + type: string + description: Formatting options for Umlauts + enum: + - replace_umlauts_with_ae_oe_ue + unestablished_loanwords: + type: string + description: Formatting options for Unestablished Loanwords + enum: + - paraphrase_in_korean + - use_as_is + - use_as_is_with_explanation_in_parentheses + style_and_tone: + type: object + properties: + abbreviations: + type: string + description: Formatting options for Abbreviations + enum: + - avoid_abbreviations_and_symbols_that_can_be_spelled_out_easily + - use_abbreviations_and_symbols + addressing_non_binary_people: + type: string + description: Formatting options for Addressing Non Binary People + enum: + - use_spanish_word_elle + - use_spanish_word_ellx + addressing_the_reader: + type: string + description: Formatting options for Addressing The Reader + enum: + - use_formal_french_word_vous + - use_formal_italian_word_lei + - use_informal_french_word_tu + - use_informal_italian_word_tu + anglicisms: + type: string + description: Formatting options for Anglicisms + enum: + - avoid_anglicisms_when_there_is_a_french_equivalent + binary_representation_of_gender: + type: string + description: Formatting options for Binary Representation Of Gender + enum: + - avoid_binary_representation_of_gender_when_gender_neutral_language_can_be_used + - replace_binary_representations_of_gender_with_gender_neutral_language + - use_neutral_pronouns + call_to_action: + type: string + description: Formatting options for Call To Action + enum: + - use_calls_to_action + complex_sentences: + type: string + description: Formatting options for Complex Sentences + enum: + - avoid_unnecessarily_complex_sentences + country_names: + type: string + description: Formatting options for Country Names + enum: + - use_long_form + - use_short_form + declarative_endings: + type: string + description: Formatting options for Declarative Endings + enum: + - mix_hapsho_and_haeyo_styles + - use_hae_style + - use_haeyo_style + - use_hapsho_style + - use_hara_style + default_first_person_pronoun: + type: string + description: Formatting options for Default First Person Pronoun + enum: + - do_not_use_first_person_pronouns + - omit_first_person_subject_when_clear_from_context + - use_first_person_pronouns + default_second_person_pronoun: + type: string + description: Formatting options for Default Second Person Pronoun + enum: + - do_not_use_second_person_pronouns + - use_second_person_pronouns + default_third_person_singular_pronoun: + type: string + description: Formatting options for Default Third Person Singular Pronoun + enum: + - use_feminine_pronoun + - use_he_him + - use_he_or_she_him_or_her + - use_masculine_pronoun + - use_masculine_pronoun_german_word_oder_feminine_pronoun + - use_she_her + - use_they_them + directional_language: + type: string + description: Formatting options for Directional Language + enum: + - do_not_use_directional_language + double_negatives: + type: string + description: Formatting options for Double Negatives + enum: + - do_not_use_double_negatives + - use_double_negatives + formality: + type: string + description: Formatting options for Formality + enum: + - use_casual_tone + - use_formal_tone + gender_neutral_language_readability: + type: string + description: Formatting options for Gender Neutral Language Readability + enum: + - use_generic_masculine_for_common_compound_nouns_if_it_increases_readability + gender_unspecified: + type: string + description: Formatting options for Gender Unspecified + enum: + - use_both_masculine_and_feminine_forms + - use_gender_neutral_terms + - use_masculine_form_only + - use_middle_dots + - use_parentheses + - use_periods + gender_unspecified_or_mixed: + type: string + description: Formatting options for Gender Unspecified Or Mixed + enum: + - use_both_feminine_and_masculine_forms + - use_feminine_form_only + - use_inclusive_nouns_and_adjectives + - use_masculine_form_only + - use_neutral_nouns_and_adjectives + idioms_colloquialisms_and_culture_specific_references: + type: string + description: Formatting options for Idioms Colloquialisms And Culture + Specific References + enum: + - do_not_use + inflected_words_masculine_noun_agreement: + type: string + description: Formatting options for Inflected Words Masculine Noun Agreement + enum: + - place_masculine_nouns_closest_to_inflected_words + instructions_style: + type: string + description: Formatting options for Instructions Style + enum: + - use_imperative + - use_indicative + - use_infinitive + - use_modal_verbs + - use_passive_voice + mixing_styles: + type: string + description: Formatting options for Mixing Styles + enum: + - do_not_mix_desu_masu_style_and_dearu_style + modal_verbs: + type: string + description: Formatting options for Modal Verbs + enum: + - avoid_modal_verbs + person_vs_identity_first_language: + type: string + description: Formatting options for Person Vs Identity First Language + enum: + - use_identity_first_language + - use_person_first_language + personal_vs_impersonal_style: + type: string + description: Formatting options for Personal Vs Impersonal Style + enum: + - use_impersonal_style + - use_personal_style + positive_vs_negative_language: + type: string + description: Formatting options for Positive Vs Negative Language + enum: + - use_positive_language + proximity_agreement: + type: string + description: Formatting options for Proximity Agreement + enum: + - use + reader_action_required: + type: string + description: Formatting options for Reader Action Required + enum: + - use_you_must_when_action_is_required_from_reader + redundant_introductory_phrases: + type: string + description: Formatting options for Redundant Introductory Phrases + enum: + - avoid_redundant_introductory_phrases + - do_not_use_redundant_phrases_that_refer_to_current_text + redundant_phrases: + type: string + description: Formatting options for Redundant Phrases + enum: + - avoid_relativizing_and_redundant_phrases + - do_not_use_redundant_phrases + referring_to_non_binary_people: + type: string + description: Formatting options for Referring To Non Binary People + enum: + - use_the_singular_and_plural_schwa + short_vs_long_words: + type: string + description: Formatting options for Short Vs Long Words + enum: + - use_short_words + simple_words_and_sentences: + type: string + description: Formatting options for Simple Words And Sentences + enum: + - use_simple_words_and_sentences_avoid_hard_to_translate_words_and_figures_of_speech + specialized_language: + type: string + description: Formatting options for Specialized Language + enum: + - avoid_specialized_language_unless_text_is_aimed_at_experts + text_position_references: + type: string + description: Formatting options for Text Position References + enum: + - avoid_directional_terms_as_only_reference_to_position_in_text_specify_exact_position_instead + tone: + type: string + description: Formatting options for Tone + enum: + - use_dearu_style_to_give_impression_content_is_accurate_and_rigorous_or_to_convey_sense_of_confidence_and_reliability + - use_desu_masu_style_to_give_impression_content_is_plain_and_straightforward_or_to_give_reader_reassuring_or_soft_impression + verbal_vs_nominal_style: + type: string + description: Formatting options for Verbal Vs Nominal Style + enum: + - use_nominal_style + - use_verbal_style + vocabulary: + type: object + properties: + abbreviations: + type: string + description: Formatting options for Abbreviations + enum: + - write_original_term_then_abbreviation_and_explanation + loanwords: + type: string + description: Formatting options for Loanwords + enum: + - add_explanation_to_loanword_if_difficult_to_rephrase + - rephrase_loanword_in_daily_use_chinese_or_japanese_words_if_possible + - rephrase_loanword_with_another_expression_if_not_established + - use_loanword_as_is_if_well_established Context: description: |- Additional context that can influence a translation but is not translated itself. @@ -1950,6 +3591,83 @@ components: type: array items: $ref: '#/components/schemas/GlossaryDictionary' + CustomInstruction: + description: All enabled custom instructions for the style rule list + type: object + properties: + label: + type: string + description: Name associated with the custom instruction + example: "Currency custom instruction" + prompt: + type: string + description: Prompt of the custom instruction + example: "Have currency symbols before the numerical value (e.g. $100, €100)" + source_language: + type: string + description: Optional source language of the custom instruction + example: "en" + StyleRuleList: + type: object + required: + - style_id + - name + - creation_time + - updated_time + - language + - version + properties: + style_id: + $ref: '#/components/schemas/StyleId' + name: + $ref: '#/components/schemas/StyleRuleName' + creation_time: + description: 'The creation time of the style rule in the ISO 8601-1:2019 format + (e.g.: `2021-08-03T14:16:18.329Z`).' + type: string + format: date-time + updated_time: + description: 'The time of the style rule when it was last updated in the ISO 8601-1:2019 format + (e.g.: `2022-08-03T14:16:18.329Z`).' + type: string + format: date-time + language: + $ref: '#/components/schemas/StyleRuleLanguage' + version: + description: The version of the style rule. Incremented when the style rule is updated. + type: integer + example: 13 + configured_rules: + type: array + description: |- + List of configured rules enabled for the style rule list. + items: + $ref: '#/components/schemas/ConfiguredRules' + custom_instructions: + type: array + description: |- + List of custom instructions enabled for the style rule list. + items: + $ref: '#/components/schemas/CustomInstruction' + StyleId: + type: string + description: A unique ID assigned to a style rule. + example: "bd0a38f3-1831-440b-a8dd-2c702e2325ab" + StyleRuleLanguage: + description: The language that the style rules are applied to. + type: string + enum: + - de + - en + - es + - fr + - it + - ja + - ko + - zh + StyleRuleName: + description: Name associated with the style rule. + type: string DocumentTranslationError: type: object properties: @@ -2262,39 +3980,125 @@ components: SourceLanguage: type: string description: |- - Language of the text to be translated. If this parameter is omitted, the API will attempt to + Language of the text to be translated. If this parameter is omitted, the API will attempt to detect the language of the text and translate it. + + **Note:** Some languages only work with `model_type` set to `quality_optimized`. See [supported languages](https://developers.deepl.com/docs/getting-started/supported-languages) for more details. enum: + - ACE + - AF + - AN - AR + - AS + - AY + - AZ + - BA + - BE - BG + - BHO + - BN + - BR + - BS + - CA + - CEB + - CKB - CS + - CY - DA - DE - EL - EN + - EO - ES - ET + - EU + - FA - FI - FR + - GA + - GL + - GN + - GOM + - GU + - HA + - HE + - HI + - HR + - HT - HU + - HY - ID + - IG + - IS - IT - JA + - JV + - KA + - KK + - KMR - KO + - KY + - LA + - LB + - LMO + - LN - LT - LV + - MAI + - MG + - MI + - MK + - ML + - MN + - MR + - MS + - MT + - MY - NB + - NE - NL + - OC + - OM + - PA + - PAG + - PAM - PL + - PRS + - PS - PT + - QU - RO - RU + - SA + - SCN - SK - SL + - SQ + - SR + - ST + - SU - SV + - SW + - TA + - TE + - TG + - TH + - TK + - TL + - TN - TR + - TS + - TT - UK + - UR + - UZ + - VI + - WO + - XH + - YI + - YUE - ZH + - ZU example: EN TagHandlingOption: description: |- @@ -2306,6 +4110,16 @@ components: - xml - html example: html + TagHandlingVersionOption: + description: |- + Sets which version of the tag handling algorithm should be used. Options currently available: + * `v1`: Traditional algorithm (currently the default, will become deprecated in the future). + * `v2`: Improved algorithm released in October 2025 (will become the default in the future). + + type: string + enum: + - v2 + - v1 NonSplittingTagCommaSeparatedList: allOf: - $ref: '#/components/schemas/TagCommaSeparatedList' @@ -2378,87 +4192,126 @@ components: - p - span TargetLanguage: - type: string - description: The language into which the text should be translated. - enum: - - AR - - BG - - CS - - DA - - DE - - EL - - EN-GB - - EN-US - - ES - - ET - - FI - - FR - - HU - - ID - - IT - - JA - - KO - - LT - - LV - - NB - - NL - - PL - - PT-BR - - PT-PT - - RO - - RU - - SK - - SL - - SV - - TR - - UK - - ZH - - ZH-HANS - - ZH-HANT - example: DE - TargetLanguageText: type: string description: |- The language into which the text should be translated. + + **Note:** Some languages only work with `model_type` set to `quality_optimized`. See [supported languages](https://developers.deepl.com/docs/getting-started/supported-languages) for more details. enum: + - ACE + - AF + - AN - AR + - AS + - AY + - AZ + - BA + - BE - BG + - BHO + - BN + - BR + - BS + - CA + - CEB + - CKB - CS + - CY - DA - DE - EL - - EN-GB - - EN-US + - EN + - EO - ES - - ES-419 - ET + - EU + - FA - FI - FR + - GA + - GL + - GN + - GOM + - GU + - HA - HE + - HI + - HR + - HT - HU + - HY - ID + - IG + - IS - IT - JA + - JV + - KA + - KK + - KMR - KO + - KY + - LA + - LB + - LMO + - LN - LT - LV + - MAI + - MG + - MI + - MK + - ML + - MN + - MR + - MS + - MT + - MY - NB + - NE - NL + - OC + - OM + - PA + - PAG + - PAM - PL - - PT-BR - - PT-PT + - PRS + - PS + - PT + - QU - RO - RU + - SA + - SCN - SK - SL + - SQ + - SR + - ST + - SU - SV + - SW + - TA + - TE + - TG - TH + - TK + - TL + - TN - TR + - TS + - TT - UK + - UR + - UZ - VI + - WO + - XH + - YI + - YUE - ZH - - ZH-HANS - - ZH-HANT + - ZU example: DE TargetLanguageWrite: type: string @@ -2476,36 +4329,6 @@ components: - pt-BR - pt-PT example: de - WritingStyle: - type: string - description: |- - Specify a style to rephrase your text in a way that fits your audience and goals. - The `prefer_` prefix allows falling back to the default style if the language does not yet support styles. - enum: - - academic - - business - - casual - - default - - simple - - prefer_academic - - prefer_business - - prefer_casual - - prefer_simple - WritingTone: - type: string - description: |- - Specify the desired tone for your text. - The `prefer_` prefix allows falling back to the default tone if the language does not yet support tones. - enum: - - confident - - default - - diplomatic - - enthusiastic - - friendly - - prefer_confident - - prefer_diplomatic - - prefer_enthusiastic - - prefer_friendly UsageResponse: type: object properties: @@ -2529,13 +4352,30 @@ components: type: string description: The type of product (e.g., 'write', 'translate'). example: write + billing_unit: + type: string + enum: + - characters + - milliseconds + description: The billing unit for this product type. + example: characters + api_key_unit_count: + type: integer + description: Units used for this product by this API key in the current period. + example: 0 + account_unit_count: + type: integer + description: Total units used for this product in the current period. + example: 5643 api_key_character_count: type: integer - description: Characters used for this product by this API key in the current period. + deprecated: true + description: Use api_key_unit_count instead. Characters used for this product by this API key in the current period." example: 0 character_count: type: integer - description: Total characters used for this product in the current period. + deprecated: true + description: Use account_unit_count instead. Total characters used for this product in the current period." example: 5643 api_key_character_count: type: integer @@ -2545,6 +4385,14 @@ components: type: integer description: Only present for API Pro users. Character limit for this API key in the current period. example: 1000000000000 + speech_to_text_milliseconds_count: + type: integer + description: Only present for API Pro users. Milliseconds of speech-to-text used in the current period. + example: 1800000 + speech_to_text_milliseconds_limit: + type: integer + description: Only present for API Pro users. Milliseconds of speech-to-text limit in the current period. + example: 36000000 start_time: type: string format: date-time @@ -2555,3 +4403,329 @@ components: format: date-time description: Only present for API Pro users. End time of the current billing period (ISO 8601). example: '2025-06-13T09:18:42Z' + VoiceFormality: + description: |- + Sets whether the translated text should lean towards formal or informal language. + Possible options are: + * `default` - use the default formality for the target language + * `formal`/`more` - for a more formal language + * `informal`/`less` - for a more informal language + type: string + enum: + - default + - formal + - more + - informal + - less + default: default + example: formal + VoiceMessageFormat: + description: |- + Message encoding format for WebSocket communication. Determines how messages are serialized and transmitted. + Using `json`, messages are JSON-encoded and sent as TEXT WebSocket frames. All binary fields (such as audio data) are base64-encoded strings. + Using `msgpack`, messages are MessagePack-encoded and sent as BINARY WebSocket frames. All binary fields (such as audio data) contain raw binary data. + type: string + enum: + - json + - msgpack + default: json + example: json + VoiceSourceMediaContentType: + type: string + description: " + The audio format for streaming, which specifies container, codec, and encoding parameters. + See the table below for supported formats. If `audio/auto` is specified, the server + will auto-detect the container and codec for all supported combinations, except PCM. That requires + explicit encoding parameters. All formats need to be single channel audio.\n + \n + | Content Type | Container | Codec |\n + | :------------------------------------ | :------------------------------------------------ | :---------------------------------------- |\n + | `audio/auto` | Auto-detect: FLAC / Matroska / MPEG / Ogg / WebM | Auto-detect AAC / FLAC / MP3 / OPUS |\n + | `audio/flac` | FLAC (flac) | FLAC |\n + | `audio/mpeg` | MPEG (mp3/m4a) | MP3 |\n + | `audio/ogg` | Ogg (ogg/oga) | Auto-detect FLAC / OPUS |\n + | `audio/webm` | WebM (webm) | OPUS |\n + | `audio/x-matroska` | Matroska (mkv/mka) | Auto-detect: AAC / FLAC / MP3 / OPUS |\n + | `audio/ogg;codecs=flac` | Ogg (ogg/oga) | FLAC |\n + | `audio/ogg;codecs=opus` | Ogg (ogg/oga) | OPUS |\n + | `audio/pcm;encoding=alaw;rate=8000` | - | PCM A-Law 8000 Hz (G.711) |\n + | `audio/pcm;encoding=ulaw;rate=8000` | - | PCM µ-Law 8000 Hz (G.711) |\n + | `audio/pcm;encoding=s16le;rate=8000` | - | PCM signed 16-bit little-endian, 8000 Hz |\n + | `audio/pcm;encoding=s16le;rate=16000` | - | PCM signed 16-bit little-endian, 16000 Hz |\n + | `audio/pcm;encoding=s16le;rate=44100` | - | PCM signed 16-bit little-endian, 44100 Hz |\n + | `audio/pcm;encoding=s16le;rate=48000` | - | PCM signed 16-bit little-endian, 48000 Hz |\n + | `audio/webm;codecs=opus` | WebM (webm) | OPUS |\n + | `audio/x-matroska;codecs=aac` | Matroska (mkv/mka) | AAC |\n + | `audio/x-matroska;codecs=flac` | Matroska (mkv/mka) | FLAC |\n + | `audio/x-matroska;codecs=mp3` | Matroska (mkv/mka) | MP3 |\n + | `audio/x-matroska;codecs=opus` | Matroska (mkv/mka) | OPUS |\n + \n + + We recommend the following bitrates as good tradeoff between quality and bandwidth:\n + - AAC: 96 kbps\n + - FLAC: 256 kbps (16000 Hz)\n + - MP3: 128 kbps\n + - OPUS: 32 kbps (recommendation for low bandwidth scenarios)\n + - PCM: 256 kbps (16000 Hz, default recommendation)\n + " + + enum: + - audio/auto + - audio/flac + - audio/mpeg + - audio/ogg + - audio/webm + - audio/x-matroska + - audio/ogg;codecs=flac + - audio/ogg;codecs=opus + - audio/pcm;encoding=alaw;rate=8000 + - audio/pcm;encoding=ulaw;rate=8000 + - audio/pcm;encoding=s16le;rate=8000 + - audio/pcm;encoding=s16le;rate=16000 + - audio/pcm;encoding=s16le;rate=44100 + - audio/pcm;encoding=s16le;rate=48000 + - audio/webm;codecs=opus + - audio/x-matroska;codecs=aac + - audio/x-matroska;codecs=flac + - audio/x-matroska;codecs=mp3 + - audio/x-matroska;codecs=opus + example: audio/ogg;codecs=opus + VoiceSourceLanguage: + type: string + description: > + The source language of the audio stream. It can be left empty or must be one of the + supported Voice API source languages and comply with IETF BCP 47 language tags. + enum: + - de + - cs + - en + - es + - fr + - id + - it + - ja + - ko + - nl + - pl + - pt + - ro + - ru + - sv + - tr + - uk + - zh + default: + example: en + VoiceSourceLanguageMode: + type: string + description: |- + Controls how the source_language value is used. + - `auto`: Treats source language as a hint; server can override + - `fixed`: Treats source language as mandatory; server must use this language + enum: + - auto + - fixed + default: auto + example: fixed + VoiceTargetLanguages: + type: array + description: > + List of target languages for translation. The stream will emit translations for each language. + The maximum allowed target languages per stream is 5. Language identifiers must comply with IETF BCP 47. + items: + type: string + enum: + - ar + - bg + - cs + - da + - de + - el + - en + - en-GB + - en-US + - es + - et + - fi + - fr + - he + - hu + - id + - it + - ja + - ko + - lt + - lv + - nb + - nl + - pl + - pt + - pt-BR + - pt-PT + - ro + - ru + - sk + - sl + - sv + - th + - tr + - uk + - vi + - zh + - zh-HANS + - zh-HANT + + maxItems: 5 + default: [] + example: ["de", "fr", "es"] + VoiceStreamingResponse: + type: object + required: + - streaming_url + - token + properties: + streaming_url: + type: string + description: > + The WebSocket URL to use for establishing + [the stream connection](/api-reference/voice/websocket-streaming). + example: wss://api.deepl.com/v3/voice/realtime/connect + token: + type: string + description: > + A unique ephemeral token for authentication with the streaming endpoint. + Pass this as a query parameter when connecting to + [the streaming URL](/api-reference/voice/websocket-streaming). + This token is ephemeral and valid for a short time and one-time use only. + example: VGhpcyBpcyBhIGZha2UgdG9rZW4K + session_id: + type: string + description: > + Internal use only. A unique identifier for the requested stream. + example: 4f911080-cfe2-41d4-8269-0e6ec15a0354 + WritingStyle: + type: string + description: |- + Specify a style to rephrase your text in a way that fits your audience and goals. + The `prefer_` prefix allows falling back to the default style if the language does not yet support styles. + enum: + - academic + - business + - casual + - default + - simple + - prefer_academic + - prefer_business + - prefer_casual + - prefer_simple + WritingTone: + type: string + description: |- + Specify the desired tone for your text. + The `prefer_` prefix allows falling back to the default tone if the language does not yet support tones. + enum: + - confident + - default + - diplomatic + - enthusiastic + - friendly + - prefer_confident + - prefer_diplomatic + - prefer_enthusiastic + - prefer_friendly + AdminUsageReport: + type: object + description: The response for admin usage statistics. + properties: + usage_report: + $ref: '#/components/schemas/AdminUsageReportData' + AdminUsageReportData: + type: object + description: Contains the detailed usage statistics for the specified date range. + properties: + total_usage: + $ref: '#/components/schemas/UsageBreakdown' + start_date: + type: string + format: date-time + description: Start date of the usage report period. + example: "2025-09-29T00:00:00" + end_date: + type: string + format: date-time + description: End date of the usage report period. + example: "2025-10-01T00:00:00" + group_by: + type: string + description: The grouping method used, if any. + enum: + - key + - key_and_day + example: "key_and_day" + key_usages: + type: array + description: Usage statistics grouped by key. Present when group_by='key'. + items: + $ref: '#/components/schemas/KeyUsageItem' + key_and_day_usages: + type: array + description: Usage statistics grouped by key and day. Present when group_by='key_and_day'. + items: + $ref: '#/components/schemas/KeyAndDayUsageItem' + UsageBreakdown: + type: object + description: Breakdown of character usage by category. + properties: + total_characters: + type: integer + description: Total number of characters used. + example: 9619 + text_translation_characters: + type: integer + description: Number of characters used for text translation. + example: 4892 + document_translation_characters: + type: integer + description: Number of characters used for document translation. + example: 0 + text_improvement_characters: + type: integer + description: Number of characters used for text improvement. + example: 4727 + speech_to_text_minutes: + type: number + description: Duration of speech-to-text usage in minutes. + example: 107.46 + KeyAndDayUsageItem: + type: object + description: Usage statistics for a specific API key and optionally a specific date. + properties: + api_key: + type: string + description: Masked API key identifier. + example: "db96****cb2c" + api_key_label: + type: string + description: Label associated with the API key. + example: "DeepL API Key Prod" + usage_date: + type: string + format: date-time + description: The usage date. Only present when group_by is "key_and_day". + example: "2025-09-29T00:00:00Z" + usage: + $ref: '#/components/schemas/UsageBreakdown' + KeyUsageItem: + type: object + description: Usage statistics for a specific API key and optionally a specific date. + properties: + api_key: + type: string + description: Masked API key identifier. + example: "db96****cb2c" + api_key_label: + type: string + description: Label associated with the API key. + example: "DeepL API Key Prod" + usage: + $ref: '#/components/schemas/UsageBreakdown' diff --git a/api-reference/quality-estimation/quality-estimation-alpha.mdx b/api-reference/quality-estimation/quality-estimation-alpha.mdx new file mode 100644 index 00000000..3786489e --- /dev/null +++ b/api-reference/quality-estimation/quality-estimation-alpha.mdx @@ -0,0 +1,409 @@ +--- +title: "Quality Estimation API - Alpha Release ⚠️" +description: "Evaluate translation quality using DeepL's bilingual quality estimation service" +--- + + + **Alpha Change Expectations**: Updates to this endpoint may be more frequent than normal because this endpoint is expected to have a higher rate of change during alpha development. + + **Reliability Standards**: This alpha endpoint has lower reliability and higher error rate thresholds compared to production APIs. + + **Please Report Issues**: If you notice consistently high error rates or reliability problems, please contact your DeepL representative so we can investigate and address them. + + +## Summary + +The Quality Estimation API evaluates the quality of +translations by comparing source text (original) and target +text (translation) pairs. Rather than simply checking if +texts match, it assesses how well the translation preserves +specific linguistic qualities such as clarity, formality, +grammatical complexity, and other categories. You can +evaluate translations using 16 preset quality categories or even define your own custom +prompt to examine. + +## Customer Access + +Access to this alpha endpoint is granted on a per-customer basis. Due to the alpha nature of this feature: +- Each customer must individually request access to the quality estimation alpha program +- Access is manually granted by contacting your DeepL representative +- This endpoint is not supported by any DeepL SDKs or client libraries +- Breaking changes may occur without notice + +## Endpoint + +``` +POST /unstable/quality-estimation/bilingual +``` + +## Authentication + +This endpoint requires authentication using the `Authorization` header with a valid API key that has access to the quality estimation feature. + +``` +Authorization: DeepL-Auth-Key YOUR_AUTH_KEY +``` + +## Request Formats + + + + ```bash + curl -X POST "https://api.deepl.com/unstable/quality-estimation/bilingual" \ + -H "Authorization: DeepL-Auth-Key YOUR_AUTH_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "source_text": "Hello world", + "source_lang": "en", + "target_text": "Bonjour le monde", + "target_lang": "fr", + "prompts": [ + {"preset_category": "adequacy"}, + {"preset_category": "fluency"} + ] + }' + ``` + + + ```bash + curl -X POST "https://api.deepl.com/unstable/quality-estimation/bilingual" \ + -H "Authorization: DeepL-Auth-Key YOUR_AUTH_KEY" \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "source_text=Hello world" \ + -d "source_lang=en" \ + -d "target_text=Bonjour le monde" \ + -d "target_lang=fr" \ + -d "prompts[0][preset_category]=adequacy" \ + -d "prompts[1][preset_category]=fluency" + ``` + + + ```http + POST /unstable/quality-estimation/bilingual HTTP/1.1 + Host: api.deepl.com + Authorization: DeepL-Auth-Key YOUR_AUTH_KEY + Content-Type: application/json + Content-Length: 238 + + { + "source_text": "Hello world", + "source_lang": "en", + "target_text": "Bonjour le monde", + "target_lang": "fr", + "prompts": [ + {"preset_category": "adequacy"}, + {"preset_category": "fluency"} + ] + } + ``` + + + +### Request Parameters + + + The source text to evaluate. This is the original text before translation. + + + + Language code of the source text. + + Acceptable source languages: `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `zh` + + + + The translated target text to evaluate. This is the translation that will be assessed for quality. + + + + Language code of the target text. + + Acceptable target languages: `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `zh` + + + + List of quality estimation prompts to evaluate. Each prompt object must contain **one** of: + - `preset_category` (string): A predefined quality category + - `custom_prompt` (string): A custom evaluation prompt + + Note that the response will contain results in the same order as the prompts array. + + Available preset categories: `adequacy`,`clarity`, `coherence`, `complexity_of_words`,`creativity`, `emotional_impact`, `engagement`, `fluency`, `formality`, `grammar`,`idiomatic_speech`, `jargon`, `persuasiveness`, `politeness`, `punctuation`, `syntax` + + See [More Details on Special Inputs](#more-details-on-special-inputs) for more info on [Preset Categories](#preset-categories) + and [Custom Prompts](#custom-prompts). + + --- + + **Warning**: Do not provide both fields in one `prompts` object entry, like this: + ```json + { + "preset_category": "fluency", + "custom_prompt": "How well does the style fit a project planning document?" + } + ``` + + Do this: + ```json + [ + { "preset_category": "fluency" }, + { "custom_prompt": "How well does the style fit a project planning document?" } + ] + ``` + + + + + +## Response Formats + + + + ```json + { + "result": [ + { + "quality_estimation_text": "The translation accurately conveys the meaning of the source text without omissions or additions.", + "quality_estimation_score": 5 + }, + { + "quality_estimation_text": "The translation reads naturally and fluently in the target language.", + "quality_estimation_score": 4 + }, + { + // Example with undefined score: + "quality_estimation_text": "The translation maintains good adequacy overall with minor improvements possible in technical terminology.", + } + ] + } + ``` + + The response contains one result object for each prompt in the request, in the same order. + + + ```json + { + "Message": "Missing parameter source_text." + } + ``` + + This error occurs when: + - Required parameters are missing (`source_text`, `source_lang`, `target_text`, `target_lang`, `prompts`) + - Parameters have invalid data types + - JSON is malformed + - Request body is empty + + + ```json + { + "Message": "Forbidden" + } + ``` + + This error occurs when: + - The API key doesn't have access to the quality estimation feature + - The customer doesn't have the required feature flag enabled + - The customer is not enrolled in the alpha program + - Invalid or missing authentication credentials + + + ```json + { + "Message": "Called with an unsupported media type. Supported media types: application/json or application/x-www-form-urlencoded. Please set the Content-Type header to a supported type." + } + ``` + + This error occurs when: + - The `Content-Type` header is missing + - The `Content-Type` header specifies an unsupported format + + + ```json + { + "Message": "Internal server error." + } + ``` + + This error occurs when there are issues with the backend quality estimation service. + + **Note**: As an alpha endpoint, you may encounter higher error rates. Please report persistent 500 errors to your DeepL contact. + + + +### Response Fields + + + Array of quality estimation results. Contains one result object for each prompt in the request, returned in the same order. + + + + Natural language explanation of the quality assessment for this specific prompt. Provides detailed feedback about the translation quality aspect being evaluated. + + + + Optional numeric quality score ranging from 1 to 5, where: + - **5** = Excellent quality + - **4** = Good quality + - **3** = Acceptable quality + - **2** = Poor quality + - **1** = Very poor quality + - **undefined** = No score provided + + The score may be `undefined` if the quality assessment doesn't include a numeric rating. + + + + + +### Prompts Array Structure + +Each item in the `prompts` array is an object with one of these fields: + +**Using Preset Categories:** + +Example: +```json +{ + "preset_category": "adequacy" +} +``` + +**Using Custom Prompts:** +```json +{ + "custom_prompt": "Evaluate whether the translation maintains the technical accuracy of the original text" +} +``` + +**Multiple Prompts:** +```json +{ + "prompts": [ + {"preset_category": "adequacy"}, + {"preset_category": "fluency"} + ] +} +``` + +## More Details on Special Inputs + +### Preset Categories + +The following 16 preset categories are available for quality estimation: + +#### **`adequacy`** +Does the translation accurately preserve the meaning and information given in the original text? + +#### **`clarity`** +Is the text clear and easy to understand or is it confusing, convoluted and difficult to follow? + +**Unclear example:** "The implementation thereof considering various factors which may or may not impact the eventual outcome of said process." + +#### **`coherence`** +Are the ideas in the text coherent and well connected or do they appear random and unrelated to each other? + +**Incoherent example:** "Dogs need exercise. The sky is blue. Some people like pizza. Exercise is important for health." + +**Coherent example:** "Dogs need daily exercise to maintain good health. Regular walks not only provide physical activity but also help establish consistent routines, which veterinarians highly recommend." + +#### **`complexity_of_words`** +Does the text use very common and simple words or does it contain rare, advanced or specialized vocabulary? + +**Low complexity example:** "The dog runs fast." + +**High complexity example:** "The exuberant canine pursued the sphere with remarkable alacrity." + +#### **`creativity`** +Is the content of the text creative and original or is it cliché and predictable? + +**Non-creative example:** "Time heals all wounds." + +**Creative example:** "Time doesn't heal our wounds - it teaches them to dance with us, transforming scars into stories." + +#### **`emotional_impact`** +Does the text cause a strong emotional connection or is there no impact at all? + +**No emotional impact example:** "The event occurred on Tuesday." + +**Strong emotional impact example:** "Tears of joy flowed freely as grandparents embraced grandchildren they'd only known through video calls, their trembling hands touching real faces for the first time in years." + +#### **`engagement`** +Is the text dry and technical or is it highly engaging using vivid language and compelling presentation? + +**Low engagement example:** "The data indicates a 23% increase in productivity." + +**High engagement example:** "In a remarkable achievement, our team shattered all previous records with a stunning 23% productivity increase, transforming our workplace into a hub of innovation." + +#### **`fluency`** +Does the translation seem unnatural and like a machine translation? Is it generally natural but with some awkward phrasing? Or does it appear as if it was originally written in the target language? + +**Non-fluent text:** "I my homework did complete yesterday evening time." + +**Moderately fluent:** "I completed my homework in the time of yesterday evening." + +**Fluent text:** "I finished my homework last night." + +#### **`formality`** +Does the text use casual language, slang or conversational tone, or uses precise, professional language and maintains an objective, impersonal tone throughout? + +#### **`grammar`** +Does the text contain basic grammatical structure, i.e. using simple sentences with basic subject-verb-object order? Or does it use multiple verb tenses, conditional and subjunctive moods, relative clauses, etc.? + +**Simple grammar example:** "The dog runs. The boy plays." + +**Complex grammar example:** "Had the dog not been running so quickly, it might have been caught by the boy, who, having finished his meal, decided that playing outside was preferable to staying indoors, despite the weather having turned colder than expected." + +#### **`idiomatic_speech`** +Is the text purely literal or does it include metaphors, similes, hyperbole and other figures to enhance the text's imagery? + +#### **`jargon`** +Does the text use plain language or is it filled with industry-specific terms and acronyms that would be difficult for a non-expert to understand? + +#### **`persuasiveness`** +Does the text make claims without support or does it provide comprehensive and compelling evidence? + +**Low persuasiveness example:** "Our product is the best choice." + +**High persuasiveness example:** "Our product stands out as the optimal choice, backed by a 95% customer satisfaction rate, independent laboratory testing, and endorsements from industry experts. Furthermore, our five-year warranty demonstrates our confidence in its durability." + +#### **`politeness`** +Is the text using direct, blunt language or does it use courtesy markers, indirect requests and other polite expressions? + +#### **`punctuation`** +Does the text use basic punctuation marks like periods, question marks and exclamation points or does it demonstrate skillful use of advanced markers like semicolons, em dashes, parentheses, etc.? (Depending on the language) + +#### **`syntax`** +Does the text use simple sentences with a single clause or is it using an intricate sentence structure, local and non-local dependencies or multiple levels of subordination? + +**Simple syntax example:** "The dog runs fast. The sun is bright." + +**Complex syntax example:** "Despite the misgivings of the harried council members, who questioned both the veracity of her arcane research and the prudence of embarking on such a perilous voyage—an undertaking complicated further by the baffling instructions, scant provisions, and unreliable cartographic clues—she nevertheless resolved, with an unwavering sense of duty, to traverse the uncharted seas in hopes of unearthing the fabled relic that, if the legends and cryptic manuscripts held any grain of truth, promised to restore balance to their beleaguered kingdom." + +All preset category names are case-sensitive and must be provided exactly as shown above. + +### Custom Prompts + +Please insert your own freeform sentence for evaluation. Results may vary. + +**Examples of strong custom prompts** + +- Assess the technical level of the text - whether the text is highly detailed and domain specific. + +- How well does the style fit a patent document? + + +## Best Practices + +- **Text Quality**: Provide complete, well-formed text in both source and target fields for accurate quality assessment. + +- **Prompt Selection**: Choose preset categories that match your quality criteria, or use custom prompts for specific evaluation needs. + +- **Error Handling**: Always check the HTTP status code and handle errors appropriately. Alpha endpoints may experience higher error rates. + + +## Limitations + +- Custom prompts have length limitations (specific limits may vary) +- Rate limiting applies to prevent abuse +- Operational support is lower grade because of alpha expectations + diff --git a/api-reference/style-rules.mdx b/api-reference/style-rules.mdx new file mode 100644 index 00000000..1a32a4ab --- /dev/null +++ b/api-reference/style-rules.mdx @@ -0,0 +1,147 @@ +--- +title: "Style rules" +sidebarTitle: "Overview" +description: "Manage a shared list of rules for style, formatting, and more" +--- + + + The Style Rules API is currently available only to Pro API subscribers. + + +The style rules feature allows you to select a set of rules to apply when translating text. These rules make changes to your text according to the selected formatting and spelling conventions. + +You can create style rules in the UI at [https://deepl.com/custom-rules](https://deepl.com/custom-rules). + +Both style rules and glossaries are unique to each of DeepL's global data centers and are not shared between them. Clients using the `api-us.deepl.com` endpoint will not be able to access glossaries or style rules created in the UI at this time. + +### Get all style rule lists +Get all style rules lists and their meta-information. + + + + +```sh Example request: get all style rule lists +curl -X GET 'https://api.deepl.com/v3/style_rules' \ +--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' +``` + +```json Example response +{ + "style_rules": [ + { + "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994", + "name": "Technical Documentation Rules", + "creation_time": "2024-10-01T12:34:56Z", + "updated_time": "2024-10-03T12:34:56Z", + "language": "EN", + "version": 8 + } + ] +} +``` +You can also optionally pass in a `detailed` query parameter, to retrieve all configured rules and custom instructions per rule list. + +```sh Example request: get all style rule lists and their configured rules +curl -X GET 'https://api.deepl.com/v3/style_rules?detailed=true' \ +--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' +``` + +```json Example response +{ + "style_rules": [ + { + "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994", + "name": "Technical Documentation Rules", + "creation_time": "2024-10-01T12:34:56Z", + "updated_time": "2024-10-03T12:34:56Z", + "language": "EN", + "version": 8, + "configured_rules": { + "numbers": { + "time_format": "always-use-24-hour-clock" + }, + "style_and_tone": { + "instructions_style": "use-imperative", + "redundant_introductory_words": "avoid-redundant-introductory-words-that-relate-to-current-text" + } + }, + "custom_instructions": { + "label": "My Custom instruction", + "prompt": "Use a friendly, diplomatic tone" + } + } + ] +} +``` + + + +```http Example request: get all style rule lists +GET https://api.deepl.com/v3/style_rules HTTP/2 +Host: api.deepl.com +Authorization: DeepL-Auth-Key [yourAuthKey] +User-Agent: YourApp/1.2.3 +``` +```json Example response +{ + "style_rules": [ + { + "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994", + "name": "Technical Documentation Rules", + "creation_time": "2024-10-01T12:34:56Z", + "updated_time": "2024-10-03T12:34:56Z", + "language": "EN", + "version": 8 + } + ] +} +``` + +You can also optionally pass in a `detailed` query parameter, to retrieve all configured rules and custom instructions per rule list. + +```http Example request: get all style rule lists and their configured rules +GET https://api.deepl.com/v3/style_rules?detailed=true HTTP/2 +Host: api.deepl.com +Authorization: DeepL-Auth-Key [yourAuthKey] +User-Agent: YourApp/1.2.3 +``` +```json Example response +{ + "style_rules": [ + { + "style_id": "a74d88fb-ed2a-4943-a664-a4512398b994", + "name": "Technical Documentation Rules", + "creation_time": "2024-10-01T12:34:56Z", + "updated_time": "2024-10-03T12:34:56Z", + "language": "EN", + "version": 8, + "configured_rules": { + "numbers": { + "time_format": "always-use-24-hour-clock" + }, + "style_and_tone": { + "instructions_style": "use-imperative", + "redundant_introductory_words": "avoid-redundant-introductory-words-that-relate-to-current-text" + } + }, + "custom_instructions": { + "label": "My Custom instruction", + "prompt": "Use a friendly, diplomatic tone" + } + } + ] +} +``` + + + +### Query parameters + +Determines if the rule list's `configured_rules` and `custom_instructions` should be included in the response body. If `detailed` parameter is not included, defaults to `false`. + + +The index of the first page to return. Default: 0 (the first page). Use with `page_size` to get the next page of rule lists. + + +The maximum number of style rule lists to return. Default: 10. Minimum: 1. Maximum: 25. + diff --git a/api-reference/style-rules/list-all-style-rules.mdx b/api-reference/style-rules/list-all-style-rules.mdx new file mode 100644 index 00000000..874c1e0e --- /dev/null +++ b/api-reference/style-rules/list-all-style-rules.mdx @@ -0,0 +1,4 @@ +--- +openapi: get /v3/style_rules +title: "Get all style rule lists" +--- \ No newline at end of file diff --git a/api-reference/style-rules/request-translation.mdx b/api-reference/style-rules/request-translation.mdx new file mode 100644 index 00000000..faba379e --- /dev/null +++ b/api-reference/style-rules/request-translation.mdx @@ -0,0 +1,5 @@ +--- +openapi: /api-reference/style-rules/openapi-temp.yaml post /v2/translate +title: "Translate text" +description: "" +--- \ No newline at end of file diff --git a/api-reference/translate.mdx b/api-reference/translate.mdx index 3dff28a5..5e3284c8 100644 --- a/api-reference/translate.mdx +++ b/api-reference/translate.mdx @@ -7,7 +7,9 @@ public: true The text-translation API currently consists of a single endpoint, `translate`, which is described below. -To learn more about context in DeepL API translations, we recommend [this article](/docs/best-practices/working-with-context). +For highest translation quality, we recommend using our next-gen models. For details, please see [here](/docs/api-reference/translate#about-the-model-type-parameter). + +To learn more about context in DeepL API translations, see our [context parameter guide](/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter). For more detail about request body parameters, see the [Request Body Descriptions](/api-reference/translate#request-body-descriptions) section further down on the page. @@ -165,7 +167,9 @@ These examples are for demonstration purposes only. In production code, the auth Note that we do not include examples for our client libraries in every single section of this reference, but our client libraries *do* support all use cases shown on this page. - Please note that for text translation, characters are still counted toward billing when the source and target languages are equal. + Please note that the Translate API is intended to be used for translation between different languages, but requests with the same source and target language are still counted toward billing. + + If trying to convert between variants of the same language (e.g. `EN-US` to `EN-GB`), please refer to [this guide](/docs/learning-how-tos/examples-and-guides/translating-between-variants). Translating between variants of the same language will result in no change to the text. ### Request Body Descriptions @@ -179,6 +183,9 @@ Note that we do not include examples for our client libraries in every single se The language into which the text should be translated. You can find supported target languages here. + + No languages are currently in beta. This parameter is maintained for backward compatibility and has no effect. + The context parameter makes it possible to include additional context that can influence a translation but is not translated itself. This additional context can potentially improve translation quality when translating short, low-context source texts such as product names on an e-commerce website, article headlines on a news website, or UI elements. @@ -195,20 +202,26 @@ Note that we do not include examples for our client libraries in every single se

    Characters included in the context parameter will not be counted toward billing (i.e., there is no additional cost for using the context parameter, and only characters sent in the text parameter(s) will be counted toward billing for text translation even when the context parameter is included in a request).

    - Specifies which DeepL model should be used for translation. The quality_optimized value is supported only in the Pro v2 API at this time (https://api.deepl.com/v2/translate). + Specifies which DeepL model should be used for translation. -

    Possible values are:

    -
      -
    • latency_optimized (uses lower latency "classic" translation models, which support all language pairs; default value)
    • -
    • quality_optimized (uses higher latency, improved quality "next-gen" translation models, which support only a subset of language pairs; if a language pair that is not supported by next-gen models is included in the request, it will fail. Consider using prefer_quality_optimized instead.)
    • -
    • prefer_quality_optimized (prioritizes use of higher latency, improved quality "next-gen" translation models, which support only a subset of DeepL languages; if a request includes a language pair not supported by next-gen models, the request will fall back to latency_optimized classic models)
    • -
    + Possible values: + - `latency_optimized`: Uses the lowest latency translation models available (usually classic models; default parameter value) + - `quality_optimized`: Uses the highest quality translation models available (currently next-gen models) + - `prefer_quality_optimized`: Same as `quality_optimized`, with fallback to classic models if no next-gen model is present (as of December 2025, all languages have next-gen models) -

    Requests with the model_type parameter will include an additional response field model_type_used to specify whether DeepL's latency_optimized or quality_optimized model was used for translation.

    + When the `model_type` parameter is set, the response includes a `model_type_used` field indicating which model was used. -

    Note: In the future, if DeepL's quality optimized models achieve language pair and latency performance parity with classic models, it's possible that next-gen models will be used regardless of the value passed in the model_type parameter.

    + + To ensure accurate automatic language detection, the API uses next-gen models for all requests that omit `source_lang`, regardless of `model_type`. If your source language is known, you can specify `source_lang` to allow classic models to be used where available for your language pair. See [supported languages](/docs/getting-started/supported-languages) for language-specific model availability. + -

    Language pairs supported by DeepL’s next-gen models are documented below.

    + + [Tag handling v2](/docs/xml-and-html-handling/tag-handling-v2) is compatible only with next-gen models and implicitly sets +`model_type` to `quality_optimized`. Setting both `model_type=latency_optimized` and `tag_handling_version=v2` will return an +error. + + + See [About the model_type parameter](#about-the-model-type-parameter) for more details.
    Sets whether the translation engine should first split the input into sentences. For text translations where tag_handling is not set to html, the default value is 1, meaning the engine splits on punctuation and on newlines. @@ -249,7 +262,7 @@ Note that we do not include examples for our client libraries in every single se - Sets whether the translated text should lean towards formal or informal language. This feature currently only works for target languages DE (German), FR (French), IT (Italian), ES (Spanish), NL (Dutch), PL (Polish), PT-BR and PT-PT (Portuguese), JA (Japanese), and RU (Russian). Learn more about the plain/polite feature for Japanese here. + Sets whether the translated text should lean towards formal or informal language. This feature currently only works for target languages DE (German), FR (French), IT (Italian), ES (Spanish), ES-419 (Latin American Spanish), NL (Dutch), PL (Polish), PT-BR and PT-PT (Portuguese), JA (Japanese), and RU (Russian). Learn more about the plain/polite feature for Japanese ↗️.

    Setting this parameter with a target language that does not support formality will fail, unless one of the prefer_... options are used. Possible options are:

      @@ -266,6 +279,23 @@ Note that we do not include examples for our client libraries in every single se Important: This requires the source_lang parameter to be set and the language pair of the glossary has to match the language pair of the request. + + Specify the style rule list to use for the translation which can be used to customize translations according to the selected formatting and style conventions. + + The target language has to match the language of the style rule list. + + Additionally, any request with the `style_id` parameter enabled will default to use the `quality_optimized` model type. Requests combining `style_id` and `model_type: latency_optimized` will be rejected. + + + + Specify a list of instructions to customize the translation behavior. Up to 10 custom instructions can be specified, each with a maximum of 300 characters. + + + The target language must be `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `zh` or any variants of these languages. + + Any request with the `custom_instructions` parameter enabled will default to use the `quality_optimized` model type. Requests combining `custom_instructions` and `model_type: latency_optimized` will be rejected. You can find best practices on how to write custom instructions [here](/docs/best-practices/custom-instructions). + + When true, the response will include an additional key-value pair with the key billed_characters and a value that is an integer showing the number of characters from the request that will be counted by DeepL for billing purposes. @@ -283,6 +313,13 @@ Note that we do not include examples for our client libraries in every single se
    • html: Enable HTML tag handling; see HTML handling.
    + + Select which version of the tag handling algorithm should be used. See tag handling v2. +
      +
    • v2: Use the improved v2 algorithm.
    • +
    • v1: Use the previous v1 algorithm.
    • +
    +
    The automatic detection of the XML structure won't yield best results in all XML files. You can disable this automatic mechanism altogether by setting the outline_detection parameter to false and selecting the tags that should be considered structure tags. This will split sentences using the splitting_tags parameter. @@ -331,9 +368,11 @@ Note that we do not include examples for our client libraries in every single se ### About the model\_type parameter -The behavior of the `model_type` parameter when the `quality_optimized` or `prefer_quality_optimized` values are sent in a request depends on language pairs that are supported by DeepL’s next-gen translation models. +The `model_type` parameter lets a user specify if they would like to optimize for speed until a request is served (latency) or translation quality. This is done on a best-effort basis by DeepL, not every language pair and feature must behave differently depending on this parameter. +Currently, the DeepL translation API defaults to the classic models if no `model_type` is included in the requests, except for certain languages (e.g. Thai, which is next-gen only) or certain features (e.g. tag handling v2, which only allows `quality_optimized`). +Note that the API intentionally does not allow the user to specify a model, but rather their goal, so that the DeepL backend can choose the most suitable model for the user (this avoids users constantly having to update their code with new model versions and learning many different models name and their specifics). -Currently, all source and target languages are supported by next-gen models. In the future, if we add language pairs that are not supported by next-gen models, a request will fail (if `model_type` is set to `quality_optimized`) or fall back to classic models (if `model_type` is set to `prefer_quality_optimized`) if the chosen language pair does not support next-gen models. +As of December 2025, all source and target languages are supported by next-gen models. Please note that DeepL reserves the right to quietly change which model serves e.g. a `model_type=quality_optimized` request, as long as we think it is a net benefit to the user (e.g. no significant latency increase, but a quality increase, or a significant latency reduction with no or only very slight decrease in quality). The `/languages` endpoint has not yet been updated to include information about `model_type` support, but we expect to make such a change in the future. diff --git a/api-reference/voice.mdx b/api-reference/voice.mdx new file mode 100644 index 00000000..bb849e15 --- /dev/null +++ b/api-reference/voice.mdx @@ -0,0 +1,345 @@ +--- +title: "Translate Speech in Realtime" +sidebarTitle: "Overview" +description: "API reference for real-time voice transcription and translation with the DeepL Voice API." +public: true +--- + +The Voice API provides real-time voice transcription and translation services using a WebSocket connection. + + + DeepL API for speech to text is now **available on request** for customers with a DeepL API Enterprise subscription via the v3 API endpoint. The supported scope of DeepL API for the speech to text functionality is covered in this documentation page. + + Please note that the existing provisions applying to customers' DeepL API Enterprise subscription also apply to DeepL API for speech to text with the following applicable additions to the [Terms and Conditions, the Service Specification and the Data Processing Agreement](/api-reference/voice/deepl-voice-api-service-specification-updates) (as a new sub-processor has been added to serve specific languages for the API for speech to text). + + +## Overview + +The Voice API provides a way to open WebSocket connections to transcribe and translate audio data. With each connection, you can: + +* Send a single audio stream +* Receive transcriptions in the source language +* Receive translations in multiple target languages + +The API uses a two-step flow: +1. [**Request a streaming URL**](/api-reference/voice/request-session) via POST request +2. [**Stream audio**](/api-reference/voice/websocket-streaming) via WebSocket + +## Getting Started + +To start using the Voice API: + +1. Ensure you have a DeepL API Pro account with Voice API access +2. Review the [Request Session](/api-reference/voice/request-session) documentation +3. Review the [WebSocket Streaming](/api-reference/voice/websocket-streaming) documentation +4. Choose your audio format and configuration +5. Implement the two-step flow in your application + +## Supported Languages + +All source languages can be translated into any target language. + + + +
    + Source languages +
    Chinese
    +
    Czech
    +
    Dutch
    +
    English
    +
    French
    +
    German
    +
    Indonesian
    +
    Italian
    +
    Japanese
    +
    Korean
    +
    Polish
    +
    Portuguese
    +
    Romanian
    +
    Russian
    +
    Spanish
    +
    Swedish
    +
    Turkish
    +
    Ukrainian
    +
    +
    + Target languages +
    Arabic
    +
    Bulgarian
    +
    Chinese (Simplified)
    +
    Chinese (Traditional)
    +
    Czech
    +
    Danish
    +
    Dutch
    +
    English (American)
    +
    English (British)
    +
    Estonian
    +
    Finnish
    +
    French
    +
    German
    +
    Greek
    +
    Hebrew
    +
    Hungarian
    +
    Indonesian
    +
    Italian
    +
    Japanese
    +
    Korean
    +
    Latvian
    +
    Lithuanian
    +
    Norwegian Bokmål
    +
    Polish
    +
    Portuguese (Brazil)
    +
    Portuguese (Portugal)
    +
    Romanian
    +
    Russian
    +
    Slovak
    +
    Slovenian
    +
    Spanish
    +
    Swedish
    +
    Thai
    +
    Turkish
    +
    Ukrainian
    +
    Vietnamese
    +
    +
    +
    + +## Supported Audio Formats + +The API supports various common combinations of streaming codecs and containers with a single channel (mono) audio stream. +For a detailed list of supported input audio formats, please refer to +[Source Media Content Type](/api-reference/voice/request-session#body-source-media-content-type). + +| Audio Codec | Audio Container | Recommended Bitrate | +| :--- | :--- | :--- | +| **PCM** | **-** | **256 kbps (16kHz), default recommendation** | +| **OPUS** | **Matroska / Ogg / WebM** | **32 kbps, recommended for low bandwidth scenarios** | +| AAC | Matroska | 96 kbps | +| FLAC | FLAC / Matroska / Ogg | 256 kbps (16kHz) | +| MP3 | Matroska / MPEG | 128 kbps | + + +## Two-Step API Flow + +The Voice API uses a two-step flow to initiate a session. + + + + Make a POST request `v3/voice/realtime` to obtain an ephemeral streaming URL and authentication token. The response will look like this: + + ```json + { + "streaming_url": "wss://api.deepl.com/v3/voice/realtime/connect", + "token": "VGhpcyBpcyBhIGZha2UgdG9rZW4K", + "session_id": "4f911080-cfe2-41d4-8269-0e6ec15a0354" + } + ``` + + This step handles: + * Authentication and authorization + * Main configuration options (audio format, languages, glossaries, message encoding, etc.) + + + URL and token are valid for one-time use only. + + + See the [Request Session](/api-reference/voice/request-session) documentation for details. + + + Use the received URL to establish a WebSocket connection to `wss://api.deepl.com/v3/voice/realtime/connect?token=VGhpcyBpcyBhIGZha2UgdG9rZW4K`. + This step handles exchanging messages on the WebSocket connection: + * Sending audio data + * Receiving transcriptions and translations in real-time + + Messages are sent as TEXT frames (JSON) or BINARY frames (MessagePack), depending on the `message_format` configured in Step 1. + + + Once a WebSocket connection is established, you must send audio data to prevent connection closure within 30 seconds. + + + See the [WebSocket Streaming](/api-reference/voice/websocket-streaming) documentation for details. + + + + +The following sequence diagram shows the flow of messages. +```mermaid +sequenceDiagram + participant Client + participant Voice API + + Note over Client,Voice API: Step 1: Request Session (POST) + + Client->>Voice API: Configuration options + Voice API->>Client: Streaming URL + + Note over Client,Voice API: Step 2: Start Streaming (WebSocket) + + Client->>Voice API: Establish WebSocket connection
    using the streaming URL + + Note over Client,Voice API: WebSocket + + par + loop Send audio data + Client->>Voice API: source_media_chunk + end + and + loop Receive updates + Voice API-->>Client: source_transcript_update + end + and Per target language + loop Receive updates + Voice API-->>Client: target_transcript_update + end + end + + Client->>Voice API: end_of_source_audio + + par + loop Final updates + Voice API-->>Client: source_transcript_update + end + and Per target language + loop Final updates + Voice API-->>Client: target_transcript_update + end + end + + Voice API-->>Client: end_of_source_transcript + + Voice API-->>Client: end_of_target_transcript
    (once per target language) + + Voice API-->>Client: end_of_stream + + Note over Client,Voice API: Stream Closed +``` +`par` means parallel execution and `loop` means looped execution. +
    + +## Reconnecting + +Network connections are inherently unreliable. +Disconnections are unavoidable and must be planned for. +In case your connection gets disconnected, request a new authentication token to pick up where you left off. +Make a GET request `v3/voice/realtime?token=`. +The response will look like this: + +```json +{ + "streaming_url": "wss://api.deepl.com/v3/voice/realtime/connect", + "token": "VGhpcyBpcyBhIGZha2UgdG9rZW4K", + "session_id": "4f911080-cfe2-41d4-8269-0e6ec15a0354" +} +``` + +Use the received URL and token to establish a new WebSocket connection. +Should another reconnection become necessary, repeat the procedure. + +See the [Reconnect Session](/api-reference/voice/reconnect-session) documentation for details. + + +Always use the latest authentication token to request a new authentication token. +The use of outdated tokens will invalidate your session for security reasons. + + + +If you still have an active connection, requesting a reconnection token will disconnect you. + + + +## Message Encoding + +The Voice API supports two message encoding formats for WebSocket communication. +For best developer experience, we recommend starting with the default JSON format +and later switch to MessagePack if you need better performance. + + + WebSocket messages must be sent as TEXT frames when using JSON format, and as BINARY frames when using MessagePack format. Sending the wrong frame type will result in connection errors. + + +**JSON (Default)** + +This format is human-readable and easy to debug. +Messages are JSON-encoded and sent as **TEXT** WebSocket frames. +Fields with binary data (such as audio chunks) are base64-encoded strings. + +**MessagePack** beta + +This format offers better bandwidth and performance characteristics. +Messages are [MessagePack](https://msgpack.org/)-encoded and sent as **BINARY** WebSocket frames. **Messages must be encoded as maps with string keys, not arrays** - ensure your MessagePack library is configured correctly. +Fields with binary data (such as audio chunks) contain raw binary data instead of base64-encoded strings. +Compared to JSON, MessagePack typically reduces bandwidth usage by 25-30% and improves message +encoding/decoding speed by 2x-4x. + + +MessagePack messages **must be encoded as maps with string keys**, +not as arrays. The message structure must match the JSON schema exactly, with all field names +preserved as string keys (e.g., `{"source_media_chunk": {"data": }}`). Array-based encoding is not supported. + +Ensure your MessagePack library is configured to encode objects as maps rather than arrays. +Some libraries default to array encoding for performance - check your library's documentation for the correct configuration. + + + + +```javascript JSON +// Raw binary audio data +const audioData = getAudioChunk(); + +// Base64 encode the audio data +const base64Audio = btoa(audioData); + +const message = { + source_media_chunk: { + data: base64Audio + } +}; + +// Send as TEXT frame +websocket.send(JSON.stringify(message)); +``` + +```javascript MessagePack +import { pack } from 'msgpackr'; + +// Raw binary audio data +const audioData = getAudioChunk(); + +const message = { + source_media_chunk: { + data: audioData // No base64 encoding needed + } +}; + +// Send as BINARY frame +websocket.send(pack(message)); +``` + + + +## How Transcription Updates Work + +Transcriptions and translations are delivered incrementally as the audio is processed: + +* **Concluded segments** - Finalized text that will not change. These segments are sent once and remain fixed. +* **Tentative segments** - Preliminary text that may be refined as more audio context becomes available. These segments may be updated in subsequent messages. + +Your application should merge concluded segments into the final transcript and could display tentative +segments as provisional content that will be updated. + +## Usage Examples + +You can find a reference usage example for python at our +[Github repository for the DeepL Python Library](https://github.com/DeepLcom/deepl-python/tree/main/examples/voice/cli). +There's no integration of the Voice API in the official DeepL SDKs yet, but you can use any WebSocket client library +to interact with the API. + +## Limitations and Constraints + +* Maximum 5 target languages per session +* Audio chunk size: should not exceed 100 kilobyte or 1 second duration +* Recommended chunk duration: 50-250 milliseconds for low latency +* Audio stream speed: maximum 2x real-time +* Timeout: If no data is received for 30 seconds, the session will be terminated +* Maximum connection duration: After 1 hour, the connection will be closed. You can establish a new connection by [reconnecting](/api-reference/voice/reconnect-session) to the session. +* Using any given token more than once to establish a WebSocket connection will terminate the associated session immediately for security reasons. diff --git a/api-reference/voice/deepl-voice-api-service-specification-updates.mdx b/api-reference/voice/deepl-voice-api-service-specification-updates.mdx new file mode 100644 index 00000000..9054e902 --- /dev/null +++ b/api-reference/voice/deepl-voice-api-service-specification-updates.mdx @@ -0,0 +1,119 @@ +--- +title: "DeepL Voice API Service Specification Updates" +--- + + +**In the section "Definitions" the following definition will be added:** + * **"Audio Minutes"** refers to the total duration of audio data streamed through the API, measured in minutes. The calculation of audio minutes is based on the actual playback duration of the audio content, regardless of the speed at which the audio data is transmitted. The duration of audio content is determined by its standard playback speed, which is defined as 1x (normal speed). If audio data is streamed at an accelerated rate, up to a maximum speed allowed in the Documentation, the Audio Minutes are still calculated based on the standard playback duration. + +**In the section "Remuneration" or "Charges" the following paragraph will be added:** + * Deviating from the DeepL API Pro for translating or improving text, the DeepL API Pro for speech to text charges Customer based on the total Audio Minutes streamed, irrespective of the connection duration or the speed of transmission. Any fractional Audio Minutes will be rounded up to the nearest whole minute for billing purposes. + +**In the DeepL Pro Service Specification for the DeepL API Pro and DeepL API Free the following will be added:** + +The DeepL API Pro (v3 endpoint only) also includes a speech-to-text translation function for realtime audio. This function is only available to users with a DeepL API Pro subscription type. The speech-to-text function for realtime audio provides the following functionality: + + + + + + + + + + + + + + + + + +
    Audio StreamRealtime Audio stream to be translated into text in up to 5 languages.
    Input Languages (Audio) +

    The realtime audio stream you want to have translated can be in one of the following languages:

    +
      +
    • `CS` (Czech)
    • +
    • `DE` (German)
    • +
    • `EN` (English)
    • +
    • `ES` (Spanish)
    • +
    • `FR` (French)
    • +
    • `ID` (Indonesian)
    • +
    • `IT` (Italian)
    • +
    • `JA` (Japanese)
    • +
    • `KO` (Korean)
    • +
    • `NL` (Dutch)
    • +
    • `PL` (Polish)
    • +
    • `PT` (Portuguese)
    • +
    • `RO` (Romanian)
    • +
    • `RU` (Russian)
    • +
    • `SV` (Swedish)
    • +
    • `TR` (Turkish)
    • +
    • `UK` (Ukrainian)
    • +
    • `ZH` (Chinese)
    • +
    +
    Target language (Text) +

    The language in which your translations are provided can be one of the following:

    +
      +
    • `AR` (Arabic)
    • +
    • `BG` (Bulgarian)
    • +
    • `CS` (Czech)
    • +
    • `DA` (Danish)
    • +
    • `DE` (German)
    • +
    • `EL` (Greek)
    • +
    • `EN-GB` (British English)
    • +
    • `EN-US` (American-English)
    • +
    • `ES` (Spanish)
    • +
    • `ET` (Estonian)
    • +
    • `FI` (Finnish)
    • +
    • `FR` (French)
    • +
    • `HE` (Hebrew)
    • +
    • `HU` (Hungarian)
    • +
    • `ID` (Indonesian)
    • +
    • `IT` (Italian)
    • +
    • `JA` (Japanese)
    • +
    • `KO` (Korean)
    • +
    • `LT` (Lithuanian)
    • +
    • `LV` (Latvian)
    • +
    • `NL` (Dutch)
    • +
    • `NB` (Norwegian Bokmål)
    • +
    • `PL` (Polish)
    • +
    • `PT-PT` (Portuguese) (all Portuguese varieties excluding Brazilian Portuguese)
    • +
    • `PT-BR` (Brazilian Portuguese)
    • +
    • `PT` (Portuguese) (unspecified variant for backward compatibility; please select `PT-PT` or `PT-BR` instead)
    • +
    • `RO` (Romanian)
    • +
    • `RU` (Russian)
    • +
    • `SK` (Slovak)
    • +
    • `SL` (Slovenian)
    • +
    • `SV` (Swedish)
    • +
    • `TH` (Thai)
    • +
    • `TR` (Turkish)
    • +
    • `UK` (Ukrainian)
    • +
    • `VI` (Vietnamese)
    • +
    • `ZH-HANS` (Chinese (simplified))
    • +
    • `ZH-HANT` (Chinese (traditional))
    • +
    +
    + +The speech to text function returns the following representation of the processing result: + + + + + + + + + + + + + +
    LanguageThe language which has been detected for your audio.
    TextThe translated text(s) and the transcribed source as a text.
    + +The DeepL API Pro for speech to text is designed to process a specific amount of target languages per stream for a specific maximum streaming connection duration and audio chunk size. The exact applicable information and units can be found in the Documentation. The audio stream speed shall not exceed two times real time; exceeding use may be limited, and Customers may encounter a 429 "Too Many Requests" error message, as described in the documentation. + +Applications using the DeepL API Pro should implement a mechanism to handle such responses accordingly and, if appropriate, to try again later. A mechanism increasing the delay for another request exponentially is recommended. + +**Amazon Web Services EMEA SARL will be added as a new sub-processor to the Data Processing Agreement. The following new section will apply:** + +When using the DeepL API Pro speech to text v3 endpoint specific languages will be processed through AWS Transcribe. These languages are currently not set out above and will be explicitly mentioned in our Help Center. DeepL will be available to add these additional languages for the service by leveraging the real-time transcription capabilities of the Amazon Transcribe API. DeepL has concluded a data processing agreement ("DPA") with Amazon Web Services EMEA SARL ("AWS") and therefore AWS may only process the data according to DeepL's instructions and not for their own purposes. When using the v3 endpoint, Customer accepts and agrees that – in case of an existing DPA with DeepL – this DPA will be amended to this regard that AWS will be added as new sub-processors. \ No newline at end of file diff --git a/api-reference/voice/reconnect-session.mdx b/api-reference/voice/reconnect-session.mdx new file mode 100644 index 00000000..52bcf1b1 --- /dev/null +++ b/api-reference/voice/reconnect-session.mdx @@ -0,0 +1,4 @@ +--- +openapi: get /v3/voice/realtime +title: "Reconnect Session" +--- diff --git a/api-reference/voice/request-session.mdx b/api-reference/voice/request-session.mdx new file mode 100644 index 00000000..ffbf9b23 --- /dev/null +++ b/api-reference/voice/request-session.mdx @@ -0,0 +1,4 @@ +--- +openapi: post /v3/voice/realtime +title: "Request Session" +--- diff --git a/api-reference/voice/voice.asyncapi.yaml b/api-reference/voice/voice.asyncapi.yaml new file mode 100644 index 00000000..ae085b66 --- /dev/null +++ b/api-reference/voice/voice.asyncapi.yaml @@ -0,0 +1,448 @@ +asyncapi: 3.0.0 +info: + title: DeepL Voice API - WebSocket Streaming + version: '1.0.0' + description: > + WebSocket streaming API for real-time voice transcription and translation. + After obtaining a streaming URL and token via the REST API, establish a WebSocket connection + to stream audio data and receive real-time transcriptions and translations. + + The API supports two message encoding formats: JSON (default) and MessagePack. + The encoding format is configured via the message_format parameter when requesting a session. + JSON format uses TEXT WebSocket frames. Fields with binary data (such as audio chunks) are base64-encoded strings, + while MessagePack format uses BINARY WebSocket frames where fields with binary data contain raw binary data. + Compared to JSON, MessagePack typically reduces bandwidth usage by 25-30% and improves message + encoding/decoding speed by 2x-4x. + + When using MessagePack encoding, messages must be encoded as maps with string keys, not as arrays. + The message structure must match the JSON schema exactly, with all field names preserved as string keys. + Array-based or integer-keyed encoding is not supported. + contact: + name: DeepL - Contact us + url: https://www.deepl.com/contact-us + +servers: + production: + host: api.deepl.com + pathname: /v3/voice/realtime/connect + protocol: wss + description: DeepL Voice API WebSocket endpoint. + variables: + token: + description: This is the ephemeral authentication token obtained from the REST API + examples: + - VGhpcyBpcyBhIGZha2UgdG9rZW4K + +channels: + voiceStream: + address: /v3/voice/realtime/connect?token={token} + description: > + WebSocket channel for streaming audio and receiving transcriptions and translations. + Messages are exchanged in JSON or MessagePack format. + WebSocket messages are exchanged in TEXT frames when using JSON format and in BINARY frames when using MessagePack format. + Sending the wrong frame type will result in connection errors. + parameters: + token: + description: > + This is the ephemeral authentication token obtained from the + [Request Session](/api-reference/voice/request-session) endpoint. + The token is valid for one-time use only and must be passed as a query parameter when establishing + the WebSocket connection. + examples: + - VGhpcyBpcyBhIGZha2UgdG9rZW4K + messages: + SourceMediaChunk: + $ref: '#/components/messages/SourceMediaChunk' + EndOfSourceMedia: + $ref: '#/components/messages/EndOfSourceMedia' + SourceTranscriptUpdate: + $ref: '#/components/messages/SourceTranscriptUpdate' + TargetTranscriptUpdate: + $ref: '#/components/messages/TargetTranscriptUpdate' + EndOfSourceTranscript: + $ref: '#/components/messages/EndOfSourceTranscript' + EndOfTargetTranscript: + $ref: '#/components/messages/EndOfTargetTranscript' + EndOfStream: + $ref: '#/components/messages/EndOfStream' + Error: + $ref: '#/components/messages/Error' + +operations: + sendAudioData: + action: send + channel: + $ref: '#/channels/voiceStream' + summary: Send audio data to the server + description: |- + Send audio chunks and control messages to the server. + Audio data must be base64-encoded and match the configured format. + messages: + - $ref: '#/channels/voiceStream/messages/SourceTranscriptUpdate' + - $ref: '#/channels/voiceStream/messages/TargetTranscriptUpdate' + - $ref: '#/channels/voiceStream/messages/EndOfSourceTranscript' + - $ref: '#/channels/voiceStream/messages/EndOfTargetTranscript' + - $ref: '#/channels/voiceStream/messages/EndOfStream' + - $ref: '#/channels/voiceStream/messages/Error' + receiveTranscriptions: + action: receive + channel: + $ref: '#/channels/voiceStream' + summary: Receive transcriptions and translations + description: |- + Receive real-time transcription and translation messages from the server. + The server sends transcript updates, end of transcript notifications and errors. + messages: + - $ref: '#/channels/voiceStream/messages/SourceMediaChunk' + - $ref: '#/channels/voiceStream/messages/EndOfSourceMedia' + +components: + messages: + SourceMediaChunk: + name: SourceMediaChunk + title: Source Media Chunk + description: " + The message contains a chunk of audio data. + The audio encoding must be the same that was specified in the [Request Session](/api-reference/voice/request-session) request. + \n\n + When using JSON format, the audio data is base64-encoded. When using MessagePack format, the audio data is raw binary data. + \n\n + The chunk size must not be more than 100 kilobyte or one second in duration. The recommended duration is + 50 - 250 milliseconds to achieve the best tradeoff between latency and quality. + The interval between chunks must not be less than half of the duration of the preceding chunk and not + exceed 30 seconds. Otherwise you will run into rate limits or the session will terminate due to timing out and the connection will be closed. + \n\n + For PCM data the chunk size must be a multiple of the frame size aka encoding unit." + contentType: application/json + payload: + $ref: '#/components/schemas/SourceMediaChunkPayload' + examples: + - name: SourceMediaChunk + summary: Source media chunk + payload: + source_media_chunk: + data: VGhpcyBpcyBhIGZha2UgYXVkaW8gY2h1bmsK + + EndOfSourceMedia: + name: EndOfSourceMedia + title: End of Source Media + description: > + The message indicates the end of source media data. It causes the finalization of tentative transcript segments + and triggers the emission of final transcript updates, end of transcript messages and the end of stream message. + No more data chunks can be sent afterwards. It marks the end of the stream input. + contentType: application/json + payload: + $ref: '#/components/schemas/EndOfSourceMediaPayload' + examples: + - name: EndStream + summary: End of audio stream + payload: + end_of_source_media: {} + + SourceTranscriptUpdate: + name: SourceTranscriptUpdate + title: Source Transcript Update + description: " + The message contains an update to the transcription of the supplied media in the *source* language. + \n\n + Each message is an incremental addition to the already received updates of the *source* transcript with concluded + and tentative text segments. Concluded segments are fixed and will only appear once, while tentative segments + may be updated in subsequent messages as more audio is processed. + \n\n + Clients should merge the concluded segments into a final transcript and update the tentative segments as + new updates arrive." + contentType: application/json + payload: + $ref: '#/components/schemas/SourceTranscriptUpdatePayload' + examples: + - name: TranscriptUpdate + summary: Source language transcript update + payload: + source_transcript_update: + concluded: + - language: en + text: 'Hello, how are you' + start_time: 0 + end_time: 1500 + tentative: + - language: en + text: ' today?' + start_time: 1500 + end_time: 2000 + + TargetTranscriptUpdate: + name: TargetTranscriptUpdate + title: Target Transcript Update + description: " + The message contains an update to the transcription of the supplied media in the *target* language. + \n\n + Each message is an incremental addition to the already received updates of the *target* transcript with concluded + and tentative text segments. Concluded segments are fixed and will only appear once, while tentative segments + may be updated in subsequent messages as more audio is processed. + \n\n + Clients should merge the concluded segments into a final transcript and update the tentative segments + as new updates arrive." + contentType: application/json + payload: + $ref: '#/components/schemas/TargetTranscriptUpdatePayload' + examples: + - name: TranslationUpdate + summary: Target language translation update + payload: + target_transcript_update: + language: es + concluded: + - text: 'Hola, ¿cómo estás' + start_time: 0 + end_time: 1500 + tentative: + - text: ' hoy?' + start_time: 1500 + end_time: 2000 + + EndOfSourceTranscript: + name: EndOfSourceTranscript + title: End of Source Transcript + description: > + The message indicates that the *source* transcript is complete and no further updates will be sent. + It gets emitted after client sends End of Source Media. + contentType: application/json + payload: + $ref: '#/components/schemas/EndOfSourceTranscriptPayload' + examples: + - name: EndSource + summary: Source transcript complete + payload: + end_of_source_transcript: {} + + EndOfTargetTranscript: + name: EndOfTargetTranscript + title: End of Target Transcript + description: > + This message indicates that the *target* transcript is complete and no further updates will be sent. + It gets emitted after client sends End of Source Media. + contentType: application/json + payload: + $ref: '#/components/schemas/EndOfTargetTranscriptPayload' + examples: + - name: EndTarget + summary: Target transcript complete + payload: + end_of_target_transcript: + language: fr + + EndOfStream: + name: EndOfStream + title: End of Stream + description: > + This message indicates that all outputs are complete and the stream ended. + It is the very last message the client will receive after it sends End of Source Media. + You can safely close the connection after you received this message. + contentType: application/json + payload: + $ref: '#/components/schemas/EndOfStreamPayload' + examples: + - name: EndStream + summary: Stream ended + payload: + end_of_stream: {} + + Error: + name: Error + title: Error + description: > + This message reports errors encountered during audio processing or streaming. + It includes an error code, reason code, and a human-readable message. + After an error, the session is terminated and reconnection is not possible. + You need to request a new session. + contentType: application/json + payload: + $ref: '#/components/schemas/ErrorPayload' + examples: + - name: AudioFormatError + summary: Audio format error + payload: + error: + request_type: source_media_chunk + error_code: 400 + reason_code: 4000403 + error_message: Audio format not supported + + schemas: + SourceMediaChunkPayload: + type: object + required: + - source_media_chunk + properties: + source_media_chunk: + type: object + required: + - data + properties: + data: + type: string + format: binary + description: > + Audio data in the audio format specified during session initialization. + Encoded as base64 string when using JSON. Raw binary data when using MessagePack. + + EndOfSourceMediaPayload: + type: object + required: + - end_of_source_media + properties: + end_of_source_media: + type: object + description: Empty object signaling end of media stream + + TranscriptSegment: + type: object + required: + - text + - start_time + - end_time + properties: + text: + type: string + description: Source or target transcript text + start_time: + type: integer + description: Estimated start time of the segment in the input stream in milliseconds + examples: + - 1250 + end_time: + type: integer + description: Estimated end time of the segment in the input stream in milliseconds + examples: + - 1570 + + SourceTranscriptSegment: + allOf: + - $ref: '#/components/schemas/TranscriptSegment' + - type: object + required: + - language + properties: + language: + type: string + description: IETF BCP 47 language tag of the detected source language + examples: + - en + + SourceTranscriptUpdatePayload: + type: object + required: + - source_transcript_update + properties: + source_transcript_update: + type: object + required: + - concluded + - tentative + properties: + concluded: + type: array + # list properties of referenced items here because there is a bug in mintlify that does not render them properly for array types + description: Array of fixed transcript segments that will not change anymore. Array objects contain `language` property of type `string` (IETF BCP 47 language tag of the detected source language), `text` property of type `string` (Source or target transcript text), `start_time` property of type `integer` (Estimated start time of the segment in the input stream in milliseconds) and `end_time` property of type `integer` (Estimated end time of the segment in the input stream in milliseconds). + items: + $ref: '#/components/schemas/SourceTranscriptSegment' + tentative: + type: array + # list properties of referenced items here because there is a bug in mintlify that does not render them properly for array types + description: Array of preliminary transcript segments that are subject to change. Array objects contain `language` property of type `string` (IETF BCP 47 language tag of the detected source language), `text` property of type `string` (Source or target transcript text), `start_time` property of type `integer` (Estimated start time of the segment in the input stream in milliseconds) and `end_time` property of type `integer` (Estimated end time of the segment in the input stream in milliseconds). + items: + $ref: '#/components/schemas/SourceTranscriptSegment' + + TargetTranscriptUpdatePayload: + type: object + required: + - target_transcript_update + properties: + target_transcript_update: + type: object + required: + - language + - concluded + - tentative + properties: + language: + type: string + description: IETF BCP 47 language tag of the target language + examples: + - es + concluded: + type: array + # list properties of referenced items here because there is a bug in mintlify that does not render them properly for array types + description: Array of fixed transcript segments that will not change anymore. Array objects contain `text` property of type `string` (Source or target transcript text), `start_time` property of type `integer` (Estimated start time of the segment in the input stream in milliseconds) and `end_time` property of type `integer` (Estimated end time of the segment in the input stream in milliseconds). + items: + $ref: '#/components/schemas/TranscriptSegment' + tentative: + type: array + # list properties of referenced items here because there is a bug in mintlify that does not render them properly for array types + description: Array of preliminary transcript segments that are subject to change. Array objects contain `text` property of type `string` (Source or target transcript text), `start_time` property of type `integer` (Estimated start time of the segment in the input stream in milliseconds) and `end_time` property of type `integer` (Estimated end time of the segment in the input stream in milliseconds). + items: + $ref: '#/components/schemas/TranscriptSegment' + + EndOfSourceTranscriptPayload: + type: object + required: + - end_of_source_transcript + properties: + end_of_source_transcript: + type: object + description: Empty object indicating source transcript is complete + + EndOfTargetTranscriptPayload: + type: object + required: + - end_of_target_transcript + properties: + end_of_target_transcript: + type: object + required: + - language + properties: + language: + type: string + description: IETF BCP 47 language tag indicating which target transcript has ended + examples: + - fr + + EndOfStreamPayload: + type: object + required: + - end_of_stream + + ErrorPayload: + type: object + required: + - error + properties: + error: + type: object + required: + - request_type + - error_code + - reason_code + - error_message + properties: + request_type: + type: string + description: The type of request that caused the error + examples: + - source_media_chunk + error_code: + type: integer + description: HTTP-style error code + examples: + - 400 + reason_code: + type: integer + description: Detailed reason code for debugging + examples: + - 4000403 + error_message: + type: string + description: Human-readable error description + examples: + - Audio format not supported diff --git a/api-reference/voice/websocket-streaming.mdx b/api-reference/voice/websocket-streaming.mdx new file mode 100644 index 00000000..0406350b --- /dev/null +++ b/api-reference/voice/websocket-streaming.mdx @@ -0,0 +1,4 @@ +--- +asyncapi: voiceStream +title: "WebSocket Streaming" +--- \ No newline at end of file diff --git a/cookie-banner.css b/cookie-banner.css new file mode 100644 index 00000000..c38c81cf --- /dev/null +++ b/cookie-banner.css @@ -0,0 +1,89 @@ +/* DeepL Cookie Consent Banner */ +#cookie-banner { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + background: #0f2b46; + color: #fff; + padding: 20px; + display: flex; + justify-content: space-between; + align-items: center; + gap: 20px; + z-index: 10000; + box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2); + font-family: Roboto, sans-serif; +} + +#cookie-banner-content { + flex: 1; +} + +#cookie-banner-text { + margin: 0; + font-size: 14px; + line-height: 1.5; +} + +#cookie-banner-text a { + color: #4FC3F7; + text-decoration: underline; +} + +#cookie-banner-buttons { + display: flex; + gap: 12px; + flex-shrink: 0; +} + +#cookie-reject, +#cookie-accept { + padding: 10px 20px; + border-radius: 4px; + cursor: pointer; + font-size: 14px; + font-weight: 500; + transition: all 0.2s; + font-family: Roboto, sans-serif; +} + +#cookie-reject { + background: transparent; + color: #fff; + border: 1px solid #fff; +} + +#cookie-reject:hover { + background: rgba(255, 255, 255, 0.1); +} + +#cookie-accept { + background: #fff; + color: #0f2b46; + border: none; +} + +#cookie-accept:hover { + background: #e6e6e6; +} + +/* Responsive design for mobile */ +@media (max-width: 768px) { + #cookie-banner { + flex-direction: column; + align-items: stretch; + gap: 16px; + padding: 16px; + } + + #cookie-banner-buttons { + width: 100%; + justify-content: stretch; + } + + #cookie-reject, + #cookie-accept { + flex: 1; + } +} diff --git a/cookie-banner.js b/cookie-banner.js index ee794b1c..4386ab31 100644 --- a/cookie-banner.js +++ b/cookie-banner.js @@ -1,38 +1,53 @@ -function getCookie(name) { - const value = `; ${document.cookie}`; - const parts = value.split(`; ${name}=`); - if (parts.length === 2) return parts.pop().split(';').shift(); -} +// Constants +const CONSENT_KEY = 'deepl_cookie_consent'; +const CONSENT_ACCEPTED = 'accepted'; +const CONSENT_REJECTED = 'rejected'; const showCookieBanner = () => { - // TODO check if this needs to use the same cookie field as deepl.com - if (getCookie('cookie_consent') === 'true') return; + // Check localStorage for consent + const consent = localStorage.getItem(CONSENT_KEY); + + // Only hide banner if user has explicitly accepted or rejected + if (consent === CONSENT_ACCEPTED || consent === CONSENT_REJECTED) return; const banner = document.createElement('div'); banner.id = 'cookie-banner'; - banner.style.position = 'fixed'; - banner.style.bottom = '0'; - banner.style.left = '0'; - banner.style.width = '100%'; - banner.style.background = '#222'; - banner.style.color = '#fff'; - banner.style.padding = '16px'; - banner.style.display = 'flex'; - banner.style.justifyContent = 'space-between'; - banner.style.alignItems = 'center'; - banner.style.zIndex = '10000'; + banner.innerHTML = ` - DeepL uses cookies to deliver its service. Please find more information in our privacy policy. - + + `; document.body.appendChild(banner); - const ONE_YEAR_SECONDS = 60 * 60 * 24 * 365; + const acceptBtn = document.getElementById('cookie-accept'); + const rejectBtn = document.getElementById('cookie-reject'); - document.getElementById('cookie-accept').onclick = function () { - document.cookie = 'cookie_consent=true; path=/; max-age=' + ONE_YEAR_SECONDS; + acceptBtn.onclick = function () { + localStorage.setItem(CONSENT_KEY, CONSENT_ACCEPTED); + banner.remove(); + // Reload to enable telemetry + window.location.reload(); + }; + + rejectBtn.onclick = function () { + localStorage.setItem(CONSENT_KEY, CONSENT_REJECTED); banner.remove(); }; } -showCookieBanner() \ No newline at end of file + +// Show banner when DOM is ready +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', showCookieBanner); +} else { + showCookieBanner(); +} \ No newline at end of file diff --git a/docs.json b/docs.json index 498bb972..625264cf 100644 --- a/docs.json +++ b/docs.json @@ -2,6 +2,10 @@ "$schema": "https://mintlify.com/docs.json", "theme": "mint", "name": "DeepL Documentation", + "banner": { + "content": "[Join the Developer Community on DeepL Bridges](https://dee.pl/7iwrt)", + "dismissible": true + }, "colors": { "primary": "#0f2b46", "light": "#ffffff", @@ -36,35 +40,37 @@ "docs/getting-started/intro", "docs/getting-started/about", "docs/getting-started/auth", + "docs/getting-started/regional-endpoints", + "docs/getting-started/client-libraries", "docs/getting-started/managing-api-keys", "docs/getting-started/your-first-api-request", "docs/getting-started/test-your-api-requests-with-postman", - "docs/getting-started/supported-languages", - "docs/getting-started/pre-production-checklist", - "docs/getting-started/alpha-and-beta-features" + "docs/getting-started/supported-languages" ] }, { "group": "Learning & How Tos", "pages": [ - { + { "group": "Cookbook", "pages": [ "docs/learning-how-tos/cookbook", "docs/learning-how-tos/cookbook/google-sheets", - "docs/learning-how-tos/cookbook/context-parameter-examples", "docs/learning-how-tos/cookbook/automating-indie-game-localization-with-the-deepl-api-and-godot", - "docs/learning-how-tos/cookbook/java-document-translator" + "docs/learning-how-tos/cookbook/java-document-translator", + "docs/learning-how-tos/cookbook/usage-analytics-dashboard", + "docs/learning-how-tos/cookbook/nodejs-proxy" ] }, { "group": "Guides", "pages": [ - "docs/learning-how-tos/examples-and-guides/", + "docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter", "docs/learning-how-tos/examples-and-guides/placeholder-tags", "docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api", "docs/learning-how-tos/examples-and-guides/glossaries-in-the-real-world", - "docs/learning-how-tos/examples-and-guides/deepl-mcp-server-how-to-build-and-use-translation-in-llm-applications" + "docs/learning-how-tos/examples-and-guides/deepl-mcp-server-how-to-build-and-use-translation-in-llm-applications", + "docs/learning-how-tos/examples-and-guides/translating-between-variants" ] } ] @@ -74,9 +80,11 @@ "pages": [ "docs/best-practices/error-handling", "docs/best-practices/cors-requests", - "docs/best-practices/working-with-context", + "docs/best-practices/document-translations", "docs/best-practices/language-detection", - "docs/best-practices/cost-control" + "docs/best-practices/cost-control", + "docs/best-practices/pre-production-checklist", + "docs/best-practices/custom-instructions" ] }, { @@ -85,25 +93,28 @@ "docs/xml-and-html-handling/xml", "docs/xml-and-html-handling/structured-content", "docs/xml-and-html-handling/customized-xml-outline-detection", - "docs/xml-and-html-handling/html" + "docs/xml-and-html-handling/html", + "docs/xml-and-html-handling/tag-handling-v2" ] }, { "group": "Resources", "pages": [ - "docs/resources/release-notes", + "docs/resources/roadmap-and-release-notes", + "docs/resources/usage-limits", + "docs/resources/deepl-developer-community", { - "group": "Breaking changes (Change Notices)", + "group": "Breaking changes (change notices)", "pages": [ "docs/resources/breaking-changes-change-notices", "docs/resources/breaking-changes-change-notices/july-2024-deprecation-of-insecure-cipher-suites", - "docs/resources/breaking-changes-change-notices/march-2025-deprecating-get-requests-to-translate-and-authenticating-with-auth_key" + "docs/resources/breaking-changes-change-notices/march-2025-deprecating-get-requests-to-translate-and-authenticating-with-auth_key", + "docs/resources/breaking-changes-change-notices/november-2025-deprecation-of-legacy-auth-methods" ] }, "docs/resources/language-release-process", - "docs/resources/usage-limits", - "docs/resources/open-api-spec", - "docs/resources/deepl-developer-community" + "docs/resources/alpha-and-beta-features", + "docs/resources/open-api-spec" ] } ] @@ -114,70 +125,77 @@ { "group": "API Reference", "pages": [ - { - "group": "Translate text", - "pages": [ - "api-reference/translate", - "api-reference/translate/request-translation" - ] - }, - { - "group": "Translate documents", - "pages": [ - "api-reference/document", - "api-reference/document/upload-and-translate-a-document", - "api-reference/document/check-document-status", - "api-reference/document/download-translated-document" - ] - }, - { - "group": "Improve text", - "pages": [ - "api-reference/improve-text", - "api-reference/improve-text/request-text-improvement" - ] - }, - { - "group": "Glossaries", - "pages": [ - "api-reference/multilingual-glossaries", - "api-reference/multilingual-glossaries/list-language-pairs-supported-by-glossaries", - "api-reference/multilingual-glossaries/create-a-glossary", - "api-reference/multilingual-glossaries/list-all-glossaries", - "api-reference/multilingual-glossaries/retrieve-glossary-details", - "api-reference/multilingual-glossaries/edit-glossary-details", - "api-reference/multilingual-glossaries/retrieve-glossary-entries", - "api-reference/multilingual-glossaries/delete-a-glossary", - "api-reference/multilingual-glossaries/deletes-the-dictionary-associated-with-the-given-language-pair-with-the-given-glossary-id", - "api-reference/multilingual-glossaries/replaces-or-creates-a-dictionary-in-the-glossary-with-the-specified-entries", - { - "group": "Manage Monolingual Glossaries", - "pages": [ - "api-reference/glossaries", - "api-reference/glossaries/v2-vs-v3-endpoints", - "api-reference/glossaries/create-a-glossary", - "api-reference/glossaries/list-all-glossaries", - "api-reference/glossaries/retrieve-glossary-details", - "api-reference/glossaries/retrieve-glossary-entries", - "api-reference/glossaries/delete-a-glossary" - ] - } - ] - }, - { - "group": "Retrieve usage and quota", - "pages": [ - "api-reference/usage-and-quota", - "api-reference/usage-and-quota/check-usage-and-limits" - ] - }, - { - "group": "Retrieve languages", - "pages": [ - "api-reference/languages", - "api-reference/languages/retrieve-supported-languages" - ] - }, + { + "group": "Translate text", + "pages": [ + "api-reference/translate", + "api-reference/translate/request-translation" + ] + }, + { + "group": "Translate documents", + "pages": [ + "api-reference/document", + "api-reference/document/upload-and-translate-a-document", + "api-reference/document/check-document-status", + "api-reference/document/download-translated-document" + ] + }, + { + "group": "Improve text", + "pages": [ + "api-reference/improve-text", + "api-reference/improve-text/request-text-improvement" + ] + }, + { + "group": "Glossaries", + "pages": [ + "api-reference/multilingual-glossaries", + "api-reference/multilingual-glossaries/list-language-pairs-supported-by-glossaries", + "api-reference/multilingual-glossaries/create-a-glossary", + "api-reference/multilingual-glossaries/list-all-glossaries", + "api-reference/multilingual-glossaries/retrieve-glossary-details", + "api-reference/multilingual-glossaries/edit-glossary-details", + "api-reference/multilingual-glossaries/retrieve-glossary-entries", + "api-reference/multilingual-glossaries/delete-a-glossary", + "api-reference/multilingual-glossaries/deletes-the-dictionary-associated-with-the-given-language-pair-with-the-given-glossary-id", + "api-reference/multilingual-glossaries/replaces-or-creates-a-dictionary-in-the-glossary-with-the-specified-entries", + { + "group": "Manage Monolingual Glossaries", + "pages": [ + "api-reference/glossaries", + "api-reference/glossaries/v2-vs-v3-endpoints", + "api-reference/glossaries/create-a-glossary", + "api-reference/glossaries/list-all-glossaries", + "api-reference/glossaries/retrieve-glossary-details", + "api-reference/glossaries/retrieve-glossary-entries", + "api-reference/glossaries/delete-a-glossary" + ] + } + ] + }, + { + "group": "Style rules", + "pages": [ + "api-reference/style-rules", + "api-reference/style-rules/list-all-style-rules" + ] + }, + { + "group": "Retrieve usage and quota", + "pages": [ + "api-reference/usage-and-quota", + "api-reference/usage-and-quota/check-usage-and-limits" + ] + }, + { + "group": "Retrieve languages", + "pages": [ + "api-reference/languages", + "api-reference/languages/retrieve-supported-languages" + ] + }, { "group": "Admin API", "pages": [ @@ -188,13 +206,26 @@ "api-reference/admin-api/managing-developer-keys/get-keys", "api-reference/admin-api/managing-developer-keys/deactivate-key", "api-reference/admin-api/managing-developer-keys/rename-key", - "api-reference/admin-api/managing-developer-keys/set-usage-limits" + "api-reference/admin-api/managing-developer-keys/set-usage-limits", + "api-reference/admin-api/organization-usage-analytics", + "api-reference/admin-api/get-usage-analytics" + ] + }, + { + "group": "Agent API", + "pages": [ + "api-reference/agent-api", + "api-reference/agent-api/trigger-workflow", + "api-reference/agent-api/get-task-result" ] }, { - "group": "Client libraries", + "group": "Translate Speech in Realtime", "pages": [ - "api-reference/client-libraries" + "api-reference/voice", + "api-reference/voice/request-session", + "api-reference/voice/websocket-streaming", + "api-reference/voice/reconnect-session" ] } ] @@ -227,7 +258,7 @@ "footer": { "socials": { "facebook": "https://www.facebook.com/DeepLcom/", - "linkedin": "https://www.linkedin.com/company/linkedin-com-company-deepl/", + "linkedin": "https://www.linkedin.com/company/deepl", "github": "https://github.com/DeepLcom", "instagram": "https://www.instagram.com/deeplhq/" } @@ -246,110 +277,150 @@ } }, "redirects": [ - { - "source": "/docs/api-reference/improve-text/openapi-spec-for-text-improvement", - "destination": "/api-reference/improve-text/request-text-improvement" - }, - { - "source": "/docs/api-reference/languages/openapi-spec-for-retrieving-languages", - "destination": "/api-reference/languages/retrieve-supported-languages" - }, - { - "source": "/docs/api-reference/translate/openapi-spec-for-text-translation", - "destination": "/api-reference/translate/request-translation" - }, - { - "source": "/docs/api-reference/document/openapi-spec-for-document-translation", - "destination": "/api-reference/document/upload-and-translate-a-document" - }, - { - "source": "/docs/api-reference/glossaries/openapi-spec-for-glossary-management", - "destination": "/api-reference/multilingual-glossaries/create-a-glossary" - }, - { - "source": "/docs/api-reference/glossaries/glossaries/openapi-spec-for-glossary-management", - "destination": "/api-reference/glossaries/create-a-glossary" - }, - { - "source": "/docs/api-reference/usage-and-quota/openapi-spec-for-retrieving-usage-and-quota", - "destination": "/api-reference/usage-and-quota/check-usage-and-limits" - }, - { - "source": "/docs/api-reference/glossaries/glossaries", - "destination": "/api-reference/glossaries" - }, - { - "source": "/docs/api-reference", - "destination": "/api-reference" - }, - { - "source": "/docs/api-reference/:page*", - "destination": "/api-reference/:page*" - }, - { - "source": "/multiple-api-keys", - "destination": "/docs/multiple-api-keys" - }, - { - "source": "/docs/examples/cookbook", - "destination": "/docs/learning-how-tos/cookbook" - }, - { - "source": "/docs/examples/cookbook/:page*", - "destination": "/docs/learning-how-tos/cookbook/:page*" - }, - { - "source": "/docs/learning-how-tos/examples-and-guides/deepl-api-101", - "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" - }, - { - "source": "/docs/learning-how-tos/examples-and-guides/deepl-api-101/first-things-to-try-with-the-deepl-api", - "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" - }, - { - "source": "/docs/resources/examples-and-guides/deepl-api-101", - "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" - }, - { - "source": "/docs/resources/examples-and-guides/deepl-api-101/first-things-to-try-with-the-deepl-api", - "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" - }, - { - "source": "/docs/resources/examples-and-guides", - "destination": "/docs/learning-how-tos/examples-and-guides" - }, - { - "source": "/docs/resources/examples-and-guides/:page*", - "destination": "/docs/learning-how-tos/example-and-guides/:page*" - }, - { - "source": "/docs/getting-started/readme", - "destination": "/docs" - }, - { - "source": "/docs/learning-how-tos/guides/:page*", - "destination": "/docs/learning-how-tos/examples-and-guides/:page*" - }, - { - "source": "/docs/examples/cookbook/placeholder-tags", - "destination": "/docs/learning-how-tos/examples-and-guides/placeholder-tags" - }, - { - "source": "/docs/resources/supported-languages", - "destination": "/docs/getting-started/supported-languages" - }, - { - "source": "/docs/resources/breaking-changes-change-notices/february-2025-deprecating-get-requests-to-translate-and-authenticating-with-auth_key", - "destination": "/docs/resources/breaking-changes-change-notices/march-2025-deprecating-get-requests-to-translate-and-authenticating-with-auth_key" - }, - { - "source": "/deepl-api-docs", - "destination": "/docs" - } + { + "source": "/docs/api-reference/improve-text/openapi-spec-for-text-improvement", + "destination": "/api-reference/improve-text/request-text-improvement" + }, + { + "source": "/docs/api-reference/languages/openapi-spec-for-retrieving-languages", + "destination": "/api-reference/languages/retrieve-supported-languages" + }, + { + "source": "/docs/api-reference/translate/openapi-spec-for-text-translation", + "destination": "/api-reference/translate/request-translation" + }, + { + "source": "/docs/api-reference/document/openapi-spec-for-document-translation", + "destination": "/api-reference/document/upload-and-translate-a-document" + }, + { + "source": "/docs/api-reference/glossaries/openapi-spec-for-glossary-management", + "destination": "/api-reference/multilingual-glossaries/create-a-glossary" + }, + { + "source": "/docs/api-reference/glossaries/glossaries/openapi-spec-for-glossary-management", + "destination": "/api-reference/glossaries/create-a-glossary" + }, + { + "source": "/docs/api-reference/usage-and-quota/openapi-spec-for-retrieving-usage-and-quota", + "destination": "/api-reference/usage-and-quota/check-usage-and-limits" + }, + { + "source": "/docs/api-reference/glossaries/glossaries", + "destination": "/api-reference/glossaries" + }, + { + "source": "/docs/api-reference", + "destination": "/api-reference" + }, + { + "source": "/docs/api-reference/:page*", + "destination": "/api-reference/:page*" + }, + { + "source": "/multiple-api-keys", + "destination": "/docs/multiple-api-keys" + }, + { + "source": "/docs/examples/cookbook", + "destination": "/docs/learning-how-tos/cookbook" + }, + { + "source": "/docs/examples/cookbook/:page*", + "destination": "/docs/learning-how-tos/cookbook/:page*" + }, + { + "source": "/docs/learning-how-tos/examples-and-guides/deepl-api-101", + "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" + }, + { + "source": "/docs/learning-how-tos/examples-and-guides/deepl-api-101/first-things-to-try-with-the-deepl-api", + "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" + }, + { + "source": "/docs/resources/examples-and-guides/deepl-api-101", + "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" + }, + { + "source": "/docs/resources/examples-and-guides/deepl-api-101/first-things-to-try-with-the-deepl-api", + "destination": "/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api" + }, + { + "source": "/docs/resources/examples-and-guides", + "destination": "/docs/learning-how-tos/examples-and-guides" + }, + { + "source": "/docs/resources/examples-and-guides/:page*", + "destination": "/docs/learning-how-tos/examples-and-guides/:page*" + }, + { + "source": "/docs/getting-started/readme", + "destination": "/docs" + }, + { + "source": "/docs/learning-how-tos/guides/:page*", + "destination": "/docs/learning-how-tos/examples-and-guides/:page*" + }, + { + "source": "/docs/examples/cookbook/placeholder-tags", + "destination": "/docs/learning-how-tos/examples-and-guides/placeholder-tags" + }, + { + "source": "/docs/resources/supported-languages", + "destination": "/docs/getting-started/supported-languages" + }, + { + "source": "/docs/resources/breaking-changes-change-notices/february-2025-deprecating-get-requests-to-translate-and-authenticating-with-auth_key", + "destination": "/docs/resources/breaking-changes-change-notices/march-2025-deprecating-get-requests-to-translate-and-authenticating-with-auth_key" + }, + { + "source": "/deepl-api-docs", + "destination": "/docs" + }, + { + "source": "/docs/getting-started/pre-production-checklist", + "destination": "/docs/best-practices/pre-production-checklist" + }, + { + "source": "/docs/getting-started/alpha-and-beta-features", + "destination": "/docs/resources/alpha-and-beta-features" + }, + { + "source": "/docs/resources/release-notes", + "destination": "/docs/resources/roadmap-and-release-notes" + }, + { + "source": "/api-reference/client-libraries", + "destination": "/docs/getting-started/client-libraries" + }, + { + "source": "/docs/resources/release-notes/rss.xml", + "destination": "/docs/resources/roadmap-and-release-notes/rss.xml" + }, + { + "source": "/api-reference/voice/request-stream", + "destination": "/api-reference/voice/request-session" + }, + { + "source": "/api-reference/voice/reconnect-stream", + "destination": "/api-reference/voice/reconnect-session" + }, + { + "source": "/docs/best-practices/working-with-context", + "destination": "/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter" + }, + { + "source": "/docs/learning-how-tos/cookbook/context-parameter-examples", + "destination": "/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter" + } ], "integrations": { - "telemetry": { - "enabled": false + "cookies": { + "key": "deepl_cookie_consent", + "value": "accepted" } + }, + "contextual": { + "options": ["copy", "chatgpt", "claude", "cursor", "vscode"] } -} \ No newline at end of file +} diff --git a/docs/best-practices/cors-requests.mdx b/docs/best-practices/cors-requests.mdx index cfa6cf31..17af7192 100644 --- a/docs/best-practices/cors-requests.mdx +++ b/docs/best-practices/cors-requests.mdx @@ -11,4 +11,4 @@ If you realize your API authentication key has been compromised, log in to your To safely use the DeepL API on your website or application, you can route your requests through your own backend servers. This keeps your credentials hidden and allows you to specify CORS policies and rate limits as required by your use case. -DeepL's official open-source [client libraries](/api-reference/client-libraries) can help you create these backend implementations. +DeepL's official open-source [client libraries](/docs/getting-started/client-libraries) can help you create these backend implementations. For prototyping and frontend testing, you can use the [DeepL API Node.js Proxy](https://github.com/DeepLcom/deepl-api-nodejs-proxy/), a lightweight ready-to-use proxy server that handles CORS and keeps your API key secure. diff --git a/docs/best-practices/custom-instructions.mdx b/docs/best-practices/custom-instructions.mdx new file mode 100644 index 00000000..a7c78d88 --- /dev/null +++ b/docs/best-practices/custom-instructions.mdx @@ -0,0 +1,99 @@ +--- +title: "Custom instructions" +description: "Learn how to create effective custom instructions to customize your translation behavior" +public: true +--- + +The `custom_instructions` parameter allows you to provide natural language instructions that customize how the DeepL API translates text. This guide provides best practices for creating effective custom instructions that produce consistent, high-quality results. + +## What are custom instructions? + +Custom instructions enable you to guide the translation engine with specific requirements for your use case. You can use custom instructions to: + +- Control tone and style (e.g., "Use a friendly, diplomatic tone") +- Specify domain-specific terminology preferences +- Define formatting conventions +- Adjust formality levels beyond the standard `formality` parameter +- Provide context-specific guidance for specialized content + +Custom instructions can also be used in conjunction with other features, such as glossaries, style rules, and the `context` parameter. + +## Best practices + +### 1. Write rules in English or the target language + +Custom instructions should be written in either English or the target language. This ensures the translation engine can properly interpret and apply your instructions. + +**English instruction** (works for all target languages) — "Use informal language appropriate for a mobile app" + +**Target language instruction** (French) — "Utiliser un langage informel adapté à une application mobile" + +### 2. Formulate rules positively + +State what the translation should do, rather than what it should not do. Positive formulations are clearer and more effective. + +❌ **INCORRECT: Negative formulation** — "Don't use overly formal language or avoid casual expressions" + +✅ **CORRECT: Positive formulation** — "Use a conversational, friendly tone" + +### 3. One instruction per rule + +Each custom instruction should contain a single, focused directive. This makes your instructions clearer and more predictable. + +❌ **INCORRECT: Multiple instructions combined** — "Use technical terminology, maintain formal tone, and convert measurements to metric" + +✅ **CORRECT: Separate instructions** +- "Use technical terminology appropriate for engineers" +- "Maintain a formal, professional tone" +- "Convert imperial measurements to metric units" + +### 4. Provide details on when and how to apply the rule + +Include context about when the rule should be applied and specific guidance on how to apply it. + +❌ **INCORRECT: Vague instruction** — "Handle gender appropriately" + +✅ **CORRECT: Specific instruction with context** — "When translating role titles, use gender-neutral forms where available in the target language" + +**Elements of a detailed instruction:** +- **When**: Conditions that trigger the rule +- **What**: Specific elements to modify +- **How**: Desired behavior or format + +### 5. Avoid too many conditions per rule + +Keep conditions simple and focused. Complex conditional logic reduces effectiveness. + +❌ **INCORRECT: Too many conditions** — "If the text contains product names or brand terms, unless they appear in headings or quotes, and the context is marketing material rather than technical documentation, then capitalize all words except articles" + +✅ **CORRECT: Simplified conditions** +- "Capitalize product names and brand terms in marketing content" +- "Preserve original capitalization in technical documentation" + +### 6. Write instructions as translation directives, not chatbot prompts + +Custom instructions guide translation behavior. They should be concise directives, not conversational prompts. + +❌ **INCORRECT: Chatbot-style prompt** — "Please translate this text in a way that would be appropriate for a luxury fashion brand. Make sure to sound elegant and sophisticated, like you're speaking to a high-end clientele." + +✅ **CORRECT: Clear translation directive** — "Use elegant, sophisticated language appropriate for luxury fashion" + +## Technical constraints + +When using custom instructions, keep these constraints in mind: + +- **Maximum instructions**: Up to 10 custom instructions per request +- **Character limit**: Each instruction can contain a maximum of 300 characters +- **Supported target languages**: `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `zh`, or any variants of these languages +- **Model requirement**: Requests with `custom_instructions` automatically use the `quality_optimized` model type + + +Combining `custom_instructions` with `model_type: latency_optimized` will result in an error. Custom instructions require the quality-optimized model. + + +## Related documentation + +- [Text translation API reference](/api-reference/translate) +- [Working with context](/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter) +- [Style rules API](/api-reference/style-rules) +- [Multilingual glossaries](/api-reference/multilingual-glossaries) diff --git a/docs/best-practices/document-translations.mdx b/docs/best-practices/document-translations.mdx new file mode 100644 index 00000000..37331660 --- /dev/null +++ b/docs/best-practices/document-translations.mdx @@ -0,0 +1,33 @@ +--- +title: "Document translations" +public: true +--- + +Below you will find general guidance on how to handle status codes and error details to ensure a smooth document translation experience. + +### Document File Size Limits +We impose [size limits](/docs/resources/usage-limits) per file type. +For `.pptx` and `.docx` types, our .NET, PHP and NodeJS client libraries offer functionality to minify files by temporarily extracting large media formats before sending them to the DeepL API. Stripped media are reinserted after document translation is completed. + +This allows users to translate files that might hit the size limit. + +### Error 429: Too Many Requests +This error may occur when: + +- You send concurrent document translation requests that exceed your account quota. +- You have too many un-retrieved or non-downloaded translated documents. + +Documents are stored for only a brief period and must be downloaded promptly after translation. + +To avoid this error, we recommend implementing the following measures: +- Polling document translation status, taking into account its frequency in order to prevent excessive load +- Quicker time to document retrieval +- Retries with exponential backoff + +### Error 456: Quota Exceeded +This error indicates that your latest document translation request has exceeded the included characters (API Free) or the character limit you have set (API Pro) for your account. +Further document translation requests will not be processed. + + + Check out our [code example](https://github.com/DeepLcom/deepl-node/tree/main/examples/bulk-translation) on how to implement bulk document translations. + diff --git a/docs/best-practices/error-handling.mdx b/docs/best-practices/error-handling.mdx index a345b2d4..cf9a1ad2 100644 --- a/docs/best-practices/error-handling.mdx +++ b/docs/best-practices/error-handling.mdx @@ -5,16 +5,12 @@ public: true Errors are indicated by [standard HTTP status codes](https://developer.mozilla.org/docs/Web/HTTP/Status). It is important to make sure that your application handles errors in an appropriate way. To that end, please consult the list of expected status code results that are provided with each endpoint's documentation in the API Reference. -* **HTTP 429: too many requests.** This is an error that you might receive when sending many API requests in a short period of time. Your application should be configured to resend the requests after some delay. Specifically, we recommend implementing retries with exponential backoff. This is implemented in all of the official, DeepL-supported [client libraries](/api-reference/client-libraries). +* **HTTP 429: too many requests.** This is an error that you might receive when sending many API requests in a short period of time. Your application should be configured to resend the requests after some delay. Specifically, we recommend implementing retries with exponential backoff. This is implemented in all of the official, DeepL-supported [client libraries](/docs/getting-started/client-libraries). -* **HTTP 456: quota exceeded** **If you're a Free API user**, you'll receive this error when the monthly 500,000 character limit of your subscription has been reached. You can consider [upgrading your subscription](https://www.deepl.com/pro) if you need more character volume. **If you're a Pro API user**, you'll receive this error when your [Cost Control](/docs/best-practices/cost-control)limit has been reached, and you can increase or remove your Cost Control limit if you need to continue translating. You can also use the [usage endpoint](/api-reference/usage-and-quota) to find out your currently used and available quota. +* **HTTP 456: quota exceeded** **If you're a Free API user**, you'll receive this error when the monthly 500,000 character limit of your subscription has been reached. You can consider [upgrading your subscription](https://www.deepl.com/pro) if you need more character volume. **If you're a Pro API user**, you'll receive this error when your [Cost Control](/docs/best-practices/cost-control) limit has been reached, and you can increase or remove your Cost Control limit if you need to continue translating. You can also use the [usage endpoint](/api-reference/usage-and-quota) to find out your currently used and available quota. -* **HTTP 500: internal server error** This is an error you'll receive if there are temporary errors in DeepL Services. Your application should be configured to resend the requests after some delay. Specifically, we recommend implementing retries with exponential backoff. This is implemented in all of the official, DeepL-supported [client libraries](/api-reference/client-libraries). +* **HTTP 500: internal server error** This is an error you'll receive if there are temporary errors in DeepL Services. Your application should be configured to resend the requests after some delay. Specifically, we recommend implementing retries with exponential backoff. This is implemented in all of the official, DeepL-supported [client libraries](/docs/getting-started/client-libraries). The service dynamically adjusts to the load on the system. Please wait to stop receiving errors to send more requests again. As the service adapts, you will be able to send increasingly more requests within a given amount of time without encountering errors. Additional information may be provided by a JSON response that contains more details about the error. In this case, this additional information will be contained in the message key. - -### SSL Handshake Error 525 - -We have received reports of an [issue](https://community.cloudflare.com/t/error-origin-ssl-handshake-error-525/294302) when querying the API from Cloudflare workers, and this issue has been brought to the attention of Cloudflare for their consideration. In the meantime, some members of the DeepL API community have had success with workarounds, such as setting up a simple authenticated proxy. diff --git a/docs/getting-started/pre-production-checklist.mdx b/docs/best-practices/pre-production-checklist.mdx similarity index 76% rename from docs/getting-started/pre-production-checklist.mdx rename to docs/best-practices/pre-production-checklist.mdx index 6344b94c..645806f3 100644 --- a/docs/getting-started/pre-production-checklist.mdx +++ b/docs/best-practices/pre-production-checklist.mdx @@ -3,16 +3,13 @@ title: "Pre-production checklist" description: "Here's what we recommend reviewing to get your DeepL API application ready for production." public: true --- +As you prepare to open your DeepL-powered application up to the world, these tips will help you get ready for production. -The fact that our pre-production checklist is published in the "Getting Started" section of the documentation is not a mistake! - -We believe it's useful information to have as you start exploring our product and thinking through your use case. - -1. **Error handling:** If you receive 429 or 500 errors, use retries with exponential backoff. If you use one of [DeepL's official client libraries](/api-reference/client-libraries), you get this functionality out-of-the-box. -2. **Persistent HTTP connection:** Especially for use cases with low latency requirements, we recommend using a persistent HTTP connection. [DeepL's official client libraries](/api-reference/client-libraries) use [Keep-Alive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive) by default. +1. **Error handling:** If you receive 429 or 500 errors, use retries with exponential backoff. If you use one of [DeepL's official client libraries](/docs/getting-started/client-libraries), you get this functionality out-of-the-box. +2. **Persistent HTTP connection:** Especially for use cases with low latency requirements, we recommend using a persistent HTTP connection. [DeepL's official client libraries](/docs/getting-started/client-libraries) use [Keep-Alive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive) by default. 3. **Use the correct content type:** For text translation (the `/translate` endpoint), use form-encoded (`Content-Type: application/x-www-form-urlencoded`) or JSON-encoded (`Content-Type: application/json`) request bodies. * Uploading a file for document translation requires an HTTP POST request with `Content-Type: multipart/form-data`; this content type should not be used for text translation. 4. **No query parameters:** Please do not make API requests using query parameters. The examples throughout the API reference include properly formed HTTP POST requests. For security reasons, be especially sure not to send your authentication key via query parameters. 5. **CORS requests:** It's not possible to send requests to the DeepL API from the browser, as requests to third-party APIs from front-end applications would expose your credentials on the web. [You can learn more here](/docs/best-practices/cors-requests). -6. **Translation context:** DeepL considers the broader context of a source text or document when translating. In general, including more context in a source text or document can result in a higher-quality DeepL translation. For text translation, you can also try the [`context` parameter](/api-reference/translate#request-body-descriptions). [Learn more about working with context here](/docs/best-practices/working-with-context). +6. **Translation context:** DeepL considers the broader context of a source text or document when translating. In general, including more context in a source text or document can result in a higher-quality DeepL translation. For text translation, you can also try the [`context` parameter](/api-reference/translate#request-body-descriptions). [Learn more about working with context here](/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter). 7. **Cache results from translation requests:** Storing API responses lets apps serve content faster and avoids extra costs from repeated requests for unchanged content. diff --git a/docs/best-practices/working-with-context.mdx b/docs/best-practices/working-with-context.mdx deleted file mode 100644 index bdabca67..00000000 --- a/docs/best-practices/working-with-context.mdx +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "Translation context" -public: true ---- - -This article provides guidance for using context to improve translation quality with the DeepL API. - -#### Text translation feature: context parameter - -For text translation, DeepL offers the `context` parameter, which makes it possible to provide additional context that can influence a translation result, but will not actually be translated itself. - -You can learn more about the `context` parameter in the [text translation API reference](/api-reference/translate#request-body-descriptions). - -Characters included in the `context` parameter will not be counted toward billing (i.e. there is no additional cost for using the `context` parameter, and only characters sent in the `text` parameter(s) will be counted toward billing for text translation even when the `context` parameter is included in a request). - -#### Text Translations With Multiple `text` Parameters - -When calling the `translate` endpoint for [text translation](/api-reference/translate), it’s possible to send multiple text parameters in a single request. - -The DeepL engine will only consider context in the scope of each individual `text` parameter within an API request. Said another way, the engine will not consider the broader context across multiple `text` parameters, even if these multiple text parameters are included in the same API request. - -Therefore, if you want to ensure the translation engine can utilize context in your API requests, we recommend the following. - -* Include as much relevant context as possible in each `text` parameter, and if possible, do not split up a request into multiple `text` parameters. - -* If you do need to split a large text into multiple `text` parameters within a single request, try to break up the text based on e.g. paragraphs or another logical “context boundary”, so that context in each `text` parameter is as complete as possible. - -#### Document Translation - -The DeepL engine also utilizes the broader context of a document when [translating documents](/api-reference/document). - -If your document does not fit within the [maximum upload limit](https://support.deepl.com/hc/articles/360020582359-Document-formats), you’ll likely need to break up the document into multiple, smaller documents for translation. When this is the case, we recommend choosing logical “context boundaries” (such as chapters of a book or sections of a PowerPoint presentation) when breaking up your large document into smaller documents that fit within the maximum upload limit. - -#### Context in XML and HTML Handling - -When using `tag_handling=xml` or `tag_handling=html` in text translation, the translation engine will consider the broader context of sentences that are close to one another and will not use tags as a “context boundary”. That is, the engine can consider context “across” different tags within the XML or HTML snippet. - -As mentioned above, the engine will only consider context in the scope of each individual `text` parameter within a text translation request. - -#### Translating Short Text Snippets - -When translating short text snippets that contain sparse context (such as product names on an e-commerce website or article titles on a news website), consider including additional context in the translation request when possible. - -For example, if using HTML handling to translate product information from an e-commerce website, you can consider sending the product name and product description (plus any other available context) in a single text translation request and within the same `text` parameter, so that the engine can refer to the context from the product description when translating the product name and vice versa. - -#### Using Glossaries - -[Glossaries](/api-reference/multilingual-glossaries) make it possible to specify your own translations for words and phrases so that you can customize your translations in a consistent way. For use cases that require translating brand-, product-, or industry-specific terminology, glossaries can help to ensure accurate, high-quality translations without the need to manually edit these terms in the translation output. - -DeepL’s glossaries go beyond a simple “find and replace” and will adapt the formulation of translations based on glossary entries, accounting for factors such as grammatical gender and plural forms. - -A glossary term might also influence the translation result as a whole (i.e. beyond the glossary term itself) if the glossary term changes the context of the source text. diff --git a/docs/getting-started/auth.mdx b/docs/getting-started/auth.mdx index 416e409c..9c1858cb 100644 --- a/docs/getting-started/auth.mdx +++ b/docs/getting-started/auth.mdx @@ -37,6 +37,8 @@ The authentication key is provided by setting the *Authorization* HTTP header to #### API Versions -The current API version is v2, meaning that all request paths start with `/v2/`. +The primary API version is v2, meaning that most request paths start with `/v2/`. Some endpoints are also available under `/v3/` — see [v2 vs v3 glossary endpoints](/api-reference/glossaries/v2-vs-v3-endpoints) for details. -It is the only supported version, with the exception of CAT tool integrations, which need to use the version 1 API that is not documented here. If you intend to integrate DeepL Pro into a CAT tool or another tool assisting translation, please contact [cat-tool.support@DeepL.com](mailto:cat-tool.support@DeepL.com). +The previous version of the API (`/v1/`) is also available for compatibility reasons and matches v2 functionality. Usage is reported and billed normally when accessing v1 endpoints. + +If you intend to integrate DeepL Pro into a CAT tool or another tool assisting translation, please contact [cat-tool.support@DeepL.com](mailto:cat-tool.support@DeepL.com). diff --git a/api-reference/client-libraries.mdx b/docs/getting-started/client-libraries.mdx similarity index 62% rename from api-reference/client-libraries.mdx rename to docs/getting-started/client-libraries.mdx index 019e3acf..ce8acb6e 100644 --- a/api-reference/client-libraries.mdx +++ b/docs/getting-started/client-libraries.mdx @@ -1,20 +1,10 @@ --- title: "Client libraries" public: true -sidebarTitle: "Overview" --- +## Official client libraries -Client library features include but are not limited to: - -* Out-of-the-box retries with exponential backoff for correct handling of 429 and 500 errors -* Persistent HTTP connection (keep-alive) enabled by default -* All document translation steps (upload, check status, and download) consolidated into a single convenience function - -All officially supported client libraries, which you can find in the [DeepL Github Organization](https://github.com/DeepLcom/), are open source under the MIT License. - -Please note that the Ruby client library is still under development and is not yet fully supported by DeepL. We will update this page when development work is complete! - -We welcome feedback in the form of issues and pull requests! +DeepL develops and supports client libraries for six popular languages: @@ -35,4 +25,17 @@ We welcome feedback in the form of issues and pull requests! deeplcom\deepl-java - \ No newline at end of file + + +Features include: + +* Out-of-the-box retries with exponential backoff for correct handling of 429 and 500 errors +* Persistent HTTP connection (keep-alive) enabled by default +* All document translation steps (upload, check status, and download) consolidated into a single convenience function + +All officially supported client libraries are open-source under the MIT License. We welcome feedback in the form of issues and pull requests! + +## Community-created client libraries + +The DeepL community [maintains client libraries](https://github.com/DeepLcom/awesome-deepl?tab=readme-ov-file#community-libraries--sdks) for other languages, including [Dart](https://github.com/komape/deepl_dart), [Go](https://github.com/candy12t/go-deepl), [Rust](https://github.com/Avimitin/deepl-rs), and [Kotlin](https://github.com/SimplyMika/DeeplKt). + diff --git a/docs/getting-started/intro.mdx b/docs/getting-started/intro.mdx index dc618d5b..1323ddb0 100644 --- a/docs/getting-started/intro.mdx +++ b/docs/getting-started/intro.mdx @@ -7,20 +7,60 @@ mode: "wide" ![](/_assets/images/intro/banner.gif) -## Get an API Key and Get Started +## Get an API key and get started New user? Follow these quick steps to get started with the DeepL API. - - - After logging in, you will find your API keys at https://www.deepl.com/en/your-account/keys - - - Here are a few simple options that you can start with. Choose any one and replace`{YOUR_API_KEY}`with your own key. + + + Visit [our plans page](https://www.deepl.com/pro-api#api-pricing), choose a plan, and sign up. + + + If you already have a DeepL Translator account, you will need to log out and [create a new account for the DeepL API](https://support.deepl.com/hc/articles/360019358999-Change-plan). + + + + Find your API key [here](https://www.deepl.com/your-account/keys). + Then try making a simple translation request in one of these ways: + * cURL or an HTTP request + * with [our client libraries](/docs/getting-started/client-libraries) for [Python](https://www.github.com/deeplcom/deepl-python), [JavaScript](https://www.github.com/deeplcom/deepl-node), [PHP](https://www.github.com/deeplcom/deepl-php), [.NET](https://www.github.com/deeplcom/deepl-dotnet), [Java](https://www.github.com/deeplcom/deepl-java), or [Ruby](https://www.github.com/deeplcom/deepl-rb) + * [in our playground](https://developers.deepl.com/api-reference/translate/request-translation?playground=open) + * [in Postman](/docs/getting-started/test-your-api-requests-with-postman) + + If you use the sample code below, be sure to replace `{YOUR_API_KEY}` with your own API key. - - Open a terminal. + + + If you chose a free API plan and you are writing cURL or HTTP requests, replace `https://api.deepl.com` with `https://api-free.deepl.com`. + + + ```http Sample request + POST /v2/translate HTTP/2 + Host: api.deepl.com + Authorization: DeepL-Auth-Key [yourAuthKey] + User-Agent: YourApp/1.2.3 + Content-Length: 45 + Content-Type: application/json + + {"text":["Hello, world!"],"target_lang":"DE"} + ``` + + ```json Sample response + { + "translations": [ + { + "detected_source_language": "EN", + "text": "Hallo, Welt!" + } + ] + } + ``` + + + + If you chose a free API plan and you are writing cURL or HTTP requests, replace `https://api.deepl.com` with `https://api-free.deepl.com`. + ```sh Set the API key export API_KEY={YOUR_API_KEY} @@ -48,62 +88,167 @@ New user? Follow these quick steps to get started with the DeepL API. ``` - Choose a local directory to work in. - ```sh Install client library pip install deepl ``` - ```py Sample Request File + ```py Sample request import deepl - auth_key = "{YOUR_API_KEY}" - translator = deepl.Translator(auth_key) + auth_key = "{YOUR_API_KEY}" # replace with your key + deepl_client = deepl.DeepLClient(auth_key) - result = translator.translate_text("Hello, world!", target_lang="DE") + result = deepl_client.translate_text("Hello, world!", target_lang="DE") print(result.text) ``` - ```text Sample Response + ```text Sample output Hallo, Welt! ``` - - - Choose a local directory to work in. + + In production code, it's safer to store your API key in an environment variable. + + + ```sh Install client library npm install deepl-node ``` - ```sh Sample Request File + ```javascript Sample request import * as deepl from 'deepl-node'; - const authKey = "{YOUR_API_KEY}"; - const translator = new deepl.Translator(authKey); + const authKey = "{YOUR_API_KEY}"; // replace with your key + const deeplClient = new deepl.DeepLClient(authKey); (async () => { - const result = await translator.translateText('Hello, world!', null, 'de'); + const result = await deeplClient.translateText('Hello, world!', null, 'de'); console.log(result.text); })(); ``` - ```text Sample Response + ```text Sample output + Hallo, Welt! + + ``` + + In production code, it's safer to store your API key in an environment variable. + + + + ```sh Install client library + composer require deeplcom/deepl-php + ``` + + ```php Sample request + require_once 'vendor/autoload.php'; + use DeepL\Translator; + + $authKey = "{YOUR_API_KEY}"; // replace with your key + $deeplClient = new \DeepL\DeepLClient($authKey); + + $result = $deeplClient->translateText('Hello, world!', null, 'de'); + echo $result->text; + ``` + + ```text Sample output Hallo, Welt! ``` + + In production code, it's safer to store your API key in an environment variable. + + + ```sh Install client library + dotnet add package DeepL.net + ``` + + ```csharp Sample request + using DeepL; // this imports the DeepL namespace. Use the code below in your main program. + + var authKey = "{YOUR_API_KEY}"; // replace with your key + var client = new DeepLClient(authKey); + + var translatedText = await client.TranslateTextAsync( + "Hello, world!", + null, + LanguageCode.German); + Console.WriteLine(translatedText); + ``` + + ```text Sample output + Hallo, Welt! + ``` + + + In production code, it's safer to store your API key in an environment variable. + + + + ```java Install client library + // For instructions on installing the DeepL Java library, + // see https://github.com/DeepLcom/deepl-java?tab=readme-ov-file#installation + ``` + + ```java Sample request + import com.deepl.api.*; + + public class Main { + public static void main(String[] args) throws DeepLException, InterruptedException { + String authKey = "{YOUR_API_KEY}"; // replace with your key + DeepLClient client = new DeepLClient(authKey); + + TextResult result = client.translateText("Hello, world!", null, "de"); + System.out.println(result.getText()); + } + } + ``` + + ```text Sample output + Hallo, Welt! + ``` + + + In production code, it's safer to store your API key in an environment variable. + + + + ```sh Install client library + gem install deepl-rb + ``` + + ```ruby Sample request + require 'deepl' + + DeepL.configure do |config| + config.auth_key = '{YOUR_API_KEY}' # replace with your key + end + + translation = DeepL.translate 'Hello, world!', nil, 'de' + puts translation.text + ``` + + ```text Sample output + Hallo, Welt! + ``` + + + In production code, it's safer to store your API key in an environment variable. + + - Note: If you are on a free API account, you can replace `https://api.deepl.com` with `https://api-free.deepl.com`. - - - You can use our API with popular programming languages (Python, JavaScript, .NET, PHP, Java, Ruby). Click [here](/api-reference/client-libraries) to learn more about our client libraries. You can also click [here](/docs/learning-how-tos/examples-and-guides) to find more examples and guides. - - + + + [Our official client libraries](/docs/getting-started/client-libraries) let you use the API with six popular programming languages - [Python](https://www.github.com/deeplcom/deepl-python), [JavaScript](https://www.github.com/deeplcom/deepl-node), [PHP](https://www.github.com/deeplcom/deepl-php), [.NET](https://www.github.com/deeplcom/deepl-dotnet), [Java](https://www.github.com/deeplcom/deepl-java), or [Ruby](https://www.github.com/deeplcom/deepl-rb). The DeepL community has [contributed client libraries](https://github.com/DeepLcom/awesome-deepl?tab=readme-ov-file#community-libraries--sdks) for other languages, including [Dart](https://github.com/komape/deepl_dart), [Go](https://github.com/candy12t/go-deepl), and [Rust](https://github.com/Avimitin/deepl-rs). You may also wish to check out [these examples and guides](/docs/learning-how-tos/examples-and-guides). + + -## Start Developing +## Keep exploring -- [Cookbook](/docs/learning-how-tos/cookbook) - Explore a large variety of examples from both internal and external contributors for using the DeepL API for different applications. -- [Guides](/docs/learning-how-tos/examples-and-guides) - Discover additional examples and guides for using the DeepL API. -- [Your First API Request](/docs/getting-started/your-first-api-request) - Get started quickly with DeepL. +- [Your first API request](/docs/getting-started/your-first-api-request) - With just a few lines of code, make your first request to the DeepL Translate or Write API +- [**DeepL 101**](/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api) - A quick guide to text and document translation, using Postman to play with the API, client libraries for your favorite programming language, and joining our developer community +- [Cookbook](/docs/learning-how-tos/cookbook) - Explore short tutorials, examples, projects, and use cases +- [Guides](/docs/learning-how-tos/examples-and-guides) - Discover in-depth explanations for API features and real-world applications ## Community and Support @@ -111,8 +256,8 @@ New user? Follow these quick steps to get started with the DeepL API. Support Center - - Discord Community + + DeepL Bridges - Developer Community Status Page @@ -120,4 +265,4 @@ New user? Follow these quick steps to get started with the DeepL API. Release Notes - \ No newline at end of file + diff --git a/docs/getting-started/regional-endpoints.mdx b/docs/getting-started/regional-endpoints.mdx new file mode 100644 index 00000000..a0e06a5c --- /dev/null +++ b/docs/getting-started/regional-endpoints.mdx @@ -0,0 +1,201 @@ +--- +title: "Regional API Endpoints" +description: "Reference documentation for DeepL's regional API endpoints, including endpoint URLs, configuration, and technical specifications." +public: false +--- + +DeepL offers regional API endpoints that process and store data within specific geographic regions. Regional endpoints provide the same API functionality as the standard endpoint, with data processing occurring in data centers located in specific regions. These endpoints help organizations meet data residency and compliance requirements, and can also reduce latency for users in specific geographic regions. + + +Regional endpoints are only available to customers who have signed a regional deployment addendum. Without a signed addendum, requests to regional endpoints will return a 403 authentication error. Contact your account manager or [reach out to our sales team](https://www.deepl.com/contact-us) to discuss access. + + +## Endpoint URLs + +DeepL currently offers the following regional endpoints: + +| **Region** | **Endpoint URL** | +|------------|------------------| +| **United States** | `https://api-us.deepl.com` | +| **Japan** | `https://api-jp.deepl.com` | +| **European Union (default)** | `https://api.deepl.com` | + + +--- + +## Configuration + +Regional endpoints are configured by specifying the endpoint URL in the API client. The standard endpoint URL (`https://api.deepl.com`) is replaced with the regional endpoint URL (`https://api-us.deepl.com` or `https://api-jp.deepl.com`). + + + + +```bash +# Standard endpoint +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": ["Hello, world!"], + "target_lang": "DE" +}' + +# US regional endpoint +curl -X POST 'https://api-us.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": ["Hello, world!"], + "target_lang": "DE" +}' +``` + + + + +The Python client library accepts a `server_url` parameter: + +```python +import deepl + +# Standard endpoint +translator = deepl.Translator("[yourAuthKey]") + +# US regional endpoint +translator = deepl.Translator( + "[yourAuthKey]", + server_url="https://api-us.deepl.com" +) + +# Usage remains identical +result = translator.translate_text("Hello, world!", target_lang="DE") +print(result.text) +``` + + + + +The Node.js client library accepts a `serverUrl` option: + +```javascript +const deepl = require('deepl-node'); + +// Standard endpoint +const translator = new deepl.Translator('[yourAuthKey]'); + +// US regional endpoint +const translator = new deepl.Translator( + '[yourAuthKey]', + { serverUrl: 'https://api-us.deepl.com' } +); + +// Usage remains identical +(async () => { + const result = await translator.translateText('Hello, world!', null, 'de'); + console.log(result.text); +})(); +``` + + + + +The Java client library accepts a `TranslatorOptions` object with `setServerUrl()` method: + +```java +import com.deepl.api.*; + +// Standard endpoint +Translator translator = new Translator("[yourAuthKey]"); + +// US regional endpoint +TranslatorOptions options = new TranslatorOptions() + .setServerUrl("https://api-us.deepl.com"); +Translator translator = new Translator("[yourAuthKey]", options); + +// Usage remains identical +TextResult result = translator.translateText("Hello, world!", null, "de"); +System.out.println(result.getText()); +``` + + + + +The .NET client library accepts a `TranslatorOptions` object with `ServerUrl` property: + +```csharp +using DeepL; + +// Standard endpoint +var translator = new Translator("[yourAuthKey]"); + +// US regional endpoint +var translator = new Translator( + "[yourAuthKey]", + new TranslatorOptions { ServerUrl = "https://api-us.deepl.com" } +); + +// Usage remains identical +var result = await translator.TranslateTextAsync("Hello, world!", null, "de"); +Console.WriteLine(result.Text); +``` + + + + +The PHP client library accepts a `server_url` option in the options array: + +```php +use DeepL\Translator; + +// Standard endpoint +$translator = new Translator('[yourAuthKey]'); + +// US regional endpoint +$translator = new Translator( + '[yourAuthKey]', + ['server_url' => 'https://api-us.deepl.com'] +); + +// Usage remains identical +$result = $translator->translateText('Hello, world!', null, 'de'); +echo $result->text; +``` + + + + +--- + +## Technical specifications + +### Access requirements + +Regional endpoints require activation through a regional deployment addendum. Requests to regional endpoints without activation will return a 403 authentication error. Contact your account manager or [reach out to our sales team](https://www.deepl.com/contact-us) to activate regional endpoints for your account. + +If your account has regional endpoint access, any API key can be used with any regional endpoint. + +### API compatibility + +Regional endpoints support all DeepL API functionality except: + +- Voice API +- Admin Analytics API + +These endpoints are only available on the standard `api.deepl.com` endpoint. + +### Glossaries and style rules + +Glossaries and style rules are unique to each of DeepL's regional data centers and are not shared between them. Glossaries and style rules created via the API on one regional endpoint (e.g., `api-us.deepl.com`) are only accessible from that same endpoint. + +Additionally, the DeepL web UI (at [deepl.com](https://www.deepl.com)) currently only accesses the European Union data center. Glossaries and style rules created in the UI are only accessible via the standard `api.deepl.com` endpoint, not regional endpoints like `api-us.deepl.com` or `api-jp.deepl.com`. + +For more details, see the [Style rules documentation](/api-reference/style-rules). + +--- + +## Related documentation + +- [Client libraries](/docs/getting-started/client-libraries) - Language-specific client library documentation and configuration +- [Authentication and access](/docs/getting-started/auth) - API authentication methods and security best practices +- [Text translation](/api-reference/translate) - Text translation API reference +- [Admin API](/api-reference/admin-api) - Programmatic API key management for enterprise administrators diff --git a/docs/getting-started/supported-languages.mdx b/docs/getting-started/supported-languages.mdx index 3d3b3428..bb6ff1c1 100644 --- a/docs/getting-started/supported-languages.mdx +++ b/docs/getting-started/supported-languages.mdx @@ -2,106 +2,33 @@ title: "Languages supported" description: "The DeepL API supports the following languages. We will update this list as we introduce new languages." public: true +sidebarTitle: "Languages supported" +mode: "wide" --- - Please note that Hebrew, Latin American Spanish, Thai and Vietnamese have not been added to the `/languages` endpoint as they are only available in the text translation API using next-gen models. When these languages are available for all translation endpoints (including document translation) they will be added to the `/languages` endpoint and this note will be removed. + If trying to convert between variants of the same language (e.g. `EN-US` to `EN-GB`), please refer to [this guide](/docs/learning-how-tos/examples-and-guides/translating-between-variants). -### Translation source languages - -- `AR` - Arabic -- `BG` - Bulgarian -- `CS` - Czech -- `DA` - Danish -- `DE` - German -- `EL` - Greek -- `EN` - English _(all English variants)_ -- `ES` - Spanish _(all Spanish variants)_ -- `ET` - Estonian -- `FI` - Finnish -- `FR` - French -- `HE` - Hebrew _(text translation via next-gen models only)_ -- `HU` - Hungarian -- `ID` - Indonesian -- `IT` - Italian -- `JA` - Japanese -- `KO` - Korean -- `LT` - Lithuanian -- `LV` - Latvian -- `NB` - Norwegian Bokmål -- `NL` - Dutch -- `PL` - Polish -- `PT` - Portuguese _(all Portuguese variants)_ -- `RO` - Romanian -- `RU` - Russian -- `SK` - Slovak -- `SL` - Slovenian -- `SV` - Swedish -- `TH` - Thai _(text translation via next-gen models only)_ -- `TR` - Turkish -- `UK` - Ukrainian -- `VI` - Vietnamese _(text translation via next-gen models only)_ -- `ZH` - Chinese _(all Chinese variants)_ + + Some languages support only text translation and do not yet support glossaries, tag handling, or text improvement. These are marked accordingly in the table below. -### Translation target languages + Languages marked **Target Only** in the Translate column can only be used as target languages (not source languages) — these are typically regional variants like `EN-GB` or `PT-BR`. -- `AR` - Arabic -- `BG` - Bulgarian -- `CS` - Czech -- `DA` - Danish -- `DE` - German -- `EL` - Greek -- `EN` - English _(unspecified variant for backward compatibility; we recommend using_`EN-GB` _or_ `EN-US` _instead)_ -- `EN-GB` - English (British) -- `EN-US` - English (American) -- `ES` - Spanish -- `ES-419` - Spanish (Latin American) _(text translation via next-gen models only)_ -- `ET` - Estonian -- `FI` - Finnish -- `FR` - French -- `HE` - Hebrew _(text translation via next-gen models only)_ -- `HU` - Hungarian -- `ID` - Indonesian -- `IT` - Italian -- `JA` - Japanese -- `KO` - Korean -- `LT` - Lithuanian -- `LV` - Latvian -- `NB` - Norwegian Bokmål -- `NL` - Dutch -- `PL` - Polish -- `PT` - Portuguese _(unspecified variant for backward compatibility; we recommend using_ `PT-BR` _or_ `PT-PT` _instead)_ -- `PT-BR` - Portuguese (Brazilian) -- `PT-PT` - Portuguese _(all Portuguese variants excluding Brazilian Portuguese)_ -- `RO` - Romanian -- `RU` - Russian -- `SK` - Slovak -- `SL` - Slovenian -- `SV` - Swedish -- `TH` - Thai _(text translation via next-gen models only)_ -- `TR` - Turkish -- `UK` - Ukrainian -- `VI` - Vietnamese _(text translation via next-gen models only)_ -- `ZH` - Chinese _(unspecified variant for backward compatibility; we recommend using_ `ZH-HANS` _or_ `ZH-HANT` _instead)_ -- `ZH-HANS` - Chinese (simplified) -- `ZH-HANT` - Chinese (traditional) + Only fully-featured languages are returned by the [`/languages` endpoint](/api-reference/languages/retrieve-supported-languages). To retrieve language support programmatically in your integration, use this endpoint. - - As of April 2025, supported languages for [text improvement](/api-reference/improve-text) (DeepL API for Write) have not yet been added to the `/languages` endpoint; we'll be extending the `/languages` endpoint in the near future to include this information. + Supported languages for [text improvement](/api-reference/improve-text) (DeepL API for Write) have not yet been added to the `/languages` endpoint; we'll be extending the `/languages` endpoint in the near future to include this information. For the `/write/rephase` endpoint, `writing_style` and `tone` currently work in `DE`, `EN-GB`, and `EN-US`. -### Text improvement languages (DeepL API for Write) +The table columns indicate support for the following features: -- `DE` (German) -- `EN-GB` (British English) -- `EN-US` (American English) -- `ES` (Spanish) -- `FR` (French) -- `IT` (Italian) -- `PT-BR` (Brazilian Portuguese) -- `PT-PT` (Portuguese) +- **Translate** — Text and document translation via the [`/translate`](/api-reference/translate/request-translation) endpoint. +- **Glossary** — Custom glossaries to control how specific terms are translated. +- **Tags** — XML/HTML [tag handling](/docs/xml-and-html-handling/xml) to preserve markup during translation. +- **Improve** — Text improvement via the [`/write`](/api-reference/improve-text) endpoint (DeepL API for Write). - - For the `/write` endpoint, `writing_style` and `tone` currently work in `DE`, `EN-GB`, and `EN-US`. - \ No newline at end of file +## API Supported Languages + +import { LanguageTable } from "/snippets/language-table.jsx" + + diff --git a/docs/getting-started/test-your-api-requests-with-postman.mdx b/docs/getting-started/test-your-api-requests-with-postman.mdx index 631dfe24..bcca462d 100644 --- a/docs/getting-started/test-your-api-requests-with-postman.mdx +++ b/docs/getting-started/test-your-api-requests-with-postman.mdx @@ -10,7 +10,7 @@ For convenience, we've created a Postman collection that mirrors the DeepL API f ![](/_assets/images/Request_Translation___DeepL_API_Developers___Postman_API_Network.png) -To get started, [sign up for a developer account at deepl.com](https://www.deepl.com/pro-checkout/account?productId=1200\&yearly=false\&trial=false) and get your authentication key from [your account page](https://www.deepl.com/account). +To get started, [sign up for a developer account at deepl.com](https://www.deepl.com/pro/change-plan#developer) and get your authentication key from [your account page](https://www.deepl.com/account). Click the button below to fork the DeepL API collection into your own Postman workspace: diff --git a/docs/getting-started/your-first-api-request.mdx b/docs/getting-started/your-first-api-request.mdx index 43bb4d55..2eee865a 100644 --- a/docs/getting-started/your-first-api-request.mdx +++ b/docs/getting-started/your-first-api-request.mdx @@ -1,6 +1,7 @@ --- title: "Your first API request" description: "Make your first API requests to translate and improve text with the DeepL API." +mode: "wide" public: true --- @@ -10,22 +11,23 @@ Once you've created a DeepL API account and located your authentication key, you To [translate text](/api-reference/translate), you can use the `/translate` endpoint, which also supports translation of [XML and HTML content](/api-reference/translate#in-text-markup). -We included text translation examples for our [client libraries](/api-reference/client-libraries), too, just to give you an idea of what they look like. +We included text translation examples for our [client libraries](/docs/getting-started/client-libraries), too, just to give you an idea of what they look like. - - The example below uses our API Pro endpoint `https://api.deepl.com`. If you're an API Free user, remember to update your requests to use `https://api-free.deepl.com` instead. + + + If you chose a free API plan, replace `https://api.deepl.com` with `https://api-free.deepl.com`. + - ```bash Example request - curl -X POST 'https://api.deepl.com/v2/translate' \ - --header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ - --header 'Content-Type: application/json' \ - --data '{ - "text": [ - "Hello, world!" - ], - "target_lang": "DE" - }' + ```http Example request + POST /v2/translate HTTP/2 + Host: api.deepl.com + Authorization: DeepL-Auth-Key [yourAuthKey] + User-Agent: YourApp/1.2.3 + Content-Length: 45 + Content-Type: application/json + + {"text":["Hello, world!"],"target_lang":"DE"} ``` ```json Example response @@ -39,18 +41,21 @@ We included text translation examples for our [client libraries](/api-reference/ } ``` - - The example below uses our API Pro endpoint `https://api.deepl.com`. If you're an API Free user, remember to update your requests to use `https://api-free.deepl.com` instead. - - ```http Example request - POST /v2/translate HTTP/2 - Host: api.deepl.com - Authorization: DeepL-Auth-Key [yourAuthKey] - User-Agent: YourApp/1.2.3 - Content-Length: 45 - Content-Type: application/json - - {"text":["Hello, world!"],"target_lang":"DE"} + + + If you chose a free API plan, replace `https://api.deepl.com` with `https://api-free.deepl.com`. + + + ```bash Example request + curl -X POST 'https://api.deepl.com/v2/translate' \ + --header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ + --header 'Content-Type: application/json' \ + --data '{ + "text": [ + "Hello, world!" + ], + "target_lang": "DE" + }' ``` ```json Example response @@ -68,66 +73,103 @@ We included text translation examples for our [client libraries](/api-reference/ ```python import deepl - auth_key = "f63c02c5-f056-..." # Replace with your key - translator = deepl.Translator(auth_key) + auth_key = "f63c02c5-f056-..." # replace with your key + deepl_client = deepl.DeepLClient(auth_key) + + result = deepl_client.translate_text("Hello, world!", target_lang="FR") + print(result.text) # "Bonjour à tous !" + ``` + + + In production code, it's safer to store your API key in an environment variable. + + + + ```javascript + import * as deepl from 'deepl-node'; + + const authKey = "f63c02c5-f056-..."; // Replace with your key + const deeplClient = new deepl.DeepLClient(authKey); - result = translator.translate_text("Hello, world!", target_lang="FR") - print(result.text) # "Bonjour, le monde !" + (async () => { + const result = await deeplClient.translateText('Hello, world!', null, 'fr'); + console.log(result.text); // Bonjour à tous ! + })(); ``` + + + In production code, it's safer to store your API key in an environment variable. + ```php + require_once 'vendor/autoload.php'; + use DeepL\Translator; + $authKey = "f63c02c5-f056-..."; // Replace with your key - $translator = new \DeepL\Translator($authKey); + $deeplClient = new \DeepL\DeepLClient($authKey); - $result = $translator->translateText('Hello, world!', null, 'fr'); + $result = $deeplClient->translateText('Hello, world!', null, 'fr'); echo $result->text; // Bonjour, le monde! ``` + + + In production code, it's safer to store your API key in an environment variable. + ```csharp - var authKey = "f63c02c5-f056-..."; // Replace with your key - var translator = new Translator(authKey); + using DeepL; // this imports the DeepL namespace. Use the code below in your main program. + + var authKey = "f63c02c5-f056-..."; // replace with your key + var client = new DeepLClient(authKey); - // Translate text into a target language, in this case, French: - var translatedText = await translator.TranslateTextAsync( - "Hello, world!", - LanguageCode.English, - LanguageCode.French); - Console.WriteLine(translatedText); // "Bonjour, le monde !" - // Note: printing or converting the result to a string uses the output text. + var translatedText = await client.TranslateTextAsync( + "Hello, world!", + null, + LanguageCode.French); + Console.WriteLine(translatedText); // "Bonjour à tous !" ``` - - - ```javascript - import * as deepl from 'deepl-node'; - - const authKey = "f63c02c5-f056-..."; // Replace with your key - const translator = new deepl.Translator(authKey); - (async () => { - const result = await translator.translateText('Hello, world!', null, 'fr'); - console.log(result.text); // Bonjour, le monde ! - })(); - ``` + + In production code, it's safer to store your API key in an environment variable. + ```java import com.deepl.api.*; - class Example { - Translator translator; - - public Example() throws Exception { - String authKey = "f63c02c5-f056-..."; // Replace with your key - translator = new Translator(authKey); - TextResult result = - translator.translateText("Hello, world!", null, "fr"); - System.out.println(result.getText()); // "Bonjour, le monde !" + public class Main { + public static void main(String[] args) throws DeepLException, InterruptedException { + String authKey = "{YOUR_API_KEY}"; // replace with your key + DeepLClient client = new DeepLClient(authKey); + + TextResult result = client.translateText("Hello, world!", null, "fr"); + System.out.println(result.getText()); // "Bonjour à tous !" } } ``` + + + In production code, it's safer to store your API key in an environment variable. + + + ```ruby + require 'deepl' + + DeepL.configure do |config| + config.auth_key = '{YOUR_API_KEY}' # replace with your key + end + + translation = DeepL.translate 'Hello, world!', nil, 'fr' + puts translation.text // "Bonjour à tous !" + ``` + + + In production code, it's safer to store your API key in an environment variable. + + ### Text improvement @@ -143,9 +185,9 @@ The text improvement endpoint (DeepL API for Write) is currently only available --header 'Content-Type: application/json' \ --data '{ "text": [ - "I could relly use sum help with edits on thiss text !" + "Its never to late too fix you'\''re grammer & speling!" ], - "target_lang": "en-US" + "target_lang": "en-GB" }' ``` @@ -153,9 +195,9 @@ The text improvement endpoint (DeepL API for Write) is currently only available { "improvements": [ { - "text": "I could really use some help with editing this text!", - "target_language": "en-US", - "detected_source_language": "en" + "text": "It's never too late to fix your grammar and spelling!", + "detected_source_language": "en", + "target_language": "en-GB" } ] } diff --git a/docs/learning-how-tos/cookbook.mdx b/docs/learning-how-tos/cookbook.mdx index 7a33c5a9..e9d6e7a1 100644 --- a/docs/learning-how-tos/cookbook.mdx +++ b/docs/learning-how-tos/cookbook.mdx @@ -11,22 +11,27 @@ public: true Updated on 2025-03-12 - - Written by [Michael Winters](https://github.com/mike-winters-deepl) and [Paul Gordon](https://github.com/pgdev) - - Updated on 2025-03-12 - Written by Lucas Mathis Updated on 2024-04-10 - - - Written by [Akash Joshi](https://thewriting.dev) Updated on 2025-07-03 + + + + + A demo dashboard for visualizing API usage across your entire account + + Updated on 2025-12-17 + + + A ready-to-use proxy server for secure browser-based API calls + + Updated on 2024-10-30 + \ No newline at end of file diff --git a/docs/learning-how-tos/cookbook/context-parameter-examples.mdx b/docs/learning-how-tos/cookbook/context-parameter-examples.mdx deleted file mode 100644 index 04239c2b..00000000 --- a/docs/learning-how-tos/cookbook/context-parameter-examples.mdx +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: "Example: Context parameter examples" -description: "Some practical examples for getting the most out of the context parameter" ---- - -When short content like headlines, product titles or titles are translated with DeepL, there may not be enough information for the translation engine to work with to fully understand the wider context. This might be noticeable when the source content could have multiple meanings and requires additional context in order to provide the best possible translation. - -With the introduction of the context parameter, you can now provide additional context for shorter pieces of source content without incurring additional translation usage. - -Consider the German sentence “Die Person stand vor dem Tor”, translated into US English in the following example: - -```sh -curl -X POST 'https://api.deepl.com/v2/translate' \ ---header 'Authorization: DeepL-Auth-Key [your key]' \ ---header 'Content-Type: application/json' \ ---data '{ - "text": [ - "Die Person stand vor dem Tor." - ], - "target_lang": "EN-US" -}' -``` - -```text -// "The person was standing in front of the gate." -``` - -Without any additional context, the returned translation is “The person was standing in front of the gate”. This might be correct, but what if we were at a football game? - -By providing additional context, we can help the DeepL find the correct translation: - -```sh -curl -X POST 'https://api.deepl.com/v2/translate' \ ---header 'Authorization: DeepL-Auth-Key [your key]' \ ---header 'Content-Type: application/json' \ ---data '{ - "text": [ - "Die Person stand vor dem Tor." - ], - "target_lang": "EN-US", - "context": "Dies ist ein Text über Fußball." -}' -``` - -```text -//"The person was standing in front of the goal." -``` - -In another example, the correct grammatical gender to use in a translation may not be totally clear from source content. Below, the English sentence “The teacher asked the class to tidy up after they finished the lesson.” makes syntactical sense, however it does not provide clarity on which variant of the word “teacher” to use when translated. Without context the translation into German is “Lehrer”: - -```sh -curl -X POST 'https://api.deepl.com/v2/translate' \ ---header 'Authorization: DeepL-Auth-Key [your key]' \ ---header 'Content-Type: application/json' \ ---data '{ - "text": [ - "The teacher asked the class to tidy up after they finished the lesson." - ], - "target_lang": "DE" -}' -``` - -```text -//"Der Lehrer bat die Klasse, nach der Stunde aufzuräumen." -``` - -By providing more context describing the teacher, we can help DeepL get to a more accurate translation, without adding more to the source content: - -```sh -curl -X POST 'https://api.deepl.com/v2/translate' \ ---header 'Authorization: DeepL-Auth-Key [your key]' \ ---header 'Content-Type: application/json' \ ---data '{ - "text": [ - "The teacher asked the class to tidy up after they finished the lesson." - ], - "target_lang": "DE", - "context": "She did not want to use her own time tidying up." -}' -``` - -```text -//"Die Lehrerin bat die Klasse, nach der Stunde aufzuräumen." -``` - -As you can see, even with a little additional information provided by the context parameter (in the same style as the text being translated), the overall translation accuracy is improved - including grammar and syntax. - -Learn more about using the context parameter in the [text translation API reference](/api-reference/translate#request-body-descriptions). diff --git a/docs/learning-how-tos/cookbook/images/dashboard-overview.png b/docs/learning-how-tos/cookbook/images/dashboard-overview.png new file mode 100644 index 00000000..16cdeab0 Binary files /dev/null and b/docs/learning-how-tos/cookbook/images/dashboard-overview.png differ diff --git a/docs/learning-how-tos/cookbook/images/usage-by-api-key.png b/docs/learning-how-tos/cookbook/images/usage-by-api-key.png new file mode 100644 index 00000000..db0b96d0 Binary files /dev/null and b/docs/learning-how-tos/cookbook/images/usage-by-api-key.png differ diff --git a/docs/learning-how-tos/cookbook/images/usage-trends.png b/docs/learning-how-tos/cookbook/images/usage-trends.png new file mode 100644 index 00000000..723941f7 Binary files /dev/null and b/docs/learning-how-tos/cookbook/images/usage-trends.png differ diff --git a/docs/learning-how-tos/cookbook/nodejs-proxy.mdx b/docs/learning-how-tos/cookbook/nodejs-proxy.mdx new file mode 100644 index 00000000..00c1912c --- /dev/null +++ b/docs/learning-how-tos/cookbook/nodejs-proxy.mdx @@ -0,0 +1,94 @@ +--- +title: "Making API calls from client-side JavaScript" +description: "Two lightweight local proxies that let you try the DeepL API directly from a website" +public: true +--- + + +These proxies are intended for prototyping and frontend testing. For production environments, consider implementing your own backend service with additional security measures and rate limiting. + + +## Rationale + +The DeepL API does not permit calls from client-side JavaScript - that is, from JavaScript running in a browser. This policy exists to keep your API key safe. When you place a call from your website directly to the DeepL API, that call needs to include your API key. Anyone using your website could look at the network calls or your code itself, find your API key, and use it themselves. + +For this and other security considerations, DeepL [does not enable the CORS headers](/docs/best-practices/cors-requests) you would need to call the API from a webpage hosted on your origin. The industry-standard approach is to call APIs like DeepL’s from a back-end service. DeepL enforces this best practice to keep your credentials secure. + +## When to use a quick proxy + +But what do you do if you want to use the API quickly, in a prototype, a demo, or a hackathon, where you need to get up and running fast? What if you don’t have easy access to a server? + +For such situations, here are two solutions. + +## Node.js Proxy Server + + + DeepL API Node.js Proxy on GitHub + + +This full-featured proxy server supports all DeepL API endpoints, including text translation, document translation, and glossaries. Built with Node.js and Express with minimal dependencies, it handles CORS headers for you and keeps your API key secure. It even includes an interactive web demo for testing translations right in your browser. + +This proxy includes an interactive setup wizard to get you started quickly. Clone the repo, run the setup, and start sending requests from your browser. Check out the [GitHub repository](https://github.com/DeepLcom/deepl-api-nodejs-proxy) for full setup instructions and Docker support. + +## Quick & dirty PHP proxy + +If you’re just using our `/translate` endpoint and want an even quicker solution, or if you don’t use node.js, you could use the PHP code below to create an instant proxy server. If PHP is not already installed on your machine, you can download and install it at [php.net](https://www.php.net/downloads.php). + +The PHP script takes the parameters in the query string and passes them into a `POST` request to `/translate`. It does not check that the parameters are valid and does not support any other endpoints, although you could modify it to do so. + +To use this while developing on your local machine: + +* replace `{your API key here}` with your actual API key +* create a file in your favorite directory with the PHP code below +* go to your terminal and visit that directory +* type `php -S localhost:8000` + +Your JavaScript can then access the DeepL API at `http://localhost:8000/php-proxy.php`. For example, to send a translation request with `text` and `target_lang`: + +```javascript +const url = `http://localhost:8000/deepl-proxy.php?text=${encodeURIComponent(text)}&target_lang=${encodeURIComponent(targetLang)}`; +const response = await fetch(url); +const result = await response.text(); +``` + +Here is the PHP script: + +```php + [ + 'method' => 'POST', + 'header' => "Authorization: DeepL-Auth-Key " . $apiKey . "\r\n" . + "Content-Type: application/x-www-form-urlencoded\r\n", + 'content' => $data + ] +]); + +echo file_get_contents($apiUrl, false, $context); +?> +``` + + +## Screenshots + +### Node.js proxy + + Node.js proxy server running and ready to accept requests + + + + Interactive web demo interface for testing translations + + +### PHP proxy + + ![](/_assets/images/php-proxy-screenshot.png) + \ No newline at end of file diff --git a/docs/learning-how-tos/cookbook/usage-analytics-dashboard.mdx b/docs/learning-how-tos/cookbook/usage-analytics-dashboard.mdx new file mode 100644 index 00000000..00793ec4 --- /dev/null +++ b/docs/learning-how-tos/cookbook/usage-analytics-dashboard.mdx @@ -0,0 +1,42 @@ +--- +title: "Usage Analytics Dashboard" +description: "A demo dashboard for visualizing DeepL API key usage across an entire account using the Admin API." +public: true +--- + + + Usage Analytics Demo Dashboard on GitHub + + + +This open-source demo dashboard shows how to visualize DeepL API key usage across your entire account, powered by a single API call to the `/v2/admin/analytics` endpoint. It provides interactive charts, flexible date ranges, and per-API-key breakdowns to help you monitor and analyze your API usage. + +The dashboard is designed to be lightweight and easy to set up, with zero NPM dependencies and sample data included for testing. It can be used as-is, or as an example of how similar data can be incorporated into your own internal workflows and dashboards. + +For more information about the DeepL Admin API endpoint, check out the [Admin API documentation](/api-reference/admin-api/organization-usage-analytics). + +## Features + +- **Interactive charts and visualizations** - View your usage data through multiple chart types +- **Flexible date ranges** - Analyze usage over rolling periods or fixed date ranges +- **Per-API-key breakdown** - See usage broken down by individual API keys +- **Basic trends and forecasting** - Identify patterns in your API usage +- **Secure local configuration** - All configuration stays on your machine +- **Zero NPM dependencies** - Chart.js loaded from CDN for simplicity +- **Sample data included** - Test and demo without connecting to your account + +## Screenshots + + + Dashboard Overview showing character usage and usage by feature type + + + + Usage by API Key comparison chart showing top 5 keys + + + + Daily usage trends across all API keys + + + diff --git a/docs/learning-how-tos/examples-and-guides.mdx b/docs/learning-how-tos/examples-and-guides.mdx index 61c5c8c3..865cb1b9 100644 --- a/docs/learning-how-tos/examples-and-guides.mdx +++ b/docs/learning-how-tos/examples-and-guides.mdx @@ -1,7 +1,7 @@ --- title: "Guides" sidebarTitle: "Overview" -description: "A collection of guides for addressing common issues with the DeepL API." +description: "Learn how to use DeepL API features to achieve your translation goals." public: true --- @@ -17,6 +17,12 @@ public: true Written by [Akash Joshi](https://thewriting.dev) + + + + + + - \ No newline at end of file + diff --git a/docs/learning-how-tos/examples-and-guides/enable-beta-languages.mdx b/docs/learning-how-tos/examples-and-guides/enable-beta-languages.mdx new file mode 100644 index 00000000..4fe9fc1b --- /dev/null +++ b/docs/learning-how-tos/examples-and-guides/enable-beta-languages.mdx @@ -0,0 +1,139 @@ +--- +title: "Enable support for Beta languages" +description: >- + Enable support for Beta languages. +sidebarTitle: "Enable Beta languages" +public: false +--- + +To activate support for languages in Beta, your API request needs to specify the enable_beta_languages option. + +Note: this option should be `true` for JSON-encoded requests, and `1` for URL-encoded requests. + +Here are some examples how to do this in plain HTTP, as a cURL command, and using our client libraries. + + + + ```http Example request + POST /v2/translate HTTP/2 + Host: api.deepl.com + Authorization: DeepL-Auth-Key [yourAuthKey] + User-Agent: YourApp/1.2.3 + Content-Length: 45 + Content-Type: application/json + + { + "text": ["Hello, world!"], + "target_lang":"ace", + "enable_beta_languages": true + } + ``` + + + ```bash Example request -- JSON-encoded + curl -X POST 'https://api.deepl.com/v2/translate' \ + --header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ + --header 'Content-Type: application/json' \ + --data '{ + "text": [ + "Hello, world!" + ], + "target_lang": "ace", + "enable_beta_languages": true + }' + ``` + + ```bash Example request -- URL-encoded + curl -X POST 'https://api.deepl.com/v2/translate' \ + --header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ + --url-encoded "text=Hello, world!" \ + --url-encoded "target_lang=ace" \ + --url-encoded "enable_beta_languages=1" + ``` + + + Minimum client library version: 1.24.0 + + ```python + result = deepl_client.translate_text( + "Hello, world!", + target_lang="ace", + extra_body_parameters={ + "enable_beta_languages": True, + }) + ``` + + + Minimum client library version: 1.21.0 + + ```typescript + const result = await deeplClient.translateText( + 'Hello, world!', + null, + 'ace' as deepl.TargetLanguageCode, // type-override for beta language. + { + extraRequestParameters: + { + 'enable_beta_languages': '1' + } + }); + ``` + + + Minimum client library version: 1.13.0 + + ```php + $result = $deeplClient->translateText( + 'Hello, world!', + null, + 'ace', + [TranslateTextOptions::EXTRA_BODY_PARAMETERS => [ + 'enable_beta_languages' => '1' + ]]); + ``` + + + Minimum client library version: 1.16.0 + + ```csharp + var translatedText = await client.TranslateTextAsync( + "Hello, world!", + null, + "ace", + new TextTranslateOptions { ExtraBodyParameters = new Dictionary { { "enable_beta_languages", "1" } } }); + ``` + + + Minimum client library version: 1.11.0 + + ```java + TextTranslationOptions textTranslationOptions = new TextTranslationOptions(); + textTranslationOptions.setExtraBodyParameters( + Map.of("enable_beta_languages", "1"); + ); + TextResult result = deepLClient.translateText("Hello, world!", null, "ace", + textTranslationOptions); + ``` + + + Minimum client library version: 3.3.0 + + ```ruby + translation = DeepL.translate 'Hello, world!', nil, 'ace', + extra_body_parameters: { enable_beta_languages: true } + ``` + + + +All examples should return "Hello, world!" translated into Acehnese (`ace`), one of the new languages: "Hai, donya!". + +```json Example response +{ + "translations": [ + { + "detected_source_language": "EN", + "text": "Hai, donya!" + } + ] +} +``` \ No newline at end of file diff --git a/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api.mdx b/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api.mdx index 99a6bf15..3c0652d5 100644 --- a/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api.mdx +++ b/docs/learning-how-tos/examples-and-guides/first-things-to-try-with-the-deepl-api.mdx @@ -65,11 +65,6 @@ Right now, client libraries are available for .NET, PHP, Node, Python, Ruby and ### 5. Get involved with the developer community -Created a killer app powered by DeepL? Want to ask what the best what practise is for integrating using C#? [The official DeepL Developer Community on Discord is the place to go](https://discord.gg/deepl). +Created a killer app powered by DeepL? Want to ask what the best what practise is for integrating using C#? [The official DeepL Developer Community on DeepL Bridges is the place to go](https://dee.pl/7iwrt). -
    - - -
    - -As well as finding other community members - and maybe helping them with their own questions - you’ll also find community exclusive events to attend and even a DeepL staffer or two talking about all things API development. +As well as finding other community members - and maybe helping them with their own questions - you'll also find community exclusive events to attend and even a DeepL staffer or two talking about all things API development. diff --git a/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter.mdx b/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter.mdx new file mode 100644 index 00000000..144ed526 --- /dev/null +++ b/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter.mdx @@ -0,0 +1,291 @@ +--- +title: "How to Use the Context Parameter Effectively" +description: "Learn when and how to use the context parameter to improve translation accuracy for ambiguous content." +public: true +--- + +**This guide shows you:** +- When to use `context` (and when not to) +- How to use `context` to resolve ambiguous words, genders, or transliterations +- How to choose between `context`, Glossaries, and Style Rules + +--- + +## What the context parameter is for + +The `context` parameter helps DeepL's API translate ambiguous words and short text snippets more accurately by providing the surrounding content. Think of it like showing a human translator the paragraphs before and after the sentence being translated. + +The `context` parameter can help with: + +- Picking the correct translation for ambiguous words +- Providing grammatical clues for gender, number, or case that isn't clear from the text alone +- Improving translations of short snippets such as headlines or product names + +## What the context parameter is NOT for + + +**Common Misconception:** Many users try to use `context` like ChatGPT system prompts. **This does not work reliably.** + + +The `context` parameter is **not** designed for: + +- LLM-style instructions: "Translate with a friendly, casual tone" +- Translation rules: "Always translate 'Tor' as 'gate'" +- Cultural context: "Adapt for German cultural norms" + +Using `context` like this will produce unpredictable results. The parameter is optimized for document content, not commands. + +Instead, try: +- [Style rules and custom instructions](/api-reference/style-rules): For tone, style, formatting, and translation instructions +- [Glossaries](/api-reference/multilingual-glossaries): For consistent terminology and brand names + +--- + +## How to use context for ambiguous words + +When a word has multiple meanings, surrounding context helps the translation engine choose the correct interpretation. + +### Example + +"Tor" could mean "gate" or "goal" in German. Without context, DeepL may not know which meaning you intend: + +```sh +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [your key]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": [ + "Die Person stand vor dem Tor." + ], + "target_lang": "EN-US" +}' +``` + +**Output without context:** +```text +"The person was standing in front of the gate." +``` + +If you're writing about a football game, provide context to clarify: + +```sh +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [your key]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": [ + "Die Person stand vor dem Tor." + ], + "target_lang": "EN-US", + "context": "Es war ein Fußballspiel." +}' +``` + +**Output with context:** +```text +"The person was standing in front of the goal." +``` + +### When to use this approach + +- You're translating short snippets that lack built-in context +- The text contains words with multiple meanings +- The surrounding content makes the intended meaning clear + +--- + +## How to use context for grammatical gender + +When grammatical gender isn't clear from the source text, context can provide the necessary clues. + +### Example + +Without context, DeepL may not use the desired gender when translating: + +```sh +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [your key]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": [ + "The teacher asked the class to tidy up after they finished the lesson." + ], + "target_lang": "DE" +}' +``` + +**Output without context:** (uses masculine form "Lehrer") +```text +"Der Lehrer bat die Klasse, nach der Stunde aufzuräumen." +``` + +You can provide context from the surrounding text that clarifies the teacher's gender: + +```sh +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [your key]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": [ + "The teacher asked the class to tidy up after they finished the lesson." + ], + "target_lang": "DE", + "context": "She did not want to tidy up herself." +}' +``` + +**Output with context:** (uses feminine form "Lehrerin") +```text +"Die Lehrerin bat die Klasse, nach der Stunde aufzuräumen." +``` + +### When to use this approach + +- Translating into languages with grammatical gender +- The source text doesn't specify gender +- You have surrounding sentences that contain gender clues + +--- + +## How to use context for consistent name translation + +When translating names in headlines or short snippets, the same name might be transliterated differently unless additional context is provided. + +### Example + +Content is not shared between `text` parameters. This results in different transliterations for the name "Sergej". + +```sh +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [your key]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": [ + "Sergej gibt Stellungnahme ab", + "Sergej Zhivkov erklärte gestern, dass neue Maßnahmen ergriffen werden." + ], + "source_lang": "DE", + "target_lang": "EN-US" +}' +``` + +**Output without context:** +```json +{ + "translations": [ + { + "detected_source_language": "DE", + "text": "Sergej makes a statement" + }, + { + "detected_source_language": "DE", + "text": "Sergei Zhivkov explained yesterday that new measures will be taken." + } + ] +} +``` + +Providing a longer snippet of `context` containing the complete name results in consistent transliteration: + +```sh +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [your key]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": [ + "Sergej gibt Stellungnahme ab", + "Sergej Zhivkov erklärte gestern, dass neue Maßnahmen ergriffen werden." + ], + "source_lang": "DE", + "target_lang": "EN-US", + "context": "Sergej Zhivkov erklärte gestern, dass neue Maßnahmen ergriffen werden." +}' +``` + +**Output with context:** +```json +{ + "translations": [ + { + "detected_source_language": "DE", + "text": "Sergei issues statement" + }, + { + "detected_source_language": "DE", + "text": "Sergei Zhivkov declared yesterday that new measures will be taken." + } + ] +} +``` + +### When to use this approach + +- Translating news headlines separately from article bodies +- Transliterating names with multiple possible spellings in your target language + +--- + +## Choosing the right feature for your needs + +Different DeepL features solve different problems. Use this table to decide which best suits your use case. + +| Use Case | Context Parameter | Glossaries | Style Rules | +|----------|:----------------:|:----------:|:-----------:| +| **Ambiguous words** | ✅ | ❌ | ❌ | +| **Consistent gender or spelling** | ✅ | ❌ | ❌ | +| **Consistent domain-specific terminology** | ❌ | ✅ | ❌ | +| **Brand names** | ❌ | ✅ | ❌ | +| **Tone and style** | ❌ | ❌ | ✅ | +| **Formatting rules** | ❌ | ❌ | ✅ | +| **Translation instructions** | ❌ | ❌ | ✅ | + +--- + +## Technical details + +### Cost + +Characters in the `context` parameter do not count toward billing. Only characters sent in the `text` parameter are billed. + +### Size limit + +There is no size limit for the `context` parameter itself, but the request body size limit of 128 KiB applies to all text translation requests. + +### Multi-`text` requests + +Content is not shared between multiple `text` parameters sent in one request. Each text parameter is translated independently. + +In this example, "Tor" might be translated as "gate" instead of "goal" because the first `text` doesn't have access to the second one's content. + +```python +{ + "text": [ + "Die Person stand vor dem Tor.", + "Es war ein Fußballspiel." + ], + "target_lang": "EN-US" +} +``` + +To ensure "Tor" is translated as "goal", you can add additional sentences into the `context` parameter, or keep related content together in one `text` parameter. + +If you send a request with both `context` and multiple `text` parameters, the `context` parameter will be applied to each one. + +### Document translation + +When using the [document translation endpoint](/api-reference/document), the engine automatically uses the broader document context. You don't need to provide explicit context for full documents. + +### Tag handling + +When using `tag_handling=xml` or `tag_handling=html`, tags are *not* used as a context boundary. The translation engine automatically looks across all content provided in each `text` parameter. As with other types of texts, you may need to provide additional `context` when translating single tags without surrounding content. + +--- + +## Next steps + +Now that you understand the context parameter: + +- **Try it yourself:** Review the [text translation API reference](/api-reference/translate) for complete context parameter specifications +- **Enforce terminology:** Learn how to use [glossaries](/api-reference/multilingual-glossaries) for consistent translations across all content +- **Control style and tone:** Explore [style rules](/api-reference/style-rules) for formatting and tone instructions +- **Translate full documents:** Understand how [document translation](/api-reference/document) automatically handles context \ No newline at end of file diff --git a/docs/learning-how-tos/examples-and-guides/translating-between-variants.mdx b/docs/learning-how-tos/examples-and-guides/translating-between-variants.mdx new file mode 100644 index 00000000..3f23d6e6 --- /dev/null +++ b/docs/learning-how-tos/examples-and-guides/translating-between-variants.mdx @@ -0,0 +1,134 @@ +--- +title: "How to Translate Between Language Variants" +description: "Learn how to translate between language variants, like British English and US English, using the DeepL API." +public: true +--- + +**This guide shows you:** +- How to translate between language variants (e.g., `en-US` to `en-GB`, `pt-PT` to `pt-BR`) +- Which method to choose: Write API, style rules, or custom instructions +- An example workflow for converting American English to British English + +--- + +## Methods for translating between variants + +You can use the DeepL API to translate between variants of the same language using 3 methods: + +### 1. DeepL Write API + +Use the [/write/rephrase](/api-reference/improve-text) endpoint to rephrase text into the target language variant. + +**When to use this:** +- You're translating shorter texts (headlines, product names, brief descriptions) +- You want high-quality rephrasing alongside variant translation + +```bash Example cURL request +curl -X POST 'https://api.deepl.com/v2/write/rephrase' \ +--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": ["Check out the new fall colors!"], + "target_lang": "en-GB" +}' +``` + +```json Example response +{ + "improvements": [ + { + "text": "Check out the new autumn colours!", + "detected_source_language": "en", + "target_language": "en-GB" + } + ] +} +``` + + +For longer texts, the Write API may rephrase and enhance content beyond simple variant conversion. If you need to maintain the exact structure while only updating locale-specific spelling and grammar, use another method. + +Please note that currently, the methods outlined below are not fully supported for this use case and may not always perform as intended. We encourage you to conduct your own evaluations. + + +### 2. Style rules with custom instructions + +Create a reusable [style rule](/api-reference/style-rules) with attached `custom_instructions` describing the desired variant translation. + +**When to use this:** +- You need to maintain the text's content between variants as precisely as possible +- You need consistent variant transformations across many translation requests +- You want to reuse the same variant rules without repeating the custom instructions + +```bash Example cURL request +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": ["I went to the pharmacy."], + "target_lang": "en-GB", + "style_id": "your-style-rule-id" +}' +``` + +```json Example response +{ + "translations": [ + { + "detected_source_language": "EN", + "text": "I went to the chemist's." + } + ] +} +``` + + +Glossaries and style rules are unique to each of DeepL's global data centers and are not shared between them. + +Clients using the `api-us.deepl.com` endpoint will not be able to access glossaries or style rules created in the UI at this time. + + +### 3. Per-request custom instructions + +Add [custom_instructions](/api-reference/translate/request-translation#body-custom-instructions) describing the desired variant translation directly into your `/translate` requests. + +**When to use this:** +- You need to maintain the text's content between variants as precisely as possible +- You need ad-hoc, one-off translations with specific variant requirements +- You don't want to manage separate style rules + +```bash Example cURL request +curl -X POST 'https://api.deepl.com/v2/translate' \ +--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \ +--header 'Content-Type: application/json' \ +--data '{ + "text": ["I went to the pharmacy."], + "target_lang": "en-GB", + "custom_instructions": ["translate to British English"] +}' +``` + +```json Example response +{ + "translations": [ + { + "detected_source_language": "EN", + "text": "I went to the chemist's." + } + ] +} +``` + +You can specify up to 10 custom instructions per request, each with a maximum of 300 characters. + +--- + +## Next steps + +Now that you understand how to translate between language variants: + +- **Try it yourself:** Test out style rules and custom instructions in the [text translation API playground](/api-reference/translate) +- **Learn about the Write API:** Explore the [/write/rephrase endpoint](/api-reference/improve-text) for high-quality variant translation and rephrasing +- **Manage reusable rules:** Learn how to create [style rules](/api-reference/style-rules) for systematic variant transformations +- **Improve translation quality:** Understand how [the context parameter](/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter) can enhance ambiguous translations + diff --git a/docs/getting-started/alpha-and-beta-features.mdx b/docs/resources/alpha-and-beta-features.mdx similarity index 100% rename from docs/getting-started/alpha-and-beta-features.mdx rename to docs/resources/alpha-and-beta-features.mdx diff --git a/docs/resources/breaking-changes-change-notices.mdx b/docs/resources/breaking-changes-change-notices.mdx index f728c8cb..4fd63797 100644 --- a/docs/resources/breaking-changes-change-notices.mdx +++ b/docs/resources/breaking-changes-change-notices.mdx @@ -10,4 +10,6 @@ To learn about new releases, please see the [Release notes](/docs/resources/rele + + \ No newline at end of file diff --git a/docs/resources/breaking-changes-change-notices/november-2025-deprecation-of-legacy-auth-methods.mdx b/docs/resources/breaking-changes-change-notices/november-2025-deprecation-of-legacy-auth-methods.mdx new file mode 100644 index 00000000..9823bc3f --- /dev/null +++ b/docs/resources/breaking-changes-change-notices/november-2025-deprecation-of-legacy-auth-methods.mdx @@ -0,0 +1,51 @@ +--- +title: "November 2025: Deprecation of query parameter and request body authentication" +--- + +## Change Notice + + +Update: The deadline for this deprecation has been extended to January 15th, 2026. + + +On November 1st, 2025, DeepL will fully obsolesce support for providing authentication information in an `auth_key` query parameter or in an `auth_key` field of the request body. + +Deprecation of this feature was previously announced in [March 2025](/docs/resources/breaking-changes-change-notices/march-2025-deprecating-get-requests-to-translate-and-authenticating-with-auth_key), but we have continued to support it temporarily to allow more time for customers to complete the migration. + +You will no longer be able to authenticate a request to any endpoint by sending an API key in a query parameter or request body. Instead, send your API key in an HTTP header named `Authorization`. + +* **You will no longer be able to authenticate a request to any endpoint by sending an API key in a query parameter or in the request body.** Instead, send your API key in an HTTP header named `Authorization` . +* **If you use one of DeepL's officially-supported client libraries, you won't be negatively affected by the breaking changes and do not need to update your application.** Specifically, we've confirmed the following client library versions: + * [deepl-php](https://github.com/deeplcom/deepl-php): 1.0.0+ + * [deepl-python](https://github.com/deeplcom/deepl-python): 1.0.0+ + * [deepl-java](https://github.com/DeepLcom/deepl-java): 1.0.0+ + * [deepl-dotnet](https://github.com/DeepLcom/deepl-dotnet): 1.0.0+ + * [deepl-node](https://github.com/DeepLcom/deepl-node): 1.1.0+ + * [deepl-rb](https://github.com/DeepLcom/deepl-rb): 3.0.0+ + +Going forward, you will need to authorize any API request, to any endpoint, by including your +API key in an HTTP header named `Authorization`, like this: + +``` +Authorization: DeepL-Auth-Key [yourAuthKey] +``` + +For detailed information on authorization and how to use the Authorization header, please see the [documentation](https://developers.deepl.com/docs/getting-started/auth). +Going forward, you will not be able to authorize any request, to any endpoint, by including your API key in an `auth_key` query parameter or an `auth_key` field of the request body. + +### Why is DeepL doing this now? +The API best practice is to authenticate a request by including the API key in an HTTP header. Sending an API key in a GET request or in a URL risks exposing the API key to the public via logs or other means. For privacy and security reasons, we must disallow this practice. + +### What if I continue to use non-header authentication? +After the date above, translation requests that attempt to authenticate with an `auth_key` query parameter or an `auth_key` field in the request body will fail with a `403 Forbidden` response. + +### What action should I take so that I’m not affected? +If you develop your own application using the DeepL API: + +- Ensure your code is not using either of the deprecated features. + +If you’re using a third-party plugin that is powered by the DeepL API: + +- Update to the most recent version of the plugin. If you experience trouble, contact the plugin provider to make sure they are aware of these deprecations. + +For further questions, please visit [our support page](https://support.deepl.com). \ No newline at end of file diff --git a/docs/resources/deepl-developer-community.mdx b/docs/resources/deepl-developer-community.mdx index a992ce99..b6d31b0c 100644 --- a/docs/resources/deepl-developer-community.mdx +++ b/docs/resources/deepl-developer-community.mdx @@ -1,19 +1,16 @@ --- -title: "DeepL developer community" +title: "Developer Community" --- -We're excited to announce the official DeepL Developer Community is now on Discord for everyone to join! This is a friendly, collaborative space to discuss everything DeepL, development, AI, tech and more! +![graphic for DeepL Bridges](https://tribe-eu.imgix.net/uU2Ee5IedtSmeFhLPfa2a?fit=max&w=1000&auto=compress,format) -
    - - -
    +We're excited to announce [the official DeepL Developer Community](https://www.deepl-bridges.com/) is now available on [DeepL Bridges](https://www.deepl-bridges.com/) for everyone to join. This is a friendly, collaborative space to discuss everything DeepL, development, AI, tech and more! The community is a place to: * Introduce yourself and connect with other DeepL community members * Share what you're currently working on and how you're integrating DeepL into your software projects * Join upcoming live events and webinars exclusive to the community -* Ask the community for coding help and tips on development best practice, as well as offering your own help and experience +* Ask for coding help and tips on development best practice, as well as offering your own help and experience -To join the community, click the following link: [https://discord.gg/deepl](https://discord.gg/deepl) +[Join Deepl Bridges here!](https://www.deepl-bridges.com/) diff --git a/docs/resources/open-api-spec.mdx b/docs/resources/open-api-spec.mdx index 9902be12..bb989c67 100644 --- a/docs/resources/open-api-spec.mdx +++ b/docs/resources/open-api-spec.mdx @@ -1,4 +1,4 @@ --- title: "Open API spec" -url: "https://raw.githubusercontent.com/DeepLcom/openapi/main/openapi_gitbook.yaml" +url: "https://github.com/DeepLcom/openapi/" --- \ No newline at end of file diff --git a/docs/resources/release-notes.mdx b/docs/resources/roadmap-and-release-notes.mdx similarity index 68% rename from docs/resources/release-notes.mdx rename to docs/resources/roadmap-and-release-notes.mdx index 032ad8c3..fa6eb751 100644 --- a/docs/resources/release-notes.mdx +++ b/docs/resources/roadmap-and-release-notes.mdx @@ -1,97 +1,128 @@ --- -title: "Release notes" -description: "Brief summaries of recent DeepL API releases, such as support for new languages and document formats, new API parameters, and more." +title: "Roadmap and release notes" +description: "The latest features and improvements in the DeepL API, plus what's coming next" rss: true --- - Add more events to audit logs for Pro API customers (API key management, cost control and usage limit changes) -- Add usage analytics in the Admin API, including key-level reporting. -- Allow multiple admins in an API subscription -- Add support for custom rules in the API to programmatically manage and translate using custom rules. +- Full CRUD functionality for managing [Style Rules](/api-reference/style-rules) and [Custom Instructions](/api-reference/translate/request-translation#body-custom-instructions) +- Translation Memory via API +- `v3/languages` endpoint with improved language code handling and additional functionality - + +## February 18 - Additional Languages in `v2/languages` +- New languages added to the [v2/languages endpoint](/api-reference/languages), bringing totals to **101 source languages** and **106 target languages**. +- These languages were already supported for translation; this change improves automatic discoverability for API clients. +- Note: 12 supported languages using three-letter base codes (e.g. ACE, CEB, CKB) are not yet included in `v2/languages` for backwards compatibility, but will be available in the upcoming `v3/languages` endpoint. + + + +## January 20 - Legacy Auth Deprecation + +Query parameter and request body authentication methods are now [deprecated](/docs/resources/breaking-changes-change-notices/november-2025-deprecation-of-legacy-auth-methods). +- **API Free users**: All requests using legacy auth now return `403 Forbidden`. +- **API Pro users**: Brownout period active with intermittent `403` responses. Full deprecation in early February 2026. + +Use the `DeepL-Auth-Key` header instead. + +## January 8 - 81 New Languages in GA +- Promoted all 81 beta languages to standard language support. These languages are now part of the main source and target language lists. +- Note that these languages only work with `quality_optimized` model or when no model is specified, and are not compatible with `latency_optimized` requests. +- The `enable_beta_languages` parameter is maintained for backward compatibility but has no effect. + +See [here](../getting-started/supported-languages) for the complete language list. + + + +## Q4 2025 +- Added API reference for the Voice API +- Add contextual menu in the to make it easier to copy any API documentation page as context for AI tools +- Add support for style rules in the API to programmatically get your created style rules and translate with them. +- Overhauled the tag-handling algorithm that backs translation of XML and HTML in the DeepL API. To enable it and benefit from all the improvements, set the `tag_handling_version` parameter to `v2` in the text translation API. See [here](../xml-and-html-handling/tag-handling-v2) for more information. +- Added new usage analytics endpoint in the Admin API, including key-level reporting. See [here](/api-reference/admin-api/get-usage-analytics) for more details +- Enabled support for multiple admins in an API subscription +- Added support for 75 new languages, initially through the `enable_beta_languages` parameter, for text and document translation. Beta languages are not billed during the beta phase and do not yet support glossaries or formality. See [here](../getting-started/supported-languages#beta-languages) for more information +- Added HE, TH and VI to the languages endpoint, since they are now also available in document translation +- Added 6 additional beta languages, for text and document translation. See the previous note about 75 new languages. +- Added a new parameter to the text translation API to allow custom instructions, making it possible to customize the translation behavior (e.g. ["Use a friendly, diplomatic tone"]) +- Added support for JPEG and PNG images in [document translation](/api-reference/document), currently in Beta. + +## Q3 2025 - Creation of an admin API, making it possible to manage API keys programmatically. See [here](/api-reference/admin-api) for more information - Added support for new language: ES-419 (Latin American Spanish). For this release, this language will be available for the API in next-gen models only. See [here](../getting-started/supported-languages) for more information. - Refreshed our API documentation and added new try-it explorers to support interacting with our APIs. See [here](/api-reference) to try it out! - - +## Q2 2025 - Added support for new language: TH (Thai). For this release, this language will only support text translation. See [here](../getting-started/supported-languages) for more information. - Added support for new languages: HE (Hebrew) and VI (Vietnamese). For this release, these languages will be available for Pro v2 API in next-gen models only. See [here](../getting-started/supported-languages) for more information. - Added improvements to API glossaries, including the ability to edit glossaries and create multilingual glossaries. Learn more [here](/api-reference/multilingual-glossaries/). - Improvements to the `/usage` endpoint for Pro API customers ([API reference](/api-reference/usage-and-quota/)) - Improvements to key-level usage reporting, making it possible to pull reports with a custom date range and to group data by calendar day. Learn more [here](../getting-started/managing-api-keys#get-api-key-level-usage). - - +## Q1 2025 - Added support for API key-level usage limits, making it possible to set a character limit at the API key-level. Learn more [here](../getting-started/managing-api-keys#set-api-key-level-usage-limits). - DeepL API for Write is generally available to Pro API customers, making it possible to improve texts in (at the time of release) 6 different languages. Learn more and get started [here](/api-reference/improve-text/). - + +## Q4 2024 - Added the `model_type` parameter, allowing users to translate text with DeepL's "next-gen" translation models. More information can be found [here](/api-reference/translate#about-the-model_type-parameter). - - +## Q3 2024 - Added the `show_billed_characters` parameter for text translation, allowing users to optionally include the number of billed characters in the API response. [Learn more here](/api-reference/translate#request-body-descriptions). - Added support for a new language for text translation: ZH-HANT (Traditional Chinese). As of this initial release, document translation is not supported for Traditional Chinese. More information is available [here](/docs/getting-started/supported-languages). - An official Ruby client library, evolved from a community-written library by Daniel Herzog. You can download it [here](https://rubygems.org/gems/deepl-rb) or find the source code on our [GitHub page](https://github.com/DeepLcom/deepl-rb). - - +## Q2 2024 - Added support for DOCX and PPTX document minification to the PHP client library, making it possible for users to translate documents that exceed DeepL's file size limit due to embedded media. [Learn more here](https://github.com/DeepLcom/deepl-php?tab=readme-ov-file#document-minification). - Added support for API key-level usage reporting. More information is available in the [multiple API keys guide](https://developers.deepl.com/multiple-api-keys#download-a-report-with-key-level-usage). - Launched DeepL Pro in [165 new markets](https://www.deepl.com/en/blog/deepl-pro-expands-165-new-markets), bringing the total number of markets where DeepL Pro is available to 228. This means users with billing addresses in these markets can create DeepL Pro API and Free API subscriptions. - Added support for new glossary languages: DA (Danish), NB (Norwegian Bokmål), and Swedish (SV). - Moved the `context` parameter from [alpha](/docs/getting-started/alpha-and-beta-features) status to general availability. More information about the context parameter is available in the "Request body descriptions" table [here](/api-reference/translate). - Added support for SRT (`srt`) files in [document translation](/api-reference/document). - - +## Q1 2024 - Added support for multiple API keys in a single account for Pro API and Free API users. More information is available in the [multiple API keys guide](https://developers.deepl.com/multiple-api-keys). - Added support for a new language for text translation: AR (Arabic). As of this initial release, document translation is not supported for Arabic. More information is available [here](/docs/getting-started/supported-languages). - Added support for Korean (KO) as a [glossary](/api-reference/multilingual-glossaries) language, increasing the number of supported glossary language pairs from 55 to 66. - + +## Q4 2023 - Added support for Microsoft Excel (`xlsx`) files in [document translation](/api-reference/document). - Released the `context` parameter as an [alpha feature](/docs/getting-started/alpha-and-beta-features) for text translation (see [Request Body Descriptions table](/api-reference/translate#request-body-descriptions) for more information). - - +## Q3 2023 - Launched DeepL Pro in South Korea ([blog post here](https://www.deepl.com/en/blog/deepl-pro-available-in-south-korea)). This means users with billing addresses in South Korea can [create DeepL Pro API and Free API subscriptions](https://www.deepl.com/ko/pro#developer). - Added support for Portuguese (PT), Russian (RU), and Chinese (ZH) as [glossary](/api-reference/multilingual-glossaries) languages, increasing the number of supported glossary language pairs from 28 to 55. - Added support for JSON-encoded requests for all remaining endpoints (*note that document upload for document translation still requires*`multipart/form-data`). - - +## Q2 2023 - Added support for user-provided http clients in [PHP client library](https://github.com/DeepLcom/deepl-php). - Released an official [DeepL API Postman collection](https://www.postman.com/deepl-api/workspace/deepl-api-developers/overview). - Added formality support for Japanese (JA) in [text](/api-reference/translate) and [document](/api-reference/document) translation. - Released in-house PDF translation; removed requirement to send data to the US when translating PDF documents ([blog post](https://www.deepl.com/en/blog/deepl-launches-in-house-pdf-translation-for-improved-security-and-efficiency)). - - +## Q1 2023 - Released an official [DeepL Custom Connector](https://support.deepl.com/hc/en-us/articles/8644041855516-DeepL-API-custom-connector-for-Microsoft-Power-Automate) for Microsoft Power Automate. - Added support for glossaries in any combination of two languages from the following list: EN (English), DE (German), FR (French), IT (Italian), PL (Polish), NL (Dutch), ES (Spanish, JA (Japanese). This represents an increase from 8 to 28 supported glossary language pairs. - Added XLIFF as a [document translation](/api-reference/document) format (*note that only documents from version 2.0 are supported, and there is no support for the legacy 1.2 format*). - Added support for new languages for text and document translation: KO (Korean) and NB (Norwegian Bokmål). [Blog post here](https://www.deepl.com/en/blog/welcome-korean-and-norwegian). - + +## Q4 2022 - Moved [HTML handling](/docs/xml-and-html-handling/html) out of beta after fixing the most commonly reported user issues. - Released an official [Java client library](https://github.com/DeepLcom/deepl-java). - Added support for JSON-encoded requests for [text translation](/api-reference/translate), [usage](/api-reference/usage-and-quota), and [languages](/api-reference/languages) endpoints. - - +## Q3 2022 - Released an official [PHP client library](https://github.com/DeepLcom/deepl-php). - Added support for a new language for [text](/api-reference/translate) and [document](/api-reference/document) translation: UK (Ukrainian). [Blog post here](https://www.deepl.com/en/blog/deepl-learns-ukrainian). - - +## Before Q3 2022 - Released an official DeepL API [OpenAPI spec](https://github.com/DeepLcom/openapi). - Released an official [NodeJS client library](https://github.com/DeepLcom/deepl-node). - Released an official [.NET client library](https://github.com/DeepLcom/deepl-dotnet). diff --git a/docs/resources/usage-limits.mdx b/docs/resources/usage-limits.mdx index 26173dca..3f38973e 100644 --- a/docs/resources/usage-limits.mdx +++ b/docs/resources/usage-limits.mdx @@ -12,18 +12,20 @@ title: "Usage and limits" ### Maximum Upload Limits Per Document Format -| File Format | DeepL API Free | DeepL API Pro | -| --------------------- | ------------------------------ | -------------------------------- | -| Word (.docx / .doc) | 10 MB
    500,000 characters | 30 MB
    1 million characters | -| PowerPoint (.pptx) | 10 MB
    500,000 characters | 30 MB
    1 million characters | -| Excel (.xlsx) | 10 MB
    500,000 characters | 30 MB
    1 million characters | -| PDF (.pdf) | 10 MB
    500,000 characters | 30 MB
    1 million characters | -| Text (.txt) | 1 MB
    500,000 characters | 1 MB
    1 million characters | -| HTML (.html) | 5 MB
    500,000 characters | 5 MB
    1 million characters | -| XLIFF (.xlf/.xliff)\* | 10 MB
    500,000 characters | 10 MB
    1 million characters | -| SRT (.srt) | 150 KB
    500,000 characters | 150 KB
    1 million characters | - -*Please note that DeepL only supports .xliff files with the version 2.1. +| File Format | DeepL API Free | DeepL API Pro | +| ----------------------- | ------------------------------ | -------------------------------- | +| Word (.docx / .doc) | 10 MB
    500,000 characters | 30 MB
    1 million characters | +| PowerPoint (.pptx) | 10 MB
    500,000 characters | 30 MB
    1 million characters | +| Excel (.xlsx) | 10 MB
    500,000 characters | 30 MB
    1 million characters | +| PDF (.pdf) | 10 MB
    500,000 characters | 30 MB
    1 million characters | +| Text (.txt) | 1 MB
    500,000 characters | 1 MB
    1 million characters | +| HTML (.html) | 5 MB
    500,000 characters | 5 MB
    1 million characters | +| XLIFF (.xlf/.xliff)\* | 10 MB
    500,000 characters | 10 MB
    1 million characters | +| SRT (.srt) | 150 KB
    500,000 characters | 150 KB
    1 million characters | +| Images (.jpeg/.png)\*\* | 3 MB
    500,000 characters | 3 MB
    1 million characters | + +*Please note that DeepL only supports .xliff files with the version 2.1.
    +**Image translation is currently in Beta. During the Beta phase, characters translated in image file formats are not billed and not counted against your character threshold. ### Your Usage diff --git a/docs/xml-and-html-handling/html.mdx b/docs/xml-and-html-handling/html.mdx index 0723b446..c4de23e3 100644 --- a/docs/xml-and-html-handling/html.mdx +++ b/docs/xml-and-html-handling/html.mdx @@ -3,12 +3,17 @@ title: "HTML handling" description: "Learn how to translate HTML content with the DeepL API." --- + + We've released an **improved version** of XML and HTML tag handling. Check it out [here](/docs/xml-and-html-handling/tag-handling-v2)! + + By default, the translation engine does not take HTML tags into account. By setting the `tag_handling` parameter to `html`, the API will process HTML input by extracting the text out of the structure, splitting it into individual sentences, translating them, and placing them back into the HTML structure. For the translation of (non-HTML) XML content please see [XML Handling](/docs/xml-and-html-handling/xml) + ### Splitting of newlines The default value for the `split_sentences` parameter for all requests where `tag_handling=html` is `nonewlines`, meaning the translation engine splits on punctuation only, ignoring newlines. @@ -41,4 +46,4 @@ To prevent the translation of elements in the HTML structure, the translation en ``` -
    \ No newline at end of file + diff --git a/docs/xml-and-html-handling/tag-handling-v2.mdx b/docs/xml-and-html-handling/tag-handling-v2.mdx new file mode 100644 index 00000000..21a4abfd --- /dev/null +++ b/docs/xml-and-html-handling/tag-handling-v2.mdx @@ -0,0 +1,188 @@ +--- +title: "New: XML/HTML handling v2" +description: "Learn about the benefits of tag handling v2 and how to migrate." +--- + +## Overview + +Tag handling v2 is an improved algorithm for translating XML and HTML content. Set `tag_handling_version=v2` to enable it. + +## What's New in v2 + +Tag handling v2 uses an algorithm that balances both translation quality and formatting. Sentences are now translated more naturally without being constrained by tag placement in the source text. It also handles edge cases around tag preservation, DOM hierarchy, and character escaping. + +V2 enforces strict XML parsing and will return an error if invalid XML is submitted. + + + Customers who had not used tag handling prior to 2025-12-01 default to v2. All other customers default to v1. + + +## Usage Examples + +### Translation with v2 + + + + ```text Parameters + tag_handling=html, tag_handling_version=v2 + ``` + + ```markup Request + + + +

    Welcome to Our Service

    +

    This is a premium feature.

    + + + ``` + + ```markup Response + + + +

    Willkommen bei unserem Service

    +

    Dies ist eine Premium-Funktion.

    + + + ``` +
    + + ```text Parameters + tag_handling=xml, tag_handling_version=v2 + ``` + + ```markup Request + Press Continue to advance. + ``` + + ```markup Response + Drücken Sie „Weiter", um fortzufahren. + ``` + + + ```text Parameters + tag_handling=xml, tag_handling_version=v2 + ``` + + ```markup Request + Please welcome the participants to today's meeting. + ``` + + ```markup Response + Bitte begrüßen Sie die Teilnehmer an der heutigen Sitzung. + ``` + + + ```text Parameters + tag_handling=xml, tag_handling_version=v2 + ``` + + ```markup Request + The firm said it had been conducting an internal investigation for several months. + ``` + + ```markup Response + Das Unternehmen gab an, dass es seit mehreren Monaten eine interne Untersuchung durchgeführt habe. + ``` + +
    + +### Strict XML Parsing + +Tag handling v2 enforces strict XML parsing. If invalid XML is submitted, the API will return an error: + + + ```text Parameters + tag_handling=xml, tag_handling_version=v2 + ``` + + ```markup Request (Invalid XML) +

    This tag is not closed properly + ``` + + ```json Response (Error) + { + "Message": "Tag handling parsing failed, please check input." + } + ``` + + +Only XML is strictly parsed. HTML is not strictly parsed. + +## Compatibility + +Tag handling v2 is currently only compatible with the `quality_optimized` model type. Support for `latency_optimized` will be added in a future update. + +| Model Type | v1 Support | v2 Support | +|------------|:----------:|:----------:| +| `quality_optimized` | ✅ | ✅ | +| `latency_optimized` | ✅ | ❌ | + +When you set `tag_handling_version` to `v2`, the `model_type` is implicitly set to `quality_optimized`. + + + Requests that specify both `model_type=latency_optimized` and `tag_handling_version=v2` will return an error. + + +## Migration Guide + +Tag handling is expected to give different results between v1 and v2. Thoroughly test your system and verify any differences in output before switching to v2 in production. + +### 1. Test Your Content + +Run v2 translations on representative samples of your content, especially: + +- Text with deep tag hierarchies +- Text with inline markup, attributes, and special characters +- Edge cases such as empty or self-closing tags + +### 2. Compare Outputs + +Compare v1 and v2 outputs, and make any updates needed to maintain your workflows. + +- Ensure that the tags are preserved correctly +- Compare any differences in translation +- Note any formatting changes + +### 3. Validate XML Syntax + +Since v2 enforces strict XML parsing: + +- Ensure all your XML input is well-formed +- Add error handling for invalid XML responses +- Update any XML generation logic if needed + +## Related Documentation + +For more information about XML and HTML tag handling: + +- [HTML Handling](/docs/xml-and-html-handling/html) +- [XML Handling](/docs/xml-and-html-handling/xml) +- [Structured XML Content](/docs/xml-and-html-handling/structured-content) + +## FAQ + +**Q: What is the default tag handling version?** + +A: Customers who had not used tag handling prior to 2025-12-01 default to v2. All other customers default to v1. + +**Q: Should I upgrade to v2?** + +A: Upgrading to v2 is strongly recommended and will provide improvements to both translation quality and structural correctness. Test thoroughly with your specific content before switching in production. + +**Q: What happens if my XML is invalid?** + +A: Tag handling v2 enforces strict XML parsing. Invalid XML will return an error response. Ensure your XML is well-formed before submission. + +**Q: Can I switch back to v1 if needed?** + +A: Yes, simply set `tag_handling_version: v1` in your API requests. + +**Q: Does v2 work with all DeepL API features?** + +A: Tag handling v2 works with all standard API features including glossaries and formality settings. However, it currently only supports the `quality_optimized` model type. + +**Q: Is HTML also strictly parsed?** + +A: No, any HTML can be submitted for translation without throwing an error. Only XML is strictly parsed and requires valid XML. diff --git a/docs/xml-and-html-handling/xml.mdx b/docs/xml-and-html-handling/xml.mdx index 165848df..27dcf4d8 100644 --- a/docs/xml-and-html-handling/xml.mdx +++ b/docs/xml-and-html-handling/xml.mdx @@ -2,13 +2,20 @@ title: "XML handling" description: "Learn how to translate XML content with the DeepL API." --- + + We've released [tag handling v2](/docs/xml-and-html-handling/tag-handling-v2), providing major improvements to XML and HTML tag handling. Note that v2 enforces strict XML parsing. + By default, the translation engine does not take tags into account. By setting the `tag_handling` parameter to `xml`, the API will process XML input by extracting the text out of the structure, splitting it into individual sentences, translating them, and placing them back into the XML structure. + +For best results, also set the [`tag_handling_version` parameter](/docs/xml-and-html-handling/tag-handling-v2) to `v2` in your request. + For the translation of HTML content please see [HTML Handling](/docs/xml-and-html-handling/html) + ### Sentences with Markup If you want to translate text where individual parts are marked up, you can simply activate the XML engine by setting `tag_handling` to `xml`. The following examples show marked-up text and how it will be translated: @@ -18,6 +25,7 @@ If you want to translate text where individual parts are marked up, you can simp ```markup Request Press Continue to advance to the next page. ``` + ```markup Response Drücken Sie Weiter, um zur nächsten Seite zu gelangen. ``` @@ -26,25 +34,28 @@ If you want to translate text where individual parts are marked up, you can simp ```markup Request Please welcome the participants to today's meeting. ``` + ```markup Response Bitte begrüßen Sie die Teilnehmer des heutigen Treffens. ``` - ```markup Request - The firm said it had been conducting an internal investigation for several months. - ``` - ```markup Response - Das Unternehmen sagte, dass es seit mehreren Monaten eine interne Untersuchungdurchgeführt habe. - ``` + ```markup Request + The firm said it had been conducting an internal investigation for several months. + ``` + + ```markup Response + Das Unternehmen sagte, dass es seit mehreren Monaten eine interne Untersuchungdurchgeführt habe. + ``` - ```markup Request - Artificial intelligence is already shaping our everyday lives. - ``` - ```markup Response - Künstliche Intelligenz prägt bereits heute unseren Alltag. - ``` + ```markup Request + Artificial intelligence is already shaping our everyday lives. + ``` + + ```markup Response + Künstliche Intelligenz prägt bereits heute unseren Alltag. + ``` @@ -52,16 +63,18 @@ In general, placeholders are associated with the words preceding or following th ### Ignored Tags -To ensure that elements in the original text are not altered in translation (e.g. trademarks or product names), use the `ignore_tags` parameter and specify a tag for this function. +Use the `ignore_tags` parameter to specify that content within specific tags should not be translated. The example below uses `ignore_tags=x` to tell DeepL to preserve text between ` `and `` tags as is. ```text Parameters tag_handling=xml, ignore_tags=x ``` + ```markup Request Please open the page Settings to configure your system. ``` + ```markup Response Bitte öffnen Sie die Seite Settings um Ihr System zu konfigurieren. ``` - \ No newline at end of file + diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000..ff24e297 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,70 @@ +{ + "name": "mintlify-docs", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@tanstack/react-table": { + "version": "8.21.3", + "resolved": "https://registry.npmjs.org/@tanstack/react-table/-/react-table-8.21.3.tgz", + "integrity": "sha512-5nNMTSETP4ykGegmVkhjcS8tTLW6Vl4axfEGQN3v0zdHYbK4UfoqfPChclTrJ4EoK9QynqAu9oUf8VEmrpZ5Ww==", + "license": "MIT", + "dependencies": { + "@tanstack/table-core": "8.21.3" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, + "node_modules/@tanstack/table-core": { + "version": "8.21.3", + "resolved": "https://registry.npmjs.org/@tanstack/table-core/-/table-core-8.21.3.tgz", + "integrity": "sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/react": { + "version": "19.1.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.1.1.tgz", + "integrity": "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.1.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.1.tgz", + "integrity": "sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw==", + "license": "MIT", + "peer": true, + "dependencies": { + "scheduler": "^0.26.0" + }, + "peerDependencies": { + "react": "^19.1.1" + } + }, + "node_modules/scheduler": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", + "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", + "license": "MIT", + "peer": true + } + } +} diff --git a/node_modules/@tanstack/react-table/LICENSE b/node_modules/@tanstack/react-table/LICENSE new file mode 100644 index 00000000..9fe1442e --- /dev/null +++ b/node_modules/@tanstack/react-table/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Tanner Linsley + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@tanstack/react-table/build/lib/index.d.ts b/node_modules/@tanstack/react-table/build/lib/index.d.ts new file mode 100644 index 00000000..2edc531a --- /dev/null +++ b/node_modules/@tanstack/react-table/build/lib/index.d.ts @@ -0,0 +1,9 @@ +import * as React from 'react'; +export * from '@tanstack/table-core'; +import { TableOptions, RowData } from '@tanstack/table-core'; +export type Renderable = React.ReactNode | React.ComponentType; +/** + * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`. + */ +export declare function flexRender(Comp: Renderable, props: TProps): React.ReactNode | React.JSX.Element; +export declare function useReactTable(options: TableOptions): import("@tanstack/table-core").Table; diff --git a/node_modules/@tanstack/react-table/build/lib/index.esm.js b/node_modules/@tanstack/react-table/build/lib/index.esm.js new file mode 100644 index 00000000..d8343709 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/lib/index.esm.js @@ -0,0 +1,74 @@ +/** + * react-table + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +import * as React from 'react'; +import { createTable } from '@tanstack/table-core'; +export * from '@tanstack/table-core'; + +// + +/** + * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`. + */ +function flexRender(Comp, props) { + return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React.createElement(Comp, props) : Comp; +} +function isReactComponent(component) { + return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component); +} +function isClassComponent(component) { + return typeof component === 'function' && (() => { + const proto = Object.getPrototypeOf(component); + return proto.prototype && proto.prototype.isReactComponent; + })(); +} +function isExoticComponent(component) { + return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description); +} +function useReactTable(options) { + // Compose in the generic options to the user options + const resolvedOptions = { + state: {}, + // Dummy state + onStateChange: () => {}, + // noop + renderFallbackValue: null, + ...options + }; + + // Create a new table and store it in state + const [tableRef] = React.useState(() => ({ + current: createTable(resolvedOptions) + })); + + // By default, manage table state here using the table's initial state + const [state, setState] = React.useState(() => tableRef.current.initialState); + + // Compose the default state above with any user state. This will allow the user + // to only control a subset of the state if desired. + tableRef.current.setOptions(prev => ({ + ...prev, + ...options, + state: { + ...state, + ...options.state + }, + // Similarly, we'll maintain both our internal state and any user-provided + // state. + onStateChange: updater => { + setState(updater); + options.onStateChange == null || options.onStateChange(updater); + } + })); + return tableRef.current; +} + +export { flexRender, useReactTable }; +//# sourceMappingURL=index.esm.js.map diff --git a/node_modules/@tanstack/react-table/build/lib/index.esm.js.map b/node_modules/@tanstack/react-table/build/lib/index.esm.js.map new file mode 100644 index 00000000..647303b1 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/lib/index.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.esm.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable = React.ReactNode | React.ComponentType\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nexport function flexRender(\n Comp: Renderable,\n props: TProps\n): React.ReactNode | React.JSX.Element {\n return !Comp ? null : isReactComponent(Comp) ? (\n \n ) : (\n Comp\n )\n}\n\nfunction isReactComponent(\n component: unknown\n): component is React.ComponentType {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport function useReactTable(\n options: TableOptions\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n tableRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n return tableRef.current\n}\n"],"names":["flexRender","Comp","props","isReactComponent","React","createElement","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","useReactTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","tableRef","useState","current","createTable","setState","initialState","setOptions","prev","updater"],"mappings":";;;;;;;;;;;;;;AAYA;;AAEA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,IAAwB,EACxBC,KAAa,EACwB;AACrC,EAAA,OAAO,CAACD,IAAI,GAAG,IAAI,GAAGE,gBAAgB,CAASF,IAAI,CAAC,gBAClDG,KAAA,CAAAC,aAAA,CAACJ,IAAI,EAAKC,KAAQ,CAAC,GAEnBD,IACD,CAAA;AACH,CAAA;AAEA,SAASE,gBAAgBA,CACvBG,SAAkB,EACwB;AAC1C,EAAA,OACEC,gBAAgB,CAACD,SAAS,CAAC,IAC3B,OAAOA,SAAS,KAAK,UAAU,IAC/BE,iBAAiB,CAACF,SAAS,CAAC,CAAA;AAEhC,CAAA;AAEA,SAASC,gBAAgBA,CAACD,SAAc,EAAE;AACxC,EAAA,OACE,OAAOA,SAAS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AAI;MACxBJ,QAAQ,CAACI,OAAO,CAAC,CAAA;MACjBb,OAAO,CAACG,aAAa,IAArBH,IAAAA,IAAAA,OAAO,CAACG,aAAa,CAAGU,OAAO,CAAC,CAAA;AAClC,KAAA;AACF,GAAC,CAAC,CAAC,CAAA;EAEH,OAAOR,QAAQ,CAACE,OAAO,CAAA;AACzB;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/react-table/build/lib/index.js b/node_modules/@tanstack/react-table/build/lib/index.js new file mode 100644 index 00000000..4a540543 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/lib/index.js @@ -0,0 +1,101 @@ +/** + * react-table + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var React = require('react'); +var tableCore = require('@tanstack/table-core'); + +function _interopNamespaceDefault(e) { + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n.default = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React); + +// + +/** + * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`. + */ +function flexRender(Comp, props) { + return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp; +} +function isReactComponent(component) { + return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component); +} +function isClassComponent(component) { + return typeof component === 'function' && (() => { + const proto = Object.getPrototypeOf(component); + return proto.prototype && proto.prototype.isReactComponent; + })(); +} +function isExoticComponent(component) { + return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description); +} +function useReactTable(options) { + // Compose in the generic options to the user options + const resolvedOptions = { + state: {}, + // Dummy state + onStateChange: () => {}, + // noop + renderFallbackValue: null, + ...options + }; + + // Create a new table and store it in state + const [tableRef] = React__namespace.useState(() => ({ + current: tableCore.createTable(resolvedOptions) + })); + + // By default, manage table state here using the table's initial state + const [state, setState] = React__namespace.useState(() => tableRef.current.initialState); + + // Compose the default state above with any user state. This will allow the user + // to only control a subset of the state if desired. + tableRef.current.setOptions(prev => ({ + ...prev, + ...options, + state: { + ...state, + ...options.state + }, + // Similarly, we'll maintain both our internal state and any user-provided + // state. + onStateChange: updater => { + setState(updater); + options.onStateChange == null || options.onStateChange(updater); + } + })); + return tableRef.current; +} + +exports.flexRender = flexRender; +exports.useReactTable = useReactTable; +Object.keys(tableCore).forEach(function (k) { + if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return tableCore[k]; } + }); +}); +//# sourceMappingURL=index.js.map diff --git a/node_modules/@tanstack/react-table/build/lib/index.js.map b/node_modules/@tanstack/react-table/build/lib/index.js.map new file mode 100644 index 00000000..5b0b3358 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable = React.ReactNode | React.ComponentType\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nexport function flexRender(\n Comp: Renderable,\n props: TProps\n): React.ReactNode | React.JSX.Element {\n return !Comp ? null : isReactComponent(Comp) ? (\n \n ) : (\n Comp\n )\n}\n\nfunction isReactComponent(\n component: unknown\n): component is React.ComponentType {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport function useReactTable(\n options: TableOptions\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n tableRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n return tableRef.current\n}\n"],"names":["flexRender","Comp","props","isReactComponent","React","createElement","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","useReactTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","tableRef","useState","current","createTable","setState","initialState","setOptions","prev","updater"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;AAEA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,IAAwB,EACxBC,KAAa,EACwB;AACrC,EAAA,OAAO,CAACD,IAAI,GAAG,IAAI,GAAGE,gBAAgB,CAASF,IAAI,CAAC,gBAClDG,gBAAA,CAAAC,aAAA,CAACJ,IAAI,EAAKC,KAAQ,CAAC,GAEnBD,IACD,CAAA;AACH,CAAA;AAEA,SAASE,gBAAgBA,CACvBG,SAAkB,EACwB;AAC1C,EAAA,OACEC,gBAAgB,CAACD,SAAS,CAAC,IAC3B,OAAOA,SAAS,KAAK,UAAU,IAC/BE,iBAAiB,CAAC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E;AACL,MAAA,GAAGA,KAAK;AACR,MAAA,GAAGF,OAAO,CAACE,KAAAA;KACZ;AACD;AACA;IACAC,aAAa,EAAEU,OAAO,IAAI;MACxBJ,QAAQ,CAACI,OAAO,CAAC,CAAA;MACjBb,OAAO,CAACG,aAAa,IAArBH,IAAAA,IAAAA,OAAO,CAACG,aAAa,CAAGU,OAAO,CAAC,CAAA;AAClC,KAAA;AACF,GAAC,CAAC,CAAC,CAAA;EAEH,OAAOR,QAAQ,CAACE,OAAO,CAAA;AACzB;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/react-table/build/lib/index.mjs b/node_modules/@tanstack/react-table/build/lib/index.mjs new file mode 100644 index 00000000..e46bad4a --- /dev/null +++ b/node_modules/@tanstack/react-table/build/lib/index.mjs @@ -0,0 +1,74 @@ +/** + * react-table + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +import * as React from 'react'; +import { createTable } from '@tanstack/table-core'; +export * from '@tanstack/table-core'; + +// + +/** + * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`. + */ +function flexRender(Comp, props) { + return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React.createElement(Comp, props) : Comp; +} +function isReactComponent(component) { + return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component); +} +function isClassComponent(component) { + return typeof component === 'function' && (() => { + const proto = Object.getPrototypeOf(component); + return proto.prototype && proto.prototype.isReactComponent; + })(); +} +function isExoticComponent(component) { + return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description); +} +function useReactTable(options) { + // Compose in the generic options to the user options + const resolvedOptions = { + state: {}, + // Dummy state + onStateChange: () => {}, + // noop + renderFallbackValue: null, + ...options + }; + + // Create a new table and store it in state + const [tableRef] = React.useState(() => ({ + current: createTable(resolvedOptions) + })); + + // By default, manage table state here using the table's initial state + const [state, setState] = React.useState(() => tableRef.current.initialState); + + // Compose the default state above with any user state. This will allow the user + // to only control a subset of the state if desired. + tableRef.current.setOptions(prev => ({ + ...prev, + ...options, + state: { + ...state, + ...options.state + }, + // Similarly, we'll maintain both our internal state and any user-provided + // state. + onStateChange: updater => { + setState(updater); + options.onStateChange == null || options.onStateChange(updater); + } + })); + return tableRef.current; +} + +export { flexRender, useReactTable }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/@tanstack/react-table/build/lib/index.mjs.map b/node_modules/@tanstack/react-table/build/lib/index.mjs.map new file mode 100644 index 00000000..fdb0be5b --- /dev/null +++ b/node_modules/@tanstack/react-table/build/lib/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable = React.ReactNode | React.ComponentType\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nexport function flexRender(\n Comp: Renderable,\n props: TProps\n): React.ReactNode | React.JSX.Element {\n return !Comp ? null : isReactComponent(Comp) ? (\n \n ) : (\n Comp\n )\n}\n\nfunction isReactComponent(\n component: unknown\n): component is React.ComponentType {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport function useReactTable(\n options: TableOptions\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n tableRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n return tableRef.current\n}\n"],"names":["flexRender","Comp","props","isReactComponent","React","createElement","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","useReactTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","tableRef","useState","current","createTable","setState","initialState","setOptions","prev","updater"],"mappings":";;;;;;;;;;;;;;AAYA;;AAEA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,IAAwB,EACxBC,KAAa,EACwB;AACrC,EAAA,OAAO,CAACD,IAAI,GAAG,IAAI,GAAGE,gBAAgB,CAASF,IAAI,CAAC,gBAClDG,KAAA,CAAAC,aAAA,CAACJ,IAAI,EAAKC,KAAQ,CAAC,GAEnBD,IACD,CAAA;AACH,CAAA;AAEA,SAASE,gBAAgBA,CACvBG,SAAkB,EACwB;AAC1C,EAAA,OACEC,gBAAgB,CAACD,SAAS,CAAC,IAC3B,OAAOA,SAAS,KAAK,UAAU,IAC/BE,iBAAiB,CAACF,SAAS,CAAC,CAAA;AAEhC,CAAA;AAEA,SAASC,gBAAgBA,CAACD,SAAc,EAAE;AACxC,EAAA,OACE,OAAOA,SAAS,KAAK,UAAU,IAC/B,CAAC,MAAM;AACL,IAAA,MAAMG,KAAK,GAAGC,MAAM,CAACC,cAAc,CAACL,SAAS,CAAC,CAAA;IAC9C,OAAOG,KAAK,CAACG,SAAS,IAAIH,KAAK,CAACG,SAAS,CAACT,gB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AA;EAEH,OAAOR,QAAQ,CAACE,OAAO,CAAA;AACzB;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/react-table/build/umd/index.development.js b/node_modules/@tanstack/react-table/build/umd/index.development.js new file mode 100644 index 00000000..f6941580 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/umd/index.development.js @@ -0,0 +1,3671 @@ +/** + * react-table + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : + typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactTable = {}, global.React)); +})(this, (function (exports, React) { 'use strict'; + + function _interopNamespaceDefault(e) { + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n.default = e; + return Object.freeze(n); + } + + var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React); + + /** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ + // type Person = { + // firstName: string + // lastName: string + // age: number + // visits: number + // status: string + // progress: number + // createdAt: Date + // nested: { + // foo: [ + // { + // bar: 'bar' + // } + // ] + // bar: { subBar: boolean }[] + // baz: { + // foo: 'foo' + // bar: { + // baz: 'baz' + // } + // } + // } + // } + + // const test: DeepKeys = 'nested.foo.0.bar' + // const test2: DeepKeys = 'nested.bar' + + // const helper = createColumnHelper() + + // helper.accessor('nested.foo', { + // cell: info => info.getValue(), + // }) + + // helper.accessor('nested.foo.0.bar', { + // cell: info => info.getValue(), + // }) + + // helper.accessor('nested.bar', { + // cell: info => info.getValue(), + // }) + + function createColumnHelper() { + return { + accessor: (accessor, column) => { + return typeof accessor === 'function' ? { + ...column, + accessorFn: accessor + } : { + ...column, + accessorKey: accessor + }; + }, + display: column => column, + group: column => column + }; + } + + // Is this type a tuple? + + // If this type is a tuple, what indices are allowed? + + /// + + function functionalUpdate(updater, input) { + return typeof updater === 'function' ? updater(input) : updater; + } + function noop() { + // + } + function makeStateUpdater(key, instance) { + return updater => { + instance.setState(old => { + return { + ...old, + [key]: functionalUpdate(updater, old[key]) + }; + }); + }; + } + function isFunction(d) { + return d instanceof Function; + } + function isNumberArray(d) { + return Array.isArray(d) && d.every(val => typeof val === 'number'); + } + function flattenBy(arr, getChildren) { + const flat = []; + const recurse = subArr => { + subArr.forEach(item => { + flat.push(item); + const children = getChildren(item); + if (children != null && children.length) { + recurse(children); + } + }); + }; + recurse(arr); + return flat; + } + function memo(getDeps, fn, opts) { + let deps = []; + let result; + return depArgs => { + let depTime; + if (opts.key && opts.debug) depTime = Date.now(); + const newDeps = getDeps(depArgs); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep); + if (!depsChanged) { + return result; + } + deps = newDeps; + let resultTime; + if (opts.key && opts.debug) resultTime = Date.now(); + result = fn(...newDeps); + opts == null || opts.onChange == null || opts.onChange(result); + if (opts.key && opts.debug) { + if (opts != null && opts.debug()) { + const depEndTime = Math.round((Date.now() - depTime) * 100) / 100; + const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100; + const resultFpsPercentage = resultEndTime / 16; + const pad = (str, num) => { + str = String(str); + while (str.length < num) { + str = ' ' + str; + } + return str; + }; + console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, ` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key); + } + } + return result; + }; + } + function getMemoOptions(tableOptions, debugLevel, key, onChange) { + return { + debug: () => { + var _tableOptions$debugAl; + return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel]; + }, + key: key, + onChange + }; + } + + function createCell(table, row, column, columnId) { + const getRenderValue = () => { + var _cell$getValue; + return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + }; + const cell = { + id: `${row.id}_${column.id}`, + row, + column, + getValue: () => row.getValue(columnId), + renderValue: getRenderValue, + getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({ + table, + column, + row, + cell: cell, + getValue: cell.getValue, + renderValue: cell.renderValue + }), getMemoOptions(table.options, 'debugCells', 'cell.getContext')) + }; + table._features.forEach(feature => { + feature.createCell == null || feature.createCell(cell, column, row, table); + }, {}); + return cell; + } + + function createColumn(table, columnDef, depth, parent) { + var _ref, _resolvedColumnDef$id; + const defaultColumn = table._getDefaultColumnDef(); + const resolvedColumnDef = { + ...defaultColumn, + ...columnDef + }; + const accessorKey = resolvedColumnDef.accessorKey; + let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined; + let accessorFn; + if (resolvedColumnDef.accessorFn) { + accessorFn = resolvedColumnDef.accessorFn; + } else if (accessorKey) { + // Support deep accessor keys + if (accessorKey.includes('.')) { + accessorFn = originalRow => { + let result = originalRow; + for (const key of accessorKey.split('.')) { + var _result; + result = (_result = result) == null ? void 0 : _result[key]; + if (result === undefined) { + console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`); + } + } + return result; + }; + } else { + accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey]; + } + } + if (!id) { + { + throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); + } + } + let column = { + id: `${String(id)}`, + accessorFn, + parent: parent, + depth, + columnDef: resolvedColumnDef, + columns: [], + getFlatColumns: memo(() => [true], () => { + var _column$columns; + return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')), + getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => { + var _column$columns2; + if ((_column$columns2 = column.columns) != null && _column$columns2.length) { + let leafColumns = column.columns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + } + return [column]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')) + }; + for (const feature of table._features) { + feature.createColumn == null || feature.createColumn(column, table); + } + + // Yes, we have to convert table to unknown, because we know more than the compiler here. + return column; + } + + const debug = 'debugHeaders'; + // + + function createHeader(table, column, options) { + var _options$id; + const id = (_options$id = options.id) != null ? _options$id : column.id; + let header = { + id, + column, + index: options.index, + isPlaceholder: !!options.isPlaceholder, + placeholderId: options.placeholderId, + depth: options.depth, + subHeaders: [], + colSpan: 0, + rowSpan: 0, + headerGroup: null, + getLeafHeaders: () => { + const leafHeaders = []; + const recurseHeader = h => { + if (h.subHeaders && h.subHeaders.length) { + h.subHeaders.map(recurseHeader); + } + leafHeaders.push(h); + }; + recurseHeader(header); + return leafHeaders; + }, + getContext: () => ({ + table, + header: header, + column + }) + }; + table._features.forEach(feature => { + feature.createHeader == null || feature.createHeader(header, table); + }); + return header; + } + const Headers = { + createTable: table => { + // Header Groups + + table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + var _left$map$filter, _right$map$filter; + const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; + const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; + const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); + return headerGroups; + }, getMemoOptions(table.options, debug, 'getHeaderGroups')); + table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + return buildHeaderGroups(allColumns, leafColumns, table, 'center'); + }, getMemoOptions(table.options, debug, 'getCenterHeaderGroups')); + table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => { + var _left$map$filter2; + const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left'); + }, getMemoOptions(table.options, debug, 'getLeftHeaderGroups')); + table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => { + var _right$map$filter2; + const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right'); + }, getMemoOptions(table.options, debug, 'getRightHeaderGroups')); + + // Footer Groups + + table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getFooterGroups')); + table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getLeftFooterGroups')); + table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getCenterFooterGroups')); + table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getRightFooterGroups')); + + // Flat Headers + + table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => { + return headerGroups.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getFlatHeaders')); + table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeftFlatHeaders')); + table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getCenterFlatHeaders')); + table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getRightFlatHeaders')); + + // Leaf Headers + + table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders; + return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); + }); + }, getMemoOptions(table.options, debug, 'getCenterLeafHeaders')); + table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders2; + return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); + }); + }, getMemoOptions(table.options, debug, 'getLeftLeafHeaders')); + table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders3; + return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); + }); + }, getMemoOptions(table.options, debug, 'getRightLeafHeaders')); + table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => { + var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$; + return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => { + return header.getLeafHeaders(); + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeafHeaders')); + } + }; + function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { + var _headerGroups$0$heade, _headerGroups$; + // Find the max depth of the columns: + // build the leaf column row + // build each buffer row going up + // placeholder for non-existent level + // real column for existing level + + let maxDepth = 0; + const findMaxDepth = function (columns, depth) { + if (depth === void 0) { + depth = 1; + } + maxDepth = Math.max(maxDepth, depth); + columns.filter(column => column.getIsVisible()).forEach(column => { + var _column$columns; + if ((_column$columns = column.columns) != null && _column$columns.length) { + findMaxDepth(column.columns, depth + 1); + } + }, 0); + }; + findMaxDepth(allColumns); + let headerGroups = []; + const createHeaderGroup = (headersToGroup, depth) => { + // The header group we are creating + const headerGroup = { + depth, + id: [headerFamily, `${depth}`].filter(Boolean).join('_'), + headers: [] + }; + + // The parent columns we're going to scan next + const pendingParentHeaders = []; + + // Scan each column for parents + headersToGroup.forEach(headerToGroup => { + // What is the latest (last) parent column? + + const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]; + const isLeafHeader = headerToGroup.column.depth === headerGroup.depth; + let column; + let isPlaceholder = false; + if (isLeafHeader && headerToGroup.column.parent) { + // The parent header is new + column = headerToGroup.column.parent; + } else { + // The parent header is repeated + column = headerToGroup.column; + isPlaceholder = true; + } + if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) { + // This column is repeated. Add it as a sub header to the next batch + latestPendingParentHeader.subHeaders.push(headerToGroup); + } else { + // This is a new header. Let's create it + const header = createHeader(table, column, { + id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'), + isPlaceholder, + placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined, + depth, + index: pendingParentHeaders.length + }); + + // Add the headerToGroup as a subHeader of the new header + header.subHeaders.push(headerToGroup); + // Add the new header to the pendingParentHeaders to get grouped + // in the next batch + pendingParentHeaders.push(header); + } + headerGroup.headers.push(headerToGroup); + headerToGroup.headerGroup = headerGroup; + }); + headerGroups.push(headerGroup); + if (depth > 0) { + createHeaderGroup(pendingParentHeaders, depth - 1); + } + }; + const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, { + depth: maxDepth, + index + })); + createHeaderGroup(bottomHeaders, maxDepth - 1); + headerGroups.reverse(); + + // headerGroups = headerGroups.filter(headerGroup => { + // return !headerGroup.headers.every(header => header.isPlaceholder) + // }) + + const recurseHeadersForSpans = headers => { + const filteredHeaders = headers.filter(header => header.column.getIsVisible()); + return filteredHeaders.map(header => { + let colSpan = 0; + let rowSpan = 0; + let childRowSpans = [0]; + if (header.subHeaders && header.subHeaders.length) { + childRowSpans = []; + recurseHeadersForSpans(header.subHeaders).forEach(_ref => { + let { + colSpan: childColSpan, + rowSpan: childRowSpan + } = _ref; + colSpan += childColSpan; + childRowSpans.push(childRowSpan); + }); + } else { + colSpan = 1; + } + const minChildRowSpan = Math.min(...childRowSpans); + rowSpan = rowSpan + minChildRowSpan; + header.colSpan = colSpan; + header.rowSpan = rowSpan; + return { + colSpan, + rowSpan + }; + }); + }; + recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); + return headerGroups; + } + + const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => { + let row = { + id, + index: rowIndex, + original, + depth, + parentId, + _valuesCache: {}, + _uniqueValuesCache: {}, + getValue: columnId => { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex); + return row._valuesCache[columnId]; + }, + getUniqueValues: columnId => { + if (row._uniqueValuesCache.hasOwnProperty(columnId)) { + return row._uniqueValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + if (!column.columnDef.getUniqueValues) { + row._uniqueValuesCache[columnId] = [row.getValue(columnId)]; + return row._uniqueValuesCache[columnId]; + } + row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex); + return row._uniqueValuesCache[columnId]; + }, + renderValue: columnId => { + var _row$getValue; + return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; + }, + subRows: subRows != null ? subRows : [], + getLeafRows: () => flattenBy(row.subRows, d => d.subRows), + getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined, + getParentRows: () => { + let parentRows = []; + let currentRow = row; + while (true) { + const parentRow = currentRow.getParentRow(); + if (!parentRow) break; + parentRows.push(parentRow); + currentRow = parentRow; + } + return parentRows.reverse(); + }, + getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => { + return leafColumns.map(column => { + return createCell(table, row, column, column.id); + }); + }, getMemoOptions(table.options, 'debugRows', 'getAllCells')), + _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => { + return allCells.reduce((acc, cell) => { + acc[cell.column.id] = cell; + return acc; + }, {}); + }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')) + }; + for (let i = 0; i < table._features.length; i++) { + const feature = table._features[i]; + feature == null || feature.createRow == null || feature.createRow(row, table); + } + return row; + }; + + // + + const ColumnFaceting = { + createColumn: (column, table) => { + column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id); + column.getFacetedRowModel = () => { + if (!column._getFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return column._getFacetedRowModel(); + }; + column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id); + column.getFacetedUniqueValues = () => { + if (!column._getFacetedUniqueValues) { + return new Map(); + } + return column._getFacetedUniqueValues(); + }; + column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id); + column.getFacetedMinMaxValues = () => { + if (!column._getFacetedMinMaxValues) { + return undefined; + } + return column._getFacetedMinMaxValues(); + }; + } + }; + + const includesString = (row, columnId, filterValue) => { + var _filterValue$toString, _row$getValue; + const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase(); + return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search)); + }; + includesString.autoRemove = val => testFalsey(val); + const includesStringSensitive = (row, columnId, filterValue) => { + var _row$getValue2; + return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue)); + }; + includesStringSensitive.autoRemove = val => testFalsey(val); + const equalsString = (row, columnId, filterValue) => { + var _row$getValue3; + return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase()); + }; + equalsString.autoRemove = val => testFalsey(val); + const arrIncludes = (row, columnId, filterValue) => { + var _row$getValue4; + return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue); + }; + arrIncludes.autoRemove = val => testFalsey(val); + const arrIncludesAll = (row, columnId, filterValue) => { + return !filterValue.some(val => { + var _row$getValue5; + return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val)); + }); + }; + arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length); + const arrIncludesSome = (row, columnId, filterValue) => { + return filterValue.some(val => { + var _row$getValue6; + return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val); + }); + }; + arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length); + const equals = (row, columnId, filterValue) => { + return row.getValue(columnId) === filterValue; + }; + equals.autoRemove = val => testFalsey(val); + const weakEquals = (row, columnId, filterValue) => { + return row.getValue(columnId) == filterValue; + }; + weakEquals.autoRemove = val => testFalsey(val); + const inNumberRange = (row, columnId, filterValue) => { + let [min, max] = filterValue; + const rowValue = row.getValue(columnId); + return rowValue >= min && rowValue <= max; + }; + inNumberRange.resolveFilterValue = val => { + let [unsafeMin, unsafeMax] = val; + let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin; + let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax; + let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin; + let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax; + if (min > max) { + const temp = min; + min = max; + max = temp; + } + return [min, max]; + }; + inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); + + // Export + + const filterFns = { + includesString, + includesStringSensitive, + equalsString, + arrIncludes, + arrIncludesAll, + arrIncludesSome, + equals, + weakEquals, + inNumberRange + }; + // Utils + + function testFalsey(val) { + return val === undefined || val === null || val === ''; + } + + // + + const ColumnFiltering = { + getDefaultColumnDef: () => { + return { + filterFn: 'auto' + }; + }, + getInitialState: state => { + return { + columnFilters: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnFiltersChange: makeStateUpdater('columnFilters', table), + filterFromLeafRows: false, + maxLeafRowFilterDepth: 100 + }; + }, + createColumn: (column, table) => { + column.getAutoFilterFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return filterFns.includesString; + } + if (typeof value === 'number') { + return filterFns.inNumberRange; + } + if (typeof value === 'boolean') { + return filterFns.equals; + } + if (value !== null && typeof value === 'object') { + return filterFns.equals; + } + if (Array.isArray(value)) { + return filterFns.arrIncludes; + } + return filterFns.weakEquals; + }; + column.getFilterFn = () => { + var _table$options$filter, _table$options$filter2; + return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore + (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn]; + }; + column.getCanFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2; + return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn; + }; + column.getIsFiltered = () => column.getFilterIndex() > -1; + column.getFilterValue = () => { + var _table$getState$colum; + return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value; + }; + column.getFilterIndex = () => { + var _table$getState$colum2, _table$getState$colum3; + return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1; + }; + column.setFilterValue = value => { + table.setColumnFilters(old => { + const filterFn = column.getFilterFn(); + const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id); + const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined); + + // + if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { + var _old$filter; + return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : []; + } + const newFilterObj = { + id: column.id, + value: newFilter + }; + if (previousFilter) { + var _old$map; + return (_old$map = old == null ? void 0 : old.map(d => { + if (d.id === column.id) { + return newFilterObj; + } + return d; + })) != null ? _old$map : []; + } + if (old != null && old.length) { + return [...old, newFilterObj]; + } + return [newFilterObj]; + }); + }; + }, + createRow: (row, _table) => { + row.columnFilters = {}; + row.columnFiltersMeta = {}; + }, + createTable: table => { + table.setColumnFilters = updater => { + const leafColumns = table.getAllLeafColumns(); + const updateFn = old => { + var _functionalUpdate; + return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => { + const column = leafColumns.find(d => d.id === filter.id); + if (column) { + const filterFn = column.getFilterFn(); + if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { + return false; + } + } + return true; + }); + }; + table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn); + }; + table.resetColumnFilters = defaultState => { + var _table$initialState$c, _table$initialState; + table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); + }; + table.getPreFilteredRowModel = () => table.getCoreRowModel(); + table.getFilteredRowModel = () => { + if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { + table._getFilteredRowModel = table.options.getFilteredRowModel(table); + } + if (table.options.manualFiltering || !table._getFilteredRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getFilteredRowModel(); + }; + } + }; + function shouldAutoRemoveFilter(filterFn, value, column) { + return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value; + } + + const sum = (columnId, _leafRows, childRows) => { + // It's faster to just add the aggregations together instead of + // process leaf nodes individually + return childRows.reduce((sum, next) => { + const nextValue = next.getValue(columnId); + return sum + (typeof nextValue === 'number' ? nextValue : 0); + }, 0); + }; + const min = (columnId, _leafRows, childRows) => { + let min; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (min > value || min === undefined && value >= value)) { + min = value; + } + }); + return min; + }; + const max = (columnId, _leafRows, childRows) => { + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (max < value || max === undefined && value >= value)) { + max = value; + } + }); + return max; + }; + const extent = (columnId, _leafRows, childRows) => { + let min; + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null) { + if (min === undefined) { + if (value >= value) min = max = value; + } else { + if (min > value) min = value; + if (max < value) max = value; + } + } + }); + return [min, max]; + }; + const mean = (columnId, leafRows) => { + let count = 0; + let sum = 0; + leafRows.forEach(row => { + let value = row.getValue(columnId); + if (value != null && (value = +value) >= value) { + ++count, sum += value; + } + }); + if (count) return sum / count; + return; + }; + const median = (columnId, leafRows) => { + if (!leafRows.length) { + return; + } + const values = leafRows.map(row => row.getValue(columnId)); + if (!isNumberArray(values)) { + return; + } + if (values.length === 1) { + return values[0]; + } + const mid = Math.floor(values.length / 2); + const nums = values.sort((a, b) => a - b); + return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2; + }; + const unique = (columnId, leafRows) => { + return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values()); + }; + const uniqueCount = (columnId, leafRows) => { + return new Set(leafRows.map(d => d.getValue(columnId))).size; + }; + const count = (_columnId, leafRows) => { + return leafRows.length; + }; + const aggregationFns = { + sum, + min, + max, + extent, + mean, + median, + unique, + uniqueCount, + count + }; + + // + + const ColumnGrouping = { + getDefaultColumnDef: () => { + return { + aggregatedCell: props => { + var _toString, _props$getValue; + return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null; + }, + aggregationFn: 'auto' + }; + }, + getInitialState: state => { + return { + grouping: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onGroupingChange: makeStateUpdater('grouping', table), + groupedColumnMode: 'reorder' + }; + }, + createColumn: (column, table) => { + column.toggleGrouping = () => { + table.setGrouping(old => { + // Find any existing grouping for this column + if (old != null && old.includes(column.id)) { + return old.filter(d => d !== column.id); + } + return [...(old != null ? old : []), column.id]; + }); + }; + column.getCanGroup = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue); + }; + column.getIsGrouped = () => { + var _table$getState$group; + return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id); + }; + column.getGroupedIndex = () => { + var _table$getState$group2; + return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id); + }; + column.getToggleGroupingHandler = () => { + const canGroup = column.getCanGroup(); + return () => { + if (!canGroup) return; + column.toggleGrouping(); + }; + }; + column.getAutoAggregationFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'number') { + return aggregationFns.sum; + } + if (Object.prototype.toString.call(value) === '[object Date]') { + return aggregationFns.extent; + } + }; + column.getAggregationFn = () => { + var _table$options$aggreg, _table$options$aggreg2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn]; + }; + }, + createTable: table => { + table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater); + table.resetGrouping = defaultState => { + var _table$initialState$g, _table$initialState; + table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); + }; + table.getPreGroupedRowModel = () => table.getFilteredRowModel(); + table.getGroupedRowModel = () => { + if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { + table._getGroupedRowModel = table.options.getGroupedRowModel(table); + } + if (table.options.manualGrouping || !table._getGroupedRowModel) { + return table.getPreGroupedRowModel(); + } + return table._getGroupedRowModel(); + }; + }, + createRow: (row, table) => { + row.getIsGrouped = () => !!row.groupingColumnId; + row.getGroupingValue = columnId => { + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.columnDef.getGroupingValue)) { + return row.getValue(columnId); + } + row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original); + return row._groupingValuesCache[columnId]; + }; + row._groupingValuesCache = {}; + }, + createCell: (cell, column, row, table) => { + cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId; + cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped(); + cell.getIsAggregated = () => { + var _row$subRows; + return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + } + }; + function orderColumns(leafColumns, grouping, groupedColumnMode) { + if (!(grouping != null && grouping.length) || !groupedColumnMode) { + return leafColumns; + } + const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id)); + if (groupedColumnMode === 'remove') { + return nonGroupingColumns; + } + const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean); + return [...groupingColumns, ...nonGroupingColumns]; + } + + // + + const ColumnOrdering = { + getInitialState: state => { + return { + columnOrder: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnOrderChange: makeStateUpdater('columnOrder', table) + }; + }, + createColumn: (column, table) => { + column.getIndex = memo(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex')); + column.getIsFirstColumn = position => { + var _columns$; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id; + }; + column.getIsLastColumn = position => { + var _columns; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id; + }; + }, + createTable: table => { + table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater); + table.resetColumnOrder = defaultState => { + var _table$initialState$c; + table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); + }; + table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => { + // Sort grouped columns to the start of the column list + // before the headers are built + let orderedColumns = []; + + // If there is no order, return the normal columns + if (!(columnOrder != null && columnOrder.length)) { + orderedColumns = columns; + } else { + const columnOrderCopy = [...columnOrder]; + + // If there is an order, make a copy of the columns + const columnsCopy = [...columns]; + + // And make a new ordered array of the columns + + // Loop over the columns and place them in order into the new array + while (columnsCopy.length && columnOrderCopy.length) { + const targetColumnId = columnOrderCopy.shift(); + const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId); + if (foundIndex > -1) { + orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); + } + } + + // If there are any columns left, add them to the end + orderedColumns = [...orderedColumns, ...columnsCopy]; + } + return orderColumns(orderedColumns, grouping, groupedColumnMode); + }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')); + } + }; + + // + + const getDefaultColumnPinningState = () => ({ + left: [], + right: [] + }); + const ColumnPinning = { + getInitialState: state => { + return { + columnPinning: getDefaultColumnPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnPinningChange: makeStateUpdater('columnPinning', table) + }; + }, + createColumn: (column, table) => { + column.pin = position => { + const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean); + table.setColumnPinning(old => { + var _old$left3, _old$right3; + if (position === 'right') { + var _old$left, _old$right; + return { + left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds] + }; + } + if (position === 'left') { + var _old$left2, _old$right2; + return { + left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds], + right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + } + return { + left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + }); + }; + column.getCanPin = () => { + const leafColumns = column.getLeafColumns(); + return leafColumns.some(d => { + var _d$columnDef$enablePi, _ref, _table$options$enable; + return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true); + }); + }; + column.getIsPinned = () => { + const leafColumnIds = column.getLeafColumns().map(d => d.id); + const { + left, + right + } = table.getState().columnPinning; + const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d)); + const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d)); + return isLeft ? 'left' : isRight ? 'right' : false; + }; + column.getPinnedIndex = () => { + var _table$getState$colum, _table$getState$colum2; + const position = column.getIsPinned(); + return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0; + }; + }, + createRow: (row, table) => { + row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allCells.filter(d => !leftAndRight.includes(d.column.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')); + row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => { + const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'left' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')); + row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { + const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'right' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')); + }, + createTable: table => { + table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater); + table.resetColumnPinning = defaultState => { + var _table$initialState$c, _table$initialState; + return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState()); + }; + table.getIsSomeColumnsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().columnPinning; + if (!position) { + var _pinningState$left, _pinningState$right; + return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { + return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')); + table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { + return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')); + table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allColumns.filter(d => !leftAndRight.includes(d.id)); + }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')); + } + }; + + function safelyAccessDocument(_document) { + return _document || (typeof document !== 'undefined' ? document : null); + } + + // + + // + + const defaultColumnSizing = { + size: 150, + minSize: 20, + maxSize: Number.MAX_SAFE_INTEGER + }; + const getDefaultColumnSizingInfoState = () => ({ + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + isResizingColumn: false, + columnSizingStart: [] + }); + const ColumnSizing = { + getDefaultColumnDef: () => { + return defaultColumnSizing; + }, + getInitialState: state => { + return { + columnSizing: {}, + columnSizingInfo: getDefaultColumnSizingInfoState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + columnResizeMode: 'onEnd', + columnResizeDirection: 'ltr', + onColumnSizingChange: makeStateUpdater('columnSizing', table), + onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table) + }; + }, + createColumn: (column, table) => { + column.getSize = () => { + var _column$columnDef$min, _ref, _column$columnDef$max; + const columnSize = table.getState().columnSizing[column.id]; + return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); + }; + column.getStart = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart')); + column.getAfter = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter')); + column.resetSize = () => { + table.setColumnSizing(_ref2 => { + let { + [column.id]: _, + ...rest + } = _ref2; + return rest; + }); + }; + column.getCanResize = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); + }; + column.getIsResizing = () => { + return table.getState().columnSizingInfo.isResizingColumn === column.id; + }; + }, + createHeader: (header, table) => { + header.getSize = () => { + let sum = 0; + const recurse = header => { + if (header.subHeaders.length) { + header.subHeaders.forEach(recurse); + } else { + var _header$column$getSiz; + sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0; + } + }; + recurse(header); + return sum; + }; + header.getStart = () => { + if (header.index > 0) { + const prevSiblingHeader = header.headerGroup.headers[header.index - 1]; + return prevSiblingHeader.getStart() + prevSiblingHeader.getSize(); + } + return 0; + }; + header.getResizeHandler = _contextDocument => { + const column = table.getColumn(header.column.id); + const canResize = column == null ? void 0 : column.getCanResize(); + return e => { + if (!column || !canResize) { + return; + } + e.persist == null || e.persist(); + if (isTouchStartEvent(e)) { + // lets not respond to multiple touches (e.g. 2 or 3 fingers) + if (e.touches && e.touches.length > 1) { + return; + } + } + const startSize = header.getSize(); + const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]]; + const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX; + const newColumnSizing = {}; + const updateOffset = (eventType, clientXPos) => { + if (typeof clientXPos !== 'number') { + return; + } + table.setColumnSizingInfo(old => { + var _old$startOffset, _old$startSize; + const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1; + const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection; + const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); + old.columnSizingStart.forEach(_ref3 => { + let [columnId, headerSize] = _ref3; + newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100; + }); + return { + ...old, + deltaOffset, + deltaPercentage + }; + }); + if (table.options.columnResizeMode === 'onChange' || eventType === 'end') { + table.setColumnSizing(old => ({ + ...old, + ...newColumnSizing + })); + } + }; + const onMove = clientXPos => updateOffset('move', clientXPos); + const onEnd = clientXPos => { + updateOffset('end', clientXPos); + table.setColumnSizingInfo(old => ({ + ...old, + isResizingColumn: false, + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + columnSizingStart: [] + })); + }; + const contextDocument = safelyAccessDocument(_contextDocument); + const mouseEvents = { + moveHandler: e => onMove(e.clientX), + upHandler: e => { + contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler); + onEnd(e.clientX); + } + }; + const touchEvents = { + moveHandler: e => { + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onMove(e.touches[0].clientX); + return false; + }, + upHandler: e => { + var _e$touches$; + contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler); + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX); + } + }; + const passiveIfSupported = passiveEventSupported() ? { + passive: false + } : false; + if (isTouchStartEvent(e)) { + contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported); + } else { + contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported); + } + table.setColumnSizingInfo(old => ({ + ...old, + startOffset: clientX, + startSize, + deltaOffset: 0, + deltaPercentage: 0, + columnSizingStart, + isResizingColumn: column.id + })); + }; + }; + }, + createTable: table => { + table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater); + table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater); + table.resetColumnSizing = defaultState => { + var _table$initialState$c; + table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); + }; + table.resetHeaderSizeInfo = defaultState => { + var _table$initialState$c2; + table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); + }; + table.getTotalSize = () => { + var _table$getHeaderGroup, _table$getHeaderGroup2; + return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getHeaderGroup : 0; + }; + table.getLeftTotalSize = () => { + var _table$getLeftHeaderG, _table$getLeftHeaderG2; + return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getLeftHeaderG : 0; + }; + table.getCenterTotalSize = () => { + var _table$getCenterHeade, _table$getCenterHeade2; + return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getCenterHeade : 0; + }; + table.getRightTotalSize = () => { + var _table$getRightHeader, _table$getRightHeader2; + return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getRightHeader : 0; + }; + } + }; + let passiveSupported = null; + function passiveEventSupported() { + if (typeof passiveSupported === 'boolean') return passiveSupported; + let supported = false; + try { + const options = { + get passive() { + supported = true; + return false; + } + }; + const noop = () => {}; + window.addEventListener('test', noop, options); + window.removeEventListener('test', noop); + } catch (err) { + supported = false; + } + passiveSupported = supported; + return passiveSupported; + } + function isTouchStartEvent(e) { + return e.type === 'touchstart'; + } + + // + + const ColumnVisibility = { + getInitialState: state => { + return { + columnVisibility: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnVisibilityChange: makeStateUpdater('columnVisibility', table) + }; + }, + createColumn: (column, table) => { + column.toggleVisibility = value => { + if (column.getCanHide()) { + table.setColumnVisibility(old => ({ + ...old, + [column.id]: value != null ? value : !column.getIsVisible() + })); + } + }; + column.getIsVisible = () => { + var _ref, _table$getState$colum; + const childColumns = column.columns; + return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true; + }; + column.getCanHide = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); + }; + column.getToggleVisibilityHandler = () => { + return e => { + column.toggleVisibility == null || column.toggleVisibility(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => { + return cells.filter(cell => cell.column.getIsVisible()); + }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')); + row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells')); + }, + createTable: table => { + const makeVisibleColumnsMethod = (key, getColumns) => { + return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => { + return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible()); + }, getMemoOptions(table.options, 'debugColumns', key)); + }; + table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()); + table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()); + table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()); + table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()); + table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()); + table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater); + table.resetColumnVisibility = defaultState => { + var _table$initialState$c; + table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); + }; + table.toggleAllColumnsVisible = value => { + var _value; + value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); + table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ + ...obj, + [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value + }), {})); + }; + table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())); + table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()); + table.getToggleAllColumnsVisibilityHandler = () => { + return e => { + var _target; + table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } + }; + function _getVisibleLeafColumns(table, position) { + return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); + } + + // + + const GlobalFaceting = { + createTable: table => { + table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'); + table.getGlobalFacetedRowModel = () => { + if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getGlobalFacetedRowModel(); + }; + table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'); + table.getGlobalFacetedUniqueValues = () => { + if (!table._getGlobalFacetedUniqueValues) { + return new Map(); + } + return table._getGlobalFacetedUniqueValues(); + }; + table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'); + table.getGlobalFacetedMinMaxValues = () => { + if (!table._getGlobalFacetedMinMaxValues) { + return; + } + return table._getGlobalFacetedMinMaxValues(); + }; + } + }; + + // + + const GlobalFiltering = { + getInitialState: state => { + return { + globalFilter: undefined, + ...state + }; + }, + getDefaultOptions: table => { + return { + onGlobalFilterChange: makeStateUpdater('globalFilter', table), + globalFilterFn: 'auto', + getColumnCanGlobalFilter: column => { + var _table$getCoreRowMode; + const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue(); + return typeof value === 'string' || typeof value === 'number'; + } + }; + }, + createColumn: (column, table) => { + column.getCanGlobalFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol; + return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn; + }; + }, + createTable: table => { + table.getGlobalAutoFilterFn = () => { + return filterFns.includesString; + }; + table.getGlobalFilterFn = () => { + var _table$options$filter, _table$options$filter2; + const { + globalFilterFn: globalFilterFn + } = table.options; + return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn]; + }; + table.setGlobalFilter = updater => { + table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater); + }; + table.resetGlobalFilter = defaultState => { + table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter); + }; + } + }; + + // + + const RowExpanding = { + getInitialState: state => { + return { + expanded: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onExpandedChange: makeStateUpdater('expanded', table), + paginateExpandedRows: true + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetExpanded = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetExpanded(); + queued = false; + }); + } + }; + table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater); + table.toggleAllRowsExpanded = expanded => { + if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { + table.setExpanded(true); + } else { + table.setExpanded({}); + } + }; + table.resetExpanded = defaultState => { + var _table$initialState$e, _table$initialState; + table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); + }; + table.getCanSomeRowsExpand = () => { + return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand()); + }; + table.getToggleAllRowsExpandedHandler = () => { + return e => { + e.persist == null || e.persist(); + table.toggleAllRowsExpanded(); + }; + }; + table.getIsSomeRowsExpanded = () => { + const expanded = table.getState().expanded; + return expanded === true || Object.values(expanded).some(Boolean); + }; + table.getIsAllRowsExpanded = () => { + const expanded = table.getState().expanded; + + // If expanded is true, save some cycles and return true + if (typeof expanded === 'boolean') { + return expanded === true; + } + if (!Object.keys(expanded).length) { + return false; + } + + // If any row is not expanded, return false + if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) { + return false; + } + + // They must all be expanded :shrug: + return true; + }; + table.getExpandedDepth = () => { + let maxDepth = 0; + const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); + rowIds.forEach(id => { + const splitId = id.split('.'); + maxDepth = Math.max(maxDepth, splitId.length); + }); + return maxDepth; + }; + table.getPreExpandedRowModel = () => table.getSortedRowModel(); + table.getExpandedRowModel = () => { + if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { + table._getExpandedRowModel = table.options.getExpandedRowModel(table); + } + if (table.options.manualExpanding || !table._getExpandedRowModel) { + return table.getPreExpandedRowModel(); + } + return table._getExpandedRowModel(); + }; + }, + createRow: (row, table) => { + row.toggleExpanded = expanded => { + table.setExpanded(old => { + var _expanded; + const exists = old === true ? true : !!(old != null && old[row.id]); + let oldExpanded = {}; + if (old === true) { + Object.keys(table.getRowModel().rowsById).forEach(rowId => { + oldExpanded[rowId] = true; + }); + } else { + oldExpanded = old; + } + expanded = (_expanded = expanded) != null ? _expanded : !exists; + if (!exists && expanded) { + return { + ...oldExpanded, + [row.id]: true + }; + } + if (exists && !expanded) { + const { + [row.id]: _, + ...rest + } = oldExpanded; + return rest; + } + return old; + }); + }; + row.getIsExpanded = () => { + var _table$options$getIsR; + const expanded = table.getState().expanded; + return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id])); + }; + row.getCanExpand = () => { + var _table$options$getRow, _table$options$enable, _row$subRows; + return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + row.getIsAllParentsExpanded = () => { + let isFullyExpanded = true; + let currentRow = row; + while (isFullyExpanded && currentRow.parentId) { + currentRow = table.getRow(currentRow.parentId, true); + isFullyExpanded = currentRow.getIsExpanded(); + } + return isFullyExpanded; + }; + row.getToggleExpandedHandler = () => { + const canExpand = row.getCanExpand(); + return () => { + if (!canExpand) return; + row.toggleExpanded(); + }; + }; + } + }; + + // + + const defaultPageIndex = 0; + const defaultPageSize = 10; + const getDefaultPaginationState = () => ({ + pageIndex: defaultPageIndex, + pageSize: defaultPageSize + }); + const RowPagination = { + getInitialState: state => { + return { + ...state, + pagination: { + ...getDefaultPaginationState(), + ...(state == null ? void 0 : state.pagination) + } + }; + }, + getDefaultOptions: table => { + return { + onPaginationChange: makeStateUpdater('pagination', table) + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetPageIndex = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetPageIndex(); + queued = false; + }); + } + }; + table.setPagination = updater => { + const safeUpdater = old => { + let newState = functionalUpdate(updater, old); + return newState; + }; + return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); + }; + table.resetPagination = defaultState => { + var _table$initialState$p; + table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); + }; + table.setPageIndex = updater => { + table.setPagination(old => { + let pageIndex = functionalUpdate(updater, old.pageIndex); + const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1; + pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex)); + return { + ...old, + pageIndex + }; + }); + }; + table.resetPageIndex = defaultState => { + var _table$initialState$p2, _table$initialState; + table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); + }; + table.resetPageSize = defaultState => { + var _table$initialState$p3, _table$initialState2; + table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize); + }; + table.setPageSize = updater => { + table.setPagination(old => { + const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize)); + const topRowIndex = old.pageSize * old.pageIndex; + const pageIndex = Math.floor(topRowIndex / pageSize); + return { + ...old, + pageIndex, + pageSize + }; + }); + }; + //deprecated + table.setPageCount = updater => table.setPagination(old => { + var _table$options$pageCo; + let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); + if (typeof newPageCount === 'number') { + newPageCount = Math.max(-1, newPageCount); + } + return { + ...old, + pageCount: newPageCount + }; + }); + table.getPageOptions = memo(() => [table.getPageCount()], pageCount => { + let pageOptions = []; + if (pageCount && pageCount > 0) { + pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i); + } + return pageOptions; + }, getMemoOptions(table.options, 'debugTable', 'getPageOptions')); + table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0; + table.getCanNextPage = () => { + const { + pageIndex + } = table.getState().pagination; + const pageCount = table.getPageCount(); + if (pageCount === -1) { + return true; + } + if (pageCount === 0) { + return false; + } + return pageIndex < pageCount - 1; + }; + table.previousPage = () => { + return table.setPageIndex(old => old - 1); + }; + table.nextPage = () => { + return table.setPageIndex(old => { + return old + 1; + }); + }; + table.firstPage = () => { + return table.setPageIndex(0); + }; + table.lastPage = () => { + return table.setPageIndex(table.getPageCount() - 1); + }; + table.getPrePaginationRowModel = () => table.getExpandedRowModel(); + table.getPaginationRowModel = () => { + if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { + table._getPaginationRowModel = table.options.getPaginationRowModel(table); + } + if (table.options.manualPagination || !table._getPaginationRowModel) { + return table.getPrePaginationRowModel(); + } + return table._getPaginationRowModel(); + }; + table.getPageCount = () => { + var _table$options$pageCo2; + return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize); + }; + table.getRowCount = () => { + var _table$options$rowCou; + return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length; + }; + } + }; + + // + + const getDefaultRowPinningState = () => ({ + top: [], + bottom: [] + }); + const RowPinning = { + getInitialState: state => { + return { + rowPinning: getDefaultRowPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowPinningChange: makeStateUpdater('rowPinning', table) + }; + }, + createRow: (row, table) => { + row.pin = (position, includeLeafRows, includeParentRows) => { + const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => { + let { + id + } = _ref; + return id; + }) : []; + const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => { + let { + id + } = _ref2; + return id; + }) : []; + const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]); + table.setRowPinning(old => { + var _old$top3, _old$bottom3; + if (position === 'bottom') { + var _old$top, _old$bottom; + return { + top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)] + }; + } + if (position === 'top') { + var _old$top2, _old$bottom2; + return { + top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)], + bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + } + return { + top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + }); + }; + row.getCanPin = () => { + var _ref3; + const { + enableRowPinning, + enablePinning + } = table.options; + if (typeof enableRowPinning === 'function') { + return enableRowPinning(row); + } + return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true; + }; + row.getIsPinned = () => { + const rowIds = [row.id]; + const { + top, + bottom + } = table.getState().rowPinning; + const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d)); + const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d)); + return isTop ? 'top' : isBottom ? 'bottom' : false; + }; + row.getPinnedIndex = () => { + var _ref4, _visiblePinnedRowIds$; + const position = row.getIsPinned(); + if (!position) return -1; + const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => { + let { + id + } = _ref5; + return id; + }); + return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1; + }; + }, + createTable: table => { + table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater); + table.resetRowPinning = defaultState => { + var _table$initialState$r, _table$initialState; + return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState()); + }; + table.getIsSomeRowsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().rowPinning; + if (!position) { + var _pinningState$top, _pinningState$bottom; + return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table._getPinnedRows = (visibleRows, pinnedRowIds, position) => { + var _table$options$keepPi; + const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? + //get all rows that are pinned even if they would not be otherwise visible + //account for expanded parent rows, but not pagination or filtering + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => { + const row = table.getRow(rowId, true); + return row.getIsAllParentsExpanded() ? row : null; + }) : + //else get only visible rows that are pinned + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId)); + return rows.filter(Boolean).map(d => ({ + ...d, + position + })); + }; + table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows')); + table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows')); + table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => { + const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]); + return allRows.filter(d => !topAndBottom.has(d.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterRows')); + } + }; + + // + + const RowSelection = { + getInitialState: state => { + return { + rowSelection: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowSelectionChange: makeStateUpdater('rowSelection', table), + enableRowSelection: true, + enableMultiRowSelection: true, + enableSubRowSelection: true + // enableGroupingRowSelection: false, + // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey, + // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey, + }; + }, + createTable: table => { + table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater); + table.resetRowSelection = defaultState => { + var _table$initialState$r; + return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); + }; + table.toggleAllRowsSelected = value => { + table.setRowSelection(old => { + value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected(); + const rowSelection = { + ...old + }; + const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; + + // We don't use `mutateRowIsSelected` here for performance reasons. + // All of the rows are flat already, so it wouldn't be worth it + if (value) { + preGroupedFlatRows.forEach(row => { + if (!row.getCanSelect()) { + return; + } + rowSelection[row.id] = true; + }); + } else { + preGroupedFlatRows.forEach(row => { + delete rowSelection[row.id]; + }); + } + return rowSelection; + }); + }; + table.toggleAllPageRowsSelected = value => table.setRowSelection(old => { + const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected(); + const rowSelection = { + ...old + }; + table.getRowModel().rows.forEach(row => { + mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table); + }); + return rowSelection; + }); + + // addRowSelectionRange: rowId => { + // const { + // rows, + // rowsById, + // options: { selectGroupingRows, selectSubRows }, + // } = table + + // const findSelectedRow = (rows: Row[]) => { + // let found + // rows.find(d => { + // if (d.getIsSelected()) { + // found = d + // return true + // } + // const subFound = findSelectedRow(d.subRows || []) + // if (subFound) { + // found = subFound + // return true + // } + // return false + // }) + // return found + // } + + // const firstRow = findSelectedRow(rows) || rows[0] + // const lastRow = rowsById[rowId] + + // let include = false + // const selectedRowIds = {} + + // const addRow = (row: Row) => { + // mutateRowIsSelected(selectedRowIds, row.id, true, { + // rowsById, + // selectGroupingRows: selectGroupingRows!, + // selectSubRows: selectSubRows!, + // }) + // } + + // table.rows.forEach(row => { + // const isFirstRow = row.id === firstRow.id + // const isLastRow = row.id === lastRow.id + + // if (isFirstRow || isLastRow) { + // if (!include) { + // include = true + // } else if (include) { + // addRow(row) + // include = false + // } + // } + + // if (include) { + // addRow(row) + // } + // }) + + // table.setRowSelection(selectedRowIds) + // }, + table.getPreSelectedRowModel = () => table.getCoreRowModel(); + table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')); + table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')); + table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')); + + /// + + // getGroupingRowCanSelect: rowId => { + // const row = table.getRow(rowId) + + // if (!row) { + // throw new Error() + // } + + // if (typeof table.options.enableGroupingRowSelection === 'function') { + // return table.options.enableGroupingRowSelection(row) + // } + + // return table.options.enableGroupingRowSelection ?? false + // }, + + table.getIsAllRowsSelected = () => { + const preGroupedFlatRows = table.getFilteredRowModel().flatRows; + const { + rowSelection + } = table.getState(); + let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); + if (isAllRowsSelected) { + if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) { + isAllRowsSelected = false; + } + } + return isAllRowsSelected; + }; + table.getIsAllPageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect()); + const { + rowSelection + } = table.getState(); + let isAllPageRowsSelected = !!paginationFlatRows.length; + if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) { + isAllPageRowsSelected = false; + } + return isAllPageRowsSelected; + }; + table.getIsSomeRowsSelected = () => { + var _table$getState$rowSe; + const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; + return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; + }; + table.getIsSomePageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows; + return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected()); + }; + table.getToggleAllRowsSelectedHandler = () => { + return e => { + table.toggleAllRowsSelected(e.target.checked); + }; + }; + table.getToggleAllPageRowsSelectedHandler = () => { + return e => { + table.toggleAllPageRowsSelected(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row.toggleSelected = (value, opts) => { + const isSelected = row.getIsSelected(); + table.setRowSelection(old => { + var _opts$selectChildren; + value = typeof value !== 'undefined' ? value : !isSelected; + if (row.getCanSelect() && isSelected === value) { + return old; + } + const selectedRowIds = { + ...old + }; + mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table); + return selectedRowIds; + }); + }; + row.getIsSelected = () => { + const { + rowSelection + } = table.getState(); + return isRowSelected(row, rowSelection); + }; + row.getIsSomeSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'some'; + }; + row.getIsAllSubRowsSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'all'; + }; + row.getCanSelect = () => { + var _table$options$enable; + if (typeof table.options.enableRowSelection === 'function') { + return table.options.enableRowSelection(row); + } + return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; + }; + row.getCanSelectSubRows = () => { + var _table$options$enable2; + if (typeof table.options.enableSubRowSelection === 'function') { + return table.options.enableSubRowSelection(row); + } + return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; + }; + row.getCanMultiSelect = () => { + var _table$options$enable3; + if (typeof table.options.enableMultiRowSelection === 'function') { + return table.options.enableMultiRowSelection(row); + } + return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; + }; + row.getToggleSelectedHandler = () => { + const canSelect = row.getCanSelect(); + return e => { + var _target; + if (!canSelect) return; + row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } + }; + const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => { + var _row$subRows; + const row = table.getRow(id, true); + + // const isGrouped = row.getIsGrouped() + + // if ( // TODO: enforce grouping row selection rules + // !isGrouped || + // (isGrouped && table.options.enableGroupingRowSelection) + // ) { + if (value) { + if (!row.getCanMultiSelect()) { + Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]); + } + if (row.getCanSelect()) { + selectedRowIds[id] = true; + } + } else { + delete selectedRowIds[id]; + } + // } + + if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { + row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)); + } + }; + function selectRowsFn(table, rowModel) { + const rowSelection = table.getState().rowSelection; + const newSelectedFlatRows = []; + const newSelectedRowsById = {}; + + // Filters top level and nested rows + const recurseRows = function (rows, depth) { + return rows.map(row => { + var _row$subRows2; + const isSelected = isRowSelected(row, rowSelection); + if (isSelected) { + newSelectedFlatRows.push(row); + newSelectedRowsById[row.id] = row; + } + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) { + row = { + ...row, + subRows: recurseRows(row.subRows) + }; + } + if (isSelected) { + return row; + } + }).filter(Boolean); + }; + return { + rows: recurseRows(rowModel.rows), + flatRows: newSelectedFlatRows, + rowsById: newSelectedRowsById + }; + } + function isRowSelected(row, selection) { + var _selection$row$id; + return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false; + } + function isSubRowSelected(row, selection, table) { + var _row$subRows3; + if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false; + let allChildrenSelected = true; + let someSelected = false; + row.subRows.forEach(subRow => { + // Bail out early if we know both of these + if (someSelected && !allChildrenSelected) { + return; + } + if (subRow.getCanSelect()) { + if (isRowSelected(subRow, selection)) { + someSelected = true; + } else { + allChildrenSelected = false; + } + } + + // Check row selection of nested subrows + if (subRow.subRows && subRow.subRows.length) { + const subRowChildrenSelected = isSubRowSelected(subRow, selection); + if (subRowChildrenSelected === 'all') { + someSelected = true; + } else if (subRowChildrenSelected === 'some') { + someSelected = true; + allChildrenSelected = false; + } else { + allChildrenSelected = false; + } + } + }); + return allChildrenSelected ? 'all' : someSelected ? 'some' : false; + } + + const reSplitAlphaNumeric = /([0-9]+)/gm; + const alphanumeric = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); + }; + const alphanumericCaseSensitive = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); + }; + + // The text filter is more basic (less numeric support) + // but is much faster + const text = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); + }; + + // The text filter is more basic (less numeric support) + // but is much faster + const textCaseSensitive = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); + }; + const datetime = (rowA, rowB, columnId) => { + const a = rowA.getValue(columnId); + const b = rowB.getValue(columnId); + + // Can handle nullish values + // Use > and < because == (and ===) doesn't work with + // Date objects (would require calling getTime()). + return a > b ? 1 : a < b ? -1 : 0; + }; + const basic = (rowA, rowB, columnId) => { + return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); + }; + + // Utils + + function compareBasic(a, b) { + return a === b ? 0 : a > b ? 1 : -1; + } + function toString(a) { + if (typeof a === 'number') { + if (isNaN(a) || a === Infinity || a === -Infinity) { + return ''; + } + return String(a); + } + if (typeof a === 'string') { + return a; + } + return ''; + } + + // Mixed sorting is slow, but very inclusive of many edge cases. + // It handles numbers, mixed alphanumeric combinations, and even + // null, undefined, and Infinity + function compareAlphanumeric(aStr, bStr) { + // Split on number groups, but keep the delimiter + // Then remove falsey split values + const a = aStr.split(reSplitAlphaNumeric).filter(Boolean); + const b = bStr.split(reSplitAlphaNumeric).filter(Boolean); + + // While + while (a.length && b.length) { + const aa = a.shift(); + const bb = b.shift(); + const an = parseInt(aa, 10); + const bn = parseInt(bb, 10); + const combo = [an, bn].sort(); + + // Both are string + if (isNaN(combo[0])) { + if (aa > bb) { + return 1; + } + if (bb > aa) { + return -1; + } + continue; + } + + // One is a string, one is a number + if (isNaN(combo[1])) { + return isNaN(an) ? -1 : 1; + } + + // Both are numbers + if (an > bn) { + return 1; + } + if (bn > an) { + return -1; + } + } + return a.length - b.length; + } + + // Exports + + const sortingFns = { + alphanumeric, + alphanumericCaseSensitive, + text, + textCaseSensitive, + datetime, + basic + }; + + // + + const RowSorting = { + getInitialState: state => { + return { + sorting: [], + ...state + }; + }, + getDefaultColumnDef: () => { + return { + sortingFn: 'auto', + sortUndefined: 1 + }; + }, + getDefaultOptions: table => { + return { + onSortingChange: makeStateUpdater('sorting', table), + isMultiSortEvent: e => { + return e.shiftKey; + } + }; + }, + createColumn: (column, table) => { + column.getAutoSortingFn = () => { + const firstRows = table.getFilteredRowModel().flatRows.slice(10); + let isString = false; + for (const row of firstRows) { + const value = row == null ? void 0 : row.getValue(column.id); + if (Object.prototype.toString.call(value) === '[object Date]') { + return sortingFns.datetime; + } + if (typeof value === 'string') { + isString = true; + if (value.split(reSplitAlphaNumeric).length > 1) { + return sortingFns.alphanumeric; + } + } + } + if (isString) { + return sortingFns.text; + } + return sortingFns.basic; + }; + column.getAutoSortDir = () => { + const firstRow = table.getFilteredRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return 'asc'; + } + return 'desc'; + }; + column.getSortingFn = () => { + var _table$options$sortin, _table$options$sortin2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn]; + }; + column.toggleSorting = (desc, multi) => { + // if (column.columns.length) { + // column.columns.forEach((c, i) => { + // if (c.id) { + // table.toggleColumnSorting(c.id, undefined, multi || !!i) + // } + // }) + // return + // } + + // this needs to be outside of table.setSorting to be in sync with rerender + const nextSortingOrder = column.getNextSortingOrder(); + const hasManualValue = typeof desc !== 'undefined' && desc !== null; + table.setSorting(old => { + // Find any existing sorting for this column + const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id); + const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id); + let newSorting = []; + + // What should we do with this sort action? + let sortAction; + let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; + + // Multi-mode + if (old != null && old.length && column.getCanMultiSort() && multi) { + if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'add'; + } + } else { + // Normal mode + if (old != null && old.length && existingIndex !== old.length - 1) { + sortAction = 'replace'; + } else if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'replace'; + } + } + + // Handle toggle states that will remove the sorting + if (sortAction === 'toggle') { + // If we are "actually" toggling (not a manual set value), should we remove the sorting? + if (!hasManualValue) { + // Is our intention to remove? + if (!nextSortingOrder) { + sortAction = 'remove'; + } + } + } + if (sortAction === 'add') { + var _table$options$maxMul; + newSorting = [...old, { + id: column.id, + desc: nextDesc + }]; + // Take latest n columns + newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); + } else if (sortAction === 'toggle') { + // This flips (or sets) the + newSorting = old.map(d => { + if (d.id === column.id) { + return { + ...d, + desc: nextDesc + }; + } + return d; + }); + } else if (sortAction === 'remove') { + newSorting = old.filter(d => d.id !== column.id); + } else { + newSorting = [{ + id: column.id, + desc: nextDesc + }]; + } + return newSorting; + }); + }; + column.getFirstSortDir = () => { + var _ref, _column$columnDef$sor; + const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc'; + return sortDescFirst ? 'desc' : 'asc'; + }; + column.getNextSortingOrder = multi => { + var _table$options$enable, _table$options$enable2; + const firstSortDirection = column.getFirstSortDir(); + const isSorted = column.getIsSorted(); + if (!isSorted) { + return firstSortDirection; + } + if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( + // If enableSortRemove, enable in general + multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove)) + ) { + return false; + } + return isSorted === 'desc' ? 'asc' : 'desc'; + }; + column.getCanSort = () => { + var _column$columnDef$ena, _table$options$enable3; + return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn; + }; + column.getCanMultiSort = () => { + var _ref2, _column$columnDef$ena2; + return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn; + }; + column.getIsSorted = () => { + var _table$getState$sorti; + const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id); + return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'; + }; + column.getSortIndex = () => { + var _table$getState$sorti2, _table$getState$sorti3; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1; + }; + column.clearSorting = () => { + //clear sorting for just 1 column + table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []); + }; + column.getToggleSortingHandler = () => { + const canSort = column.getCanSort(); + return e => { + if (!canSort) return; + e.persist == null || e.persist(); + column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false); + }; + }; + }, + createTable: table => { + table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater); + table.resetSorting = defaultState => { + var _table$initialState$s, _table$initialState; + table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); + }; + table.getPreSortedRowModel = () => table.getGroupedRowModel(); + table.getSortedRowModel = () => { + if (!table._getSortedRowModel && table.options.getSortedRowModel) { + table._getSortedRowModel = table.options.getSortedRowModel(table); + } + if (table.options.manualSorting || !table._getSortedRowModel) { + return table.getPreSortedRowModel(); + } + return table._getSortedRowModel(); + }; + } + }; + + const builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting, + //depends on ColumnFaceting + GlobalFiltering, + //depends on ColumnFiltering + RowSorting, ColumnGrouping, + //depends on RowSorting + RowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing]; + + // + + function createTable(options) { + var _options$_features, _options$initialState; + if ((options.debugAll || options.debugTable)) { + console.info('Creating Table Instance...'); + } + const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])]; + let table = { + _features + }; + const defaultOptions = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); + }, {}); + const mergeOptions = options => { + if (table.options.mergeOptions) { + return table.options.mergeOptions(defaultOptions, options); + } + return { + ...defaultOptions, + ...options + }; + }; + const coreInitialState = {}; + let initialState = { + ...coreInitialState, + ...((_options$initialState = options.initialState) != null ? _options$initialState : {}) + }; + table._features.forEach(feature => { + var _feature$getInitialSt; + initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState; + }); + const queued = []; + let queuedTimeout = false; + const coreInstance = { + _features, + options: { + ...defaultOptions, + ...options + }, + initialState, + _queue: cb => { + queued.push(cb); + if (!queuedTimeout) { + queuedTimeout = true; + + // Schedule a microtask to run the queued callbacks after + // the current call stack (render, etc) has finished. + Promise.resolve().then(() => { + while (queued.length) { + queued.shift()(); + } + queuedTimeout = false; + }).catch(error => setTimeout(() => { + throw error; + })); + } + }, + reset: () => { + table.setState(table.initialState); + }, + setOptions: updater => { + const newOptions = functionalUpdate(updater, table.options); + table.options = mergeOptions(newOptions); + }, + getState: () => { + return table.options.state; + }, + setState: updater => { + table.options.onStateChange == null || table.options.onStateChange(updater); + }, + _getRowId: (row, index, parent) => { + var _table$options$getRow; + return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`; + }, + getCoreRowModel: () => { + if (!table._getCoreRowModel) { + table._getCoreRowModel = table.options.getCoreRowModel(table); + } + return table._getCoreRowModel(); + }, + // The final calls start at the bottom of the model, + // expanded rows, which then work their way up + + getRowModel: () => { + return table.getPaginationRowModel(); + }, + //in next version, we should just pass in the row model as the optional 2nd arg + getRow: (id, searchAll) => { + let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id]; + if (!row) { + row = table.getCoreRowModel().rowsById[id]; + if (!row) { + { + throw new Error(`getRow could not find row with ID: ${id}`); + } + } + } + return row; + }, + _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => { + var _defaultColumn; + defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; + return { + header: props => { + const resolvedColumnDef = props.header.column.columnDef; + if (resolvedColumnDef.accessorKey) { + return resolvedColumnDef.accessorKey; + } + if (resolvedColumnDef.accessorFn) { + return resolvedColumnDef.id; + } + return null; + }, + // footer: props => props.header.column.id, + cell: props => { + var _props$renderValue$to, _props$renderValue; + return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; + }, + ...table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); + }, {}), + ...defaultColumn + }; + }, getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')), + _getColumnDefs: () => table.options.columns, + getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => { + const recurseColumns = function (columnDefs, parent, depth) { + if (depth === void 0) { + depth = 0; + } + return columnDefs.map(columnDef => { + const column = createColumn(table, columnDef, depth, parent); + const groupingColumnDef = columnDef; + column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : []; + return column; + }); + }; + return recurseColumns(columnDefs); + }, getMemoOptions(options, 'debugColumns', 'getAllColumns')), + getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => { + return allColumns.flatMap(column => { + return column.getFlatColumns(); + }); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')), + _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => { + return flatColumns.reduce((acc, column) => { + acc[column.id] = column; + return acc; + }, {}); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')), + getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => { + let leafColumns = allColumns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + }, getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')), + getColumn: columnId => { + const column = table._getAllFlatColumnsById()[columnId]; + if (!column) { + console.error(`[Table] Column with id '${columnId}' does not exist.`); + } + return column; + } + }; + Object.assign(table, coreInstance); + for (let index = 0; index < table._features.length; index++) { + const feature = table._features[index]; + feature == null || feature.createTable == null || feature.createTable(table); + } + return table; + } + + function getCoreRowModel() { + return table => memo(() => [table.options.data], data => { + const rowModel = { + rows: [], + flatRows: [], + rowsById: {} + }; + const accessRows = function (originalRows, depth, parentRow) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + for (let i = 0; i < originalRows.length; i++) { + // This could be an expensive check at scale, so we should move it somewhere else, but where? + // if (!id) { + // if ("development" !== 'production') { + // throw new Error(`getRowId expected an ID, but got ${id}`) + // } + // } + + // Make the row + const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id); + + // Keep track of every row in a flat array + rowModel.flatRows.push(row); + // Also keep track of every row by its ID + rowModel.rowsById[row.id] = row; + // Push table row into parent + rows.push(row); + + // Get the original subrows + if (table.options.getSubRows) { + var _row$originalSubRows; + row.originalSubRows = table.options.getSubRows(originalRows[i], i); + + // Then recursively access them + if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) { + row.subRows = accessRows(row.originalSubRows, depth + 1, row); + } + } + } + return rows; + }; + rowModel.rows = accessRows(data); + return rowModel; + }, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex())); + } + + function getExpandedRowModel() { + return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => { + if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) { + return rowModel; + } + if (!paginateExpandedRows) { + // Only expand rows at this point if they are being paginated + return rowModel; + } + return expandRows(rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')); + } + function expandRows(rowModel) { + const expandedRows = []; + const handleRow = row => { + var _row$subRows; + expandedRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) { + row.subRows.forEach(handleRow); + } + }; + rowModel.rows.forEach(handleRow); + return { + rows: expandedRows, + flatRows: rowModel.flatRows, + rowsById: rowModel.rowsById + }; + } + + function getFacetedMinMaxValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return undefined; + const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => { + var _flatRow$getUniqueVal; + return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : []; + }).map(Number).filter(value => !Number.isNaN(value)); + if (!uniqueValues.length) return; + let facetedMinValue = uniqueValues[0]; + let facetedMaxValue = uniqueValues[uniqueValues.length - 1]; + for (const value of uniqueValues) { + if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value; + } + return [facetedMinValue, facetedMaxValue]; + }, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')); + } + + function filterRows(rows, filterRowImpl, table) { + if (table.options.filterFromLeafRows) { + return filterRowModelFromLeafs(rows, filterRowImpl, table); + } + return filterRowModelFromRoot(rows, filterRowImpl, table); + } + function filterRowModelFromLeafs(rowsToFilter, filterRow, table) { + var _table$options$maxLea; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100; + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + + // Filter from children up first + for (let i = 0; i < rowsToFilter.length; i++) { + var _row$subRows; + let row = rowsToFilter[i]; + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.columnFilters = row.columnFilters; + if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) { + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + if (filterRow(row) && !newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + if (filterRow(row) || newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + } else { + row = newRow; + if (filterRow(row)) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + } + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; + } + function filterRowModelFromRoot(rowsToFilter, filterRow, table) { + var _table$options$maxLea2; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100; + + // Filters top level and nested rows + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + // Filter from parents downward first + + const rows = []; + + // Apply the filter to any subRows + for (let i = 0; i < rowsToFilter.length; i++) { + let row = rowsToFilter[i]; + const pass = filterRow(row); + if (pass) { + var _row$subRows2; + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) { + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + } + rows.push(row); + newFilteredFlatRows.push(row); + newFilteredRowsById[row.id] = row; + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; + } + + function getFacetedRowModel() { + return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => { + if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + return preRowModel; + } + const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean); + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + return filterRows(preRowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')); + } + + function getFacetedUniqueValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return new Map(); + let facetedUniqueValues = new Map(); + for (let i = 0; i < facetedRowModel.flatRows.length; i++) { + const values = facetedRowModel.flatRows[i].getUniqueValues(columnId); + for (let j = 0; j < values.length; j++) { + const value = values[j]; + if (facetedUniqueValues.has(value)) { + var _facetedUniqueValues$; + facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1); + } else { + facetedUniqueValues.set(value, 1); + } + } + } + return facetedUniqueValues; + }, getMemoOptions(table.options, 'debugTable', `getFacetedUniqueValues_${columnId}`)); + } + + function getFilteredRowModel() { + return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => { + if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + for (let i = 0; i < rowModel.flatRows.length; i++) { + rowModel.flatRows[i].columnFilters = {}; + rowModel.flatRows[i].columnFiltersMeta = {}; + } + return rowModel; + } + const resolvedColumnFilters = []; + const resolvedGlobalFilters = []; + (columnFilters != null ? columnFilters : []).forEach(d => { + var _filterFn$resolveFilt; + const column = table.getColumn(d.id); + if (!column) { + return; + } + const filterFn = column.getFilterFn(); + if (!filterFn) { + { + console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`); + } + return; + } + resolvedColumnFilters.push({ + id: d.id, + filterFn, + resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value + }); + }); + const filterableIds = (columnFilters != null ? columnFilters : []).map(d => d.id); + const globalFilterFn = table.getGlobalFilterFn(); + const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter()); + if (globalFilter && globalFilterFn && globallyFilterableColumns.length) { + filterableIds.push('__global__'); + globallyFilterableColumns.forEach(column => { + var _globalFilterFn$resol; + resolvedGlobalFilters.push({ + id: column.id, + filterFn: globalFilterFn, + resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter + }); + }); + } + let currentColumnFilter; + let currentGlobalFilter; + + // Flag the prefiltered row model with each filter state + for (let j = 0; j < rowModel.flatRows.length; j++) { + const row = rowModel.flatRows[j]; + row.columnFilters = {}; + if (resolvedColumnFilters.length) { + for (let i = 0; i < resolvedColumnFilters.length; i++) { + currentColumnFilter = resolvedColumnFilters[i]; + const id = currentColumnFilter.id; + + // Tag the row with the column filter state + row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + }); + } + } + if (resolvedGlobalFilters.length) { + for (let i = 0; i < resolvedGlobalFilters.length; i++) { + currentGlobalFilter = resolvedGlobalFilters[i]; + const id = currentGlobalFilter.id; + // Tag the row with the first truthy global filter state + if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + })) { + row.columnFilters.__global__ = true; + break; + } + } + if (row.columnFilters.__global__ !== true) { + row.columnFilters.__global__ = false; + } + } + } + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + + // Filter final rows using all of the active filters + return filterRows(rowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => table._autoResetPageIndex())); + } + + function getGroupedRowModel() { + return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { + if (!rowModel.rows.length || !grouping.length) { + rowModel.rows.forEach(row => { + row.depth = 0; + row.parentId = undefined; + }); + return rowModel; + } + + // Filter the grouping list down to columns that exist + const existingGrouping = grouping.filter(columnId => table.getColumn(columnId)); + const groupedFlatRows = []; + const groupedRowsById = {}; + // const onlyGroupedFlatRows: Row[] = []; + // const onlyGroupedRowsById: Record = {}; + // const nonGroupedFlatRows: Row[] = []; + // const nonGroupedRowsById: Record = {}; + + // Recursively group the data + const groupUpRecursively = function (rows, depth, parentId) { + if (depth === void 0) { + depth = 0; + } + // Grouping depth has been been met + // Stop grouping and simply rewrite thd depth and row relationships + if (depth >= existingGrouping.length) { + return rows.map(row => { + row.depth = depth; + groupedFlatRows.push(row); + groupedRowsById[row.id] = row; + if (row.subRows) { + row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id); + } + return row; + }); + } + const columnId = existingGrouping[depth]; + + // Group the rows together for this level + const rowGroupsMap = groupBy(rows, columnId); + + // Perform aggregations for each group + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { + let [groupingValue, groupedRows] = _ref; + let id = `${columnId}:${groupingValue}`; + id = parentId ? `${parentId}>${id}` : id; + + // First, Recurse to group sub rows before aggregation + const subRows = groupUpRecursively(groupedRows, depth + 1, id); + subRows.forEach(subRow => { + subRow.parentId = id; + }); + + // Flatten the leaf rows of the rows in this group + const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows; + const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId); + Object.assign(row, { + groupingColumnId: columnId, + groupingValue, + subRows, + leafRows, + getValue: columnId => { + // Don't aggregate columns that are in the grouping + if (existingGrouping.includes(columnId)) { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + if (groupedRows[0]) { + var _groupedRows$0$getVal; + row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined; + } + return row._valuesCache[columnId]; + } + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + + // Aggregate the values + const column = table.getColumn(columnId); + const aggregateFn = column == null ? void 0 : column.getAggregationFn(); + if (aggregateFn) { + row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows); + return row._groupingValuesCache[columnId]; + } + } + }); + subRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return row; + }); + return aggregatedGroupedRows; + }; + const groupedRows = groupUpRecursively(rowModel.rows, 0); + groupedRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return { + rows: groupedRows, + flatRows: groupedFlatRows, + rowsById: groupedRowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => { + table._queue(() => { + table._autoResetExpanded(); + table._autoResetPageIndex(); + }); + })); + } + function groupBy(rows, columnId) { + const groupMap = new Map(); + return rows.reduce((map, row) => { + const resKey = `${row.getGroupingValue(columnId)}`; + const previous = map.get(resKey); + if (!previous) { + map.set(resKey, [row]); + } else { + previous.push(row); + } + return map; + }, groupMap); + } + + function getPaginationRowModel(opts) { + return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => { + if (!rowModel.rows.length) { + return rowModel; + } + const { + pageSize, + pageIndex + } = pagination; + let { + rows, + flatRows, + rowsById + } = rowModel; + const pageStart = pageSize * pageIndex; + const pageEnd = pageStart + pageSize; + rows = rows.slice(pageStart, pageEnd); + let paginatedRowModel; + if (!table.options.paginateExpandedRows) { + paginatedRowModel = expandRows({ + rows, + flatRows, + rowsById + }); + } else { + paginatedRowModel = { + rows, + flatRows, + rowsById + }; + } + paginatedRowModel.flatRows = []; + const handleRow = row => { + paginatedRowModel.flatRows.push(row); + if (row.subRows.length) { + row.subRows.forEach(handleRow); + } + }; + paginatedRowModel.rows.forEach(handleRow); + return paginatedRowModel; + }, getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')); + } + + function getSortedRowModel() { + return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => { + if (!rowModel.rows.length || !(sorting != null && sorting.length)) { + return rowModel; + } + const sortingState = table.getState().sorting; + const sortedFlatRows = []; + + // Filter out sortings that correspond to non existing columns + const availableSorting = sortingState.filter(sort => { + var _table$getColumn; + return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort(); + }); + const columnInfoById = {}; + availableSorting.forEach(sortEntry => { + const column = table.getColumn(sortEntry.id); + if (!column) return; + columnInfoById[sortEntry.id] = { + sortUndefined: column.columnDef.sortUndefined, + invertSorting: column.columnDef.invertSorting, + sortingFn: column.getSortingFn() + }; + }); + const sortData = rows => { + // This will also perform a stable sorting using the row index + // if needed. + const sortedData = rows.map(row => ({ + ...row + })); + sortedData.sort((rowA, rowB) => { + for (let i = 0; i < availableSorting.length; i += 1) { + var _sortEntry$desc; + const sortEntry = availableSorting[i]; + const columnInfo = columnInfoById[sortEntry.id]; + const sortUndefined = columnInfo.sortUndefined; + const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false; + let sortInt = 0; + + // All sorting ints should always return in ascending order + if (sortUndefined) { + const aValue = rowA.getValue(sortEntry.id); + const bValue = rowB.getValue(sortEntry.id); + const aUndefined = aValue === undefined; + const bUndefined = bValue === undefined; + if (aUndefined || bUndefined) { + if (sortUndefined === 'first') return aUndefined ? -1 : 1; + if (sortUndefined === 'last') return aUndefined ? 1 : -1; + sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined; + } + } + if (sortInt === 0) { + sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id); + } + + // If sorting is non-zero, take care of desc and inversion + if (sortInt !== 0) { + if (isDesc) { + sortInt *= -1; + } + if (columnInfo.invertSorting) { + sortInt *= -1; + } + return sortInt; + } + } + return rowA.index - rowB.index; + }); + + // If there are sub-rows, sort them + sortedData.forEach(row => { + var _row$subRows; + sortedFlatRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length) { + row.subRows = sortData(row.subRows); + } + }); + return sortedData; + }; + return { + rows: sortData(rowModel.rows), + flatRows: sortedFlatRows, + rowsById: rowModel.rowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex())); + } + + // + + /** + * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`. + */ + function flexRender(Comp, props) { + return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp; + } + function isReactComponent(component) { + return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component); + } + function isClassComponent(component) { + return typeof component === 'function' && (() => { + const proto = Object.getPrototypeOf(component); + return proto.prototype && proto.prototype.isReactComponent; + })(); + } + function isExoticComponent(component) { + return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description); + } + function useReactTable(options) { + // Compose in the generic options to the user options + const resolvedOptions = { + state: {}, + // Dummy state + onStateChange: () => {}, + // noop + renderFallbackValue: null, + ...options + }; + + // Create a new table and store it in state + const [tableRef] = React__namespace.useState(() => ({ + current: createTable(resolvedOptions) + })); + + // By default, manage table state here using the table's initial state + const [state, setState] = React__namespace.useState(() => tableRef.current.initialState); + + // Compose the default state above with any user state. This will allow the user + // to only control a subset of the state if desired. + tableRef.current.setOptions(prev => ({ + ...prev, + ...options, + state: { + ...state, + ...options.state + }, + // Similarly, we'll maintain both our internal state and any user-provided + // state. + onStateChange: updater => { + setState(updater); + options.onStateChange == null || options.onStateChange(updater); + } + })); + return tableRef.current; + } + + exports.ColumnFaceting = ColumnFaceting; + exports.ColumnFiltering = ColumnFiltering; + exports.ColumnGrouping = ColumnGrouping; + exports.ColumnOrdering = ColumnOrdering; + exports.ColumnPinning = ColumnPinning; + exports.ColumnSizing = ColumnSizing; + exports.ColumnVisibility = ColumnVisibility; + exports.GlobalFaceting = GlobalFaceting; + exports.GlobalFiltering = GlobalFiltering; + exports.Headers = Headers; + exports.RowExpanding = RowExpanding; + exports.RowPagination = RowPagination; + exports.RowPinning = RowPinning; + exports.RowSelection = RowSelection; + exports.RowSorting = RowSorting; + exports._getVisibleLeafColumns = _getVisibleLeafColumns; + exports.aggregationFns = aggregationFns; + exports.buildHeaderGroups = buildHeaderGroups; + exports.createCell = createCell; + exports.createColumn = createColumn; + exports.createColumnHelper = createColumnHelper; + exports.createRow = createRow; + exports.createTable = createTable; + exports.defaultColumnSizing = defaultColumnSizing; + exports.expandRows = expandRows; + exports.filterFns = filterFns; + exports.flattenBy = flattenBy; + exports.flexRender = flexRender; + exports.functionalUpdate = functionalUpdate; + exports.getCoreRowModel = getCoreRowModel; + exports.getExpandedRowModel = getExpandedRowModel; + exports.getFacetedMinMaxValues = getFacetedMinMaxValues; + exports.getFacetedRowModel = getFacetedRowModel; + exports.getFacetedUniqueValues = getFacetedUniqueValues; + exports.getFilteredRowModel = getFilteredRowModel; + exports.getGroupedRowModel = getGroupedRowModel; + exports.getMemoOptions = getMemoOptions; + exports.getPaginationRowModel = getPaginationRowModel; + exports.getSortedRowModel = getSortedRowModel; + exports.isFunction = isFunction; + exports.isNumberArray = isNumberArray; + exports.isRowSelected = isRowSelected; + exports.isSubRowSelected = isSubRowSelected; + exports.makeStateUpdater = makeStateUpdater; + exports.memo = memo; + exports.noop = noop; + exports.orderColumns = orderColumns; + exports.passiveEventSupported = passiveEventSupported; + exports.reSplitAlphaNumeric = reSplitAlphaNumeric; + exports.selectRowsFn = selectRowsFn; + exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter; + exports.sortingFns = sortingFns; + exports.useReactTable = useReactTable; + +})); +//# sourceMappingURL=index.development.js.map diff --git a/node_modules/@tanstack/react-table/build/umd/index.development.js.map b/node_modules/@tanstack/react-table/build/umd/index.development.js.map new file mode 100644 index 00000000..854faee0 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/umd/index.development.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.development.js","sources":["../../../table-core/build/lib/index.mjs","../../src/index.tsx"],"sourcesContent":["/**\n * table-core\n *\n * Copyright (c) TanStack\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nfunction createColumnHelper() {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function' ? {\n ...column,\n accessorFn: accessor\n } : {\n ...column,\n accessorKey: accessor\n };\n },\n display: column => column,\n group: column => column\n };\n}\n\n// Is this type a tuple?\n\n// If this type is a tuple, what indices are allowed?\n\n///\n\nfunction functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\nfunction noop() {\n //\n}\nfunction makeStateUpdater(key, instance) {\n return updater => {\n instance.setState(old => {\n return {\n ...old,\n [key]: functionalUpdate(updater, old[key])\n };\n });\n };\n}\nfunction isFunction(d) {\n return d instanceof Function;\n}\nfunction isNumberArray(d) {\n return Array.isArray(d) && d.every(val => typeof val === 'number');\n}\nfunction flattenBy(arr, getChildren) {\n const flat = [];\n const recurse = subArr => {\n subArr.forEach(item => {\n flat.push(item);\n const children = getChildren(item);\n if (children != null && children.length) {\n recurse(children);\n }\n });\n };\n recurse(arr);\n return flat;\n}\nfunction memo(getDeps, fn, opts) {\n let deps = [];\n let result;\n return depArgs => {\n let depTime;\n if (opts.key && opts.debug) depTime = Date.now();\n const newDeps = getDeps(depArgs);\n const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);\n if (!depsChanged) {\n return result;\n }\n deps = newDeps;\n let resultTime;\n if (opts.key && opts.debug) resultTime = Date.now();\n result = fn(...newDeps);\n opts == null || opts.onChange == null || opts.onChange(result);\n if (opts.key && opts.debug) {\n if (opts != null && opts.debug()) {\n const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;\n const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;\n const resultFpsPercentage = resultEndTime / 16;\n const pad = (str, num) => {\n str = String(str);\n while (str.length < num) {\n str = ' ' + str;\n }\n return str;\n };\n console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);\n }\n }\n return result;\n };\n}\nfunction getMemoOptions(tableOptions, debugLevel, key, onChange) {\n return {\n debug: () => {\n var _tableOptions$debugAl;\n return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel];\n },\n key: process.env.NODE_ENV === 'development' && key,\n onChange\n };\n}\n\nfunction createCell(table, row, column, columnId) {\n const getRenderValue = () => {\n var _cell$getValue;\n return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;\n };\n const cell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue\n }), getMemoOptions(table.options, 'debugCells', 'cell.getContext'))\n };\n table._features.forEach(feature => {\n feature.createCell == null || feature.createCell(cell, column, row, table);\n }, {});\n return cell;\n}\n\nfunction createColumn(table, columnDef, depth, parent) {\n var _ref, _resolvedColumnDef$id;\n const defaultColumn = table._getDefaultColumnDef();\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef\n };\n const accessorKey = resolvedColumnDef.accessorKey;\n let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;\n let accessorFn;\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn;\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = originalRow => {\n let result = originalRow;\n for (const key of accessorKey.split('.')) {\n var _result;\n result = (_result = result) == null ? void 0 : _result[key];\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(`\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`);\n }\n }\n return result;\n };\n } else {\n accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];\n }\n }\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`);\n }\n throw new Error();\n }\n let column = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent,\n depth,\n columnDef: resolvedColumnDef,\n columns: [],\n getFlatColumns: memo(() => [true], () => {\n var _column$columns;\n return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];\n }, getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')),\n getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {\n var _column$columns2;\n if ((_column$columns2 = column.columns) != null && _column$columns2.length) {\n let leafColumns = column.columns.flatMap(column => column.getLeafColumns());\n return orderColumns(leafColumns);\n }\n return [column];\n }, getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns'))\n };\n for (const feature of table._features) {\n feature.createColumn == null || feature.createColumn(column, table);\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column;\n}\n\nconst debug = 'debugHeaders';\n//\n\nfunction createHeader(table, column, options) {\n var _options$id;\n const id = (_options$id = options.id) != null ? _options$id : column.id;\n let header = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null,\n getLeafHeaders: () => {\n const leafHeaders = [];\n const recurseHeader = h => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader);\n }\n leafHeaders.push(h);\n };\n recurseHeader(header);\n return leafHeaders;\n },\n getContext: () => ({\n table,\n header: header,\n column\n })\n };\n table._features.forEach(feature => {\n feature.createHeader == null || feature.createHeader(header, table);\n });\n return header;\n}\nconst Headers = {\n createTable: table => {\n // Header Groups\n\n table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {\n var _left$map$filter, _right$map$filter;\n const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];\n const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];\n const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));\n const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);\n return headerGroups;\n }, getMemoOptions(table.options, debug, 'getHeaderGroups'));\n table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));\n return buildHeaderGroups(allColumns, leafColumns, table, 'center');\n }, getMemoOptions(table.options, debug, 'getCenterHeaderGroups'));\n table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {\n var _left$map$filter2;\n const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');\n }, getMemoOptions(table.options, debug, 'getLeftHeaderGroups'));\n table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {\n var _right$map$filter2;\n const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');\n }, getMemoOptions(table.options, debug, 'getRightHeaderGroups'));\n\n // Footer Groups\n\n table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getFooterGroups'));\n table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getLeftFooterGroups'));\n table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getCenterFooterGroups'));\n table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getRightFooterGroups'));\n\n // Flat Headers\n\n table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => {\n return headerGroups.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getFlatHeaders'));\n table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => {\n return left.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getLeftFlatHeaders'));\n table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => {\n return left.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getCenterFlatHeaders'));\n table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => {\n return left.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getRightFlatHeaders'));\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => {\n return flatHeaders.filter(header => {\n var _header$subHeaders;\n return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);\n });\n }, getMemoOptions(table.options, debug, 'getCenterLeafHeaders'));\n table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => {\n return flatHeaders.filter(header => {\n var _header$subHeaders2;\n return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);\n });\n }, getMemoOptions(table.options, debug, 'getLeftLeafHeaders'));\n table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => {\n return flatHeaders.filter(header => {\n var _header$subHeaders3;\n return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);\n });\n }, getMemoOptions(table.options, debug, 'getRightLeafHeaders'));\n table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {\n var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;\n return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {\n return header.getLeafHeaders();\n }).flat();\n }, getMemoOptions(table.options, debug, 'getLeafHeaders'));\n }\n};\nfunction buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {\n var _headerGroups$0$heade, _headerGroups$;\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0;\n const findMaxDepth = function (columns, depth) {\n if (depth === void 0) {\n depth = 1;\n }\n maxDepth = Math.max(maxDepth, depth);\n columns.filter(column => column.getIsVisible()).forEach(column => {\n var _column$columns;\n if ((_column$columns = column.columns) != null && _column$columns.length) {\n findMaxDepth(column.columns, depth + 1);\n }\n }, 0);\n };\n findMaxDepth(allColumns);\n let headerGroups = [];\n const createHeaderGroup = (headersToGroup, depth) => {\n // The header group we are creating\n const headerGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: []\n };\n\n // The parent columns we're going to scan next\n const pendingParentHeaders = [];\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;\n let column;\n let isPlaceholder = false;\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent;\n } else {\n // The parent header is repeated\n column = headerToGroup.column;\n isPlaceholder = true;\n }\n if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup);\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined,\n depth,\n index: pendingParentHeaders.length\n });\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup);\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header);\n }\n headerGroup.headers.push(headerToGroup);\n headerToGroup.headerGroup = headerGroup;\n });\n headerGroups.push(headerGroup);\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1);\n }\n };\n const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {\n depth: maxDepth,\n index\n }));\n createHeaderGroup(bottomHeaders, maxDepth - 1);\n headerGroups.reverse();\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = headers => {\n const filteredHeaders = headers.filter(header => header.column.getIsVisible());\n return filteredHeaders.map(header => {\n let colSpan = 0;\n let rowSpan = 0;\n let childRowSpans = [0];\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = [];\n recurseHeadersForSpans(header.subHeaders).forEach(_ref => {\n let {\n colSpan: childColSpan,\n rowSpan: childRowSpan\n } = _ref;\n colSpan += childColSpan;\n childRowSpans.push(childRowSpan);\n });\n } else {\n colSpan = 1;\n }\n const minChildRowSpan = Math.min(...childRowSpans);\n rowSpan = rowSpan + minChildRowSpan;\n header.colSpan = colSpan;\n header.rowSpan = rowSpan;\n return {\n colSpan,\n rowSpan\n };\n });\n };\n recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);\n return headerGroups;\n}\n\nconst createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {\n let row = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId];\n }\n const column = table.getColumn(columnId);\n if (!(column != null && column.accessorFn)) {\n return undefined;\n }\n row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);\n return row._valuesCache[columnId];\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId];\n }\n const column = table.getColumn(columnId);\n if (!(column != null && column.accessorFn)) {\n return undefined;\n }\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)];\n return row._uniqueValuesCache[columnId];\n }\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex);\n return row._uniqueValuesCache[columnId];\n },\n renderValue: columnId => {\n var _row$getValue;\n return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;\n },\n subRows: subRows != null ? subRows : [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,\n getParentRows: () => {\n let parentRows = [];\n let currentRow = row;\n while (true) {\n const parentRow = currentRow.getParentRow();\n if (!parentRow) break;\n parentRows.push(parentRow);\n currentRow = parentRow;\n }\n return parentRows.reverse();\n },\n getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row, column, column.id);\n });\n }, getMemoOptions(table.options, 'debugRows', 'getAllCells')),\n _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {\n return allCells.reduce((acc, cell) => {\n acc[cell.column.id] = cell;\n return acc;\n }, {});\n }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId'))\n };\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i];\n feature == null || feature.createRow == null || feature.createRow(row, table);\n }\n return row;\n};\n\n//\n\nconst ColumnFaceting = {\n createColumn: (column, table) => {\n column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel();\n }\n return column._getFacetedRowModel();\n };\n column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map();\n }\n return column._getFacetedUniqueValues();\n };\n column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined;\n }\n return column._getFacetedMinMaxValues();\n };\n }\n};\n\nconst includesString = (row, columnId, filterValue) => {\n var _filterValue$toString, _row$getValue;\n const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase();\n return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));\n};\nincludesString.autoRemove = val => testFalsey(val);\nconst includesStringSensitive = (row, columnId, filterValue) => {\n var _row$getValue2;\n return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue));\n};\nincludesStringSensitive.autoRemove = val => testFalsey(val);\nconst equalsString = (row, columnId, filterValue) => {\n var _row$getValue3;\n return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase());\n};\nequalsString.autoRemove = val => testFalsey(val);\nconst arrIncludes = (row, columnId, filterValue) => {\n var _row$getValue4;\n return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);\n};\narrIncludes.autoRemove = val => testFalsey(val);\nconst arrIncludesAll = (row, columnId, filterValue) => {\n return !filterValue.some(val => {\n var _row$getValue5;\n return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));\n });\n};\narrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);\nconst arrIncludesSome = (row, columnId, filterValue) => {\n return filterValue.some(val => {\n var _row$getValue6;\n return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);\n });\n};\narrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);\nconst equals = (row, columnId, filterValue) => {\n return row.getValue(columnId) === filterValue;\n};\nequals.autoRemove = val => testFalsey(val);\nconst weakEquals = (row, columnId, filterValue) => {\n return row.getValue(columnId) == filterValue;\n};\nweakEquals.autoRemove = val => testFalsey(val);\nconst inNumberRange = (row, columnId, filterValue) => {\n let [min, max] = filterValue;\n const rowValue = row.getValue(columnId);\n return rowValue >= min && rowValue <= max;\n};\ninNumberRange.resolveFilterValue = val => {\n let [unsafeMin, unsafeMax] = val;\n let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin;\n let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax;\n let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;\n if (min > max) {\n const temp = min;\n min = max;\n max = temp;\n }\n return [min, max];\n};\ninNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]);\n\n// Export\n\nconst filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange\n};\n// Utils\n\nfunction testFalsey(val) {\n return val === undefined || val === null || val === '';\n}\n\n//\n\nconst ColumnFiltering = {\n getDefaultColumnDef: () => {\n return {\n filterFn: 'auto'\n };\n },\n getInitialState: state => {\n return {\n columnFilters: [],\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100\n };\n },\n createColumn: (column, table) => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0];\n const value = firstRow == null ? void 0 : firstRow.getValue(column.id);\n if (typeof value === 'string') {\n return filterFns.includesString;\n }\n if (typeof value === 'number') {\n return filterFns.inNumberRange;\n }\n if (typeof value === 'boolean') {\n return filterFns.equals;\n }\n if (value !== null && typeof value === 'object') {\n return filterFns.equals;\n }\n if (Array.isArray(value)) {\n return filterFns.arrIncludes;\n }\n return filterFns.weakEquals;\n };\n column.getFilterFn = () => {\n var _table$options$filter, _table$options$filter2;\n return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore\n (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];\n };\n column.getCanFilter = () => {\n var _column$columnDef$ena, _table$options$enable, _table$options$enable2;\n return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;\n };\n column.getIsFiltered = () => column.getFilterIndex() > -1;\n column.getFilterValue = () => {\n var _table$getState$colum;\n return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;\n };\n column.getFilterIndex = () => {\n var _table$getState$colum2, _table$getState$colum3;\n return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;\n };\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn();\n const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id);\n const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined);\n\n //\n if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {\n var _old$filter;\n return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];\n }\n const newFilterObj = {\n id: column.id,\n value: newFilter\n };\n if (previousFilter) {\n var _old$map;\n return (_old$map = old == null ? void 0 : old.map(d => {\n if (d.id === column.id) {\n return newFilterObj;\n }\n return d;\n })) != null ? _old$map : [];\n }\n if (old != null && old.length) {\n return [...old, newFilterObj];\n }\n return [newFilterObj];\n });\n };\n },\n createRow: (row, _table) => {\n row.columnFilters = {};\n row.columnFiltersMeta = {};\n },\n createTable: table => {\n table.setColumnFilters = updater => {\n const leafColumns = table.getAllLeafColumns();\n const updateFn = old => {\n var _functionalUpdate;\n return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id);\n if (column) {\n const filterFn = column.getFilterFn();\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false;\n }\n }\n return true;\n });\n };\n table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);\n };\n table.resetColumnFilters = defaultState => {\n var _table$initialState$c, _table$initialState;\n table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);\n };\n table.getPreFilteredRowModel = () => table.getCoreRowModel();\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table);\n }\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel();\n }\n return table._getFilteredRowModel();\n };\n }\n};\nfunction shouldAutoRemoveFilter(filterFn, value, column) {\n return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;\n}\n\nconst sum = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId);\n return sum + (typeof nextValue === 'number' ? nextValue : 0);\n }, 0);\n};\nconst min = (columnId, _leafRows, childRows) => {\n let min;\n childRows.forEach(row => {\n const value = row.getValue(columnId);\n if (value != null && (min > value || min === undefined && value >= value)) {\n min = value;\n }\n });\n return min;\n};\nconst max = (columnId, _leafRows, childRows) => {\n let max;\n childRows.forEach(row => {\n const value = row.getValue(columnId);\n if (value != null && (max < value || max === undefined && value >= value)) {\n max = value;\n }\n });\n return max;\n};\nconst extent = (columnId, _leafRows, childRows) => {\n let min;\n let max;\n childRows.forEach(row => {\n const value = row.getValue(columnId);\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value;\n } else {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n });\n return [min, max];\n};\nconst mean = (columnId, leafRows) => {\n let count = 0;\n let sum = 0;\n leafRows.forEach(row => {\n let value = row.getValue(columnId);\n if (value != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n });\n if (count) return sum / count;\n return;\n};\nconst median = (columnId, leafRows) => {\n if (!leafRows.length) {\n return;\n }\n const values = leafRows.map(row => row.getValue(columnId));\n if (!isNumberArray(values)) {\n return;\n }\n if (values.length === 1) {\n return values[0];\n }\n const mid = Math.floor(values.length / 2);\n const nums = values.sort((a, b) => a - b);\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;\n};\nconst unique = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());\n};\nconst uniqueCount = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size;\n};\nconst count = (_columnId, leafRows) => {\n return leafRows.length;\n};\nconst aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count\n};\n\n//\n\nconst ColumnGrouping = {\n getDefaultColumnDef: () => {\n return {\n aggregatedCell: props => {\n var _toString, _props$getValue;\n return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;\n },\n aggregationFn: 'auto'\n };\n },\n getInitialState: state => {\n return {\n grouping: [],\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder'\n };\n },\n createColumn: (column, table) => {\n column.toggleGrouping = () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old != null && old.includes(column.id)) {\n return old.filter(d => d !== column.id);\n }\n return [...(old != null ? old : []), column.id];\n });\n };\n column.getCanGroup = () => {\n var _column$columnDef$ena, _table$options$enable;\n return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue);\n };\n column.getIsGrouped = () => {\n var _table$getState$group;\n return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);\n };\n column.getGroupedIndex = () => {\n var _table$getState$group2;\n return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);\n };\n column.getToggleGroupingHandler = () => {\n const canGroup = column.getCanGroup();\n return () => {\n if (!canGroup) return;\n column.toggleGrouping();\n };\n };\n column.getAutoAggregationFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0];\n const value = firstRow == null ? void 0 : firstRow.getValue(column.id);\n if (typeof value === 'number') {\n return aggregationFns.sum;\n }\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent;\n }\n };\n column.getAggregationFn = () => {\n var _table$options$aggreg, _table$options$aggreg2;\n if (!column) {\n throw new Error();\n }\n return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];\n };\n },\n createTable: table => {\n table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);\n table.resetGrouping = defaultState => {\n var _table$initialState$g, _table$initialState;\n table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);\n };\n table.getPreGroupedRowModel = () => table.getFilteredRowModel();\n table.getGroupedRowModel = () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table);\n }\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel();\n }\n return table._getGroupedRowModel();\n };\n },\n createRow: (row, table) => {\n row.getIsGrouped = () => !!row.groupingColumnId;\n row.getGroupingValue = columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId];\n }\n const column = table.getColumn(columnId);\n if (!(column != null && column.columnDef.getGroupingValue)) {\n return row.getValue(columnId);\n }\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);\n return row._groupingValuesCache[columnId];\n };\n row._groupingValuesCache = {};\n },\n createCell: (cell, column, row, table) => {\n cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;\n cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();\n cell.getIsAggregated = () => {\n var _row$subRows;\n return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);\n };\n }\n};\nfunction orderColumns(leafColumns, grouping, groupedColumnMode) {\n if (!(grouping != null && grouping.length) || !groupedColumnMode) {\n return leafColumns;\n }\n const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns;\n }\n const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean);\n return [...groupingColumns, ...nonGroupingColumns];\n}\n\n//\n\nconst ColumnOrdering = {\n getInitialState: state => {\n return {\n columnOrder: [],\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table)\n };\n },\n createColumn: (column, table) => {\n column.getIndex = memo(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex'));\n column.getIsFirstColumn = position => {\n var _columns$;\n const columns = _getVisibleLeafColumns(table, position);\n return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id;\n };\n column.getIsLastColumn = position => {\n var _columns;\n const columns = _getVisibleLeafColumns(table, position);\n return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id;\n };\n },\n createTable: table => {\n table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);\n table.resetColumnOrder = defaultState => {\n var _table$initialState$c;\n table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);\n };\n table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns = [];\n\n // If there is no order, return the normal columns\n if (!(columnOrder != null && columnOrder.length)) {\n orderedColumns = columns;\n } else {\n const columnOrderCopy = [...columnOrder];\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns];\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift();\n const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy];\n }\n return orderColumns(orderedColumns, grouping, groupedColumnMode);\n }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn'));\n }\n};\n\n//\n\nconst getDefaultColumnPinningState = () => ({\n left: [],\n right: []\n});\nconst ColumnPinning = {\n getInitialState: state => {\n return {\n columnPinning: getDefaultColumnPinningState(),\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table)\n };\n },\n createColumn: (column, table) => {\n column.pin = position => {\n const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);\n table.setColumnPinning(old => {\n var _old$left3, _old$right3;\n if (position === 'right') {\n var _old$left, _old$right;\n return {\n left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),\n right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]\n };\n }\n if (position === 'left') {\n var _old$left2, _old$right2;\n return {\n left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],\n right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))\n };\n }\n return {\n left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),\n right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))\n };\n });\n };\n column.getCanPin = () => {\n const leafColumns = column.getLeafColumns();\n return leafColumns.some(d => {\n var _d$columnDef$enablePi, _ref, _table$options$enable;\n return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true);\n });\n };\n column.getIsPinned = () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id);\n const {\n left,\n right\n } = table.getState().columnPinning;\n const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));\n const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));\n return isLeft ? 'left' : isRight ? 'right' : false;\n };\n column.getPinnedIndex = () => {\n var _table$getState$colum, _table$getState$colum2;\n const position = column.getIsPinned();\n return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;\n };\n },\n createRow: (row, table) => {\n row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {\n const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];\n return allCells.filter(d => !leftAndRight.includes(d.column.id));\n }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells'));\n row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {\n const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({\n ...d,\n position: 'left'\n }));\n return cells;\n }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells'));\n row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {\n const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({\n ...d,\n position: 'right'\n }));\n return cells;\n }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells'));\n },\n createTable: table => {\n table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);\n table.resetColumnPinning = defaultState => {\n var _table$initialState$c, _table$initialState;\n return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState());\n };\n table.getIsSomeColumnsPinned = position => {\n var _pinningState$positio;\n const pinningState = table.getState().columnPinning;\n if (!position) {\n var _pinningState$left, _pinningState$right;\n return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));\n }\n return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);\n };\n table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {\n return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);\n }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns'));\n table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {\n return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);\n }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns'));\n table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {\n const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];\n return allColumns.filter(d => !leftAndRight.includes(d.id));\n }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns'));\n }\n};\n\nfunction safelyAccessDocument(_document) {\n return _document || (typeof document !== 'undefined' ? document : null);\n}\n\n//\n\n//\n\nconst defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER\n};\nconst getDefaultColumnSizingInfoState = () => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: []\n});\nconst ColumnSizing = {\n getDefaultColumnDef: () => {\n return defaultColumnSizing;\n },\n getInitialState: state => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n columnResizeMode: 'onEnd',\n columnResizeDirection: 'ltr',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)\n };\n },\n createColumn: (column, table) => {\n column.getSize = () => {\n var _column$columnDef$min, _ref, _column$columnDef$max;\n const columnSize = table.getState().columnSizing[column.id];\n return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);\n };\n column.getStart = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart'));\n column.getAfter = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter'));\n column.resetSize = () => {\n table.setColumnSizing(_ref2 => {\n let {\n [column.id]: _,\n ...rest\n } = _ref2;\n return rest;\n });\n };\n column.getCanResize = () => {\n var _column$columnDef$ena, _table$options$enable;\n return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);\n };\n column.getIsResizing = () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id;\n };\n },\n createHeader: (header, table) => {\n header.getSize = () => {\n let sum = 0;\n const recurse = header => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse);\n } else {\n var _header$column$getSiz;\n sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;\n }\n };\n recurse(header);\n return sum;\n };\n header.getStart = () => {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup.headers[header.index - 1];\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();\n }\n return 0;\n };\n header.getResizeHandler = _contextDocument => {\n const column = table.getColumn(header.column.id);\n const canResize = column == null ? void 0 : column.getCanResize();\n return e => {\n if (!column || !canResize) {\n return;\n }\n e.persist == null || e.persist();\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return;\n }\n }\n const startSize = header.getSize();\n const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];\n const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;\n const newColumnSizing = {};\n const updateOffset = (eventType, clientXPos) => {\n if (typeof clientXPos !== 'number') {\n return;\n }\n table.setColumnSizingInfo(old => {\n var _old$startOffset, _old$startSize;\n const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1;\n const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection;\n const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);\n old.columnSizingStart.forEach(_ref3 => {\n let [columnId, headerSize] = _ref3;\n newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;\n });\n return {\n ...old,\n deltaOffset,\n deltaPercentage\n };\n });\n if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing\n }));\n }\n };\n const onMove = clientXPos => updateOffset('move', clientXPos);\n const onEnd = clientXPos => {\n updateOffset('end', clientXPos);\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: []\n }));\n };\n const contextDocument = safelyAccessDocument(_contextDocument);\n const mouseEvents = {\n moveHandler: e => onMove(e.clientX),\n upHandler: e => {\n contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler);\n contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler);\n onEnd(e.clientX);\n }\n };\n const touchEvents = {\n moveHandler: e => {\n if (e.cancelable) {\n e.preventDefault();\n e.stopPropagation();\n }\n onMove(e.touches[0].clientX);\n return false;\n },\n upHandler: e => {\n var _e$touches$;\n contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler);\n contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler);\n if (e.cancelable) {\n e.preventDefault();\n e.stopPropagation();\n }\n onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);\n }\n };\n const passiveIfSupported = passiveEventSupported() ? {\n passive: false\n } : false;\n if (isTouchStartEvent(e)) {\n contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);\n contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);\n } else {\n contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);\n contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);\n }\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id\n }));\n };\n };\n },\n createTable: table => {\n table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater);\n table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater);\n table.resetColumnSizing = defaultState => {\n var _table$initialState$c;\n table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});\n };\n table.resetHeaderSizeInfo = defaultState => {\n var _table$initialState$c2;\n table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());\n };\n table.getTotalSize = () => {\n var _table$getHeaderGroup, _table$getHeaderGroup2;\n return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getHeaderGroup : 0;\n };\n table.getLeftTotalSize = () => {\n var _table$getLeftHeaderG, _table$getLeftHeaderG2;\n return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getLeftHeaderG : 0;\n };\n table.getCenterTotalSize = () => {\n var _table$getCenterHeade, _table$getCenterHeade2;\n return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getCenterHeade : 0;\n };\n table.getRightTotalSize = () => {\n var _table$getRightHeader, _table$getRightHeader2;\n return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getRightHeader : 0;\n };\n }\n};\nlet passiveSupported = null;\nfunction passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported;\n let supported = false;\n try {\n const options = {\n get passive() {\n supported = true;\n return false;\n }\n };\n const noop = () => {};\n window.addEventListener('test', noop, options);\n window.removeEventListener('test', noop);\n } catch (err) {\n supported = false;\n }\n passiveSupported = supported;\n return passiveSupported;\n}\nfunction isTouchStartEvent(e) {\n return e.type === 'touchstart';\n}\n\n//\n\nconst ColumnVisibility = {\n getInitialState: state => {\n return {\n columnVisibility: {},\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)\n };\n },\n createColumn: (column, table) => {\n column.toggleVisibility = value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value != null ? value : !column.getIsVisible()\n }));\n }\n };\n column.getIsVisible = () => {\n var _ref, _table$getState$colum;\n const childColumns = column.columns;\n return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true;\n };\n column.getCanHide = () => {\n var _column$columnDef$ena, _table$options$enable;\n return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);\n };\n column.getToggleVisibilityHandler = () => {\n return e => {\n column.toggleVisibility == null || column.toggleVisibility(e.target.checked);\n };\n };\n },\n createRow: (row, table) => {\n row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {\n return cells.filter(cell => cell.column.getIsVisible());\n }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells'));\n row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells'));\n },\n createTable: table => {\n const makeVisibleColumnsMethod = (key, getColumns) => {\n return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {\n return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());\n }, getMemoOptions(table.options, 'debugColumns', key));\n };\n table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());\n table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());\n table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());\n table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());\n table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());\n table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);\n table.resetColumnVisibility = defaultState => {\n var _table$initialState$c;\n table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});\n };\n table.toggleAllColumnsVisible = value => {\n var _value;\n value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();\n table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({\n ...obj,\n [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value\n }), {}));\n };\n table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));\n table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());\n table.getToggleAllColumnsVisibilityHandler = () => {\n return e => {\n var _target;\n table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);\n };\n };\n }\n};\nfunction _getVisibleLeafColumns(table, position) {\n return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();\n}\n\n//\n\nconst GlobalFaceting = {\n createTable: table => {\n table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__');\n table.getGlobalFacetedRowModel = () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel();\n }\n return table._getGlobalFacetedRowModel();\n };\n table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__');\n table.getGlobalFacetedUniqueValues = () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map();\n }\n return table._getGlobalFacetedUniqueValues();\n };\n table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__');\n table.getGlobalFacetedMinMaxValues = () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return;\n }\n return table._getGlobalFacetedMinMaxValues();\n };\n }\n};\n\n//\n\nconst GlobalFiltering = {\n getInitialState: state => {\n return {\n globalFilter: undefined,\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n var _table$getCoreRowMode;\n const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue();\n return typeof value === 'string' || typeof value === 'number';\n }\n };\n },\n createColumn: (column, table) => {\n column.getCanGlobalFilter = () => {\n var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol;\n return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;\n };\n },\n createTable: table => {\n table.getGlobalAutoFilterFn = () => {\n return filterFns.includesString;\n };\n table.getGlobalFilterFn = () => {\n var _table$options$filter, _table$options$filter2;\n const {\n globalFilterFn: globalFilterFn\n } = table.options;\n return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn];\n };\n table.setGlobalFilter = updater => {\n table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);\n };\n table.resetGlobalFilter = defaultState => {\n table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);\n };\n }\n};\n\n//\n\nconst RowExpanding = {\n getInitialState: state => {\n return {\n expanded: {},\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true\n };\n },\n createTable: table => {\n let registered = false;\n let queued = false;\n table._autoResetExpanded = () => {\n var _ref, _table$options$autoRe;\n if (!registered) {\n table._queue(() => {\n registered = true;\n });\n return;\n }\n if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {\n if (queued) return;\n queued = true;\n table._queue(() => {\n table.resetExpanded();\n queued = false;\n });\n }\n };\n table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);\n table.toggleAllRowsExpanded = expanded => {\n if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {\n table.setExpanded(true);\n } else {\n table.setExpanded({});\n }\n };\n table.resetExpanded = defaultState => {\n var _table$initialState$e, _table$initialState;\n table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});\n };\n table.getCanSomeRowsExpand = () => {\n return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());\n };\n table.getToggleAllRowsExpandedHandler = () => {\n return e => {\n e.persist == null || e.persist();\n table.toggleAllRowsExpanded();\n };\n };\n table.getIsSomeRowsExpanded = () => {\n const expanded = table.getState().expanded;\n return expanded === true || Object.values(expanded).some(Boolean);\n };\n table.getIsAllRowsExpanded = () => {\n const expanded = table.getState().expanded;\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true;\n }\n if (!Object.keys(expanded).length) {\n return false;\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false;\n }\n\n // They must all be expanded :shrug:\n return true;\n };\n table.getExpandedDepth = () => {\n let maxDepth = 0;\n const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);\n rowIds.forEach(id => {\n const splitId = id.split('.');\n maxDepth = Math.max(maxDepth, splitId.length);\n });\n return maxDepth;\n };\n table.getPreExpandedRowModel = () => table.getSortedRowModel();\n table.getExpandedRowModel = () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table);\n }\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel();\n }\n return table._getExpandedRowModel();\n };\n },\n createRow: (row, table) => {\n row.toggleExpanded = expanded => {\n table.setExpanded(old => {\n var _expanded;\n const exists = old === true ? true : !!(old != null && old[row.id]);\n let oldExpanded = {};\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true;\n });\n } else {\n oldExpanded = old;\n }\n expanded = (_expanded = expanded) != null ? _expanded : !exists;\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true\n };\n }\n if (exists && !expanded) {\n const {\n [row.id]: _,\n ...rest\n } = oldExpanded;\n return rest;\n }\n return old;\n });\n };\n row.getIsExpanded = () => {\n var _table$options$getIsR;\n const expanded = table.getState().expanded;\n return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));\n };\n row.getCanExpand = () => {\n var _table$options$getRow, _table$options$enable, _row$subRows;\n return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);\n };\n row.getIsAllParentsExpanded = () => {\n let isFullyExpanded = true;\n let currentRow = row;\n while (isFullyExpanded && currentRow.parentId) {\n currentRow = table.getRow(currentRow.parentId, true);\n isFullyExpanded = currentRow.getIsExpanded();\n }\n return isFullyExpanded;\n };\n row.getToggleExpandedHandler = () => {\n const canExpand = row.getCanExpand();\n return () => {\n if (!canExpand) return;\n row.toggleExpanded();\n };\n };\n }\n};\n\n//\n\nconst defaultPageIndex = 0;\nconst defaultPageSize = 10;\nconst getDefaultPaginationState = () => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize\n});\nconst RowPagination = {\n getInitialState: state => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...(state == null ? void 0 : state.pagination)\n }\n };\n },\n getDefaultOptions: table => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table)\n };\n },\n createTable: table => {\n let registered = false;\n let queued = false;\n table._autoResetPageIndex = () => {\n var _ref, _table$options$autoRe;\n if (!registered) {\n table._queue(() => {\n registered = true;\n });\n return;\n }\n if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {\n if (queued) return;\n queued = true;\n table._queue(() => {\n table.resetPageIndex();\n queued = false;\n });\n }\n };\n table.setPagination = updater => {\n const safeUpdater = old => {\n let newState = functionalUpdate(updater, old);\n return newState;\n };\n return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);\n };\n table.resetPagination = defaultState => {\n var _table$initialState$p;\n table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());\n };\n table.setPageIndex = updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex);\n const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));\n return {\n ...old,\n pageIndex\n };\n });\n };\n table.resetPageIndex = defaultState => {\n var _table$initialState$p2, _table$initialState;\n table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);\n };\n table.resetPageSize = defaultState => {\n var _table$initialState$p3, _table$initialState2;\n table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);\n };\n table.setPageSize = updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));\n const topRowIndex = old.pageSize * old.pageIndex;\n const pageIndex = Math.floor(topRowIndex / pageSize);\n return {\n ...old,\n pageIndex,\n pageSize\n };\n });\n };\n //deprecated\n table.setPageCount = updater => table.setPagination(old => {\n var _table$options$pageCo;\n let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount);\n }\n return {\n ...old,\n pageCount: newPageCount\n };\n });\n table.getPageOptions = memo(() => [table.getPageCount()], pageCount => {\n let pageOptions = [];\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);\n }\n return pageOptions;\n }, getMemoOptions(table.options, 'debugTable', 'getPageOptions'));\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;\n table.getCanNextPage = () => {\n const {\n pageIndex\n } = table.getState().pagination;\n const pageCount = table.getPageCount();\n if (pageCount === -1) {\n return true;\n }\n if (pageCount === 0) {\n return false;\n }\n return pageIndex < pageCount - 1;\n };\n table.previousPage = () => {\n return table.setPageIndex(old => old - 1);\n };\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1;\n });\n };\n table.firstPage = () => {\n return table.setPageIndex(0);\n };\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1);\n };\n table.getPrePaginationRowModel = () => table.getExpandedRowModel();\n table.getPaginationRowModel = () => {\n if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {\n table._getPaginationRowModel = table.options.getPaginationRowModel(table);\n }\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel();\n }\n return table._getPaginationRowModel();\n };\n table.getPageCount = () => {\n var _table$options$pageCo2;\n return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize);\n };\n table.getRowCount = () => {\n var _table$options$rowCou;\n return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length;\n };\n }\n};\n\n//\n\nconst getDefaultRowPinningState = () => ({\n top: [],\n bottom: []\n});\nconst RowPinning = {\n getInitialState: state => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table)\n };\n },\n createRow: (row, table) => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => {\n let {\n id\n } = _ref;\n return id;\n }) : [];\n const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => {\n let {\n id\n } = _ref2;\n return id;\n }) : [];\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]);\n table.setRowPinning(old => {\n var _old$top3, _old$bottom3;\n if (position === 'bottom') {\n var _old$top, _old$bottom;\n return {\n top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))),\n bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)]\n };\n }\n if (position === 'top') {\n var _old$top2, _old$bottom2;\n return {\n top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)],\n bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d)))\n };\n }\n return {\n top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))),\n bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d)))\n };\n });\n };\n row.getCanPin = () => {\n var _ref3;\n const {\n enableRowPinning,\n enablePinning\n } = table.options;\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row);\n }\n return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true;\n };\n row.getIsPinned = () => {\n const rowIds = [row.id];\n const {\n top,\n bottom\n } = table.getState().rowPinning;\n const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d));\n const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d));\n return isTop ? 'top' : isBottom ? 'bottom' : false;\n };\n row.getPinnedIndex = () => {\n var _ref4, _visiblePinnedRowIds$;\n const position = row.getIsPinned();\n if (!position) return -1;\n const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => {\n let {\n id\n } = _ref5;\n return id;\n });\n return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;\n };\n },\n createTable: table => {\n table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater);\n table.resetRowPinning = defaultState => {\n var _table$initialState$r, _table$initialState;\n return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());\n };\n table.getIsSomeRowsPinned = position => {\n var _pinningState$positio;\n const pinningState = table.getState().rowPinning;\n if (!position) {\n var _pinningState$top, _pinningState$bottom;\n return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length));\n }\n return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);\n };\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n var _table$options$keepPi;\n const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ?\n //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => {\n const row = table.getRow(rowId, true);\n return row.getIsAllParentsExpanded() ? row : null;\n }) :\n //else get only visible rows that are pinned\n (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId));\n return rows.filter(Boolean).map(d => ({\n ...d,\n position\n }));\n };\n table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows'));\n table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows'));\n table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);\n return allRows.filter(d => !topAndBottom.has(d.id));\n }, getMemoOptions(table.options, 'debugRows', 'getCenterRows'));\n }\n};\n\n//\n\nconst RowSelection = {\n getInitialState: state => {\n return {\n rowSelection: {},\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n };\n },\n createTable: table => {\n table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater);\n table.resetRowSelection = defaultState => {\n var _table$initialState$r;\n return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});\n };\n table.toggleAllRowsSelected = value => {\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();\n const rowSelection = {\n ...old\n };\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return;\n }\n rowSelection[row.id] = true;\n });\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id];\n });\n }\n return rowSelection;\n });\n };\n table.toggleAllPageRowsSelected = value => table.setRowSelection(old => {\n const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();\n const rowSelection = {\n ...old\n };\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table);\n });\n return rowSelection;\n });\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n table.getPreSelectedRowModel = () => table.getCoreRowModel();\n table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n }\n return selectRowsFn(table, rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel'));\n table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n }\n return selectRowsFn(table, rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel'));\n table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n }\n return selectRowsFn(table, rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel'));\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n table.getIsAllRowsSelected = () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows;\n const {\n rowSelection\n } = table.getState();\n let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);\n if (isAllRowsSelected) {\n if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {\n isAllRowsSelected = false;\n }\n }\n return isAllRowsSelected;\n };\n table.getIsAllPageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());\n const {\n rowSelection\n } = table.getState();\n let isAllPageRowsSelected = !!paginationFlatRows.length;\n if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {\n isAllPageRowsSelected = false;\n }\n return isAllPageRowsSelected;\n };\n table.getIsSomeRowsSelected = () => {\n var _table$getState$rowSe;\n const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;\n return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;\n };\n table.getIsSomePageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows;\n return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected());\n };\n table.getToggleAllRowsSelectedHandler = () => {\n return e => {\n table.toggleAllRowsSelected(e.target.checked);\n };\n };\n table.getToggleAllPageRowsSelectedHandler = () => {\n return e => {\n table.toggleAllPageRowsSelected(e.target.checked);\n };\n };\n },\n createRow: (row, table) => {\n row.toggleSelected = (value, opts) => {\n const isSelected = row.getIsSelected();\n table.setRowSelection(old => {\n var _opts$selectChildren;\n value = typeof value !== 'undefined' ? value : !isSelected;\n if (row.getCanSelect() && isSelected === value) {\n return old;\n }\n const selectedRowIds = {\n ...old\n };\n mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table);\n return selectedRowIds;\n });\n };\n row.getIsSelected = () => {\n const {\n rowSelection\n } = table.getState();\n return isRowSelected(row, rowSelection);\n };\n row.getIsSomeSelected = () => {\n const {\n rowSelection\n } = table.getState();\n return isSubRowSelected(row, rowSelection) === 'some';\n };\n row.getIsAllSubRowsSelected = () => {\n const {\n rowSelection\n } = table.getState();\n return isSubRowSelected(row, rowSelection) === 'all';\n };\n row.getCanSelect = () => {\n var _table$options$enable;\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row);\n }\n return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;\n };\n row.getCanSelectSubRows = () => {\n var _table$options$enable2;\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row);\n }\n return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;\n };\n row.getCanMultiSelect = () => {\n var _table$options$enable3;\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row);\n }\n return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;\n };\n row.getToggleSelectedHandler = () => {\n const canSelect = row.getCanSelect();\n return e => {\n var _target;\n if (!canSelect) return;\n row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);\n };\n };\n }\n};\nconst mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => {\n var _row$subRows;\n const row = table.getRow(id, true);\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true;\n }\n } else {\n delete selectedRowIds[id];\n }\n // }\n\n if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table));\n }\n};\nfunction selectRowsFn(table, rowModel) {\n const rowSelection = table.getState().rowSelection;\n const newSelectedFlatRows = [];\n const newSelectedRowsById = {};\n\n // Filters top level and nested rows\n const recurseRows = function (rows, depth) {\n return rows.map(row => {\n var _row$subRows2;\n const isSelected = isRowSelected(row, rowSelection);\n if (isSelected) {\n newSelectedFlatRows.push(row);\n newSelectedRowsById[row.id] = row;\n }\n if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows)\n };\n }\n if (isSelected) {\n return row;\n }\n }).filter(Boolean);\n };\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById\n };\n}\nfunction isRowSelected(row, selection) {\n var _selection$row$id;\n return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;\n}\nfunction isSubRowSelected(row, selection, table) {\n var _row$subRows3;\n if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;\n let allChildrenSelected = true;\n let someSelected = false;\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return;\n }\n if (subRow.getCanSelect()) {\n if (isRowSelected(subRow, selection)) {\n someSelected = true;\n } else {\n allChildrenSelected = false;\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows && subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow, selection);\n if (subRowChildrenSelected === 'all') {\n someSelected = true;\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true;\n allChildrenSelected = false;\n } else {\n allChildrenSelected = false;\n }\n }\n });\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false;\n}\n\nconst reSplitAlphaNumeric = /([0-9]+)/gm;\nconst alphanumeric = (rowA, rowB, columnId) => {\n return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());\n};\nconst alphanumericCaseSensitive = (rowA, rowB, columnId) => {\n return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));\n};\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text = (rowA, rowB, columnId) => {\n return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());\n};\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive = (rowA, rowB, columnId) => {\n return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));\n};\nconst datetime = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId);\n const b = rowB.getValue(columnId);\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0;\n};\nconst basic = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));\n};\n\n// Utils\n\nfunction compareBasic(a, b) {\n return a === b ? 0 : a > b ? 1 : -1;\n}\nfunction toString(a) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return '';\n }\n return String(a);\n }\n if (typeof a === 'string') {\n return a;\n }\n return '';\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr, bStr) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean);\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean);\n\n // While\n while (a.length && b.length) {\n const aa = a.shift();\n const bb = b.shift();\n const an = parseInt(aa, 10);\n const bn = parseInt(bb, 10);\n const combo = [an, bn].sort();\n\n // Both are string\n if (isNaN(combo[0])) {\n if (aa > bb) {\n return 1;\n }\n if (bb > aa) {\n return -1;\n }\n continue;\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1])) {\n return isNaN(an) ? -1 : 1;\n }\n\n // Both are numbers\n if (an > bn) {\n return 1;\n }\n if (bn > an) {\n return -1;\n }\n }\n return a.length - b.length;\n}\n\n// Exports\n\nconst sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic\n};\n\n//\n\nconst RowSorting = {\n getInitialState: state => {\n return {\n sorting: [],\n ...state\n };\n },\n getDefaultColumnDef: () => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1\n };\n },\n getDefaultOptions: table => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: e => {\n return e.shiftKey;\n }\n };\n },\n createColumn: (column, table) => {\n column.getAutoSortingFn = () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10);\n let isString = false;\n for (const row of firstRows) {\n const value = row == null ? void 0 : row.getValue(column.id);\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime;\n }\n if (typeof value === 'string') {\n isString = true;\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric;\n }\n }\n }\n if (isString) {\n return sortingFns.text;\n }\n return sortingFns.basic;\n };\n column.getAutoSortDir = () => {\n const firstRow = table.getFilteredRowModel().flatRows[0];\n const value = firstRow == null ? void 0 : firstRow.getValue(column.id);\n if (typeof value === 'string') {\n return 'asc';\n }\n return 'desc';\n };\n column.getSortingFn = () => {\n var _table$options$sortin, _table$options$sortin2;\n if (!column) {\n throw new Error();\n }\n return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn];\n };\n column.toggleSorting = (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder();\n const hasManualValue = typeof desc !== 'undefined' && desc !== null;\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);\n const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);\n let newSorting = [];\n\n // What should we do with this sort action?\n let sortAction;\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';\n\n // Multi-mode\n if (old != null && old.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle';\n } else {\n sortAction = 'add';\n }\n } else {\n // Normal mode\n if (old != null && old.length && existingIndex !== old.length - 1) {\n sortAction = 'replace';\n } else if (existingSorting) {\n sortAction = 'toggle';\n } else {\n sortAction = 'replace';\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove';\n }\n }\n }\n if (sortAction === 'add') {\n var _table$options$maxMul;\n newSorting = [...old, {\n id: column.id,\n desc: nextDesc\n }];\n // Take latest n columns\n newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc\n };\n }\n return d;\n });\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id);\n } else {\n newSorting = [{\n id: column.id,\n desc: nextDesc\n }];\n }\n return newSorting;\n });\n };\n column.getFirstSortDir = () => {\n var _ref, _column$columnDef$sor;\n const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';\n return sortDescFirst ? 'desc' : 'asc';\n };\n column.getNextSortingOrder = multi => {\n var _table$options$enable, _table$options$enable2;\n const firstSortDirection = column.getFirstSortDir();\n const isSorted = column.getIsSorted();\n if (!isSorted) {\n return firstSortDirection;\n }\n if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (\n // If enableSortRemove, enable in general\n multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false;\n }\n return isSorted === 'desc' ? 'asc' : 'desc';\n };\n column.getCanSort = () => {\n var _column$columnDef$ena, _table$options$enable3;\n return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn;\n };\n column.getCanMultiSort = () => {\n var _ref2, _column$columnDef$ena2;\n return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;\n };\n column.getIsSorted = () => {\n var _table$getState$sorti;\n const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';\n };\n column.getSortIndex = () => {\n var _table$getState$sorti2, _table$getState$sorti3;\n return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1;\n };\n column.clearSorting = () => {\n //clear sorting for just 1 column\n table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);\n };\n column.getToggleSortingHandler = () => {\n const canSort = column.getCanSort();\n return e => {\n if (!canSort) return;\n e.persist == null || e.persist();\n column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);\n };\n };\n },\n createTable: table => {\n table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater);\n table.resetSorting = defaultState => {\n var _table$initialState$s, _table$initialState;\n table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);\n };\n table.getPreSortedRowModel = () => table.getGroupedRowModel();\n table.getSortedRowModel = () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table);\n }\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel();\n }\n return table._getSortedRowModel();\n };\n }\n};\n\nconst builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting,\n//depends on ColumnFaceting\nGlobalFiltering,\n//depends on ColumnFiltering\nRowSorting, ColumnGrouping,\n//depends on RowSorting\nRowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing];\n\n//\n\nfunction createTable(options) {\n var _options$_features, _options$initialState;\n if (process.env.NODE_ENV !== 'production' && (options.debugAll || options.debugTable)) {\n console.info('Creating Table Instance...');\n }\n const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])];\n let table = {\n _features\n };\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));\n }, {});\n const mergeOptions = options => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options);\n }\n return {\n ...defaultOptions,\n ...options\n };\n };\n const coreInitialState = {};\n let initialState = {\n ...coreInitialState,\n ...((_options$initialState = options.initialState) != null ? _options$initialState : {})\n };\n table._features.forEach(feature => {\n var _feature$getInitialSt;\n initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;\n });\n const queued = [];\n let queuedTimeout = false;\n const coreInstance = {\n _features,\n options: {\n ...defaultOptions,\n ...options\n },\n initialState,\n _queue: cb => {\n queued.push(cb);\n if (!queuedTimeout) {\n queuedTimeout = true;\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve().then(() => {\n while (queued.length) {\n queued.shift()();\n }\n queuedTimeout = false;\n }).catch(error => setTimeout(() => {\n throw error;\n }));\n }\n },\n reset: () => {\n table.setState(table.initialState);\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options);\n table.options = mergeOptions(newOptions);\n },\n getState: () => {\n return table.options.state;\n },\n setState: updater => {\n table.options.onStateChange == null || table.options.onStateChange(updater);\n },\n _getRowId: (row, index, parent) => {\n var _table$options$getRow;\n return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`;\n },\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table);\n }\n return table._getCoreRowModel();\n },\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel();\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id, searchAll) => {\n let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id];\n if (!row) {\n row = table.getCoreRowModel().rowsById[id];\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`);\n }\n throw new Error();\n }\n }\n return row;\n },\n _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {\n var _defaultColumn;\n defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};\n return {\n header: props => {\n const resolvedColumnDef = props.header.column.columnDef;\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey;\n }\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id;\n }\n return null;\n },\n // footer: props => props.header.column.id,\n cell: props => {\n var _props$renderValue$to, _props$renderValue;\n return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null;\n },\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());\n }, {}),\n ...defaultColumn\n };\n }, getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')),\n _getColumnDefs: () => table.options.columns,\n getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {\n const recurseColumns = function (columnDefs, parent, depth) {\n if (depth === void 0) {\n depth = 0;\n }\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent);\n const groupingColumnDef = columnDef;\n column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : [];\n return column;\n });\n };\n return recurseColumns(columnDefs);\n }, getMemoOptions(options, 'debugColumns', 'getAllColumns')),\n getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns();\n });\n }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')),\n _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {\n return flatColumns.reduce((acc, column) => {\n acc[column.id] = column;\n return acc;\n }, {});\n }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')),\n getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns());\n return orderColumns(leafColumns);\n }, getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')),\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId];\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`);\n }\n return column;\n }\n };\n Object.assign(table, coreInstance);\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index];\n feature == null || feature.createTable == null || feature.createTable(table);\n }\n return table;\n}\n\nfunction getCoreRowModel() {\n return table => memo(() => [table.options.data], data => {\n const rowModel = {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n const accessRows = function (originalRows, depth, parentRow) {\n if (depth === void 0) {\n depth = 0;\n }\n const rows = [];\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id);\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row);\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row;\n // Push table row into parent\n rows.push(row);\n\n // Get the original subrows\n if (table.options.getSubRows) {\n var _row$originalSubRows;\n row.originalSubRows = table.options.getSubRows(originalRows[i], i);\n\n // Then recursively access them\n if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row);\n }\n }\n }\n return rows;\n };\n rowModel.rows = accessRows(data);\n return rowModel;\n }, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex()));\n}\n\nfunction getExpandedRowModel() {\n return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {\n if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {\n return rowModel;\n }\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel;\n }\n return expandRows(rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel'));\n}\nfunction expandRows(rowModel) {\n const expandedRows = [];\n const handleRow = row => {\n var _row$subRows;\n expandedRows.push(row);\n if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow);\n }\n };\n rowModel.rows.forEach(handleRow);\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById\n };\n}\n\nfunction getFacetedMinMaxValues() {\n return (table, columnId) => memo(() => {\n var _table$getColumn;\n return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];\n }, facetedRowModel => {\n if (!facetedRowModel) return undefined;\n const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => {\n var _flatRow$getUniqueVal;\n return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : [];\n }).map(Number).filter(value => !Number.isNaN(value));\n if (!uniqueValues.length) return;\n let facetedMinValue = uniqueValues[0];\n let facetedMaxValue = uniqueValues[uniqueValues.length - 1];\n for (const value of uniqueValues) {\n if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value;\n }\n return [facetedMinValue, facetedMaxValue];\n }, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues'));\n}\n\nfunction filterRows(rows, filterRowImpl, table) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table);\n }\n return filterRowModelFromRoot(rows, filterRowImpl, table);\n}\nfunction filterRowModelFromLeafs(rowsToFilter, filterRow, table) {\n var _table$options$maxLea;\n const newFilteredFlatRows = [];\n const newFilteredRowsById = {};\n const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100;\n const recurseFilterRows = function (rowsToFilter, depth) {\n if (depth === void 0) {\n depth = 0;\n }\n const rows = [];\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n var _row$subRows;\n let row = rowsToFilter[i];\n const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId);\n newRow.columnFilters = row.columnFilters;\n if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1);\n row = newRow;\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row);\n newFilteredRowsById[row.id] = row;\n newFilteredFlatRows.push(row);\n continue;\n }\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row);\n newFilteredRowsById[row.id] = row;\n newFilteredFlatRows.push(row);\n continue;\n }\n } else {\n row = newRow;\n if (filterRow(row)) {\n rows.push(row);\n newFilteredRowsById[row.id] = row;\n newFilteredFlatRows.push(row);\n }\n }\n }\n return rows;\n };\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById\n };\n}\nfunction filterRowModelFromRoot(rowsToFilter, filterRow, table) {\n var _table$options$maxLea2;\n const newFilteredFlatRows = [];\n const newFilteredRowsById = {};\n const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100;\n\n // Filters top level and nested rows\n const recurseFilterRows = function (rowsToFilter, depth) {\n if (depth === void 0) {\n depth = 0;\n }\n // Filter from parents downward first\n\n const rows = [];\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i];\n const pass = filterRow(row);\n if (pass) {\n var _row$subRows2;\n if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {\n const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId);\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1);\n row = newRow;\n }\n rows.push(row);\n newFilteredFlatRows.push(row);\n newFilteredRowsById[row.id] = row;\n }\n }\n return rows;\n };\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById\n };\n}\n\nfunction getFacetedRowModel() {\n return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {\n if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {\n return preRowModel;\n }\n const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean);\n const filterRowsImpl = row => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]] === false) {\n return false;\n }\n }\n return true;\n };\n return filterRows(preRowModel.rows, filterRowsImpl, table);\n }, getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel'));\n}\n\nfunction getFacetedUniqueValues() {\n return (table, columnId) => memo(() => {\n var _table$getColumn;\n return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];\n }, facetedRowModel => {\n if (!facetedRowModel) return new Map();\n let facetedUniqueValues = new Map();\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);\n for (let j = 0; j < values.length; j++) {\n const value = values[j];\n if (facetedUniqueValues.has(value)) {\n var _facetedUniqueValues$;\n facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1);\n } else {\n facetedUniqueValues.set(value, 1);\n }\n }\n }\n return facetedUniqueValues;\n }, getMemoOptions(table.options, 'debugTable', `getFacetedUniqueValues_${columnId}`));\n}\n\nfunction getFilteredRowModel() {\n return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {\n if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i].columnFilters = {};\n rowModel.flatRows[i].columnFiltersMeta = {};\n }\n return rowModel;\n }\n const resolvedColumnFilters = [];\n const resolvedGlobalFilters = [];\n (columnFilters != null ? columnFilters : []).forEach(d => {\n var _filterFn$resolveFilt;\n const column = table.getColumn(d.id);\n if (!column) {\n return;\n }\n const filterFn = column.getFilterFn();\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`);\n }\n return;\n }\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value\n });\n });\n const filterableIds = (columnFilters != null ? columnFilters : []).map(d => d.id);\n const globalFilterFn = table.getGlobalFilterFn();\n const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter());\n if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {\n filterableIds.push('__global__');\n globallyFilterableColumns.forEach(column => {\n var _globalFilterFn$resol;\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter\n });\n });\n }\n let currentColumnFilter;\n let currentGlobalFilter;\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j];\n row.columnFilters = {};\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i];\n const id = currentColumnFilter.id;\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {\n row.columnFiltersMeta[id] = filterMeta;\n });\n }\n }\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i];\n const id = currentGlobalFilter.id;\n // Tag the row with the first truthy global filter state\n if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {\n row.columnFiltersMeta[id] = filterMeta;\n })) {\n row.columnFilters.__global__ = true;\n break;\n }\n }\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false;\n }\n }\n }\n const filterRowsImpl = row => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]] === false) {\n return false;\n }\n }\n return true;\n };\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table);\n }, getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => table._autoResetPageIndex()));\n}\n\nfunction getGroupedRowModel() {\n return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n rowModel.rows.forEach(row => {\n row.depth = 0;\n row.parentId = undefined;\n });\n return rowModel;\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));\n const groupedFlatRows = [];\n const groupedRowsById = {};\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = function (rows, depth, parentId) {\n if (depth === void 0) {\n depth = 0;\n }\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth;\n groupedFlatRows.push(row);\n groupedRowsById[row.id] = row;\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id);\n }\n return row;\n });\n }\n const columnId = existingGrouping[depth];\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId);\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {\n let [groupingValue, groupedRows] = _ref;\n let id = `${columnId}:${groupingValue}`;\n id = parentId ? `${parentId}>${id}` : id;\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id);\n subRows.forEach(subRow => {\n subRow.parentId = id;\n });\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;\n const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId);\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: columnId => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId];\n }\n if (groupedRows[0]) {\n var _groupedRows$0$getVal;\n row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;\n }\n return row._valuesCache[columnId];\n }\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId];\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId);\n const aggregateFn = column == null ? void 0 : column.getAggregationFn();\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);\n return row._groupingValuesCache[columnId];\n }\n }\n });\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow);\n groupedRowsById[subRow.id] = subRow;\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n });\n return row;\n });\n return aggregatedGroupedRows;\n };\n const groupedRows = groupUpRecursively(rowModel.rows, 0);\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow);\n groupedRowsById[subRow.id] = subRow;\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n });\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById\n };\n }, getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {\n table._queue(() => {\n table._autoResetExpanded();\n table._autoResetPageIndex();\n });\n }));\n}\nfunction groupBy(rows, columnId) {\n const groupMap = new Map();\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`;\n const previous = map.get(resKey);\n if (!previous) {\n map.set(resKey, [row]);\n } else {\n previous.push(row);\n }\n return map;\n }, groupMap);\n}\n\nfunction getPaginationRowModel(opts) {\n return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel;\n }\n const {\n pageSize,\n pageIndex\n } = pagination;\n let {\n rows,\n flatRows,\n rowsById\n } = rowModel;\n const pageStart = pageSize * pageIndex;\n const pageEnd = pageStart + pageSize;\n rows = rows.slice(pageStart, pageEnd);\n let paginatedRowModel;\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById\n });\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById\n };\n }\n paginatedRowModel.flatRows = [];\n const handleRow = row => {\n paginatedRowModel.flatRows.push(row);\n if (row.subRows.length) {\n row.subRows.forEach(handleRow);\n }\n };\n paginatedRowModel.rows.forEach(handleRow);\n return paginatedRowModel;\n }, getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel'));\n}\n\nfunction getSortedRowModel() {\n return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {\n if (!rowModel.rows.length || !(sorting != null && sorting.length)) {\n return rowModel;\n }\n const sortingState = table.getState().sorting;\n const sortedFlatRows = [];\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort => {\n var _table$getColumn;\n return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();\n });\n const columnInfoById = {};\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id);\n if (!column) return;\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn()\n };\n });\n const sortData = rows => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = rows.map(row => ({\n ...row\n }));\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n var _sortEntry$desc;\n const sortEntry = availableSorting[i];\n const columnInfo = columnInfoById[sortEntry.id];\n const sortUndefined = columnInfo.sortUndefined;\n const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;\n let sortInt = 0;\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id);\n const bValue = rowB.getValue(sortEntry.id);\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1;\n }\n if (columnInfo.invertSorting) {\n sortInt *= -1;\n }\n return sortInt;\n }\n }\n return rowA.index - rowB.index;\n });\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n var _row$subRows;\n sortedFlatRows.push(row);\n if ((_row$subRows = row.subRows) != null && _row$subRows.length) {\n row.subRows = sortData(row.subRows);\n }\n });\n return sortedData;\n };\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById\n };\n }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex()));\n}\n\nexport { ColumnFaceting, ColumnFiltering, ColumnGrouping, ColumnOrdering, ColumnPinning, ColumnSizing, ColumnVisibility, GlobalFaceting, GlobalFiltering, Headers, RowExpanding, RowPagination, RowPinning, RowSelection, RowSorting, _getVisibleLeafColumns, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getMemoOptions, getPaginationRowModel, getSortedRowModel, isFunction, isNumberArray, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns };\n//# sourceMappingURL=index.mjs.map\n","import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable = React.ReactNode | React.ComponentType\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nexport function flexRender(\n Comp: Renderable,\n props: TProps\n): React.ReactNode | React.JSX.Element {\n return !Comp ? null : isReactComponent(Comp) ? (\n \n ) : (\n Comp\n )\n}\n\nfunction isReactComponent(\n component: unknown\n): component is React.ComponentType {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport function useReactTable(\n options: TableOptions\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n tableRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n return tableRef.current\n}\n"],"names":["flexRender","Comp","props","isReactComponent","React","createElement","component","isClassComponent","isExoticComponent","proto","Object","getPrototypeOf","prototype","$$typeof","includes","description","useReactTable","options","resolvedOptions","state","onStateChange","renderFallbackValue","tableRef","useState","current","createTable","setState","initialState","setOptions","prev","updater"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACA;EACA;EACA;AACA;EACA;AACA;EACA;EACA;EACA;AACA;EACA;EACA;EACA;AACA;EACA;EACA;EACA;AACA;EACA,SAAS,kBAAkB,GAAG;EAC9B,EAAE,OAAO;EACT,IAAI,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK;EACpC,MAAM,OAAO,OAAO,QAAQ,KAAK,UAAU,GAAG;EAC9C,QAAQ,GAAG,MAAM;EACjB,QAAQ,UAAU,EAAE,QAAQ;EAC5B,OAAO,GAAG;EACV,QAAQ,GAAG,MAAM;EACjB,QAAQ,WAAW,EAAE,QAAQ;EAC7B,OAAO,CAAC;EACR,KAAK;EACL,IAAI,OAAO,EAAE,MAAM,IAAI,MAAM;EAC7B,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM;EAC3B,GAAG,CAAC;EACJ,CAAC;AACD;EACA;AACA;EACA;AACA;EACA;AACA;EACA,SAAS,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE;EAC1C,EAAE,OAAO,OAAO,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;EAClE,CAAC;EACD,SAAS,IAAI,GAAG;EAChB;EACA,CAAC;EACD,SAAS,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE;EACzC,EAAE,OAAO,OAAO,IAAI;EACpB,IAAI,QAAQ,CAAC,QAAQ,CAA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OAAO;EACVE,IAAAA,KAAK,EAAE;EACL,MAAA,GAAGA,KAAK;EACR,MAAA,GAAGF,OAAO,CAACE,KAAAA;OACZ;EACD;EACA;MACAC,aAAa,EAAEU,OAAO,IAAI;QACxBJ,QAAQ,CAACI,OAAO,CAAC,CAAA;QACjBb,OAAO,CAACG,aAAa,IAArBH,IAAAA,IAAAA,OAAO,CAACG,aAAa,CAAGU,OAAO,CAAC,CAAA;EAClC,KAAA;EACF,GAAC,CAAC,CAAC,CAAA;IAEH,OAAOR,QAAQ,CAACE,OAAO,CAAA;EACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/react-table/build/umd/index.production.js b/node_modules/@tanstack/react-table/build/umd/index.production.js new file mode 100644 index 00000000..46929bc9 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/umd/index.production.js @@ -0,0 +1,22 @@ +/** + * react-table + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTable={},e.React)}(this,(function(e,t){"use strict";function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var l=n(t); +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function o(e,t){return"function"==typeof e?e(t):e}function i(e,t){return n=>{t.setState((t=>({...t,[e]:o(n,t[e])})))}}function r(e){return e instanceof Function}function u(e){return Array.isArray(e)&&e.every((e=>"number"==typeof e))}function a(e,t){const n=[],l=e=>{e.forEach((e=>{n.push(e);const o=t(e);null!=o&&o.length&&l(o)}))};return l(e),n}function s(e,t,n){let l,o=[];return i=>{let r;n.key&&n.debug&&(r=Date.now());const u=e(i);if(!(u.length!==o.length||u.some(((e,t)=>o[t]!==e))))return l;let a;if(o=u,n.key&&n.debug&&(a=Date.now()),l=t(...u),null==n||null==n.onChange||n.onChange(l),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-r))/100,t=Math.round(100*(Date.now()-a))/100,l=t/16,o=(e,t)=>{for(e=String(e);e.length{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:l}}function d(e,t,n,l){const o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(l),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:s((()=>[e,n,t,o]),((e,t,n,l)=>({table:e,column:t,row:n,cell:l,getValue:l.getValue,renderValue:l.renderValue})),g(e.options,"debugCells"))};return e._features.forEach((l=>{null==l.createCell||l.createCell(o,n,t,e)}),{}),o}function c(e,t,n,l){var o,i;const r={...e._getDefaultColumnDef(),...t},u=r.accessorKey;let a,d=null!=(o=null!=(i=r.id)?i:u?"function"==typeof String.prototype.replaceAll?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)?o:"string"==typeof r.header?r.header:void 0;if(r.accessorFn?a=r.accessorFn:u&&(a=u.includes(".")?e=>{let t=e;for(const e of u.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[r.accessorKey]),!d)throw new Error;let c={id:`${String(d)}`,accessorFn:a,parent:l,depth:n,columnDef:r,columns:[],getFlatColumns:s((()=>[!0]),(()=>{var e;return[c,...null==(e=c.columns)?void 0:e.flatMap((e=>e.getFlatColumns()))]}),g(e.options,"debugColumns")),getLeafColumns:s((()=>[e._getOrderColumnsFn()]),(e=>{var t;if(null!=(t=c.columns)&&t.length){let t=c.columns.flatMap((e=>e.getLeafColumns()));return e(t)}return[c]}),g(e.options,"debugColumns"))};for(const t of e._features)null==t.createColumn||t.createColumn(c,e);return c}const p="debugHeaders";function f(e,t,n){var l;let o={id:null!=(l=n.id)?l:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach((t=>{null==t.createHeader||t.createHeader(o,e)})),o}const m={createTable:e=>{e.getHeaderGroups=s((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>{var i,r;const u=null!=(i=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?i:[],a=null!=(r=null==o?void 0:o.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?r:[];return w(t,[...u,...n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),...a],e)}),g(e.options,p)),e.getCenterHeaderGroups=s((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>w(t,n=n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),e,"center")),g(e.options,p)),e.getLeftHeaderGroups=s((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left]),((t,n,l)=>{var o;return w(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"left")}),g(e.options,p)),e.getRightHeaderGroups=s((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right]),((t,n,l)=>{var o;return w(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"right")}),g(e.options,p)),e.getFooterGroups=s((()=>[e.getHeaderGroups()]),(e=>[...e].reverse()),g(e.options,p)),e.getLeftFooterGroups=s((()=>[e.getLeftHeaderGroups()]),(e=>[...e].reverse()),g(e.options,p)),e.getCenterFooterGroups=s((()=>[e.getCenterHeaderGroups()]),(e=>[...e].reverse()),g(e.options,p)),e.getRightFooterGroups=s((()=>[e.getRightHeaderGroups()]),(e=>[...e].reverse()),g(e.options,p)),e.getFlatHeaders=s((()=>[e.getHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),g(e.options,p)),e.getLeftFlatHeaders=s((()=>[e.getLeftHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),g(e.options,p)),e.getCenterFlatHeaders=s((()=>[e.getCenterHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),g(e.options,p)),e.getRightFlatHeaders=s((()=>[e.getRightHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),g(e.options,p)),e.getCenterLeafHeaders=s((()=>[e.getCenterFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),g(e.options,p)),e.getLeftLeafHeaders=s((()=>[e.getLeftFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),g(e.options,p)),e.getRightLeafHeaders=s((()=>[e.getRightFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),g(e.options,p)),e.getLeafHeaders=s((()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()]),((e,t,n)=>{var l,o,i,r,u,a;return[...null!=(l=null==(o=e[0])?void 0:o.headers)?l:[],...null!=(i=null==(r=t[0])?void 0:r.headers)?i:[],...null!=(u=null==(a=n[0])?void 0:a.headers)?u:[]].map((e=>e.getLeafHeaders())).flat()}),g(e.options,p))}};function w(e,t,n,l){var o,i;let r=0;const u=function(e,t){void 0===t&&(t=1),r=Math.max(r,t),e.filter((e=>e.getIsVisible())).forEach((e=>{var n;null!=(n=e.columns)&&n.length&&u(e.columns,t+1)}),0)};u(e);let a=[];const s=(e,t)=>{const o={depth:t,id:[l,`${t}`].filter(Boolean).join("_"),headers:[]},i=[];e.forEach((e=>{const r=[...i].reverse()[0];let u,a=!1;if(e.column.depth===o.depth&&e.column.parent?u=e.column.parent:(u=e.column,a=!0),r&&(null==r?void 0:r.column)===u)r.subHeaders.push(e);else{const o=f(n,u,{id:[l,t,u.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:a,placeholderId:a?`${i.filter((e=>e.column===u)).length}`:void 0,depth:t,index:i.length});o.subHeaders.push(e),i.push(o)}o.headers.push(e),e.headerGroup=o})),a.push(o),t>0&&s(i,t-1)},g=t.map(((e,t)=>f(n,e,{depth:r,index:t})));s(g,r-1),a.reverse();const d=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,n=0,l=[0];e.subHeaders&&e.subHeaders.length?(l=[],d(e.subHeaders).forEach((e=>{let{colSpan:n,rowSpan:o}=e;t+=n,l.push(o)}))):t=1;return n+=Math.min(...l),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}}));return d(null!=(o=null==(i=a[0])?void 0:i.headers)?o:[]),a}const h=(e,t,n,l,o,i,r)=>{let u={id:t,index:l,original:n,depth:o,parentId:r,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(u._valuesCache.hasOwnProperty(t))return u._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(u._valuesCache[t]=n.accessorFn(u.original,l),u._valuesCache[t]):void 0},getUniqueValues:t=>{if(u._uniqueValuesCache.hasOwnProperty(t))return u._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(u._uniqueValuesCache[t]=n.columnDef.getUniqueValues(u.original,l),u._uniqueValuesCache[t]):(u._uniqueValuesCache[t]=[u.getValue(t)],u._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=u.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=i?i:[],getLeafRows:()=>a(u.subRows,(e=>e.subRows)),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let e=[],t=u;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:s((()=>[e.getAllLeafColumns()]),(t=>t.map((t=>d(e,u,t,t.id)))),g(e.options,"debugRows")),_getAllCellsByColumnId:s((()=>[u.getAllCells()]),(e=>e.reduce(((e,t)=>(e[t.column.id]=t,e)),{})),g(e.options,"debugRows"))};for(let t=0;t{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},C=(e,t,n)=>{var l,o;const i=null==n||null==(l=n.toString())?void 0:l.toLowerCase();return Boolean(null==(o=e.getValue(t))||null==(o=o.toString())||null==(o=o.toLowerCase())?void 0:o.includes(i))};C.autoRemove=e=>_(e);const v=(e,t,n)=>{var l;return Boolean(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.includes(n))};v.autoRemove=e=>_(e);const R=(e,t,n)=>{var l;return(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.toLowerCase())===(null==n?void 0:n.toLowerCase())};R.autoRemove=e=>_(e);const b=(e,t,n)=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)};b.autoRemove=e=>_(e);const F=(e,t,n)=>!n.some((n=>{var l;return!(null!=(l=e.getValue(t))&&l.includes(n))}));F.autoRemove=e=>_(e)||!(null!=e&&e.length);const M=(e,t,n)=>n.some((n=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)}));M.autoRemove=e=>_(e)||!(null!=e&&e.length);const V=(e,t,n)=>e.getValue(t)===n;V.autoRemove=e=>_(e);const P=(e,t,n)=>e.getValue(t)==n;P.autoRemove=e=>_(e);const I=(e,t,n)=>{let[l,o]=n;const i=e.getValue(t);return i>=l&&i<=o};I.resolveFilterValue=e=>{let[t,n]=e,l="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,i=null===t||Number.isNaN(l)?-1/0:l,r=null===n||Number.isNaN(o)?1/0:o;if(i>r){const e=i;i=r,r=e}return[i,r]},I.autoRemove=e=>_(e)||_(e[0])&&_(e[1]);const x={includesString:C,includesStringSensitive:v,equalsString:R,arrIncludes:b,arrIncludesAll:F,arrIncludesSome:M,equals:V,weakEquals:P,inNumberRange:I};function _(e){return null==e||""===e}const y={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:i("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],l=null==n?void 0:n.getValue(e.id);return"string"==typeof l?x.includesString:"number"==typeof l?x.inNumberRange:"boolean"==typeof l||null!==l&&"object"==typeof l?x.equals:Array.isArray(l)?x.arrIncludes:x.weakEquals},e.getFilterFn=()=>{var n,l;return r(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(l=t.options.filterFns)?void 0:l[e.columnDef.filterFn])?n:x[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,l,o;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(l=t.options.enableColumnFilters)||l)&&(null==(o=t.options.enableFilters)||o)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find((t=>t.id===e.id)))?void 0:n.value},e.getFilterIndex=()=>{var n,l;return null!=(n=null==(l=t.getState().columnFilters)?void 0:l.findIndex((t=>t.id===e.id)))?n:-1},e.setFilterValue=n=>{t.setColumnFilters((t=>{const l=e.getFilterFn(),i=null==t?void 0:t.find((t=>t.id===e.id)),r=o(n,i?i.value:void 0);var u;if(E(l,r,e))return null!=(u=null==t?void 0:t.filter((t=>t.id!==e.id)))?u:[];const a={id:e.id,value:r};var s;return i?null!=(s=null==t?void 0:t.map((t=>t.id===e.id?a:t)))?s:[]:null!=t&&t.length?[...t,a]:[a]}))}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange((e=>{var l;return null==(l=o(t,e))?void 0:l.filter((e=>{const t=n.find((t=>t.id===e.id));if(t){if(E(t.getFilterFn(),e.value,t))return!1}return!0}))}))},e.resetColumnFilters=t=>{var n,l;e.setColumnFilters(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function E(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const G={sum:(e,t,n)=>n.reduce(((t,n)=>{const l=n.getValue(e);return t+("number"==typeof l?l:0)}),0),min:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l>n||void 0===l&&n>=n)&&(l=n)})),l},max:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l=n)&&(l=n)})),l},extent:(e,t,n)=>{let l,o;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(void 0===l?n>=n&&(l=o=n):(l>n&&(l=n),o{let n=0,l=0;if(t.forEach((t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,l+=o)})),n)return l/n},median:(e,t)=>{if(!t.length)return;const n=t.map((t=>t.getValue(e)));if(!u(n))return;if(1===n.length)return n[0];const l=Math.floor(n.length/2),o=n.sort(((e,t)=>e-t));return n.length%2!=0?o[l]:(o[l-1]+o[l])/2},unique:(e,t)=>Array.from(new Set(t.map((t=>t.getValue(e)))).values()),uniqueCount:(e,t)=>new Set(t.map((t=>t.getValue(e)))).size,count:(e,t)=>t.length},z={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:i("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping((t=>null!=t&&t.includes(e.id)?t.filter((t=>t!==e.id)):[...null!=t?t:[],e.id]))},e.getCanGroup=()=>{var n,l;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(l=t.options.enableGrouping)||l)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],l=null==n?void 0:n.getValue(e.id);return"number"==typeof l?G.sum:"[object Date]"===Object.prototype.toString.call(l)?G.extent:void 0},e.getAggregationFn=()=>{var n,l;if(!e)throw new Error;return r(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(l=t.options.aggregationFns)?void 0:l[e.columnDef.aggregationFn])?n:G[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,l;e.setGrouping(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const l=t.getColumn(n);return null!=l&&l.columnDef.getGroupingValue?(e._groupingValuesCache[n]=l.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,l)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}};function A(e,t,n){if(null==t||!t.length||!n)return e;const l=e.filter((e=>!t.includes(e.id)));if("remove"===n)return l;return[...t.map((t=>e.find((e=>e.id===t)))).filter(Boolean),...l]}const D={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:i("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=s((e=>[k(t,e)]),(t=>t.findIndex((t=>t.id===e.id))),g(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var l;return(null==(l=k(t,n)[0])?void 0:l.id)===e.id},e.getIsLastColumn=n=>{var l;const o=k(t,n);return(null==(l=o[o.length-1])?void 0:l.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=s((()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode]),((e,t,n)=>l=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...l];for(;n.length&&t.length;){const e=t.shift(),l=n.findIndex((t=>t.id===e));l>-1&&o.push(n.splice(l,1)[0])}o=[...o,...n]}else o=l;return A(o,t,n)}),g(e.options,"debugTable"))}},L={getInitialState:e=>({columnPinning:{left:[],right:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:i("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const l=e.getLeafColumns().map((e=>e.id)).filter(Boolean);t.setColumnPinning((e=>{var t,o,i,r,u,a;return"right"===n?{left:(null!=(i=null==e?void 0:e.left)?i:[]).filter((e=>!(null!=l&&l.includes(e)))),right:[...(null!=(r=null==e?void 0:e.right)?r:[]).filter((e=>!(null!=l&&l.includes(e)))),...l]}:"left"===n?{left:[...(null!=(u=null==e?void 0:e.left)?u:[]).filter((e=>!(null!=l&&l.includes(e)))),...l],right:(null!=(a=null==e?void 0:e.right)?a:[]).filter((e=>!(null!=l&&l.includes(e))))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter((e=>!(null!=l&&l.includes(e)))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter((e=>!(null!=l&&l.includes(e))))}}))},e.getCanPin=()=>e.getLeafColumns().some((e=>{var n,l,o;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(l=null!=(o=t.options.enableColumnPinning)?o:t.options.enablePinning)||l)})),e.getIsPinned=()=>{const n=e.getLeafColumns().map((e=>e.id)),{left:l,right:o}=t.getState().columnPinning,i=n.some((e=>null==l?void 0:l.includes(e))),r=n.some((e=>null==o?void 0:o.includes(e)));return i?"left":!!r&&"right"},e.getPinnedIndex=()=>{var n,l;const o=e.getIsPinned();return o?null!=(n=null==(l=t.getState().columnPinning)||null==(l=l[o])?void 0:l.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=s((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.column.id)))}),g(t.options,"debugRows")),e.getLeftVisibleCells=s((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"left"})))),g(t.options,"debugRows")),e.getRightVisibleCells=s((()=>[e._getAllVisibleCells(),t.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"right"})))),g(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,l;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(l=e.initialState)?void 0:l.columnPinning)?n:{left:[],right:[]})},e.getIsSomeColumnsPinned=t=>{var n;const l=e.getState().columnPinning;var o,i;return t?Boolean(null==(n=l[t])?void 0:n.length):Boolean((null==(o=l.left)?void 0:o.length)||(null==(i=l.right)?void 0:i.length))},e.getLeftLeafColumns=s((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),g(e.options,"debugColumns")),e.getRightLeafColumns=s((()=>[e.getAllLeafColumns(),e.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),g(e.options,"debugColumns")),e.getCenterLeafColumns=s((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.id)))}),g(e.options,"debugColumns"))}};const H={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},O={getDefaultColumnDef:()=>H,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:i("columnSizing",e),onColumnSizingInfoChange:i("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,l,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:H.minSize,null!=(l=null!=i?i:e.columnDef.size)?l:H.size),null!=(o=e.columnDef.maxSize)?o:H.maxSize)},e.getStart=s((e=>[e,k(t,e),t.getState().columnSizing]),((t,n)=>n.slice(0,e.getIndex(t)).reduce(((e,t)=>e+t.getSize()),0)),g(t.options,"debugColumns")),e.getAfter=s((e=>[e,k(t,e),t.getState().columnSizing]),((t,n)=>n.slice(e.getIndex(t)+1).reduce(((e,t)=>e+t.getSize()),0)),g(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing((t=>{let{[e.id]:n,...l}=t;return l}))},e.getCanResize=()=>{var n,l;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(l=t.options.enableColumnResizing)||l)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const n=e=>{var l;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(l=e.column.getSize())?l:0};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{const l=t.getColumn(e.column.id),o=null==l?void 0:l.getCanResize();return i=>{if(!l||!o)return;if(null==i.persist||i.persist(),q(i)&&i.touches&&i.touches.length>1)return;const r=e.getSize(),u=e?e.getLeafHeaders().map((e=>[e.column.id,e.column.getSize()])):[[l.id,l.getSize()]],a=q(i)?Math.round(i.touches[0].clientX):i.clientX,s={},g=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo((e=>{var l,o;const i="rtl"===t.options.columnResizeDirection?-1:1,r=(n-(null!=(l=null==e?void 0:e.startOffset)?l:0))*i,u=Math.max(r/(null!=(o=null==e?void 0:e.startSize)?o:0),-.999999);return e.columnSizingStart.forEach((e=>{let[t,n]=e;s[t]=Math.round(100*Math.max(n+n*u,0))/100})),{...e,deltaOffset:r,deltaPercentage:u}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...s}))))},d=e=>g("move",e),c=e=>{g("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},p=n||("undefined"!=typeof document?document:null);const f={moveHandler:e=>d(e.clientX),upHandler:e=>{null==p||p.removeEventListener("mousemove",f.moveHandler),null==p||p.removeEventListener("mouseup",f.upHandler),c(e.clientX)}},m={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{var t;null==p||p.removeEventListener("touchmove",m.moveHandler),null==p||p.removeEventListener("touchend",m.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),c(null==(t=e.touches[0])?void 0:t.clientX)}},w=!!B()&&{passive:!1};q(i)?(null==p||p.addEventListener("touchmove",m.moveHandler,w),null==p||p.addEventListener("touchend",m.upHandler,w)):(null==p||p.addEventListener("mousemove",f.moveHandler,w),null==p||p.addEventListener("mouseup",f.upHandler,w)),t.setColumnSizingInfo((e=>({...e,startOffset:a,startSize:r,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:l.id})))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0}}};let T=null;function B(){if("boolean"==typeof T)return T;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return T=e,T}function q(e){return"touchstart"===e.type}const j={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:i("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility((t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()})))},e.getIsVisible=()=>{var n,l;const o=e.columns;return null==(n=o.length?o.some((e=>e.getIsVisible())):null==(l=t.getState().columnVisibility)?void 0:l[e.id])||n},e.getCanHide=()=>{var n,l;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(l=t.options.enableHiding)||l)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=s((()=>[e.getAllCells(),t.getState().columnVisibility]),(e=>e.filter((e=>e.column.getIsVisible()))),g(t.options,"debugRows")),e.getVisibleCells=s((()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()]),((e,t,n)=>[...e,...t,...n]),g(t.options,"debugRows"))},createTable:e=>{const t=(t,n)=>s((()=>[n(),n().filter((e=>e.getIsVisible())).map((e=>e.id)).join("_")]),(e=>e.filter((e=>null==e.getIsVisible?void 0:e.getIsVisible()))),g(e.options,"debugColumns"));e.getVisibleFlatColumns=t(0,(()=>e.getAllFlatColumns())),e.getVisibleLeafColumns=t(0,(()=>e.getAllLeafColumns())),e.getLeftVisibleLeafColumns=t(0,(()=>e.getLeftLeafColumns())),e.getRightVisibleLeafColumns=t(0,(()=>e.getRightLeafColumns())),e.getCenterVisibleLeafColumns=t(0,(()=>e.getCenterLeafColumns())),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce(((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())})),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some((e=>!(null!=e.getIsVisible&&e.getIsVisible()))),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some((e=>null==e.getIsVisible?void 0:e.getIsVisible())),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}};function k(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const N={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},U={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:i("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const l=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof l||"number"==typeof l}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,l,o,i;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(l=t.options.enableGlobalFilter)||l)&&(null==(o=t.options.enableFilters)||o)&&(null==(i=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||i)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>x.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:l}=e.options;return r(l)?l:"auto"===l?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[l])?t:x[l]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},$={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:i("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var l,o;if(t){if(null!=(l=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?l:!e.options.manualExpanding){if(n)return;n=!0,e._queue((()=>{e.resetExpanded(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,l;e.setExpanded(t?{}:null!=(n=null==(l=e.initialState)?void 0:l.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some((e=>e.getCanExpand())),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some((e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((e=>{const n=e.split(".");t=Math.max(t,n.length)})),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded((l=>{var o;const i=!0===l||!(null==l||!l[e.id]);let r={};if(!0===l?Object.keys(t.getRowModel().rowsById).forEach((e=>{r[e]=!0})):r=l,n=null!=(o=n)?o:!i,!i&&n)return{...r,[e.id]:!0};if(i&&!n){const{[e.id]:t,...n}=r;return n}return l}))},e.getIsExpanded=()=>{var n;const l=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===l||(null==l?void 0:l[e.id]))},e.getCanExpand=()=>{var n,l,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(l=t.options.enableExpanding)||l)&&!(null==(o=e.subRows)||!o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,l=e;for(;n&&l.parentId;)l=t.getRow(l.parentId,!0),n=l.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},X={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:i("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var l,o;if(t){if(null!=(l=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?l:!e.options.manualPagination){if(n)return;n=!0,e._queue((()=>{e.resetPageIndex(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange((e=>o(t,e))),e.resetPagination=t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},e.setPageIndex=t=>{e.setPagination((n=>{let l=o(t,n.pageIndex);const i=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return l=Math.max(0,Math.min(l,i)),{...n,pageIndex:l}}))},e.resetPageIndex=t=>{var n,l;e.setPageIndex(t?0:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageIndex)?n:0)},e.resetPageSize=t=>{var n,l;e.setPageSize(t?10:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination((e=>{const n=Math.max(1,o(t,e.pageSize)),l=e.pageSize*e.pageIndex,i=Math.floor(l/n);return{...e,pageIndex:i,pageSize:n}}))},e.setPageCount=t=>e.setPagination((n=>{var l;let i=o(t,null!=(l=e.options.pageCount)?l:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...n,pageCount:i}})),e.getPageOptions=s((()=>[e.getPageCount()]),(e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map(((e,t)=>t))),t}),g(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&te.setPageIndex((e=>e-1)),e.nextPage=()=>e.setPageIndex((e=>e+1)),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},K={getInitialState:e=>({rowPinning:{top:[],bottom:[]},...e}),getDefaultOptions:e=>({onRowPinningChange:i("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,l,o)=>{const i=l?e.getLeafRows().map((e=>{let{id:t}=e;return t})):[],r=o?e.getParentRows().map((e=>{let{id:t}=e;return t})):[],u=new Set([...r,e.id,...i]);t.setRowPinning((e=>{var t,l,o,i,r,a;return"bottom"===n?{top:(null!=(o=null==e?void 0:e.top)?o:[]).filter((e=>!(null!=u&&u.has(e)))),bottom:[...(null!=(i=null==e?void 0:e.bottom)?i:[]).filter((e=>!(null!=u&&u.has(e)))),...Array.from(u)]}:"top"===n?{top:[...(null!=(r=null==e?void 0:e.top)?r:[]).filter((e=>!(null!=u&&u.has(e)))),...Array.from(u)],bottom:(null!=(a=null==e?void 0:e.bottom)?a:[]).filter((e=>!(null!=u&&u.has(e))))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter((e=>!(null!=u&&u.has(e)))),bottom:(null!=(l=null==e?void 0:e.bottom)?l:[]).filter((e=>!(null!=u&&u.has(e))))}}))},e.getCanPin=()=>{var n;const{enableRowPinning:l,enablePinning:o}=t.options;return"function"==typeof l?l(e):null==(n=null!=l?l:o)||n},e.getIsPinned=()=>{const n=[e.id],{top:l,bottom:o}=t.getState().rowPinning,i=n.some((e=>null==l?void 0:l.includes(e))),r=n.some((e=>null==o?void 0:o.includes(e)));return i?"top":!!r&&"bottom"},e.getPinnedIndex=()=>{var n,l;const o=e.getIsPinned();if(!o)return-1;const i=null==(n="top"===o?t.getTopRows():t.getBottomRows())?void 0:n.map((e=>{let{id:t}=e;return t}));return null!=(l=null==i?void 0:i.indexOf(e.id))?l:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,l;return e.setRowPinning(t?{top:[],bottom:[]}:null!=(n=null==(l=e.initialState)?void 0:l.rowPinning)?n:{top:[],bottom:[]})},e.getIsSomeRowsPinned=t=>{var n;const l=e.getState().rowPinning;var o,i;return t?Boolean(null==(n=l[t])?void 0:n.length):Boolean((null==(o=l.top)?void 0:o.length)||(null==(i=l.bottom)?void 0:i.length))},e._getPinnedRows=(t,n,l)=>{var o;return(null==(o=e.options.keepPinnedRows)||o?(null!=n?n:[]).map((t=>{const n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null})):(null!=n?n:[]).map((e=>t.find((t=>t.id===e))))).filter(Boolean).map((e=>({...e,position:l})))},e.getTopRows=s((()=>[e.getRowModel().rows,e.getState().rowPinning.top]),((t,n)=>e._getPinnedRows(t,n,"top")),g(e.options,"debugRows")),e.getBottomRows=s((()=>[e.getRowModel().rows,e.getState().rowPinning.bottom]),((t,n)=>e._getPinnedRows(t,n,"bottom")),g(e.options,"debugRows")),e.getCenterRows=s((()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom]),((e,t,n)=>{const l=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter((e=>!l.has(e.id)))}),g(e.options,"debugRows"))}},J={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:i("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection((n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const l={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach((e=>{e.getCanSelect()&&(l[e.id]=!0)})):o.forEach((e=>{delete l[e.id]})),l}))},e.toggleAllPageRowsSelected=t=>e.setRowSelection((n=>{const l=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach((t=>{Q(o,t.id,l,!0,e)})),o})),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=s((()=>[e.getState().rowSelection,e.getCoreRowModel()]),((t,n)=>Object.keys(t).length?W(e,n):{rows:[],flatRows:[],rowsById:{}}),g(e.options,"debugTable")),e.getFilteredSelectedRowModel=s((()=>[e.getState().rowSelection,e.getFilteredRowModel()]),((t,n)=>Object.keys(t).length?W(e,n):{rows:[],flatRows:[],rowsById:{}}),g(e.options,"debugTable")),e.getGroupedSelectedRowModel=s((()=>[e.getState().rowSelection,e.getSortedRowModel()]),((t,n)=>Object.keys(t).length?W(e,n):{rows:[],flatRows:[],rowsById:{}}),g(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let l=Boolean(t.length&&Object.keys(n).length);return l&&t.some((e=>e.getCanSelect()&&!n[e.id]))&&(l=!1),l},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter((e=>e.getCanSelect())),{rowSelection:n}=e.getState();let l=!!t.length;return l&&t.some((e=>!n[e.id]))&&(l=!1),l},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter((e=>e.getCanSelect())).some((e=>e.getIsSelected()||e.getIsSomeSelected()))},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,l)=>{const o=e.getIsSelected();t.setRowSelection((i=>{var r;if(n=void 0!==n?n:!o,e.getCanSelect()&&o===n)return i;const u={...i};return Q(u,e.id,n,null==(r=null==l?void 0:l.selectChildren)||r,t),u}))},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return Y(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===Z(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===Z(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var l;t&&e.toggleSelected(null==(l=n.target)?void 0:l.checked)}}}},Q=(e,t,n,l,o)=>{var i;const r=o.getRow(t,!0);n?(r.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),r.getCanSelect()&&(e[t]=!0)):delete e[t],l&&null!=(i=r.subRows)&&i.length&&r.getCanSelectSubRows()&&r.subRows.forEach((t=>Q(e,t.id,n,l,o)))};function W(e,t){const n=e.getState().rowSelection,l=[],o={},i=function(e,t){return e.map((e=>{var t;const r=Y(e,n);if(r&&(l.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:i(e.subRows)}),r)return e})).filter(Boolean)};return{rows:i(t.rows),flatRows:l,rowsById:o}}function Y(e,t){var n;return null!=(n=t[e.id])&&n}function Z(e,t,n){var l;if(null==(l=e.subRows)||!l.length)return!1;let o=!0,i=!1;return e.subRows.forEach((e=>{if((!i||o)&&(e.getCanSelect()&&(Y(e,t)?i=!0:o=!1),e.subRows&&e.subRows.length)){const n=Z(e,t);"all"===n?i=!0:"some"===n?(i=!0,o=!1):o=!1}})),o?"all":!!i&&"some"}const ee=/([0-9]+)/gm;function te(e,t){return e===t?0:e>t?1:-1}function ne(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function le(e,t){const n=e.split(ee).filter(Boolean),l=t.split(ee).filter(Boolean);for(;n.length&&l.length;){const e=n.shift(),t=l.shift(),o=parseInt(e,10),i=parseInt(t,10),r=[o,i].sort();if(isNaN(r[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(r[1]))return isNaN(o)?-1:1;if(o>i)return 1;if(i>o)return-1}}return n.length-l.length}const oe={alphanumeric:(e,t,n)=>le(ne(e.getValue(n)).toLowerCase(),ne(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>le(ne(e.getValue(n)),ne(t.getValue(n))),text:(e,t,n)=>te(ne(e.getValue(n)).toLowerCase(),ne(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>te(ne(e.getValue(n)),ne(t.getValue(n))),datetime:(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:lte(e.getValue(n),t.getValue(n))},ie={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:i("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let l=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return oe.datetime;if("string"==typeof n&&(l=!0,n.split(ee).length>1))return oe.alphanumeric}return l?oe.text:oe.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,l;if(!e)throw new Error;return r(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(l=t.options.sortingFns)?void 0:l[e.columnDef.sortingFn])?n:oe[e.columnDef.sortingFn]},e.toggleSorting=(n,l)=>{const o=e.getNextSortingOrder(),i=null!=n;t.setSorting((r=>{const u=null==r?void 0:r.find((t=>t.id===e.id)),a=null==r?void 0:r.findIndex((t=>t.id===e.id));let s,g=[],d=i?n:"desc"===o;var c;(s=null!=r&&r.length&&e.getCanMultiSort()&&l?u?"toggle":"add":null!=r&&r.length&&a!==r.length-1?"replace":u?"toggle":"replace","toggle"===s&&(i||o||(s="remove")),"add"===s)?(g=[...r,{id:e.id,desc:d}],g.splice(0,g.length-(null!=(c=t.options.maxMultiSortColCount)?c:Number.MAX_SAFE_INTEGER))):g="toggle"===s?r.map((t=>t.id===e.id?{...t,desc:d}:t)):"remove"===s?r.filter((t=>t.id!==e.id)):[{id:e.id,desc:d}];return g}))},e.getFirstSortDir=()=>{var n,l;return(null!=(n=null!=(l=e.columnDef.sortDescFirst)?l:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var l,o;const i=e.getFirstSortDir(),r=e.getIsSorted();return r?!!(r===i||null!=(l=t.options.enableSortingRemoval)&&!l||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===r?"asc":"desc"):i},e.getCanSort=()=>{var n,l;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(l=t.options.enableSorting)||l)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,l;return null!=(n=null!=(l=e.columnDef.enableMultiSort)?l:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const l=null==(n=t.getState().sorting)?void 0:n.find((t=>t.id===e.id));return!!l&&(l.desc?"desc":"asc")},e.getSortIndex=()=>{var n,l;return null!=(n=null==(l=t.getState().sorting)?void 0:l.findIndex((t=>t.id===e.id)))?n:-1},e.clearSorting=()=>{t.setSorting((t=>null!=t&&t.length?t.filter((t=>t.id!==e.id)):[]))},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return l=>{n&&(null==l.persist||l.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(l))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,l;e.setSorting(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},re=[m,j,D,L,S,y,N,U,ie,z,$,X,K,J,O];function ue(e){var t,n;const l=[...re,...null!=(t=e._features)?t:[]];let i={_features:l};const r=i._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(i))),{});let u={...null!=(n=e.initialState)?n:{}};i._features.forEach((e=>{var t;u=null!=(t=null==e.getInitialState?void 0:e.getInitialState(u))?t:u}));const a=[];let d=!1;const p={_features:l,options:{...r,...e},initialState:u,_queue:e=>{a.push(e),d||(d=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();d=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{const t=o(e,i.options);i.options=(e=>i.options.mergeOptions?i.options.mergeOptions(r,e):{...r,...e})(t)},getState:()=>i.options.state,setState:e=>{null==i.options.onStateChange||i.options.onStateChange(e)},_getRowId:(e,t,n)=>{var l;return null!=(l=null==i.options.getRowId?void 0:i.options.getRowId(e,t,n))?l:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?i.getPrePaginationRowModel():i.getRowModel()).rowsById[e];if(!n&&(n=i.getCoreRowModel().rowsById[e],!n))throw new Error;return n},_getDefaultColumnDef:s((()=>[i.options.defaultColumn]),(e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...i._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef())),{}),...e}}),g(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:s((()=>[i._getColumnDefs()]),(e=>{const t=function(e,n,l){return void 0===l&&(l=0),e.map((e=>{const o=c(i,e,l,n),r=e;return o.columns=r.columns?t(r.columns,o,l+1):[],o}))};return t(e)}),g(e,"debugColumns")),getAllFlatColumns:s((()=>[i.getAllColumns()]),(e=>e.flatMap((e=>e.getFlatColumns()))),g(e,"debugColumns")),_getAllFlatColumnsById:s((()=>[i.getAllFlatColumns()]),(e=>e.reduce(((e,t)=>(e[t.id]=t,e)),{})),g(e,"debugColumns")),getAllLeafColumns:s((()=>[i.getAllColumns(),i._getOrderColumnsFn()]),((e,t)=>t(e.flatMap((e=>e.getLeafColumns())))),g(e,"debugColumns")),getColumn:e=>i._getAllFlatColumnsById()[e]};Object.assign(i,p);for(let e=0;e{var l;t.push(e),null!=(l=e.subRows)&&l.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function se(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const a=[];for(let g=0;g"function"==typeof e?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}},e.createRow=h,e.createTable=ue,e.defaultColumnSizing=H,e.expandRows=ae,e.filterFns=x,e.flattenBy=a,e.flexRender=function(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(n=e)||"function"==typeof n||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(n)?l.createElement(e,t):e:null;var n},e.functionalUpdate=o,e.getCoreRowModel=function(){return e=>s((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},l=function(t,o,i){void 0===o&&(o=0);const r=[];for(let a=0;ae._autoResetPageIndex())))},e.getExpandedRowModel=function(){return e=>s((()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows]),((e,t,n)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:n?ae(t):t),g(e.options,"debugTable"))},e.getFacetedMinMaxValues=function(){return(e,t)=>s((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{if(!e)return;const n=e.flatRows.flatMap((e=>{var n;return null!=(n=e.getUniqueValues(t))?n:[]})).map(Number).filter((e=>!Number.isNaN(e)));if(!n.length)return;let l=n[0],o=n[n.length-1];for(const e of n)eo&&(o=e);return[l,o]}),g(e.options,"debugTable"))},e.getFacetedRowModel=function(){return(e,t)=>s((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()]),((n,l,o)=>{if(!n.rows.length||(null==l||!l.length)&&!o)return n;const i=[...l.map((e=>e.id)).filter((e=>e!==t)),o?"__global__":void 0].filter(Boolean);return se(n.rows,(e=>{for(let t=0;ts((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{if(!e)return new Map;let n=new Map;for(let o=0;os((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,l)=>{if(!t.rows.length||(null==n||!n.length)&&!l){for(let e=0;e{var n;const l=e.getColumn(t.id);if(!l)return;const i=l.getFilterFn();i&&o.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})}));const r=(null!=n?n:[]).map((e=>e.id)),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,g;l&&u&&a.length&&(r.push("__global__"),a.forEach((e=>{var t;i.push({id:e.id,filterFn:u,resolvedValue:null!=(t=null==u.resolveFilterValue?void 0:u.resolveFilterValue(l))?t:l})})));for(let e=0;e{n.columnFiltersMeta[t]=e}))}if(i.length){for(let e=0;e{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return se(t.rows,(e=>{for(let t=0;te._autoResetPageIndex())))},e.getGroupedRowModel=function(){return e=>s((()=>[e.getState().grouping,e.getPreGroupedRowModel()]),((t,n)=>{if(!n.rows.length||!t.length)return n.rows.forEach((e=>{e.depth=0,e.parentId=void 0})),n;const l=t.filter((t=>e.getColumn(t))),o=[],i={},r=function(t,n,u){if(void 0===n&&(n=0),n>=l.length)return t.map((e=>(e.depth=n,o.push(e),i[e.id]=e,e.subRows&&(e.subRows=r(e.subRows,n+1,e.id)),e)));const s=l[n],g=function(e,t){const n=new Map;return e.reduce(((e,n)=>{const l=`${n.getGroupingValue(t)}`,o=e.get(l);return o?o.push(n):e.set(l,[n]),e}),n)}(t,s),d=Array.from(g.entries()).map(((t,g)=>{let[d,c]=t,p=`${s}:${d}`;p=u?`${u}>${p}`:p;const f=r(c,n+1,p);f.forEach((e=>{e.parentId=p}));const m=n?a(c,(e=>e.subRows)):c,w=h(e,p,m[0].original,g,n,void 0,u);return Object.assign(w,{groupingColumnId:s,groupingValue:d,subRows:f,leafRows:m,getValue:t=>{if(l.includes(t)){if(w._valuesCache.hasOwnProperty(t))return w._valuesCache[t];var n;if(c[0])w._valuesCache[t]=null!=(n=c[0].getValue(t))?n:void 0;return w._valuesCache[t]}if(w._groupingValuesCache.hasOwnProperty(t))return w._groupingValuesCache[t];const o=e.getColumn(t),i=null==o?void 0:o.getAggregationFn();return i?(w._groupingValuesCache[t]=i(t,m,c),w._groupingValuesCache[t]):void 0}}),f.forEach((e=>{o.push(e),i[e.id]=e})),w}));return d},u=r(n.rows,0);return u.forEach((e=>{o.push(e),i[e.id]=e})),{rows:u,flatRows:o,rowsById:i}}),g(e.options,"debugTable",0,(()=>{e._queue((()=>{e._autoResetExpanded(),e._autoResetPageIndex()}))})))},e.getMemoOptions=g,e.getPaginationRowModel=function(e){return e=>s((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:l,pageIndex:o}=t;let{rows:i,flatRows:r,rowsById:u}=n;const a=l*o,s=a+l;let g;i=i.slice(a,s),g=e.options.paginateExpandedRows?{rows:i,flatRows:r,rowsById:u}:ae({rows:i,flatRows:r,rowsById:u}),g.flatRows=[];const d=e=>{g.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d)};return g.rows.forEach(d),g}),g(e.options,"debugTable"))},e.getSortedRowModel=function(){return e=>s((()=>[e.getState().sorting,e.getPreSortedRowModel()]),((t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const l=e.getState().sorting,o=[],i=l.filter((t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()})),r={};i.forEach((t=>{const n=e.getColumn(t.id);n&&(r[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})}));const u=e=>{const t=e.map((e=>({...e})));return t.sort(((e,t)=>{for(let l=0;l{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=u(e.subRows))})),t};return{rows:u(n.rows),flatRows:o,rowsById:n.rowsById}}),g(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))},e.isFunction=r,e.isNumberArray=u,e.isRowSelected=Y,e.isSubRowSelected=Z,e.makeStateUpdater=i,e.memo=s,e.noop=function(){},e.orderColumns=A,e.passiveEventSupported=B,e.reSplitAlphaNumeric=ee,e.selectRowsFn=W,e.shouldAutoRemoveFilter=E,e.sortingFns=oe,e.useReactTable=function(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=l.useState((()=>({current:ue(t)}))),[o,i]=l.useState((()=>n.current.initialState));return n.current.setOptions((t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}}))),n.current}})); +//# sourceMappingURL=index.production.js.map diff --git a/node_modules/@tanstack/react-table/build/umd/index.production.js.map b/node_modules/@tanstack/react-table/build/umd/index.production.js.map new file mode 100644 index 00000000..95b60776 --- /dev/null +++ b/node_modules/@tanstack/react-table/build/umd/index.production.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.production.js","sources":["../../../table-core/build/lib/index.mjs","../../src/index.tsx"],"sourcesContent":["/**\n * table-core\n *\n * Copyright (c) TanStack\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nfunction createColumnHelper() {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function' ? {\n ...column,\n accessorFn: accessor\n } : {\n ...column,\n accessorKey: accessor\n };\n },\n display: column => column,\n group: column => column\n };\n}\n\n// Is this type a tuple?\n\n// If this type is a tuple, what indices are allowed?\n\n///\n\nfunction functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\nfunction noop() {\n //\n}\nfunction makeStateUpdater(key, instance) {\n return updater => {\n instance.setState(old => {\n return {\n ...old,\n [key]: functionalUpdate(updater, old[key])\n };\n });\n };\n}\nfunction isFunction(d) {\n return d instanceof Function;\n}\nfunction isNumberArray(d) {\n return Array.isArray(d) && d.every(val => typeof val === 'number');\n}\nfunction flattenBy(arr, getChildren) {\n const flat = [];\n const recurse = subArr => {\n subArr.forEach(item => {\n flat.push(item);\n const children = getChildren(item);\n if (children != null && children.length) {\n recurse(children);\n }\n });\n };\n recurse(arr);\n return flat;\n}\nfunction memo(getDeps, fn, opts) {\n let deps = [];\n let result;\n return depArgs => {\n let depTime;\n if (opts.key && opts.debug) depTime = Date.now();\n const newDeps = getDeps(depArgs);\n const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);\n if (!depsChanged) {\n return result;\n }\n deps = newDeps;\n let resultTime;\n if (opts.key && opts.debug) resultTime = Date.now();\n result = fn(...newDeps);\n opts == null || opts.onChange == null || opts.onChange(result);\n if (opts.key && opts.debug) {\n if (opts != null && opts.debug()) {\n const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;\n const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;\n const resultFpsPercentage = resultEndTime / 16;\n const pad = (str, num) => {\n str = String(str);\n while (str.length < num) {\n str = ' ' + str;\n }\n return str;\n };\n console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);\n }\n }\n return result;\n };\n}\nfunction getMemoOptions(tableOptions, debugLevel, key, onChange) {\n return {\n debug: () => {\n var _tableOptions$debugAl;\n return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel];\n },\n key: process.env.NODE_ENV === 'development' && key,\n onChange\n };\n}\n\nfunction createCell(table, row, column, columnId) {\n const getRenderValue = () => {\n var _cell$getValue;\n return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;\n };\n const cell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue\n }), getMemoOptions(table.options, 'debugCells', 'cell.getContext'))\n };\n table._features.forEach(feature => {\n feature.createCell == null || feature.createCell(cell, column, row, table);\n }, {});\n return cell;\n}\n\nfunction createColumn(table, columnDef, depth, parent) {\n var _ref, _resolvedColumnDef$id;\n const defaultColumn = table._getDefaultColumnDef();\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef\n };\n const accessorKey = resolvedColumnDef.accessorKey;\n let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;\n let accessorFn;\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn;\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = originalRow => {\n let result = originalRow;\n for (const key of accessorKey.split('.')) {\n var _result;\n result = (_result = result) == null ? void 0 : _result[key];\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(`\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`);\n }\n }\n return result;\n };\n } else {\n accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];\n }\n }\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`);\n }\n throw new Error();\n }\n let column = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent,\n depth,\n columnDef: resolvedColumnDef,\n columns: [],\n getFlatColumns: memo(() => [true], () => {\n var _column$columns;\n return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];\n }, getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')),\n getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {\n var _column$columns2;\n if ((_column$columns2 = column.columns) != null && _column$columns2.length) {\n let leafColumns = column.columns.flatMap(column => column.getLeafColumns());\n return orderColumns(leafColumns);\n }\n return [column];\n }, getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns'))\n };\n for (const feature of table._features) {\n feature.createColumn == null || feature.createColumn(column, table);\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column;\n}\n\nconst debug = 'debugHeaders';\n//\n\nfunction createHeader(table, column, options) {\n var _options$id;\n const id = (_options$id = options.id) != null ? _options$id : column.id;\n let header = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null,\n getLeafHeaders: () => {\n const leafHeaders = [];\n const recurseHeader = h => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader);\n }\n leafHeaders.push(h);\n };\n recurseHeader(header);\n return leafHeaders;\n },\n getContext: () => ({\n table,\n header: header,\n column\n })\n };\n table._features.forEach(feature => {\n feature.createHeader == null || feature.createHeader(header, table);\n });\n return header;\n}\nconst Headers = {\n createTable: table => {\n // Header Groups\n\n table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {\n var _left$map$filter, _right$map$filter;\n const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];\n const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];\n const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));\n const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);\n return headerGroups;\n }, getMemoOptions(table.options, debug, 'getHeaderGroups'));\n table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));\n return buildHeaderGroups(allColumns, leafColumns, table, 'center');\n }, getMemoOptions(table.options, debug, 'getCenterHeaderGroups'));\n table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {\n var _left$map$filter2;\n const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');\n }, getMemoOptions(table.options, debug, 'getLeftHeaderGroups'));\n table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {\n var _right$map$filter2;\n const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');\n }, getMemoOptions(table.options, debug, 'getRightHeaderGroups'));\n\n // Footer Groups\n\n table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getFooterGroups'));\n table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getLeftFooterGroups'));\n table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getCenterFooterGroups'));\n table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => {\n return [...headerGroups].reverse();\n }, getMemoOptions(table.options, debug, 'getRightFooterGroups'));\n\n // Flat Headers\n\n table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => {\n return headerGroups.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getFlatHeaders'));\n table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => {\n return left.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getLeftFlatHeaders'));\n table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => {\n return left.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getCenterFlatHeaders'));\n table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => {\n return left.map(headerGroup => {\n return headerGroup.headers;\n }).flat();\n }, getMemoOptions(table.options, debug, 'getRightFlatHeaders'));\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => {\n return flatHeaders.filter(header => {\n var _header$subHeaders;\n return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);\n });\n }, getMemoOptions(table.options, debug, 'getCenterLeafHeaders'));\n table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => {\n return flatHeaders.filter(header => {\n var _header$subHeaders2;\n return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);\n });\n }, getMemoOptions(table.options, debug, 'getLeftLeafHeaders'));\n table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => {\n return flatHeaders.filter(header => {\n var _header$subHeaders3;\n return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);\n });\n }, getMemoOptions(table.options, debug, 'getRightLeafHeaders'));\n table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {\n var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;\n return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {\n return header.getLeafHeaders();\n }).flat();\n }, getMemoOptions(table.options, debug, 'getLeafHeaders'));\n }\n};\nfunction buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {\n var _headerGroups$0$heade, _headerGroups$;\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0;\n const findMaxDepth = function (columns, depth) {\n if (depth === void 0) {\n depth = 1;\n }\n maxDepth = Math.max(maxDepth, depth);\n columns.filter(column => column.getIsVisible()).forEach(column => {\n var _column$columns;\n if ((_column$columns = column.columns) != null && _column$columns.length) {\n findMaxDepth(column.columns, depth + 1);\n }\n }, 0);\n };\n findMaxDepth(allColumns);\n let headerGroups = [];\n const createHeaderGroup = (headersToGroup, depth) => {\n // The header group we are creating\n const headerGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: []\n };\n\n // The parent columns we're going to scan next\n const pendingParentHeaders = [];\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;\n let column;\n let isPlaceholder = false;\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent;\n } else {\n // The parent header is repeated\n column = headerToGroup.column;\n isPlaceholder = true;\n }\n if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup);\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined,\n depth,\n index: pendingParentHeaders.length\n });\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup);\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header);\n }\n headerGroup.headers.push(headerToGroup);\n headerToGroup.headerGroup = headerGroup;\n });\n headerGroups.push(headerGroup);\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1);\n }\n };\n const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {\n depth: maxDepth,\n index\n }));\n createHeaderGroup(bottomHeaders, maxDepth - 1);\n headerGroups.reverse();\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = headers => {\n const filteredHeaders = headers.filter(header => header.column.getIsVisible());\n return filteredHeaders.map(header => {\n let colSpan = 0;\n let rowSpan = 0;\n let childRowSpans = [0];\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = [];\n recurseHeadersForSpans(header.subHeaders).forEach(_ref => {\n let {\n colSpan: childColSpan,\n rowSpan: childRowSpan\n } = _ref;\n colSpan += childColSpan;\n childRowSpans.push(childRowSpan);\n });\n } else {\n colSpan = 1;\n }\n const minChildRowSpan = Math.min(...childRowSpans);\n rowSpan = rowSpan + minChildRowSpan;\n header.colSpan = colSpan;\n header.rowSpan = rowSpan;\n return {\n colSpan,\n rowSpan\n };\n });\n };\n recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);\n return headerGroups;\n}\n\nconst createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {\n let row = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId];\n }\n const column = table.getColumn(columnId);\n if (!(column != null && column.accessorFn)) {\n return undefined;\n }\n row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);\n return row._valuesCache[columnId];\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId];\n }\n const column = table.getColumn(columnId);\n if (!(column != null && column.accessorFn)) {\n return undefined;\n }\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)];\n return row._uniqueValuesCache[columnId];\n }\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex);\n return row._uniqueValuesCache[columnId];\n },\n renderValue: columnId => {\n var _row$getValue;\n return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;\n },\n subRows: subRows != null ? subRows : [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,\n getParentRows: () => {\n let parentRows = [];\n let currentRow = row;\n while (true) {\n const parentRow = currentRow.getParentRow();\n if (!parentRow) break;\n parentRows.push(parentRow);\n currentRow = parentRow;\n }\n return parentRows.reverse();\n },\n getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row, column, column.id);\n });\n }, getMemoOptions(table.options, 'debugRows', 'getAllCells')),\n _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {\n return allCells.reduce((acc, cell) => {\n acc[cell.column.id] = cell;\n return acc;\n }, {});\n }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId'))\n };\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i];\n feature == null || feature.createRow == null || feature.createRow(row, table);\n }\n return row;\n};\n\n//\n\nconst ColumnFaceting = {\n createColumn: (column, table) => {\n column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel();\n }\n return column._getFacetedRowModel();\n };\n column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map();\n }\n return column._getFacetedUniqueValues();\n };\n column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined;\n }\n return column._getFacetedMinMaxValues();\n };\n }\n};\n\nconst includesString = (row, columnId, filterValue) => {\n var _filterValue$toString, _row$getValue;\n const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase();\n return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));\n};\nincludesString.autoRemove = val => testFalsey(val);\nconst includesStringSensitive = (row, columnId, filterValue) => {\n var _row$getValue2;\n return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue));\n};\nincludesStringSensitive.autoRemove = val => testFalsey(val);\nconst equalsString = (row, columnId, filterValue) => {\n var _row$getValue3;\n return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase());\n};\nequalsString.autoRemove = val => testFalsey(val);\nconst arrIncludes = (row, columnId, filterValue) => {\n var _row$getValue4;\n return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);\n};\narrIncludes.autoRemove = val => testFalsey(val);\nconst arrIncludesAll = (row, columnId, filterValue) => {\n return !filterValue.some(val => {\n var _row$getValue5;\n return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));\n });\n};\narrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);\nconst arrIncludesSome = (row, columnId, filterValue) => {\n return filterValue.some(val => {\n var _row$getValue6;\n return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);\n });\n};\narrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);\nconst equals = (row, columnId, filterValue) => {\n return row.getValue(columnId) === filterValue;\n};\nequals.autoRemove = val => testFalsey(val);\nconst weakEquals = (row, columnId, filterValue) => {\n return row.getValue(columnId) == filterValue;\n};\nweakEquals.autoRemove = val => testFalsey(val);\nconst inNumberRange = (row, columnId, filterValue) => {\n let [min, max] = filterValue;\n const rowValue = row.getValue(columnId);\n return rowValue >= min && rowValue <= max;\n};\ninNumberRange.resolveFilterValue = val => {\n let [unsafeMin, unsafeMax] = val;\n let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin;\n let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax;\n let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;\n if (min > max) {\n const temp = min;\n min = max;\n max = temp;\n }\n return [min, max];\n};\ninNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]);\n\n// Export\n\nconst filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange\n};\n// Utils\n\nfunction testFalsey(val) {\n return val === undefined || val === null || val === '';\n}\n\n//\n\nconst ColumnFiltering = {\n getDefaultColumnDef: () => {\n return {\n filterFn: 'auto'\n };\n },\n getInitialState: state => {\n return {\n columnFilters: [],\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100\n };\n },\n createColumn: (column, table) => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0];\n const value = firstRow == null ? void 0 : firstRow.getValue(column.id);\n if (typeof value === 'string') {\n return filterFns.includesString;\n }\n if (typeof value === 'number') {\n return filterFns.inNumberRange;\n }\n if (typeof value === 'boolean') {\n return filterFns.equals;\n }\n if (value !== null && typeof value === 'object') {\n return filterFns.equals;\n }\n if (Array.isArray(value)) {\n return filterFns.arrIncludes;\n }\n return filterFns.weakEquals;\n };\n column.getFilterFn = () => {\n var _table$options$filter, _table$options$filter2;\n return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore\n (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];\n };\n column.getCanFilter = () => {\n var _column$columnDef$ena, _table$options$enable, _table$options$enable2;\n return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;\n };\n column.getIsFiltered = () => column.getFilterIndex() > -1;\n column.getFilterValue = () => {\n var _table$getState$colum;\n return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;\n };\n column.getFilterIndex = () => {\n var _table$getState$colum2, _table$getState$colum3;\n return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;\n };\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn();\n const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id);\n const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined);\n\n //\n if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {\n var _old$filter;\n return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];\n }\n const newFilterObj = {\n id: column.id,\n value: newFilter\n };\n if (previousFilter) {\n var _old$map;\n return (_old$map = old == null ? void 0 : old.map(d => {\n if (d.id === column.id) {\n return newFilterObj;\n }\n return d;\n })) != null ? _old$map : [];\n }\n if (old != null && old.length) {\n return [...old, newFilterObj];\n }\n return [newFilterObj];\n });\n };\n },\n createRow: (row, _table) => {\n row.columnFilters = {};\n row.columnFiltersMeta = {};\n },\n createTable: table => {\n table.setColumnFilters = updater => {\n const leafColumns = table.getAllLeafColumns();\n const updateFn = old => {\n var _functionalUpdate;\n return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id);\n if (column) {\n const filterFn = column.getFilterFn();\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false;\n }\n }\n return true;\n });\n };\n table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);\n };\n table.resetColumnFilters = defaultState => {\n var _table$initialState$c, _table$initialState;\n table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);\n };\n table.getPreFilteredRowModel = () => table.getCoreRowModel();\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table);\n }\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel();\n }\n return table._getFilteredRowModel();\n };\n }\n};\nfunction shouldAutoRemoveFilter(filterFn, value, column) {\n return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;\n}\n\nconst sum = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId);\n return sum + (typeof nextValue === 'number' ? nextValue : 0);\n }, 0);\n};\nconst min = (columnId, _leafRows, childRows) => {\n let min;\n childRows.forEach(row => {\n const value = row.getValue(columnId);\n if (value != null && (min > value || min === undefined && value >= value)) {\n min = value;\n }\n });\n return min;\n};\nconst max = (columnId, _leafRows, childRows) => {\n let max;\n childRows.forEach(row => {\n const value = row.getValue(columnId);\n if (value != null && (max < value || max === undefined && value >= value)) {\n max = value;\n }\n });\n return max;\n};\nconst extent = (columnId, _leafRows, childRows) => {\n let min;\n let max;\n childRows.forEach(row => {\n const value = row.getValue(columnId);\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value;\n } else {\n if (min > value) min = value;\n if (max < value) max = value;\n }\n }\n });\n return [min, max];\n};\nconst mean = (columnId, leafRows) => {\n let count = 0;\n let sum = 0;\n leafRows.forEach(row => {\n let value = row.getValue(columnId);\n if (value != null && (value = +value) >= value) {\n ++count, sum += value;\n }\n });\n if (count) return sum / count;\n return;\n};\nconst median = (columnId, leafRows) => {\n if (!leafRows.length) {\n return;\n }\n const values = leafRows.map(row => row.getValue(columnId));\n if (!isNumberArray(values)) {\n return;\n }\n if (values.length === 1) {\n return values[0];\n }\n const mid = Math.floor(values.length / 2);\n const nums = values.sort((a, b) => a - b);\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;\n};\nconst unique = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());\n};\nconst uniqueCount = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size;\n};\nconst count = (_columnId, leafRows) => {\n return leafRows.length;\n};\nconst aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count\n};\n\n//\n\nconst ColumnGrouping = {\n getDefaultColumnDef: () => {\n return {\n aggregatedCell: props => {\n var _toString, _props$getValue;\n return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;\n },\n aggregationFn: 'auto'\n };\n },\n getInitialState: state => {\n return {\n grouping: [],\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder'\n };\n },\n createColumn: (column, table) => {\n column.toggleGrouping = () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old != null && old.includes(column.id)) {\n return old.filter(d => d !== column.id);\n }\n return [...(old != null ? old : []), column.id];\n });\n };\n column.getCanGroup = () => {\n var _column$columnDef$ena, _table$options$enable;\n return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue);\n };\n column.getIsGrouped = () => {\n var _table$getState$group;\n return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);\n };\n column.getGroupedIndex = () => {\n var _table$getState$group2;\n return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);\n };\n column.getToggleGroupingHandler = () => {\n const canGroup = column.getCanGroup();\n return () => {\n if (!canGroup) return;\n column.toggleGrouping();\n };\n };\n column.getAutoAggregationFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0];\n const value = firstRow == null ? void 0 : firstRow.getValue(column.id);\n if (typeof value === 'number') {\n return aggregationFns.sum;\n }\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent;\n }\n };\n column.getAggregationFn = () => {\n var _table$options$aggreg, _table$options$aggreg2;\n if (!column) {\n throw new Error();\n }\n return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];\n };\n },\n createTable: table => {\n table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);\n table.resetGrouping = defaultState => {\n var _table$initialState$g, _table$initialState;\n table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);\n };\n table.getPreGroupedRowModel = () => table.getFilteredRowModel();\n table.getGroupedRowModel = () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table);\n }\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel();\n }\n return table._getGroupedRowModel();\n };\n },\n createRow: (row, table) => {\n row.getIsGrouped = () => !!row.groupingColumnId;\n row.getGroupingValue = columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId];\n }\n const column = table.getColumn(columnId);\n if (!(column != null && column.columnDef.getGroupingValue)) {\n return row.getValue(columnId);\n }\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);\n return row._groupingValuesCache[columnId];\n };\n row._groupingValuesCache = {};\n },\n createCell: (cell, column, row, table) => {\n cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;\n cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();\n cell.getIsAggregated = () => {\n var _row$subRows;\n return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);\n };\n }\n};\nfunction orderColumns(leafColumns, grouping, groupedColumnMode) {\n if (!(grouping != null && grouping.length) || !groupedColumnMode) {\n return leafColumns;\n }\n const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns;\n }\n const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean);\n return [...groupingColumns, ...nonGroupingColumns];\n}\n\n//\n\nconst ColumnOrdering = {\n getInitialState: state => {\n return {\n columnOrder: [],\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table)\n };\n },\n createColumn: (column, table) => {\n column.getIndex = memo(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex'));\n column.getIsFirstColumn = position => {\n var _columns$;\n const columns = _getVisibleLeafColumns(table, position);\n return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id;\n };\n column.getIsLastColumn = position => {\n var _columns;\n const columns = _getVisibleLeafColumns(table, position);\n return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id;\n };\n },\n createTable: table => {\n table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);\n table.resetColumnOrder = defaultState => {\n var _table$initialState$c;\n table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);\n };\n table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns = [];\n\n // If there is no order, return the normal columns\n if (!(columnOrder != null && columnOrder.length)) {\n orderedColumns = columns;\n } else {\n const columnOrderCopy = [...columnOrder];\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns];\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift();\n const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy];\n }\n return orderColumns(orderedColumns, grouping, groupedColumnMode);\n }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn'));\n }\n};\n\n//\n\nconst getDefaultColumnPinningState = () => ({\n left: [],\n right: []\n});\nconst ColumnPinning = {\n getInitialState: state => {\n return {\n columnPinning: getDefaultColumnPinningState(),\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table)\n };\n },\n createColumn: (column, table) => {\n column.pin = position => {\n const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);\n table.setColumnPinning(old => {\n var _old$left3, _old$right3;\n if (position === 'right') {\n var _old$left, _old$right;\n return {\n left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),\n right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]\n };\n }\n if (position === 'left') {\n var _old$left2, _old$right2;\n return {\n left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],\n right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))\n };\n }\n return {\n left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),\n right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))\n };\n });\n };\n column.getCanPin = () => {\n const leafColumns = column.getLeafColumns();\n return leafColumns.some(d => {\n var _d$columnDef$enablePi, _ref, _table$options$enable;\n return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true);\n });\n };\n column.getIsPinned = () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id);\n const {\n left,\n right\n } = table.getState().columnPinning;\n const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));\n const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));\n return isLeft ? 'left' : isRight ? 'right' : false;\n };\n column.getPinnedIndex = () => {\n var _table$getState$colum, _table$getState$colum2;\n const position = column.getIsPinned();\n return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;\n };\n },\n createRow: (row, table) => {\n row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {\n const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];\n return allCells.filter(d => !leftAndRight.includes(d.column.id));\n }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells'));\n row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {\n const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({\n ...d,\n position: 'left'\n }));\n return cells;\n }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells'));\n row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {\n const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({\n ...d,\n position: 'right'\n }));\n return cells;\n }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells'));\n },\n createTable: table => {\n table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);\n table.resetColumnPinning = defaultState => {\n var _table$initialState$c, _table$initialState;\n return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState());\n };\n table.getIsSomeColumnsPinned = position => {\n var _pinningState$positio;\n const pinningState = table.getState().columnPinning;\n if (!position) {\n var _pinningState$left, _pinningState$right;\n return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));\n }\n return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);\n };\n table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {\n return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);\n }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns'));\n table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {\n return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);\n }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns'));\n table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {\n const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];\n return allColumns.filter(d => !leftAndRight.includes(d.id));\n }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns'));\n }\n};\n\nfunction safelyAccessDocument(_document) {\n return _document || (typeof document !== 'undefined' ? document : null);\n}\n\n//\n\n//\n\nconst defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER\n};\nconst getDefaultColumnSizingInfoState = () => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: []\n});\nconst ColumnSizing = {\n getDefaultColumnDef: () => {\n return defaultColumnSizing;\n },\n getInitialState: state => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n columnResizeMode: 'onEnd',\n columnResizeDirection: 'ltr',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)\n };\n },\n createColumn: (column, table) => {\n column.getSize = () => {\n var _column$columnDef$min, _ref, _column$columnDef$max;\n const columnSize = table.getState().columnSizing[column.id];\n return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);\n };\n column.getStart = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart'));\n column.getAfter = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter'));\n column.resetSize = () => {\n table.setColumnSizing(_ref2 => {\n let {\n [column.id]: _,\n ...rest\n } = _ref2;\n return rest;\n });\n };\n column.getCanResize = () => {\n var _column$columnDef$ena, _table$options$enable;\n return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);\n };\n column.getIsResizing = () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id;\n };\n },\n createHeader: (header, table) => {\n header.getSize = () => {\n let sum = 0;\n const recurse = header => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse);\n } else {\n var _header$column$getSiz;\n sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;\n }\n };\n recurse(header);\n return sum;\n };\n header.getStart = () => {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup.headers[header.index - 1];\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();\n }\n return 0;\n };\n header.getResizeHandler = _contextDocument => {\n const column = table.getColumn(header.column.id);\n const canResize = column == null ? void 0 : column.getCanResize();\n return e => {\n if (!column || !canResize) {\n return;\n }\n e.persist == null || e.persist();\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return;\n }\n }\n const startSize = header.getSize();\n const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];\n const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;\n const newColumnSizing = {};\n const updateOffset = (eventType, clientXPos) => {\n if (typeof clientXPos !== 'number') {\n return;\n }\n table.setColumnSizingInfo(old => {\n var _old$startOffset, _old$startSize;\n const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1;\n const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection;\n const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);\n old.columnSizingStart.forEach(_ref3 => {\n let [columnId, headerSize] = _ref3;\n newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;\n });\n return {\n ...old,\n deltaOffset,\n deltaPercentage\n };\n });\n if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing\n }));\n }\n };\n const onMove = clientXPos => updateOffset('move', clientXPos);\n const onEnd = clientXPos => {\n updateOffset('end', clientXPos);\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: []\n }));\n };\n const contextDocument = safelyAccessDocument(_contextDocument);\n const mouseEvents = {\n moveHandler: e => onMove(e.clientX),\n upHandler: e => {\n contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler);\n contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler);\n onEnd(e.clientX);\n }\n };\n const touchEvents = {\n moveHandler: e => {\n if (e.cancelable) {\n e.preventDefault();\n e.stopPropagation();\n }\n onMove(e.touches[0].clientX);\n return false;\n },\n upHandler: e => {\n var _e$touches$;\n contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler);\n contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler);\n if (e.cancelable) {\n e.preventDefault();\n e.stopPropagation();\n }\n onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);\n }\n };\n const passiveIfSupported = passiveEventSupported() ? {\n passive: false\n } : false;\n if (isTouchStartEvent(e)) {\n contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);\n contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);\n } else {\n contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);\n contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);\n }\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id\n }));\n };\n };\n },\n createTable: table => {\n table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater);\n table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater);\n table.resetColumnSizing = defaultState => {\n var _table$initialState$c;\n table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});\n };\n table.resetHeaderSizeInfo = defaultState => {\n var _table$initialState$c2;\n table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());\n };\n table.getTotalSize = () => {\n var _table$getHeaderGroup, _table$getHeaderGroup2;\n return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getHeaderGroup : 0;\n };\n table.getLeftTotalSize = () => {\n var _table$getLeftHeaderG, _table$getLeftHeaderG2;\n return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getLeftHeaderG : 0;\n };\n table.getCenterTotalSize = () => {\n var _table$getCenterHeade, _table$getCenterHeade2;\n return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getCenterHeade : 0;\n };\n table.getRightTotalSize = () => {\n var _table$getRightHeader, _table$getRightHeader2;\n return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {\n return sum + header.getSize();\n }, 0)) != null ? _table$getRightHeader : 0;\n };\n }\n};\nlet passiveSupported = null;\nfunction passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported;\n let supported = false;\n try {\n const options = {\n get passive() {\n supported = true;\n return false;\n }\n };\n const noop = () => {};\n window.addEventListener('test', noop, options);\n window.removeEventListener('test', noop);\n } catch (err) {\n supported = false;\n }\n passiveSupported = supported;\n return passiveSupported;\n}\nfunction isTouchStartEvent(e) {\n return e.type === 'touchstart';\n}\n\n//\n\nconst ColumnVisibility = {\n getInitialState: state => {\n return {\n columnVisibility: {},\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)\n };\n },\n createColumn: (column, table) => {\n column.toggleVisibility = value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value != null ? value : !column.getIsVisible()\n }));\n }\n };\n column.getIsVisible = () => {\n var _ref, _table$getState$colum;\n const childColumns = column.columns;\n return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true;\n };\n column.getCanHide = () => {\n var _column$columnDef$ena, _table$options$enable;\n return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);\n };\n column.getToggleVisibilityHandler = () => {\n return e => {\n column.toggleVisibility == null || column.toggleVisibility(e.target.checked);\n };\n };\n },\n createRow: (row, table) => {\n row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {\n return cells.filter(cell => cell.column.getIsVisible());\n }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells'));\n row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells'));\n },\n createTable: table => {\n const makeVisibleColumnsMethod = (key, getColumns) => {\n return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {\n return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());\n }, getMemoOptions(table.options, 'debugColumns', key));\n };\n table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());\n table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());\n table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());\n table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());\n table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());\n table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);\n table.resetColumnVisibility = defaultState => {\n var _table$initialState$c;\n table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});\n };\n table.toggleAllColumnsVisible = value => {\n var _value;\n value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();\n table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({\n ...obj,\n [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value\n }), {}));\n };\n table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));\n table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());\n table.getToggleAllColumnsVisibilityHandler = () => {\n return e => {\n var _target;\n table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);\n };\n };\n }\n};\nfunction _getVisibleLeafColumns(table, position) {\n return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();\n}\n\n//\n\nconst GlobalFaceting = {\n createTable: table => {\n table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__');\n table.getGlobalFacetedRowModel = () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel();\n }\n return table._getGlobalFacetedRowModel();\n };\n table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__');\n table.getGlobalFacetedUniqueValues = () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map();\n }\n return table._getGlobalFacetedUniqueValues();\n };\n table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__');\n table.getGlobalFacetedMinMaxValues = () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return;\n }\n return table._getGlobalFacetedMinMaxValues();\n };\n }\n};\n\n//\n\nconst GlobalFiltering = {\n getInitialState: state => {\n return {\n globalFilter: undefined,\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n var _table$getCoreRowMode;\n const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue();\n return typeof value === 'string' || typeof value === 'number';\n }\n };\n },\n createColumn: (column, table) => {\n column.getCanGlobalFilter = () => {\n var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol;\n return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;\n };\n },\n createTable: table => {\n table.getGlobalAutoFilterFn = () => {\n return filterFns.includesString;\n };\n table.getGlobalFilterFn = () => {\n var _table$options$filter, _table$options$filter2;\n const {\n globalFilterFn: globalFilterFn\n } = table.options;\n return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn];\n };\n table.setGlobalFilter = updater => {\n table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);\n };\n table.resetGlobalFilter = defaultState => {\n table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);\n };\n }\n};\n\n//\n\nconst RowExpanding = {\n getInitialState: state => {\n return {\n expanded: {},\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true\n };\n },\n createTable: table => {\n let registered = false;\n let queued = false;\n table._autoResetExpanded = () => {\n var _ref, _table$options$autoRe;\n if (!registered) {\n table._queue(() => {\n registered = true;\n });\n return;\n }\n if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {\n if (queued) return;\n queued = true;\n table._queue(() => {\n table.resetExpanded();\n queued = false;\n });\n }\n };\n table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);\n table.toggleAllRowsExpanded = expanded => {\n if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {\n table.setExpanded(true);\n } else {\n table.setExpanded({});\n }\n };\n table.resetExpanded = defaultState => {\n var _table$initialState$e, _table$initialState;\n table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});\n };\n table.getCanSomeRowsExpand = () => {\n return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());\n };\n table.getToggleAllRowsExpandedHandler = () => {\n return e => {\n e.persist == null || e.persist();\n table.toggleAllRowsExpanded();\n };\n };\n table.getIsSomeRowsExpanded = () => {\n const expanded = table.getState().expanded;\n return expanded === true || Object.values(expanded).some(Boolean);\n };\n table.getIsAllRowsExpanded = () => {\n const expanded = table.getState().expanded;\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true;\n }\n if (!Object.keys(expanded).length) {\n return false;\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false;\n }\n\n // They must all be expanded :shrug:\n return true;\n };\n table.getExpandedDepth = () => {\n let maxDepth = 0;\n const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);\n rowIds.forEach(id => {\n const splitId = id.split('.');\n maxDepth = Math.max(maxDepth, splitId.length);\n });\n return maxDepth;\n };\n table.getPreExpandedRowModel = () => table.getSortedRowModel();\n table.getExpandedRowModel = () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table);\n }\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel();\n }\n return table._getExpandedRowModel();\n };\n },\n createRow: (row, table) => {\n row.toggleExpanded = expanded => {\n table.setExpanded(old => {\n var _expanded;\n const exists = old === true ? true : !!(old != null && old[row.id]);\n let oldExpanded = {};\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true;\n });\n } else {\n oldExpanded = old;\n }\n expanded = (_expanded = expanded) != null ? _expanded : !exists;\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true\n };\n }\n if (exists && !expanded) {\n const {\n [row.id]: _,\n ...rest\n } = oldExpanded;\n return rest;\n }\n return old;\n });\n };\n row.getIsExpanded = () => {\n var _table$options$getIsR;\n const expanded = table.getState().expanded;\n return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));\n };\n row.getCanExpand = () => {\n var _table$options$getRow, _table$options$enable, _row$subRows;\n return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);\n };\n row.getIsAllParentsExpanded = () => {\n let isFullyExpanded = true;\n let currentRow = row;\n while (isFullyExpanded && currentRow.parentId) {\n currentRow = table.getRow(currentRow.parentId, true);\n isFullyExpanded = currentRow.getIsExpanded();\n }\n return isFullyExpanded;\n };\n row.getToggleExpandedHandler = () => {\n const canExpand = row.getCanExpand();\n return () => {\n if (!canExpand) return;\n row.toggleExpanded();\n };\n };\n }\n};\n\n//\n\nconst defaultPageIndex = 0;\nconst defaultPageSize = 10;\nconst getDefaultPaginationState = () => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize\n});\nconst RowPagination = {\n getInitialState: state => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...(state == null ? void 0 : state.pagination)\n }\n };\n },\n getDefaultOptions: table => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table)\n };\n },\n createTable: table => {\n let registered = false;\n let queued = false;\n table._autoResetPageIndex = () => {\n var _ref, _table$options$autoRe;\n if (!registered) {\n table._queue(() => {\n registered = true;\n });\n return;\n }\n if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {\n if (queued) return;\n queued = true;\n table._queue(() => {\n table.resetPageIndex();\n queued = false;\n });\n }\n };\n table.setPagination = updater => {\n const safeUpdater = old => {\n let newState = functionalUpdate(updater, old);\n return newState;\n };\n return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);\n };\n table.resetPagination = defaultState => {\n var _table$initialState$p;\n table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());\n };\n table.setPageIndex = updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex);\n const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));\n return {\n ...old,\n pageIndex\n };\n });\n };\n table.resetPageIndex = defaultState => {\n var _table$initialState$p2, _table$initialState;\n table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);\n };\n table.resetPageSize = defaultState => {\n var _table$initialState$p3, _table$initialState2;\n table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);\n };\n table.setPageSize = updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));\n const topRowIndex = old.pageSize * old.pageIndex;\n const pageIndex = Math.floor(topRowIndex / pageSize);\n return {\n ...old,\n pageIndex,\n pageSize\n };\n });\n };\n //deprecated\n table.setPageCount = updater => table.setPagination(old => {\n var _table$options$pageCo;\n let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount);\n }\n return {\n ...old,\n pageCount: newPageCount\n };\n });\n table.getPageOptions = memo(() => [table.getPageCount()], pageCount => {\n let pageOptions = [];\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);\n }\n return pageOptions;\n }, getMemoOptions(table.options, 'debugTable', 'getPageOptions'));\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;\n table.getCanNextPage = () => {\n const {\n pageIndex\n } = table.getState().pagination;\n const pageCount = table.getPageCount();\n if (pageCount === -1) {\n return true;\n }\n if (pageCount === 0) {\n return false;\n }\n return pageIndex < pageCount - 1;\n };\n table.previousPage = () => {\n return table.setPageIndex(old => old - 1);\n };\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1;\n });\n };\n table.firstPage = () => {\n return table.setPageIndex(0);\n };\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1);\n };\n table.getPrePaginationRowModel = () => table.getExpandedRowModel();\n table.getPaginationRowModel = () => {\n if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {\n table._getPaginationRowModel = table.options.getPaginationRowModel(table);\n }\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel();\n }\n return table._getPaginationRowModel();\n };\n table.getPageCount = () => {\n var _table$options$pageCo2;\n return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize);\n };\n table.getRowCount = () => {\n var _table$options$rowCou;\n return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length;\n };\n }\n};\n\n//\n\nconst getDefaultRowPinningState = () => ({\n top: [],\n bottom: []\n});\nconst RowPinning = {\n getInitialState: state => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table)\n };\n },\n createRow: (row, table) => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => {\n let {\n id\n } = _ref;\n return id;\n }) : [];\n const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => {\n let {\n id\n } = _ref2;\n return id;\n }) : [];\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]);\n table.setRowPinning(old => {\n var _old$top3, _old$bottom3;\n if (position === 'bottom') {\n var _old$top, _old$bottom;\n return {\n top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))),\n bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)]\n };\n }\n if (position === 'top') {\n var _old$top2, _old$bottom2;\n return {\n top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)],\n bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d)))\n };\n }\n return {\n top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))),\n bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d)))\n };\n });\n };\n row.getCanPin = () => {\n var _ref3;\n const {\n enableRowPinning,\n enablePinning\n } = table.options;\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row);\n }\n return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true;\n };\n row.getIsPinned = () => {\n const rowIds = [row.id];\n const {\n top,\n bottom\n } = table.getState().rowPinning;\n const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d));\n const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d));\n return isTop ? 'top' : isBottom ? 'bottom' : false;\n };\n row.getPinnedIndex = () => {\n var _ref4, _visiblePinnedRowIds$;\n const position = row.getIsPinned();\n if (!position) return -1;\n const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => {\n let {\n id\n } = _ref5;\n return id;\n });\n return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;\n };\n },\n createTable: table => {\n table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater);\n table.resetRowPinning = defaultState => {\n var _table$initialState$r, _table$initialState;\n return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());\n };\n table.getIsSomeRowsPinned = position => {\n var _pinningState$positio;\n const pinningState = table.getState().rowPinning;\n if (!position) {\n var _pinningState$top, _pinningState$bottom;\n return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length));\n }\n return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);\n };\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n var _table$options$keepPi;\n const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ?\n //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => {\n const row = table.getRow(rowId, true);\n return row.getIsAllParentsExpanded() ? row : null;\n }) :\n //else get only visible rows that are pinned\n (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId));\n return rows.filter(Boolean).map(d => ({\n ...d,\n position\n }));\n };\n table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows'));\n table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows'));\n table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);\n return allRows.filter(d => !topAndBottom.has(d.id));\n }, getMemoOptions(table.options, 'debugRows', 'getCenterRows'));\n }\n};\n\n//\n\nconst RowSelection = {\n getInitialState: state => {\n return {\n rowSelection: {},\n ...state\n };\n },\n getDefaultOptions: table => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n };\n },\n createTable: table => {\n table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater);\n table.resetRowSelection = defaultState => {\n var _table$initialState$r;\n return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});\n };\n table.toggleAllRowsSelected = value => {\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();\n const rowSelection = {\n ...old\n };\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return;\n }\n rowSelection[row.id] = true;\n });\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id];\n });\n }\n return rowSelection;\n });\n };\n table.toggleAllPageRowsSelected = value => table.setRowSelection(old => {\n const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();\n const rowSelection = {\n ...old\n };\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table);\n });\n return rowSelection;\n });\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n table.getPreSelectedRowModel = () => table.getCoreRowModel();\n table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n }\n return selectRowsFn(table, rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel'));\n table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n }\n return selectRowsFn(table, rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel'));\n table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n }\n return selectRowsFn(table, rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel'));\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n table.getIsAllRowsSelected = () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows;\n const {\n rowSelection\n } = table.getState();\n let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);\n if (isAllRowsSelected) {\n if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {\n isAllRowsSelected = false;\n }\n }\n return isAllRowsSelected;\n };\n table.getIsAllPageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());\n const {\n rowSelection\n } = table.getState();\n let isAllPageRowsSelected = !!paginationFlatRows.length;\n if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {\n isAllPageRowsSelected = false;\n }\n return isAllPageRowsSelected;\n };\n table.getIsSomeRowsSelected = () => {\n var _table$getState$rowSe;\n const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;\n return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;\n };\n table.getIsSomePageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows;\n return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected());\n };\n table.getToggleAllRowsSelectedHandler = () => {\n return e => {\n table.toggleAllRowsSelected(e.target.checked);\n };\n };\n table.getToggleAllPageRowsSelectedHandler = () => {\n return e => {\n table.toggleAllPageRowsSelected(e.target.checked);\n };\n };\n },\n createRow: (row, table) => {\n row.toggleSelected = (value, opts) => {\n const isSelected = row.getIsSelected();\n table.setRowSelection(old => {\n var _opts$selectChildren;\n value = typeof value !== 'undefined' ? value : !isSelected;\n if (row.getCanSelect() && isSelected === value) {\n return old;\n }\n const selectedRowIds = {\n ...old\n };\n mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table);\n return selectedRowIds;\n });\n };\n row.getIsSelected = () => {\n const {\n rowSelection\n } = table.getState();\n return isRowSelected(row, rowSelection);\n };\n row.getIsSomeSelected = () => {\n const {\n rowSelection\n } = table.getState();\n return isSubRowSelected(row, rowSelection) === 'some';\n };\n row.getIsAllSubRowsSelected = () => {\n const {\n rowSelection\n } = table.getState();\n return isSubRowSelected(row, rowSelection) === 'all';\n };\n row.getCanSelect = () => {\n var _table$options$enable;\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row);\n }\n return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;\n };\n row.getCanSelectSubRows = () => {\n var _table$options$enable2;\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row);\n }\n return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;\n };\n row.getCanMultiSelect = () => {\n var _table$options$enable3;\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row);\n }\n return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;\n };\n row.getToggleSelectedHandler = () => {\n const canSelect = row.getCanSelect();\n return e => {\n var _target;\n if (!canSelect) return;\n row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);\n };\n };\n }\n};\nconst mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => {\n var _row$subRows;\n const row = table.getRow(id, true);\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true;\n }\n } else {\n delete selectedRowIds[id];\n }\n // }\n\n if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table));\n }\n};\nfunction selectRowsFn(table, rowModel) {\n const rowSelection = table.getState().rowSelection;\n const newSelectedFlatRows = [];\n const newSelectedRowsById = {};\n\n // Filters top level and nested rows\n const recurseRows = function (rows, depth) {\n return rows.map(row => {\n var _row$subRows2;\n const isSelected = isRowSelected(row, rowSelection);\n if (isSelected) {\n newSelectedFlatRows.push(row);\n newSelectedRowsById[row.id] = row;\n }\n if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows)\n };\n }\n if (isSelected) {\n return row;\n }\n }).filter(Boolean);\n };\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById\n };\n}\nfunction isRowSelected(row, selection) {\n var _selection$row$id;\n return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;\n}\nfunction isSubRowSelected(row, selection, table) {\n var _row$subRows3;\n if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;\n let allChildrenSelected = true;\n let someSelected = false;\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return;\n }\n if (subRow.getCanSelect()) {\n if (isRowSelected(subRow, selection)) {\n someSelected = true;\n } else {\n allChildrenSelected = false;\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows && subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow, selection);\n if (subRowChildrenSelected === 'all') {\n someSelected = true;\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true;\n allChildrenSelected = false;\n } else {\n allChildrenSelected = false;\n }\n }\n });\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false;\n}\n\nconst reSplitAlphaNumeric = /([0-9]+)/gm;\nconst alphanumeric = (rowA, rowB, columnId) => {\n return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());\n};\nconst alphanumericCaseSensitive = (rowA, rowB, columnId) => {\n return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));\n};\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text = (rowA, rowB, columnId) => {\n return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());\n};\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive = (rowA, rowB, columnId) => {\n return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));\n};\nconst datetime = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId);\n const b = rowB.getValue(columnId);\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0;\n};\nconst basic = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));\n};\n\n// Utils\n\nfunction compareBasic(a, b) {\n return a === b ? 0 : a > b ? 1 : -1;\n}\nfunction toString(a) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return '';\n }\n return String(a);\n }\n if (typeof a === 'string') {\n return a;\n }\n return '';\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr, bStr) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean);\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean);\n\n // While\n while (a.length && b.length) {\n const aa = a.shift();\n const bb = b.shift();\n const an = parseInt(aa, 10);\n const bn = parseInt(bb, 10);\n const combo = [an, bn].sort();\n\n // Both are string\n if (isNaN(combo[0])) {\n if (aa > bb) {\n return 1;\n }\n if (bb > aa) {\n return -1;\n }\n continue;\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1])) {\n return isNaN(an) ? -1 : 1;\n }\n\n // Both are numbers\n if (an > bn) {\n return 1;\n }\n if (bn > an) {\n return -1;\n }\n }\n return a.length - b.length;\n}\n\n// Exports\n\nconst sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic\n};\n\n//\n\nconst RowSorting = {\n getInitialState: state => {\n return {\n sorting: [],\n ...state\n };\n },\n getDefaultColumnDef: () => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1\n };\n },\n getDefaultOptions: table => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: e => {\n return e.shiftKey;\n }\n };\n },\n createColumn: (column, table) => {\n column.getAutoSortingFn = () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10);\n let isString = false;\n for (const row of firstRows) {\n const value = row == null ? void 0 : row.getValue(column.id);\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime;\n }\n if (typeof value === 'string') {\n isString = true;\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric;\n }\n }\n }\n if (isString) {\n return sortingFns.text;\n }\n return sortingFns.basic;\n };\n column.getAutoSortDir = () => {\n const firstRow = table.getFilteredRowModel().flatRows[0];\n const value = firstRow == null ? void 0 : firstRow.getValue(column.id);\n if (typeof value === 'string') {\n return 'asc';\n }\n return 'desc';\n };\n column.getSortingFn = () => {\n var _table$options$sortin, _table$options$sortin2;\n if (!column) {\n throw new Error();\n }\n return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn];\n };\n column.toggleSorting = (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder();\n const hasManualValue = typeof desc !== 'undefined' && desc !== null;\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);\n const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);\n let newSorting = [];\n\n // What should we do with this sort action?\n let sortAction;\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';\n\n // Multi-mode\n if (old != null && old.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle';\n } else {\n sortAction = 'add';\n }\n } else {\n // Normal mode\n if (old != null && old.length && existingIndex !== old.length - 1) {\n sortAction = 'replace';\n } else if (existingSorting) {\n sortAction = 'toggle';\n } else {\n sortAction = 'replace';\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove';\n }\n }\n }\n if (sortAction === 'add') {\n var _table$options$maxMul;\n newSorting = [...old, {\n id: column.id,\n desc: nextDesc\n }];\n // Take latest n columns\n newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc\n };\n }\n return d;\n });\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id);\n } else {\n newSorting = [{\n id: column.id,\n desc: nextDesc\n }];\n }\n return newSorting;\n });\n };\n column.getFirstSortDir = () => {\n var _ref, _column$columnDef$sor;\n const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';\n return sortDescFirst ? 'desc' : 'asc';\n };\n column.getNextSortingOrder = multi => {\n var _table$options$enable, _table$options$enable2;\n const firstSortDirection = column.getFirstSortDir();\n const isSorted = column.getIsSorted();\n if (!isSorted) {\n return firstSortDirection;\n }\n if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (\n // If enableSortRemove, enable in general\n multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false;\n }\n return isSorted === 'desc' ? 'asc' : 'desc';\n };\n column.getCanSort = () => {\n var _column$columnDef$ena, _table$options$enable3;\n return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn;\n };\n column.getCanMultiSort = () => {\n var _ref2, _column$columnDef$ena2;\n return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;\n };\n column.getIsSorted = () => {\n var _table$getState$sorti;\n const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';\n };\n column.getSortIndex = () => {\n var _table$getState$sorti2, _table$getState$sorti3;\n return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1;\n };\n column.clearSorting = () => {\n //clear sorting for just 1 column\n table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);\n };\n column.getToggleSortingHandler = () => {\n const canSort = column.getCanSort();\n return e => {\n if (!canSort) return;\n e.persist == null || e.persist();\n column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);\n };\n };\n },\n createTable: table => {\n table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater);\n table.resetSorting = defaultState => {\n var _table$initialState$s, _table$initialState;\n table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);\n };\n table.getPreSortedRowModel = () => table.getGroupedRowModel();\n table.getSortedRowModel = () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table);\n }\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel();\n }\n return table._getSortedRowModel();\n };\n }\n};\n\nconst builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting,\n//depends on ColumnFaceting\nGlobalFiltering,\n//depends on ColumnFiltering\nRowSorting, ColumnGrouping,\n//depends on RowSorting\nRowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing];\n\n//\n\nfunction createTable(options) {\n var _options$_features, _options$initialState;\n if (process.env.NODE_ENV !== 'production' && (options.debugAll || options.debugTable)) {\n console.info('Creating Table Instance...');\n }\n const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])];\n let table = {\n _features\n };\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));\n }, {});\n const mergeOptions = options => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options);\n }\n return {\n ...defaultOptions,\n ...options\n };\n };\n const coreInitialState = {};\n let initialState = {\n ...coreInitialState,\n ...((_options$initialState = options.initialState) != null ? _options$initialState : {})\n };\n table._features.forEach(feature => {\n var _feature$getInitialSt;\n initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;\n });\n const queued = [];\n let queuedTimeout = false;\n const coreInstance = {\n _features,\n options: {\n ...defaultOptions,\n ...options\n },\n initialState,\n _queue: cb => {\n queued.push(cb);\n if (!queuedTimeout) {\n queuedTimeout = true;\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve().then(() => {\n while (queued.length) {\n queued.shift()();\n }\n queuedTimeout = false;\n }).catch(error => setTimeout(() => {\n throw error;\n }));\n }\n },\n reset: () => {\n table.setState(table.initialState);\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options);\n table.options = mergeOptions(newOptions);\n },\n getState: () => {\n return table.options.state;\n },\n setState: updater => {\n table.options.onStateChange == null || table.options.onStateChange(updater);\n },\n _getRowId: (row, index, parent) => {\n var _table$options$getRow;\n return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`;\n },\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table);\n }\n return table._getCoreRowModel();\n },\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel();\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id, searchAll) => {\n let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id];\n if (!row) {\n row = table.getCoreRowModel().rowsById[id];\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`);\n }\n throw new Error();\n }\n }\n return row;\n },\n _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {\n var _defaultColumn;\n defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};\n return {\n header: props => {\n const resolvedColumnDef = props.header.column.columnDef;\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey;\n }\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id;\n }\n return null;\n },\n // footer: props => props.header.column.id,\n cell: props => {\n var _props$renderValue$to, _props$renderValue;\n return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null;\n },\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());\n }, {}),\n ...defaultColumn\n };\n }, getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')),\n _getColumnDefs: () => table.options.columns,\n getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {\n const recurseColumns = function (columnDefs, parent, depth) {\n if (depth === void 0) {\n depth = 0;\n }\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent);\n const groupingColumnDef = columnDef;\n column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : [];\n return column;\n });\n };\n return recurseColumns(columnDefs);\n }, getMemoOptions(options, 'debugColumns', 'getAllColumns')),\n getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns();\n });\n }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')),\n _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {\n return flatColumns.reduce((acc, column) => {\n acc[column.id] = column;\n return acc;\n }, {});\n }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')),\n getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns());\n return orderColumns(leafColumns);\n }, getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')),\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId];\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`);\n }\n return column;\n }\n };\n Object.assign(table, coreInstance);\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index];\n feature == null || feature.createTable == null || feature.createTable(table);\n }\n return table;\n}\n\nfunction getCoreRowModel() {\n return table => memo(() => [table.options.data], data => {\n const rowModel = {\n rows: [],\n flatRows: [],\n rowsById: {}\n };\n const accessRows = function (originalRows, depth, parentRow) {\n if (depth === void 0) {\n depth = 0;\n }\n const rows = [];\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id);\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row);\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row;\n // Push table row into parent\n rows.push(row);\n\n // Get the original subrows\n if (table.options.getSubRows) {\n var _row$originalSubRows;\n row.originalSubRows = table.options.getSubRows(originalRows[i], i);\n\n // Then recursively access them\n if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row);\n }\n }\n }\n return rows;\n };\n rowModel.rows = accessRows(data);\n return rowModel;\n }, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex()));\n}\n\nfunction getExpandedRowModel() {\n return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {\n if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {\n return rowModel;\n }\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel;\n }\n return expandRows(rowModel);\n }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel'));\n}\nfunction expandRows(rowModel) {\n const expandedRows = [];\n const handleRow = row => {\n var _row$subRows;\n expandedRows.push(row);\n if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow);\n }\n };\n rowModel.rows.forEach(handleRow);\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById\n };\n}\n\nfunction getFacetedMinMaxValues() {\n return (table, columnId) => memo(() => {\n var _table$getColumn;\n return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];\n }, facetedRowModel => {\n if (!facetedRowModel) return undefined;\n const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => {\n var _flatRow$getUniqueVal;\n return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : [];\n }).map(Number).filter(value => !Number.isNaN(value));\n if (!uniqueValues.length) return;\n let facetedMinValue = uniqueValues[0];\n let facetedMaxValue = uniqueValues[uniqueValues.length - 1];\n for (const value of uniqueValues) {\n if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value;\n }\n return [facetedMinValue, facetedMaxValue];\n }, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues'));\n}\n\nfunction filterRows(rows, filterRowImpl, table) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table);\n }\n return filterRowModelFromRoot(rows, filterRowImpl, table);\n}\nfunction filterRowModelFromLeafs(rowsToFilter, filterRow, table) {\n var _table$options$maxLea;\n const newFilteredFlatRows = [];\n const newFilteredRowsById = {};\n const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100;\n const recurseFilterRows = function (rowsToFilter, depth) {\n if (depth === void 0) {\n depth = 0;\n }\n const rows = [];\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n var _row$subRows;\n let row = rowsToFilter[i];\n const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId);\n newRow.columnFilters = row.columnFilters;\n if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1);\n row = newRow;\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row);\n newFilteredRowsById[row.id] = row;\n newFilteredFlatRows.push(row);\n continue;\n }\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row);\n newFilteredRowsById[row.id] = row;\n newFilteredFlatRows.push(row);\n continue;\n }\n } else {\n row = newRow;\n if (filterRow(row)) {\n rows.push(row);\n newFilteredRowsById[row.id] = row;\n newFilteredFlatRows.push(row);\n }\n }\n }\n return rows;\n };\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById\n };\n}\nfunction filterRowModelFromRoot(rowsToFilter, filterRow, table) {\n var _table$options$maxLea2;\n const newFilteredFlatRows = [];\n const newFilteredRowsById = {};\n const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100;\n\n // Filters top level and nested rows\n const recurseFilterRows = function (rowsToFilter, depth) {\n if (depth === void 0) {\n depth = 0;\n }\n // Filter from parents downward first\n\n const rows = [];\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i];\n const pass = filterRow(row);\n if (pass) {\n var _row$subRows2;\n if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {\n const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId);\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1);\n row = newRow;\n }\n rows.push(row);\n newFilteredFlatRows.push(row);\n newFilteredRowsById[row.id] = row;\n }\n }\n return rows;\n };\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById\n };\n}\n\nfunction getFacetedRowModel() {\n return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {\n if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {\n return preRowModel;\n }\n const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean);\n const filterRowsImpl = row => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]] === false) {\n return false;\n }\n }\n return true;\n };\n return filterRows(preRowModel.rows, filterRowsImpl, table);\n }, getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel'));\n}\n\nfunction getFacetedUniqueValues() {\n return (table, columnId) => memo(() => {\n var _table$getColumn;\n return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];\n }, facetedRowModel => {\n if (!facetedRowModel) return new Map();\n let facetedUniqueValues = new Map();\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);\n for (let j = 0; j < values.length; j++) {\n const value = values[j];\n if (facetedUniqueValues.has(value)) {\n var _facetedUniqueValues$;\n facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1);\n } else {\n facetedUniqueValues.set(value, 1);\n }\n }\n }\n return facetedUniqueValues;\n }, getMemoOptions(table.options, 'debugTable', `getFacetedUniqueValues_${columnId}`));\n}\n\nfunction getFilteredRowModel() {\n return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {\n if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i].columnFilters = {};\n rowModel.flatRows[i].columnFiltersMeta = {};\n }\n return rowModel;\n }\n const resolvedColumnFilters = [];\n const resolvedGlobalFilters = [];\n (columnFilters != null ? columnFilters : []).forEach(d => {\n var _filterFn$resolveFilt;\n const column = table.getColumn(d.id);\n if (!column) {\n return;\n }\n const filterFn = column.getFilterFn();\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`);\n }\n return;\n }\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value\n });\n });\n const filterableIds = (columnFilters != null ? columnFilters : []).map(d => d.id);\n const globalFilterFn = table.getGlobalFilterFn();\n const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter());\n if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {\n filterableIds.push('__global__');\n globallyFilterableColumns.forEach(column => {\n var _globalFilterFn$resol;\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter\n });\n });\n }\n let currentColumnFilter;\n let currentGlobalFilter;\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j];\n row.columnFilters = {};\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i];\n const id = currentColumnFilter.id;\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {\n row.columnFiltersMeta[id] = filterMeta;\n });\n }\n }\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i];\n const id = currentGlobalFilter.id;\n // Tag the row with the first truthy global filter state\n if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {\n row.columnFiltersMeta[id] = filterMeta;\n })) {\n row.columnFilters.__global__ = true;\n break;\n }\n }\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false;\n }\n }\n }\n const filterRowsImpl = row => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]] === false) {\n return false;\n }\n }\n return true;\n };\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table);\n }, getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => table._autoResetPageIndex()));\n}\n\nfunction getGroupedRowModel() {\n return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n rowModel.rows.forEach(row => {\n row.depth = 0;\n row.parentId = undefined;\n });\n return rowModel;\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));\n const groupedFlatRows = [];\n const groupedRowsById = {};\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = function (rows, depth, parentId) {\n if (depth === void 0) {\n depth = 0;\n }\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth;\n groupedFlatRows.push(row);\n groupedRowsById[row.id] = row;\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id);\n }\n return row;\n });\n }\n const columnId = existingGrouping[depth];\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId);\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => {\n let [groupingValue, groupedRows] = _ref;\n let id = `${columnId}:${groupingValue}`;\n id = parentId ? `${parentId}>${id}` : id;\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id);\n subRows.forEach(subRow => {\n subRow.parentId = id;\n });\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;\n const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId);\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: columnId => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId];\n }\n if (groupedRows[0]) {\n var _groupedRows$0$getVal;\n row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;\n }\n return row._valuesCache[columnId];\n }\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId];\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId);\n const aggregateFn = column == null ? void 0 : column.getAggregationFn();\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);\n return row._groupingValuesCache[columnId];\n }\n }\n });\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow);\n groupedRowsById[subRow.id] = subRow;\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n });\n return row;\n });\n return aggregatedGroupedRows;\n };\n const groupedRows = groupUpRecursively(rowModel.rows, 0);\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow);\n groupedRowsById[subRow.id] = subRow;\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n });\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById\n };\n }, getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {\n table._queue(() => {\n table._autoResetExpanded();\n table._autoResetPageIndex();\n });\n }));\n}\nfunction groupBy(rows, columnId) {\n const groupMap = new Map();\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`;\n const previous = map.get(resKey);\n if (!previous) {\n map.set(resKey, [row]);\n } else {\n previous.push(row);\n }\n return map;\n }, groupMap);\n}\n\nfunction getPaginationRowModel(opts) {\n return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel;\n }\n const {\n pageSize,\n pageIndex\n } = pagination;\n let {\n rows,\n flatRows,\n rowsById\n } = rowModel;\n const pageStart = pageSize * pageIndex;\n const pageEnd = pageStart + pageSize;\n rows = rows.slice(pageStart, pageEnd);\n let paginatedRowModel;\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById\n });\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById\n };\n }\n paginatedRowModel.flatRows = [];\n const handleRow = row => {\n paginatedRowModel.flatRows.push(row);\n if (row.subRows.length) {\n row.subRows.forEach(handleRow);\n }\n };\n paginatedRowModel.rows.forEach(handleRow);\n return paginatedRowModel;\n }, getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel'));\n}\n\nfunction getSortedRowModel() {\n return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {\n if (!rowModel.rows.length || !(sorting != null && sorting.length)) {\n return rowModel;\n }\n const sortingState = table.getState().sorting;\n const sortedFlatRows = [];\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort => {\n var _table$getColumn;\n return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();\n });\n const columnInfoById = {};\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id);\n if (!column) return;\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn()\n };\n });\n const sortData = rows => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = rows.map(row => ({\n ...row\n }));\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n var _sortEntry$desc;\n const sortEntry = availableSorting[i];\n const columnInfo = columnInfoById[sortEntry.id];\n const sortUndefined = columnInfo.sortUndefined;\n const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;\n let sortInt = 0;\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id);\n const bValue = rowB.getValue(sortEntry.id);\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1;\n }\n if (columnInfo.invertSorting) {\n sortInt *= -1;\n }\n return sortInt;\n }\n }\n return rowA.index - rowB.index;\n });\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n var _row$subRows;\n sortedFlatRows.push(row);\n if ((_row$subRows = row.subRows) != null && _row$subRows.length) {\n row.subRows = sortData(row.subRows);\n }\n });\n return sortedData;\n };\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById\n };\n }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex()));\n}\n\nexport { ColumnFaceting, ColumnFiltering, ColumnGrouping, ColumnOrdering, ColumnPinning, ColumnSizing, ColumnVisibility, GlobalFaceting, GlobalFiltering, Headers, RowExpanding, RowPagination, RowPinning, RowSelection, RowSorting, _getVisibleLeafColumns, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getMemoOptions, getPaginationRowModel, getSortedRowModel, isFunction, isNumberArray, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns };\n//# sourceMappingURL=index.mjs.map\n","import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable = React.ReactNode | React.ComponentType\n\n//\n\n/**\n * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`.\n */\nexport function flexRender(\n Comp: Renderable,\n props: TProps\n): React.ReactNode | React.JSX.Element {\n return !Comp ? null : isReactComponent(Comp) ? (\n \n ) : (\n Comp\n )\n}\n\nfunction isReactComponent(\n component: unknown\n): component is React.ComponentType {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport function useReactTable(\n options: TableOptions\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n tableRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n return tableRef.current\n}\n"],"names":["functionalUpdate","updater","input","makeStateUpdater","key","instance","setState","old","isFunction","d","Function","isNumberArray","Array","isArray","every","val","flattenBy","arr","getChildren","flat","recurse","subArr","forEach","item","push","children","length","memo","getDeps","fn","opts","result","deps","depArgs","depTime","debug","Date","now","newDeps","some","dep","index","resultTime","onChange","depEndTime","Math","round","resultEndTime","resultFpsPercentage","pad","str","num","String","console","info","max","min","getMemoOptions","tableOptions","debugLevel","_tableOptions$debugAl","debugAll","createCell","table","row","column","columnId","cell","id","getValue","renderValue","_cell$getValue","options","renderFallbackValue","getContext","_features","feature","createColumn","columnDef","depth","parent","_ref","_resolvedColumnDef$id","resolvedColumnDef","_getDefaultColumnDef","accessorKey","accessorFn","prototype","replaceAll","replace","undefined","header","includes","originalRow","split","_result","Error","columns","getFlatColumns","_column$columns","flatMap","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","leafColumns","createHeader","_options$id","isPlaceholder","placeholderId","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","map","Headers","createTable","getHeaderGroups","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","_left$map$filter","_right$map$filter","leftColumns","find","filter","Boolean","rightColumns","buildHeaderGroups","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","getRightHeaderGroups","_right$map$filter2","getFooterGroups","headerGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","getIsVisible","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","bottomHeaders","recurseHeadersForSpans","childRowSpans","childColSpan","childRowSpan","createRow","original","rowIndex","subRows","parentId","_valuesCache","_uniqueValuesCache","hasOwnProperty","getColumn","getUniqueValues","_row$getValue","getLeafRows","getParentRow","getRow","getParentRows","parentRows","currentRow","parentRow","getAllCells","getAllLeafColumns","_getAllCellsByColumnId","allCells","reduce","acc","i","ColumnFaceting","_getFacetedRowModel","getFacetedRowModel","getPreFilteredRowModel","_getFacetedUniqueValues","getFacetedUniqueValues","Map","_getFacetedMinMaxValues","getFacetedMinMaxValues","includesString","filterValue","_filterValue$toString","search","toString","toLowerCase","autoRemove","testFalsey","includesStringSensitive","_row$getValue2","equalsString","_row$getValue3","arrIncludes","_row$getValue4","arrIncludesAll","_row$getValue5","arrIncludesSome","_row$getValue6","equals","weakEquals","inNumberRange","rowValue","resolveFilterValue","unsafeMin","unsafeMax","parsedMin","parseFloat","parsedMax","Number","isNaN","Infinity","temp","filterFns","ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","onColumnFiltersChange","filterFromLeafRows","maxLeafRowFilterDepth","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getFilterFn","_table$options$filter","_table$options$filter2","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","previousFilter","newFilter","_old$filter","shouldAutoRemoveFilter","newFilterObj","_old$map","_table","columnFiltersMeta","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getFilteredRowModel","_getFilteredRowModel","manualFiltering","aggregationFns","sum","_leafRows","childRows","next","nextValue","extent","mean","leafRows","count","median","values","mid","floor","nums","sort","a","b","unique","from","Set","uniqueCount","size","_columnId","ColumnGrouping","aggregatedCell","props","_toString","_props$getValue","aggregationFn","grouping","onGroupingChange","groupedColumnMode","toggleGrouping","setGrouping","getCanGroup","enableGrouping","getGroupingValue","getIsGrouped","_table$getState$group","getGroupedIndex","_table$getState$group2","indexOf","getToggleGroupingHandler","canGroup","getAutoAggregationFn","Object","call","getAggregationFn","_table$options$aggreg","_table$options$aggreg2","resetGrouping","_table$initialState$g","getPreGroupedRowModel","getGroupedRowModel","_getGroupedRowModel","manualGrouping","groupingColumnId","_groupingValuesCache","getIsPlaceholder","getIsAggregated","_row$subRows","nonGroupingColumns","col","g","ColumnOrdering","columnOrder","onColumnOrderChange","getIndex","position","_getVisibleLeafColumns","getIsFirstColumn","_columns$","getIsLastColumn","_columns","setColumnOrder","resetColumnOrder","orderedColumns","columnOrderCopy","columnsCopy","targetColumnId","shift","foundIndex","splice","ColumnPinning","onColumnPinningChange","pin","columnIds","setColumnPinning","_old$left3","_old$right3","_old$left","_old$right","_old$left2","_old$right2","getCanPin","_d$columnDef$enablePi","enablePinning","enableColumnPinning","getIsPinned","leafColumnIds","isLeft","isRight","getPinnedIndex","getCenterVisibleCells","_getAllVisibleCells","leftAndRight","getLeftVisibleCells","getRightVisibleCells","resetColumnPinning","getIsSomeColumnsPinned","_pinningState$positio","pinningState","_pinningState$left","_pinningState$right","getLeftLeafColumns","getRightLeafColumns","getCenterLeafColumns","defaultColumnSizing","minSize","maxSize","MAX_SAFE_INTEGER","ColumnSizing","columnSizing","columnSizingInfo","startOffset","startSize","deltaOffset","deltaPercentage","isResizingColumn","columnSizingStart","columnResizeMode","columnResizeDirection","onColumnSizingChange","onColumnSizingInfoChange","getSize","_column$columnDef$min","_column$columnDef$max","columnSize","getStart","slice","getAfter","resetSize","setColumnSizing","_ref2","_","rest","getCanResize","enableResizing","enableColumnResizing","getIsResizing","_header$column$getSiz","prevSiblingHeader","getResizeHandler","_contextDocument","canResize","e","persist","isTouchStartEvent","touches","clientX","newColumnSizing","updateOffset","eventType","clientXPos","setColumnSizingInfo","_old$startOffset","_old$startSize","deltaDirection","_ref3","headerSize","onMove","onEnd","contextDocument","document","mouseEvents","moveHandler","upHandler","removeEventListener","touchEvents","cancelable","preventDefault","stopPropagation","_e$touches$","passiveIfSupported","passiveEventSupported","passive","addEventListener","resetColumnSizing","resetHeaderSizeInfo","_table$initialState$c2","getTotalSize","_table$getHeaderGroup","_table$getHeaderGroup2","getLeftTotalSize","_table$getLeftHeaderG","_table$getLeftHeaderG2","getCenterTotalSize","_table$getCenterHeade","_table$getCenterHeade2","getRightTotalSize","_table$getRightHeader","_table$getRightHeader2","passiveSupported","supported","noop","window","err","type","ColumnVisibility","columnVisibility","onColumnVisibilityChange","toggleVisibility","getCanHide","setColumnVisibility","childColumns","c","enableHiding","getToggleVisibilityHandler","target","checked","cells","getVisibleCells","makeVisibleColumnsMethod","getColumns","getVisibleFlatColumns","getAllFlatColumns","getLeftVisibleLeafColumns","getRightVisibleLeafColumns","getCenterVisibleLeafColumns","resetColumnVisibility","toggleAllColumnsVisible","_value","getIsAllColumnsVisible","obj","getIsSomeColumnsVisible","getToggleAllColumnsVisibilityHandler","_target","GlobalFaceting","_getGlobalFacetedRowModel","getGlobalFacetedRowModel","_getGlobalFacetedUniqueValues","getGlobalFacetedUniqueValues","_getGlobalFacetedMinMaxValues","getGlobalFacetedMinMaxValues","GlobalFiltering","globalFilter","onGlobalFilterChange","globalFilterFn","getColumnCanGlobalFilter","_table$getCoreRowMode","getCanGlobalFilter","_table$options$getCol","enableGlobalFilter","getGlobalAutoFilterFn","getGlobalFilterFn","setGlobalFilter","resetGlobalFilter","RowExpanding","expanded","onExpandedChange","paginateExpandedRows","registered","queued","_autoResetExpanded","_table$options$autoRe","autoResetAll","autoResetExpanded","manualExpanding","_queue","resetExpanded","setExpanded","toggleAllRowsExpanded","getIsAllRowsExpanded","_table$initialState$e","getCanSomeRowsExpand","getPrePaginationRowModel","getCanExpand","getToggleAllRowsExpandedHandler","getIsSomeRowsExpanded","keys","getRowModel","getIsExpanded","getExpandedDepth","rowsById","splitId","getPreExpandedRowModel","getSortedRowModel","getExpandedRowModel","_getExpandedRowModel","toggleExpanded","_expanded","exists","oldExpanded","rowId","_table$options$getIsR","getIsRowExpanded","_table$options$getRow","getRowCanExpand","enableExpanding","getIsAllParentsExpanded","isFullyExpanded","getToggleExpandedHandler","canExpand","RowPagination","pagination","pageIndex","pageSize","onPaginationChange","_autoResetPageIndex","autoResetPageIndex","manualPagination","resetPageIndex","setPagination","resetPagination","_table$initialState$p","setPageIndex","maxPageIndex","pageCount","_table$initialState$p2","resetPageSize","_table$initialState$p3","_table$initialState2","setPageSize","topRowIndex","setPageCount","_table$options$pageCo","newPageCount","getPageOptions","getPageCount","pageOptions","fill","getCanPreviousPage","getCanNextPage","previousPage","nextPage","firstPage","lastPage","getPaginationRowModel","_getPaginationRowModel","_table$options$pageCo2","ceil","getRowCount","_table$options$rowCou","rowCount","rows","RowPinning","rowPinning","top","bottom","onRowPinningChange","includeLeafRows","includeParentRows","leafRowIds","parentRowIds","rowIds","setRowPinning","_old$top3","_old$bottom3","_old$top","_old$bottom","_old$top2","_old$bottom2","has","enableRowPinning","isTop","isBottom","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","resetRowPinning","_table$initialState$r","getIsSomeRowsPinned","_pinningState$top","_pinningState$bottom","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","keepPinnedRows","allRows","topPinnedRowIds","bottomPinnedRowIds","getCenterRows","topAndBottom","RowSelection","rowSelection","onRowSelectionChange","enableRowSelection","enableMultiRowSelection","enableSubRowSelection","setRowSelection","resetRowSelection","toggleAllRowsSelected","getIsAllRowsSelected","preGroupedFlatRows","getCanSelect","toggleAllPageRowsSelected","resolvedValue","getIsAllPageRowsSelected","mutateRowIsSelected","getPreSelectedRowModel","getSelectedRowModel","rowModel","selectRowsFn","getFilteredSelectedRowModel","getGroupedSelectedRowModel","isAllRowsSelected","paginationFlatRows","isAllPageRowsSelected","getIsSomeRowsSelected","_table$getState$rowSe","totalSelected","getIsSomePageRowsSelected","getIsSelected","getIsSomeSelected","getToggleAllRowsSelectedHandler","getToggleAllPageRowsSelectedHandler","toggleSelected","isSelected","_opts$selectChildren","selectedRowIds","selectChildren","isRowSelected","isSubRowSelected","getIsAllSubRowsSelected","getCanSelectSubRows","getCanMultiSelect","_table$options$enable3","getToggleSelectedHandler","canSelect","includeChildren","newSelectedFlatRows","newSelectedRowsById","recurseRows","_row$subRows2","selection","_selection$row$id","_row$subRows3","allChildrenSelected","someSelected","subRow","subRowChildrenSelected","reSplitAlphaNumeric","compareBasic","compareAlphanumeric","aStr","bStr","aa","bb","an","parseInt","bn","combo","sortingFns","alphanumeric","rowA","rowB","alphanumericCaseSensitive","text","textCaseSensitive","datetime","basic","RowSorting","sorting","sortingFn","sortUndefined","onSortingChange","isMultiSortEvent","shiftKey","getAutoSortingFn","firstRows","isString","getAutoSortDir","getSortingFn","_table$options$sortin","_table$options$sortin2","toggleSorting","desc","multi","nextSortingOrder","getNextSortingOrder","hasManualValue","setSorting","existingSorting","existingIndex","sortAction","newSorting","nextDesc","_table$options$maxMul","getCanMultiSort","maxMultiSortColCount","getFirstSortDir","_column$columnDef$sor","sortDescFirst","firstSortDirection","isSorted","getIsSorted","enableSortingRemoval","enableMultiRemove","getCanSort","enableSorting","_column$columnDef$ena2","enableMultiSort","_table$getState$sorti","columnSort","getSortIndex","_table$getState$sorti2","_table$getState$sorti3","clearSorting","getToggleSortingHandler","canSort","resetSorting","_table$initialState$s","getPreSortedRowModel","_getSortedRowModel","manualSorting","builtInFeatures","_options$_features","_options$initialState","defaultOptions","assign","_feature$getInitialSt","queuedTimeout","coreInstance","cb","Promise","resolve","then","catch","error","setTimeout","reset","setOptions","newOptions","mergeOptions","onStateChange","_getRowId","getRowId","_getCoreRowModel","searchAll","defaultColumn","_defaultColumn","_props$renderValue$to","_props$renderValue","_getColumnDefs","columnDefs","recurseColumns","groupingColumnDef","_getAllFlatColumnsById","flatColumns","expandRows","expandedRows","handleRow","filterRows","filterRowImpl","rowsToFilter","filterRow","_table$options$maxLea","newFilteredFlatRows","newFilteredRowsById","recurseFilterRows","newRow","filterRowModelFromLeafs","_table$options$maxLea2","filterRowModelFromRoot","accessor","display","group","Comp","component","proto","getPrototypeOf","isReactComponent","isClassComponent","$$typeof","description","isExoticComponent","React","createElement","data","accessRows","originalRows","_row$originalSubRows","getSubRows","originalSubRows","_table$getColumn","facetedRowModel","uniqueValues","flatRow","_flatRow$getUniqueVal","facetedMinValue","facetedMaxValue","preRowModel","filterableIds","facetedUniqueValues","j","_facetedUniqueValues$","set","get","resolvedColumnFilters","resolvedGlobalFilters","_filterFn$resolveFilt","globallyFilterableColumns","currentColumnFilter","currentGlobalFilter","_globalFilterFn$resol","filterMeta","__global__","existingGrouping","groupedFlatRows","groupedRowsById","groupUpRecursively","rowGroupsMap","groupMap","resKey","previous","groupBy","aggregatedGroupedRows","entries","groupingValue","groupedRows","_groupedRows$0$getVal","aggregateFn","pageStart","pageEnd","paginatedRowModel","sortingState","sortedFlatRows","availableSorting","columnInfoById","sortEntry","invertSorting","sortData","sortedData","_sortEntry$desc","columnInfo","isDesc","sortInt","aUndefined","bUndefined","resolvedOptions","tableRef","useState","current","prev"],"mappings":";;;;;;;;;;;;;;;;;;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K,UAAUT,EAAMC,EAAM8K,EAAUr2B,KAIvC,IAAZ42B,EAOF,OANID,IACFC,IAAY,GAEVF,EAAWJ,gBACbM,IAAY,GAEPA,CAEV,CACD,OAAOtL,EAAKjtB,MAAQktB,EAAKltB,KAAK,IAIhCm4B,EAAWt5B,SAAQ0C,IACjB,IAAI4S,EACJ0jB,EAAe94B,KAAKwC,GACgB,OAA/B4S,EAAe5S,EAAI4H,UAAoBgL,EAAalV,SACvDsC,EAAI4H,QAAU+uB,EAAS32B,EAAI4H,SAC5B,IAEIgvB,CAAU,EAEnB,MAAO,CACLpS,KAAMmS,EAAStO,EAAS7D,MACxB/X,SAAU6pB,EACV3V,SAAU0H,EAAS1H,SACpB,GACAlhB,EAAeM,EAAMS,QAAS,aAAc,GAAqB,IAAMT,EAAMqiB,wBAClF,+GAt3GA,WAEA,kJCtBO,SACL5hB,GAGA,MAAM22B,EAA+C,CACnDnrB,MAAO,CAAE,EACT0kB,cAAeA,OACfjwB,oBAAqB,QAClBD,IAIE42B,GAAYhE,EAAMiE,UAAS,KAAO,CACvCC,QAAS9zB,GAAmB2zB,QAIvBnrB,EAAO1P,GAAY82B,EAAMiE,UAAS,IAAMD,EAASE,QAAQ3oB,eAmBhE,OAfAyoB,EAASE,QAAQ/G,YAAWgH,IAAS,IAChCA,KACA/2B,EACHwL,MAAO,IACFA,KACAxL,EAAQwL,OAIb0kB,cAAez0B,IACbK,EAASL,GACTuE,MAAAA,EAAQkwB,eAARlwB,EAAQkwB,cAAgBz0B,EAAQ,MAI7Bm7B,EAASE,OAClB"} \ No newline at end of file diff --git a/node_modules/@tanstack/react-table/package.json b/node_modules/@tanstack/react-table/package.json new file mode 100644 index 00000000..b30a8bca --- /dev/null +++ b/node_modules/@tanstack/react-table/package.json @@ -0,0 +1,56 @@ +{ + "name": "@tanstack/react-table", + "version": "8.21.3", + "description": "Headless UI for building powerful tables & datagrids for React.", + "author": "Tanner Linsley", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/TanStack/table.git", + "directory": "packages/react-table" + }, + "homepage": "https://tanstack.com/table", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "keywords": [ + "react", + "table", + "react-table", + "datagrid" + ], + "type": "commonjs", + "module": "build/lib/index.esm.js", + "main": "build/lib/index.js", + "types": "build/lib/index.d.ts", + "exports": { + ".": { + "types": "./build/lib/index.d.ts", + "import": "./build/lib/index.mjs", + "default": "./build/lib/index.js" + }, + "./package.json": "./package.json" + }, + "sideEffects": false, + "engines": { + "node": ">=12" + }, + "files": [ + "build/lib/*", + "build/umd/*", + "src" + ], + "dependencies": { + "@tanstack/table-core": "8.21.3" + }, + "devDependencies": { + "@types/react": "^18.3.3", + "react": "^18.3.1" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + }, + "scripts": {} +} \ No newline at end of file diff --git a/node_modules/@tanstack/react-table/src/index.tsx b/node_modules/@tanstack/react-table/src/index.tsx new file mode 100644 index 00000000..132ea490 --- /dev/null +++ b/node_modules/@tanstack/react-table/src/index.tsx @@ -0,0 +1,94 @@ +import * as React from 'react' +export * from '@tanstack/table-core' + +import { + TableOptions, + TableOptionsResolved, + RowData, + createTable, +} from '@tanstack/table-core' + +export type Renderable = React.ReactNode | React.ComponentType + +// + +/** + * If rendering headers, cells, or footers with custom markup, use flexRender instead of `cell.getValue()` or `cell.renderValue()`. + */ +export function flexRender( + Comp: Renderable, + props: TProps +): React.ReactNode | React.JSX.Element { + return !Comp ? null : isReactComponent(Comp) ? ( + + ) : ( + Comp + ) +} + +function isReactComponent( + component: unknown +): component is React.ComponentType { + return ( + isClassComponent(component) || + typeof component === 'function' || + isExoticComponent(component) + ) +} + +function isClassComponent(component: any) { + return ( + typeof component === 'function' && + (() => { + const proto = Object.getPrototypeOf(component) + return proto.prototype && proto.prototype.isReactComponent + })() + ) +} + +function isExoticComponent(component: any) { + return ( + typeof component === 'object' && + typeof component.$$typeof === 'symbol' && + ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description) + ) +} + +export function useReactTable( + options: TableOptions +) { + // Compose in the generic options to the user options + const resolvedOptions: TableOptionsResolved = { + state: {}, // Dummy state + onStateChange: () => {}, // noop + renderFallbackValue: null, + ...options, + } + + // Create a new table and store it in state + const [tableRef] = React.useState(() => ({ + current: createTable(resolvedOptions), + })) + + // By default, manage table state here using the table's initial state + const [state, setState] = React.useState(() => tableRef.current.initialState) + + // Compose the default state above with any user state. This will allow the user + // to only control a subset of the state if desired. + tableRef.current.setOptions(prev => ({ + ...prev, + ...options, + state: { + ...state, + ...options.state, + }, + // Similarly, we'll maintain both our internal state and any user-provided + // state. + onStateChange: updater => { + setState(updater) + options.onStateChange?.(updater) + }, + })) + + return tableRef.current +} diff --git a/node_modules/@tanstack/table-core/LICENSE b/node_modules/@tanstack/table-core/LICENSE new file mode 100644 index 00000000..9fe1442e --- /dev/null +++ b/node_modules/@tanstack/table-core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Tanner Linsley + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@tanstack/table-core/build/lib/aggregationFns.d.ts b/node_modules/@tanstack/table-core/build/lib/aggregationFns.d.ts new file mode 100644 index 00000000..824d292d --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/aggregationFns.d.ts @@ -0,0 +1,13 @@ +import { AggregationFn } from './features/ColumnGrouping'; +export declare const aggregationFns: { + sum: AggregationFn; + min: AggregationFn; + max: AggregationFn; + extent: AggregationFn; + mean: AggregationFn; + median: AggregationFn; + unique: AggregationFn; + uniqueCount: AggregationFn; + count: AggregationFn; +}; +export type BuiltInAggregationFn = keyof typeof aggregationFns; diff --git a/node_modules/@tanstack/table-core/build/lib/aggregationFns.js b/node_modules/@tanstack/table-core/build/lib/aggregationFns.js new file mode 100644 index 00000000..7deefcb0 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/aggregationFns.js @@ -0,0 +1,108 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('./utils.js'); + +const sum = (columnId, _leafRows, childRows) => { + // It's faster to just add the aggregations together instead of + // process leaf nodes individually + return childRows.reduce((sum, next) => { + const nextValue = next.getValue(columnId); + return sum + (typeof nextValue === 'number' ? nextValue : 0); + }, 0); +}; +const min = (columnId, _leafRows, childRows) => { + let min; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (min > value || min === undefined && value >= value)) { + min = value; + } + }); + return min; +}; +const max = (columnId, _leafRows, childRows) => { + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (max < value || max === undefined && value >= value)) { + max = value; + } + }); + return max; +}; +const extent = (columnId, _leafRows, childRows) => { + let min; + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null) { + if (min === undefined) { + if (value >= value) min = max = value; + } else { + if (min > value) min = value; + if (max < value) max = value; + } + } + }); + return [min, max]; +}; +const mean = (columnId, leafRows) => { + let count = 0; + let sum = 0; + leafRows.forEach(row => { + let value = row.getValue(columnId); + if (value != null && (value = +value) >= value) { + ++count, sum += value; + } + }); + if (count) return sum / count; + return; +}; +const median = (columnId, leafRows) => { + if (!leafRows.length) { + return; + } + const values = leafRows.map(row => row.getValue(columnId)); + if (!utils.isNumberArray(values)) { + return; + } + if (values.length === 1) { + return values[0]; + } + const mid = Math.floor(values.length / 2); + const nums = values.sort((a, b) => a - b); + return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2; +}; +const unique = (columnId, leafRows) => { + return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values()); +}; +const uniqueCount = (columnId, leafRows) => { + return new Set(leafRows.map(d => d.getValue(columnId))).size; +}; +const count = (_columnId, leafRows) => { + return leafRows.length; +}; +const aggregationFns = { + sum, + min, + max, + extent, + mean, + median, + unique, + uniqueCount, + count +}; + +exports.aggregationFns = aggregationFns; +//# sourceMappingURL=aggregationFns.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/aggregationFns.js.map b/node_modules/@tanstack/table-core/build/lib/aggregationFns.js.map new file mode 100644 index 00000000..f21f5de9 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/aggregationFns.js.map @@ -0,0 +1 @@ +{"version":3,"file":"aggregationFns.js","sources":["../../src/aggregationFns.ts"],"sourcesContent":["import { AggregationFn } from './features/ColumnGrouping'\nimport { isNumberArray } from './utils'\n\nconst sum: AggregationFn = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId)\n return sum + (typeof nextValue === 'number' ? nextValue : 0)\n }, 0)\n}\n\nconst min: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n\n if (\n value != null &&\n (min! > value || (min === undefined && value >= value))\n ) {\n min = value\n }\n })\n\n return min\n}\n\nconst max: AggregationFn = (columnId, _leafRows, childRows) => {\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (\n value != null &&\n (max! < value || (max === undefined && value >= value))\n ) {\n max = value\n }\n })\n\n return max\n}\n\nconst extent: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value\n } else {\n if (min > value) min = value\n if (max! < value) max = value\n }\n }\n })\n\n return [min, max]\n}\n\nconst mean: AggregationFn = (columnId, leafRows) => {\n let count = 0\n let sum = 0\n\n leafRows.forEach(row => {\n let value = row.getValue(columnId)\n if (value != null && (value = +value) >= value) {\n ++count, (sum += value)\n }\n })\n\n if (count) return sum / count\n\n return\n}\n\nconst median: AggregationFn = (columnId, leafRows) => {\n if (!leafRows.length) {\n return\n }\n\n const values = leafRows.map(row => row.getValue(columnId))\n if (!isNumberArray(values)) {\n return\n }\n if (values.length === 1) {\n return values[0]\n }\n\n const mid = Math.floor(values.length / 2)\n const nums = values.sort((a, b) => a - b)\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1]! + nums[mid]!) / 2\n}\n\nconst unique: AggregationFn = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values())\n}\n\nconst uniqueCount: AggregationFn = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size\n}\n\nconst count: AggregationFn = (_columnId, leafRows) => {\n return leafRows.length\n}\n\nexport const aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count,\n}\n\nexport type BuiltInAggregationFn = keyof typeof aggregationFns\n"],"names":["sum","columnId","_leafRows","childRows","reduce","next","nextValue","getValue","min","forEach","row","value","undefined","max","extent","mean","leafRows","count","median","length","values","map","isNumberArray","mid","Math","floor","nums","sort","a","b","unique","Array","from","Set","d","uniqueCount","size","_columnId","aggregationFns"],"mappings":";;;;;;;;;;;;;;AAGA,MAAMA,GAAuB,GAAGA,CA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e,WAA+B,GAAGA,CAAClC,QAAQ,EAAEe,QAAQ,KAAK;AAC9D,EAAA,OAAO,IAAIiB,GAAG,CAACjB,QAAQ,CAACK,GAAG,CAACa,CAAC,IAAIA,CAAC,CAAC3B,QAAQ,CAACN,QAAQ,CAAC,CAAC,CAAC,CAACmC,IAAI,CAAA;AAC9D,CAAC,CAAA;AAED,MAAMnB,KAAyB,GAAGA,CAACoB,SAAS,EAAErB,QAAQ,KAAK;EACzD,OAAOA,QAAQ,CAACG,MAAM,CAAA;AACxB,CAAC,CAAA;AAEM,MAAMmB,cAAc,GAAG;EAC5BtC,GAAG;EACHQ,GAAG;EACHK,GAAG;EACHC,MAAM;EACNC,IAAI;EACJG,MAAM;EACNY,MAAM;EACNK,WAAW;AACXlB,EAAAA,KAAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/columnHelper.d.ts b/node_modules/@tanstack/table-core/build/lib/columnHelper.d.ts new file mode 100644 index 00000000..91efff3a --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/columnHelper.d.ts @@ -0,0 +1,8 @@ +import { AccessorFn, AccessorFnColumnDef, AccessorKeyColumnDef, DisplayColumnDef, GroupColumnDef, IdentifiedColumnDef, RowData } from './types'; +import { DeepKeys, DeepValue } from './utils'; +export type ColumnHelper = { + accessor: | DeepKeys, TValue extends TAccessor extends AccessorFn ? TReturn : TAccessor extends DeepKeys ? DeepValue : never>(accessor: TAccessor, column: TAccessor extends AccessorFn ? DisplayColumnDef : IdentifiedColumnDef) => TAccessor extends AccessorFn ? AccessorFnColumnDef : AccessorKeyColumnDef; + display: (column: DisplayColumnDef) => DisplayColumnDef; + group: (column: GroupColumnDef) => GroupColumnDef; +}; +export declare function createColumnHelper(): ColumnHelper; diff --git a/node_modules/@tanstack/table-core/build/lib/columnHelper.js b/node_modules/@tanstack/table-core/build/lib/columnHelper.js new file mode 100644 index 00000000..7b2a991b --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/columnHelper.js @@ -0,0 +1,71 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +// type Person = { +// firstName: string +// lastName: string +// age: number +// visits: number +// status: string +// progress: number +// createdAt: Date +// nested: { +// foo: [ +// { +// bar: 'bar' +// } +// ] +// bar: { subBar: boolean }[] +// baz: { +// foo: 'foo' +// bar: { +// baz: 'baz' +// } +// } +// } +// } + +// const test: DeepKeys = 'nested.foo.0.bar' +// const test2: DeepKeys = 'nested.bar' + +// const helper = createColumnHelper() + +// helper.accessor('nested.foo', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.foo.0.bar', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.bar', { +// cell: info => info.getValue(), +// }) + +function createColumnHelper() { + return { + accessor: (accessor, column) => { + return typeof accessor === 'function' ? { + ...column, + accessorFn: accessor + } : { + ...column, + accessorKey: accessor + }; + }, + display: column => column, + group: column => column + }; +} + +exports.createColumnHelper = createColumnHelper; +//# sourceMappingURL=columnHelper.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/columnHelper.js.map b/node_modules/@tanstack/table-core/build/lib/columnHelper.js.map new file mode 100644 index 00000000..b2716823 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/columnHelper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"columnHelper.js","sources":["../../src/columnHelper.ts"],"sourcesContent":["import {\n AccessorFn,\n AccessorFnColumnDef,\n AccessorKeyColumnDef,\n DisplayColumnDef,\n GroupColumnDef,\n IdentifiedColumnDef,\n RowData,\n} from './types'\nimport { DeepKeys, DeepValue } from './utils'\n\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nexport type ColumnHelper = {\n accessor: <\n TAccessor extends AccessorFn | DeepKeys,\n TValue extends TAccessor extends AccessorFn\n ? TReturn\n : TAccessor extends DeepKeys\n ? DeepValue\n : never,\n >(\n accessor: TAccessor,\n column: TAccessor extends AccessorFn\n ? DisplayColumnDef\n : IdentifiedColumnDef\n ) => TAccessor extends AccessorFn\n ? AccessorFnColumnDef\n : AccessorKeyColumnDef\n display: (column: DisplayColumnDef) => DisplayColumnDef\n group: (column: GroupColumnDef) => GroupColumnDef\n}\n\nexport function createColumnHelper<\n TData extends RowData,\n>(): ColumnHelper {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function'\n ? ({\n ...column,\n accessorFn: accessor,\n } as any)\n : {\n ...column,\n accessorKey: accessor,\n }\n },\n display: column => column,\n group: column => column,\n }\n}\n"],"names":["createColumnHelper","accessor","column","accessorFn","accessorKey","display","group"],"mappings":";;;;;;;;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAsBO,SAASA,kBAAkBA,GAET;EACvB,OAAO;AACLC,IAAAA,QAAQ,EAAEA,CAACA,QAAQ,EAAEC,MAAM,KAAK;AAC9B,MAAA,OAAO,OAAOD,QAAQ,KAAK,UAAU,GAChC;AACC,QAAA,GAAGC,MAAM;AACTC,QAAAA,UAAU,EAAEF,QAAAA;AACd,OAAC,GACD;AACE,QAAA,GAAGC,MAAM;AACTE,QAAAA,WAAW,EAAEH,QAAAA;OACd,CAAA;KACN;IACDI,OAAO,EAAEH,MAAM,IAAIA,MAAM;IACzBI,KAAK,EAAEJ,MAAM,IAAIA,MAAAA;GAClB,CAAA;AACH;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/core/cell.d.ts b/node_modules/@tanstack/table-core/build/lib/core/cell.d.ts new file mode 100644 index 00000000..1cb5f075 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/cell.d.ts @@ -0,0 +1,49 @@ +import { RowData, Cell, Column, Row, Table } from '../types'; +import { Getter } from '../utils'; +export interface CellContext { + cell: Cell; + column: Column; + getValue: Getter; + renderValue: Getter; + row: Row; + table: Table; +} +export interface CoreCell { + /** + * The associated Column object for the cell. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + column: Column; + /** + * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice: + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + getContext: () => CellContext; + /** + * Returns the value for the cell, accessed via the associated column's accessor key or accessor function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + getValue: CellContext['getValue']; + /** + * The unique ID for the cell across the entire table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + id: string; + /** + * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + renderValue: CellContext['renderValue']; + /** + * The associated Row object for the cell. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + row: Row; +} +export declare function createCell(table: Table, row: Row, column: Column, columnId: string): Cell; diff --git a/node_modules/@tanstack/table-core/build/lib/core/cell.js b/node_modules/@tanstack/table-core/build/lib/core/cell.js new file mode 100644 index 00000000..dcc944de --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/cell.js @@ -0,0 +1,42 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +function createCell(table, row, column, columnId) { + const getRenderValue = () => { + var _cell$getValue; + return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + }; + const cell = { + id: `${row.id}_${column.id}`, + row, + column, + getValue: () => row.getValue(columnId), + renderValue: getRenderValue, + getContext: utils.memo(() => [table, column, row, cell], (table, column, row, cell) => ({ + table, + column, + row, + cell: cell, + getValue: cell.getValue, + renderValue: cell.renderValue + }), utils.getMemoOptions(table.options, 'debugCells', 'cell.getContext')) + }; + table._features.forEach(feature => { + feature.createCell == null || feature.createCell(cell, column, row, table); + }, {}); + return cell; +} + +exports.createCell = createCell; +//# sourceMappingURL=cell.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/core/cell.js.map b/node_modules/@tanstack/table-core/build/lib/core/cell.js.map new file mode 100644 index 00000000..302e4c00 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/cell.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cell.js","sources":["../../../src/core/cell.ts"],"sourcesContent":["import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, getMemoOptions, memo } from '../utils'\n\nexport interface CellContext {\n cell: Cell\n column: Column\n getValue: Getter\n renderValue: Getter\n row: Row\n table: Table\n}\n\nexport interface CoreCell {\n /**\n * The associated Column object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n column: Column\n /**\n * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice:\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getContext: () => CellContext\n /**\n * Returns the value for the cell, accessed via the associated column's accessor key or accessor function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getValue: CellContext['getValue']\n /**\n * The unique ID for the cell across the entire table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n id: string\n /**\n * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n renderValue: CellContext['renderValue']\n /**\n * The associated Row object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n row: Row\n}\n\nexport function createCell(\n table: Table,\n row: Row,\n column: Column,\n columnId: string\n): Cell {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n getMemoOptions(table.options, 'debugCells', 'cell.getContext')\n ),\n }\n\n table._features.forEach(feature => {\n feature.createCell?.(\n cell as Cell,\n column,\n row as Row,\n table\n )\n }, {})\n\n return cell as Cell\n}\n"],"names":["createCell","table","row","column","columnId","getRenderValue","_cell$getValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","memo","getMemoOptions","_features","forEach","feature"],"mappings":";;;;;;;;;;;;;;AAmDO,SAASA,UAAUA,CACxBC,KAAmB,EACnBC,GAAe,EACfC,MAA6B,EAC7BC,QAAgB,EACK;EACrB,MAAMC,cAAc,GAAGA,MAAA;AAAA,IAAA,IAAAC,cAAA,CAAA;AAAA,IAAA,OAAA,CAAAA,cAAA,GACrBC,IAAI,CAACC,QAAQ,EAAE,KAAAF,IAAAA,GAAAA,cAAA,GAAIL,KAAK,CAACQ,OAAO,CAACC,mBAAmB,CAAA;AAAA,GAAA,CAAA;AAEtD,EAAA,MAAMH,IAA6B,GAAG;IACpCI,EAAE,EAAE,GAAGT,GAAG,CAACS,EAAE,CAAIR,CAAAA,EAAAA,MAAM,CAACQ,EAAE,CAAE,CAAA;IAC5BT,GAAG;IACHC,MAAM;IACNK,QAAQ,EAAEA,MAAMN,GAAG,CAACM,QAAQ,CAACJ,QAAQ,CAAC;AACtCQ,IAAAA,WAAW,EAAEP,cAAc;IAC3BQ,UAAU,EAAEC,UAAI,CACd,MAAM,CAACb,KAAK,EAAEE,MAAM,EAAED,GAAG,EAAEK,IAAI,CAAC,EAChC,CAACN,KAAK,EAAEE,MAAM,EAAED,GAAG,EAAEK,IAAI,MAAM;MAC7BN,KAAK;MACLE,MAAM;MACND,GAAG;AACHK,MAAAA,IAAI,EAAEA,IAA2B;MACjCC,QAAQ,EAAED,IAAI,CAACC,QAAQ;MACvBI,WAAW,EAAEL,IAAI,CAACK,WAAAA;KACnB,CAAC,EACFG,oBAAc,CAACd,KAAK,CAACQ,OAAO,EAAE,YAAY,EAAE,iBAAiB,CAC/D,CAAA;GACD,CAAA;AAEDR,EAAAA,KAAK,CAACe,SAAS,CAACC,OAAO,CAACC,OAAO,IAAI;AACjCA,IAAAA,OAAO,CAAClB,UAAU,IAAlBkB,IAAAA,IAAAA,OAAO,CAAClB,UAAU,CAChBO,IAAI,EACJJ,MAAM,EACND,GAAG,EACHD,KACF,CAAC,CAAA;GACF,EAAE,EAAE,CAAC,CAAA;AAEN,EAAA,OAAOM,IAAI,CAAA;AACb;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/core/column.d.ts b/node_modules/@tanstack/table-core/build/lib/core/column.d.ts new file mode 100644 index 00000000..a4dd9a60 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/column.d.ts @@ -0,0 +1,55 @@ +import { Column, Table, AccessorFn, ColumnDef, RowData } from '../types'; +export interface CoreColumn { + /** + * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + accessorFn?: AccessorFn; + /** + * The original column def used to create the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + columnDef: ColumnDef; + /** + * The child column (if the column is a group column). Will be an empty array if the column is not a group column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + columns: Column[]; + /** + * The depth of the column (if grouped) relative to the root column def array. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + depth: number; + /** + * Returns the flattened array of this column and all child/grand-child columns for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + getFlatColumns: () => Column[]; + /** + * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + getLeafColumns: () => Column[]; + /** + * The resolved unique identifier for the column resolved in this priority: + - A manual `id` property from the column def + - The accessor key from the column def + - The header string from the column def + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + id: string; + /** + * The parent column for this column. Will be undefined if this is a root column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + parent?: Column; +} +export declare function createColumn(table: Table, columnDef: ColumnDef, depth: number, parent?: Column): Column; diff --git a/node_modules/@tanstack/table-core/build/lib/core/column.js b/node_modules/@tanstack/table-core/build/lib/core/column.js new file mode 100644 index 00000000..63f2399f --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/column.js @@ -0,0 +1,80 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +function createColumn(table, columnDef, depth, parent) { + var _ref, _resolvedColumnDef$id; + const defaultColumn = table._getDefaultColumnDef(); + const resolvedColumnDef = { + ...defaultColumn, + ...columnDef + }; + const accessorKey = resolvedColumnDef.accessorKey; + let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined; + let accessorFn; + if (resolvedColumnDef.accessorFn) { + accessorFn = resolvedColumnDef.accessorFn; + } else if (accessorKey) { + // Support deep accessor keys + if (accessorKey.includes('.')) { + accessorFn = originalRow => { + let result = originalRow; + for (const key of accessorKey.split('.')) { + var _result; + result = (_result = result) == null ? void 0 : _result[key]; + if (process.env.NODE_ENV !== 'production' && result === undefined) { + console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`); + } + } + return result; + }; + } else { + accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey]; + } + } + if (!id) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); + } + throw new Error(); + } + let column = { + id: `${String(id)}`, + accessorFn, + parent: parent, + depth, + columnDef: resolvedColumnDef, + columns: [], + getFlatColumns: utils.memo(() => [true], () => { + var _column$columns; + return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))]; + }, utils.getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')), + getLeafColumns: utils.memo(() => [table._getOrderColumnsFn()], orderColumns => { + var _column$columns2; + if ((_column$columns2 = column.columns) != null && _column$columns2.length) { + let leafColumns = column.columns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + } + return [column]; + }, utils.getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')) + }; + for (const feature of table._features) { + feature.createColumn == null || feature.createColumn(column, table); + } + + // Yes, we have to convert table to unknown, because we know more than the compiler here. + return column; +} + +exports.createColumn = createColumn; +//# sourceMappingURL=column.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/core/column.js.map b/node_modules/@tanstack/table-core/build/lib/core/column.js.map new file mode 100644 index 00000000..351eb8ef --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/column.js.map @@ -0,0 +1 @@ +{"version":3,"file":"column.js","sources":["../../../src/core/column.ts"],"sourcesContent":["import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport interface CoreColumn {\n /**\n * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n accessorFn?: AccessorFn\n /**\n * The original column def used to create the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columnDef: ColumnDef\n /**\n * The child column (if the column is a group column). Will be an empty array if the column is not a group column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columns: Column[]\n /**\n * The depth of the column (if grouped) relative to the root column def array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n depth: number\n /**\n * Returns the flattened array of this column and all child/grand-child columns for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getFlatColumns: () => Column[]\n /**\n * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getLeafColumns: () => Column[]\n /**\n * The resolved unique identifier for the column resolved in this priority:\n - A manual `id` property from the column def\n - The accessor key from the column def\n - The header string from the column def\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n id: string\n /**\n * The parent column for this column. Will be undefined if this is a root column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n parent?: Column\n}\n\nexport function createColumn(\n table: Table,\n columnDef: ColumnDef,\n depth: number,\n parent?: Column\n): Column {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey\n ? typeof String.prototype.replaceAll === 'function'\n ? accessorKey.replaceAll('.', '_')\n : accessorKey.replace(/\\./g, '_')\n : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')\n ),\n }\n\n for (const feature of table._features) {\n feature.createColumn?.(column as Column, table)\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column as Column\n}\n"],"names":["createColumn","table","columnDef","depth","parent","_ref","_resolvedColumnDef$id","defaultColumn","_getDefaultColumnDef","resolvedColumnDef","accessorKey","id","String","prototype","replaceAll","replace","undefined","header","accessorFn","includes","originalRow","result","key","split","_result","process","env","NODE_ENV","console","warn","Error","column","columns","getFlatColumns","memo","_column$columns","flatMap","d","getMemoOptions","options","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","length","leafColumns","feature","_features"],"mappings":";;;;;;;;;;;;;;AAgEO,SAASA,YAAYA,CAC1BC,KAAmB,EACnBC,SAAmC,EACnCC,KAAa,EACbC,MAA8B,EACP;EAAA,IAAAC,IAAA,EAAAC,qBAAA,CAAA;AACvB,EAAA,MAAMC,aAAa,GAAGN,KAAK,CAACO,oBAAoB,EAAE,CAAA;AAElD,EAAA,MAAMC,iBAAiB,GAAG;AACxB,IAAA,GAAGF,aAAa;IAChB,GAAGL,SAAAA;GACwB,CAAA;AAE7B,EAAA,MAAMQ,WAAW,GAAGD,iBAAiB,CAACC,WAAW,CAAA;EAEjD,IAAIC,EAAE,GAAAN,CAAAA,IAAA,GAAAC,CAAAA,qBAAA,GACJG,iBAAiB,CAACE,EAAE,KAAAL,IAAAA,GAAAA,qBAAA,GACnBI,WAAW,GACR,OAAOE,MAAM,CAACC,SAAS,CAACC,UAAU,KAAK,UAAU,GAC/CJ,WAAW,CAACI,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,GAChCJ,WAAW,CAACK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GACjCC,SAAS,KAAA,IAAA,GAAAX,IAAA,GACZ,OAAOI,iBAAiB,CAACQ,MAAM,KAAK,QAAQ,GACzCR,iBAAiB,CAACQ,MAAM,GACxBD,SAAU,CAAA;AAEhB,EAAA,IAAIE,UAAyC,CAAA;EAE7C,IAAIT,iBAAiB,CAACS,UAAU,EAAE;IAChCA,UAAU,GAAGT,iBAAiB,CAACS,UAAU,CAAA;GAC1C,MAAM,IAAIR,WAAW,EAAE;AACtB;AACA,IAAA,IAA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MAAM,CAAC,IAAI,CAAC,EACZ,MAAM;AAAA,MAAA,IAAAC,eAAA,CAAA;MACJ,OAAO,CACLJ,MAAM,EACN,IAAA,CAAAI,eAAA,GAAGJ,MAAM,CAACC,OAAO,KAAdG,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,eAAA,CAAgBC,OAAO,CAACC,CAAC,IAAIA,CAAC,CAACJ,cAAc,EAAE,CAAC,EACpD,CAAA;KACF,EACDK,oBAAc,CAACrC,KAAK,CAACsC,OAAO,EAAE,cAAc,EAAE,uBAAuB,CACvE,CAAC;AACDC,IAAAA,cAAc,EAAEN,UAAI,CAClB,MAAM,CAACjC,KAAK,CAACwC,kBAAkB,EAAE,CAAC,EAClCC,YAAY,IAAI;AAAA,MAAA,IAAAC,gBAAA,CAAA;MACd,IAAAA,CAAAA,gBAAA,GAAIZ,MAAM,CAACC,OAAO,KAAdW,IAAAA,IAAAA,gBAAA,CAAgBC,MAAM,EAAE;AAC1B,QAAA,IAAIC,WAAW,GAAGd,MAAM,CAACC,OAAO,CAACI,OAAO,CAACL,MAAM,IAC7CA,MAAM,CAACS,cAAc,EACvB,CAAC,CAAA;QAED,OAAOE,YAAY,CAACG,WAAW,CAAC,CAAA;AAClC,OAAA;MAEA,OAAO,CAACd,MAAM,CAA0B,CAAA;KACzC,EACDO,oBAAc,CAACrC,KAAK,CAACsC,OAAO,EAAE,cAAc,EAAE,uBAAuB,CACvE,CAAA;GACD,CAAA;AAED,EAAA,KAAK,MAAMO,OAAO,IAAI7C,KAAK,CAAC8C,SAAS,EAAE;IACrCD,OAAO,CAAC9C,YAAY,IAAA,IAAA,IAApB8C,OAAO,CAAC9C,YAAY,CAAG+B,MAAM,EAA2B9B,KAAK,CAAC,CAAA;AAChE,GAAA;;AAEA;AACA,EAAA,OAAO8B,MAAM,CAAA;AACf;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/core/headers.d.ts b/node_modules/@tanstack/table-core/build/lib/core/headers.d.ts new file mode 100644 index 00000000..abd7c0c9 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/headers.d.ts @@ -0,0 +1,194 @@ +import { RowData, Column, Header, HeaderGroup, Table, TableFeature } from '../types'; +export interface CoreHeaderGroup { + depth: number; + headers: Header[]; + id: string; +} +export interface HeaderContext { + /** + * An instance of a column. + */ + column: Column; + /** + * An instance of a header. + */ + header: Header; + /** + * The table instance. + */ + table: Table; +} +export interface CoreHeader { + /** + * The col-span for the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + colSpan: number; + /** + * The header's associated column object. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + column: Column; + /** + * The depth of the header, zero-indexed based. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + depth: number; + /** + * Returns the rendering context (or props) for column-based components like headers, footers and filters. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getContext: () => HeaderContext; + /** + * Returns the leaf headers hierarchically nested under this header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeafHeaders: () => Header[]; + /** + * The header's associated header group object. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + headerGroup: HeaderGroup; + /** + * The unique identifier for the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + id: string; + /** + * The index for the header within the header group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + index: number; + /** + * A boolean denoting if the header is a placeholder header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + isPlaceholder: boolean; + /** + * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + placeholderId?: string; + /** + * The row-span for the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + rowSpan: number; + /** + * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + subHeaders: Header[]; +} +export interface HeadersInstance { + /** + * Returns all header groups for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getHeaderGroups: () => HeaderGroup[]; + /** + * If pinning, returns the header groups for the left pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftHeaderGroups: () => HeaderGroup[]; + /** + * If pinning, returns the header groups for columns that are not pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterHeaderGroups: () => HeaderGroup[]; + /** + * If pinning, returns the header groups for the right pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightHeaderGroups: () => HeaderGroup[]; + /** + * Returns the footer groups for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getFooterGroups: () => HeaderGroup[]; + /** + * If pinning, returns the footer groups for the left pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftFooterGroups: () => HeaderGroup[]; + /** + * If pinning, returns the footer groups for columns that are not pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterFooterGroups: () => HeaderGroup[]; + /** + * If pinning, returns the footer groups for the right pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightFooterGroups: () => HeaderGroup[]; + /** + * Returns headers for all columns in the table, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getFlatHeaders: () => Header[]; + /** + * If pinning, returns headers for all left pinned columns in the table, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftFlatHeaders: () => Header[]; + /** + * If pinning, returns headers for all columns that are not pinned, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterFlatHeaders: () => Header[]; + /** + * If pinning, returns headers for all right pinned columns in the table, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightFlatHeaders: () => Header[]; + /** + * Returns headers for all leaf columns in the table, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeafHeaders: () => Header[]; + /** + * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftLeafHeaders: () => Header[]; + /** + * If pinning, returns headers for all columns that are not pinned, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterLeafHeaders: () => Header[]; + /** + * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightLeafHeaders: () => Header[]; +} +export declare const Headers: TableFeature; +export declare function buildHeaderGroups(allColumns: Column[], columnsToGroup: Column[], table: Table, headerFamily?: 'center' | 'left' | 'right'): HeaderGroup[]; diff --git a/node_modules/@tanstack/table-core/build/lib/core/headers.js b/node_modules/@tanstack/table-core/build/lib/core/headers.js new file mode 100644 index 00000000..1e6e396b --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/headers.js @@ -0,0 +1,270 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +const debug = 'debugHeaders'; +// + +function createHeader(table, column, options) { + var _options$id; + const id = (_options$id = options.id) != null ? _options$id : column.id; + let header = { + id, + column, + index: options.index, + isPlaceholder: !!options.isPlaceholder, + placeholderId: options.placeholderId, + depth: options.depth, + subHeaders: [], + colSpan: 0, + rowSpan: 0, + headerGroup: null, + getLeafHeaders: () => { + const leafHeaders = []; + const recurseHeader = h => { + if (h.subHeaders && h.subHeaders.length) { + h.subHeaders.map(recurseHeader); + } + leafHeaders.push(h); + }; + recurseHeader(header); + return leafHeaders; + }, + getContext: () => ({ + table, + header: header, + column + }) + }; + table._features.forEach(feature => { + feature.createHeader == null || feature.createHeader(header, table); + }); + return header; +} +const Headers = { + createTable: table => { + // Header Groups + + table.getHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + var _left$map$filter, _right$map$filter; + const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; + const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; + const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); + return headerGroups; + }, utils.getMemoOptions(table.options, debug, 'getHeaderGroups')); + table.getCenterHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + return buildHeaderGroups(allColumns, leafColumns, table, 'center'); + }, utils.getMemoOptions(table.options, debug, 'getCenterHeaderGroups')); + table.getLeftHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => { + var _left$map$filter2; + const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left'); + }, utils.getMemoOptions(table.options, debug, 'getLeftHeaderGroups')); + table.getRightHeaderGroups = utils.memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => { + var _right$map$filter2; + const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right'); + }, utils.getMemoOptions(table.options, debug, 'getRightHeaderGroups')); + + // Footer Groups + + table.getFooterGroups = utils.memo(() => [table.getHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, utils.getMemoOptions(table.options, debug, 'getFooterGroups')); + table.getLeftFooterGroups = utils.memo(() => [table.getLeftHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, utils.getMemoOptions(table.options, debug, 'getLeftFooterGroups')); + table.getCenterFooterGroups = utils.memo(() => [table.getCenterHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, utils.getMemoOptions(table.options, debug, 'getCenterFooterGroups')); + table.getRightFooterGroups = utils.memo(() => [table.getRightHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, utils.getMemoOptions(table.options, debug, 'getRightFooterGroups')); + + // Flat Headers + + table.getFlatHeaders = utils.memo(() => [table.getHeaderGroups()], headerGroups => { + return headerGroups.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, utils.getMemoOptions(table.options, debug, 'getFlatHeaders')); + table.getLeftFlatHeaders = utils.memo(() => [table.getLeftHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, utils.getMemoOptions(table.options, debug, 'getLeftFlatHeaders')); + table.getCenterFlatHeaders = utils.memo(() => [table.getCenterHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, utils.getMemoOptions(table.options, debug, 'getCenterFlatHeaders')); + table.getRightFlatHeaders = utils.memo(() => [table.getRightHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, utils.getMemoOptions(table.options, debug, 'getRightFlatHeaders')); + + // Leaf Headers + + table.getCenterLeafHeaders = utils.memo(() => [table.getCenterFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders; + return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); + }); + }, utils.getMemoOptions(table.options, debug, 'getCenterLeafHeaders')); + table.getLeftLeafHeaders = utils.memo(() => [table.getLeftFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders2; + return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); + }); + }, utils.getMemoOptions(table.options, debug, 'getLeftLeafHeaders')); + table.getRightLeafHeaders = utils.memo(() => [table.getRightFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders3; + return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); + }); + }, utils.getMemoOptions(table.options, debug, 'getRightLeafHeaders')); + table.getLeafHeaders = utils.memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => { + var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$; + return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => { + return header.getLeafHeaders(); + }).flat(); + }, utils.getMemoOptions(table.options, debug, 'getLeafHeaders')); + } +}; +function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { + var _headerGroups$0$heade, _headerGroups$; + // Find the max depth of the columns: + // build the leaf column row + // build each buffer row going up + // placeholder for non-existent level + // real column for existing level + + let maxDepth = 0; + const findMaxDepth = function (columns, depth) { + if (depth === void 0) { + depth = 1; + } + maxDepth = Math.max(maxDepth, depth); + columns.filter(column => column.getIsVisible()).forEach(column => { + var _column$columns; + if ((_column$columns = column.columns) != null && _column$columns.length) { + findMaxDepth(column.columns, depth + 1); + } + }, 0); + }; + findMaxDepth(allColumns); + let headerGroups = []; + const createHeaderGroup = (headersToGroup, depth) => { + // The header group we are creating + const headerGroup = { + depth, + id: [headerFamily, `${depth}`].filter(Boolean).join('_'), + headers: [] + }; + + // The parent columns we're going to scan next + const pendingParentHeaders = []; + + // Scan each column for parents + headersToGroup.forEach(headerToGroup => { + // What is the latest (last) parent column? + + const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]; + const isLeafHeader = headerToGroup.column.depth === headerGroup.depth; + let column; + let isPlaceholder = false; + if (isLeafHeader && headerToGroup.column.parent) { + // The parent header is new + column = headerToGroup.column.parent; + } else { + // The parent header is repeated + column = headerToGroup.column; + isPlaceholder = true; + } + if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) { + // This column is repeated. Add it as a sub header to the next batch + latestPendingParentHeader.subHeaders.push(headerToGroup); + } else { + // This is a new header. Let's create it + const header = createHeader(table, column, { + id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'), + isPlaceholder, + placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined, + depth, + index: pendingParentHeaders.length + }); + + // Add the headerToGroup as a subHeader of the new header + header.subHeaders.push(headerToGroup); + // Add the new header to the pendingParentHeaders to get grouped + // in the next batch + pendingParentHeaders.push(header); + } + headerGroup.headers.push(headerToGroup); + headerToGroup.headerGroup = headerGroup; + }); + headerGroups.push(headerGroup); + if (depth > 0) { + createHeaderGroup(pendingParentHeaders, depth - 1); + } + }; + const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, { + depth: maxDepth, + index + })); + createHeaderGroup(bottomHeaders, maxDepth - 1); + headerGroups.reverse(); + + // headerGroups = headerGroups.filter(headerGroup => { + // return !headerGroup.headers.every(header => header.isPlaceholder) + // }) + + const recurseHeadersForSpans = headers => { + const filteredHeaders = headers.filter(header => header.column.getIsVisible()); + return filteredHeaders.map(header => { + let colSpan = 0; + let rowSpan = 0; + let childRowSpans = [0]; + if (header.subHeaders && header.subHeaders.length) { + childRowSpans = []; + recurseHeadersForSpans(header.subHeaders).forEach(_ref => { + let { + colSpan: childColSpan, + rowSpan: childRowSpan + } = _ref; + colSpan += childColSpan; + childRowSpans.push(childRowSpan); + }); + } else { + colSpan = 1; + } + const minChildRowSpan = Math.min(...childRowSpans); + rowSpan = rowSpan + minChildRowSpan; + header.colSpan = colSpan; + header.rowSpan = rowSpan; + return { + colSpan, + rowSpan + }; + }); + }; + recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); + return headerGroups; +} + +exports.Headers = Headers; +exports.buildHeaderGroups = buildHeaderGroups; +//# sourceMappingURL=headers.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/core/headers.js.map b/node_modules/@tanstack/table-core/build/lib/core/headers.js.map new file mode 100644 index 00000000..bba79b54 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/headers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"headers.js","sources":["../../../src/core/headers.ts"],"sourcesContent":["import {\n RowData,\n Column,\n Header,\n HeaderGroup,\n Table,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nconst debug = 'debugHeaders'\n\nexport interface CoreHeaderGroup {\n depth: number\n headers: Header[]\n id: string\n}\n\nexport interface HeaderContext {\n /**\n * An instance of a column.\n */\n column: Column\n /**\n * An instance of a header.\n */\n header: Header\n /**\n * The table instance.\n */\n table: Table\n}\n\nexport interface CoreHeader {\n /**\n * The col-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n colSpan: number\n /**\n * The header's associated column object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n column: Column\n /**\n * The depth of the header, zero-indexed based.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n depth: number\n /**\n * Returns the rendering context (or props) for column-based components like headers, footers and filters.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getContext: () => HeaderContext\n /**\n * Returns the leaf headers hierarchically nested under this header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * The header's associated header group object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n headerGroup: HeaderGroup\n /**\n * The unique identifier for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n id: string\n /**\n * The index for the header within the header group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n index: number\n /**\n * A boolean denoting if the header is a placeholder header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n isPlaceholder: boolean\n /**\n * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n placeholderId?: string\n /**\n * The row-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n rowSpan: number\n /**\n * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n subHeaders: Header[]\n}\n\nexport interface HeadersInstance {\n /**\n * Returns all header groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightHeaderGroups: () => HeaderGroup[]\n\n /**\n * Returns the footer groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFooterGroups: () => HeaderGroup[]\n\n /**\n * Returns headers for all columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFlatHeaders: () => Header[]\n\n /**\n * Returns headers for all leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightLeafHeaders: () => Header[]\n}\n\n//\n\nfunction createHeader(\n table: Table,\n column: Column,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header {\n const id = options.id ?? column.id\n\n let header: CoreHeader = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header[] => {\n const leafHeaders: Header[] = []\n\n const recurseHeader = (h: CoreHeader) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n feature.createHeader?.(header as Header, table)\n })\n\n return header as Header\n}\n\nexport const Headers: TableFeature = {\n createTable: (table: Table): void => {\n // Header Groups\n\n table.getHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n getMemoOptions(table.options, debug, 'getHeaderGroups')\n )\n\n table.getCenterHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n getMemoOptions(table.options, debug, 'getCenterHeaderGroups')\n )\n\n table.getLeftHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')\n },\n getMemoOptions(table.options, debug, 'getLeftHeaderGroups')\n )\n\n table.getRightHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')\n },\n getMemoOptions(table.options, debug, 'getRightHeaderGroups')\n )\n\n // Footer Groups\n\n table.getFooterGroups = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getFooterGroups')\n )\n\n table.getLeftFooterGroups = memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getLeftFooterGroups')\n )\n\n table.getCenterFooterGroups = memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getCenterFooterGroups')\n )\n\n table.getRightFooterGroups = memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getRightFooterGroups')\n )\n\n // Flat Headers\n\n table.getFlatHeaders = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getFlatHeaders')\n )\n\n table.getLeftFlatHeaders = memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeftFlatHeaders')\n )\n\n table.getCenterFlatHeaders = memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getCenterFlatHeaders')\n )\n\n table.getRightFlatHeaders = memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getRightFlatHeaders')\n )\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getCenterLeafHeaders')\n )\n\n table.getLeftLeafHeaders = memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getLeftLeafHeaders')\n )\n\n table.getRightLeafHeaders = memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getRightLeafHeaders')\n )\n\n table.getLeafHeaders = memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeafHeaders')\n )\n },\n}\n\nexport function buildHeaderGroups(\n allColumns: Column[],\n columnsToGroup: Column[],\n table: Table,\n headerFamily?: 'center' | 'left' | 'right'\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (columns: Column[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Header[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader?.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup?.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter(d => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n"],"names":["debug","createHeader","table","column","options","_options$id","id","header","index","isPlaceholder","placeholderId","depth","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","length","map","push","getContext","_features","forEach","feature","Headers","createTable","getHeaderGroups","memo","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","leafColumns","_left$map$filter","_right$map$filter","leftColumns","columnId","find","d","filter","Boolean","rightColumns","centerColumns","includes","headerGroups","buildHeaderGroups","getMemoOptions","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","orderedLeafColumns","getRightHeaderGroups","_right$map$filter2","getFooterGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","flat","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","columns","Math","max","getIsVisible","_column$columns","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","isLeafHeader","parent","undefined","bottomHeaders","recurseHeadersForSpans","filteredHeaders","childRowSpans","_ref","childColSpan","childRowSpan","minChildRowSpan","min"],"mappings":";;;;;;;;;;;;;;AAUA,MAAMA,KAAK,GAAG,cAAc,CAAA;AAwM5B;;AAEA,SAASC,YAAYA,CACnBC,KAAmB,EACnBC,MAA6B,EAC7BC,OAMC,EACsB;AAAA,EAAA,IAAAC,WAAA,CAAA;AACvB,EAAA,MAAMC,EAAE,GAAA,CAAAD,WAAA,GAAGD,OAAO,CAACE,EAAE,KAAA,IAAA,GAAAD,WAAA,GAAIF,MAAM,CAACG,EAAE,CAAA;AAElC,EAAA,IAAIC,MAAiC,GAAG;IACtCD,EAAE;IACFH,MAAM;IACNK,KAAK,EAAEJ,OAAO,CAACI,KAAK;AACpBC,IAAAA,aAAa,EAAE,CAAC,CAACL,OAAO,CAACK,aAAa;IACtCC,aAAa,EAAEN,OAAO,CAACM,aAAa;IACpCC,KAAK,EAAEP,OAAO,CAACO,KAAK;AACpBC,IAAAA,UAAU,EAAE,EAAE;AACdC,IAAAA,OAAO,E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CAAC,CAAA;AACf,MAAA,IAAI6F,aAAa,GAAG,CAAC,CAAC,CAAC,CAAA;MAEvB,IAAIpG,MAAM,CAACK,UAAU,IAAIL,MAAM,CAACK,UAAU,CAACQ,MAAM,EAAE;AACjDuF,QAAAA,aAAa,GAAG,EAAE,CAAA;QAElBF,sBAAsB,CAAClG,MAAM,CAACK,UAAU,CAAC,CAACa,OAAO,CAC/CmF,IAAA,IAAsD;UAAA,IAArD;AAAE/F,YAAAA,OAAO,EAAEgG,YAAY;AAAE/F,YAAAA,OAAO,EAAEgG,YAAAA;AAAa,WAAC,GAAAF,IAAA,CAAA;AAC/C/F,UAAAA,OAAO,IAAIgG,YAAY,CAAA;AACvBF,UAAAA,aAAa,CAACrF,IAAI,CAACwF,YAAY,CAAC,CAAA;AAClC,SACF,CAAC,CAAA;AACH,OAAC,MAAM;AACLjG,QAAAA,OAAO,GAAG,CAAC,CAAA;AACb,OAAA;MAEA,MAAMkG,eAAe,GAAGpB,IAAI,CAACqB,GAAG,CAAC,GAAGL,aAAa,CAAC,CAAA;MAClD7F,OAAO,GAAGA,OAAO,GAAGiG,eAAe,CAAA;MAEnCxG,MAAM,CAACM,OAAO,GAAGA,OAAO,CAAA;MACxBN,MAAM,CAACO,OAAO,GAAGA,OAAO,CAAA;MAExB,OAAO;QAAED,OAAO;AAAEC,QAAAA,OAAAA;OAAS,CAAA;AAC7B,KAAC,CAAC,CAAA;GACH,CAAA;AAED2F,EAAAA,sBAAsB,EAAAnB,qBAAA,GAAA,CAAAC,cAAA,GAACrC,YAAY,CAAC,CAAC,CAAC,KAAA,IAAA,GAAA,KAAA,CAAA,GAAfqC,cAAA,CAAiBtB,OAAO,YAAAqB,qBAAA,GAAI,EAAE,CAAC,CAAA;AAEtD,EAAA,OAAOpC,YAAY,CAAA;AACrB;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/core/row.d.ts b/node_modules/@tanstack/table-core/build/lib/core/row.d.ts new file mode 100644 index 00000000..a1b9c76f --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/row.d.ts @@ -0,0 +1,91 @@ +import { RowData, Cell, Row, Table } from '../types'; +export interface CoreRow { + _getAllCellsByColumnId: () => Record>; + _uniqueValuesCache: Record; + _valuesCache: Record; + /** + * The depth of the row (if nested or grouped) relative to the root row array. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#depth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + depth: number; + /** + * Returns all of the cells for the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getallcells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getAllCells: () => Cell[]; + /** + * Returns the leaf rows for the row, not including any parent rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getleafrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getLeafRows: () => Row[]; + /** + * Returns the parent row for the row, if it exists. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrow) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getParentRow: () => Row | undefined; + /** + * Returns the parent rows for the row, all the way up to a root row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getParentRows: () => Row[]; + /** + * Returns a unique array of values from the row for a given columnId. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getuniquevalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getUniqueValues: (columnId: string) => TValue[]; + /** + * Returns the value from the row for a given columnId. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getValue: (columnId: string) => TValue; + /** + * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + id: string; + /** + * The index of the row within its parent array (or the root data array). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#index) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + index: number; + /** + * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#original) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + original: TData; + /** + * An array of the original subRows as returned by the `options.getSubRows` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#originalsubrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + originalSubRows?: TData[]; + /** + * If nested, this row's parent row id. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#parentid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + parentId?: string; + /** + * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#rendervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + renderValue: (columnId: string) => TValue; + /** + * An array of subRows for the row as returned and created by the `options.getSubRows` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#subrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + subRows: Row[]; +} +export declare const createRow: (table: Table, id: string, original: TData, rowIndex: number, depth: number, subRows?: Row[], parentId?: string) => Row; diff --git a/node_modules/@tanstack/table-core/build/lib/core/row.js b/node_modules/@tanstack/table-core/build/lib/core/row.js new file mode 100644 index 00000000..5ce8f55f --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/row.js @@ -0,0 +1,89 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); +var cell = require('./cell.js'); + +const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => { + let row = { + id, + index: rowIndex, + original, + depth, + parentId, + _valuesCache: {}, + _uniqueValuesCache: {}, + getValue: columnId => { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex); + return row._valuesCache[columnId]; + }, + getUniqueValues: columnId => { + if (row._uniqueValuesCache.hasOwnProperty(columnId)) { + return row._uniqueValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + if (!column.columnDef.getUniqueValues) { + row._uniqueValuesCache[columnId] = [row.getValue(columnId)]; + return row._uniqueValuesCache[columnId]; + } + row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex); + return row._uniqueValuesCache[columnId]; + }, + renderValue: columnId => { + var _row$getValue; + return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; + }, + subRows: subRows != null ? subRows : [], + getLeafRows: () => utils.flattenBy(row.subRows, d => d.subRows), + getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined, + getParentRows: () => { + let parentRows = []; + let currentRow = row; + while (true) { + const parentRow = currentRow.getParentRow(); + if (!parentRow) break; + parentRows.push(parentRow); + currentRow = parentRow; + } + return parentRows.reverse(); + }, + getAllCells: utils.memo(() => [table.getAllLeafColumns()], leafColumns => { + return leafColumns.map(column => { + return cell.createCell(table, row, column, column.id); + }); + }, utils.getMemoOptions(table.options, 'debugRows', 'getAllCells')), + _getAllCellsByColumnId: utils.memo(() => [row.getAllCells()], allCells => { + return allCells.reduce((acc, cell) => { + acc[cell.column.id] = cell; + return acc; + }, {}); + }, utils.getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')) + }; + for (let i = 0; i < table._features.length; i++) { + const feature = table._features[i]; + feature == null || feature.createRow == null || feature.createRow(row, table); + } + return row; +}; + +exports.createRow = createRow; +//# sourceMappingURL=row.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/core/row.js.map b/node_modules/@tanstack/table-core/build/lib/core/row.js.map new file mode 100644 index 00000000..75353bbb --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/row.js.map @@ -0,0 +1 @@ +{"version":3,"file":"row.js","sources":["../../../src/core/row.ts"],"sourcesContent":["import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow {\n _getAllCellsByColumnId: () => Record>\n _uniqueValuesCache: Record\n _valuesCache: Record\n /**\n * The depth of the row (if nested or grouped) relative to the root row array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n depth: number\n /**\n * Returns all of the cells for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getallcells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getAllCells: () => Cell[]\n /**\n * Returns the leaf rows for the row, not including any parent rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getLeafRows: () => Row[]\n /**\n * Returns the parent row for the row, if it exists.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRow: () => Row | undefined\n /**\n * Returns the parent rows for the row, all the way up to a root row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRows: () => Row[]\n /**\n * Returns a unique array of values from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getuniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getUniqueValues: (columnId: string) => TValue[]\n /**\n * Returns the value from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getValue: (columnId: string) => TValue\n /**\n * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n id: string\n /**\n * The index of the row within its parent array (or the root data array).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n index: number\n /**\n * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#original)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n original: TData\n /**\n * An array of the original subRows as returned by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#originalsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n originalSubRows?: TData[]\n /**\n * If nested, this row's parent row id.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#parentid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n parentId?: string\n /**\n * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n renderValue: (columnId: string) => TValue\n /**\n * An array of subRows for the row as returned and created by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#subrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n subRows: Row[]\n}\n\nexport const createRow = (\n table: Table,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row[],\n parentId?: string\n): Row => {\n let row: CoreRow = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () =>\n row.parentId ? table.getRow(row.parentId, true) : undefined,\n getParentRows: () => {\n let parentRows: Row[] = []\n let currentRow = row\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n },\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row, column, column.id)\n })\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCells')\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce(\n (acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n feature?.createRow?.(row as Row, table)\n }\n\n return row as Row\n}\n"],"names":["createRow","table","id","original","rowIndex","depth","subRows","parentId","row","index","_valuesCache","_uniqueValuesCache","getValue","columnId","hasOwnProperty","column","getColumn","accessorFn","undefined","getUniqueValues","columnDef","renderValue","_row$getValue","options","renderFallbackValue","getLeafRows","flattenBy","d","getParentRow","getRow","getParentRows","parentRows","currentRow","parentRow","push","reverse","getAllCells","memo","getAllLeafColumns","leafColumns","map","createCell","getMemoOptions","_getAllCellsByColumnId","allCells","reduce","acc","cell","i","_features","length","feature"],"mappings":";;;;;;;;;;;;;;;MA8FaA,SAAS,GAAGA,CACvBC,KAAmB,EACnBC,EAAU,EACVC,QAAe,EACfC,QAAgB,EAChBC,KAAa,EACbC,OAAsB,EACtBC,QAAiB,KACF;AACf,EAAA,IAAIC,GAAmB,GAAG;IACxBN,EAAE;AACFO,IAAAA,KAAK,EAAEL,QAAQ;IACfD,QAAQ;IACRE,KAAK;IACLE,QAAQ;IACRG,YAAY,EAAE,EAAE;IAChBC,kBAAkB,EAAE,EAAE;IACtBC,QAAQ,EAAEC,QAAQ,IAAI;MACpB,IAAIL,GAAG,CAACE,YAAY,CAACI,cAAc,CAACD,QAAQ,CAAC,EAAE;AAC7C,QAAA,OAAOL,GAAG,CAACE,YAAY,CAACG,QAAQ,CAAC,CAAA;AACnC,OAAA;AAEA,MAAA,MAAME,MAAM,GAAGd,KAAK,CAACe,SAAS,CAACH,QAAQ,CAAC,CAAA;AAExC,MAAA,IAAI,EAACE,MAAM,IAAA,IAAA,IAANA,MAAM,CAAEE,UAAU,CAAE,EAAA;AACvB,QAAA,OAAOC,SAAS,CAAA;AAClB,OAAA;AAEAV,MAAAA,GAAG,CAACE,YAAY,CAACG,QAAQ,CAAC,GAAGE,MAAM,CAACE,UAAU,CAC5CT,GAAG,CAACL,QAAQ,EACZC,QACF,CAAC,CAAA;AAED,MAAA,OAAOI,GAAG,CAACE,YAAY,CAACG,QAAQ,CAAC,CAA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AAG,CAAA;OACX,EACD,EACF,CAAC,CAAA;KACF,EACDJ,oBAAc,CAACzC,KAAK,CAACsB,OAAO,EAAE,WAAW,EAAE,uBAAuB,CACpE,CAAA;GACD,CAAA;AAED,EAAA,KAAK,IAAIyB,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG/C,KAAK,CAACgD,SAAS,CAACC,MAAM,EAAEF,CAAC,EAAE,EAAE;AAC/C,IAAA,MAAMG,OAAO,GAAGlD,KAAK,CAACgD,SAAS,CAACD,CAAC,CAAC,CAAA;AAClCG,IAAAA,OAAO,IAAPA,IAAAA,IAAAA,OAAO,CAAEnD,SAAS,IAAlBmD,IAAAA,IAAAA,OAAO,CAAEnD,SAAS,CAAGQ,GAAG,EAAgBP,KAAK,CAAC,CAAA;AAChD,GAAA;AAEA,EAAA,OAAOO,GAAG,CAAA;AACZ;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/core/table.d.ts b/node_modules/@tanstack/table-core/build/lib/core/table.d.ts new file mode 100644 index 00000000..d5e97619 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/table.d.ts @@ -0,0 +1,220 @@ +import { RequiredKeys } from '../utils'; +import { Updater, TableOptionsResolved, TableState, Table, InitialTableState, Row, Column, RowModel, ColumnDef, TableOptions, RowData, TableMeta, TableFeature } from '../types'; +export interface CoreTableState { +} +export interface CoreOptions { + /** + * An array of extra features that you can add to the table instance. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + _features?: TableFeature[]; + /** + * Set this option to override any of the `autoReset...` feature options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + autoResetAll?: boolean; + /** + * The array of column defs to use for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + columns: ColumnDef[]; + /** + * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + data: TData[]; + /** + * Set this option to `true` to output all debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugAll?: boolean; + /** + * Set this option to `true` to output cell debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells] + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugCells?: boolean; + /** + * Set this option to `true` to output column debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugColumns?: boolean; + /** + * Set this option to `true` to output header debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugHeaders?: boolean; + /** + * Set this option to `true` to output row debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugRows?: boolean; + /** + * Set this option to `true` to output table debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugTable?: boolean; + /** + * Default column options to use for all column defs supplied to the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + defaultColumn?: Partial>; + /** + * This required option is a factory for a function that computes and returns the core row model for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getCoreRowModel: (table: Table) => () => RowModel; + /** + * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc. + * @example getRowId: row => row.userId + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getRowId?: (originalRow: TData, index: number, parent?: Row) => string; + /** + * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row. + * @example getSubRows: row => row.subRows + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getSubRows?: (originalRow: TData, index: number) => undefined | TData[]; + /** + * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state. + * + * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable. + * + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + initialState?: InitialTableState; + /** + * This option is used to optionally implement the merging of table options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + mergeOptions?: (defaultOptions: TableOptions, options: Partial>) => TableOptions; + /** + * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + meta?: TableMeta; + /** + * The `onStateChange` option can be used to optionally listen to state changes within the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + onStateChange: (updater: Updater) => void; + /** + * Value used when the desired value is not found in the data. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + renderFallbackValue: any; + /** + * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option. + * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + state: Partial; +} +export interface CoreInstance { + _features: readonly TableFeature[]; + _getAllFlatColumnsById: () => Record>; + _getColumnDefs: () => ColumnDef[]; + _getCoreRowModel?: () => RowModel; + _getDefaultColumnDef: () => Partial>; + _getRowId: (_: TData, index: number, parent?: Row) => string; + _queue: (cb: () => void) => void; + /** + * Returns all columns in the table in their normalized and nested hierarchy. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getAllColumns: () => Column[]; + /** + * Returns all columns in the table flattened to a single level. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getAllFlatColumns: () => Column[]; + /** + * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getAllLeafColumns: () => Column[]; + /** + * Returns a single column by its ID. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getColumn: (columnId: string) => Column | undefined; + /** + * Returns the core row model before any processing has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getCoreRowModel: () => RowModel; + /** + * Returns the row with the given ID. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getRow: (id: string, searchAll?: boolean) => Row; + /** + * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getRowModel: () => RowModel; + /** + * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getState: () => TableState; + /** + * This is the resolved initial state of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + initialState: TableState; + /** + * A read-only reference to the table's current options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + options: RequiredKeys, 'state'>; + /** + * Call this function to reset the table state to the initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + reset: () => void; + /** + * This function can be used to update the table options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + setOptions: (newOptions: Updater>) => void; + /** + * Call this function to update the table state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + setState: (updater: Updater) => void; +} +export declare function createTable(options: TableOptionsResolved): Table; diff --git a/node_modules/@tanstack/table-core/build/lib/core/table.js b/node_modules/@tanstack/table-core/build/lib/core/table.js new file mode 100644 index 00000000..bf1fc366 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/table.js @@ -0,0 +1,212 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); +var column = require('./column.js'); +var headers = require('./headers.js'); +var ColumnFaceting = require('../features/ColumnFaceting.js'); +var ColumnFiltering = require('../features/ColumnFiltering.js'); +var ColumnGrouping = require('../features/ColumnGrouping.js'); +var ColumnOrdering = require('../features/ColumnOrdering.js'); +var ColumnPinning = require('../features/ColumnPinning.js'); +var ColumnSizing = require('../features/ColumnSizing.js'); +var ColumnVisibility = require('../features/ColumnVisibility.js'); +var GlobalFaceting = require('../features/GlobalFaceting.js'); +var GlobalFiltering = require('../features/GlobalFiltering.js'); +var RowExpanding = require('../features/RowExpanding.js'); +var RowPagination = require('../features/RowPagination.js'); +var RowPinning = require('../features/RowPinning.js'); +var RowSelection = require('../features/RowSelection.js'); +var RowSorting = require('../features/RowSorting.js'); + +const builtInFeatures = [headers.Headers, ColumnVisibility.ColumnVisibility, ColumnOrdering.ColumnOrdering, ColumnPinning.ColumnPinning, ColumnFaceting.ColumnFaceting, ColumnFiltering.ColumnFiltering, GlobalFaceting.GlobalFaceting, +//depends on ColumnFaceting +GlobalFiltering.GlobalFiltering, +//depends on ColumnFiltering +RowSorting.RowSorting, ColumnGrouping.ColumnGrouping, +//depends on RowSorting +RowExpanding.RowExpanding, RowPagination.RowPagination, RowPinning.RowPinning, RowSelection.RowSelection, ColumnSizing.ColumnSizing]; + +// + +function createTable(options) { + var _options$_features, _options$initialState; + if (process.env.NODE_ENV !== 'production' && (options.debugAll || options.debugTable)) { + console.info('Creating Table Instance...'); + } + const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])]; + let table = { + _features + }; + const defaultOptions = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); + }, {}); + const mergeOptions = options => { + if (table.options.mergeOptions) { + return table.options.mergeOptions(defaultOptions, options); + } + return { + ...defaultOptions, + ...options + }; + }; + const coreInitialState = {}; + let initialState = { + ...coreInitialState, + ...((_options$initialState = options.initialState) != null ? _options$initialState : {}) + }; + table._features.forEach(feature => { + var _feature$getInitialSt; + initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState; + }); + const queued = []; + let queuedTimeout = false; + const coreInstance = { + _features, + options: { + ...defaultOptions, + ...options + }, + initialState, + _queue: cb => { + queued.push(cb); + if (!queuedTimeout) { + queuedTimeout = true; + + // Schedule a microtask to run the queued callbacks after + // the current call stack (render, etc) has finished. + Promise.resolve().then(() => { + while (queued.length) { + queued.shift()(); + } + queuedTimeout = false; + }).catch(error => setTimeout(() => { + throw error; + })); + } + }, + reset: () => { + table.setState(table.initialState); + }, + setOptions: updater => { + const newOptions = utils.functionalUpdate(updater, table.options); + table.options = mergeOptions(newOptions); + }, + getState: () => { + return table.options.state; + }, + setState: updater => { + table.options.onStateChange == null || table.options.onStateChange(updater); + }, + _getRowId: (row, index, parent) => { + var _table$options$getRow; + return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`; + }, + getCoreRowModel: () => { + if (!table._getCoreRowModel) { + table._getCoreRowModel = table.options.getCoreRowModel(table); + } + return table._getCoreRowModel(); + }, + // The final calls start at the bottom of the model, + // expanded rows, which then work their way up + + getRowModel: () => { + return table.getPaginationRowModel(); + }, + //in next version, we should just pass in the row model as the optional 2nd arg + getRow: (id, searchAll) => { + let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id]; + if (!row) { + row = table.getCoreRowModel().rowsById[id]; + if (!row) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(`getRow could not find row with ID: ${id}`); + } + throw new Error(); + } + } + return row; + }, + _getDefaultColumnDef: utils.memo(() => [table.options.defaultColumn], defaultColumn => { + var _defaultColumn; + defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; + return { + header: props => { + const resolvedColumnDef = props.header.column.columnDef; + if (resolvedColumnDef.accessorKey) { + return resolvedColumnDef.accessorKey; + } + if (resolvedColumnDef.accessorFn) { + return resolvedColumnDef.id; + } + return null; + }, + // footer: props => props.header.column.id, + cell: props => { + var _props$renderValue$to, _props$renderValue; + return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; + }, + ...table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); + }, {}), + ...defaultColumn + }; + }, utils.getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')), + _getColumnDefs: () => table.options.columns, + getAllColumns: utils.memo(() => [table._getColumnDefs()], columnDefs => { + const recurseColumns = function (columnDefs, parent, depth) { + if (depth === void 0) { + depth = 0; + } + return columnDefs.map(columnDef => { + const column$1 = column.createColumn(table, columnDef, depth, parent); + const groupingColumnDef = columnDef; + column$1.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column$1, depth + 1) : []; + return column$1; + }); + }; + return recurseColumns(columnDefs); + }, utils.getMemoOptions(options, 'debugColumns', 'getAllColumns')), + getAllFlatColumns: utils.memo(() => [table.getAllColumns()], allColumns => { + return allColumns.flatMap(column => { + return column.getFlatColumns(); + }); + }, utils.getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')), + _getAllFlatColumnsById: utils.memo(() => [table.getAllFlatColumns()], flatColumns => { + return flatColumns.reduce((acc, column) => { + acc[column.id] = column; + return acc; + }, {}); + }, utils.getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')), + getAllLeafColumns: utils.memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => { + let leafColumns = allColumns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + }, utils.getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')), + getColumn: columnId => { + const column = table._getAllFlatColumnsById()[columnId]; + if (process.env.NODE_ENV !== 'production' && !column) { + console.error(`[Table] Column with id '${columnId}' does not exist.`); + } + return column; + } + }; + Object.assign(table, coreInstance); + for (let index = 0; index < table._features.length; index++) { + const feature = table._features[index]; + feature == null || feature.createTable == null || feature.createTable(table); + } + return table; +} + +exports.createTable = createTable; +//# sourceMappingURL=table.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/core/table.js.map b/node_modules/@tanstack/table-core/build/lib/core/table.js.map new file mode 100644 index 00000000..14625b72 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/core/table.js.map @@ -0,0 +1 @@ +{"version":3,"file":"table.js","sources":["../../../src/core/table.ts"],"sourcesContent":["import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table) => () => RowModel\n /**\n * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row) => string\n /**\n * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions,\n options: Partial>\n ) => TableOptions\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial\n}\n\nexport interface CoreInstance {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record>\n _getColumnDefs: () => ColumnDef[]\n _getCoreRowModel?: () => RowModel\n _getDefaultColumnDef: () => Partial>\n _getRowId: (_: TData, index: number, parent?: Row) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater) => void\n}\n\nexport function createTable(\n options: TableOptionsResolved\n): Table {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved\n\n const mergeOptions = (options: TableOptionsResolved) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef[],\n parent?: Column,\n depth = 0\n ): Column[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n"],"names":["builtInFeatures","Headers","ColumnVisibility","ColumnOrdering","ColumnPinning","ColumnFaceting","ColumnFiltering","GlobalFaceting","GlobalFiltering","RowSorting","ColumnGrouping","RowExpanding","RowPagination","RowPinning","RowSelection","ColumnSizing","createTable","options","_options$_features","_options$initialState","process","env","NODE_ENV","debugAll","debugTable","console","info","_features","table","defaultOptions","reduce","obj","feature","Object","assign","getDefaultOptions","mergeOptions","coreInitialState","initialState","forEach","_feature$getInitialSt","getInitialState","queued","queuedTimeout","coreInstance","_queue","cb","push","Promise","resolve","then","length","shift","catch","error","setTimeout","reset","setState","setOptions","updater","newOptions","functionalUpdate","getState","state","onStateChange","_getRowId","row","index","parent","_table$options$getRow","getRowId","id","join","getCoreRowModel","_getCoreRowModel","getRowModel","getPaginationRowModel","getRow","searchAll","getPrePaginationRowModel","rowsById","Error","_getDefaultColumnDef","memo","defaultColumn","_defaultColumn","header","props","resolvedColumnDef","column","columnDef","accessorKey","accessorFn","cell","_props$renderValue$to","_props$renderValue","renderValue","toString","getDefaultColumnDef","getMemoOptions","_getColumnDefs","columns","getAllColumns","columnDefs","recurseColumns","depth","map","createColumn","groupingColumnDef","getAllFlatColumns","allColumns","flatMap","getFlatColumns","_getAllFlatColumnsById","flatColumns","acc","getAllLeafColumns","_getOrderColumnsFn","orderColumns","leafColumns","getLeafColumns","getColumn","columnId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,eAAe,GAAG,CACtBC,eAAO,EACPC,iCAAgB,EAChBC,6BAAc,EACdC,2BAAa,E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,CAACvD,KAAK,CAAC0E,aAAa,EAAE,EAAE1E,KAAK,CAACyF,kBAAkB,EAAE,CAAC,EACzD,CAACP,UAAU,EAAEQ,YAAY,KAAK;AAC5B,MAAA,IAAIC,WAAW,GAAGT,UAAU,CAACC,OAAO,CAACtB,MAAM,IAAIA,MAAM,CAAC+B,cAAc,EAAE,CAAC,CAAA;MACvE,OAAOF,YAAY,CAACC,WAAW,CAAC,CAAA;KACjC,EACDpB,oBAAc,CAAClF,OAAO,EAAE,cAAc,EAAE,mBAAmB,CAC7D,CAAC;IAEDwG,SAAS,EAAEC,QAAQ,IAAI;MACrB,MAAMjC,MAAM,GAAG7D,KAAK,CAACqF,sBAAsB,EAAE,CAACS,QAAQ,CAAC,CAAA;MAEvD,IAAItG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAACmE,MAAM,EAAE;AACpDhE,QAAAA,OAAO,CAAC6B,KAAK,CAAC,CAA2BoE,wBAAAA,EAAAA,QAAQ,mBAAmB,CAAC,CAAA;AACvE,OAAA;AAEA,MAAA,OAAOjC,MAAM,CAAA;AACf,KAAA;GACD,CAAA;AAEDxD,EAAAA,MAAM,CAACC,MAAM,CAACN,KAAK,EAAEgB,YAAY,CAAC,CAAA;AAElC,EAAA,KAAK,IAAIuB,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGvC,KAAK,CAACD,SAAS,CAACwB,MAAM,EAAEgB,KAAK,EAAE,EAAE;AAC3D,IAAA,MAAMnC,OAAO,GAAGJ,KAAK,CAACD,SAAS,CAACwC,KAAK,CAAC,CAAA;IACtCnC,OAAO,IAAA,IAAA,IAAPA,OAAO,CAAEhB,WAAW,IAAA,IAAA,IAApBgB,OAAO,CAAEhB,WAAW,CAAGY,KAAK,CAAC,CAAA;AAC/B,GAAA;AAEA,EAAA,OAAOA,KAAK,CAAA;AACd;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.d.ts b/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.d.ts new file mode 100644 index 00000000..ec0855af --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.d.ts @@ -0,0 +1,34 @@ +import { RowModel } from '..'; +import { RowData, Table, TableFeature } from '../types'; +export interface FacetedColumn { + _getFacetedMinMaxValues?: () => undefined | [number, number]; + _getFacetedRowModel?: () => RowModel; + _getFacetedUniqueValues?: () => Map; + /** + * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values. + * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting) + */ + getFacetedMinMaxValues: () => undefined | [number, number]; + /** + * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts. + * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting) + */ + getFacetedRowModel: () => RowModel; + /** + * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values. + * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting) + */ + getFacetedUniqueValues: () => Map; +} +export interface FacetedOptions { + getFacetedMinMaxValues?: (table: Table, columnId: string) => () => undefined | [number, number]; + getFacetedRowModel?: (table: Table, columnId: string) => () => RowModel; + getFacetedUniqueValues?: (table: Table, columnId: string) => () => Map; +} +export declare const ColumnFaceting: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.js b/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.js new file mode 100644 index 00000000..a4f0630e --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.js @@ -0,0 +1,42 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +// + +const ColumnFaceting = { + createColumn: (column, table) => { + column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id); + column.getFacetedRowModel = () => { + if (!column._getFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return column._getFacetedRowModel(); + }; + column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id); + column.getFacetedUniqueValues = () => { + if (!column._getFacetedUniqueValues) { + return new Map(); + } + return column._getFacetedUniqueValues(); + }; + column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id); + column.getFacetedMinMaxValues = () => { + if (!column._getFacetedMinMaxValues) { + return undefined; + } + return column._getFacetedMinMaxValues(); + }; + } +}; + +exports.ColumnFaceting = ColumnFaceting; +//# sourceMappingURL=ColumnFaceting.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.js.map b/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.js.map new file mode 100644 index 00000000..45bdfa09 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnFaceting.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ColumnFaceting.js","sources":["../../../src/features/ColumnFaceting.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { Column, RowData, Table, TableFeature } from '../types'\n\nexport interface FacetedColumn {\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n _getFacetedRowModel?: () => RowModel\n _getFacetedUniqueValues?: () => Map\n /**\n * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.\n * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedRowModel: () => RowModel\n /**\n * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedUniqueValues: () => Map\n}\n\nexport interface FacetedOptions {\n getFacetedMinMaxValues?: (\n table: Table,\n columnId: string\n ) => () => undefined | [number, number]\n getFacetedRowModel?: (\n table: Table,\n columnId: string\n ) => () => RowModel\n getFacetedUniqueValues?: (\n table: Table,\n columnId: string\n ) => () => Map\n}\n\n//\n\nexport const ColumnFaceting: TableFeature = {\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column._getFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, column.id)\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return column._getFacetedRowModel()\n }\n column._getFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, column.id)\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map()\n }\n\n return column._getFacetedUniqueValues()\n }\n column._getFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, column.id)\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined\n }\n\n return column._getFacetedMinMaxValues()\n }\n },\n}\n"],"names":["ColumnFaceting","createColumn","column","table","_getFacetedRowModel","options","getFacetedRowModel","id","getPreFilteredRowModel","_getFacetedUniqueValues","getFacetedUniqueValues","Map","_getFacetedMinMaxValues","getFacetedMinMaxValues","undefined"],"mappings":";;;;;;;;;;;;AA6CA;;AAEO,MAAMA,cAA4B,GAAG;AAC1CC,EAAAA,YAAY,EAAEA,CACZC,MAA8B,EAC9BC,KAAmB,KACV;IACTD,MAAM,CAACE,mBAAmB,GACxBD,KAAK,CAACE,OAAO,CAACC,kBAAkB,IAChCH,KAAK,CAACE,OAAO,CAACC,kBAAkB,CAACH,KAAK,EAAED,MAAM,CAACK,EAAE,CAAC,CAAA;IACpDL,MAAM,CAACI,kBAAkB,GAAG,MAAM;AAChC,MAAA,IAAI,CAACJ,MAAM,CAACE,mBAAmB,EAAE;AAC/B,QAAA,OAAOD,KAAK,CAACK,sBAAsB,EAAE,CAAA;AACvC,OAAA;AAEA,MAAA,OAAON,MAAM,CAACE,mBAAmB,EAAE,CAAA;KACpC,CAAA;IACDF,MAAM,CAACO,uBAAuB,GAC5BN,KAAK,CAACE,OAAO,CAACK,sBAAsB,IACpCP,KAAK,CAACE,OAAO,CAACK,sBAAsB,CAACP,KAAK,EAAED,MAAM,CAACK,EAAE,CAAC,CAAA;IACxDL,MAAM,CAACQ,sBAAsB,GAAG,MAAM;AACpC,MAAA,IAAI,CAACR,MAAM,CAACO,uBAAuB,EAAE;QACnC,OAAO,IAAIE,GAAG,EAAE,CAAA;AAClB,OAAA;AAEA,MAAA,OAAOT,MAAM,CAACO,uBAAuB,EAAE,CAAA;KACxC,CAAA;IACDP,MAAM,CAACU,uBAAuB,GAC5BT,KAAK,CAACE,OAAO,CAACQ,sBAAsB,IACpCV,KAAK,CAACE,OAAO,CAACQ,sBAAsB,CAACV,KAAK,EAAED,MAAM,CAACK,EAAE,CAAC,CAAA;IACxDL,MAAM,CAACW,sBAAsB,GAAG,MAAM;AACpC,MAAA,IAAI,CAACX,MAAM,CAACU,uBAAuB,EAAE;AACnC,QAAA,OAAOE,SAAS,CAAA;AAClB,OAAA;AAEA,MAAA,OAAOZ,MAAM,CAACU,uBAAuB,EAAE,CAAA;KACxC,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.d.ts b/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.d.ts new file mode 100644 index 00000000..425cb437 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.d.ts @@ -0,0 +1,194 @@ +import { RowModel } from '..'; +import { BuiltInFilterFn } from '../filterFns'; +import { Column, FilterFns, FilterMeta, OnChangeFn, Row, RowData, Table, TableFeature, Updater } from '../types'; +export interface ColumnFiltersTableState { + columnFilters: ColumnFiltersState; +} +export type ColumnFiltersState = ColumnFilter[]; +export interface ColumnFilter { + id: string; + value: unknown; +} +export interface ResolvedColumnFilter { + filterFn: FilterFn; + id: string; + resolvedValue: unknown; +} +export interface FilterFn { + (row: Row, columnId: string, filterValue: any, addMeta: (meta: FilterMeta) => void): boolean; + autoRemove?: ColumnFilterAutoRemoveTestFn; + resolveFilterValue?: TransformFilterValueFn; +} +export type TransformFilterValueFn = (value: any, column?: Column) => unknown; +export type ColumnFilterAutoRemoveTestFn = (value: any, column?: Column) => boolean; +export type CustomFilterFns = Record>; +export type FilterFnOption = 'auto' | BuiltInFilterFn | keyof FilterFns | FilterFn; +export interface ColumnFiltersColumnDef { + /** + * Enables/disables the **column** filter for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + enableColumnFilter?: boolean; + /** + * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + filterFn?: FilterFnOption; +} +export interface ColumnFiltersColumn { + /** + * Returns an automatically calculated filter function for the column based off of the columns first known value. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getAutoFilterFn: () => FilterFn | undefined; + /** + * Returns whether or not the column can be **column** filtered. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getCanFilter: () => boolean; + /** + * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilterFn: () => FilterFn | undefined; + /** + * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilterIndex: () => number; + /** + * Returns the current filter value for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilterValue: () => unknown; + /** + * Returns whether or not the column is currently filtered. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getIsFiltered: () => boolean; + /** + * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + setFilterValue: (updater: Updater) => void; +} +export interface ColumnFiltersRow { + /** + * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + columnFilters: Record; + /** + * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + columnFiltersMeta: Record; +} +interface ColumnFiltersOptionsBase { + /** + * Enables/disables **column** filtering for all columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + enableColumnFilters?: boolean; + /** + * Enables/disables all filtering for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + enableFilters?: boolean; + /** + * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + filterFromLeafRows?: boolean; + /** + * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered. + * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model. + * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilteredRowModel?: (table: Table) => () => RowModel; + /** + * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + manualFiltering?: boolean; + /** + * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on. + + * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + maxLeafRowFilterDepth?: number; + /** + * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + onColumnFiltersChange?: OnChangeFn; +} +type ResolvedFilterFns = keyof FilterFns extends never ? { + filterFns?: Record>; +} : { + filterFns: Record>; +}; +export interface ColumnFiltersOptions extends ColumnFiltersOptionsBase, ResolvedFilterFns { +} +export interface ColumnFiltersInstance { + _getFilteredRowModel?: () => RowModel; + /** + * Returns the row model for the table after **column** filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilteredRowModel: () => RowModel; + /** + * Returns the row model for the table before any **column** filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getPreFilteredRowModel: () => RowModel; + /** + * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + resetColumnFilters: (defaultState?: boolean) => void; + /** + * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + resetGlobalFilter: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.columnFilters` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + setColumnFilters: (updater: Updater) => void; + /** + * Sets or updates the `state.globalFilter` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + setGlobalFilter: (updater: Updater) => void; +} +export declare const ColumnFiltering: TableFeature; +export declare function shouldAutoRemoveFilter(filterFn?: FilterFn, value?: any, column?: Column): boolean; +export {}; diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.js b/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.js new file mode 100644 index 00000000..a6dbf65e --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.js @@ -0,0 +1,151 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var filterFns = require('../filterFns.js'); +var utils = require('../utils.js'); + +// + +const ColumnFiltering = { + getDefaultColumnDef: () => { + return { + filterFn: 'auto' + }; + }, + getInitialState: state => { + return { + columnFilters: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnFiltersChange: utils.makeStateUpdater('columnFilters', table), + filterFromLeafRows: false, + maxLeafRowFilterDepth: 100 + }; + }, + createColumn: (column, table) => { + column.getAutoFilterFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return filterFns.filterFns.includesString; + } + if (typeof value === 'number') { + return filterFns.filterFns.inNumberRange; + } + if (typeof value === 'boolean') { + return filterFns.filterFns.equals; + } + if (value !== null && typeof value === 'object') { + return filterFns.filterFns.equals; + } + if (Array.isArray(value)) { + return filterFns.filterFns.arrIncludes; + } + return filterFns.filterFns.weakEquals; + }; + column.getFilterFn = () => { + var _table$options$filter, _table$options$filter2; + return utils.isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore + (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns.filterFns[column.columnDef.filterFn]; + }; + column.getCanFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2; + return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn; + }; + column.getIsFiltered = () => column.getFilterIndex() > -1; + column.getFilterValue = () => { + var _table$getState$colum; + return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value; + }; + column.getFilterIndex = () => { + var _table$getState$colum2, _table$getState$colum3; + return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1; + }; + column.setFilterValue = value => { + table.setColumnFilters(old => { + const filterFn = column.getFilterFn(); + const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id); + const newFilter = utils.functionalUpdate(value, previousFilter ? previousFilter.value : undefined); + + // + if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { + var _old$filter; + return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : []; + } + const newFilterObj = { + id: column.id, + value: newFilter + }; + if (previousFilter) { + var _old$map; + return (_old$map = old == null ? void 0 : old.map(d => { + if (d.id === column.id) { + return newFilterObj; + } + return d; + })) != null ? _old$map : []; + } + if (old != null && old.length) { + return [...old, newFilterObj]; + } + return [newFilterObj]; + }); + }; + }, + createRow: (row, _table) => { + row.columnFilters = {}; + row.columnFiltersMeta = {}; + }, + createTable: table => { + table.setColumnFilters = updater => { + const leafColumns = table.getAllLeafColumns(); + const updateFn = old => { + var _functionalUpdate; + return (_functionalUpdate = utils.functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => { + const column = leafColumns.find(d => d.id === filter.id); + if (column) { + const filterFn = column.getFilterFn(); + if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { + return false; + } + } + return true; + }); + }; + table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn); + }; + table.resetColumnFilters = defaultState => { + var _table$initialState$c, _table$initialState; + table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); + }; + table.getPreFilteredRowModel = () => table.getCoreRowModel(); + table.getFilteredRowModel = () => { + if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { + table._getFilteredRowModel = table.options.getFilteredRowModel(table); + } + if (table.options.manualFiltering || !table._getFilteredRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getFilteredRowModel(); + }; + } +}; +function shouldAutoRemoveFilter(filterFn, value, column) { + return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value; +} + +exports.ColumnFiltering = ColumnFiltering; +exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter; +//# sourceMappingURL=ColumnFiltering.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.js.map b/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.js.map new file mode 100644 index 00000000..a738b321 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnFiltering.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ColumnFiltering.js","sources":["../../../src/features/ColumnFiltering.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n FilterFns,\n FilterMeta,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface ColumnFiltersTableState {\n columnFilters: ColumnFiltersState\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter {\n filterFn: FilterFn\n id: string\n resolvedValue: unknown\n}\n\nexport interface FilterFn {\n (\n row: Row,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n autoRemove?: ColumnFilterAutoRemoveTestFn\n resolveFilterValue?: TransformFilterValueFn\n}\n\nexport type TransformFilterValueFn = (\n value: any,\n column?: Column\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn = (\n value: any,\n column?: Column\n) => boolean\n\nexport type CustomFilterFns = Record<\n string,\n FilterFn\n>\n\nexport type FilterFnOption =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn\n\nexport interface ColumnFiltersColumnDef {\n /**\n * Enables/disables the **column** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilter?: boolean\n /**\n * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFn?: FilterFnOption\n}\n\nexport interface ColumnFiltersColumn {\n /**\n * Returns an automatically calculated filter function for the column based off of the columns first known value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns whether or not the column can be **column** filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getCanFilter: () => boolean\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterFn: () => FilterFn | undefined\n /**\n * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterIndex: () => number\n /**\n * Returns the current filter value for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterValue: () => unknown\n /**\n * Returns whether or not the column is currently filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getIsFiltered: () => boolean\n /**\n * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setFilterValue: (updater: Updater) => void\n}\n\nexport interface ColumnFiltersRow {\n /**\n * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFilters: Record\n /**\n * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFiltersMeta: Record\n}\n\ninterface ColumnFiltersOptionsBase {\n /**\n * Enables/disables **column** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilters?: boolean\n /**\n * Enables/disables all filtering for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableFilters?: boolean\n /**\n * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFromLeafRows?: boolean\n /**\n * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.\n * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.\n * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel?: (table: Table) => () => RowModel\n /**\n * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n manualFiltering?: boolean\n /**\n * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.\n\n * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n maxLeafRowFilterDepth?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n onColumnFiltersChange?: OnChangeFn\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record>\n }\n : {\n filterFns: Record>\n }\n\nexport interface ColumnFiltersOptions\n extends ColumnFiltersOptionsBase,\n ResolvedFilterFns {}\n\nexport interface ColumnFiltersInstance {\n _getFilteredRowModel?: () => RowModel\n /**\n * Returns the row model for the table after **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel: () => RowModel\n /**\n * Returns the row model for the table before any **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getPreFilteredRowModel: () => RowModel\n /**\n * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetColumnFilters: (defaultState?: boolean) => void\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnFilters` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setColumnFilters: (updater: Updater) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnFiltering: TableFeature = {\n getDefaultColumnDef: <\n TData extends RowData,\n >(): ColumnFiltersColumnDef => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): ColumnFiltersTableState => {\n return {\n columnFilters: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnFiltersOptions => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n } as ColumnFiltersOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return filterFns.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns.arrIncludes\n }\n\n return filterFns.weakEquals\n }\n column.getFilterFn = () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n : // @ts-ignore\n table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n }\n column.getCanFilter = () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getIsFiltered = () => column.getFilterIndex() > -1\n\n column.getFilterValue = () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value\n\n column.getFilterIndex = () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1\n\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\n const previousFilter = old?.find(d => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined\n )\n\n //\n if (\n shouldAutoRemoveFilter(filterFn as FilterFn, newFilter, column)\n ) {\n return old?.filter(d => d.id !== column.id) ?? []\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n }\n },\n\n createRow: (\n row: Row,\n _table: Table\n ): void => {\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n },\n\n createTable: (table: Table): void => {\n table.setColumnFilters = (updater: Updater) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n }\n\n table.resetColumnFilters = defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n }\n\n table.getPreFilteredRowModel = () => table.getCoreRowModel()\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n }\n },\n}\n\nexport function shouldAutoRemoveFilter(\n filterFn?: FilterFn,\n value?: any,\n column?: Column\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n"],"names":["ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","table","onColumnFiltersChange","makeStateUpdater","filterFromLeafRows","maxLeafRowFilterDepth","createColumn","column","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getValue","id","filterFns","includesString","inNumberRange","equals","Array","isArray","arrIncludes","weakEquals","getFilterFn","_table$options$filter","_table$options$filter2","isFunction","columnDef","options","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","accessorFn","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","getState","find","d","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","old","previousFilter","newFilter","functionalUpdate","undefined","shouldAutoRemoveFilter","_old$filter","filter","newFilterObj","_old$map","map","length","createRow","row","_table","columnFiltersMeta","createTable","updater","leafColumns","getAllLeafColumns","updateFn","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getPreFilteredRowModel","getFilteredRowModel","_getFilteredRowModel","manualFiltering","autoRemove"],"mappings":";;;;;;;;;;;;;;;AAgPA;;AAEO,MAAMA,eAA6B,GAAG;EAC3CC,mBAAmB,EAAEA,MAEiB;IACpC,OAAO;AACLC,MAAAA,QAAQ,EAAE,MAAA;KACX,CAAA;GACF;EAEDC,eAAe,EAAGC,KAAK,IAA8B;IACnD,OAAO;AACLC,MAAAA,aAAa,EAAE,EAAE;MACjB,GAAGD,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACa;IAChC,OAAO;AACLC,MAAAA,qBAAqB,EAAEC,sBAAgB,CAAC,eAAe,EAAEF,KAAK,CAAC;AAC/DG,MAAAA,kBAAkB,EAAE,KAAK;AACzBC,MAAAA,qBAAqB,EAAE,GAAA;KACxB,CAAA;GACF;AAEDC,EAAAA,YAAY,EAAEA,CACZC,MAA8B,EAC9BN,KAAmB,KACV;IACTM,MAAM,CAACC,eAAe,GAAG,MAAM;MAC7B,MAAMC,QAAQ,GAAGR,KAAK,CAACS,eAAe,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAAA;MAEpD,MAAMC,KAAK,GAAGH,QAAQ,IAARA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,QAAQ,CAAEI,QAAQ,CAACN,MAAM,CAACO,EAAE,CAAC,CAAA;AAE3C,MAAA,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAOG,mBAAS,CAACC,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oF,UAAU,GAC5BpF,QAAQ,CAACoF,UAAU,CAACpE,KAAK,EAAEL,MAAM,CAAC,GAClC,KAAK,KACT,OAAOK,KAAK,KAAK,WAAW,IAC3B,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACA,KAAM,CAAA;AAEzC;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.d.ts b/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.d.ts new file mode 100644 index 00000000..16ce2c5e --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.d.ts @@ -0,0 +1,201 @@ +import { RowModel } from '..'; +import { BuiltInAggregationFn } from '../aggregationFns'; +import { AggregationFns, Cell, Column, ColumnDefTemplate, OnChangeFn, Row, RowData, Table, TableFeature, Updater } from '../types'; +export type GroupingState = string[]; +export interface GroupingTableState { + grouping: GroupingState; +} +export type AggregationFn = (columnId: string, leafRows: Row[], childRows: Row[]) => any; +export type CustomAggregationFns = Record>; +export type AggregationFnOption = 'auto' | keyof AggregationFns | BuiltInAggregationFn | AggregationFn; +export interface GroupingColumnDef { + /** + * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + aggregatedCell?: ColumnDefTemplate['getContext']>>; + /** + * The resolved aggregation function for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + aggregationFn?: AggregationFnOption; + /** + * Enables/disables grouping for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + enableGrouping?: boolean; + /** + * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupingValue?: (row: TData) => any; +} +export interface GroupingColumn { + /** + * Returns the aggregation function for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getAggregationFn: () => AggregationFn | undefined; + /** + * Returns the automatically inferred aggregation function for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getAutoAggregationFn: () => AggregationFn | undefined; + /** + * Returns whether or not the column can be grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getCanGroup: () => boolean; + /** + * Returns the index of the column in the grouping state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupedIndex: () => number; + /** + * Returns whether or not the column is currently grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsGrouped: () => boolean; + /** + * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getToggleGroupingHandler: () => () => void; + /** + * Toggles the grouping state of the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + toggleGrouping: () => void; +} +export interface GroupingRow { + _groupingValuesCache: Record; + /** + * Returns the grouping value for any row and column (including leaf rows). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupingValue: (columnId: string) => unknown; + /** + * Returns whether or not the row is currently grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsGrouped: () => boolean; + /** + * If this row is grouped, this is the id of the column that this row is grouped by. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + groupingColumnId?: string; + /** + * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + groupingValue?: unknown; +} +export interface GroupingCell { + /** + * Returns whether or not the cell is currently aggregated. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsAggregated: () => boolean; + /** + * Returns whether or not the cell is currently grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsGrouped: () => boolean; + /** + * Returns whether or not the cell is currently a placeholder cell. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsPlaceholder: () => boolean; +} +export interface ColumnDefaultOptions { + enableGrouping: boolean; + onGroupingChange: OnChangeFn; +} +interface GroupingOptionsBase { + /** + * Enables/disables grouping for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + enableGrouping?: boolean; + /** + * Returns the row model after grouping has taken place, but no further. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupedRowModel?: (table: Table) => () => RowModel; + /** + * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + groupedColumnMode?: false | 'reorder' | 'remove'; + /** + * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + manualGrouping?: boolean; + /** + * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + onGroupingChange?: OnChangeFn; +} +type ResolvedAggregationFns = keyof AggregationFns extends never ? { + aggregationFns?: Record>; +} : { + aggregationFns: Record>; +}; +export interface GroupingOptions extends GroupingOptionsBase, ResolvedAggregationFns { +} +export type GroupingColumnMode = false | 'reorder' | 'remove'; +export interface GroupingInstance { + _getGroupedRowModel?: () => RowModel; + /** + * Returns the row model for the table after grouping has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupedRowModel: () => RowModel; + /** + * Returns the row model for the table before any grouping has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getPreGroupedRowModel: () => RowModel; + /** + * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + resetGrouping: (defaultState?: boolean) => void; + /** + * Updates the grouping state of the table via an update function or value. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + setGrouping: (updater: Updater) => void; +} +export declare const ColumnGrouping: TableFeature; +export declare function orderColumns(leafColumns: Column[], grouping: string[], groupedColumnMode?: GroupingColumnMode): Column[]; +export {}; diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.js b/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.js new file mode 100644 index 00000000..9004799c --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.js @@ -0,0 +1,142 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var aggregationFns = require('../aggregationFns.js'); +var utils = require('../utils.js'); + +// + +const ColumnGrouping = { + getDefaultColumnDef: () => { + return { + aggregatedCell: props => { + var _toString, _props$getValue; + return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null; + }, + aggregationFn: 'auto' + }; + }, + getInitialState: state => { + return { + grouping: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onGroupingChange: utils.makeStateUpdater('grouping', table), + groupedColumnMode: 'reorder' + }; + }, + createColumn: (column, table) => { + column.toggleGrouping = () => { + table.setGrouping(old => { + // Find any existing grouping for this column + if (old != null && old.includes(column.id)) { + return old.filter(d => d !== column.id); + } + return [...(old != null ? old : []), column.id]; + }); + }; + column.getCanGroup = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue); + }; + column.getIsGrouped = () => { + var _table$getState$group; + return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id); + }; + column.getGroupedIndex = () => { + var _table$getState$group2; + return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id); + }; + column.getToggleGroupingHandler = () => { + const canGroup = column.getCanGroup(); + return () => { + if (!canGroup) return; + column.toggleGrouping(); + }; + }; + column.getAutoAggregationFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'number') { + return aggregationFns.aggregationFns.sum; + } + if (Object.prototype.toString.call(value) === '[object Date]') { + return aggregationFns.aggregationFns.extent; + } + }; + column.getAggregationFn = () => { + var _table$options$aggreg, _table$options$aggreg2; + if (!column) { + throw new Error(); + } + return utils.isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns.aggregationFns[column.columnDef.aggregationFn]; + }; + }, + createTable: table => { + table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater); + table.resetGrouping = defaultState => { + var _table$initialState$g, _table$initialState; + table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); + }; + table.getPreGroupedRowModel = () => table.getFilteredRowModel(); + table.getGroupedRowModel = () => { + if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { + table._getGroupedRowModel = table.options.getGroupedRowModel(table); + } + if (table.options.manualGrouping || !table._getGroupedRowModel) { + return table.getPreGroupedRowModel(); + } + return table._getGroupedRowModel(); + }; + }, + createRow: (row, table) => { + row.getIsGrouped = () => !!row.groupingColumnId; + row.getGroupingValue = columnId => { + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.columnDef.getGroupingValue)) { + return row.getValue(columnId); + } + row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original); + return row._groupingValuesCache[columnId]; + }; + row._groupingValuesCache = {}; + }, + createCell: (cell, column, row, table) => { + cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId; + cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped(); + cell.getIsAggregated = () => { + var _row$subRows; + return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + } +}; +function orderColumns(leafColumns, grouping, groupedColumnMode) { + if (!(grouping != null && grouping.length) || !groupedColumnMode) { + return leafColumns; + } + const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id)); + if (groupedColumnMode === 'remove') { + return nonGroupingColumns; + } + const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean); + return [...groupingColumns, ...nonGroupingColumns]; +} + +exports.ColumnGrouping = ColumnGrouping; +exports.orderColumns = orderColumns; +//# sourceMappingURL=ColumnGrouping.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.js.map b/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.js.map new file mode 100644 index 00000000..deff9000 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnGrouping.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ColumnGrouping.js","sources":["../../../src/features/ColumnGrouping.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { BuiltInAggregationFn, aggregationFns } from '../aggregationFns'\nimport {\n AggregationFns,\n Cell,\n Column,\n ColumnDefTemplate,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type GroupingState = string[]\n\nexport interface GroupingTableState {\n grouping: GroupingState\n}\n\nexport type AggregationFn = (\n columnId: string,\n leafRows: Row[],\n childRows: Row[]\n) => any\n\nexport type CustomAggregationFns = Record>\n\nexport type AggregationFnOption =\n | 'auto'\n | keyof AggregationFns\n | BuiltInAggregationFn\n | AggregationFn\n\nexport interface GroupingColumnDef {\n /**\n * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregatedCell?: ColumnDefTemplate<\n ReturnType['getContext']>\n >\n /**\n * The resolved aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregationFn?: AggregationFnOption\n /**\n * Enables/disables grouping for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue?: (row: TData) => any\n}\n\nexport interface GroupingColumn {\n /**\n * Returns the aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAggregationFn: () => AggregationFn | undefined\n /**\n * Returns the automatically inferred aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAutoAggregationFn: () => AggregationFn | undefined\n /**\n * Returns whether or not the column can be grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getCanGroup: () => boolean\n /**\n * Returns the index of the column in the grouping state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedIndex: () => number\n /**\n * Returns whether or not the column is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getToggleGroupingHandler: () => () => void\n /**\n * Toggles the grouping state of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n toggleGrouping: () => void\n}\n\nexport interface GroupingRow {\n _groupingValuesCache: Record\n /**\n * Returns the grouping value for any row and column (including leaf rows).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue: (columnId: string) => unknown\n /**\n * Returns whether or not the row is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * If this row is grouped, this is the id of the column that this row is grouped by.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingColumnId?: string\n /**\n * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingValue?: unknown\n}\n\nexport interface GroupingCell {\n /**\n * Returns whether or not the cell is currently aggregated.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsAggregated: () => boolean\n /**\n * Returns whether or not the cell is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns whether or not the cell is currently a placeholder cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsPlaceholder: () => boolean\n}\n\nexport interface ColumnDefaultOptions {\n enableGrouping: boolean\n onGroupingChange: OnChangeFn\n}\n\ninterface GroupingOptionsBase {\n /**\n * Enables/disables grouping for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Returns the row model after grouping has taken place, but no further.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel?: (table: Table) => () => RowModel\n /**\n * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupedColumnMode?: false | 'reorder' | 'remove'\n /**\n * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n manualGrouping?: boolean\n /**\n * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n onGroupingChange?: OnChangeFn\n}\n\ntype ResolvedAggregationFns = keyof AggregationFns extends never\n ? {\n aggregationFns?: Record>\n }\n : {\n aggregationFns: Record>\n }\n\nexport interface GroupingOptions\n extends GroupingOptionsBase,\n ResolvedAggregationFns {}\n\nexport type GroupingColumnMode = false | 'reorder' | 'remove'\n\nexport interface GroupingInstance {\n _getGroupedRowModel?: () => RowModel\n /**\n * Returns the row model for the table after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel: () => RowModel\n /**\n * Returns the row model for the table before any grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getPreGroupedRowModel: () => RowModel\n /**\n * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n resetGrouping: (defaultState?: boolean) => void\n /**\n * Updates the grouping state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n setGrouping: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnGrouping: TableFeature = {\n getDefaultColumnDef: (): GroupingColumnDef<\n TData,\n unknown\n > => {\n return {\n aggregatedCell: props => (props.getValue() as any)?.toString?.() ?? null,\n aggregationFn: 'auto',\n }\n },\n\n getInitialState: (state): GroupingTableState => {\n return {\n grouping: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GroupingOptions => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder',\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleGrouping = () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old?.includes(column.id)) {\n return old.filter(d => d !== column.id)\n }\n\n return [...(old ?? []), column.id]\n })\n }\n\n column.getCanGroup = () => {\n return (\n (column.columnDef.enableGrouping ?? true) &&\n (table.options.enableGrouping ?? true) &&\n (!!column.accessorFn || !!column.columnDef.getGroupingValue)\n )\n }\n\n column.getIsGrouped = () => {\n return table.getState().grouping?.includes(column.id)\n }\n\n column.getGroupedIndex = () => table.getState().grouping?.indexOf(column.id)\n\n column.getToggleGroupingHandler = () => {\n const canGroup = column.getCanGroup()\n\n return () => {\n if (!canGroup) return\n column.toggleGrouping()\n }\n }\n column.getAutoAggregationFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent\n }\n }\n column.getAggregationFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column.getAutoAggregationFn()\n : table.options.aggregationFns?.[\n column.columnDef.aggregationFn as string\n ] ??\n aggregationFns[\n column.columnDef.aggregationFn as BuiltInAggregationFn\n ]\n }\n },\n\n createTable: (table: Table): void => {\n table.setGrouping = updater => table.options.onGroupingChange?.(updater)\n\n table.resetGrouping = defaultState => {\n table.setGrouping(defaultState ? [] : table.initialState?.grouping ?? [])\n }\n\n table.getPreGroupedRowModel = () => table.getFilteredRowModel()\n table.getGroupedRowModel = () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table)\n }\n\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._getGroupedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getIsGrouped = () => !!row.groupingColumnId\n row.getGroupingValue = columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original\n )\n\n return row._groupingValuesCache[columnId]\n }\n row._groupingValuesCache = {}\n },\n\n createCell: (\n cell: Cell,\n column: Column,\n row: Row,\n table: Table\n ): void => {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n cell.getIsGrouped = () =>\n column.getIsGrouped() && column.id === row.groupingColumnId\n cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped()\n cell.getIsAggregated = () =>\n !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length\n },\n}\n\nexport function orderColumns(\n leafColumns: Column[],\n grouping: string[],\n groupedColumnMode?: GroupingColumnMode\n) {\n if (!grouping?.length || !groupedColumnMode) {\n return leafColumns\n }\n\n const nonGroupingColumns = leafColumns.filter(\n col => !grouping.includes(col.id)\n )\n\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns\n }\n\n const groupingColumns = grouping\n .map(g => leafColumns.find(col => col.id === g)!)\n .filter(Boolean)\n\n return [...groupingColumns, ...nonGroupingColumns]\n}\n"],"names":["ColumnGrouping","getDefaultColumnDef","aggregatedCell","props","_toString","_props$getValue","getValue","toString","aggregationFn","getInitialState","state","grouping","getDefaultOptions","table","onGroupingChange","makeStateUpdater","groupedColumnMode","createColumn","column","toggleGrouping","setGrouping","old","includes","id","filter","d","getCanGroup","_column$columnDef$ena","_table$options$enable","columnDef","enableGrouping","options","accessorFn","getGroupingValue","getIsGrouped","_table$getState$group","getState","getGroupedIndex","_table$getState$group2","indexOf","getToggleGroupingHandler","canGroup","getAutoAggregationFn","firstRow","getCoreRowModel","flatRows","value","aggregationFns","sum","Object","prototype","call","extent","getAggregationFn","_table$options$aggreg","_table$options$aggreg2","Error","isFunction","createTable","updater","resetGrouping","defaultState","_table$initialState$g","_table$initialState","initialState","getPreGroupedRowModel","getFilteredRowModel","getGroupedRowModel","_getGroupedRowModel","manualGrouping","createRow","row","groupingColumnId","columnId","_groupingValuesCache","hasOwnProperty","getColumn","original","createCell","cell","getIsPlaceholder","getIsAggregated","_row$subRows","subRows","length","orderColumns","leafColumns","nonGroupingColumns","col","groupingColumns","map","g","find","Boolean"],"mappings":";;;;;;;;;;;;;;;AA+OA;;AAEO,MAAMA,cAA4B,GAAG;EAC1CC,mBAAmB,EAAEA,MAGhB;IACH,OAAO;AACLC,MAAAA,cAAc,EAAEC,KAAK,IAAA;QAAA,IAAAC,SAAA,EAAAC,eAAA,CAAA;QAAA,OAAAD,CAAAA,SAAA,IAAAC,eAAA,GAAKF,KAAK,CAACG,QAAQ,EAAE,KAAjBD,IAAAA,IAAAA,eAAA,CAA2BE,QAAQ,IAAA,IAAA,GAAA,KAAA,CAAA,GAAnCF,eAAA,CAA2BE,QAAQ,EAAI,KAAA,IAAA,GAAAH,SAAA,GAAI,IAAI,CAAA;AAAA,OAAA;AACxEI,MAAAA,a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AK,QAAQ,EAAE;AAClC,IAAA,OAAOuE,kBAAkB,CAAA;AAC3B,GAAA;EAEA,MAAME,eAAe,GAAG9E,QAAQ,CAC7B+E,GAAG,CAACC,CAAC,IAAIL,WAAW,CAACM,IAAI,CAACJ,GAAG,IAAIA,GAAG,CAACjE,EAAE,KAAKoE,CAAC,CAAE,CAAC,CAChDnE,MAAM,CAACqE,OAAO,CAAC,CAAA;AAElB,EAAA,OAAO,CAAC,GAAGJ,eAAe,EAAE,GAAGF,kBAAkB,CAAC,CAAA;AACpD;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.d.ts b/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.d.ts new file mode 100644 index 00000000..c18ee202 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.d.ts @@ -0,0 +1,53 @@ +import { Column, OnChangeFn, RowData, TableFeature, Updater } from '../types'; +import { ColumnPinningPosition } from '..'; +export interface ColumnOrderTableState { + columnOrder: ColumnOrderState; +} +export type ColumnOrderState = string[]; +export interface ColumnOrderOptions { + /** + * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + onColumnOrderChange?: OnChangeFn; +} +export interface ColumnOrderColumn { + /** + * Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + getIndex: (position?: ColumnPinningPosition | 'center') => number; + /** + * Returns `true` if the column is the first column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the first in a sub-section of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getisfirstcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + getIsFirstColumn: (position?: ColumnPinningPosition | 'center') => boolean; + /** + * Returns `true` if the column is the last column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the last in a sub-section of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getislastcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + getIsLastColumn: (position?: ColumnPinningPosition | 'center') => boolean; +} +export interface ColumnOrderDefaultOptions { + onColumnOrderChange: OnChangeFn; +} +export interface ColumnOrderInstance { + _getOrderColumnsFn: () => (columns: Column[]) => Column[]; + /** + * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + resetColumnOrder: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.columnOrder` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + setColumnOrder: (updater: Updater) => void; +} +export declare const ColumnOrdering: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.js b/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.js new file mode 100644 index 00000000..29c21bdd --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.js @@ -0,0 +1,84 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); +var ColumnGrouping = require('./ColumnGrouping.js'); +var ColumnVisibility = require('./ColumnVisibility.js'); + +// + +const ColumnOrdering = { + getInitialState: state => { + return { + columnOrder: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnOrderChange: utils.makeStateUpdater('columnOrder', table) + }; + }, + createColumn: (column, table) => { + column.getIndex = utils.memo(position => [ColumnVisibility._getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), utils.getMemoOptions(table.options, 'debugColumns', 'getIndex')); + column.getIsFirstColumn = position => { + var _columns$; + const columns = ColumnVisibility._getVisibleLeafColumns(table, position); + return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id; + }; + column.getIsLastColumn = position => { + var _columns; + const columns = ColumnVisibility._getVisibleLeafColumns(table, position); + return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id; + }; + }, + createTable: table => { + table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater); + table.resetColumnOrder = defaultState => { + var _table$initialState$c; + table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); + }; + table._getOrderColumnsFn = utils.memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => { + // Sort grouped columns to the start of the column list + // before the headers are built + let orderedColumns = []; + + // If there is no order, return the normal columns + if (!(columnOrder != null && columnOrder.length)) { + orderedColumns = columns; + } else { + const columnOrderCopy = [...columnOrder]; + + // If there is an order, make a copy of the columns + const columnsCopy = [...columns]; + + // And make a new ordered array of the columns + + // Loop over the columns and place them in order into the new array + while (columnsCopy.length && columnOrderCopy.length) { + const targetColumnId = columnOrderCopy.shift(); + const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId); + if (foundIndex > -1) { + orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); + } + } + + // If there are any columns left, add them to the end + orderedColumns = [...orderedColumns, ...columnsCopy]; + } + return ColumnGrouping.orderColumns(orderedColumns, grouping, groupedColumnMode); + }, utils.getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')); + } +}; + +exports.ColumnOrdering = ColumnOrdering; +//# sourceMappingURL=ColumnOrdering.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.js.map b/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.js.map new file mode 100644 index 00000000..079ecec0 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnOrdering.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ColumnOrdering.js","sources":["../../../src/features/ColumnOrdering.ts"],"sourcesContent":["import { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nimport {\n Column,\n OnChangeFn,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\n\nimport { orderColumns } from './ColumnGrouping'\nimport { ColumnPinningPosition, _getVisibleLeafColumns } from '..'\n\nexport interface ColumnOrderTableState {\n columnOrder: ColumnOrderState\n}\n\nexport type ColumnOrderState = string[]\n\nexport interface ColumnOrderOptions {\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n onColumnOrderChange?: OnChangeFn\n}\n\nexport interface ColumnOrderColumn {\n /**\n * Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIndex: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns `true` if the column is the first column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the first in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getisfirstcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsFirstColumn: (position?: ColumnPinningPosition | 'center') => boolean\n /**\n * Returns `true` if the column is the last column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the last in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getislastcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsLastColumn: (position?: ColumnPinningPosition | 'center') => boolean\n}\n\nexport interface ColumnOrderDefaultOptions {\n onColumnOrderChange: OnChangeFn\n}\n\nexport interface ColumnOrderInstance {\n _getOrderColumnsFn: () => (\n columns: Column[]\n ) => Column[]\n /**\n * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n resetColumnOrder: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnOrder` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n setColumnOrder: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnOrdering: TableFeature = {\n getInitialState: (state): ColumnOrderTableState => {\n return {\n columnOrder: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnOrderDefaultOptions => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getIndex = memo(\n position => [_getVisibleLeafColumns(table, position)],\n columns => columns.findIndex(d => d.id === column.id),\n getMemoOptions(table.options, 'debugColumns', 'getIndex')\n )\n column.getIsFirstColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[0]?.id === column.id\n }\n column.getIsLastColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[columns.length - 1]?.id === column.id\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnOrder = updater =>\n table.options.onColumnOrderChange?.(updater)\n table.resetColumnOrder = defaultState => {\n table.setColumnOrder(\n defaultState ? [] : table.initialState.columnOrder ?? []\n )\n }\n table._getOrderColumnsFn = memo(\n () => [\n table.getState().columnOrder,\n table.getState().grouping,\n table.options.groupedColumnMode,\n ],\n (columnOrder, grouping, groupedColumnMode) =>\n (columns: Column[]) => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns: Column[] = []\n\n // If there is no order, return the normal columns\n if (!columnOrder?.length) {\n orderedColumns = columns\n } else {\n const columnOrderCopy = [...columnOrder]\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns]\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift()\n const foundIndex = columnsCopy.findIndex(\n d => d.id === targetColumnId\n )\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy]\n }\n\n return orderColumns(orderedColumns, grouping, groupedColumnMode)\n },\n getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')\n )\n },\n}\n"],"names":["ColumnOrdering","getInitialState","state","columnOrder","getDefaultOptions","table","onColumnOrderChange","makeStateUpdater","createColumn","column","getIndex","memo","position","_getVisibleLeafColumns","columns","findIndex","d","id","getMemoOptions","options","getIsFirstColumn","_columns$","getIsLastColumn","_columns","length","createTable","setColumnOrder","updater","resetColumnOrder","defaultState","_table$initialState$c","initialState","_getOrderColumnsFn","getState","grouping","groupedColumnMode","orderedColumns","columnOrderCopy","columnsCopy","targetColumnId","shift","foundIndex","push","splice","orderColumns"],"mappings":";;;;;;;;;;;;;;;;AAwEA;;AAEO,MAAMA,cAA4B,GAAG;EAC1CC,eAAe,EAAGC,KAAK,IAA4B;IACjD,OAAO;AACLC,MAAAA,WAAW,EAAE,EAAE;MACf,GAAGD,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACW;IAC9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AACC,EAAE,KAAKsB,cAChB,CAAC,CAAA;AACD,UAAA,IAAIE,UAAU,GAAG,CAAC,CAAC,EAAE;AACnBL,YAAAA,cAAc,CAACM,IAAI,CAACJ,WAAW,CAACK,MAAM,CAACF,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAA;AAC5D,WAAA;AACF,SAAA;;AAEA;AACAL,QAAAA,cAAc,GAAG,CAAC,GAAGA,cAAc,EAAE,GAAGE,WAAW,CAAC,CAAA;AACtD,OAAA;AAEA,MAAA,OAAOM,2BAAY,CAACR,cAAc,EAAEF,QAAQ,EAAEC,iBAAiB,CAAC,CAAA;KACjE,EACHjB,oBAAc,CAACb,KAAK,CAACc,OAAO,EAAE,YAAY,EAAE,oBAAoB,CAClE,CAAC,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.d.ts b/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.d.ts new file mode 100644 index 00000000..d8f037d5 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.d.ts @@ -0,0 +1,126 @@ +import { OnChangeFn, Updater, Column, Cell, RowData, TableFeature } from '../types'; +export type ColumnPinningPosition = false | 'left' | 'right'; +export interface ColumnPinningState { + left?: string[]; + right?: string[]; +} +export interface ColumnPinningTableState { + columnPinning: ColumnPinningState; +} +export interface ColumnPinningOptions { + /** + * Enables/disables column pinning for the table. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + enableColumnPinning?: boolean; + /** + * @deprecated Use `enableColumnPinning` or `enableRowPinning` instead. + * Enables/disables all pinning for the table. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + enablePinning?: boolean; + /** + * If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange) + */ + onColumnPinningChange?: OnChangeFn; +} +export interface ColumnPinningDefaultOptions { + onColumnPinningChange: OnChangeFn; +} +export interface ColumnPinningColumnDef { + /** + * Enables/disables column pinning for this column. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + enablePinning?: boolean; +} +export interface ColumnPinningColumn { + /** + * Returns whether or not the column can be pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcanpin) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getCanPin: () => boolean; + /** + * Returns the pinned position of the column. (`'left'`, `'right'` or `false`) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getispinned) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getIsPinned: () => ColumnPinningPosition; + /** + * Returns the numeric pinned index of the column within a pinned column group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getpinnedindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getPinnedIndex: () => number; + /** + * Pins a column to the `'left'` or `'right'`, or unpins the column to the center if `false` is passed. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#pin) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + pin: (position: ColumnPinningPosition) => void; +} +export interface ColumnPinningRow { + /** + * Returns all center pinned (unpinned) leaf cells in the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcentervisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getCenterVisibleCells: () => Cell[]; + /** + * Returns all left pinned leaf cells in the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftvisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getLeftVisibleCells: () => Cell[]; + /** + * Returns all right pinned leaf cells in the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightvisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getRightVisibleCells: () => Cell[]; +} +export interface ColumnPinningInstance { + /** + * Returns all center pinned (unpinned) leaf columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcenterleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getCenterLeafColumns: () => Column[]; + /** + * Returns whether or not any columns are pinned. Optionally specify to only check for pinned columns in either the `left` or `right` position. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getissomecolumnspinned) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean; + /** + * Returns all left pinned leaf columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getLeftLeafColumns: () => Column[]; + /** + * Returns all right pinned leaf columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getRightLeafColumns: () => Column[]; + /** + * Resets the **columnPinning** state to `initialState.columnPinning`, or `true` can be passed to force a default blank state reset to `{ left: [], right: [], }`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#resetcolumnpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + resetColumnPinning: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.columnPinning` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#setcolumnpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + setColumnPinning: (updater: Updater) => void; +} +export declare const ColumnPinning: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.js b/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.js new file mode 100644 index 00000000..a0b53aa7 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.js @@ -0,0 +1,130 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +// + +const getDefaultColumnPinningState = () => ({ + left: [], + right: [] +}); +const ColumnPinning = { + getInitialState: state => { + return { + columnPinning: getDefaultColumnPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnPinningChange: utils.makeStateUpdater('columnPinning', table) + }; + }, + createColumn: (column, table) => { + column.pin = position => { + const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean); + table.setColumnPinning(old => { + var _old$left3, _old$right3; + if (position === 'right') { + var _old$left, _old$right; + return { + left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds] + }; + } + if (position === 'left') { + var _old$left2, _old$right2; + return { + left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds], + right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + } + return { + left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + }); + }; + column.getCanPin = () => { + const leafColumns = column.getLeafColumns(); + return leafColumns.some(d => { + var _d$columnDef$enablePi, _ref, _table$options$enable; + return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true); + }); + }; + column.getIsPinned = () => { + const leafColumnIds = column.getLeafColumns().map(d => d.id); + const { + left, + right + } = table.getState().columnPinning; + const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d)); + const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d)); + return isLeft ? 'left' : isRight ? 'right' : false; + }; + column.getPinnedIndex = () => { + var _table$getState$colum, _table$getState$colum2; + const position = column.getIsPinned(); + return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0; + }; + }, + createRow: (row, table) => { + row.getCenterVisibleCells = utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allCells.filter(d => !leftAndRight.includes(d.column.id)); + }, utils.getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')); + row.getLeftVisibleCells = utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => { + const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'left' + })); + return cells; + }, utils.getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')); + row.getRightVisibleCells = utils.memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { + const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'right' + })); + return cells; + }, utils.getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')); + }, + createTable: table => { + table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater); + table.resetColumnPinning = defaultState => { + var _table$initialState$c, _table$initialState; + return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState()); + }; + table.getIsSomeColumnsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().columnPinning; + if (!position) { + var _pinningState$left, _pinningState$right; + return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table.getLeftLeafColumns = utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { + return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, utils.getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')); + table.getRightLeafColumns = utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { + return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, utils.getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')); + table.getCenterLeafColumns = utils.memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allColumns.filter(d => !leftAndRight.includes(d.id)); + }, utils.getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')); + } +}; + +exports.ColumnPinning = ColumnPinning; +//# sourceMappingURL=ColumnPinning.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.js.map b/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.js.map new file mode 100644 index 00000000..9fc4ecae --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnPinning.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ColumnPinning.js","sources":["../../../src/features/ColumnPinning.ts"],"sourcesContent":["import {\n OnChangeFn,\n Updater,\n Table,\n Column,\n Row,\n Cell,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type ColumnPinningPosition = false | 'left' | 'right'\n\nexport interface ColumnPinningState {\n left?: string[]\n right?: string[]\n}\n\nexport interface ColumnPinningTableState {\n columnPinning: ColumnPinningState\n}\n\nexport interface ColumnPinningOptions {\n /**\n * Enables/disables column pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enableColumnPinning?: boolean\n /**\n * @deprecated Use `enableColumnPinning` or `enableRowPinning` instead.\n * Enables/disables all pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange)\n */\n onColumnPinningChange?: OnChangeFn\n}\n\nexport interface ColumnPinningDefaultOptions {\n onColumnPinningChange: OnChangeFn\n}\n\nexport interface ColumnPinningColumnDef {\n /**\n * Enables/disables column pinning for this column. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n}\n\nexport interface ColumnPinningColumn {\n /**\n * Returns whether or not the column can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcanpin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the column. (`'left'`, `'right'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getispinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsPinned: () => ColumnPinningPosition\n /**\n * Returns the numeric pinned index of the column within a pinned column group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getpinnedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a column to the `'left'` or `'right'`, or unpins the column to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#pin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n pin: (position: ColumnPinningPosition) => void\n}\n\nexport interface ColumnPinningRow {\n /**\n * Returns all center pinned (unpinned) leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcentervisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterVisibleCells: () => Cell[]\n /**\n * Returns all left pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftVisibleCells: () => Cell[]\n /**\n * Returns all right pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightVisibleCells: () => Cell[]\n}\n\nexport interface ColumnPinningInstance {\n /**\n * Returns all center pinned (unpinned) leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcenterleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterLeafColumns: () => Column[]\n /**\n * Returns whether or not any columns are pinned. Optionally specify to only check for pinned columns in either the `left` or `right` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getissomecolumnspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean\n /**\n * Returns all left pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftLeafColumns: () => Column[]\n /**\n * Returns all right pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightLeafColumns: () => Column[]\n /**\n * Resets the **columnPinning** state to `initialState.columnPinning`, or `true` can be passed to force a default blank state reset to `{ left: [], right: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#resetcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n resetColumnPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#setcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n setColumnPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultColumnPinningState = (): ColumnPinningState => ({\n left: [],\n right: [],\n})\n\nexport const ColumnPinning: TableFeature = {\n getInitialState: (state): ColumnPinningTableState => {\n return {\n columnPinning: getDefaultColumnPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnPinningDefaultOptions => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.pin = position => {\n const columnIds = column\n .getLeafColumns()\n .map(d => d.id)\n .filter(Boolean) as string[]\n\n table.setColumnPinning(old => {\n if (position === 'right') {\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: [\n ...(old?.right ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n }\n }\n\n if (position === 'left') {\n return {\n left: [\n ...(old?.left ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n }\n\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n })\n }\n\n column.getCanPin = () => {\n const leafColumns = column.getLeafColumns()\n\n return leafColumns.some(\n d =>\n (d.columnDef.enablePinning ?? true) &&\n (table.options.enableColumnPinning ??\n table.options.enablePinning ??\n true)\n )\n }\n\n column.getIsPinned = () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id)\n\n const { left, right } = table.getState().columnPinning\n\n const isLeft = leafColumnIds.some(d => left?.includes(d))\n const isRight = leafColumnIds.some(d => right?.includes(d))\n\n return isLeft ? 'left' : isRight ? 'right' : false\n }\n\n column.getPinnedIndex = () => {\n const position = column.getIsPinned()\n\n return position\n ? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1\n : 0\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getCenterVisibleCells = memo(\n () => [\n row._getAllVisibleCells(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allCells, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allCells.filter(d => !leftAndRight.includes(d.column.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')\n )\n row.getLeftVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.left],\n (allCells, left) => {\n const cells = (left ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'left' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')\n )\n row.getRightVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.right],\n (allCells, right) => {\n const cells = (right ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'right' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n table.setColumnPinning = updater =>\n table.options.onColumnPinningChange?.(updater)\n\n table.resetColumnPinning = defaultState =>\n table.setColumnPinning(\n defaultState\n ? getDefaultColumnPinningState()\n : table.initialState?.columnPinning ?? getDefaultColumnPinningState()\n )\n\n table.getIsSomeColumnsPinned = position => {\n const pinningState = table.getState().columnPinning\n\n if (!position) {\n return Boolean(pinningState.left?.length || pinningState.right?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table.getLeftLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.left],\n (allColumns, left) => {\n return (left ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')\n )\n\n table.getRightLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.right],\n (allColumns, right) => {\n return (right ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')\n )\n\n table.getCenterLeafColumns = memo(\n () => [\n table.getAllLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allColumns.filter(d => !leftAndRight.includes(d.id))\n },\n getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')\n )\n },\n}\n"],"names":["getDefaultColumnPinningState","left","right","ColumnPinning","getInitialState","state","columnPinning","getDefaultOptions","table","onColumnPinningChange","makeStateUpdater","createColumn","column","pin","position","columnIds","getLeafColumns","map","d","id","filter","Boolean","setColumnPinning","old","_old$left3","_old$right3","_old$left","_old$right","includes","_old$left2","_old$right2","getCanPin","leafColumns","some","_d$columnDef$enablePi","_ref","_table$options$enable","columnDef","enablePinning","options","enableColumnPinning","getIsPinned","leafColumnIds","getState","isLeft","isRight","getPinnedIndex","_table$getState$colum","_table$getState$colum2","indexOf","createRow","row","getCenterVisibleCells","memo","_getAllVisibleCells","allCells","leftAndRight","getMemoOptions","getLeftVisibleCells","cells","columnId","find","cell","getRightVisibleCells","createTable","updater","resetColumnPinning","defaultState","_table$initialState$c","_table$initialState","initialState","getIsSomeColumnsPinned","_pinningState$positio","pinningState","_pinningState$left","_pinningState$right","length","getLeftLeafColumns","getAllLeafColumns","allColumns","getRightLeafColumns","getCenterLeafColumns"],"mappings":";;;;;;;;;;;;;;AAiJA;;AAEA,MAAMA,4BAA4B,GAAGA,OAA2B;AAC9DC,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,KAAK,EAAE,EAAA;AACT,CAAC,CAAC,CAAA;AAEK,MAAMC,aAA2B,GAAG;EACzCC,eAAe,EAAGC,KAAK,IAA8B;IACnD,OAAO;MACLC,aAAa,EAAEN,4BAA4B,EAAE;MAC7C,GAAGK,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACa;IAChC,OAAO;AACLC,MAAAA,qBAAqB,EAAEC,sBAAgB,CAAC,eAAe,EAAEF,KAAK,CAAA;KAC/D,CAAA;GACF;AAEDG,EAAAA,YAAY,EAAEA,CACZC,MAA6B,EAC7BJ,KAAmB,KACV;AACTI,I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E,KAAK,CAACmC,QAAQ,EAAE,CAACrC,aAAa,CAACL,IAAI,EACnCO,KAAK,CAACmC,QAAQ,EAAE,CAACrC,aAAa,CAACJ,KAAK,CACrC,EACD,CAAC6E,UAAU,EAAE9E,IAAI,EAAEC,KAAK,KAAK;AAC3B,MAAA,MAAMsD,YAAsB,GAAG,CAAC,IAAIvD,IAAI,IAAA,IAAA,GAAJA,IAAI,GAAI,EAAE,GAAG,IAAIC,KAAK,IAAA,IAAA,GAALA,KAAK,GAAI,EAAE,EAAE,CAAA;AAElE,MAAA,OAAO6E,UAAU,CAAC3D,MAAM,CAACF,CAAC,IAAI,CAACsC,YAAY,CAAC5B,QAAQ,CAACV,CAAC,CAACC,EAAE,CAAC,CAAC,CAAA;KAC5D,EACDsC,oBAAc,CAACjD,KAAK,CAAC+B,OAAO,EAAE,cAAc,EAAE,sBAAsB,CACtE,CAAC,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.d.ts b/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.d.ts new file mode 100644 index 00000000..eacc5d3f --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.d.ts @@ -0,0 +1,193 @@ +import { OnChangeFn, Updater, TableFeature } from '../types'; +import { ColumnPinningPosition } from './ColumnPinning'; +export interface ColumnSizingTableState { + columnSizing: ColumnSizingState; + columnSizingInfo: ColumnSizingInfoState; +} +export type ColumnSizingState = Record; +export interface ColumnSizingInfoState { + columnSizingStart: [string, number][]; + deltaOffset: null | number; + deltaPercentage: null | number; + isResizingColumn: false | string; + startOffset: null | number; + startSize: null | number; +} +export type ColumnResizeMode = 'onChange' | 'onEnd'; +export type ColumnResizeDirection = 'ltr' | 'rtl'; +export interface ColumnSizingOptions { + /** + * Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnresizemode) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + columnResizeMode?: ColumnResizeMode; + /** + * Enables or disables column resizing for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enablecolumnresizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + enableColumnResizing?: boolean; + /** + * Enables or disables right-to-left support for resizing the column. defaults to 'ltr'. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnResizeDirection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + columnResizeDirection?: ColumnResizeDirection; + /** + * If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + onColumnSizingChange?: OnChangeFn; + /** + * If provided, this function will be called with an `updaterFn` when `state.columnSizingInfo` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizingInfo` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizinginfochange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + onColumnSizingInfoChange?: OnChangeFn; +} +export type ColumnSizingDefaultOptions = Pick; +export interface ColumnSizingInstance { + /** + * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcentertotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getCenterTotalSize: () => number; + /** + * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getlefttotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getLeftTotalSize: () => number; + /** + * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getrighttotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getRightTotalSize: () => number; + /** + * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#gettotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getTotalSize: () => number; + /** + * Resets column sizing to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetcolumnsizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + resetColumnSizing: (defaultState?: boolean) => void; + /** + * Resets column sizing info to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetheadersizeinfo) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + resetHeaderSizeInfo: (defaultState?: boolean) => void; + /** + * Sets the column sizing state using an updater function or a value. This will trigger the underlying `onColumnSizingChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + setColumnSizing: (updater: Updater) => void; + /** + * Sets the column sizing info state using an updater function or a value. This will trigger the underlying `onColumnSizingInfoChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizinginfo) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + setColumnSizingInfo: (updater: Updater) => void; +} +export interface ColumnSizingColumnDef { + /** + * Enables or disables column resizing for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + enableResizing?: boolean; + /** + * The maximum allowed size for the column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + maxSize?: number; + /** + * The minimum allowed size for the column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + minSize?: number; + /** + * The desired size for the column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + size?: number; +} +export interface ColumnSizingColumn { + /** + * Returns `true` if the column can be resized. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcanresize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getCanResize: () => boolean; + /** + * Returns `true` if the column is currently being resized. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getisresizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getIsResizing: () => boolean; + /** + * Returns the current size of the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getSize: () => number; + /** + * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getStart: (position?: ColumnPinningPosition | 'center') => number; + /** + * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column. + */ + getAfter: (position?: ColumnPinningPosition | 'center') => number; + /** + * Resets the column to its initial size. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + resetSize: () => void; +} +export interface ColumnSizingHeader { + /** + * Returns an event handler function that can be used to resize the header. It can be used as an: + * - `onMouseDown` handler + * - `onTouchStart` handler + * + * The dragging and release events are automatically handled for you. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getresizehandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getResizeHandler: (context?: Document) => (event: unknown) => void; + /** + * Returns the current size of the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getSize: () => number; + /** + * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getStart: (position?: ColumnPinningPosition) => number; +} +export declare const defaultColumnSizing: { + size: number; + minSize: number; + maxSize: number; +}; +export declare const ColumnSizing: TableFeature; +export declare function passiveEventSupported(): boolean; diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.js b/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.js new file mode 100644 index 00000000..41636b61 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.js @@ -0,0 +1,271 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); +var document = require('../utils/document.js'); +var ColumnVisibility = require('./ColumnVisibility.js'); + +// + +// + +const defaultColumnSizing = { + size: 150, + minSize: 20, + maxSize: Number.MAX_SAFE_INTEGER +}; +const getDefaultColumnSizingInfoState = () => ({ + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + isResizingColumn: false, + columnSizingStart: [] +}); +const ColumnSizing = { + getDefaultColumnDef: () => { + return defaultColumnSizing; + }, + getInitialState: state => { + return { + columnSizing: {}, + columnSizingInfo: getDefaultColumnSizingInfoState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + columnResizeMode: 'onEnd', + columnResizeDirection: 'ltr', + onColumnSizingChange: utils.makeStateUpdater('columnSizing', table), + onColumnSizingInfoChange: utils.makeStateUpdater('columnSizingInfo', table) + }; + }, + createColumn: (column, table) => { + column.getSize = () => { + var _column$columnDef$min, _ref, _column$columnDef$max; + const columnSize = table.getState().columnSizing[column.id]; + return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); + }; + column.getStart = utils.memo(position => [position, ColumnVisibility._getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), utils.getMemoOptions(table.options, 'debugColumns', 'getStart')); + column.getAfter = utils.memo(position => [position, ColumnVisibility._getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), utils.getMemoOptions(table.options, 'debugColumns', 'getAfter')); + column.resetSize = () => { + table.setColumnSizing(_ref2 => { + let { + [column.id]: _, + ...rest + } = _ref2; + return rest; + }); + }; + column.getCanResize = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); + }; + column.getIsResizing = () => { + return table.getState().columnSizingInfo.isResizingColumn === column.id; + }; + }, + createHeader: (header, table) => { + header.getSize = () => { + let sum = 0; + const recurse = header => { + if (header.subHeaders.length) { + header.subHeaders.forEach(recurse); + } else { + var _header$column$getSiz; + sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0; + } + }; + recurse(header); + return sum; + }; + header.getStart = () => { + if (header.index > 0) { + const prevSiblingHeader = header.headerGroup.headers[header.index - 1]; + return prevSiblingHeader.getStart() + prevSiblingHeader.getSize(); + } + return 0; + }; + header.getResizeHandler = _contextDocument => { + const column = table.getColumn(header.column.id); + const canResize = column == null ? void 0 : column.getCanResize(); + return e => { + if (!column || !canResize) { + return; + } + e.persist == null || e.persist(); + if (isTouchStartEvent(e)) { + // lets not respond to multiple touches (e.g. 2 or 3 fingers) + if (e.touches && e.touches.length > 1) { + return; + } + } + const startSize = header.getSize(); + const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]]; + const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX; + const newColumnSizing = {}; + const updateOffset = (eventType, clientXPos) => { + if (typeof clientXPos !== 'number') { + return; + } + table.setColumnSizingInfo(old => { + var _old$startOffset, _old$startSize; + const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1; + const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection; + const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); + old.columnSizingStart.forEach(_ref3 => { + let [columnId, headerSize] = _ref3; + newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100; + }); + return { + ...old, + deltaOffset, + deltaPercentage + }; + }); + if (table.options.columnResizeMode === 'onChange' || eventType === 'end') { + table.setColumnSizing(old => ({ + ...old, + ...newColumnSizing + })); + } + }; + const onMove = clientXPos => updateOffset('move', clientXPos); + const onEnd = clientXPos => { + updateOffset('end', clientXPos); + table.setColumnSizingInfo(old => ({ + ...old, + isResizingColumn: false, + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + columnSizingStart: [] + })); + }; + const contextDocument = document.safelyAccessDocument(_contextDocument); + const mouseEvents = { + moveHandler: e => onMove(e.clientX), + upHandler: e => { + contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler); + onEnd(e.clientX); + } + }; + const touchEvents = { + moveHandler: e => { + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onMove(e.touches[0].clientX); + return false; + }, + upHandler: e => { + var _e$touches$; + contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler); + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX); + } + }; + const passiveIfSupported = passiveEventSupported() ? { + passive: false + } : false; + if (isTouchStartEvent(e)) { + contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported); + } else { + contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported); + } + table.setColumnSizingInfo(old => ({ + ...old, + startOffset: clientX, + startSize, + deltaOffset: 0, + deltaPercentage: 0, + columnSizingStart, + isResizingColumn: column.id + })); + }; + }; + }, + createTable: table => { + table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater); + table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater); + table.resetColumnSizing = defaultState => { + var _table$initialState$c; + table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); + }; + table.resetHeaderSizeInfo = defaultState => { + var _table$initialState$c2; + table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); + }; + table.getTotalSize = () => { + var _table$getHeaderGroup, _table$getHeaderGroup2; + return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getHeaderGroup : 0; + }; + table.getLeftTotalSize = () => { + var _table$getLeftHeaderG, _table$getLeftHeaderG2; + return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getLeftHeaderG : 0; + }; + table.getCenterTotalSize = () => { + var _table$getCenterHeade, _table$getCenterHeade2; + return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getCenterHeade : 0; + }; + table.getRightTotalSize = () => { + var _table$getRightHeader, _table$getRightHeader2; + return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getRightHeader : 0; + }; + } +}; +let passiveSupported = null; +function passiveEventSupported() { + if (typeof passiveSupported === 'boolean') return passiveSupported; + let supported = false; + try { + const options = { + get passive() { + supported = true; + return false; + } + }; + const noop = () => {}; + window.addEventListener('test', noop, options); + window.removeEventListener('test', noop); + } catch (err) { + supported = false; + } + passiveSupported = supported; + return passiveSupported; +} +function isTouchStartEvent(e) { + return e.type === 'touchstart'; +} + +exports.ColumnSizing = ColumnSizing; +exports.defaultColumnSizing = defaultColumnSizing; +exports.passiveEventSupported = passiveEventSupported; +//# sourceMappingURL=ColumnSizing.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.js.map b/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.js.map new file mode 100644 index 00000000..90952e1b --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnSizing.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ColumnSizing.js","sources":["../../../src/features/ColumnSizing.ts"],"sourcesContent":["import { _getVisibleLeafColumns } from '..'\nimport {\n RowData,\n Column,\n Header,\n OnChangeFn,\n Table,\n Updater,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\nimport { ColumnPinningPosition } from './ColumnPinning'\nimport { safelyAccessDocument } from '../utils/document'\n\n//\n\nexport interface ColumnSizingTableState {\n columnSizing: ColumnSizingState\n columnSizingInfo: ColumnSizingInfoState\n}\n\nexport type ColumnSizingState = Record\n\nexport interface ColumnSizingInfoState {\n columnSizingStart: [string, number][]\n deltaOffset: null | number\n deltaPercentage: null | number\n isResizingColumn: false | string\n startOffset: null | number\n startSize: null | number\n}\n\nexport type ColumnResizeMode = 'onChange' | 'onEnd'\n\nexport type ColumnResizeDirection = 'ltr' | 'rtl'\n\nexport interface ColumnSizingOptions {\n /**\n * Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnresizemode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeMode?: ColumnResizeMode\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enablecolumnresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableColumnResizing?: boolean\n /**\n * Enables or disables right-to-left support for resizing the column. defaults to 'ltr'.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnResizeDirection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeDirection?: ColumnResizeDirection\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingChange?: OnChangeFn\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizingInfo` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizingInfo` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizinginfochange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingInfoChange?: OnChangeFn\n}\n\nexport type ColumnSizingDefaultOptions = Pick<\n ColumnSizingOptions,\n | 'columnResizeMode'\n | 'onColumnSizingChange'\n | 'onColumnSizingInfoChange'\n | 'columnResizeDirection'\n>\n\nexport interface ColumnSizingInstance {\n /**\n * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcentertotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCenterTotalSize: () => number\n /**\n * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getlefttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getLeftTotalSize: () => number\n /**\n * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getrighttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getRightTotalSize: () => number\n /**\n * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#gettotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getTotalSize: () => number\n /**\n * Resets column sizing to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetColumnSizing: (defaultState?: boolean) => void\n /**\n * Resets column sizing info to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetheadersizeinfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetHeaderSizeInfo: (defaultState?: boolean) => void\n /**\n * Sets the column sizing state using an updater function or a value. This will trigger the underlying `onColumnSizingChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizing: (updater: Updater) => void\n /**\n * Sets the column sizing info state using an updater function or a value. This will trigger the underlying `onColumnSizingInfoChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizinginfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizingInfo: (updater: Updater) => void\n}\n\nexport interface ColumnSizingColumnDef {\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableResizing?: boolean\n /**\n * The maximum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n maxSize?: number\n /**\n * The minimum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n minSize?: number\n /**\n * The desired size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n size?: number\n}\n\nexport interface ColumnSizingColumn {\n /**\n * Returns `true` if the column can be resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcanresize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCanResize: () => boolean\n /**\n * Returns `true` if the column is currently being resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getisresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getIsResizing: () => boolean\n /**\n * Returns the current size of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column.\n */\n getAfter: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Resets the column to its initial size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetSize: () => void\n}\n\nexport interface ColumnSizingHeader {\n /**\n * Returns an event handler function that can be used to resize the header. It can be used as an:\n * - `onMouseDown` handler\n * - `onTouchStart` handler\n *\n * The dragging and release events are automatically handled for you.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getresizehandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getResizeHandler: (context?: Document) => (event: unknown) => void\n /**\n * Returns the current size of the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition) => number\n}\n\n//\n\nexport const defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n}\n\nconst getDefaultColumnSizingInfoState = (): ColumnSizingInfoState => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: [],\n})\n\nexport const ColumnSizing: TableFeature = {\n getDefaultColumnDef: (): ColumnSizingColumnDef => {\n return defaultColumnSizing\n },\n getInitialState: (state): ColumnSizingTableState => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnSizingDefaultOptions => {\n return {\n columnResizeMode: 'onEnd',\n columnResizeDirection: 'ltr',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getSize = () => {\n const columnSize = table.getState().columnSizing[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultColumnSizing.minSize,\n columnSize ?? column.columnDef.size ?? defaultColumnSizing.size\n ),\n column.columnDef.maxSize ?? defaultColumnSizing.maxSize\n )\n }\n\n column.getStart = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(0, column.getIndex(position))\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getStart')\n )\n\n column.getAfter = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(column.getIndex(position) + 1)\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getAfter')\n )\n\n column.resetSize = () => {\n table.setColumnSizing(({ [column.id]: _, ...rest }) => {\n return rest\n })\n }\n column.getCanResize = () => {\n return (\n (column.columnDef.enableResizing ?? true) &&\n (table.options.enableColumnResizing ?? true)\n )\n }\n column.getIsResizing = () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id\n }\n },\n\n createHeader: (\n header: Header,\n table: Table\n ): void => {\n header.getSize = () => {\n let sum = 0\n\n const recurse = (header: Header) => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse)\n } else {\n sum += header.column.getSize() ?? 0\n }\n }\n\n recurse(header)\n\n return sum\n }\n header.getStart = () => {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup.headers[header.index - 1]!\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()\n }\n\n return 0\n }\n header.getResizeHandler = _contextDocument => {\n const column = table.getColumn(header.column.id)\n const canResize = column?.getCanResize()\n\n return (e: unknown) => {\n if (!column || !canResize) {\n return\n }\n\n ;(e as any).persist?.()\n\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return\n }\n }\n\n const startSize = header.getSize()\n\n const columnSizingStart: [string, number][] = header\n ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()])\n : [[column.id, column.getSize()]]\n\n const clientX = isTouchStartEvent(e)\n ? Math.round(e.touches[0]!.clientX)\n : (e as MouseEvent).clientX\n\n const newColumnSizing: ColumnSizingState = {}\n\n const updateOffset = (\n eventType: 'move' | 'end',\n clientXPos?: number\n ) => {\n if (typeof clientXPos !== 'number') {\n return\n }\n\n table.setColumnSizingInfo(old => {\n const deltaDirection =\n table.options.columnResizeDirection === 'rtl' ? -1 : 1\n const deltaOffset =\n (clientXPos - (old?.startOffset ?? 0)) * deltaDirection\n const deltaPercentage = Math.max(\n deltaOffset / (old?.startSize ?? 0),\n -0.999999\n )\n\n old.columnSizingStart.forEach(([columnId, headerSize]) => {\n newColumnSizing[columnId] =\n Math.round(\n Math.max(headerSize + headerSize * deltaPercentage, 0) * 100\n ) / 100\n })\n\n return {\n ...old,\n deltaOffset,\n deltaPercentage,\n }\n })\n\n if (\n table.options.columnResizeMode === 'onChange' ||\n eventType === 'end'\n ) {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing,\n }))\n }\n }\n\n const onMove = (clientXPos?: number) => updateOffset('move', clientXPos)\n\n const onEnd = (clientXPos?: number) => {\n updateOffset('end', clientXPos)\n\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: [],\n }))\n }\n\n const contextDocument = safelyAccessDocument(_contextDocument)\n\n const mouseEvents = {\n moveHandler: (e: MouseEvent) => onMove(e.clientX),\n upHandler: (e: MouseEvent) => {\n contextDocument?.removeEventListener(\n 'mousemove',\n mouseEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'mouseup',\n mouseEvents.upHandler\n )\n onEnd(e.clientX)\n },\n }\n\n const touchEvents = {\n moveHandler: (e: TouchEvent) => {\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onMove(e.touches[0]!.clientX)\n return false\n },\n upHandler: (e: TouchEvent) => {\n contextDocument?.removeEventListener(\n 'touchmove',\n touchEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'touchend',\n touchEvents.upHandler\n )\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onEnd(e.touches[0]?.clientX)\n },\n }\n\n const passiveIfSupported = passiveEventSupported()\n ? { passive: false }\n : false\n\n if (isTouchStartEvent(e)) {\n contextDocument?.addEventListener(\n 'touchmove',\n touchEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'touchend',\n touchEvents.upHandler,\n passiveIfSupported\n )\n } else {\n contextDocument?.addEventListener(\n 'mousemove',\n mouseEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'mouseup',\n mouseEvents.upHandler,\n passiveIfSupported\n )\n }\n\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id,\n }))\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnSizing = updater =>\n table.options.onColumnSizingChange?.(updater)\n table.setColumnSizingInfo = updater =>\n table.options.onColumnSizingInfoChange?.(updater)\n table.resetColumnSizing = defaultState => {\n table.setColumnSizing(\n defaultState ? {} : table.initialState.columnSizing ?? {}\n )\n }\n table.resetHeaderSizeInfo = defaultState => {\n table.setColumnSizingInfo(\n defaultState\n ? getDefaultColumnSizingInfoState()\n : table.initialState.columnSizingInfo ??\n getDefaultColumnSizingInfoState()\n )\n }\n table.getTotalSize = () =>\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getLeftTotalSize = () =>\n table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getCenterTotalSize = () =>\n table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getRightTotalSize = () =>\n table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n },\n}\n\nlet passiveSupported: boolean | null = null\nexport function passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported\n\n let supported = false\n try {\n const options = {\n get passive() {\n supported = true\n return false\n },\n }\n\n const noop = () => {}\n\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop)\n } catch (err) {\n supported = false\n }\n passiveSupported = supported\n return passiveSupported\n}\n\nfunction isTouchStartEvent(e: unknown): e is TouchEvent {\n return (e as TouchEvent).type === 'touchstart'\n}\n"],"names":["defaultColumnSizing","size","minSize","maxSize","Number","MAX_SAFE_INTEGER","getDefaultColumnSizingInfoState","startOffset","startSize","deltaOffset","deltaPercentage","isResizingColumn","columnSizingStart","ColumnSizing","getDefaultColumnDef","getInitialState","state","columnSizing","columnSizingInfo","getDefaultOptions","table","columnResizeMode","columnResizeDirection","onColumnSizingChange","makeStateUpdater","onColumnSizingInfoChange","createColumn","column","getSize","_column$columnDef$min","_ref","_column$columnDef$max","columnSize","getState","id","Math","min","max","columnDef","getStart","memo","position","_getVisibleLeafColumns","columns","slice","getIndex","reduce","sum","getMemoOptions","options","getAfter","resetSize","setColumnSizing","_ref2","_","rest","getCanResize","_column$columnDef$ena","_table$options$enable","enableResizing","enableColumnResizing","getIsResizing","createHeader","header","recurse","subHeaders","length","forEach","_header$column$getSiz","index","prevSiblingHeader","headerGroup","headers","getResizeHandler","_contextDocument","getColumn","canResize","e","persist","isTouchStartEvent","touches","getLeafHeaders","map","d","clientX","round","newColumnSizing","updateOffset","eventType","clientXPos","setColumnSizingInfo","old","_old$startOffset","_old$startSize","deltaDirection","_ref3","columnId","headerSize","onMove","onEnd","contextDocument","safelyAccessDocument","mouseEvents","moveHandler","upHandler","removeEventListener","touchEvents","cancelable","preventDefault","stopPropagation","_e$touches$","passiveIfSupported","passiveEventSupported","passive","addEventListener","createTable","updater","resetColumnSizing","defaultState","_table$initialState$c","initialState","resetHeaderSizeInfo","_table$initialState$c2","getTotalSize","_table$getHeaderGroup","_table$getHeaderGroup2","getHeaderGroups","getLeftTotalSize","_table$getLeftHeaderG","_table$getLeftHeaderG2","getLeftHeaderGroups","getCenterTotalSize","_table$getCenterHeade","_table$getCenterHeade2","getCenterHeaderGroups","getRightTotalSize","_table$getRightHeader","_table$getRightHeader2","getRightHeaderGroups","passiveSupported","supported","noop","window","err","type"],"mappings":";;;;;;;;;;;;;;;;AAcA;;AA2MA;;AAEO,MAAMA,mBAAmB,GAAG;AACjCC,EAAAA,IAAI,EAAE,GAAG;AACTC,EAAAA,OAAO,EAAE,EAAE;EACXC,OAAO,EAAEC,MAAM,CAACC,gBAAAA;AAClB,EAAC;AAED,MAAMC,+BAA+B,GAAGA,OAA8B;AACpEC,EAAAA,WAAW,EAAE,IAAI;AACjBC,EAAAA,SAAS,EAAE,IAAI;AACfC,EAAAA,WAAW,EAAE,IAAI;AACjBC,EAAAA,eAAe,EAAE,IAAI;AACrBC,EAAAA,gBAAgB,EAAE,KAAK;AACvBC,EAAAA,iBAAiB,EAAE,EAAA;AACrB,CAAC,CAAC,CAAA;AAEK,MAAMC,YAA0B,GAAG;EACxCC,mBAAmB,EAAEA,MAA6B;AAChD,IAAA,OAAOd,mBAAmB,CAAA;GAC3B;EACDe,eAAe,EAAGC,KAAK,IAA6B;IAClD,OAAO;MACLC,YAAY,EAAE,EAAE;MAChBC,gBAAgB,EAAEZ,+BAA+B,EAAE;MACnD,GAAGU,KAAAA;KACJ,CAAA;GACF;EAEDG,iBAAiB,EACfC,KAAmB,IACY;IAC/B,OAAO;AACLC,MAAAA,gBAAgB,EAAE,OAAO;AACzBC,MAAAA,qBAAqB,EAAE,KAAK;AAC5BC,MAAAA,oBAAoB,EAAEC,sBAAgB,CAAC,cAAc,EAAEJ,KAAK,CAAC;AAC7DK,MAAAA,wBAAwB,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IAAA,MAAMC,IAAI,GAAGA,MAAM,EAAE,CAAA;IAErBC,MAAM,CAAC5B,gBAAgB,CAAC,MAAM,EAAE2B,IAAI,EAAE5F,OAAO,CAAC,CAAA;AAC9C6F,IAAAA,MAAM,CAACrC,mBAAmB,CAAC,MAAM,EAAEoC,IAAI,CAAC,CAAA;GACzC,CAAC,OAAOE,GAAG,EAAE;AACZH,IAAAA,SAAS,GAAG,KAAK,CAAA;AACnB,GAAA;AACAD,EAAAA,gBAAgB,GAAGC,SAAS,CAAA;AAC5B,EAAA,OAAOD,gBAAgB,CAAA;AACzB,CAAA;AAEA,SAAS5D,iBAAiBA,CAACF,CAAU,EAAmB;AACtD,EAAA,OAAQA,CAAC,CAAgBmE,IAAI,KAAK,YAAY,CAAA;AAChD;;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.d.ts b/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.d.ts new file mode 100644 index 00000000..36727e9c --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.d.ts @@ -0,0 +1,129 @@ +import { ColumnPinningPosition } from '..'; +import { Cell, Column, OnChangeFn, Table, Updater, RowData, TableFeature } from '../types'; +export type VisibilityState = Record; +export interface VisibilityTableState { + columnVisibility: VisibilityState; +} +export interface VisibilityOptions { + /** + * Whether to enable column hiding. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#enablehiding) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + enableHiding?: boolean; + /** + * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + onColumnVisibilityChange?: OnChangeFn; +} +export type VisibilityDefaultOptions = Pick; +export interface VisibilityInstance { + /** + * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getCenterVisibleLeafColumns: () => Column[]; + /** + * Returns whether all columns are visible + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getIsAllColumnsVisible: () => boolean; + /** + * Returns whether any columns are visible + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getIsSomeColumnsVisible: () => boolean; + /** + * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getLeftVisibleLeafColumns: () => Column[]; + /** + * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getRightVisibleLeafColumns: () => Column[]; + /** + * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void; + /** + * Returns a flat array of columns that are visible, including parent columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getVisibleFlatColumns: () => Column[]; + /** + * Returns a flat array of leaf-node columns that are visible. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getVisibleLeafColumns: () => Column[]; + /** + * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}` + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + resetColumnVisibility: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.columnVisibility` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + setColumnVisibility: (updater: Updater) => void; + /** + * Toggles the visibility of all columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + toggleAllColumnsVisible: (value?: boolean) => void; +} +export interface VisibilityColumnDef { + enableHiding?: boolean; +} +export interface VisibilityRow { + _getAllVisibleCells: () => Cell[]; + /** + * Returns an array of cells that account for column visibility for the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getVisibleCells: () => Cell[]; +} +export interface VisibilityColumn { + /** + * Returns whether the column can be hidden + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getCanHide: () => boolean; + /** + * Returns whether the column is visible + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getIsVisible: () => boolean; + /** + * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getToggleVisibilityHandler: () => (event: unknown) => void; + /** + * Toggles the visibility of the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + toggleVisibility: (value?: boolean) => void; +} +export declare const ColumnVisibility: TableFeature; +export declare function _getVisibleLeafColumns(table: Table, position?: ColumnPinningPosition | 'center'): Column[]; diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.js b/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.js new file mode 100644 index 00000000..c52111b2 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.js @@ -0,0 +1,99 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +// + +const ColumnVisibility = { + getInitialState: state => { + return { + columnVisibility: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnVisibilityChange: utils.makeStateUpdater('columnVisibility', table) + }; + }, + createColumn: (column, table) => { + column.toggleVisibility = value => { + if (column.getCanHide()) { + table.setColumnVisibility(old => ({ + ...old, + [column.id]: value != null ? value : !column.getIsVisible() + })); + } + }; + column.getIsVisible = () => { + var _ref, _table$getState$colum; + const childColumns = column.columns; + return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true; + }; + column.getCanHide = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); + }; + column.getToggleVisibilityHandler = () => { + return e => { + column.toggleVisibility == null || column.toggleVisibility(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row._getAllVisibleCells = utils.memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => { + return cells.filter(cell => cell.column.getIsVisible()); + }, utils.getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')); + row.getVisibleCells = utils.memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], utils.getMemoOptions(table.options, 'debugRows', 'getVisibleCells')); + }, + createTable: table => { + const makeVisibleColumnsMethod = (key, getColumns) => { + return utils.memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => { + return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible()); + }, utils.getMemoOptions(table.options, 'debugColumns', key)); + }; + table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()); + table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()); + table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()); + table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()); + table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()); + table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater); + table.resetColumnVisibility = defaultState => { + var _table$initialState$c; + table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); + }; + table.toggleAllColumnsVisible = value => { + var _value; + value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); + table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ + ...obj, + [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value + }), {})); + }; + table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())); + table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()); + table.getToggleAllColumnsVisibilityHandler = () => { + return e => { + var _target; + table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } +}; +function _getVisibleLeafColumns(table, position) { + return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); +} + +exports.ColumnVisibility = ColumnVisibility; +exports._getVisibleLeafColumns = _getVisibleLeafColumns; +//# sourceMappingURL=ColumnVisibility.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.js.map b/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.js.map new file mode 100644 index 00000000..5bf3f5e7 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/ColumnVisibility.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ColumnVisibility.js","sources":["../../../src/features/ColumnVisibility.ts"],"sourcesContent":["import { ColumnPinningPosition } from '..'\nimport {\n Cell,\n Column,\n OnChangeFn,\n Table,\n Updater,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type VisibilityState = Record\n\nexport interface VisibilityTableState {\n columnVisibility: VisibilityState\n}\n\nexport interface VisibilityOptions {\n /**\n * Whether to enable column hiding. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#enablehiding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n enableHiding?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n onColumnVisibilityChange?: OnChangeFn\n}\n\nexport type VisibilityDefaultOptions = Pick<\n VisibilityOptions,\n 'onColumnVisibilityChange'\n>\n\nexport interface VisibilityInstance {\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCenterVisibleLeafColumns: () => Column[]\n /**\n * Returns whether all columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsAllColumnsVisible: () => boolean\n /**\n * Returns whether any columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsSomeColumnsVisible: () => boolean\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getLeftVisibleLeafColumns: () => Column[]\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getRightVisibleLeafColumns: () => Column[]\n /**\n * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void\n /**\n * Returns a flat array of columns that are visible, including parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleFlatColumns: () => Column[]\n /**\n * Returns a flat array of leaf-node columns that are visible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleLeafColumns: () => Column[]\n /**\n * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n resetColumnVisibility: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnVisibility` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n setColumnVisibility: (updater: Updater) => void\n /**\n * Toggles the visibility of all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleAllColumnsVisible: (value?: boolean) => void\n}\n\nexport interface VisibilityColumnDef {\n enableHiding?: boolean\n}\n\nexport interface VisibilityRow {\n _getAllVisibleCells: () => Cell[]\n /**\n * Returns an array of cells that account for column visibility for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleCells: () => Cell[]\n}\n\nexport interface VisibilityColumn {\n /**\n * Returns whether the column can be hidden\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCanHide: () => boolean\n /**\n * Returns whether the column is visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsVisible: () => boolean\n /**\n * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleVisibilityHandler: () => (event: unknown) => void\n /**\n * Toggles the visibility of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleVisibility: (value?: boolean) => void\n}\n\n//\n\nexport const ColumnVisibility: TableFeature = {\n getInitialState: (state): VisibilityTableState => {\n return {\n columnVisibility: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): VisibilityDefaultOptions => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleVisibility = value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value ?? !column.getIsVisible(),\n }))\n }\n }\n column.getIsVisible = () => {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some(c => c.getIsVisible())\n : table.getState().columnVisibility?.[column.id]) ?? true\n )\n }\n\n column.getCanHide = () => {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (table.options.enableHiding ?? true)\n )\n }\n column.getToggleVisibilityHandler = () => {\n return (e: unknown) => {\n column.toggleVisibility?.(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row._getAllVisibleCells = memo(\n () => [row.getAllCells(), table.getState().columnVisibility],\n cells => {\n return cells.filter(cell => cell.column.getIsVisible())\n },\n getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')\n )\n row.getVisibleCells = memo(\n () => [\n row.getLeftVisibleCells(),\n row.getCenterVisibleCells(),\n row.getRightVisibleCells(),\n ],\n (left, center, right) => [...left, ...center, ...right],\n getMemoOptions(table.options, 'debugRows', 'getVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n const makeVisibleColumnsMethod = (\n key: string,\n getColumns: () => Column[]\n ): (() => Column[]) => {\n return memo(\n () => [\n getColumns(),\n getColumns()\n .filter(d => d.getIsVisible())\n .map(d => d.id)\n .join('_'),\n ],\n columns => {\n return columns.filter(d => d.getIsVisible?.())\n },\n getMemoOptions(table.options, 'debugColumns', key)\n )\n }\n\n table.getVisibleFlatColumns = makeVisibleColumnsMethod(\n 'getVisibleFlatColumns',\n () => table.getAllFlatColumns()\n )\n table.getVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getVisibleLeafColumns',\n () => table.getAllLeafColumns()\n )\n table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getLeftVisibleLeafColumns',\n () => table.getLeftLeafColumns()\n )\n table.getRightVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getRightVisibleLeafColumns',\n () => table.getRightLeafColumns()\n )\n table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getCenterVisibleLeafColumns',\n () => table.getCenterLeafColumns()\n )\n\n table.setColumnVisibility = updater =>\n table.options.onColumnVisibilityChange?.(updater)\n\n table.resetColumnVisibility = defaultState => {\n table.setColumnVisibility(\n defaultState ? {} : table.initialState.columnVisibility ?? {}\n )\n }\n\n table.toggleAllColumnsVisible = value => {\n value = value ?? !table.getIsAllColumnsVisible()\n\n table.setColumnVisibility(\n table.getAllLeafColumns().reduce(\n (obj, column) => ({\n ...obj,\n [column.id]: !value ? !column.getCanHide?.() : value,\n }),\n {}\n )\n )\n }\n\n table.getIsAllColumnsVisible = () =>\n !table.getAllLeafColumns().some(column => !column.getIsVisible?.())\n\n table.getIsSomeColumnsVisible = () =>\n table.getAllLeafColumns().some(column => column.getIsVisible?.())\n\n table.getToggleAllColumnsVisibilityHandler = () => {\n return (e: unknown) => {\n table.toggleAllColumnsVisible(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nexport function _getVisibleLeafColumns(\n table: Table,\n position?: ColumnPinningPosition | 'center'\n) {\n return !position\n ? table.getVisibleLeafColumns()\n : position === 'center'\n ? table.getCenterVisibleLeafColumns()\n : position === 'left'\n ? table.getLeftVisibleLeafColumns()\n : table.getRightVisibleLeafColumns()\n}\n"],"names":["ColumnVisibility","getInitialState","state","columnVisibility","getDefaultOptions","table","onColumnVisibilityChange","makeStateUpdater","createColumn","column","toggleVisibility","value","getCanHide","setColumnVisibility","old","id","getIsVisible","_ref","_table$getState$colum","childColumns","columns","length","some","c","getState","_column$columnDef$ena","_table$options$enable","columnDef","enableHiding","options","getToggleVisibilityHandler","e","target","checked","createRow","row","_getAllVisibleCells","memo","getAllCells","cells","filter","cell","getMemoOptions","getVisibleCells","getLeftVisibleCells","getCenterVisibleCells","getRightVisibleCells","left","center","right","createTable","makeVisibleColumnsMethod","key","getColumns","d","map","join","getVisibleFlatColumns","getAllFlatColumns","getVisibleLeafColumns","getAllLeafColumns","getLeftVisibleLeafColumns","getLeftLeafColumns","getRightVisibleLeafColumns","getRightLeafColumns","getCenterVisibleLeafColumns","getCenterLeafColumns","updater","resetColumnVisibility","defaultState","_table$initialState$c","initialState","toggleAllColumnsVisible","_value","getIsAllColumnsVisible","reduce","obj","getIsSomeColumnsVisible","getToggleAllColumnsVisibilityHandler","_target","_getVisibleLeafColumns","position"],"mappings":";;;;;;;;;;;;;;AAqJA;;AAEO,MAAMA,gBAA8B,GAAG;EAC5CC,eAAe,EAAGC,KAAK,IAA2B;IAChD,OAAO;MACLC,gBAAgB,EAAE,EAAE;MACpB,GAAGD,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACU;IAC7B,OAAO;AACLC,M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nEX,KAAK,CAACyE,oCAAoC,GAAG,MAAM;AACjD,MAAA,OAAQ/C,CAAU,IAAK;AAAA,QAAA,IAAAgD,OAAA,CAAA;AACrB1E,QAAAA,KAAK,CAACmE,uBAAuB,CAAAO,CAAAA,OAAA,GACzBhD,CAAC,CAAgBC,MAAM,KAAzB+C,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAA,CAAgD9C,OAClD,CAAC,CAAA;OACF,CAAA;KACF,CAAA;AACH,GAAA;AACF,EAAC;AAEM,SAAS+C,sBAAsBA,CACpC3E,KAAmB,EACnB4E,QAA2C,EAC3C;AACA,EAAA,OAAO,CAACA,QAAQ,GACZ5E,KAAK,CAACsD,qBAAqB,EAAE,GAC7BsB,QAAQ,KAAK,QAAQ,GACnB5E,KAAK,CAAC4D,2BAA2B,EAAE,GACnCgB,QAAQ,KAAK,MAAM,GACjB5E,KAAK,CAACwD,yBAAyB,EAAE,GACjCxD,KAAK,CAAC0D,0BAA0B,EAAE,CAAA;AAC5C;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.d.ts b/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.d.ts new file mode 100644 index 00000000..30cd2384 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.d.ts @@ -0,0 +1,26 @@ +import { RowModel } from '..'; +import { RowData, TableFeature } from '../types'; +export interface GlobalFacetingInstance { + _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]; + _getGlobalFacetedRowModel?: () => RowModel; + _getGlobalFacetedUniqueValues?: () => Map; + /** + * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalautofilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting) + */ + getGlobalFacetedMinMaxValues: () => undefined | [number, number]; + /** + * Returns the row model for the table after **global** filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfacetedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting) + */ + getGlobalFacetedRowModel: () => RowModel; + /** + * Returns the faceted unique values for the global filter. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfaceteduniquevalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting) + */ + getGlobalFacetedUniqueValues: () => Map; +} +export declare const GlobalFaceting: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.js b/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.js new file mode 100644 index 00000000..f31e1957 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.js @@ -0,0 +1,42 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +// + +const GlobalFaceting = { + createTable: table => { + table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'); + table.getGlobalFacetedRowModel = () => { + if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getGlobalFacetedRowModel(); + }; + table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'); + table.getGlobalFacetedUniqueValues = () => { + if (!table._getGlobalFacetedUniqueValues) { + return new Map(); + } + return table._getGlobalFacetedUniqueValues(); + }; + table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'); + table.getGlobalFacetedMinMaxValues = () => { + if (!table._getGlobalFacetedMinMaxValues) { + return; + } + return table._getGlobalFacetedMinMaxValues(); + }; + } +}; + +exports.GlobalFaceting = GlobalFaceting; +//# sourceMappingURL=GlobalFaceting.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.js.map b/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.js.map new file mode 100644 index 00000000..c4b9faf8 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/GlobalFaceting.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GlobalFaceting.js","sources":["../../../src/features/GlobalFaceting.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { Table, RowData, TableFeature } from '../types'\n\nexport interface GlobalFacetingInstance {\n _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]\n _getGlobalFacetedRowModel?: () => RowModel\n _getGlobalFacetedUniqueValues?: () => Map\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model for the table after **global** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedRowModel: () => RowModel\n /**\n * Returns the faceted unique values for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedUniqueValues: () => Map\n}\n\n//\n\nexport const GlobalFaceting: TableFeature = {\n createTable: (table: Table): void => {\n table._getGlobalFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, '__global__')\n\n table.getGlobalFacetedRowModel = () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getGlobalFacetedRowModel()\n }\n\n table._getGlobalFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, '__global__')\n table.getGlobalFacetedUniqueValues = () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map()\n }\n\n return table._getGlobalFacetedUniqueValues()\n }\n\n table._getGlobalFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, '__global__')\n table.getGlobalFacetedMinMaxValues = () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return\n }\n\n return table._getGlobalFacetedMinMaxValues()\n }\n },\n}\n"],"names":["GlobalFaceting","createTable","table","_getGlobalFacetedRowModel","options","getFacetedRowModel","getGlobalFacetedRowModel","manualFiltering","getPreFilteredRowModel","_getGlobalFacetedUniqueValues","getFacetedUniqueValues","getGlobalFacetedUniqueValues","Map","_getGlobalFacetedMinMaxValues","getFacetedMinMaxValues","getGlobalFacetedMinMaxValues"],"mappings":";;;;;;;;;;;;AA2BA;;AAEO,MAAMA,cAA4B,GAAG;EAC1CC,WAAW,EAA0BC,KAAmB,IAAW;AACjEA,IAAAA,KAAK,CAACC,yBAAyB,GAC7BD,KAAK,CAACE,OAAO,CAACC,kBAAkB,IAChCH,KAAK,CAACE,OAAO,CAACC,kBAAkB,CAACH,KAAK,EAAE,YAAY,CAAC,CAAA;IAEvDA,KAAK,CAACI,wBAAwB,GAAG,MAAM;MACrC,IAAIJ,KAAK,CAACE,OAAO,CAACG,eAAe,IAAI,CAACL,KAAK,CAACC,yBAAyB,EAAE;AACrE,QAAA,OAAOD,KAAK,CAACM,sBAAsB,EAAE,CAAA;AACvC,OAAA;AAEA,MAAA,OAAON,KAAK,CAACC,yBAAyB,EAAE,CAAA;KACzC,CAAA;AAEDD,IAAAA,KAAK,CAACO,6BAA6B,GACjCP,KAAK,CAACE,OAAO,CAACM,sBAAsB,IACpCR,KAAK,CAACE,OAAO,CAACM,sBAAsB,CAACR,KAAK,EAAE,YAAY,CAAC,CAAA;IAC3DA,KAAK,CAACS,4BAA4B,GAAG,MAAM;AACzC,MAAA,IAAI,CAACT,KAAK,CAACO,6BAA6B,EAAE;QACxC,OAAO,IAAIG,GAAG,EAAE,CAAA;AAClB,OAAA;AAEA,MAAA,OAAOV,KAAK,CAACO,6BAA6B,EAAE,CAAA;KAC7C,CAAA;AAEDP,IAAAA,KAAK,CAACW,6BAA6B,GACjCX,KAAK,CAACE,OAAO,CAACU,sBAAsB,IACpCZ,KAAK,CAACE,OAAO,CAACU,sBAAsB,CAACZ,KAAK,EAAE,YAAY,CAAC,CAAA;IAC3DA,KAAK,CAACa,4BAA4B,GAAG,MAAM;AACzC,MAAA,IAAI,CAACb,KAAK,CAACW,6BAA6B,EAAE;AACxC,QAAA,OAAA;AACF,OAAA;AAEA,MAAA,OAAOX,KAAK,CAACW,6BAA6B,EAAE,CAAA;KAC7C,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.d.ts b/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.d.ts new file mode 100644 index 00000000..bddb63ea --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.d.ts @@ -0,0 +1,79 @@ +import { FilterFn, FilterFnOption } from '..'; +import { Column, OnChangeFn, Updater, RowData, TableFeature } from '../types'; +export interface GlobalFilterTableState { + globalFilter: any; +} +export interface GlobalFilterColumnDef { + /** + * Enables/disables the **global** filter for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + enableGlobalFilter?: boolean; +} +export interface GlobalFilterColumn { + /** + * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcanglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getCanGlobalFilter: () => boolean; +} +export interface GlobalFilterOptions { + /** + * Enables/disables **global** filtering for all columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + enableGlobalFilter?: boolean; + /** + * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering. + * + * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcolumncanglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getColumnCanGlobalFilter?: (column: Column) => boolean; + /** + * The filter function to use for global filtering. + * - A `string` referencing a built-in filter function + * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option + * - A custom filter function + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#globalfilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + globalFilterFn?: FilterFnOption; + /** + * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#onglobalfilterchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + onGlobalFilterChange?: OnChangeFn; +} +export interface GlobalFilterInstance { + /** + * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalautofilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getGlobalAutoFilterFn: () => FilterFn | undefined; + /** + * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalfilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getGlobalFilterFn: () => FilterFn | undefined; + /** + * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#resetglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + resetGlobalFilter: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.globalFilter` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#setglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + setGlobalFilter: (updater: Updater) => void; +} +export declare const GlobalFiltering: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.js b/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.js new file mode 100644 index 00000000..56821586 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.js @@ -0,0 +1,63 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var filterFns = require('../filterFns.js'); +var utils = require('../utils.js'); + +// + +const GlobalFiltering = { + getInitialState: state => { + return { + globalFilter: undefined, + ...state + }; + }, + getDefaultOptions: table => { + return { + onGlobalFilterChange: utils.makeStateUpdater('globalFilter', table), + globalFilterFn: 'auto', + getColumnCanGlobalFilter: column => { + var _table$getCoreRowMode; + const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue(); + return typeof value === 'string' || typeof value === 'number'; + } + }; + }, + createColumn: (column, table) => { + column.getCanGlobalFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol; + return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn; + }; + }, + createTable: table => { + table.getGlobalAutoFilterFn = () => { + return filterFns.filterFns.includesString; + }; + table.getGlobalFilterFn = () => { + var _table$options$filter, _table$options$filter2; + const { + globalFilterFn: globalFilterFn + } = table.options; + return utils.isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns.filterFns[globalFilterFn]; + }; + table.setGlobalFilter = updater => { + table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater); + }; + table.resetGlobalFilter = defaultState => { + table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter); + }; + } +}; + +exports.GlobalFiltering = GlobalFiltering; +//# sourceMappingURL=GlobalFiltering.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.js.map b/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.js.map new file mode 100644 index 00000000..317c7d5f --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/GlobalFiltering.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GlobalFiltering.js","sources":["../../../src/features/GlobalFiltering.ts"],"sourcesContent":["import { FilterFn, FilterFnOption } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n OnChangeFn,\n Table,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport interface GlobalFilterTableState {\n globalFilter: any\n}\n\nexport interface GlobalFilterColumnDef {\n /**\n * Enables/disables the **global** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n}\n\nexport interface GlobalFilterColumn {\n /**\n * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getCanGlobalFilter: () => boolean\n}\n\nexport interface GlobalFilterOptions {\n /**\n * Enables/disables **global** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n /**\n * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering.\n *\n * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcolumncanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getColumnCanGlobalFilter?: (column: Column) => boolean\n /**\n * The filter function to use for global filtering.\n * - A `string` referencing a built-in filter function\n * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option\n * - A custom filter function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#globalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n globalFilterFn?: FilterFnOption\n /**\n * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#onglobalfilterchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n onGlobalFilterChange?: OnChangeFn\n}\n\nexport interface GlobalFilterInstance {\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalFilterFn: () => FilterFn | undefined\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const GlobalFiltering: TableFeature = {\n getInitialState: (state): GlobalFilterTableState => {\n return {\n globalFilter: undefined,\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GlobalFilterOptions => {\n return {\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n const value = table\n .getCoreRowModel()\n .flatRows[0]?._getAllCellsByColumnId()\n [column.id]?.getValue()\n\n return typeof value === 'string' || typeof value === 'number'\n },\n } as GlobalFilterOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getCanGlobalFilter = () => {\n return (\n (column.columnDef.enableGlobalFilter ?? true) &&\n (table.options.enableGlobalFilter ?? true) &&\n (table.options.enableFilters ?? true) &&\n (table.options.getColumnCanGlobalFilter?.(column) ?? true) &&\n !!column.accessorFn\n )\n }\n },\n\n createTable: (table: Table): void => {\n table.getGlobalAutoFilterFn = () => {\n return filterFns.includesString\n }\n\n table.getGlobalFilterFn = () => {\n const { globalFilterFn: globalFilterFn } = table.options\n\n return isFunction(globalFilterFn)\n ? globalFilterFn\n : globalFilterFn === 'auto'\n ? table.getGlobalAutoFilterFn()\n : table.options.filterFns?.[globalFilterFn as string] ??\n filterFns[globalFilterFn as BuiltInFilterFn]\n }\n\n table.setGlobalFilter = updater => {\n table.options.onGlobalFilterChange?.(updater)\n }\n\n table.resetGlobalFilter = defaultState => {\n table.setGlobalFilter(\n defaultState ? undefined : table.initialState.globalFilter\n )\n }\n },\n}\n"],"names":["GlobalFiltering","getInitialState","state","globalFilter","undefined","getDefaultOptions","table","onGlobalFilterChange","makeStateUpdater","globalFilterFn","getColumnCanGlobalFilter","column","_table$getCoreRowMode","value","getCoreRowModel","flatRows","_getAllCellsByColumnId","id","getValue","createColumn","getCanGlobalFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","_table$options$getCol","columnDef","enableGlobalFilter","options","enableFilters","accessorFn","createTable","getGlobalAutoFilterFn","filterFns","includesString","getGlobalFilterFn","_table$options$filter","_table$options$filter2","isFunction","setGlobalFilter","updater","resetGlobalFilter","defaultState","initialState"],"mappings":";;;;;;;;;;;;;;;AA6FA;;AAEO,MAAMA,eAA6B,GAAG;EAC3CC,eAAe,EAAGC,KAAK,IAA6B;IAClD,OAAO;AACLC,MAAAA,YAAY,EAAEC,SAAS;MACvB,GAAGF,KAAAA;KACJ,CAAA;GACF;EAEDG,iBAAiB,EACfC,KAAmB,IACY;IAC/B,OAAO;AACLC,MAAAA,oBAAoB,EAAEC,sBAAgB,CAAC,cAAc,EAAEF,KAAK,CAAC;AAC7DG,MAAAA,cAAc,EAAE,MAAM;MACtBC,wBAAwB,EAAEC,MAAM,IAAI;AAAA,QAAA,IAAAC,qBAAA,CAAA;AAClC,QAAA,MAAMC,KAAK,GAAA,CAAAD,qBAAA,GAAGN,KAAK,CAChBQ,eAAe,EAAE,CACjBC,QAAQ,CAAC,CAAC,CAAC,KAAAH,IAAAA,IAAAA,CAAAA,qBAAA,GAFAA,qBAAA,CAEEI,sBAAs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AACqB,OAAO,CAAA;AAExD,MAAA,OAAOU,gBAAU,CAAC5B,cAAc,CAAC,GAC7BA,cAAc,GACdA,cAAc,KAAK,MAAM,GACvBH,KAAK,CAACyB,qBAAqB,EAAE,GAAAI,CAAAA,qBAAA,GAAAC,CAAAA,sBAAA,GAC7B9B,KAAK,CAACqB,OAAO,CAACK,SAAS,KAAvBI,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAA,CAA0B3B,cAAc,CAAW,KAAA0B,IAAAA,GAAAA,qBAAA,GACnDH,mBAAS,CAACvB,cAAc,CAAoB,CAAA;KACnD,CAAA;AAEDH,IAAAA,KAAK,CAACgC,eAAe,GAAGC,OAAO,IAAI;AACjCjC,MAAAA,KAAK,CAACqB,OAAO,CAACpB,oBAAoB,IAAlCD,IAAAA,IAAAA,KAAK,CAACqB,OAAO,CAACpB,oBAAoB,CAAGgC,OAAO,CAAC,CAAA;KAC9C,CAAA;AAEDjC,IAAAA,KAAK,CAACkC,iBAAiB,GAAGC,YAAY,IAAI;AACxCnC,MAAAA,KAAK,CAACgC,eAAe,CACnBG,YAAY,GAAGrC,SAAS,GAAGE,KAAK,CAACoC,YAAY,CAACvC,YAChD,CAAC,CAAA;KACF,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.d.ts b/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.d.ts new file mode 100644 index 00000000..2fd3b656 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.d.ts @@ -0,0 +1,154 @@ +import { RowModel } from '..'; +import { OnChangeFn, Table, Row, Updater, RowData, TableFeature } from '../types'; +export type ExpandedStateList = Record; +export type ExpandedState = true | Record; +export interface ExpandedTableState { + expanded: ExpandedState; +} +export interface ExpandedRow { + /** + * Returns whether the row can be expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcanexpand) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getCanExpand: () => boolean; + /** + * Returns whether all parent rows of the row are expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallparentsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsAllParentsExpanded: () => boolean; + /** + * Returns whether the row is expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsExpanded: () => boolean; + /** + * Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleexpandedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getToggleExpandedHandler: () => () => void; + /** + * Toggles the expanded state (or sets it if `expanded` is provided) for the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + toggleExpanded: (expanded?: boolean) => void; +} +export interface ExpandedOptions { + /** + * Enable this setting to automatically reset the expanded state of the table when expanding state changes. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#autoresetexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + autoResetExpanded?: boolean; + /** + * Enable/disable expanding for all rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#enableexpanding) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + enableExpanding?: boolean; + /** + * This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported `getExpandedRowModel` function to get the expanded row model or implement your own. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getExpandedRowModel?: (table: Table) => () => RowModel; + /** + * If provided, allows you to override the default behavior of determining whether a row is currently expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisrowexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsRowExpanded?: (row: Row) => boolean; + /** + * If provided, allows you to override the default behavior of determining whether a row can be expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getrowcanexpand) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getRowCanExpand?: (row: Row) => boolean; + /** + * Enables manual row expansion. If this is set to `true`, `getExpandedRowModel` will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#manualexpanding) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + manualExpanding?: boolean; + /** + * This function is called when the `expanded` table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the `tableOptions.state.expanded` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#onexpandedchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + onExpandedChange?: OnChangeFn; + /** + * If `true` expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages). If `false` expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#paginateexpandedrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + paginateExpandedRows?: boolean; +} +export interface ExpandedInstance { + _autoResetExpanded: () => void; + _getExpandedRowModel?: () => RowModel; + /** + * Returns whether there are any rows that can be expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcansomerowsexpand) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getCanSomeRowsExpand: () => boolean; + /** + * Returns the maximum depth of the expanded rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandeddepth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getExpandedDepth: () => number; + /** + * Returns the row model after expansion has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getExpandedRowModel: () => RowModel; + /** + * Returns whether all rows are currently expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallrowsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsAllRowsExpanded: () => boolean; + /** + * Returns whether there are any rows that are currently expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getissomerowsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsSomeRowsExpanded: () => boolean; + /** + * Returns the row model before expansion has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getpreexpandedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getPreExpandedRowModel: () => RowModel; + /** + * Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an `input[type=checkbox]` element. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleallrowsexpandedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getToggleAllRowsExpandedHandler: () => (event: unknown) => void; + /** + * Resets the expanded state of the table to the initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#resetexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + resetExpanded: (defaultState?: boolean) => void; + /** + * Updates the expanded state of the table via an update function or value. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#setexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + setExpanded: (updater: Updater) => void; + /** + * Toggles the expanded state for all rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleallrowsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + toggleAllRowsExpanded: (expanded?: boolean) => void; +} +export declare const RowExpanding: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.js b/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.js new file mode 100644 index 00000000..84d44475 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.js @@ -0,0 +1,173 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +// + +const RowExpanding = { + getInitialState: state => { + return { + expanded: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onExpandedChange: utils.makeStateUpdater('expanded', table), + paginateExpandedRows: true + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetExpanded = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetExpanded(); + queued = false; + }); + } + }; + table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater); + table.toggleAllRowsExpanded = expanded => { + if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { + table.setExpanded(true); + } else { + table.setExpanded({}); + } + }; + table.resetExpanded = defaultState => { + var _table$initialState$e, _table$initialState; + table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); + }; + table.getCanSomeRowsExpand = () => { + return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand()); + }; + table.getToggleAllRowsExpandedHandler = () => { + return e => { + e.persist == null || e.persist(); + table.toggleAllRowsExpanded(); + }; + }; + table.getIsSomeRowsExpanded = () => { + const expanded = table.getState().expanded; + return expanded === true || Object.values(expanded).some(Boolean); + }; + table.getIsAllRowsExpanded = () => { + const expanded = table.getState().expanded; + + // If expanded is true, save some cycles and return true + if (typeof expanded === 'boolean') { + return expanded === true; + } + if (!Object.keys(expanded).length) { + return false; + } + + // If any row is not expanded, return false + if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) { + return false; + } + + // They must all be expanded :shrug: + return true; + }; + table.getExpandedDepth = () => { + let maxDepth = 0; + const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); + rowIds.forEach(id => { + const splitId = id.split('.'); + maxDepth = Math.max(maxDepth, splitId.length); + }); + return maxDepth; + }; + table.getPreExpandedRowModel = () => table.getSortedRowModel(); + table.getExpandedRowModel = () => { + if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { + table._getExpandedRowModel = table.options.getExpandedRowModel(table); + } + if (table.options.manualExpanding || !table._getExpandedRowModel) { + return table.getPreExpandedRowModel(); + } + return table._getExpandedRowModel(); + }; + }, + createRow: (row, table) => { + row.toggleExpanded = expanded => { + table.setExpanded(old => { + var _expanded; + const exists = old === true ? true : !!(old != null && old[row.id]); + let oldExpanded = {}; + if (old === true) { + Object.keys(table.getRowModel().rowsById).forEach(rowId => { + oldExpanded[rowId] = true; + }); + } else { + oldExpanded = old; + } + expanded = (_expanded = expanded) != null ? _expanded : !exists; + if (!exists && expanded) { + return { + ...oldExpanded, + [row.id]: true + }; + } + if (exists && !expanded) { + const { + [row.id]: _, + ...rest + } = oldExpanded; + return rest; + } + return old; + }); + }; + row.getIsExpanded = () => { + var _table$options$getIsR; + const expanded = table.getState().expanded; + return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id])); + }; + row.getCanExpand = () => { + var _table$options$getRow, _table$options$enable, _row$subRows; + return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + row.getIsAllParentsExpanded = () => { + let isFullyExpanded = true; + let currentRow = row; + while (isFullyExpanded && currentRow.parentId) { + currentRow = table.getRow(currentRow.parentId, true); + isFullyExpanded = currentRow.getIsExpanded(); + } + return isFullyExpanded; + }; + row.getToggleExpandedHandler = () => { + const canExpand = row.getCanExpand(); + return () => { + if (!canExpand) return; + row.toggleExpanded(); + }; + }; + } +}; + +exports.RowExpanding = RowExpanding; +//# sourceMappingURL=RowExpanding.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.js.map b/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.js.map new file mode 100644 index 00000000..f1645c0b --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowExpanding.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RowExpanding.js","sources":["../../../src/features/RowExpanding.ts"],"sourcesContent":["import { RowModel } from '..'\nimport {\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { makeStateUpdater } from '../utils'\n\nexport type ExpandedStateList = Record\nexport type ExpandedState = true | Record\nexport interface ExpandedTableState {\n expanded: ExpandedState\n}\n\nexport interface ExpandedRow {\n /**\n * Returns whether the row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanExpand: () => boolean\n /**\n * Returns whether all parent rows of the row are expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallparentsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllParentsExpanded: () => boolean\n /**\n * Returns whether the row is expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsExpanded: () => boolean\n /**\n * Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleExpandedHandler: () => () => void\n /**\n * Toggles the expanded state (or sets it if `expanded` is provided) for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleExpanded: (expanded?: boolean) => void\n}\n\nexport interface ExpandedOptions {\n /**\n * Enable this setting to automatically reset the expanded state of the table when expanding state changes.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#autoresetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n autoResetExpanded?: boolean\n /**\n * Enable/disable expanding for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#enableexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n enableExpanding?: boolean\n /**\n * This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported `getExpandedRowModel` function to get the expanded row model or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel?: (table: Table) => () => RowModel\n /**\n * If provided, allows you to override the default behavior of determining whether a row is currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisrowexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsRowExpanded?: (row: Row) => boolean\n /**\n * If provided, allows you to override the default behavior of determining whether a row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getrowcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getRowCanExpand?: (row: Row) => boolean\n /**\n * Enables manual row expansion. If this is set to `true`, `getExpandedRowModel` will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#manualexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n manualExpanding?: boolean\n /**\n * This function is called when the `expanded` table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the `tableOptions.state.expanded` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#onexpandedchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n onExpandedChange?: OnChangeFn\n /**\n * If `true` expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages). If `false` expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#paginateexpandedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n paginateExpandedRows?: boolean\n}\n\nexport interface ExpandedInstance {\n _autoResetExpanded: () => void\n _getExpandedRowModel?: () => RowModel\n /**\n * Returns whether there are any rows that can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcansomerowsexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanSomeRowsExpand: () => boolean\n /**\n * Returns the maximum depth of the expanded rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandeddepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedDepth: () => number\n /**\n * Returns the row model after expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel: () => RowModel\n /**\n * Returns whether all rows are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllRowsExpanded: () => boolean\n /**\n * Returns whether there are any rows that are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getissomerowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsSomeRowsExpanded: () => boolean\n /**\n * Returns the row model before expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getpreexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getPreExpandedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleallrowsexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleAllRowsExpandedHandler: () => (event: unknown) => void\n /**\n * Resets the expanded state of the table to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#resetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n resetExpanded: (defaultState?: boolean) => void\n /**\n * Updates the expanded state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#setexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n setExpanded: (updater: Updater) => void\n /**\n * Toggles the expanded state for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleAllRowsExpanded: (expanded?: boolean) => void\n}\n\n//\n\nexport const RowExpanding: TableFeature = {\n getInitialState: (state): ExpandedTableState => {\n return {\n expanded: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ExpandedOptions => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true,\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetExpanded = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetExpanded ??\n !table.options.manualExpanding\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetExpanded()\n queued = false\n })\n }\n }\n table.setExpanded = updater => table.options.onExpandedChange?.(updater)\n table.toggleAllRowsExpanded = expanded => {\n if (expanded ?? !table.getIsAllRowsExpanded()) {\n table.setExpanded(true)\n } else {\n table.setExpanded({})\n }\n }\n table.resetExpanded = defaultState => {\n table.setExpanded(defaultState ? {} : table.initialState?.expanded ?? {})\n }\n table.getCanSomeRowsExpand = () => {\n return table\n .getPrePaginationRowModel()\n .flatRows.some(row => row.getCanExpand())\n }\n table.getToggleAllRowsExpandedHandler = () => {\n return (e: unknown) => {\n ;(e as any).persist?.()\n table.toggleAllRowsExpanded()\n }\n }\n table.getIsSomeRowsExpanded = () => {\n const expanded = table.getState().expanded\n return expanded === true || Object.values(expanded).some(Boolean)\n }\n table.getIsAllRowsExpanded = () => {\n const expanded = table.getState().expanded\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true\n }\n\n if (!Object.keys(expanded).length) {\n return false\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false\n }\n\n // They must all be expanded :shrug:\n return true\n }\n table.getExpandedDepth = () => {\n let maxDepth = 0\n\n const rowIds =\n table.getState().expanded === true\n ? Object.keys(table.getRowModel().rowsById)\n : Object.keys(table.getState().expanded)\n\n rowIds.forEach(id => {\n const splitId = id.split('.')\n maxDepth = Math.max(maxDepth, splitId.length)\n })\n\n return maxDepth\n }\n table.getPreExpandedRowModel = () => table.getSortedRowModel()\n table.getExpandedRowModel = () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table)\n }\n\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._getExpandedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleExpanded = expanded => {\n table.setExpanded(old => {\n const exists = old === true ? true : !!old?.[row.id]\n\n let oldExpanded: ExpandedStateList = {}\n\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true\n })\n } else {\n oldExpanded = old\n }\n\n expanded = expanded ?? !exists\n\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true,\n }\n }\n\n if (exists && !expanded) {\n const { [row.id]: _, ...rest } = oldExpanded\n return rest\n }\n\n return old\n })\n }\n row.getIsExpanded = () => {\n const expanded = table.getState().expanded\n\n return !!(\n table.options.getIsRowExpanded?.(row) ??\n (expanded === true || expanded?.[row.id])\n )\n }\n row.getCanExpand = () => {\n return (\n table.options.getRowCanExpand?.(row) ??\n ((table.options.enableExpanding ?? true) && !!row.subRows?.length)\n )\n }\n row.getIsAllParentsExpanded = () => {\n let isFullyExpanded = true\n let currentRow = row\n\n while (isFullyExpanded && currentRow.parentId) {\n currentRow = table.getRow(currentRow.parentId, true)\n isFullyExpanded = currentRow.getIsExpanded()\n }\n\n return isFullyExpanded\n }\n row.getToggleExpandedHandler = () => {\n const canExpand = row.getCanExpand()\n\n return () => {\n if (!canExpand) return\n row.toggleExpanded()\n }\n }\n },\n}\n"],"names":["RowExpanding","getInitialState","state","expanded","getDefaultOptions","table","onExpandedChange","makeStateUpdater","paginateExpandedRows","createTable","registered","queued","_autoResetExpanded","_ref","_table$options$autoRe","_queue","options","autoResetAll","autoResetExpanded","manualExpanding","resetExpanded","setExpanded","updater","toggleAllRowsExpanded","getIsAllRowsExpanded","defaultState","_table$initialState$e","_table$initialState","initialState","getCanSomeRowsExpand","getPrePaginationRowModel","flatRows","some","row","getCanExpand","getToggleAllRowsExpandedHandler","e","persist","getIsSomeRowsExpanded","getState","Object","values","Boolean","keys","length","getRowModel","getIsExpanded","getExpandedDepth","maxDepth","rowIds","rowsById","forEach","id","splitId","split","Math","max","getPreExpandedRowModel","getSortedRowModel","getExpandedRowModel","_getExpandedRowModel","createRow","toggleExpanded","old","_expanded","exists","oldExpanded","rowId","_","rest","_table$options$getIsR","getIsRowExpanded","_table$options$getRow","_table$options$enable","_row$subRows","getRowCanExpand","enableExpanding","subRows","getIsAllParentsExpanded","isFullyExpanded","currentRow","parentId","getRow","getToggleExpandedHandler","canExpand"],"mappings":";;;;;;;;;;;;;;AAsKA;;AAEO,MAAMA,YAA0B,GAAG;EACxCC,eAAe,EAAGC,KAAK,IAAyB;IAC9C,OAAO;MACLC,QAAQ,EAAE,EAAE;MACZ,GAAGD,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACQ;IAC3B,OAAO;AACLC,MAAAA,gBAAgB,EAAEC,sBAAgB,CAAC,UAAU,EAAEF,KAAK,CAAC;AACrDG,MAAAA,oBAAoB,EAAE,IAAA;KACvB,CAAA;GACF;EAEDC,WAAW,EAA0BJ,KAAmB,IAAW;IACjE,IAAIK,UAAU,GAAG,KAAK,CAAA;IACtB,IAAIC,MAAM,GAAG,KAAK,CAAA;IAElBN,KAAK,CAACO,kBAAkB,GAAG,MAAM;MAAA,IAAAC,IAAA,EAAAC,qBAAA,CAAA;MAC/B,IAAI,CAACJ,UAAU,EAAE;QACfL,KAAK,CAACU,MAAM,CAAC,MAAM;AACjBL,UAAAA,UAAU,GAAG,IAAI,CAAA;AACnB,SAAC,CAAC,CAAA;AACF,QAAA,OAAA;AACF,OAAA;MAEA,IAAAG,CAAAA,IAAA,GAAAC,CAAAA,qBAAA,GACET,KAAK,CAACW,OAAO,CAACC,YAAY,KAAAH,IAAAA,GAAAA,qBAAA,GAC1BT,KAAK,CAACW,OAAO,CAACE,iBAAiB,KAAA,IAAA,GAAAL,IAAA,GAC/B,CAACR,KAAK,CAACW,OAAO,CAAC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ACkD,wBAAwB,GAAG,MAAM;AACnC,MAAA,MAAMC,SAAS,GAAGnD,GAAG,CAACC,YAAY,EAAE,CAAA;AAEpC,MAAA,OAAO,MAAM;QACX,IAAI,CAACkD,SAAS,EAAE,OAAA;QAChBnD,GAAG,CAAC6B,cAAc,EAAE,CAAA;OACrB,CAAA;KACF,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowPagination.d.ts b/node_modules/@tanstack/table-core/build/lib/features/RowPagination.d.ts new file mode 100644 index 00000000..c3d076c3 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowPagination.d.ts @@ -0,0 +1,165 @@ +import { OnChangeFn, Table, RowModel, Updater, RowData, TableFeature } from '../types'; +export interface PaginationState { + pageIndex: number; + pageSize: number; +} +export interface PaginationTableState { + pagination: PaginationState; +} +export interface PaginationInitialTableState { + pagination?: Partial; +} +export interface PaginationOptions { + /** + * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + autoResetPageIndex?: boolean; + /** + * Returns the row model after pagination has taken place, but no further. + * + * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPaginationRowModel?: (table: Table) => () => RowModel; + /** + * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + manualPagination?: boolean; + /** + * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + onPaginationChange?: OnChangeFn; + /** + * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + pageCount?: number; + /** + * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + rowCount?: number; +} +export interface PaginationDefaultOptions { + onPaginationChange: OnChangeFn; +} +export interface PaginationInstance { + _autoResetPageIndex: () => void; + _getPaginationRowModel?: () => RowModel; + /** + * Returns whether the table can go to the next page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getCanNextPage: () => boolean; + /** + * Returns whether the table can go to the previous page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getCanPreviousPage: () => boolean; + /** + * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPageCount: () => number; + /** + * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getRowCount: () => number; + /** + * Returns an array of page options (zero-index-based) for the current page size. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPageOptions: () => number[]; + /** + * Returns the row model for the table after pagination has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPaginationRowModel: () => RowModel; + /** + * Returns the row model for the table before any pagination has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPrePaginationRowModel: () => RowModel; + /** + * Increments the page index by one, if possible. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + nextPage: () => void; + /** + * Decrements the page index by one, if possible. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + previousPage: () => void; + /** + * Sets the page index to `0`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + firstPage: () => void; + /** + * Sets the page index to the last page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + lastPage: () => void; + /** + * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + resetPageIndex: (defaultState?: boolean) => void; + /** + * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + resetPageSize: (defaultState?: boolean) => void; + /** + * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + resetPagination: (defaultState?: boolean) => void; + /** + * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead. + */ + setPageCount: (updater: Updater) => void; + /** + * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + setPageIndex: (updater: Updater) => void; + /** + * Updates the page size using the provided function or value in the `state.pagination.pageSize` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + setPageSize: (updater: Updater) => void; + /** + * Sets or updates the `state.pagination` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + setPagination: (updater: Updater) => void; +} +export declare const RowPagination: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowPagination.js b/node_modules/@tanstack/table-core/build/lib/features/RowPagination.js new file mode 100644 index 00000000..7004c11f --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowPagination.js @@ -0,0 +1,169 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +// + +const defaultPageIndex = 0; +const defaultPageSize = 10; +const getDefaultPaginationState = () => ({ + pageIndex: defaultPageIndex, + pageSize: defaultPageSize +}); +const RowPagination = { + getInitialState: state => { + return { + ...state, + pagination: { + ...getDefaultPaginationState(), + ...(state == null ? void 0 : state.pagination) + } + }; + }, + getDefaultOptions: table => { + return { + onPaginationChange: utils.makeStateUpdater('pagination', table) + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetPageIndex = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetPageIndex(); + queued = false; + }); + } + }; + table.setPagination = updater => { + const safeUpdater = old => { + let newState = utils.functionalUpdate(updater, old); + return newState; + }; + return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); + }; + table.resetPagination = defaultState => { + var _table$initialState$p; + table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); + }; + table.setPageIndex = updater => { + table.setPagination(old => { + let pageIndex = utils.functionalUpdate(updater, old.pageIndex); + const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1; + pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex)); + return { + ...old, + pageIndex + }; + }); + }; + table.resetPageIndex = defaultState => { + var _table$initialState$p2, _table$initialState; + table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); + }; + table.resetPageSize = defaultState => { + var _table$initialState$p3, _table$initialState2; + table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize); + }; + table.setPageSize = updater => { + table.setPagination(old => { + const pageSize = Math.max(1, utils.functionalUpdate(updater, old.pageSize)); + const topRowIndex = old.pageSize * old.pageIndex; + const pageIndex = Math.floor(topRowIndex / pageSize); + return { + ...old, + pageIndex, + pageSize + }; + }); + }; + //deprecated + table.setPageCount = updater => table.setPagination(old => { + var _table$options$pageCo; + let newPageCount = utils.functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); + if (typeof newPageCount === 'number') { + newPageCount = Math.max(-1, newPageCount); + } + return { + ...old, + pageCount: newPageCount + }; + }); + table.getPageOptions = utils.memo(() => [table.getPageCount()], pageCount => { + let pageOptions = []; + if (pageCount && pageCount > 0) { + pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i); + } + return pageOptions; + }, utils.getMemoOptions(table.options, 'debugTable', 'getPageOptions')); + table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0; + table.getCanNextPage = () => { + const { + pageIndex + } = table.getState().pagination; + const pageCount = table.getPageCount(); + if (pageCount === -1) { + return true; + } + if (pageCount === 0) { + return false; + } + return pageIndex < pageCount - 1; + }; + table.previousPage = () => { + return table.setPageIndex(old => old - 1); + }; + table.nextPage = () => { + return table.setPageIndex(old => { + return old + 1; + }); + }; + table.firstPage = () => { + return table.setPageIndex(0); + }; + table.lastPage = () => { + return table.setPageIndex(table.getPageCount() - 1); + }; + table.getPrePaginationRowModel = () => table.getExpandedRowModel(); + table.getPaginationRowModel = () => { + if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { + table._getPaginationRowModel = table.options.getPaginationRowModel(table); + } + if (table.options.manualPagination || !table._getPaginationRowModel) { + return table.getPrePaginationRowModel(); + } + return table._getPaginationRowModel(); + }; + table.getPageCount = () => { + var _table$options$pageCo2; + return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize); + }; + table.getRowCount = () => { + var _table$options$rowCou; + return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length; + }; + } +}; + +exports.RowPagination = RowPagination; +//# sourceMappingURL=RowPagination.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowPagination.js.map b/node_modules/@tanstack/table-core/build/lib/features/RowPagination.js.map new file mode 100644 index 00000000..06183e07 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowPagination.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RowPagination.js","sources":["../../../src/features/RowPagination.ts"],"sourcesContent":["import {\n OnChangeFn,\n Table,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport {\n functionalUpdate,\n getMemoOptions,\n makeStateUpdater,\n memo,\n} from '../utils'\n\nexport interface PaginationState {\n pageIndex: number\n pageSize: number\n}\n\nexport interface PaginationTableState {\n pagination: PaginationState\n}\n\nexport interface PaginationInitialTableState {\n pagination?: Partial\n}\n\nexport interface PaginationOptions {\n /**\n * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n autoResetPageIndex?: boolean\n /**\n * Returns the row model after pagination has taken place, but no further.\n *\n * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel?: (table: Table) => () => RowModel\n /**\n * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n manualPagination?: boolean\n /**\n * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n onPaginationChange?: OnChangeFn\n /**\n * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n pageCount?: number\n /**\n * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n rowCount?: number\n}\n\nexport interface PaginationDefaultOptions {\n onPaginationChange: OnChangeFn\n}\n\nexport interface PaginationInstance {\n _autoResetPageIndex: () => void\n _getPaginationRowModel?: () => RowModel\n /**\n * Returns whether the table can go to the next page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanNextPage: () => boolean\n /**\n * Returns whether the table can go to the previous page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanPreviousPage: () => boolean\n /**\n * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageCount: () => number\n /**\n * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getRowCount: () => number\n /**\n * Returns an array of page options (zero-index-based) for the current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageOptions: () => number[]\n /**\n * Returns the row model for the table after pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel: () => RowModel\n /**\n * Returns the row model for the table before any pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPrePaginationRowModel: () => RowModel\n /**\n * Increments the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n nextPage: () => void\n /**\n * Decrements the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n previousPage: () => void\n /**\n * Sets the page index to `0`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n firstPage: () => void\n /**\n * Sets the page index to the last page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n lastPage: () => void\n /**\n * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageIndex: (defaultState?: boolean) => void\n /**\n * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageSize: (defaultState?: boolean) => void\n /**\n * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPagination: (defaultState?: boolean) => void\n /**\n * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead.\n */\n setPageCount: (updater: Updater) => void\n /**\n * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageIndex: (updater: Updater) => void\n /**\n * Updates the page size using the provided function or value in the `state.pagination.pageSize` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageSize: (updater: Updater) => void\n /**\n * Sets or updates the `state.pagination` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPagination: (updater: Updater) => void\n}\n\n//\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\nconst getDefaultPaginationState = (): PaginationState => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n})\n\nexport const RowPagination: TableFeature = {\n getInitialState: (state): PaginationTableState => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...state?.pagination,\n },\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): PaginationDefaultOptions => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table),\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetPageIndex = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetPageIndex()\n queued = false\n })\n }\n }\n table.setPagination = updater => {\n const safeUpdater: Updater = old => {\n let newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n }\n table.resetPagination = defaultState => {\n table.setPagination(\n defaultState\n ? getDefaultPaginationState()\n : table.initialState.pagination ?? getDefaultPaginationState()\n )\n }\n table.setPageIndex = updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n }\n table.resetPageIndex = defaultState => {\n table.setPageIndex(\n defaultState\n ? defaultPageIndex\n : table.initialState?.pagination?.pageIndex ?? defaultPageIndex\n )\n }\n table.resetPageSize = defaultState => {\n table.setPageSize(\n defaultState\n ? defaultPageSize\n : table.initialState?.pagination?.pageSize ?? defaultPageSize\n )\n }\n table.setPageSize = updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex!\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n }\n //deprecated\n table.setPageCount = updater =>\n table.setPagination(old => {\n let newPageCount = functionalUpdate(\n updater,\n table.options.pageCount ?? -1\n )\n\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount)\n }\n\n return {\n ...old,\n pageCount: newPageCount,\n }\n })\n\n table.getPageOptions = memo(\n () => [table.getPageCount()],\n pageCount => {\n let pageOptions: number[] = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n },\n getMemoOptions(table.options, 'debugTable', 'getPageOptions')\n )\n\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0\n\n table.getCanNextPage = () => {\n const { pageIndex } = table.getState().pagination\n\n const pageCount = table.getPageCount()\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n }\n\n table.previousPage = () => {\n return table.setPageIndex(old => old - 1)\n }\n\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1\n })\n }\n\n table.firstPage = () => {\n return table.setPageIndex(0)\n }\n\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1)\n }\n\n table.getPrePaginationRowModel = () => table.getExpandedRowModel()\n table.getPaginationRowModel = () => {\n if (\n !table._getPaginationRowModel &&\n table.options.getPaginationRowModel\n ) {\n table._getPaginationRowModel =\n table.options.getPaginationRowModel(table)\n }\n\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel()\n }\n\n return table._getPaginationRowModel()\n }\n\n table.getPageCount = () => {\n return (\n table.options.pageCount ??\n Math.ceil(table.getRowCount() / table.getState().pagination.pageSize)\n )\n }\n\n table.getRowCount = () => {\n return (\n table.options.rowCount ?? table.getPrePaginationRowModel().rows.length\n )\n }\n },\n}\n"],"names":["defaultPageIndex","defaultPageSize","getDefaultPaginationState","pageIndex","pageSize","RowPagination","getInitialState","state","pagination","getDefaultOptions","table","onPaginationChange","makeStateUpdater","createTable","registered","queued","_autoResetPageIndex","_ref","_table$options$autoRe","_queue","options","autoResetAll","autoResetPageIndex","manualPagination","resetPageIndex","setPagination","updater","safeUpdater","old","newState","functionalUpdate","resetPagination","defaultState","_table$initialState$p","initialState","setPageIndex","maxPageIndex","pageCount","Number","MAX_SAFE_INTEGER","Math","max","min","_table$initialState$p2","_table$initialState","resetPageSize","_table$initialState$p3","_table$initialState2","setPageSize","topRowIndex","floor","setPageCount","_table$options$pageCo","newPageCount","getPageOptions","memo","getPageCount","pageOptions","Array","fill","map","_","i","getMemoOptions","getCanPreviousPage","getState","getCanNextPage","previousPage","nextPage","firstPage","lastPage","getPrePaginationRowModel","getExpandedRowModel","getPaginationRowModel","_getPaginationRowModel","_table$options$pageCo2","ceil","getRowCount","_table$options$rowCou","rowCount","rows","length"],"mappings":";;;;;;;;;;;;;;AAwLA;;AAEA,MAAMA,gBAAgB,GAAG,CAAC,CAAA;AAC1B,MAAMC,eAAe,GAAG,EAAE,CAAA;AAE1B,MAAMC,yBAAyB,GAAGA,OAAwB;AACxDC,EAAAA,SAAS,EAAEH,gBAAgB;AAC3BI,EAAAA,QAAQ,EAAEH,eAAAA;AACZ,CAAC,CAAC,CAAA;AAEK,MAAMI,aAA2B,GAAG;EACzCC,eAAe,EAAGC,KAAK,IAA2B;IAChD,OAAO;AACL,MAAA,GAAGA,KAAK;AACRC,MAAAA,UAAU,EAAE;QACV,GAAGN,yBAAyB,EAAE;AAC9B,QAAA,IAAGK,KAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEC,UAAU;AACtB,OAAA;KACD,CAAA;GACF;EAEDC,iBAAiB,EACfC,KAAmB,IACU;IAC7B,OAAO;AACLC,MAAAA,kBAAkB,EAAEC,sBAAgB,CAAC,YAAY,EAAEF,KAAK,CAAA;KACzD,CAAA;GACF;EAEDG,WAAW,EAA0BH,KAAmB,IAAW;IACjE,IAAII,UAAU,GAAG,KAAK,CAAA;IACtB,IAAIC,MAAM,GAAG,KAAK,CAAA;IAElBL,KAAK,CAACM,mBAAmB,GAAG,MAAM;MAAA,IAAAC,IAAA,EAAAC,qBAAA,CAAA;MAChC,IAAI,CAACJ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B,MAAA,OAAA,CAAAA,sBAAA,GACEjE,KAAK,CAACU,OAAO,CAACiB,SAAS,KAAA,IAAA,GAAAsC,sBAAA,GACvBnC,IAAI,CAACoC,IAAI,CAAClE,KAAK,CAACmE,WAAW,EAAE,GAAGnE,KAAK,CAACuD,QAAQ,EAAE,CAACzD,UAAU,CAACJ,QAAQ,CAAC,CAAA;KAExE,CAAA;IAEDM,KAAK,CAACmE,WAAW,GAAG,MAAM;AAAA,MAAA,IAAAC,qBAAA,CAAA;AACxB,MAAA,OAAA,CAAAA,qBAAA,GACEpE,KAAK,CAACU,OAAO,CAAC2D,QAAQ,KAAAD,IAAAA,GAAAA,qBAAA,GAAIpE,KAAK,CAAC6D,wBAAwB,EAAE,CAACS,IAAI,CAACC,MAAM,CAAA;KAEzE,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowPinning.d.ts b/node_modules/@tanstack/table-core/build/lib/features/RowPinning.d.ts new file mode 100644 index 00000000..0f61ff37 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowPinning.d.ts @@ -0,0 +1,98 @@ +import { OnChangeFn, Updater, Row, RowData, TableFeature } from '../types'; +export type RowPinningPosition = false | 'top' | 'bottom'; +export interface RowPinningState { + bottom?: string[]; + top?: string[]; +} +export interface RowPinningTableState { + rowPinning: RowPinningState; +} +export interface RowPinningOptions { + /** + * Enables/disables row pinning for the table. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + enableRowPinning?: boolean | ((row: Row) => boolean); + /** + * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + keepPinnedRows?: boolean; + /** + * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange) + */ + onRowPinningChange?: OnChangeFn; +} +export interface RowPinningDefaultOptions { + onRowPinningChange: OnChangeFn; +} +export interface RowPinningRow { + /** + * Returns whether or not the row can be pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getCanPin: () => boolean; + /** + * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getIsPinned: () => RowPinningPosition; + /** + * Returns the numeric pinned index of the row within a pinned row group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getPinnedIndex: () => number; + /** + * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + pin: (position: RowPinningPosition, includeLeafRows?: boolean, includeParentRows?: boolean) => void; +} +export interface RowPinningInstance { + _getPinnedRows: (visiblePinnedRows: Array>, pinnedRowIds: Array | undefined, position: 'top' | 'bottom') => Row[]; + /** + * Returns all bottom pinned rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getBottomRows: () => Row[]; + /** + * Returns all rows that are not pinned to the top or bottom. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getCenterRows: () => Row[]; + /** + * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean; + /** + * Returns all top pinned rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getTopRows: () => Row[]; + /** + * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + resetRowPinning: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.rowPinning` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + setRowPinning: (updater: Updater) => void; +} +export declare const RowPinning: TableFeature; diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowPinning.js b/node_modules/@tanstack/table-core/build/lib/features/RowPinning.js new file mode 100644 index 00000000..2597a31a --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowPinning.js @@ -0,0 +1,145 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +// + +const getDefaultRowPinningState = () => ({ + top: [], + bottom: [] +}); +const RowPinning = { + getInitialState: state => { + return { + rowPinning: getDefaultRowPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowPinningChange: utils.makeStateUpdater('rowPinning', table) + }; + }, + createRow: (row, table) => { + row.pin = (position, includeLeafRows, includeParentRows) => { + const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => { + let { + id + } = _ref; + return id; + }) : []; + const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => { + let { + id + } = _ref2; + return id; + }) : []; + const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]); + table.setRowPinning(old => { + var _old$top3, _old$bottom3; + if (position === 'bottom') { + var _old$top, _old$bottom; + return { + top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)] + }; + } + if (position === 'top') { + var _old$top2, _old$bottom2; + return { + top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)], + bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + } + return { + top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + }); + }; + row.getCanPin = () => { + var _ref3; + const { + enableRowPinning, + enablePinning + } = table.options; + if (typeof enableRowPinning === 'function') { + return enableRowPinning(row); + } + return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true; + }; + row.getIsPinned = () => { + const rowIds = [row.id]; + const { + top, + bottom + } = table.getState().rowPinning; + const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d)); + const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d)); + return isTop ? 'top' : isBottom ? 'bottom' : false; + }; + row.getPinnedIndex = () => { + var _ref4, _visiblePinnedRowIds$; + const position = row.getIsPinned(); + if (!position) return -1; + const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => { + let { + id + } = _ref5; + return id; + }); + return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1; + }; + }, + createTable: table => { + table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater); + table.resetRowPinning = defaultState => { + var _table$initialState$r, _table$initialState; + return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState()); + }; + table.getIsSomeRowsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().rowPinning; + if (!position) { + var _pinningState$top, _pinningState$bottom; + return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table._getPinnedRows = (visibleRows, pinnedRowIds, position) => { + var _table$options$keepPi; + const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? + //get all rows that are pinned even if they would not be otherwise visible + //account for expanded parent rows, but not pagination or filtering + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => { + const row = table.getRow(rowId, true); + return row.getIsAllParentsExpanded() ? row : null; + }) : + //else get only visible rows that are pinned + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId)); + return rows.filter(Boolean).map(d => ({ + ...d, + position + })); + }; + table.getTopRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), utils.getMemoOptions(table.options, 'debugRows', 'getTopRows')); + table.getBottomRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), utils.getMemoOptions(table.options, 'debugRows', 'getBottomRows')); + table.getCenterRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => { + const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]); + return allRows.filter(d => !topAndBottom.has(d.id)); + }, utils.getMemoOptions(table.options, 'debugRows', 'getCenterRows')); + } +}; + +exports.RowPinning = RowPinning; +//# sourceMappingURL=RowPinning.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowPinning.js.map b/node_modules/@tanstack/table-core/build/lib/features/RowPinning.js.map new file mode 100644 index 00000000..9ae66b2e --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowPinning.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RowPinning.js","sources":["../../../src/features/RowPinning.ts"],"sourcesContent":["import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance {\n _getPinnedRows: (\n visiblePinnedRows: Array>,\n pinnedRowIds: Array | undefined,\n position: 'top' | 'bottom'\n ) => Row[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top' ? table.getTopRows() : table.getBottomRows()\n )?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows.filter(Boolean).map(d => ({ ...d, position })) as Row[]\n }\n\n table.getTopRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.top],\n (allRows, topPinnedRowIds) =>\n table._getPinnedRows(allRows, topPinnedRowIds, 'top'),\n getMemoOptions(table.options, 'debugRows', 'getTopRows')\n )\n\n table.getBottomRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.bottom],\n (allRows, bottomPinnedRowIds) =>\n table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'),\n getMemoOptions(table.options, 'debugRows', 'getBottomRows')\n )\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n"],"names":["getDefaultRowPinningState","top","bottom","RowPinning","getInitialState","state","rowPinning","getDefaultOptions","table","onRowPinningChange","makeStateUpdater","createRow","row","pin","position","includeLeafRows","includeParentRows","leafRowIds","getLeafRows","map","_ref","id","parentRowIds","getParentRows","_ref2","rowIds","Set","setRowPinning","old","_old$top3","_old$bottom3","_old$top","_old$bottom","filter","d","has","Array","from","_old$top2","_old$bottom2","getCanPin","_ref3","enableRowPinning","enablePinning","options","getIsPinned","getState","isTop","some","includes","isBottom","getPinnedIndex","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","indexOf","createTable","updater","resetRowPinning","defaultState","_table$initialState$r","_table$initialState","initialState","getIsSomeRowsPinned","_pinningState$positio","pinningState","_pinningState$top","_pinningState$bottom","Boolean","length","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","rows","keepPinnedRows","rowId","getRow","getIsAllParentsExpanded","find","memo","getRowModel","allRows","topPinnedRowIds","getMemoOptions","bottomPinnedRowIds","getCenterRows","topAndBottom"],"mappings":";;;;;;;;;;;;;;AAyHA;;AAEA,MAAMA,yBAAyB,GAAGA,OAAwB;AACxDC,EAAAA,GAAG,EAAE,EAAE;AACPC,EAAAA,MAAM,EAAE,EAAA;AACV,CAAC,CAAC,CAAA;AAEK,MAAMC,UAAwB,GAAG;EACtCC,eAAe,EAAGC,KAAK,IAA2B;IAChD,OAAO;MACLC,UAAU,EAAEN,yBAAyB,EAAE;MACvC,GAAGK,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACU;IAC7B,OAAO;AACLC,MAAAA,kBAAkB,EAAEC,sBAAgB,CAAC,YAAY,EAAEF,KAAK,CAAA;KACzD,CAAA;GACF;AAEDG,EAAAA,SAAS,EAAEA,CACTC,GAAe,EACfJ,KAAmB,KACV;IACTI,GAAG,CAACC,GAAG,GAAG,CAACC,QAAQ,EAAEC,eAAe,EAAEC,iBAAiB,KAAK;AAC1D,MAAA,MAAMC,UAAU,GAAGF,eAAe,GAC9BH,GAAG,CAACM,WAAW,EAAE,CAACC,GAAG,CAACC,IAAA,IAAA;QAAA,IAAC;AAAEC,UAAAA,EAAAA;AAAG,SAAC,GAAAD,IAAA,CAAA;AAAA,QAAA,OAAKC,EAAE,CAAA;AAAA,OAAA,CAAC,GACrC,EAAE,CAAA;AACN,MAAA,MAAMC,YAAY,GAAGN,iBAAiB,GAClCJ,GAAG,CAACW,aAAa,EAAE,CAACJ,GAAG,CAACK,KA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F,YAAY,GAAG,IAAIhE,GAAG,CAAC,CAAC,IAAIzB,GAAG,IAAA,IAAA,GAAHA,GAAG,GAAI,EAAE,GAAG,IAAIC,MAAM,IAAA,IAAA,GAANA,MAAM,GAAI,EAAE,EAAE,CAAC,CAAA;AACjE,MAAA,OAAOmF,OAAO,CAACpD,MAAM,CAACC,CAAC,IAAI,CAACwD,YAAY,CAACvD,GAAG,CAACD,CAAC,CAACb,EAAE,CAAC,CAAC,CAAA;KACpD,EACDkE,oBAAc,CAAC/E,KAAK,CAACoC,OAAO,EAAE,WAAW,EAAE,eAAe,CAC5D,CAAC,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowSelection.d.ts b/node_modules/@tanstack/table-core/build/lib/features/RowSelection.d.ts new file mode 100644 index 00000000..218af5a7 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowSelection.d.ts @@ -0,0 +1,176 @@ +import { OnChangeFn, Table, Row, RowModel, Updater, RowData, TableFeature } from '../types'; +export type RowSelectionState = Record; +export interface RowSelectionTableState { + rowSelection: RowSelectionState; +} +export interface RowSelectionOptions { + /** + * - Enables/disables multiple row selection for all rows in the table OR + * - A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablemultirowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + enableMultiRowSelection?: boolean | ((row: Row) => boolean); + /** + * - Enables/disables row selection for all rows in the table OR + * - A function that given a row, returns whether to enable/disable row selection for that row + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablerowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + enableRowSelection?: boolean | ((row: Row) => boolean); + /** + * Enables/disables automatic sub-row selection when a parent row is selected, or a function that enables/disables automatic sub-row selection for each row. + * (Use in combination with expanding or grouping features) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablesubrowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + enableSubRowSelection?: boolean | ((row: Row) => boolean); + /** + * If provided, this function will be called with an `updaterFn` when `state.rowSelection` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#onrowselectionchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + onRowSelectionChange?: OnChangeFn; +} +export interface RowSelectionRow { + /** + * Returns whether or not the row can multi-select. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanmultiselect) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getCanMultiSelect: () => boolean; + /** + * Returns whether or not the row can be selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselect) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getCanSelect: () => boolean; + /** + * Returns whether or not the row can select sub rows automatically when the parent row is selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselectsubrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getCanSelectSubRows: () => boolean; + /** + * Returns whether or not all of the row's sub rows are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallsubrowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsAllSubRowsSelected: () => boolean; + /** + * Returns whether or not the row is selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSelected: () => boolean; + /** + * Returns whether or not some of the row's sub rows are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomeselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSomeSelected: () => boolean; + /** + * Returns a handler that can be used to toggle the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleselectedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getToggleSelectedHandler: () => (event: unknown) => void; + /** + * Selects/deselects the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + toggleSelected: (value?: boolean, opts?: { + selectChildren?: boolean; + }) => void; +} +export interface RowSelectionInstance { + /** + * Returns the row model of all rows that are selected after filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getfilteredselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getFilteredSelectedRowModel: () => RowModel; + /** + * Returns the row model of all rows that are selected after grouping has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getgroupedselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getGroupedSelectedRowModel: () => RowModel; + /** + * Returns whether or not all rows on the current page are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallpagerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsAllPageRowsSelected: () => boolean; + /** + * Returns whether or not all rows in the table are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallrowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsAllRowsSelected: () => boolean; + /** + * Returns whether or not any rows on the current page are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSomePageRowsSelected: () => boolean; + /** + * Returns whether or not any rows in the table are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSomeRowsSelected: () => boolean; + /** + * Returns the core row model of all rows before row selection has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getpreselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getPreSelectedRowModel: () => RowModel; + /** + * Returns the row model of all rows that are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getSelectedRowModel: () => RowModel; + /** + * Returns a handler that can be used to toggle all rows on the current page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallpagerowsselectedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void; + /** + * Returns a handler that can be used to toggle all rows in the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallrowsselectedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getToggleAllRowsSelectedHandler: () => (event: unknown) => void; + /** + * Resets the **rowSelection** state to the `initialState.rowSelection`, or `true` can be passed to force a default blank state reset to `{}`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#resetrowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + resetRowSelection: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.rowSelection` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#setrowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + setRowSelection: (updater: Updater) => void; + /** + * Selects/deselects all rows on the current page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallpagerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + toggleAllPageRowsSelected: (value?: boolean) => void; + /** + * Selects/deselects all rows in the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallrowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + toggleAllRowsSelected: (value?: boolean) => void; +} +export declare const RowSelection: TableFeature; +export declare function selectRowsFn(table: Table, rowModel: RowModel): RowModel; +export declare function isRowSelected(row: Row, selection: Record): boolean; +export declare function isSubRowSelected(row: Row, selection: Record, table: Table): boolean | 'some' | 'all'; diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowSelection.js b/node_modules/@tanstack/table-core/build/lib/features/RowSelection.js new file mode 100644 index 00000000..703a2c77 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowSelection.js @@ -0,0 +1,391 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +// + +const RowSelection = { + getInitialState: state => { + return { + rowSelection: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowSelectionChange: utils.makeStateUpdater('rowSelection', table), + enableRowSelection: true, + enableMultiRowSelection: true, + enableSubRowSelection: true + // enableGroupingRowSelection: false, + // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey, + // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey, + }; + }, + createTable: table => { + table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater); + table.resetRowSelection = defaultState => { + var _table$initialState$r; + return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); + }; + table.toggleAllRowsSelected = value => { + table.setRowSelection(old => { + value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected(); + const rowSelection = { + ...old + }; + const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; + + // We don't use `mutateRowIsSelected` here for performance reasons. + // All of the rows are flat already, so it wouldn't be worth it + if (value) { + preGroupedFlatRows.forEach(row => { + if (!row.getCanSelect()) { + return; + } + rowSelection[row.id] = true; + }); + } else { + preGroupedFlatRows.forEach(row => { + delete rowSelection[row.id]; + }); + } + return rowSelection; + }); + }; + table.toggleAllPageRowsSelected = value => table.setRowSelection(old => { + const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected(); + const rowSelection = { + ...old + }; + table.getRowModel().rows.forEach(row => { + mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table); + }); + return rowSelection; + }); + + // addRowSelectionRange: rowId => { + // const { + // rows, + // rowsById, + // options: { selectGroupingRows, selectSubRows }, + // } = table + + // const findSelectedRow = (rows: Row[]) => { + // let found + // rows.find(d => { + // if (d.getIsSelected()) { + // found = d + // return true + // } + // const subFound = findSelectedRow(d.subRows || []) + // if (subFound) { + // found = subFound + // return true + // } + // return false + // }) + // return found + // } + + // const firstRow = findSelectedRow(rows) || rows[0] + // const lastRow = rowsById[rowId] + + // let include = false + // const selectedRowIds = {} + + // const addRow = (row: Row) => { + // mutateRowIsSelected(selectedRowIds, row.id, true, { + // rowsById, + // selectGroupingRows: selectGroupingRows!, + // selectSubRows: selectSubRows!, + // }) + // } + + // table.rows.forEach(row => { + // const isFirstRow = row.id === firstRow.id + // const isLastRow = row.id === lastRow.id + + // if (isFirstRow || isLastRow) { + // if (!include) { + // include = true + // } else if (include) { + // addRow(row) + // include = false + // } + // } + + // if (include) { + // addRow(row) + // } + // }) + + // table.setRowSelection(selectedRowIds) + // }, + table.getPreSelectedRowModel = () => table.getCoreRowModel(); + table.getSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, utils.getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')); + table.getFilteredSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, utils.getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')); + table.getGroupedSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, utils.getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')); + + /// + + // getGroupingRowCanSelect: rowId => { + // const row = table.getRow(rowId) + + // if (!row) { + // throw new Error() + // } + + // if (typeof table.options.enableGroupingRowSelection === 'function') { + // return table.options.enableGroupingRowSelection(row) + // } + + // return table.options.enableGroupingRowSelection ?? false + // }, + + table.getIsAllRowsSelected = () => { + const preGroupedFlatRows = table.getFilteredRowModel().flatRows; + const { + rowSelection + } = table.getState(); + let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); + if (isAllRowsSelected) { + if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) { + isAllRowsSelected = false; + } + } + return isAllRowsSelected; + }; + table.getIsAllPageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect()); + const { + rowSelection + } = table.getState(); + let isAllPageRowsSelected = !!paginationFlatRows.length; + if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) { + isAllPageRowsSelected = false; + } + return isAllPageRowsSelected; + }; + table.getIsSomeRowsSelected = () => { + var _table$getState$rowSe; + const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; + return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; + }; + table.getIsSomePageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows; + return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected()); + }; + table.getToggleAllRowsSelectedHandler = () => { + return e => { + table.toggleAllRowsSelected(e.target.checked); + }; + }; + table.getToggleAllPageRowsSelectedHandler = () => { + return e => { + table.toggleAllPageRowsSelected(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row.toggleSelected = (value, opts) => { + const isSelected = row.getIsSelected(); + table.setRowSelection(old => { + var _opts$selectChildren; + value = typeof value !== 'undefined' ? value : !isSelected; + if (row.getCanSelect() && isSelected === value) { + return old; + } + const selectedRowIds = { + ...old + }; + mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table); + return selectedRowIds; + }); + }; + row.getIsSelected = () => { + const { + rowSelection + } = table.getState(); + return isRowSelected(row, rowSelection); + }; + row.getIsSomeSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'some'; + }; + row.getIsAllSubRowsSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'all'; + }; + row.getCanSelect = () => { + var _table$options$enable; + if (typeof table.options.enableRowSelection === 'function') { + return table.options.enableRowSelection(row); + } + return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; + }; + row.getCanSelectSubRows = () => { + var _table$options$enable2; + if (typeof table.options.enableSubRowSelection === 'function') { + return table.options.enableSubRowSelection(row); + } + return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; + }; + row.getCanMultiSelect = () => { + var _table$options$enable3; + if (typeof table.options.enableMultiRowSelection === 'function') { + return table.options.enableMultiRowSelection(row); + } + return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; + }; + row.getToggleSelectedHandler = () => { + const canSelect = row.getCanSelect(); + return e => { + var _target; + if (!canSelect) return; + row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } +}; +const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => { + var _row$subRows; + const row = table.getRow(id, true); + + // const isGrouped = row.getIsGrouped() + + // if ( // TODO: enforce grouping row selection rules + // !isGrouped || + // (isGrouped && table.options.enableGroupingRowSelection) + // ) { + if (value) { + if (!row.getCanMultiSelect()) { + Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]); + } + if (row.getCanSelect()) { + selectedRowIds[id] = true; + } + } else { + delete selectedRowIds[id]; + } + // } + + if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { + row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)); + } +}; +function selectRowsFn(table, rowModel) { + const rowSelection = table.getState().rowSelection; + const newSelectedFlatRows = []; + const newSelectedRowsById = {}; + + // Filters top level and nested rows + const recurseRows = function (rows, depth) { + return rows.map(row => { + var _row$subRows2; + const isSelected = isRowSelected(row, rowSelection); + if (isSelected) { + newSelectedFlatRows.push(row); + newSelectedRowsById[row.id] = row; + } + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) { + row = { + ...row, + subRows: recurseRows(row.subRows) + }; + } + if (isSelected) { + return row; + } + }).filter(Boolean); + }; + return { + rows: recurseRows(rowModel.rows), + flatRows: newSelectedFlatRows, + rowsById: newSelectedRowsById + }; +} +function isRowSelected(row, selection) { + var _selection$row$id; + return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false; +} +function isSubRowSelected(row, selection, table) { + var _row$subRows3; + if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false; + let allChildrenSelected = true; + let someSelected = false; + row.subRows.forEach(subRow => { + // Bail out early if we know both of these + if (someSelected && !allChildrenSelected) { + return; + } + if (subRow.getCanSelect()) { + if (isRowSelected(subRow, selection)) { + someSelected = true; + } else { + allChildrenSelected = false; + } + } + + // Check row selection of nested subrows + if (subRow.subRows && subRow.subRows.length) { + const subRowChildrenSelected = isSubRowSelected(subRow, selection); + if (subRowChildrenSelected === 'all') { + someSelected = true; + } else if (subRowChildrenSelected === 'some') { + someSelected = true; + allChildrenSelected = false; + } else { + allChildrenSelected = false; + } + } + }); + return allChildrenSelected ? 'all' : someSelected ? 'some' : false; +} + +exports.RowSelection = RowSelection; +exports.isRowSelected = isRowSelected; +exports.isSubRowSelected = isSubRowSelected; +exports.selectRowsFn = selectRowsFn; +//# sourceMappingURL=RowSelection.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowSelection.js.map b/node_modules/@tanstack/table-core/build/lib/features/RowSelection.js.map new file mode 100644 index 00000000..12b88d46 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowSelection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RowSelection.js","sources":["../../../src/features/RowSelection.ts"],"sourcesContent":["import {\n OnChangeFn,\n Table,\n Row,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowSelectionState = Record\n\nexport interface RowSelectionTableState {\n rowSelection: RowSelectionState\n}\n\nexport interface RowSelectionOptions {\n /**\n * - Enables/disables multiple row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablemultirowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableMultiRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * - Enables/disables row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable row selection for that row\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablerowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * Enables/disables automatic sub-row selection when a parent row is selected, or a function that enables/disables automatic sub-row selection for each row.\n * (Use in combination with expanding or grouping features)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablesubrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableSubRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowSelection` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#onrowselectionchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n onRowSelectionChange?: OnChangeFn\n // enableGroupingRowSelection?:\n // | boolean\n // | ((\n // row: Row\n // ) => boolean)\n // isAdditiveSelectEvent?: (e: unknown) => boolean\n // isInclusiveSelectEvent?: (e: unknown) => boolean\n // selectRowsFn?: (\n // table: Table,\n // rowModel: RowModel\n // ) => RowModel\n}\n\nexport interface RowSelectionRow {\n /**\n * Returns whether or not the row can multi-select.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanmultiselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanMultiSelect: () => boolean\n /**\n * Returns whether or not the row can be selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelect: () => boolean\n /**\n * Returns whether or not the row can select sub rows automatically when the parent row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselectsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelectSubRows: () => boolean\n /**\n * Returns whether or not all of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallsubrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllSubRowsSelected: () => boolean\n /**\n * Returns whether or not the row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSelected: () => boolean\n /**\n * Returns whether or not some of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomeselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeSelected: () => boolean\n /**\n * Returns a handler that can be used to toggle the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleSelectedHandler: () => (event: unknown) => void\n /**\n * Selects/deselects the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleSelected: (value?: boolean, opts?: { selectChildren?: boolean }) => void\n}\n\nexport interface RowSelectionInstance {\n /**\n * Returns the row model of all rows that are selected after filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getfilteredselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getFilteredSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getgroupedselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getGroupedSelectedRowModel: () => RowModel\n /**\n * Returns whether or not all rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllPageRowsSelected: () => boolean\n /**\n * Returns whether or not all rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllRowsSelected: () => boolean\n /**\n * Returns whether or not any rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomePageRowsSelected: () => boolean\n /**\n * Returns whether or not any rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeRowsSelected: () => boolean\n /**\n * Returns the core row model of all rows before row selection has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getpreselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getPreSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getSelectedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallpagerowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Returns a handler that can be used to toggle all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallrowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Resets the **rowSelection** state to the `initialState.rowSelection`, or `true` can be passed to force a default blank state reset to `{}`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#resetrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n resetRowSelection: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowSelection` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#setrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n setRowSelection: (updater: Updater) => void\n /**\n * Selects/deselects all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllPageRowsSelected: (value?: boolean) => void\n /**\n * Selects/deselects all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllRowsSelected: (value?: boolean) => void\n}\n\n//\n\nexport const RowSelection: TableFeature = {\n getInitialState: (state): RowSelectionTableState => {\n return {\n rowSelection: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowSelectionOptions => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true,\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowSelection = updater =>\n table.options.onRowSelectionChange?.(updater)\n table.resetRowSelection = defaultState =>\n table.setRowSelection(\n defaultState ? {} : table.initialState.rowSelection ?? {}\n )\n table.toggleAllRowsSelected = value => {\n table.setRowSelection(old => {\n value =\n typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n }\n table.toggleAllPageRowsSelected = value =>\n table.setRowSelection(old => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table.getIsAllPageRowsSelected()\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n table.getPreSelectedRowModel = () => table.getCoreRowModel()\n table.getSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getCoreRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')\n )\n\n table.getFilteredSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getFilteredRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')\n )\n\n table.getGroupedSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getSortedRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')\n )\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n table.getIsAllRowsSelected = () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const { rowSelection } = table.getState()\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n row => row.getCanSelect() && !rowSelection[row.id]\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n }\n\n table.getIsAllPageRowsSelected = () => {\n const paginationFlatRows = table\n .getPaginationRowModel()\n .flatRows.filter(row => row.getCanSelect())\n const { rowSelection } = table.getState()\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some(row => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n }\n\n table.getIsSomeRowsSelected = () => {\n const totalSelected = Object.keys(\n table.getState().rowSelection ?? {}\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n }\n\n table.getIsSomePageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows\n return table.getIsAllPageRowsSelected()\n ? false\n : paginationFlatRows\n .filter(row => row.getCanSelect())\n .some(d => d.getIsSelected() || d.getIsSomeSelected())\n }\n\n table.getToggleAllRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n\n table.getToggleAllPageRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllPageRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleSelected = (value, opts) => {\n const isSelected = row.getIsSelected()\n\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row.getCanSelect() && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n table\n )\n\n return selectedRowIds\n })\n }\n row.getIsSelected = () => {\n const { rowSelection } = table.getState()\n return isRowSelected(row, rowSelection)\n }\n\n row.getIsSomeSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'some'\n }\n\n row.getIsAllSubRowsSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'all'\n }\n\n row.getCanSelect = () => {\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row)\n }\n\n return table.options.enableRowSelection ?? true\n }\n\n row.getCanSelectSubRows = () => {\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row)\n }\n\n return table.options.enableSubRowSelection ?? true\n }\n\n row.getCanMultiSelect = () => {\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row)\n }\n\n return table.options.enableMultiRowSelection ?? true\n }\n row.getToggleSelectedHandler = () => {\n const canSelect = row.getCanSelect()\n\n return (e: unknown) => {\n if (!canSelect) return\n row.toggleSelected(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nconst mutateRowIsSelected = (\n selectedRowIds: Record,\n id: string,\n value: boolean,\n includeChildren: boolean,\n table: Table\n) => {\n const row = table.getRow(id, true)\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key])\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true\n }\n } else {\n delete selectedRowIds[id]\n }\n // }\n\n if (includeChildren && row.subRows?.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row =>\n mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)\n )\n }\n}\n\nexport function selectRowsFn(\n table: Table,\n rowModel: RowModel\n): RowModel {\n const rowSelection = table.getState().rowSelection\n\n const newSelectedFlatRows: Row[] = []\n const newSelectedRowsById: Record> = {}\n\n // Filters top level and nested rows\n const recurseRows = (rows: Row[], depth = 0): Row[] => {\n return rows\n .map(row => {\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows?.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n return row\n }\n })\n .filter(Boolean) as Row[]\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\nexport function isRowSelected(\n row: Row,\n selection: Record\n): boolean {\n return selection[row.id] ?? false\n}\n\nexport function isSubRowSelected(\n row: Row,\n selection: Record,\n table: Table\n): boolean | 'some' | 'all' {\n if (!row.subRows?.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (subRow.getCanSelect()) {\n if (isRowSelected(subRow, selection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows && subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow, selection, table)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"names":["RowSelection","getInitialState","state","rowSelection","getDefaultOptions","table","onRowSelectionChange","makeStateUpdater","enableRowSelection","enableMultiRowSelection","enableSubRowSelection","createTable","setRowSelection","updater","options","resetRowSelection","defaultState","_table$initialState$r","initialState","toggleAllRowsSelected","value","old","getIsAllRowsSelected","preGroupedFlatRows","getPreGroupedRowModel","flatRows","forEach","row","getCanSelect","id","toggleAllPageRowsSelected","resolvedValue","getIsAllPageRowsSelected","getRowModel","rows","mutateRowIsSelected","getPreSelectedRowModel","getCoreRowModel","getSelectedRowModel","memo","getState","rowModel","Object","keys","length","rowsById","selectRowsFn","getMemoOptions","getFilteredSelectedRowModel","getFilteredRowModel","getGroupedSelectedRowModel","getSortedRowModel","isAllRowsSelected","Boolean","some","paginationFlatRows","getPaginationRowModel","filter","isAllPageRowsSelected","getIsSomeRowsSelected","_table$getState$rowSe","totalSelected","getIsSomePageRowsSelected","d","getIsSelected","getIsSomeSelected","getToggleAllRowsSelectedHandler","e","target","checked","getToggleAllPageRowsSelectedHandler","createRow","toggleSelected","opts","isSelected","_opts$selectChildren","selectedRowIds","selectChildren","isRowSelected","isSubRowSelected","getIsAllSubRowsSelected","_table$options$enable","getCanSelectSubRows","_table$options$enable2","getCanMultiSelect","_table$options$enable3","getToggleSelectedHandler","canSelect","_target","includeChildren","_row$subRows","getRow","key","subRows","newSelectedFlatRows","newSelectedRowsById","recurseRows","depth","map","_row$subRows2","push","selection","_selection$row$id","_row$subRows3","allChildrenSelected","someSelected","subRow","subRowChildrenSelected"],"mappings":";;;;;;;;;;;;;;AAoMA;;AAEO,MAAMA,YAA0B,GAAG;EACxCC,eAAe,EAAG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3D,MAAM,CAAE,EAAA,OAAO,KAAK,CAAA;EAEtC,IAAI4D,mBAAmB,GAAG,IAAI,CAAA;EAC9B,IAAIC,YAAY,GAAG,KAAK,CAAA;AAExB9E,EAAAA,GAAG,CAACkE,OAAO,CAACnE,OAAO,CAACgF,MAAM,IAAI;AAC5B;AACA,IAAA,IAAID,YAAY,IAAI,CAACD,mBAAmB,EAAE;AACxC,MAAA,OAAA;AACF,KAAA;AAEA,IAAA,IAAIE,MAAM,CAAC9E,YAAY,EAAE,EAAE;AACzB,MAAA,IAAIkD,aAAa,CAAC4B,MAAM,EAAEL,SAAS,CAAC,EAAE;AACpCI,QAAAA,YAAY,GAAG,IAAI,CAAA;AACrB,OAAC,MAAM;AACLD,QAAAA,mBAAmB,GAAG,KAAK,CAAA;AAC7B,OAAA;AACF,KAAA;;AAEA;IACA,IAAIE,MAAM,CAACb,OAAO,IAAIa,MAAM,CAACb,OAAO,CAACjD,MAAM,EAAE;MAC3C,MAAM+D,sBAAsB,GAAG5B,gBAAgB,CAAC2B,MAAM,EAAEL,SAAgB,CAAC,CAAA;MACzE,IAAIM,sBAAsB,KAAK,KAAK,EAAE;AACpCF,QAAAA,YAAY,GAAG,IAAI,CAAA;AACrB,OAAC,MAAM,IAAIE,sBAAsB,KAAK,MAAM,EAAE;AAC5CF,QAAAA,YAAY,GAAG,IAAI,CAAA;AACnBD,QAAAA,mBAAmB,GAAG,KAAK,CAAA;AAC7B,OAAC,MAAM;AACLA,QAAAA,mBAAmB,GAAG,KAAK,CAAA;AAC7B,OAAA;AACF,KAAA;AACF,GAAC,CAAC,CAAA;EAEF,OAAOA,mBAAmB,GAAG,KAAK,GAAGC,YAAY,GAAG,MAAM,GAAG,KAAK,CAAA;AACpE;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowSorting.d.ts b/node_modules/@tanstack/table-core/build/lib/features/RowSorting.d.ts new file mode 100644 index 00000000..73e7544d --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowSorting.d.ts @@ -0,0 +1,237 @@ +import { RowModel } from '..'; +import { BuiltInSortingFn } from '../sortingFns'; +import { OnChangeFn, Table, Row, Updater, RowData, SortingFns, TableFeature } from '../types'; +export type SortDirection = 'asc' | 'desc'; +export interface ColumnSort { + desc: boolean; + id: string; +} +export type SortingState = ColumnSort[]; +export interface SortingTableState { + sorting: SortingState; +} +export interface SortingFn { + (rowA: Row, rowB: Row, columnId: string): number; +} +export type CustomSortingFns = Record>; +export type SortingFnOption = 'auto' | keyof SortingFns | BuiltInSortingFn | SortingFn; +export interface SortingColumnDef { + /** + * Enables/Disables multi-sorting for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableMultiSort?: boolean; + /** + * Enables/Disables sorting for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableSorting?: boolean; + /** + * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + invertSorting?: boolean; + /** + * Set to `true` for sorting toggles on this column to start in the descending direction. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortDescFirst?: boolean; + /** + * The sorting function to use with this column. + * - A `string` referencing a built-in sorting function + * - A custom sorting function + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortingFn?: SortingFnOption; + /** + * The priority of undefined values when sorting this column. + * - `false` + * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies) + * - `-1` + * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list) + * - `1` + * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortundefined) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortUndefined?: false | -1 | 1 | 'first' | 'last'; +} +export interface SortingColumn { + /** + * Removes this column from the table's sorting state + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + clearSorting: () => void; + /** + * Returns a sort direction automatically inferred based on the columns values. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getAutoSortDir: () => SortDirection; + /** + * Returns a sorting function automatically inferred based on the columns values. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getAutoSortingFn: () => SortingFn; + /** + * Returns whether this column can be multi-sorted. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getCanMultiSort: () => boolean; + /** + * Returns whether this column can be sorted. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getCanSort: () => boolean; + /** + * Returns the first direction that should be used when sorting this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getFirstSortDir: () => SortDirection; + /** + * Returns the current sort direction of this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getIsSorted: () => false | SortDirection; + /** + * Returns the next sorting order. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getNextSortingOrder: () => SortDirection | false; + /** + * Returns the index position of this column's sorting within the sorting state + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortIndex: () => number; + /** + * Returns the resolved sorting function to be used for this column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortingFn: () => SortingFn; + /** + * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getToggleSortingHandler: () => undefined | ((event: unknown) => void); + /** + * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + toggleSorting: (desc?: boolean, isMulti?: boolean) => void; +} +interface SortingOptionsBase { + /** + * Enables/disables the ability to remove multi-sorts + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableMultiRemove?: boolean; + /** + * Enables/Disables multi-sorting for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableMultiSort?: boolean; + /** + * Enables/Disables sorting for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableSorting?: boolean; + /** + * Enables/Disables the ability to remove sorting for the table. + * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ... + * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ... + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableSortingRemoval?: boolean; + /** + * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortedRowModel?: (table: Table) => () => RowModel; + /** + * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + isMultiSortEvent?: (e: unknown) => boolean; + /** + * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + manualSorting?: boolean; + /** + * Set a maximum number of columns that can be multi-sorted. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + maxMultiSortColCount?: number; + /** + * If provided, this function will be called with an `updaterFn` when `state.sorting` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + onSortingChange?: OnChangeFn; + /** + * If `true`, all sorts will default to descending as their first toggle state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortDescFirst?: boolean; +} +type ResolvedSortingFns = keyof SortingFns extends never ? { + sortingFns?: Record>; +} : { + sortingFns: Record>; +}; +export interface SortingOptions extends SortingOptionsBase, ResolvedSortingFns { +} +export interface SortingInstance { + _getSortedRowModel?: () => RowModel; + /** + * Returns the row model for the table before any sorting has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getPreSortedRowModel: () => RowModel; + /** + * Returns the row model for the table after sorting has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortedRowModel: () => RowModel; + /** + * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + resetSorting: (defaultState?: boolean) => void; + /** + * Sets or updates the `state.sorting` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + setSorting: (updater: Updater) => void; +} +export declare const RowSorting: TableFeature; +export {}; diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowSorting.js b/node_modules/@tanstack/table-core/build/lib/features/RowSorting.js new file mode 100644 index 00000000..52669094 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowSorting.js @@ -0,0 +1,226 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var sortingFns = require('../sortingFns.js'); +var utils = require('../utils.js'); + +// + +const RowSorting = { + getInitialState: state => { + return { + sorting: [], + ...state + }; + }, + getDefaultColumnDef: () => { + return { + sortingFn: 'auto', + sortUndefined: 1 + }; + }, + getDefaultOptions: table => { + return { + onSortingChange: utils.makeStateUpdater('sorting', table), + isMultiSortEvent: e => { + return e.shiftKey; + } + }; + }, + createColumn: (column, table) => { + column.getAutoSortingFn = () => { + const firstRows = table.getFilteredRowModel().flatRows.slice(10); + let isString = false; + for (const row of firstRows) { + const value = row == null ? void 0 : row.getValue(column.id); + if (Object.prototype.toString.call(value) === '[object Date]') { + return sortingFns.sortingFns.datetime; + } + if (typeof value === 'string') { + isString = true; + if (value.split(sortingFns.reSplitAlphaNumeric).length > 1) { + return sortingFns.sortingFns.alphanumeric; + } + } + } + if (isString) { + return sortingFns.sortingFns.text; + } + return sortingFns.sortingFns.basic; + }; + column.getAutoSortDir = () => { + const firstRow = table.getFilteredRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return 'asc'; + } + return 'desc'; + }; + column.getSortingFn = () => { + var _table$options$sortin, _table$options$sortin2; + if (!column) { + throw new Error(); + } + return utils.isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns.sortingFns[column.columnDef.sortingFn]; + }; + column.toggleSorting = (desc, multi) => { + // if (column.columns.length) { + // column.columns.forEach((c, i) => { + // if (c.id) { + // table.toggleColumnSorting(c.id, undefined, multi || !!i) + // } + // }) + // return + // } + + // this needs to be outside of table.setSorting to be in sync with rerender + const nextSortingOrder = column.getNextSortingOrder(); + const hasManualValue = typeof desc !== 'undefined' && desc !== null; + table.setSorting(old => { + // Find any existing sorting for this column + const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id); + const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id); + let newSorting = []; + + // What should we do with this sort action? + let sortAction; + let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; + + // Multi-mode + if (old != null && old.length && column.getCanMultiSort() && multi) { + if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'add'; + } + } else { + // Normal mode + if (old != null && old.length && existingIndex !== old.length - 1) { + sortAction = 'replace'; + } else if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'replace'; + } + } + + // Handle toggle states that will remove the sorting + if (sortAction === 'toggle') { + // If we are "actually" toggling (not a manual set value), should we remove the sorting? + if (!hasManualValue) { + // Is our intention to remove? + if (!nextSortingOrder) { + sortAction = 'remove'; + } + } + } + if (sortAction === 'add') { + var _table$options$maxMul; + newSorting = [...old, { + id: column.id, + desc: nextDesc + }]; + // Take latest n columns + newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); + } else if (sortAction === 'toggle') { + // This flips (or sets) the + newSorting = old.map(d => { + if (d.id === column.id) { + return { + ...d, + desc: nextDesc + }; + } + return d; + }); + } else if (sortAction === 'remove') { + newSorting = old.filter(d => d.id !== column.id); + } else { + newSorting = [{ + id: column.id, + desc: nextDesc + }]; + } + return newSorting; + }); + }; + column.getFirstSortDir = () => { + var _ref, _column$columnDef$sor; + const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc'; + return sortDescFirst ? 'desc' : 'asc'; + }; + column.getNextSortingOrder = multi => { + var _table$options$enable, _table$options$enable2; + const firstSortDirection = column.getFirstSortDir(); + const isSorted = column.getIsSorted(); + if (!isSorted) { + return firstSortDirection; + } + if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( + // If enableSortRemove, enable in general + multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove)) + ) { + return false; + } + return isSorted === 'desc' ? 'asc' : 'desc'; + }; + column.getCanSort = () => { + var _column$columnDef$ena, _table$options$enable3; + return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn; + }; + column.getCanMultiSort = () => { + var _ref2, _column$columnDef$ena2; + return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn; + }; + column.getIsSorted = () => { + var _table$getState$sorti; + const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id); + return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'; + }; + column.getSortIndex = () => { + var _table$getState$sorti2, _table$getState$sorti3; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1; + }; + column.clearSorting = () => { + //clear sorting for just 1 column + table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []); + }; + column.getToggleSortingHandler = () => { + const canSort = column.getCanSort(); + return e => { + if (!canSort) return; + e.persist == null || e.persist(); + column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false); + }; + }; + }, + createTable: table => { + table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater); + table.resetSorting = defaultState => { + var _table$initialState$s, _table$initialState; + table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); + }; + table.getPreSortedRowModel = () => table.getGroupedRowModel(); + table.getSortedRowModel = () => { + if (!table._getSortedRowModel && table.options.getSortedRowModel) { + table._getSortedRowModel = table.options.getSortedRowModel(table); + } + if (table.options.manualSorting || !table._getSortedRowModel) { + return table.getPreSortedRowModel(); + } + return table._getSortedRowModel(); + }; + } +}; + +exports.RowSorting = RowSorting; +//# sourceMappingURL=RowSorting.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/features/RowSorting.js.map b/node_modules/@tanstack/table-core/build/lib/features/RowSorting.js.map new file mode 100644 index 00000000..e648549c --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/features/RowSorting.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RowSorting.js","sources":["../../../src/features/RowSorting.ts"],"sourcesContent":["import { RowModel } from '..'\nimport {\n BuiltInSortingFn,\n reSplitAlphaNumeric,\n sortingFns,\n} from '../sortingFns'\n\nimport {\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n SortingFns,\n TableFeature,\n} from '../types'\n\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type SortDirection = 'asc' | 'desc'\n\nexport interface ColumnSort {\n desc: boolean\n id: string\n}\n\nexport type SortingState = ColumnSort[]\n\nexport interface SortingTableState {\n sorting: SortingState\n}\n\nexport interface SortingFn {\n (rowA: Row, rowB: Row, columnId: string): number\n}\n\nexport type CustomSortingFns = Record<\n string,\n SortingFn\n>\n\nexport type SortingFnOption =\n | 'auto'\n | keyof SortingFns\n | BuiltInSortingFn\n | SortingFn\n\nexport interface SortingColumnDef {\n /**\n * Enables/Disables multi-sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n invertSorting?: boolean\n /**\n * Set to `true` for sorting toggles on this column to start in the descending direction.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n /**\n * The sorting function to use with this column.\n * - A `string` referencing a built-in sorting function\n * - A custom sorting function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortingFn?: SortingFnOption\n /**\n * The priority of undefined values when sorting this column.\n * - `false`\n * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)\n * - `-1`\n * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)\n * - `1`\n * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortundefined)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n}\n\nexport interface SortingColumn {\n /**\n * Removes this column from the table's sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n clearSorting: () => void\n /**\n * Returns a sort direction automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortDir: () => SortDirection\n /**\n * Returns a sorting function automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortingFn: () => SortingFn\n /**\n * Returns whether this column can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanMultiSort: () => boolean\n /**\n * Returns whether this column can be sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanSort: () => boolean\n /**\n * Returns the first direction that should be used when sorting this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getFirstSortDir: () => SortDirection\n /**\n * Returns the current sort direction of this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getIsSorted: () => false | SortDirection\n /**\n * Returns the next sorting order.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getNextSortingOrder: () => SortDirection | false\n /**\n * Returns the index position of this column's sorting within the sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortIndex: () => number\n /**\n * Returns the resolved sorting function to be used for this column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortingFn: () => SortingFn\n /**\n * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getToggleSortingHandler: () => undefined | ((event: unknown) => void)\n /**\n * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n toggleSorting: (desc?: boolean, isMulti?: boolean) => void\n}\n\ninterface SortingOptionsBase {\n /**\n * Enables/disables the ability to remove multi-sorts\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiRemove?: boolean\n /**\n * Enables/Disables multi-sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Enables/Disables the ability to remove sorting for the table.\n * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ...\n * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ...\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSortingRemoval?: boolean\n /**\n * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel?: (table: Table) => () => RowModel\n /**\n * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n isMultiSortEvent?: (e: unknown) => boolean\n /**\n * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n manualSorting?: boolean\n /**\n * Set a maximum number of columns that can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n maxMultiSortColCount?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.sorting` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n onSortingChange?: OnChangeFn\n /**\n * If `true`, all sorts will default to descending as their first toggle state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n}\n\ntype ResolvedSortingFns = keyof SortingFns extends never\n ? {\n sortingFns?: Record>\n }\n : {\n sortingFns: Record>\n }\n\nexport interface SortingOptions\n extends SortingOptionsBase,\n ResolvedSortingFns {}\n\nexport interface SortingInstance {\n _getSortedRowModel?: () => RowModel\n /**\n * Returns the row model for the table before any sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getPreSortedRowModel: () => RowModel\n /**\n * Returns the row model for the table after sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel: () => RowModel\n /**\n * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n resetSorting: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.sorting` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n setSorting: (updater: Updater) => void\n}\n\n//\n\nexport const RowSorting: TableFeature = {\n getInitialState: (state): SortingTableState => {\n return {\n sorting: [],\n ...state,\n }\n },\n\n getDefaultColumnDef: (): SortingColumnDef => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): SortingOptions => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoSortingFn = () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row?.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric\n }\n }\n }\n\n if (isString) {\n return sortingFns.text\n }\n\n return sortingFns.basic\n }\n column.getAutoSortDir = () => {\n const firstRow = table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n }\n column.getSortingFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.sortingFn)\n ? column.columnDef.sortingFn\n : column.columnDef.sortingFn === 'auto'\n ? column.getAutoSortingFn()\n : table.options.sortingFns?.[column.columnDef.sortingFn as string] ??\n sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]\n }\n column.toggleSorting = (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder()\n const hasManualValue = typeof desc !== 'undefined' && desc !== null\n\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old?.find(d => d.id === column.id)\n const existingIndex = old?.findIndex(d => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old?.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old?.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n }\n\n column.getFirstSortDir = () => {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n table.options.sortDescFirst ??\n column.getAutoSortDir() === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n }\n\n column.getNextSortingOrder = (multi?: boolean) => {\n const firstSortDirection = column.getFirstSortDir()\n const isSorted = column.getIsSorted()\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n }\n\n column.getCanSort = () => {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getCanMultiSort = () => {\n return (\n column.columnDef.enableMultiSort ??\n table.options.enableMultiSort ??\n !!column.accessorFn\n )\n }\n\n column.getIsSorted = () => {\n const columnSort = table.getState().sorting?.find(d => d.id === column.id)\n\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n }\n\n column.getSortIndex = () =>\n table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1\n\n column.clearSorting = () => {\n //clear sorting for just 1 column\n table.setSorting(old =>\n old?.length ? old.filter(d => d.id !== column.id) : []\n )\n }\n\n column.getToggleSortingHandler = () => {\n const canSort = column.getCanSort()\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column.toggleSorting?.(\n undefined,\n column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false\n )\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setSorting = updater => table.options.onSortingChange?.(updater)\n table.resetSorting = defaultState => {\n table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])\n }\n table.getPreSortedRowModel = () => table.getGroupedRowModel()\n table.getSortedRowModel = () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table)\n }\n\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._getSortedRowModel()\n }\n },\n}\n"],"names":["RowSorting","getInitialState","state","sorting","getDefaultColumnDef","sortingFn","sortUndefined","getDefaultOptions","table","onSortingChange","makeStateUpdater","isMultiSortEvent","e","shiftKey","createColumn","column","getAutoSortingFn","firstRows","getFilteredRowModel","flatRows","slice","isString","row","value","getValue","id","Object","prototype","toString","call","sortingFns","datetime","split","reSplitAlphaNumeric","length","alphanumeric","text","basic","getAutoSortDir","firstRow","getSortingFn","_table$options$sortin","_table$options$sortin2","Error","isFunction","columnDef","options","toggleSorting","desc","multi","nextSortingOrder","getNextSortingOrder","hasManualValue","setSorting","old","existingSorting","find","d","existingIndex","findIndex","newSorting","sortAction","nextDesc","getCanMultiSort","_table$options$maxMul","splice","maxMultiSortColCount","Number","MAX_SAFE_INTEGER","map","filter","getFirstSortDir","_ref","_column$columnDef$sor","sortDescFirst","_table$options$enable","_table$options$enable2","firstSortDirection","isSorted","getIsSorted","enableSortingRemoval","enableMultiRemove","getCanSort","_column$columnDef$ena","_table$options$enable3","enableSorting","accessorFn","_ref2","_column$columnDef$ena2","enableMultiSort","_table$getState$sorti","columnSort","getState","getSortIndex","_table$getState$sorti2","_table$getState$sorti3","clearSorting","getToggleSortingHandler","canSort","persist","undefined","createTable","updater","resetSorting","defaultState","_table$initialState$s","_table$initialState","initialState","getPreSortedRowModel","getGroupedRowModel","getSortedRowModel","_getSortedRowModel","manualSorting"],"mappings":";;;;;;;;;;;;;;;AAmRA;;AAEO,MAAMA,UAAwB,GAAG;EACtCC,eAAe,EAAGC,KAAK,IAAwB;IAC7C,OAAO;AACLC,MAAAA,OAAO,EAAE,EAAE;MACX,GAAGD,KAAAA;KACJ,CAAA;GACF;EAEDE,mBAAmB,EAAEA,M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AAK,CAAC6C,UAAU,GAAGiD,OAAO,IAAI9F,KAAK,CAACsC,OAAO,CAACrC,eAAe,IAAA,IAAA,GAAA,KAAA,CAAA,GAA7BD,KAAK,CAACsC,OAAO,CAACrC,eAAe,CAAG6F,OAAO,CAAC,CAAA;AACtE9F,IAAAA,KAAK,CAAC+F,YAAY,GAAGC,YAAY,IAAI;MAAA,IAAAC,qBAAA,EAAAC,mBAAA,CAAA;MACnClG,KAAK,CAAC6C,UAAU,CAACmD,YAAY,GAAG,EAAE,GAAA,CAAAC,qBAAA,GAAA,CAAAC,mBAAA,GAAGlG,KAAK,CAACmG,YAAY,qBAAlBD,mBAAA,CAAoBvG,OAAO,KAAAsG,IAAAA,GAAAA,qBAAA,GAAI,EAAE,CAAC,CAAA;KACxE,CAAA;IACDjG,KAAK,CAACoG,oBAAoB,GAAG,MAAMpG,KAAK,CAACqG,kBAAkB,EAAE,CAAA;IAC7DrG,KAAK,CAACsG,iBAAiB,GAAG,MAAM;MAC9B,IAAI,CAACtG,KAAK,CAACuG,kBAAkB,IAAIvG,KAAK,CAACsC,OAAO,CAACgE,iBAAiB,EAAE;QAChEtG,KAAK,CAACuG,kBAAkB,GAAGvG,KAAK,CAACsC,OAAO,CAACgE,iBAAiB,CAACtG,KAAK,CAAC,CAAA;AACnE,OAAA;MAEA,IAAIA,KAAK,CAACsC,OAAO,CAACkE,aAAa,IAAI,CAACxG,KAAK,CAACuG,kBAAkB,EAAE;AAC5D,QAAA,OAAOvG,KAAK,CAACoG,oBAAoB,EAAE,CAAA;AACrC,OAAA;AAEA,MAAA,OAAOpG,KAAK,CAACuG,kBAAkB,EAAE,CAAA;KAClC,CAAA;AACH,GAAA;AACF;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/filterFns.d.ts b/node_modules/@tanstack/table-core/build/lib/filterFns.d.ts new file mode 100644 index 00000000..ee5d7c37 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/filterFns.d.ts @@ -0,0 +1,13 @@ +import { FilterFn } from './features/ColumnFiltering'; +export declare const filterFns: { + includesString: FilterFn; + includesStringSensitive: FilterFn; + equalsString: FilterFn; + arrIncludes: FilterFn; + arrIncludesAll: FilterFn; + arrIncludesSome: FilterFn; + equals: FilterFn; + weakEquals: FilterFn; + inNumberRange: FilterFn; +}; +export type BuiltInFilterFn = keyof typeof filterFns; diff --git a/node_modules/@tanstack/table-core/build/lib/filterFns.js b/node_modules/@tanstack/table-core/build/lib/filterFns.js new file mode 100644 index 00000000..a08a6a44 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/filterFns.js @@ -0,0 +1,96 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +const includesString = (row, columnId, filterValue) => { + var _filterValue$toString, _row$getValue; + const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase(); + return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search)); +}; +includesString.autoRemove = val => testFalsey(val); +const includesStringSensitive = (row, columnId, filterValue) => { + var _row$getValue2; + return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue)); +}; +includesStringSensitive.autoRemove = val => testFalsey(val); +const equalsString = (row, columnId, filterValue) => { + var _row$getValue3; + return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase()); +}; +equalsString.autoRemove = val => testFalsey(val); +const arrIncludes = (row, columnId, filterValue) => { + var _row$getValue4; + return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue); +}; +arrIncludes.autoRemove = val => testFalsey(val); +const arrIncludesAll = (row, columnId, filterValue) => { + return !filterValue.some(val => { + var _row$getValue5; + return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val)); + }); +}; +arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length); +const arrIncludesSome = (row, columnId, filterValue) => { + return filterValue.some(val => { + var _row$getValue6; + return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val); + }); +}; +arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length); +const equals = (row, columnId, filterValue) => { + return row.getValue(columnId) === filterValue; +}; +equals.autoRemove = val => testFalsey(val); +const weakEquals = (row, columnId, filterValue) => { + return row.getValue(columnId) == filterValue; +}; +weakEquals.autoRemove = val => testFalsey(val); +const inNumberRange = (row, columnId, filterValue) => { + let [min, max] = filterValue; + const rowValue = row.getValue(columnId); + return rowValue >= min && rowValue <= max; +}; +inNumberRange.resolveFilterValue = val => { + let [unsafeMin, unsafeMax] = val; + let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin; + let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax; + let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin; + let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax; + if (min > max) { + const temp = min; + min = max; + max = temp; + } + return [min, max]; +}; +inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); + +// Export + +const filterFns = { + includesString, + includesStringSensitive, + equalsString, + arrIncludes, + arrIncludesAll, + arrIncludesSome, + equals, + weakEquals, + inNumberRange +}; +// Utils + +function testFalsey(val) { + return val === undefined || val === null || val === ''; +} + +exports.filterFns = filterFns; +//# sourceMappingURL=filterFns.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/filterFns.js.map b/node_modules/@tanstack/table-core/build/lib/filterFns.js.map new file mode 100644 index 00000000..e102b611 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/filterFns.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filterFns.js","sources":["../../src/filterFns.ts"],"sourcesContent":["import { FilterFn } from './features/ColumnFiltering'\n\nconst includesString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n const search = filterValue?.toString()?.toLowerCase()\n return Boolean(\n row\n .getValue(columnId)\n ?.toString()\n ?.toLowerCase()\n ?.includes(search)\n )\n}\n\nincludesString.autoRemove = (val: any) => testFalsey(val)\n\nconst includesStringSensitive: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return Boolean(\n row.getValue(columnId)?.toString()?.includes(filterValue)\n )\n}\n\nincludesStringSensitive.autoRemove = (val: any) => testFalsey(val)\n\nconst equalsString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return (\n row.getValue(columnId)?.toString()?.toLowerCase() ===\n filterValue?.toLowerCase()\n )\n}\n\nequalsString.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludes: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId)?.includes(filterValue)\n}\n\narrIncludes.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludesAll: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return !filterValue.some(\n val => !row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst arrIncludesSome: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return filterValue.some(val =>\n row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesSome.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst equals: FilterFn = (row, columnId: string, filterValue: unknown) => {\n return row.getValue(columnId) === filterValue\n}\n\nequals.autoRemove = (val: any) => testFalsey(val)\n\nconst weakEquals: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId) == filterValue\n}\n\nweakEquals.autoRemove = (val: any) => testFalsey(val)\n\nconst inNumberRange: FilterFn = (\n row,\n columnId: string,\n filterValue: [number, number]\n) => {\n let [min, max] = filterValue\n\n const rowValue = row.getValue(columnId)\n return rowValue >= min && rowValue <= max\n}\n\ninNumberRange.resolveFilterValue = (val: [any, any]) => {\n let [unsafeMin, unsafeMax] = val\n\n let parsedMin =\n typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin\n let parsedMax =\n typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax\n\n let min =\n unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax\n\n if (min > max) {\n const temp = min\n min = max\n max = temp\n }\n\n return [min, max] as const\n}\n\ninNumberRange.autoRemove = (val: any) =>\n testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]))\n\n// Export\n\nexport const filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange,\n}\n\nexport type BuiltInFilterFn = keyof typeof filterFns\n\n// Utils\n\nfunction testFalsey(val: any) {\n return val === undefined || val === null || val === ''\n}\n"],"names":["includesString","row","columnId","filterValue","_filterValue$toString","_row$getValue","search","toString","toLowerCase","Boolean","getValue","includes","autoRemove","val","testFalsey","includesStringSensitive","_row$getValue2","equalsString","_row$getValue3","arrIncludes","_row$getValue4","arrIncludesAll","some","_row$getValue5","length","arrIncludesSome","_row$getValue6","equals","weakEquals","inNumberRange","min","max","rowValue","resolveFilterValue","unsafeMin","unsafeMax","parsedMin","parseFloat","parsedMax","Number","isNaN","Infinity","temp","filterFns","undefined"],"mappings":";;;;;;;;;;;;AAEA,MAAMA,cAA6B,GAAGA,CACpCC,GAAG,EACHC,QAAgB,EAChBC,WAAmB,KAChB;EAAA,IAAAC,qBAAA,EAAAC,aAAA,CAAA;AACH,EAAA,MAAMC,MAAM,G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;AACF,EAAC;AAID;;AAEA,SAASf,UAAUA,CAACD,GAAQ,EAAE;EAC5B,OAAOA,GAAG,KAAK+B,SAAS,IAAI/B,GAAG,KAAK,IAAI,IAAIA,GAAG,KAAK,EAAE,CAAA;AACxD;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/index.d.ts b/node_modules/@tanstack/table-core/build/lib/index.d.ts new file mode 100644 index 00000000..0eb7eb8e --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/index.d.ts @@ -0,0 +1,34 @@ +export * from './columnHelper'; +export * from './types'; +export * from './core/cell'; +export * from './core/column'; +export * from './core/headers'; +export * from './core/row'; +export * from './core/table'; +export * from './features/ColumnFaceting'; +export * from './features/ColumnFiltering'; +export * from './features/ColumnGrouping'; +export * from './features/ColumnOrdering'; +export * from './features/ColumnPinning'; +export * from './features/ColumnSizing'; +export * from './features/ColumnVisibility'; +export * from './features/GlobalFaceting'; +export * from './features/GlobalFiltering'; +export * from './features/RowExpanding'; +export * from './features/RowPagination'; +export * from './features/RowPinning'; +export * from './features/RowSelection'; +export * from './features/RowSorting'; +export * from './utils'; +export * from './utils/getCoreRowModel'; +export * from './utils/getExpandedRowModel'; +export * from './utils/getFacetedMinMaxValues'; +export * from './utils/getFacetedRowModel'; +export * from './utils/getFacetedUniqueValues'; +export * from './utils/getFilteredRowModel'; +export * from './utils/getGroupedRowModel'; +export * from './utils/getPaginationRowModel'; +export * from './utils/getSortedRowModel'; +export * from './aggregationFns'; +export * from './filterFns'; +export * from './sortingFns'; diff --git a/node_modules/@tanstack/table-core/build/lib/index.esm.js b/node_modules/@tanstack/table-core/build/lib/index.esm.js new file mode 100644 index 00000000..3093c8a5 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/index.esm.js @@ -0,0 +1,3526 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +// type Person = { +// firstName: string +// lastName: string +// age: number +// visits: number +// status: string +// progress: number +// createdAt: Date +// nested: { +// foo: [ +// { +// bar: 'bar' +// } +// ] +// bar: { subBar: boolean }[] +// baz: { +// foo: 'foo' +// bar: { +// baz: 'baz' +// } +// } +// } +// } + +// const test: DeepKeys = 'nested.foo.0.bar' +// const test2: DeepKeys = 'nested.bar' + +// const helper = createColumnHelper() + +// helper.accessor('nested.foo', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.foo.0.bar', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.bar', { +// cell: info => info.getValue(), +// }) + +function createColumnHelper() { + return { + accessor: (accessor, column) => { + return typeof accessor === 'function' ? { + ...column, + accessorFn: accessor + } : { + ...column, + accessorKey: accessor + }; + }, + display: column => column, + group: column => column + }; +} + +// Is this type a tuple? + +// If this type is a tuple, what indices are allowed? + +/// + +function functionalUpdate(updater, input) { + return typeof updater === 'function' ? updater(input) : updater; +} +function noop() { + // +} +function makeStateUpdater(key, instance) { + return updater => { + instance.setState(old => { + return { + ...old, + [key]: functionalUpdate(updater, old[key]) + }; + }); + }; +} +function isFunction(d) { + return d instanceof Function; +} +function isNumberArray(d) { + return Array.isArray(d) && d.every(val => typeof val === 'number'); +} +function flattenBy(arr, getChildren) { + const flat = []; + const recurse = subArr => { + subArr.forEach(item => { + flat.push(item); + const children = getChildren(item); + if (children != null && children.length) { + recurse(children); + } + }); + }; + recurse(arr); + return flat; +} +function memo(getDeps, fn, opts) { + let deps = []; + let result; + return depArgs => { + let depTime; + if (opts.key && opts.debug) depTime = Date.now(); + const newDeps = getDeps(depArgs); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep); + if (!depsChanged) { + return result; + } + deps = newDeps; + let resultTime; + if (opts.key && opts.debug) resultTime = Date.now(); + result = fn(...newDeps); + opts == null || opts.onChange == null || opts.onChange(result); + if (opts.key && opts.debug) { + if (opts != null && opts.debug()) { + const depEndTime = Math.round((Date.now() - depTime) * 100) / 100; + const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100; + const resultFpsPercentage = resultEndTime / 16; + const pad = (str, num) => { + str = String(str); + while (str.length < num) { + str = ' ' + str; + } + return str; + }; + console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, ` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key); + } + } + return result; + }; +} +function getMemoOptions(tableOptions, debugLevel, key, onChange) { + return { + debug: () => { + var _tableOptions$debugAl; + return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel]; + }, + key: process.env.NODE_ENV === 'development' && key, + onChange + }; +} + +function createCell(table, row, column, columnId) { + const getRenderValue = () => { + var _cell$getValue; + return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + }; + const cell = { + id: `${row.id}_${column.id}`, + row, + column, + getValue: () => row.getValue(columnId), + renderValue: getRenderValue, + getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({ + table, + column, + row, + cell: cell, + getValue: cell.getValue, + renderValue: cell.renderValue + }), getMemoOptions(table.options, 'debugCells', 'cell.getContext')) + }; + table._features.forEach(feature => { + feature.createCell == null || feature.createCell(cell, column, row, table); + }, {}); + return cell; +} + +function createColumn(table, columnDef, depth, parent) { + var _ref, _resolvedColumnDef$id; + const defaultColumn = table._getDefaultColumnDef(); + const resolvedColumnDef = { + ...defaultColumn, + ...columnDef + }; + const accessorKey = resolvedColumnDef.accessorKey; + let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined; + let accessorFn; + if (resolvedColumnDef.accessorFn) { + accessorFn = resolvedColumnDef.accessorFn; + } else if (accessorKey) { + // Support deep accessor keys + if (accessorKey.includes('.')) { + accessorFn = originalRow => { + let result = originalRow; + for (const key of accessorKey.split('.')) { + var _result; + result = (_result = result) == null ? void 0 : _result[key]; + if (process.env.NODE_ENV !== 'production' && result === undefined) { + console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`); + } + } + return result; + }; + } else { + accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey]; + } + } + if (!id) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); + } + throw new Error(); + } + let column = { + id: `${String(id)}`, + accessorFn, + parent: parent, + depth, + columnDef: resolvedColumnDef, + columns: [], + getFlatColumns: memo(() => [true], () => { + var _column$columns; + return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')), + getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => { + var _column$columns2; + if ((_column$columns2 = column.columns) != null && _column$columns2.length) { + let leafColumns = column.columns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + } + return [column]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')) + }; + for (const feature of table._features) { + feature.createColumn == null || feature.createColumn(column, table); + } + + // Yes, we have to convert table to unknown, because we know more than the compiler here. + return column; +} + +const debug = 'debugHeaders'; +// + +function createHeader(table, column, options) { + var _options$id; + const id = (_options$id = options.id) != null ? _options$id : column.id; + let header = { + id, + column, + index: options.index, + isPlaceholder: !!options.isPlaceholder, + placeholderId: options.placeholderId, + depth: options.depth, + subHeaders: [], + colSpan: 0, + rowSpan: 0, + headerGroup: null, + getLeafHeaders: () => { + const leafHeaders = []; + const recurseHeader = h => { + if (h.subHeaders && h.subHeaders.length) { + h.subHeaders.map(recurseHeader); + } + leafHeaders.push(h); + }; + recurseHeader(header); + return leafHeaders; + }, + getContext: () => ({ + table, + header: header, + column + }) + }; + table._features.forEach(feature => { + feature.createHeader == null || feature.createHeader(header, table); + }); + return header; +} +const Headers = { + createTable: table => { + // Header Groups + + table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + var _left$map$filter, _right$map$filter; + const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; + const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; + const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); + return headerGroups; + }, getMemoOptions(table.options, debug, 'getHeaderGroups')); + table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + return buildHeaderGroups(allColumns, leafColumns, table, 'center'); + }, getMemoOptions(table.options, debug, 'getCenterHeaderGroups')); + table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => { + var _left$map$filter2; + const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left'); + }, getMemoOptions(table.options, debug, 'getLeftHeaderGroups')); + table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => { + var _right$map$filter2; + const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right'); + }, getMemoOptions(table.options, debug, 'getRightHeaderGroups')); + + // Footer Groups + + table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getFooterGroups')); + table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getLeftFooterGroups')); + table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getCenterFooterGroups')); + table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getRightFooterGroups')); + + // Flat Headers + + table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => { + return headerGroups.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getFlatHeaders')); + table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeftFlatHeaders')); + table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getCenterFlatHeaders')); + table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getRightFlatHeaders')); + + // Leaf Headers + + table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders; + return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); + }); + }, getMemoOptions(table.options, debug, 'getCenterLeafHeaders')); + table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders2; + return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); + }); + }, getMemoOptions(table.options, debug, 'getLeftLeafHeaders')); + table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders3; + return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); + }); + }, getMemoOptions(table.options, debug, 'getRightLeafHeaders')); + table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => { + var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$; + return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => { + return header.getLeafHeaders(); + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeafHeaders')); + } +}; +function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { + var _headerGroups$0$heade, _headerGroups$; + // Find the max depth of the columns: + // build the leaf column row + // build each buffer row going up + // placeholder for non-existent level + // real column for existing level + + let maxDepth = 0; + const findMaxDepth = function (columns, depth) { + if (depth === void 0) { + depth = 1; + } + maxDepth = Math.max(maxDepth, depth); + columns.filter(column => column.getIsVisible()).forEach(column => { + var _column$columns; + if ((_column$columns = column.columns) != null && _column$columns.length) { + findMaxDepth(column.columns, depth + 1); + } + }, 0); + }; + findMaxDepth(allColumns); + let headerGroups = []; + const createHeaderGroup = (headersToGroup, depth) => { + // The header group we are creating + const headerGroup = { + depth, + id: [headerFamily, `${depth}`].filter(Boolean).join('_'), + headers: [] + }; + + // The parent columns we're going to scan next + const pendingParentHeaders = []; + + // Scan each column for parents + headersToGroup.forEach(headerToGroup => { + // What is the latest (last) parent column? + + const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]; + const isLeafHeader = headerToGroup.column.depth === headerGroup.depth; + let column; + let isPlaceholder = false; + if (isLeafHeader && headerToGroup.column.parent) { + // The parent header is new + column = headerToGroup.column.parent; + } else { + // The parent header is repeated + column = headerToGroup.column; + isPlaceholder = true; + } + if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) { + // This column is repeated. Add it as a sub header to the next batch + latestPendingParentHeader.subHeaders.push(headerToGroup); + } else { + // This is a new header. Let's create it + const header = createHeader(table, column, { + id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'), + isPlaceholder, + placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined, + depth, + index: pendingParentHeaders.length + }); + + // Add the headerToGroup as a subHeader of the new header + header.subHeaders.push(headerToGroup); + // Add the new header to the pendingParentHeaders to get grouped + // in the next batch + pendingParentHeaders.push(header); + } + headerGroup.headers.push(headerToGroup); + headerToGroup.headerGroup = headerGroup; + }); + headerGroups.push(headerGroup); + if (depth > 0) { + createHeaderGroup(pendingParentHeaders, depth - 1); + } + }; + const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, { + depth: maxDepth, + index + })); + createHeaderGroup(bottomHeaders, maxDepth - 1); + headerGroups.reverse(); + + // headerGroups = headerGroups.filter(headerGroup => { + // return !headerGroup.headers.every(header => header.isPlaceholder) + // }) + + const recurseHeadersForSpans = headers => { + const filteredHeaders = headers.filter(header => header.column.getIsVisible()); + return filteredHeaders.map(header => { + let colSpan = 0; + let rowSpan = 0; + let childRowSpans = [0]; + if (header.subHeaders && header.subHeaders.length) { + childRowSpans = []; + recurseHeadersForSpans(header.subHeaders).forEach(_ref => { + let { + colSpan: childColSpan, + rowSpan: childRowSpan + } = _ref; + colSpan += childColSpan; + childRowSpans.push(childRowSpan); + }); + } else { + colSpan = 1; + } + const minChildRowSpan = Math.min(...childRowSpans); + rowSpan = rowSpan + minChildRowSpan; + header.colSpan = colSpan; + header.rowSpan = rowSpan; + return { + colSpan, + rowSpan + }; + }); + }; + recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); + return headerGroups; +} + +const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => { + let row = { + id, + index: rowIndex, + original, + depth, + parentId, + _valuesCache: {}, + _uniqueValuesCache: {}, + getValue: columnId => { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex); + return row._valuesCache[columnId]; + }, + getUniqueValues: columnId => { + if (row._uniqueValuesCache.hasOwnProperty(columnId)) { + return row._uniqueValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + if (!column.columnDef.getUniqueValues) { + row._uniqueValuesCache[columnId] = [row.getValue(columnId)]; + return row._uniqueValuesCache[columnId]; + } + row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex); + return row._uniqueValuesCache[columnId]; + }, + renderValue: columnId => { + var _row$getValue; + return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; + }, + subRows: subRows != null ? subRows : [], + getLeafRows: () => flattenBy(row.subRows, d => d.subRows), + getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined, + getParentRows: () => { + let parentRows = []; + let currentRow = row; + while (true) { + const parentRow = currentRow.getParentRow(); + if (!parentRow) break; + parentRows.push(parentRow); + currentRow = parentRow; + } + return parentRows.reverse(); + }, + getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => { + return leafColumns.map(column => { + return createCell(table, row, column, column.id); + }); + }, getMemoOptions(table.options, 'debugRows', 'getAllCells')), + _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => { + return allCells.reduce((acc, cell) => { + acc[cell.column.id] = cell; + return acc; + }, {}); + }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')) + }; + for (let i = 0; i < table._features.length; i++) { + const feature = table._features[i]; + feature == null || feature.createRow == null || feature.createRow(row, table); + } + return row; +}; + +// + +const ColumnFaceting = { + createColumn: (column, table) => { + column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id); + column.getFacetedRowModel = () => { + if (!column._getFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return column._getFacetedRowModel(); + }; + column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id); + column.getFacetedUniqueValues = () => { + if (!column._getFacetedUniqueValues) { + return new Map(); + } + return column._getFacetedUniqueValues(); + }; + column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id); + column.getFacetedMinMaxValues = () => { + if (!column._getFacetedMinMaxValues) { + return undefined; + } + return column._getFacetedMinMaxValues(); + }; + } +}; + +const includesString = (row, columnId, filterValue) => { + var _filterValue$toString, _row$getValue; + const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase(); + return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search)); +}; +includesString.autoRemove = val => testFalsey(val); +const includesStringSensitive = (row, columnId, filterValue) => { + var _row$getValue2; + return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue)); +}; +includesStringSensitive.autoRemove = val => testFalsey(val); +const equalsString = (row, columnId, filterValue) => { + var _row$getValue3; + return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase()); +}; +equalsString.autoRemove = val => testFalsey(val); +const arrIncludes = (row, columnId, filterValue) => { + var _row$getValue4; + return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue); +}; +arrIncludes.autoRemove = val => testFalsey(val); +const arrIncludesAll = (row, columnId, filterValue) => { + return !filterValue.some(val => { + var _row$getValue5; + return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val)); + }); +}; +arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length); +const arrIncludesSome = (row, columnId, filterValue) => { + return filterValue.some(val => { + var _row$getValue6; + return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val); + }); +}; +arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length); +const equals = (row, columnId, filterValue) => { + return row.getValue(columnId) === filterValue; +}; +equals.autoRemove = val => testFalsey(val); +const weakEquals = (row, columnId, filterValue) => { + return row.getValue(columnId) == filterValue; +}; +weakEquals.autoRemove = val => testFalsey(val); +const inNumberRange = (row, columnId, filterValue) => { + let [min, max] = filterValue; + const rowValue = row.getValue(columnId); + return rowValue >= min && rowValue <= max; +}; +inNumberRange.resolveFilterValue = val => { + let [unsafeMin, unsafeMax] = val; + let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin; + let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax; + let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin; + let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax; + if (min > max) { + const temp = min; + min = max; + max = temp; + } + return [min, max]; +}; +inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); + +// Export + +const filterFns = { + includesString, + includesStringSensitive, + equalsString, + arrIncludes, + arrIncludesAll, + arrIncludesSome, + equals, + weakEquals, + inNumberRange +}; +// Utils + +function testFalsey(val) { + return val === undefined || val === null || val === ''; +} + +// + +const ColumnFiltering = { + getDefaultColumnDef: () => { + return { + filterFn: 'auto' + }; + }, + getInitialState: state => { + return { + columnFilters: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnFiltersChange: makeStateUpdater('columnFilters', table), + filterFromLeafRows: false, + maxLeafRowFilterDepth: 100 + }; + }, + createColumn: (column, table) => { + column.getAutoFilterFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return filterFns.includesString; + } + if (typeof value === 'number') { + return filterFns.inNumberRange; + } + if (typeof value === 'boolean') { + return filterFns.equals; + } + if (value !== null && typeof value === 'object') { + return filterFns.equals; + } + if (Array.isArray(value)) { + return filterFns.arrIncludes; + } + return filterFns.weakEquals; + }; + column.getFilterFn = () => { + var _table$options$filter, _table$options$filter2; + return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore + (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn]; + }; + column.getCanFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2; + return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn; + }; + column.getIsFiltered = () => column.getFilterIndex() > -1; + column.getFilterValue = () => { + var _table$getState$colum; + return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value; + }; + column.getFilterIndex = () => { + var _table$getState$colum2, _table$getState$colum3; + return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1; + }; + column.setFilterValue = value => { + table.setColumnFilters(old => { + const filterFn = column.getFilterFn(); + const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id); + const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined); + + // + if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { + var _old$filter; + return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : []; + } + const newFilterObj = { + id: column.id, + value: newFilter + }; + if (previousFilter) { + var _old$map; + return (_old$map = old == null ? void 0 : old.map(d => { + if (d.id === column.id) { + return newFilterObj; + } + return d; + })) != null ? _old$map : []; + } + if (old != null && old.length) { + return [...old, newFilterObj]; + } + return [newFilterObj]; + }); + }; + }, + createRow: (row, _table) => { + row.columnFilters = {}; + row.columnFiltersMeta = {}; + }, + createTable: table => { + table.setColumnFilters = updater => { + const leafColumns = table.getAllLeafColumns(); + const updateFn = old => { + var _functionalUpdate; + return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => { + const column = leafColumns.find(d => d.id === filter.id); + if (column) { + const filterFn = column.getFilterFn(); + if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { + return false; + } + } + return true; + }); + }; + table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn); + }; + table.resetColumnFilters = defaultState => { + var _table$initialState$c, _table$initialState; + table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); + }; + table.getPreFilteredRowModel = () => table.getCoreRowModel(); + table.getFilteredRowModel = () => { + if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { + table._getFilteredRowModel = table.options.getFilteredRowModel(table); + } + if (table.options.manualFiltering || !table._getFilteredRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getFilteredRowModel(); + }; + } +}; +function shouldAutoRemoveFilter(filterFn, value, column) { + return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value; +} + +const sum = (columnId, _leafRows, childRows) => { + // It's faster to just add the aggregations together instead of + // process leaf nodes individually + return childRows.reduce((sum, next) => { + const nextValue = next.getValue(columnId); + return sum + (typeof nextValue === 'number' ? nextValue : 0); + }, 0); +}; +const min = (columnId, _leafRows, childRows) => { + let min; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (min > value || min === undefined && value >= value)) { + min = value; + } + }); + return min; +}; +const max = (columnId, _leafRows, childRows) => { + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (max < value || max === undefined && value >= value)) { + max = value; + } + }); + return max; +}; +const extent = (columnId, _leafRows, childRows) => { + let min; + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null) { + if (min === undefined) { + if (value >= value) min = max = value; + } else { + if (min > value) min = value; + if (max < value) max = value; + } + } + }); + return [min, max]; +}; +const mean = (columnId, leafRows) => { + let count = 0; + let sum = 0; + leafRows.forEach(row => { + let value = row.getValue(columnId); + if (value != null && (value = +value) >= value) { + ++count, sum += value; + } + }); + if (count) return sum / count; + return; +}; +const median = (columnId, leafRows) => { + if (!leafRows.length) { + return; + } + const values = leafRows.map(row => row.getValue(columnId)); + if (!isNumberArray(values)) { + return; + } + if (values.length === 1) { + return values[0]; + } + const mid = Math.floor(values.length / 2); + const nums = values.sort((a, b) => a - b); + return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2; +}; +const unique = (columnId, leafRows) => { + return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values()); +}; +const uniqueCount = (columnId, leafRows) => { + return new Set(leafRows.map(d => d.getValue(columnId))).size; +}; +const count = (_columnId, leafRows) => { + return leafRows.length; +}; +const aggregationFns = { + sum, + min, + max, + extent, + mean, + median, + unique, + uniqueCount, + count +}; + +// + +const ColumnGrouping = { + getDefaultColumnDef: () => { + return { + aggregatedCell: props => { + var _toString, _props$getValue; + return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null; + }, + aggregationFn: 'auto' + }; + }, + getInitialState: state => { + return { + grouping: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onGroupingChange: makeStateUpdater('grouping', table), + groupedColumnMode: 'reorder' + }; + }, + createColumn: (column, table) => { + column.toggleGrouping = () => { + table.setGrouping(old => { + // Find any existing grouping for this column + if (old != null && old.includes(column.id)) { + return old.filter(d => d !== column.id); + } + return [...(old != null ? old : []), column.id]; + }); + }; + column.getCanGroup = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue); + }; + column.getIsGrouped = () => { + var _table$getState$group; + return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id); + }; + column.getGroupedIndex = () => { + var _table$getState$group2; + return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id); + }; + column.getToggleGroupingHandler = () => { + const canGroup = column.getCanGroup(); + return () => { + if (!canGroup) return; + column.toggleGrouping(); + }; + }; + column.getAutoAggregationFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'number') { + return aggregationFns.sum; + } + if (Object.prototype.toString.call(value) === '[object Date]') { + return aggregationFns.extent; + } + }; + column.getAggregationFn = () => { + var _table$options$aggreg, _table$options$aggreg2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn]; + }; + }, + createTable: table => { + table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater); + table.resetGrouping = defaultState => { + var _table$initialState$g, _table$initialState; + table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); + }; + table.getPreGroupedRowModel = () => table.getFilteredRowModel(); + table.getGroupedRowModel = () => { + if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { + table._getGroupedRowModel = table.options.getGroupedRowModel(table); + } + if (table.options.manualGrouping || !table._getGroupedRowModel) { + return table.getPreGroupedRowModel(); + } + return table._getGroupedRowModel(); + }; + }, + createRow: (row, table) => { + row.getIsGrouped = () => !!row.groupingColumnId; + row.getGroupingValue = columnId => { + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.columnDef.getGroupingValue)) { + return row.getValue(columnId); + } + row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original); + return row._groupingValuesCache[columnId]; + }; + row._groupingValuesCache = {}; + }, + createCell: (cell, column, row, table) => { + cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId; + cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped(); + cell.getIsAggregated = () => { + var _row$subRows; + return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + } +}; +function orderColumns(leafColumns, grouping, groupedColumnMode) { + if (!(grouping != null && grouping.length) || !groupedColumnMode) { + return leafColumns; + } + const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id)); + if (groupedColumnMode === 'remove') { + return nonGroupingColumns; + } + const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean); + return [...groupingColumns, ...nonGroupingColumns]; +} + +// + +const ColumnOrdering = { + getInitialState: state => { + return { + columnOrder: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnOrderChange: makeStateUpdater('columnOrder', table) + }; + }, + createColumn: (column, table) => { + column.getIndex = memo(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex')); + column.getIsFirstColumn = position => { + var _columns$; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id; + }; + column.getIsLastColumn = position => { + var _columns; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id; + }; + }, + createTable: table => { + table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater); + table.resetColumnOrder = defaultState => { + var _table$initialState$c; + table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); + }; + table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => { + // Sort grouped columns to the start of the column list + // before the headers are built + let orderedColumns = []; + + // If there is no order, return the normal columns + if (!(columnOrder != null && columnOrder.length)) { + orderedColumns = columns; + } else { + const columnOrderCopy = [...columnOrder]; + + // If there is an order, make a copy of the columns + const columnsCopy = [...columns]; + + // And make a new ordered array of the columns + + // Loop over the columns and place them in order into the new array + while (columnsCopy.length && columnOrderCopy.length) { + const targetColumnId = columnOrderCopy.shift(); + const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId); + if (foundIndex > -1) { + orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); + } + } + + // If there are any columns left, add them to the end + orderedColumns = [...orderedColumns, ...columnsCopy]; + } + return orderColumns(orderedColumns, grouping, groupedColumnMode); + }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')); + } +}; + +// + +const getDefaultColumnPinningState = () => ({ + left: [], + right: [] +}); +const ColumnPinning = { + getInitialState: state => { + return { + columnPinning: getDefaultColumnPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnPinningChange: makeStateUpdater('columnPinning', table) + }; + }, + createColumn: (column, table) => { + column.pin = position => { + const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean); + table.setColumnPinning(old => { + var _old$left3, _old$right3; + if (position === 'right') { + var _old$left, _old$right; + return { + left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds] + }; + } + if (position === 'left') { + var _old$left2, _old$right2; + return { + left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds], + right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + } + return { + left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + }); + }; + column.getCanPin = () => { + const leafColumns = column.getLeafColumns(); + return leafColumns.some(d => { + var _d$columnDef$enablePi, _ref, _table$options$enable; + return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true); + }); + }; + column.getIsPinned = () => { + const leafColumnIds = column.getLeafColumns().map(d => d.id); + const { + left, + right + } = table.getState().columnPinning; + const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d)); + const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d)); + return isLeft ? 'left' : isRight ? 'right' : false; + }; + column.getPinnedIndex = () => { + var _table$getState$colum, _table$getState$colum2; + const position = column.getIsPinned(); + return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0; + }; + }, + createRow: (row, table) => { + row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allCells.filter(d => !leftAndRight.includes(d.column.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')); + row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => { + const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'left' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')); + row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { + const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'right' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')); + }, + createTable: table => { + table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater); + table.resetColumnPinning = defaultState => { + var _table$initialState$c, _table$initialState; + return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState()); + }; + table.getIsSomeColumnsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().columnPinning; + if (!position) { + var _pinningState$left, _pinningState$right; + return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { + return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')); + table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { + return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')); + table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allColumns.filter(d => !leftAndRight.includes(d.id)); + }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')); + } +}; + +function safelyAccessDocument(_document) { + return _document || (typeof document !== 'undefined' ? document : null); +} + +// + +// + +const defaultColumnSizing = { + size: 150, + minSize: 20, + maxSize: Number.MAX_SAFE_INTEGER +}; +const getDefaultColumnSizingInfoState = () => ({ + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + isResizingColumn: false, + columnSizingStart: [] +}); +const ColumnSizing = { + getDefaultColumnDef: () => { + return defaultColumnSizing; + }, + getInitialState: state => { + return { + columnSizing: {}, + columnSizingInfo: getDefaultColumnSizingInfoState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + columnResizeMode: 'onEnd', + columnResizeDirection: 'ltr', + onColumnSizingChange: makeStateUpdater('columnSizing', table), + onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table) + }; + }, + createColumn: (column, table) => { + column.getSize = () => { + var _column$columnDef$min, _ref, _column$columnDef$max; + const columnSize = table.getState().columnSizing[column.id]; + return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); + }; + column.getStart = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart')); + column.getAfter = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter')); + column.resetSize = () => { + table.setColumnSizing(_ref2 => { + let { + [column.id]: _, + ...rest + } = _ref2; + return rest; + }); + }; + column.getCanResize = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); + }; + column.getIsResizing = () => { + return table.getState().columnSizingInfo.isResizingColumn === column.id; + }; + }, + createHeader: (header, table) => { + header.getSize = () => { + let sum = 0; + const recurse = header => { + if (header.subHeaders.length) { + header.subHeaders.forEach(recurse); + } else { + var _header$column$getSiz; + sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0; + } + }; + recurse(header); + return sum; + }; + header.getStart = () => { + if (header.index > 0) { + const prevSiblingHeader = header.headerGroup.headers[header.index - 1]; + return prevSiblingHeader.getStart() + prevSiblingHeader.getSize(); + } + return 0; + }; + header.getResizeHandler = _contextDocument => { + const column = table.getColumn(header.column.id); + const canResize = column == null ? void 0 : column.getCanResize(); + return e => { + if (!column || !canResize) { + return; + } + e.persist == null || e.persist(); + if (isTouchStartEvent(e)) { + // lets not respond to multiple touches (e.g. 2 or 3 fingers) + if (e.touches && e.touches.length > 1) { + return; + } + } + const startSize = header.getSize(); + const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]]; + const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX; + const newColumnSizing = {}; + const updateOffset = (eventType, clientXPos) => { + if (typeof clientXPos !== 'number') { + return; + } + table.setColumnSizingInfo(old => { + var _old$startOffset, _old$startSize; + const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1; + const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection; + const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); + old.columnSizingStart.forEach(_ref3 => { + let [columnId, headerSize] = _ref3; + newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100; + }); + return { + ...old, + deltaOffset, + deltaPercentage + }; + }); + if (table.options.columnResizeMode === 'onChange' || eventType === 'end') { + table.setColumnSizing(old => ({ + ...old, + ...newColumnSizing + })); + } + }; + const onMove = clientXPos => updateOffset('move', clientXPos); + const onEnd = clientXPos => { + updateOffset('end', clientXPos); + table.setColumnSizingInfo(old => ({ + ...old, + isResizingColumn: false, + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + columnSizingStart: [] + })); + }; + const contextDocument = safelyAccessDocument(_contextDocument); + const mouseEvents = { + moveHandler: e => onMove(e.clientX), + upHandler: e => { + contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler); + onEnd(e.clientX); + } + }; + const touchEvents = { + moveHandler: e => { + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onMove(e.touches[0].clientX); + return false; + }, + upHandler: e => { + var _e$touches$; + contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler); + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX); + } + }; + const passiveIfSupported = passiveEventSupported() ? { + passive: false + } : false; + if (isTouchStartEvent(e)) { + contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported); + } else { + contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported); + } + table.setColumnSizingInfo(old => ({ + ...old, + startOffset: clientX, + startSize, + deltaOffset: 0, + deltaPercentage: 0, + columnSizingStart, + isResizingColumn: column.id + })); + }; + }; + }, + createTable: table => { + table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater); + table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater); + table.resetColumnSizing = defaultState => { + var _table$initialState$c; + table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); + }; + table.resetHeaderSizeInfo = defaultState => { + var _table$initialState$c2; + table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); + }; + table.getTotalSize = () => { + var _table$getHeaderGroup, _table$getHeaderGroup2; + return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getHeaderGroup : 0; + }; + table.getLeftTotalSize = () => { + var _table$getLeftHeaderG, _table$getLeftHeaderG2; + return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getLeftHeaderG : 0; + }; + table.getCenterTotalSize = () => { + var _table$getCenterHeade, _table$getCenterHeade2; + return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getCenterHeade : 0; + }; + table.getRightTotalSize = () => { + var _table$getRightHeader, _table$getRightHeader2; + return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getRightHeader : 0; + }; + } +}; +let passiveSupported = null; +function passiveEventSupported() { + if (typeof passiveSupported === 'boolean') return passiveSupported; + let supported = false; + try { + const options = { + get passive() { + supported = true; + return false; + } + }; + const noop = () => {}; + window.addEventListener('test', noop, options); + window.removeEventListener('test', noop); + } catch (err) { + supported = false; + } + passiveSupported = supported; + return passiveSupported; +} +function isTouchStartEvent(e) { + return e.type === 'touchstart'; +} + +// + +const ColumnVisibility = { + getInitialState: state => { + return { + columnVisibility: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnVisibilityChange: makeStateUpdater('columnVisibility', table) + }; + }, + createColumn: (column, table) => { + column.toggleVisibility = value => { + if (column.getCanHide()) { + table.setColumnVisibility(old => ({ + ...old, + [column.id]: value != null ? value : !column.getIsVisible() + })); + } + }; + column.getIsVisible = () => { + var _ref, _table$getState$colum; + const childColumns = column.columns; + return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true; + }; + column.getCanHide = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); + }; + column.getToggleVisibilityHandler = () => { + return e => { + column.toggleVisibility == null || column.toggleVisibility(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => { + return cells.filter(cell => cell.column.getIsVisible()); + }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')); + row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells')); + }, + createTable: table => { + const makeVisibleColumnsMethod = (key, getColumns) => { + return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => { + return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible()); + }, getMemoOptions(table.options, 'debugColumns', key)); + }; + table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()); + table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()); + table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()); + table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()); + table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()); + table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater); + table.resetColumnVisibility = defaultState => { + var _table$initialState$c; + table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); + }; + table.toggleAllColumnsVisible = value => { + var _value; + value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); + table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ + ...obj, + [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value + }), {})); + }; + table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())); + table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()); + table.getToggleAllColumnsVisibilityHandler = () => { + return e => { + var _target; + table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } +}; +function _getVisibleLeafColumns(table, position) { + return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); +} + +// + +const GlobalFaceting = { + createTable: table => { + table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'); + table.getGlobalFacetedRowModel = () => { + if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getGlobalFacetedRowModel(); + }; + table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'); + table.getGlobalFacetedUniqueValues = () => { + if (!table._getGlobalFacetedUniqueValues) { + return new Map(); + } + return table._getGlobalFacetedUniqueValues(); + }; + table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'); + table.getGlobalFacetedMinMaxValues = () => { + if (!table._getGlobalFacetedMinMaxValues) { + return; + } + return table._getGlobalFacetedMinMaxValues(); + }; + } +}; + +// + +const GlobalFiltering = { + getInitialState: state => { + return { + globalFilter: undefined, + ...state + }; + }, + getDefaultOptions: table => { + return { + onGlobalFilterChange: makeStateUpdater('globalFilter', table), + globalFilterFn: 'auto', + getColumnCanGlobalFilter: column => { + var _table$getCoreRowMode; + const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue(); + return typeof value === 'string' || typeof value === 'number'; + } + }; + }, + createColumn: (column, table) => { + column.getCanGlobalFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol; + return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn; + }; + }, + createTable: table => { + table.getGlobalAutoFilterFn = () => { + return filterFns.includesString; + }; + table.getGlobalFilterFn = () => { + var _table$options$filter, _table$options$filter2; + const { + globalFilterFn: globalFilterFn + } = table.options; + return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn]; + }; + table.setGlobalFilter = updater => { + table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater); + }; + table.resetGlobalFilter = defaultState => { + table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter); + }; + } +}; + +// + +const RowExpanding = { + getInitialState: state => { + return { + expanded: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onExpandedChange: makeStateUpdater('expanded', table), + paginateExpandedRows: true + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetExpanded = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetExpanded(); + queued = false; + }); + } + }; + table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater); + table.toggleAllRowsExpanded = expanded => { + if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { + table.setExpanded(true); + } else { + table.setExpanded({}); + } + }; + table.resetExpanded = defaultState => { + var _table$initialState$e, _table$initialState; + table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); + }; + table.getCanSomeRowsExpand = () => { + return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand()); + }; + table.getToggleAllRowsExpandedHandler = () => { + return e => { + e.persist == null || e.persist(); + table.toggleAllRowsExpanded(); + }; + }; + table.getIsSomeRowsExpanded = () => { + const expanded = table.getState().expanded; + return expanded === true || Object.values(expanded).some(Boolean); + }; + table.getIsAllRowsExpanded = () => { + const expanded = table.getState().expanded; + + // If expanded is true, save some cycles and return true + if (typeof expanded === 'boolean') { + return expanded === true; + } + if (!Object.keys(expanded).length) { + return false; + } + + // If any row is not expanded, return false + if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) { + return false; + } + + // They must all be expanded :shrug: + return true; + }; + table.getExpandedDepth = () => { + let maxDepth = 0; + const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); + rowIds.forEach(id => { + const splitId = id.split('.'); + maxDepth = Math.max(maxDepth, splitId.length); + }); + return maxDepth; + }; + table.getPreExpandedRowModel = () => table.getSortedRowModel(); + table.getExpandedRowModel = () => { + if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { + table._getExpandedRowModel = table.options.getExpandedRowModel(table); + } + if (table.options.manualExpanding || !table._getExpandedRowModel) { + return table.getPreExpandedRowModel(); + } + return table._getExpandedRowModel(); + }; + }, + createRow: (row, table) => { + row.toggleExpanded = expanded => { + table.setExpanded(old => { + var _expanded; + const exists = old === true ? true : !!(old != null && old[row.id]); + let oldExpanded = {}; + if (old === true) { + Object.keys(table.getRowModel().rowsById).forEach(rowId => { + oldExpanded[rowId] = true; + }); + } else { + oldExpanded = old; + } + expanded = (_expanded = expanded) != null ? _expanded : !exists; + if (!exists && expanded) { + return { + ...oldExpanded, + [row.id]: true + }; + } + if (exists && !expanded) { + const { + [row.id]: _, + ...rest + } = oldExpanded; + return rest; + } + return old; + }); + }; + row.getIsExpanded = () => { + var _table$options$getIsR; + const expanded = table.getState().expanded; + return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id])); + }; + row.getCanExpand = () => { + var _table$options$getRow, _table$options$enable, _row$subRows; + return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + row.getIsAllParentsExpanded = () => { + let isFullyExpanded = true; + let currentRow = row; + while (isFullyExpanded && currentRow.parentId) { + currentRow = table.getRow(currentRow.parentId, true); + isFullyExpanded = currentRow.getIsExpanded(); + } + return isFullyExpanded; + }; + row.getToggleExpandedHandler = () => { + const canExpand = row.getCanExpand(); + return () => { + if (!canExpand) return; + row.toggleExpanded(); + }; + }; + } +}; + +// + +const defaultPageIndex = 0; +const defaultPageSize = 10; +const getDefaultPaginationState = () => ({ + pageIndex: defaultPageIndex, + pageSize: defaultPageSize +}); +const RowPagination = { + getInitialState: state => { + return { + ...state, + pagination: { + ...getDefaultPaginationState(), + ...(state == null ? void 0 : state.pagination) + } + }; + }, + getDefaultOptions: table => { + return { + onPaginationChange: makeStateUpdater('pagination', table) + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetPageIndex = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetPageIndex(); + queued = false; + }); + } + }; + table.setPagination = updater => { + const safeUpdater = old => { + let newState = functionalUpdate(updater, old); + return newState; + }; + return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); + }; + table.resetPagination = defaultState => { + var _table$initialState$p; + table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); + }; + table.setPageIndex = updater => { + table.setPagination(old => { + let pageIndex = functionalUpdate(updater, old.pageIndex); + const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1; + pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex)); + return { + ...old, + pageIndex + }; + }); + }; + table.resetPageIndex = defaultState => { + var _table$initialState$p2, _table$initialState; + table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); + }; + table.resetPageSize = defaultState => { + var _table$initialState$p3, _table$initialState2; + table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize); + }; + table.setPageSize = updater => { + table.setPagination(old => { + const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize)); + const topRowIndex = old.pageSize * old.pageIndex; + const pageIndex = Math.floor(topRowIndex / pageSize); + return { + ...old, + pageIndex, + pageSize + }; + }); + }; + //deprecated + table.setPageCount = updater => table.setPagination(old => { + var _table$options$pageCo; + let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); + if (typeof newPageCount === 'number') { + newPageCount = Math.max(-1, newPageCount); + } + return { + ...old, + pageCount: newPageCount + }; + }); + table.getPageOptions = memo(() => [table.getPageCount()], pageCount => { + let pageOptions = []; + if (pageCount && pageCount > 0) { + pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i); + } + return pageOptions; + }, getMemoOptions(table.options, 'debugTable', 'getPageOptions')); + table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0; + table.getCanNextPage = () => { + const { + pageIndex + } = table.getState().pagination; + const pageCount = table.getPageCount(); + if (pageCount === -1) { + return true; + } + if (pageCount === 0) { + return false; + } + return pageIndex < pageCount - 1; + }; + table.previousPage = () => { + return table.setPageIndex(old => old - 1); + }; + table.nextPage = () => { + return table.setPageIndex(old => { + return old + 1; + }); + }; + table.firstPage = () => { + return table.setPageIndex(0); + }; + table.lastPage = () => { + return table.setPageIndex(table.getPageCount() - 1); + }; + table.getPrePaginationRowModel = () => table.getExpandedRowModel(); + table.getPaginationRowModel = () => { + if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { + table._getPaginationRowModel = table.options.getPaginationRowModel(table); + } + if (table.options.manualPagination || !table._getPaginationRowModel) { + return table.getPrePaginationRowModel(); + } + return table._getPaginationRowModel(); + }; + table.getPageCount = () => { + var _table$options$pageCo2; + return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize); + }; + table.getRowCount = () => { + var _table$options$rowCou; + return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length; + }; + } +}; + +// + +const getDefaultRowPinningState = () => ({ + top: [], + bottom: [] +}); +const RowPinning = { + getInitialState: state => { + return { + rowPinning: getDefaultRowPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowPinningChange: makeStateUpdater('rowPinning', table) + }; + }, + createRow: (row, table) => { + row.pin = (position, includeLeafRows, includeParentRows) => { + const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => { + let { + id + } = _ref; + return id; + }) : []; + const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => { + let { + id + } = _ref2; + return id; + }) : []; + const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]); + table.setRowPinning(old => { + var _old$top3, _old$bottom3; + if (position === 'bottom') { + var _old$top, _old$bottom; + return { + top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)] + }; + } + if (position === 'top') { + var _old$top2, _old$bottom2; + return { + top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)], + bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + } + return { + top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + }); + }; + row.getCanPin = () => { + var _ref3; + const { + enableRowPinning, + enablePinning + } = table.options; + if (typeof enableRowPinning === 'function') { + return enableRowPinning(row); + } + return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true; + }; + row.getIsPinned = () => { + const rowIds = [row.id]; + const { + top, + bottom + } = table.getState().rowPinning; + const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d)); + const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d)); + return isTop ? 'top' : isBottom ? 'bottom' : false; + }; + row.getPinnedIndex = () => { + var _ref4, _visiblePinnedRowIds$; + const position = row.getIsPinned(); + if (!position) return -1; + const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => { + let { + id + } = _ref5; + return id; + }); + return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1; + }; + }, + createTable: table => { + table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater); + table.resetRowPinning = defaultState => { + var _table$initialState$r, _table$initialState; + return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState()); + }; + table.getIsSomeRowsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().rowPinning; + if (!position) { + var _pinningState$top, _pinningState$bottom; + return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table._getPinnedRows = (visibleRows, pinnedRowIds, position) => { + var _table$options$keepPi; + const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? + //get all rows that are pinned even if they would not be otherwise visible + //account for expanded parent rows, but not pagination or filtering + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => { + const row = table.getRow(rowId, true); + return row.getIsAllParentsExpanded() ? row : null; + }) : + //else get only visible rows that are pinned + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId)); + return rows.filter(Boolean).map(d => ({ + ...d, + position + })); + }; + table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows')); + table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows')); + table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => { + const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]); + return allRows.filter(d => !topAndBottom.has(d.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterRows')); + } +}; + +// + +const RowSelection = { + getInitialState: state => { + return { + rowSelection: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowSelectionChange: makeStateUpdater('rowSelection', table), + enableRowSelection: true, + enableMultiRowSelection: true, + enableSubRowSelection: true + // enableGroupingRowSelection: false, + // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey, + // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey, + }; + }, + createTable: table => { + table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater); + table.resetRowSelection = defaultState => { + var _table$initialState$r; + return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); + }; + table.toggleAllRowsSelected = value => { + table.setRowSelection(old => { + value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected(); + const rowSelection = { + ...old + }; + const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; + + // We don't use `mutateRowIsSelected` here for performance reasons. + // All of the rows are flat already, so it wouldn't be worth it + if (value) { + preGroupedFlatRows.forEach(row => { + if (!row.getCanSelect()) { + return; + } + rowSelection[row.id] = true; + }); + } else { + preGroupedFlatRows.forEach(row => { + delete rowSelection[row.id]; + }); + } + return rowSelection; + }); + }; + table.toggleAllPageRowsSelected = value => table.setRowSelection(old => { + const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected(); + const rowSelection = { + ...old + }; + table.getRowModel().rows.forEach(row => { + mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table); + }); + return rowSelection; + }); + + // addRowSelectionRange: rowId => { + // const { + // rows, + // rowsById, + // options: { selectGroupingRows, selectSubRows }, + // } = table + + // const findSelectedRow = (rows: Row[]) => { + // let found + // rows.find(d => { + // if (d.getIsSelected()) { + // found = d + // return true + // } + // const subFound = findSelectedRow(d.subRows || []) + // if (subFound) { + // found = subFound + // return true + // } + // return false + // }) + // return found + // } + + // const firstRow = findSelectedRow(rows) || rows[0] + // const lastRow = rowsById[rowId] + + // let include = false + // const selectedRowIds = {} + + // const addRow = (row: Row) => { + // mutateRowIsSelected(selectedRowIds, row.id, true, { + // rowsById, + // selectGroupingRows: selectGroupingRows!, + // selectSubRows: selectSubRows!, + // }) + // } + + // table.rows.forEach(row => { + // const isFirstRow = row.id === firstRow.id + // const isLastRow = row.id === lastRow.id + + // if (isFirstRow || isLastRow) { + // if (!include) { + // include = true + // } else if (include) { + // addRow(row) + // include = false + // } + // } + + // if (include) { + // addRow(row) + // } + // }) + + // table.setRowSelection(selectedRowIds) + // }, + table.getPreSelectedRowModel = () => table.getCoreRowModel(); + table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')); + table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')); + table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')); + + /// + + // getGroupingRowCanSelect: rowId => { + // const row = table.getRow(rowId) + + // if (!row) { + // throw new Error() + // } + + // if (typeof table.options.enableGroupingRowSelection === 'function') { + // return table.options.enableGroupingRowSelection(row) + // } + + // return table.options.enableGroupingRowSelection ?? false + // }, + + table.getIsAllRowsSelected = () => { + const preGroupedFlatRows = table.getFilteredRowModel().flatRows; + const { + rowSelection + } = table.getState(); + let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); + if (isAllRowsSelected) { + if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) { + isAllRowsSelected = false; + } + } + return isAllRowsSelected; + }; + table.getIsAllPageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect()); + const { + rowSelection + } = table.getState(); + let isAllPageRowsSelected = !!paginationFlatRows.length; + if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) { + isAllPageRowsSelected = false; + } + return isAllPageRowsSelected; + }; + table.getIsSomeRowsSelected = () => { + var _table$getState$rowSe; + const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; + return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; + }; + table.getIsSomePageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows; + return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected()); + }; + table.getToggleAllRowsSelectedHandler = () => { + return e => { + table.toggleAllRowsSelected(e.target.checked); + }; + }; + table.getToggleAllPageRowsSelectedHandler = () => { + return e => { + table.toggleAllPageRowsSelected(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row.toggleSelected = (value, opts) => { + const isSelected = row.getIsSelected(); + table.setRowSelection(old => { + var _opts$selectChildren; + value = typeof value !== 'undefined' ? value : !isSelected; + if (row.getCanSelect() && isSelected === value) { + return old; + } + const selectedRowIds = { + ...old + }; + mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table); + return selectedRowIds; + }); + }; + row.getIsSelected = () => { + const { + rowSelection + } = table.getState(); + return isRowSelected(row, rowSelection); + }; + row.getIsSomeSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'some'; + }; + row.getIsAllSubRowsSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'all'; + }; + row.getCanSelect = () => { + var _table$options$enable; + if (typeof table.options.enableRowSelection === 'function') { + return table.options.enableRowSelection(row); + } + return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; + }; + row.getCanSelectSubRows = () => { + var _table$options$enable2; + if (typeof table.options.enableSubRowSelection === 'function') { + return table.options.enableSubRowSelection(row); + } + return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; + }; + row.getCanMultiSelect = () => { + var _table$options$enable3; + if (typeof table.options.enableMultiRowSelection === 'function') { + return table.options.enableMultiRowSelection(row); + } + return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; + }; + row.getToggleSelectedHandler = () => { + const canSelect = row.getCanSelect(); + return e => { + var _target; + if (!canSelect) return; + row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } +}; +const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => { + var _row$subRows; + const row = table.getRow(id, true); + + // const isGrouped = row.getIsGrouped() + + // if ( // TODO: enforce grouping row selection rules + // !isGrouped || + // (isGrouped && table.options.enableGroupingRowSelection) + // ) { + if (value) { + if (!row.getCanMultiSelect()) { + Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]); + } + if (row.getCanSelect()) { + selectedRowIds[id] = true; + } + } else { + delete selectedRowIds[id]; + } + // } + + if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { + row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)); + } +}; +function selectRowsFn(table, rowModel) { + const rowSelection = table.getState().rowSelection; + const newSelectedFlatRows = []; + const newSelectedRowsById = {}; + + // Filters top level and nested rows + const recurseRows = function (rows, depth) { + return rows.map(row => { + var _row$subRows2; + const isSelected = isRowSelected(row, rowSelection); + if (isSelected) { + newSelectedFlatRows.push(row); + newSelectedRowsById[row.id] = row; + } + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) { + row = { + ...row, + subRows: recurseRows(row.subRows) + }; + } + if (isSelected) { + return row; + } + }).filter(Boolean); + }; + return { + rows: recurseRows(rowModel.rows), + flatRows: newSelectedFlatRows, + rowsById: newSelectedRowsById + }; +} +function isRowSelected(row, selection) { + var _selection$row$id; + return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false; +} +function isSubRowSelected(row, selection, table) { + var _row$subRows3; + if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false; + let allChildrenSelected = true; + let someSelected = false; + row.subRows.forEach(subRow => { + // Bail out early if we know both of these + if (someSelected && !allChildrenSelected) { + return; + } + if (subRow.getCanSelect()) { + if (isRowSelected(subRow, selection)) { + someSelected = true; + } else { + allChildrenSelected = false; + } + } + + // Check row selection of nested subrows + if (subRow.subRows && subRow.subRows.length) { + const subRowChildrenSelected = isSubRowSelected(subRow, selection); + if (subRowChildrenSelected === 'all') { + someSelected = true; + } else if (subRowChildrenSelected === 'some') { + someSelected = true; + allChildrenSelected = false; + } else { + allChildrenSelected = false; + } + } + }); + return allChildrenSelected ? 'all' : someSelected ? 'some' : false; +} + +const reSplitAlphaNumeric = /([0-9]+)/gm; +const alphanumeric = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; +const alphanumericCaseSensitive = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; + +// The text filter is more basic (less numeric support) +// but is much faster +const text = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; + +// The text filter is more basic (less numeric support) +// but is much faster +const textCaseSensitive = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; +const datetime = (rowA, rowB, columnId) => { + const a = rowA.getValue(columnId); + const b = rowB.getValue(columnId); + + // Can handle nullish values + // Use > and < because == (and ===) doesn't work with + // Date objects (would require calling getTime()). + return a > b ? 1 : a < b ? -1 : 0; +}; +const basic = (rowA, rowB, columnId) => { + return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); +}; + +// Utils + +function compareBasic(a, b) { + return a === b ? 0 : a > b ? 1 : -1; +} +function toString(a) { + if (typeof a === 'number') { + if (isNaN(a) || a === Infinity || a === -Infinity) { + return ''; + } + return String(a); + } + if (typeof a === 'string') { + return a; + } + return ''; +} + +// Mixed sorting is slow, but very inclusive of many edge cases. +// It handles numbers, mixed alphanumeric combinations, and even +// null, undefined, and Infinity +function compareAlphanumeric(aStr, bStr) { + // Split on number groups, but keep the delimiter + // Then remove falsey split values + const a = aStr.split(reSplitAlphaNumeric).filter(Boolean); + const b = bStr.split(reSplitAlphaNumeric).filter(Boolean); + + // While + while (a.length && b.length) { + const aa = a.shift(); + const bb = b.shift(); + const an = parseInt(aa, 10); + const bn = parseInt(bb, 10); + const combo = [an, bn].sort(); + + // Both are string + if (isNaN(combo[0])) { + if (aa > bb) { + return 1; + } + if (bb > aa) { + return -1; + } + continue; + } + + // One is a string, one is a number + if (isNaN(combo[1])) { + return isNaN(an) ? -1 : 1; + } + + // Both are numbers + if (an > bn) { + return 1; + } + if (bn > an) { + return -1; + } + } + return a.length - b.length; +} + +// Exports + +const sortingFns = { + alphanumeric, + alphanumericCaseSensitive, + text, + textCaseSensitive, + datetime, + basic +}; + +// + +const RowSorting = { + getInitialState: state => { + return { + sorting: [], + ...state + }; + }, + getDefaultColumnDef: () => { + return { + sortingFn: 'auto', + sortUndefined: 1 + }; + }, + getDefaultOptions: table => { + return { + onSortingChange: makeStateUpdater('sorting', table), + isMultiSortEvent: e => { + return e.shiftKey; + } + }; + }, + createColumn: (column, table) => { + column.getAutoSortingFn = () => { + const firstRows = table.getFilteredRowModel().flatRows.slice(10); + let isString = false; + for (const row of firstRows) { + const value = row == null ? void 0 : row.getValue(column.id); + if (Object.prototype.toString.call(value) === '[object Date]') { + return sortingFns.datetime; + } + if (typeof value === 'string') { + isString = true; + if (value.split(reSplitAlphaNumeric).length > 1) { + return sortingFns.alphanumeric; + } + } + } + if (isString) { + return sortingFns.text; + } + return sortingFns.basic; + }; + column.getAutoSortDir = () => { + const firstRow = table.getFilteredRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return 'asc'; + } + return 'desc'; + }; + column.getSortingFn = () => { + var _table$options$sortin, _table$options$sortin2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn]; + }; + column.toggleSorting = (desc, multi) => { + // if (column.columns.length) { + // column.columns.forEach((c, i) => { + // if (c.id) { + // table.toggleColumnSorting(c.id, undefined, multi || !!i) + // } + // }) + // return + // } + + // this needs to be outside of table.setSorting to be in sync with rerender + const nextSortingOrder = column.getNextSortingOrder(); + const hasManualValue = typeof desc !== 'undefined' && desc !== null; + table.setSorting(old => { + // Find any existing sorting for this column + const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id); + const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id); + let newSorting = []; + + // What should we do with this sort action? + let sortAction; + let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; + + // Multi-mode + if (old != null && old.length && column.getCanMultiSort() && multi) { + if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'add'; + } + } else { + // Normal mode + if (old != null && old.length && existingIndex !== old.length - 1) { + sortAction = 'replace'; + } else if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'replace'; + } + } + + // Handle toggle states that will remove the sorting + if (sortAction === 'toggle') { + // If we are "actually" toggling (not a manual set value), should we remove the sorting? + if (!hasManualValue) { + // Is our intention to remove? + if (!nextSortingOrder) { + sortAction = 'remove'; + } + } + } + if (sortAction === 'add') { + var _table$options$maxMul; + newSorting = [...old, { + id: column.id, + desc: nextDesc + }]; + // Take latest n columns + newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); + } else if (sortAction === 'toggle') { + // This flips (or sets) the + newSorting = old.map(d => { + if (d.id === column.id) { + return { + ...d, + desc: nextDesc + }; + } + return d; + }); + } else if (sortAction === 'remove') { + newSorting = old.filter(d => d.id !== column.id); + } else { + newSorting = [{ + id: column.id, + desc: nextDesc + }]; + } + return newSorting; + }); + }; + column.getFirstSortDir = () => { + var _ref, _column$columnDef$sor; + const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc'; + return sortDescFirst ? 'desc' : 'asc'; + }; + column.getNextSortingOrder = multi => { + var _table$options$enable, _table$options$enable2; + const firstSortDirection = column.getFirstSortDir(); + const isSorted = column.getIsSorted(); + if (!isSorted) { + return firstSortDirection; + } + if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( + // If enableSortRemove, enable in general + multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove)) + ) { + return false; + } + return isSorted === 'desc' ? 'asc' : 'desc'; + }; + column.getCanSort = () => { + var _column$columnDef$ena, _table$options$enable3; + return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn; + }; + column.getCanMultiSort = () => { + var _ref2, _column$columnDef$ena2; + return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn; + }; + column.getIsSorted = () => { + var _table$getState$sorti; + const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id); + return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'; + }; + column.getSortIndex = () => { + var _table$getState$sorti2, _table$getState$sorti3; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1; + }; + column.clearSorting = () => { + //clear sorting for just 1 column + table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []); + }; + column.getToggleSortingHandler = () => { + const canSort = column.getCanSort(); + return e => { + if (!canSort) return; + e.persist == null || e.persist(); + column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false); + }; + }; + }, + createTable: table => { + table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater); + table.resetSorting = defaultState => { + var _table$initialState$s, _table$initialState; + table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); + }; + table.getPreSortedRowModel = () => table.getGroupedRowModel(); + table.getSortedRowModel = () => { + if (!table._getSortedRowModel && table.options.getSortedRowModel) { + table._getSortedRowModel = table.options.getSortedRowModel(table); + } + if (table.options.manualSorting || !table._getSortedRowModel) { + return table.getPreSortedRowModel(); + } + return table._getSortedRowModel(); + }; + } +}; + +const builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting, +//depends on ColumnFaceting +GlobalFiltering, +//depends on ColumnFiltering +RowSorting, ColumnGrouping, +//depends on RowSorting +RowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing]; + +// + +function createTable(options) { + var _options$_features, _options$initialState; + if (process.env.NODE_ENV !== 'production' && (options.debugAll || options.debugTable)) { + console.info('Creating Table Instance...'); + } + const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])]; + let table = { + _features + }; + const defaultOptions = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); + }, {}); + const mergeOptions = options => { + if (table.options.mergeOptions) { + return table.options.mergeOptions(defaultOptions, options); + } + return { + ...defaultOptions, + ...options + }; + }; + const coreInitialState = {}; + let initialState = { + ...coreInitialState, + ...((_options$initialState = options.initialState) != null ? _options$initialState : {}) + }; + table._features.forEach(feature => { + var _feature$getInitialSt; + initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState; + }); + const queued = []; + let queuedTimeout = false; + const coreInstance = { + _features, + options: { + ...defaultOptions, + ...options + }, + initialState, + _queue: cb => { + queued.push(cb); + if (!queuedTimeout) { + queuedTimeout = true; + + // Schedule a microtask to run the queued callbacks after + // the current call stack (render, etc) has finished. + Promise.resolve().then(() => { + while (queued.length) { + queued.shift()(); + } + queuedTimeout = false; + }).catch(error => setTimeout(() => { + throw error; + })); + } + }, + reset: () => { + table.setState(table.initialState); + }, + setOptions: updater => { + const newOptions = functionalUpdate(updater, table.options); + table.options = mergeOptions(newOptions); + }, + getState: () => { + return table.options.state; + }, + setState: updater => { + table.options.onStateChange == null || table.options.onStateChange(updater); + }, + _getRowId: (row, index, parent) => { + var _table$options$getRow; + return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`; + }, + getCoreRowModel: () => { + if (!table._getCoreRowModel) { + table._getCoreRowModel = table.options.getCoreRowModel(table); + } + return table._getCoreRowModel(); + }, + // The final calls start at the bottom of the model, + // expanded rows, which then work their way up + + getRowModel: () => { + return table.getPaginationRowModel(); + }, + //in next version, we should just pass in the row model as the optional 2nd arg + getRow: (id, searchAll) => { + let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id]; + if (!row) { + row = table.getCoreRowModel().rowsById[id]; + if (!row) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(`getRow could not find row with ID: ${id}`); + } + throw new Error(); + } + } + return row; + }, + _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => { + var _defaultColumn; + defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; + return { + header: props => { + const resolvedColumnDef = props.header.column.columnDef; + if (resolvedColumnDef.accessorKey) { + return resolvedColumnDef.accessorKey; + } + if (resolvedColumnDef.accessorFn) { + return resolvedColumnDef.id; + } + return null; + }, + // footer: props => props.header.column.id, + cell: props => { + var _props$renderValue$to, _props$renderValue; + return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; + }, + ...table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); + }, {}), + ...defaultColumn + }; + }, getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')), + _getColumnDefs: () => table.options.columns, + getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => { + const recurseColumns = function (columnDefs, parent, depth) { + if (depth === void 0) { + depth = 0; + } + return columnDefs.map(columnDef => { + const column = createColumn(table, columnDef, depth, parent); + const groupingColumnDef = columnDef; + column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : []; + return column; + }); + }; + return recurseColumns(columnDefs); + }, getMemoOptions(options, 'debugColumns', 'getAllColumns')), + getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => { + return allColumns.flatMap(column => { + return column.getFlatColumns(); + }); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')), + _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => { + return flatColumns.reduce((acc, column) => { + acc[column.id] = column; + return acc; + }, {}); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')), + getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => { + let leafColumns = allColumns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + }, getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')), + getColumn: columnId => { + const column = table._getAllFlatColumnsById()[columnId]; + if (process.env.NODE_ENV !== 'production' && !column) { + console.error(`[Table] Column with id '${columnId}' does not exist.`); + } + return column; + } + }; + Object.assign(table, coreInstance); + for (let index = 0; index < table._features.length; index++) { + const feature = table._features[index]; + feature == null || feature.createTable == null || feature.createTable(table); + } + return table; +} + +function getCoreRowModel() { + return table => memo(() => [table.options.data], data => { + const rowModel = { + rows: [], + flatRows: [], + rowsById: {} + }; + const accessRows = function (originalRows, depth, parentRow) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + for (let i = 0; i < originalRows.length; i++) { + // This could be an expensive check at scale, so we should move it somewhere else, but where? + // if (!id) { + // if (process.env.NODE_ENV !== 'production') { + // throw new Error(`getRowId expected an ID, but got ${id}`) + // } + // } + + // Make the row + const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id); + + // Keep track of every row in a flat array + rowModel.flatRows.push(row); + // Also keep track of every row by its ID + rowModel.rowsById[row.id] = row; + // Push table row into parent + rows.push(row); + + // Get the original subrows + if (table.options.getSubRows) { + var _row$originalSubRows; + row.originalSubRows = table.options.getSubRows(originalRows[i], i); + + // Then recursively access them + if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) { + row.subRows = accessRows(row.originalSubRows, depth + 1, row); + } + } + } + return rows; + }; + rowModel.rows = accessRows(data); + return rowModel; + }, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex())); +} + +function getExpandedRowModel() { + return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => { + if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) { + return rowModel; + } + if (!paginateExpandedRows) { + // Only expand rows at this point if they are being paginated + return rowModel; + } + return expandRows(rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')); +} +function expandRows(rowModel) { + const expandedRows = []; + const handleRow = row => { + var _row$subRows; + expandedRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) { + row.subRows.forEach(handleRow); + } + }; + rowModel.rows.forEach(handleRow); + return { + rows: expandedRows, + flatRows: rowModel.flatRows, + rowsById: rowModel.rowsById + }; +} + +function getFacetedMinMaxValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return undefined; + const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => { + var _flatRow$getUniqueVal; + return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : []; + }).map(Number).filter(value => !Number.isNaN(value)); + if (!uniqueValues.length) return; + let facetedMinValue = uniqueValues[0]; + let facetedMaxValue = uniqueValues[uniqueValues.length - 1]; + for (const value of uniqueValues) { + if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value; + } + return [facetedMinValue, facetedMaxValue]; + }, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')); +} + +function filterRows(rows, filterRowImpl, table) { + if (table.options.filterFromLeafRows) { + return filterRowModelFromLeafs(rows, filterRowImpl, table); + } + return filterRowModelFromRoot(rows, filterRowImpl, table); +} +function filterRowModelFromLeafs(rowsToFilter, filterRow, table) { + var _table$options$maxLea; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100; + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + + // Filter from children up first + for (let i = 0; i < rowsToFilter.length; i++) { + var _row$subRows; + let row = rowsToFilter[i]; + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.columnFilters = row.columnFilters; + if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) { + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + if (filterRow(row) && !newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + if (filterRow(row) || newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + } else { + row = newRow; + if (filterRow(row)) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + } + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; +} +function filterRowModelFromRoot(rowsToFilter, filterRow, table) { + var _table$options$maxLea2; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100; + + // Filters top level and nested rows + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + // Filter from parents downward first + + const rows = []; + + // Apply the filter to any subRows + for (let i = 0; i < rowsToFilter.length; i++) { + let row = rowsToFilter[i]; + const pass = filterRow(row); + if (pass) { + var _row$subRows2; + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) { + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + } + rows.push(row); + newFilteredFlatRows.push(row); + newFilteredRowsById[row.id] = row; + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; +} + +function getFacetedRowModel() { + return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => { + if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + return preRowModel; + } + const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean); + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + return filterRows(preRowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')); +} + +function getFacetedUniqueValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return new Map(); + let facetedUniqueValues = new Map(); + for (let i = 0; i < facetedRowModel.flatRows.length; i++) { + const values = facetedRowModel.flatRows[i].getUniqueValues(columnId); + for (let j = 0; j < values.length; j++) { + const value = values[j]; + if (facetedUniqueValues.has(value)) { + var _facetedUniqueValues$; + facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1); + } else { + facetedUniqueValues.set(value, 1); + } + } + } + return facetedUniqueValues; + }, getMemoOptions(table.options, 'debugTable', `getFacetedUniqueValues_${columnId}`)); +} + +function getFilteredRowModel() { + return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => { + if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + for (let i = 0; i < rowModel.flatRows.length; i++) { + rowModel.flatRows[i].columnFilters = {}; + rowModel.flatRows[i].columnFiltersMeta = {}; + } + return rowModel; + } + const resolvedColumnFilters = []; + const resolvedGlobalFilters = []; + (columnFilters != null ? columnFilters : []).forEach(d => { + var _filterFn$resolveFilt; + const column = table.getColumn(d.id); + if (!column) { + return; + } + const filterFn = column.getFilterFn(); + if (!filterFn) { + if (process.env.NODE_ENV !== 'production') { + console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`); + } + return; + } + resolvedColumnFilters.push({ + id: d.id, + filterFn, + resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value + }); + }); + const filterableIds = (columnFilters != null ? columnFilters : []).map(d => d.id); + const globalFilterFn = table.getGlobalFilterFn(); + const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter()); + if (globalFilter && globalFilterFn && globallyFilterableColumns.length) { + filterableIds.push('__global__'); + globallyFilterableColumns.forEach(column => { + var _globalFilterFn$resol; + resolvedGlobalFilters.push({ + id: column.id, + filterFn: globalFilterFn, + resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter + }); + }); + } + let currentColumnFilter; + let currentGlobalFilter; + + // Flag the prefiltered row model with each filter state + for (let j = 0; j < rowModel.flatRows.length; j++) { + const row = rowModel.flatRows[j]; + row.columnFilters = {}; + if (resolvedColumnFilters.length) { + for (let i = 0; i < resolvedColumnFilters.length; i++) { + currentColumnFilter = resolvedColumnFilters[i]; + const id = currentColumnFilter.id; + + // Tag the row with the column filter state + row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + }); + } + } + if (resolvedGlobalFilters.length) { + for (let i = 0; i < resolvedGlobalFilters.length; i++) { + currentGlobalFilter = resolvedGlobalFilters[i]; + const id = currentGlobalFilter.id; + // Tag the row with the first truthy global filter state + if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + })) { + row.columnFilters.__global__ = true; + break; + } + } + if (row.columnFilters.__global__ !== true) { + row.columnFilters.__global__ = false; + } + } + } + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + + // Filter final rows using all of the active filters + return filterRows(rowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => table._autoResetPageIndex())); +} + +function getGroupedRowModel() { + return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { + if (!rowModel.rows.length || !grouping.length) { + rowModel.rows.forEach(row => { + row.depth = 0; + row.parentId = undefined; + }); + return rowModel; + } + + // Filter the grouping list down to columns that exist + const existingGrouping = grouping.filter(columnId => table.getColumn(columnId)); + const groupedFlatRows = []; + const groupedRowsById = {}; + // const onlyGroupedFlatRows: Row[] = []; + // const onlyGroupedRowsById: Record = {}; + // const nonGroupedFlatRows: Row[] = []; + // const nonGroupedRowsById: Record = {}; + + // Recursively group the data + const groupUpRecursively = function (rows, depth, parentId) { + if (depth === void 0) { + depth = 0; + } + // Grouping depth has been been met + // Stop grouping and simply rewrite thd depth and row relationships + if (depth >= existingGrouping.length) { + return rows.map(row => { + row.depth = depth; + groupedFlatRows.push(row); + groupedRowsById[row.id] = row; + if (row.subRows) { + row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id); + } + return row; + }); + } + const columnId = existingGrouping[depth]; + + // Group the rows together for this level + const rowGroupsMap = groupBy(rows, columnId); + + // Perform aggregations for each group + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { + let [groupingValue, groupedRows] = _ref; + let id = `${columnId}:${groupingValue}`; + id = parentId ? `${parentId}>${id}` : id; + + // First, Recurse to group sub rows before aggregation + const subRows = groupUpRecursively(groupedRows, depth + 1, id); + subRows.forEach(subRow => { + subRow.parentId = id; + }); + + // Flatten the leaf rows of the rows in this group + const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows; + const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId); + Object.assign(row, { + groupingColumnId: columnId, + groupingValue, + subRows, + leafRows, + getValue: columnId => { + // Don't aggregate columns that are in the grouping + if (existingGrouping.includes(columnId)) { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + if (groupedRows[0]) { + var _groupedRows$0$getVal; + row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined; + } + return row._valuesCache[columnId]; + } + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + + // Aggregate the values + const column = table.getColumn(columnId); + const aggregateFn = column == null ? void 0 : column.getAggregationFn(); + if (aggregateFn) { + row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows); + return row._groupingValuesCache[columnId]; + } + } + }); + subRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return row; + }); + return aggregatedGroupedRows; + }; + const groupedRows = groupUpRecursively(rowModel.rows, 0); + groupedRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return { + rows: groupedRows, + flatRows: groupedFlatRows, + rowsById: groupedRowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => { + table._queue(() => { + table._autoResetExpanded(); + table._autoResetPageIndex(); + }); + })); +} +function groupBy(rows, columnId) { + const groupMap = new Map(); + return rows.reduce((map, row) => { + const resKey = `${row.getGroupingValue(columnId)}`; + const previous = map.get(resKey); + if (!previous) { + map.set(resKey, [row]); + } else { + previous.push(row); + } + return map; + }, groupMap); +} + +function getPaginationRowModel(opts) { + return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => { + if (!rowModel.rows.length) { + return rowModel; + } + const { + pageSize, + pageIndex + } = pagination; + let { + rows, + flatRows, + rowsById + } = rowModel; + const pageStart = pageSize * pageIndex; + const pageEnd = pageStart + pageSize; + rows = rows.slice(pageStart, pageEnd); + let paginatedRowModel; + if (!table.options.paginateExpandedRows) { + paginatedRowModel = expandRows({ + rows, + flatRows, + rowsById + }); + } else { + paginatedRowModel = { + rows, + flatRows, + rowsById + }; + } + paginatedRowModel.flatRows = []; + const handleRow = row => { + paginatedRowModel.flatRows.push(row); + if (row.subRows.length) { + row.subRows.forEach(handleRow); + } + }; + paginatedRowModel.rows.forEach(handleRow); + return paginatedRowModel; + }, getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')); +} + +function getSortedRowModel() { + return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => { + if (!rowModel.rows.length || !(sorting != null && sorting.length)) { + return rowModel; + } + const sortingState = table.getState().sorting; + const sortedFlatRows = []; + + // Filter out sortings that correspond to non existing columns + const availableSorting = sortingState.filter(sort => { + var _table$getColumn; + return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort(); + }); + const columnInfoById = {}; + availableSorting.forEach(sortEntry => { + const column = table.getColumn(sortEntry.id); + if (!column) return; + columnInfoById[sortEntry.id] = { + sortUndefined: column.columnDef.sortUndefined, + invertSorting: column.columnDef.invertSorting, + sortingFn: column.getSortingFn() + }; + }); + const sortData = rows => { + // This will also perform a stable sorting using the row index + // if needed. + const sortedData = rows.map(row => ({ + ...row + })); + sortedData.sort((rowA, rowB) => { + for (let i = 0; i < availableSorting.length; i += 1) { + var _sortEntry$desc; + const sortEntry = availableSorting[i]; + const columnInfo = columnInfoById[sortEntry.id]; + const sortUndefined = columnInfo.sortUndefined; + const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false; + let sortInt = 0; + + // All sorting ints should always return in ascending order + if (sortUndefined) { + const aValue = rowA.getValue(sortEntry.id); + const bValue = rowB.getValue(sortEntry.id); + const aUndefined = aValue === undefined; + const bUndefined = bValue === undefined; + if (aUndefined || bUndefined) { + if (sortUndefined === 'first') return aUndefined ? -1 : 1; + if (sortUndefined === 'last') return aUndefined ? 1 : -1; + sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined; + } + } + if (sortInt === 0) { + sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id); + } + + // If sorting is non-zero, take care of desc and inversion + if (sortInt !== 0) { + if (isDesc) { + sortInt *= -1; + } + if (columnInfo.invertSorting) { + sortInt *= -1; + } + return sortInt; + } + } + return rowA.index - rowB.index; + }); + + // If there are sub-rows, sort them + sortedData.forEach(row => { + var _row$subRows; + sortedFlatRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length) { + row.subRows = sortData(row.subRows); + } + }); + return sortedData; + }; + return { + rows: sortData(rowModel.rows), + flatRows: sortedFlatRows, + rowsById: rowModel.rowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex())); +} + +export { ColumnFaceting, ColumnFiltering, ColumnGrouping, ColumnOrdering, ColumnPinning, ColumnSizing, ColumnVisibility, GlobalFaceting, GlobalFiltering, Headers, RowExpanding, RowPagination, RowPinning, RowSelection, RowSorting, _getVisibleLeafColumns, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getMemoOptions, getPaginationRowModel, getSortedRowModel, isFunction, isNumberArray, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns }; +//# sourceMappingURL=index.esm.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/index.esm.js.map b/node_modules/@tanstack/table-core/build/lib/index.esm.js.map new file mode 100644 index 00000000..7e20782a --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/index.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.esm.js","sources":["../../src/columnHelper.ts","../../src/utils.ts","../../src/core/cell.ts","../../src/core/column.ts","../../src/core/headers.ts","../../src/core/row.ts","../../src/features/ColumnFaceting.ts","../../src/filterFns.ts","../../src/features/ColumnFiltering.ts","../../src/aggregationFns.ts","../../src/features/ColumnGrouping.ts","../../src/features/ColumnOrdering.ts","../../src/features/ColumnPinning.ts","../../src/utils/document.ts","../../src/features/ColumnSizing.ts","../../src/features/ColumnVisibility.ts","../../src/features/GlobalFaceting.ts","../../src/features/GlobalFiltering.ts","../../src/features/RowExpanding.ts","../../src/features/RowPagination.ts","../../src/features/RowPinning.ts","../../src/features/RowSelection.ts","../../src/sortingFns.ts","../../src/features/RowSorting.ts","../../src/core/table.ts","../../src/utils/getCoreRowModel.ts","../../src/utils/getExpandedRowModel.ts","../../src/utils/getFacetedMinMaxValues.ts","../../src/utils/filterRowsUtils.ts","../../src/utils/getFacetedRowModel.ts","../../src/utils/getFacetedUniqueValues.ts","../../src/utils/getFilteredRowModel.ts","../../src/utils/getGroupedRowModel.ts","../../src/utils/getPaginationRowModel.ts","../../src/utils/getSortedRowModel.ts"],"sourcesContent":["import {\n AccessorFn,\n AccessorFnColumnDef,\n AccessorKeyColumnDef,\n DisplayColumnDef,\n GroupColumnDef,\n IdentifiedColumnDef,\n RowData,\n} from './types'\nimport { DeepKeys, DeepValue } from './utils'\n\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nexport type ColumnHelper = {\n accessor: <\n TAccessor extends AccessorFn | DeepKeys,\n TValue extends TAccessor extends AccessorFn\n ? TReturn\n : TAccessor extends DeepKeys\n ? DeepValue\n : never,\n >(\n accessor: TAccessor,\n column: TAccessor extends AccessorFn\n ? DisplayColumnDef\n : IdentifiedColumnDef\n ) => TAccessor extends AccessorFn\n ? AccessorFnColumnDef\n : AccessorKeyColumnDef\n display: (column: DisplayColumnDef) => DisplayColumnDef\n group: (column: GroupColumnDef) => GroupColumnDef\n}\n\nexport function createColumnHelper<\n TData extends RowData,\n>(): ColumnHelper {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function'\n ? ({\n ...column,\n accessorFn: accessor,\n } as any)\n : {\n ...column,\n accessorKey: accessor,\n }\n },\n display: column => column,\n group: column => column,\n }\n}\n","import { TableOptionsResolved, TableState, Updater } from './types'\n\nexport type PartialKeys = Omit & Partial>\nexport type RequiredKeys = Omit &\n Required>\nexport type Overwrite = Omit<\n T,\n keyof U\n> &\n U\n\nexport type UnionToIntersection = (\n T extends any ? (x: T) => any : never\n) extends (x: infer R) => any\n ? R\n : never\n\nexport type IsAny = 1 extends 0 & T ? Y : N\nexport type IsKnown = unknown extends T ? N : Y\n\ntype ComputeRange<\n N extends number,\n Result extends Array = [],\n> = Result['length'] extends N\n ? Result\n : ComputeRange\ntype Index40 = ComputeRange<40>[number]\n\n// Is this type a tuple?\ntype IsTuple = T extends readonly any[] & { length: infer Length }\n ? Length extends Index40\n ? T\n : never\n : never\n\n// If this type is a tuple, what indices are allowed?\ntype AllowedIndexes<\n Tuple extends ReadonlyArray,\n Keys extends number = never,\n> = Tuple extends readonly []\n ? Keys\n : Tuple extends readonly [infer _, ...infer Tail]\n ? AllowedIndexes\n : Keys\n\nexport type DeepKeys = TDepth['length'] extends 5\n ? never\n : unknown extends T\n ? string\n : T extends readonly any[] & IsTuple\n ? AllowedIndexes | DeepKeysPrefix, TDepth>\n : T extends any[]\n ? DeepKeys\n : T extends Date\n ? never\n : T extends object\n ? (keyof T & string) | DeepKeysPrefix\n : never\n\ntype DeepKeysPrefix<\n T,\n TPrefix,\n TDepth extends any[],\n> = TPrefix extends keyof T & (number | string)\n ? `${TPrefix}.${DeepKeys & string}`\n : never\n\nexport type DeepValue =\n T extends Record\n ? TProp extends `${infer TBranch}.${infer TDeepProp}`\n ? DeepValue\n : T[TProp & string]\n : never\n\nexport type NoInfer = [T][T extends any ? 0 : never]\n\nexport type Getter = () => NoInfer\n\n///\n\nexport function functionalUpdate(updater: Updater, input: T): T {\n return typeof updater === 'function'\n ? (updater as (input: T) => T)(input)\n : updater\n}\n\nexport function noop() {\n //\n}\n\nexport function makeStateUpdater(\n key: K,\n instance: unknown\n) {\n return (updater: Updater) => {\n ;(instance as any).setState((old: TTableState) => {\n return {\n ...old,\n [key]: functionalUpdate(updater, (old as any)[key]),\n }\n })\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\nexport function isFunction(d: any): d is T {\n return d instanceof Function\n}\n\nexport function isNumberArray(d: any): d is number[] {\n return Array.isArray(d) && d.every(val => typeof val === 'number')\n}\n\nexport function flattenBy(\n arr: TNode[],\n getChildren: (item: TNode) => TNode[]\n) {\n const flat: TNode[] = []\n\n const recurse = (subArr: TNode[]) => {\n subArr.forEach(item => {\n flat.push(item)\n const children = getChildren(item)\n if (children?.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\nexport function memo(\n getDeps: (depArgs?: TDepArgs) => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: any\n debug?: () => any\n onChange?: (result: TResult) => void\n }\n): (depArgs?: TDepArgs) => TResult {\n let deps: any[] = []\n let result: TResult | undefined\n\n return depArgs => {\n let depTime: number\n if (opts.key && opts.debug) depTime = Date.now()\n\n const newDeps = getDeps(depArgs)\n\n const depsChanged =\n newDeps.length !== deps.length ||\n newDeps.some((dep: any, index: number) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime: number\n if (opts.key && opts.debug) resultTime = Date.now()\n\n result = fn(...newDeps)\n opts?.onChange?.(result)\n\n if (opts.key && opts.debug) {\n if (opts?.debug()) {\n const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120)\n )}deg 100% 31%);`,\n opts?.key\n )\n }\n }\n\n return result!\n }\n}\n\nexport function getMemoOptions(\n tableOptions: Partial>,\n debugLevel:\n | 'debugAll'\n | 'debugCells'\n | 'debugTable'\n | 'debugColumns'\n | 'debugRows'\n | 'debugHeaders',\n key: string,\n onChange?: (result: any) => void\n) {\n return {\n debug: () => tableOptions?.debugAll ?? tableOptions[debugLevel],\n key: process.env.NODE_ENV === 'development' && key,\n onChange,\n }\n}\n","import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, getMemoOptions, memo } from '../utils'\n\nexport interface CellContext {\n cell: Cell\n column: Column\n getValue: Getter\n renderValue: Getter\n row: Row\n table: Table\n}\n\nexport interface CoreCell {\n /**\n * The associated Column object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n column: Column\n /**\n * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice:\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getContext: () => CellContext\n /**\n * Returns the value for the cell, accessed via the associated column's accessor key or accessor function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getValue: CellContext['getValue']\n /**\n * The unique ID for the cell across the entire table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n id: string\n /**\n * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n renderValue: CellContext['renderValue']\n /**\n * The associated Row object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n row: Row\n}\n\nexport function createCell(\n table: Table,\n row: Row,\n column: Column,\n columnId: string\n): Cell {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n getMemoOptions(table.options, 'debugCells', 'cell.getContext')\n ),\n }\n\n table._features.forEach(feature => {\n feature.createCell?.(\n cell as Cell,\n column,\n row as Row,\n table\n )\n }, {})\n\n return cell as Cell\n}\n","import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport interface CoreColumn {\n /**\n * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n accessorFn?: AccessorFn\n /**\n * The original column def used to create the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columnDef: ColumnDef\n /**\n * The child column (if the column is a group column). Will be an empty array if the column is not a group column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columns: Column[]\n /**\n * The depth of the column (if grouped) relative to the root column def array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n depth: number\n /**\n * Returns the flattened array of this column and all child/grand-child columns for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getFlatColumns: () => Column[]\n /**\n * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getLeafColumns: () => Column[]\n /**\n * The resolved unique identifier for the column resolved in this priority:\n - A manual `id` property from the column def\n - The accessor key from the column def\n - The header string from the column def\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n id: string\n /**\n * The parent column for this column. Will be undefined if this is a root column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n parent?: Column\n}\n\nexport function createColumn(\n table: Table,\n columnDef: ColumnDef,\n depth: number,\n parent?: Column\n): Column {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey\n ? typeof String.prototype.replaceAll === 'function'\n ? accessorKey.replaceAll('.', '_')\n : accessorKey.replace(/\\./g, '_')\n : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')\n ),\n }\n\n for (const feature of table._features) {\n feature.createColumn?.(column as Column, table)\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column as Column\n}\n","import {\n RowData,\n Column,\n Header,\n HeaderGroup,\n Table,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nconst debug = 'debugHeaders'\n\nexport interface CoreHeaderGroup {\n depth: number\n headers: Header[]\n id: string\n}\n\nexport interface HeaderContext {\n /**\n * An instance of a column.\n */\n column: Column\n /**\n * An instance of a header.\n */\n header: Header\n /**\n * The table instance.\n */\n table: Table\n}\n\nexport interface CoreHeader {\n /**\n * The col-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n colSpan: number\n /**\n * The header's associated column object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n column: Column\n /**\n * The depth of the header, zero-indexed based.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n depth: number\n /**\n * Returns the rendering context (or props) for column-based components like headers, footers and filters.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getContext: () => HeaderContext\n /**\n * Returns the leaf headers hierarchically nested under this header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * The header's associated header group object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n headerGroup: HeaderGroup\n /**\n * The unique identifier for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n id: string\n /**\n * The index for the header within the header group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n index: number\n /**\n * A boolean denoting if the header is a placeholder header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n isPlaceholder: boolean\n /**\n * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n placeholderId?: string\n /**\n * The row-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n rowSpan: number\n /**\n * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n subHeaders: Header[]\n}\n\nexport interface HeadersInstance {\n /**\n * Returns all header groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightHeaderGroups: () => HeaderGroup[]\n\n /**\n * Returns the footer groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFooterGroups: () => HeaderGroup[]\n\n /**\n * Returns headers for all columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFlatHeaders: () => Header[]\n\n /**\n * Returns headers for all leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightLeafHeaders: () => Header[]\n}\n\n//\n\nfunction createHeader(\n table: Table,\n column: Column,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header {\n const id = options.id ?? column.id\n\n let header: CoreHeader = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header[] => {\n const leafHeaders: Header[] = []\n\n const recurseHeader = (h: CoreHeader) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n feature.createHeader?.(header as Header, table)\n })\n\n return header as Header\n}\n\nexport const Headers: TableFeature = {\n createTable: (table: Table): void => {\n // Header Groups\n\n table.getHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n getMemoOptions(table.options, debug, 'getHeaderGroups')\n )\n\n table.getCenterHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n getMemoOptions(table.options, debug, 'getCenterHeaderGroups')\n )\n\n table.getLeftHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')\n },\n getMemoOptions(table.options, debug, 'getLeftHeaderGroups')\n )\n\n table.getRightHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')\n },\n getMemoOptions(table.options, debug, 'getRightHeaderGroups')\n )\n\n // Footer Groups\n\n table.getFooterGroups = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getFooterGroups')\n )\n\n table.getLeftFooterGroups = memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getLeftFooterGroups')\n )\n\n table.getCenterFooterGroups = memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getCenterFooterGroups')\n )\n\n table.getRightFooterGroups = memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getRightFooterGroups')\n )\n\n // Flat Headers\n\n table.getFlatHeaders = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getFlatHeaders')\n )\n\n table.getLeftFlatHeaders = memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeftFlatHeaders')\n )\n\n table.getCenterFlatHeaders = memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getCenterFlatHeaders')\n )\n\n table.getRightFlatHeaders = memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getRightFlatHeaders')\n )\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getCenterLeafHeaders')\n )\n\n table.getLeftLeafHeaders = memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getLeftLeafHeaders')\n )\n\n table.getRightLeafHeaders = memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getRightLeafHeaders')\n )\n\n table.getLeafHeaders = memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeafHeaders')\n )\n },\n}\n\nexport function buildHeaderGroups(\n allColumns: Column[],\n columnsToGroup: Column[],\n table: Table,\n headerFamily?: 'center' | 'left' | 'right'\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (columns: Column[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Header[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader?.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup?.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter(d => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n","import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow {\n _getAllCellsByColumnId: () => Record>\n _uniqueValuesCache: Record\n _valuesCache: Record\n /**\n * The depth of the row (if nested or grouped) relative to the root row array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n depth: number\n /**\n * Returns all of the cells for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getallcells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getAllCells: () => Cell[]\n /**\n * Returns the leaf rows for the row, not including any parent rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getLeafRows: () => Row[]\n /**\n * Returns the parent row for the row, if it exists.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRow: () => Row | undefined\n /**\n * Returns the parent rows for the row, all the way up to a root row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRows: () => Row[]\n /**\n * Returns a unique array of values from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getuniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getUniqueValues: (columnId: string) => TValue[]\n /**\n * Returns the value from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getValue: (columnId: string) => TValue\n /**\n * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n id: string\n /**\n * The index of the row within its parent array (or the root data array).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n index: number\n /**\n * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#original)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n original: TData\n /**\n * An array of the original subRows as returned by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#originalsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n originalSubRows?: TData[]\n /**\n * If nested, this row's parent row id.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#parentid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n parentId?: string\n /**\n * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n renderValue: (columnId: string) => TValue\n /**\n * An array of subRows for the row as returned and created by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#subrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n subRows: Row[]\n}\n\nexport const createRow = (\n table: Table,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row[],\n parentId?: string\n): Row => {\n let row: CoreRow = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () =>\n row.parentId ? table.getRow(row.parentId, true) : undefined,\n getParentRows: () => {\n let parentRows: Row[] = []\n let currentRow = row\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n },\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row, column, column.id)\n })\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCells')\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce(\n (acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n feature?.createRow?.(row as Row, table)\n }\n\n return row as Row\n}\n","import { RowModel } from '..'\nimport { Column, RowData, Table, TableFeature } from '../types'\n\nexport interface FacetedColumn {\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n _getFacetedRowModel?: () => RowModel\n _getFacetedUniqueValues?: () => Map\n /**\n * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.\n * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedRowModel: () => RowModel\n /**\n * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedUniqueValues: () => Map\n}\n\nexport interface FacetedOptions {\n getFacetedMinMaxValues?: (\n table: Table,\n columnId: string\n ) => () => undefined | [number, number]\n getFacetedRowModel?: (\n table: Table,\n columnId: string\n ) => () => RowModel\n getFacetedUniqueValues?: (\n table: Table,\n columnId: string\n ) => () => Map\n}\n\n//\n\nexport const ColumnFaceting: TableFeature = {\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column._getFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, column.id)\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return column._getFacetedRowModel()\n }\n column._getFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, column.id)\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map()\n }\n\n return column._getFacetedUniqueValues()\n }\n column._getFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, column.id)\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined\n }\n\n return column._getFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn } from './features/ColumnFiltering'\n\nconst includesString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n const search = filterValue?.toString()?.toLowerCase()\n return Boolean(\n row\n .getValue(columnId)\n ?.toString()\n ?.toLowerCase()\n ?.includes(search)\n )\n}\n\nincludesString.autoRemove = (val: any) => testFalsey(val)\n\nconst includesStringSensitive: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return Boolean(\n row.getValue(columnId)?.toString()?.includes(filterValue)\n )\n}\n\nincludesStringSensitive.autoRemove = (val: any) => testFalsey(val)\n\nconst equalsString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return (\n row.getValue(columnId)?.toString()?.toLowerCase() ===\n filterValue?.toLowerCase()\n )\n}\n\nequalsString.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludes: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId)?.includes(filterValue)\n}\n\narrIncludes.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludesAll: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return !filterValue.some(\n val => !row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst arrIncludesSome: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return filterValue.some(val =>\n row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesSome.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst equals: FilterFn = (row, columnId: string, filterValue: unknown) => {\n return row.getValue(columnId) === filterValue\n}\n\nequals.autoRemove = (val: any) => testFalsey(val)\n\nconst weakEquals: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId) == filterValue\n}\n\nweakEquals.autoRemove = (val: any) => testFalsey(val)\n\nconst inNumberRange: FilterFn = (\n row,\n columnId: string,\n filterValue: [number, number]\n) => {\n let [min, max] = filterValue\n\n const rowValue = row.getValue(columnId)\n return rowValue >= min && rowValue <= max\n}\n\ninNumberRange.resolveFilterValue = (val: [any, any]) => {\n let [unsafeMin, unsafeMax] = val\n\n let parsedMin =\n typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin\n let parsedMax =\n typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax\n\n let min =\n unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax\n\n if (min > max) {\n const temp = min\n min = max\n max = temp\n }\n\n return [min, max] as const\n}\n\ninNumberRange.autoRemove = (val: any) =>\n testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]))\n\n// Export\n\nexport const filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange,\n}\n\nexport type BuiltInFilterFn = keyof typeof filterFns\n\n// Utils\n\nfunction testFalsey(val: any) {\n return val === undefined || val === null || val === ''\n}\n","import { RowModel } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n FilterFns,\n FilterMeta,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface ColumnFiltersTableState {\n columnFilters: ColumnFiltersState\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter {\n filterFn: FilterFn\n id: string\n resolvedValue: unknown\n}\n\nexport interface FilterFn {\n (\n row: Row,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n autoRemove?: ColumnFilterAutoRemoveTestFn\n resolveFilterValue?: TransformFilterValueFn\n}\n\nexport type TransformFilterValueFn = (\n value: any,\n column?: Column\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn = (\n value: any,\n column?: Column\n) => boolean\n\nexport type CustomFilterFns = Record<\n string,\n FilterFn\n>\n\nexport type FilterFnOption =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn\n\nexport interface ColumnFiltersColumnDef {\n /**\n * Enables/disables the **column** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilter?: boolean\n /**\n * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFn?: FilterFnOption\n}\n\nexport interface ColumnFiltersColumn {\n /**\n * Returns an automatically calculated filter function for the column based off of the columns first known value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns whether or not the column can be **column** filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getCanFilter: () => boolean\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterFn: () => FilterFn | undefined\n /**\n * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterIndex: () => number\n /**\n * Returns the current filter value for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterValue: () => unknown\n /**\n * Returns whether or not the column is currently filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getIsFiltered: () => boolean\n /**\n * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setFilterValue: (updater: Updater) => void\n}\n\nexport interface ColumnFiltersRow {\n /**\n * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFilters: Record\n /**\n * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFiltersMeta: Record\n}\n\ninterface ColumnFiltersOptionsBase {\n /**\n * Enables/disables **column** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilters?: boolean\n /**\n * Enables/disables all filtering for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableFilters?: boolean\n /**\n * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFromLeafRows?: boolean\n /**\n * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.\n * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.\n * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel?: (table: Table) => () => RowModel\n /**\n * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n manualFiltering?: boolean\n /**\n * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.\n\n * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n maxLeafRowFilterDepth?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n onColumnFiltersChange?: OnChangeFn\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record>\n }\n : {\n filterFns: Record>\n }\n\nexport interface ColumnFiltersOptions\n extends ColumnFiltersOptionsBase,\n ResolvedFilterFns {}\n\nexport interface ColumnFiltersInstance {\n _getFilteredRowModel?: () => RowModel\n /**\n * Returns the row model for the table after **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel: () => RowModel\n /**\n * Returns the row model for the table before any **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getPreFilteredRowModel: () => RowModel\n /**\n * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetColumnFilters: (defaultState?: boolean) => void\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnFilters` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setColumnFilters: (updater: Updater) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnFiltering: TableFeature = {\n getDefaultColumnDef: <\n TData extends RowData,\n >(): ColumnFiltersColumnDef => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): ColumnFiltersTableState => {\n return {\n columnFilters: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnFiltersOptions => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n } as ColumnFiltersOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return filterFns.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns.arrIncludes\n }\n\n return filterFns.weakEquals\n }\n column.getFilterFn = () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n : // @ts-ignore\n table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n }\n column.getCanFilter = () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getIsFiltered = () => column.getFilterIndex() > -1\n\n column.getFilterValue = () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value\n\n column.getFilterIndex = () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1\n\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\n const previousFilter = old?.find(d => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined\n )\n\n //\n if (\n shouldAutoRemoveFilter(filterFn as FilterFn, newFilter, column)\n ) {\n return old?.filter(d => d.id !== column.id) ?? []\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n }\n },\n\n createRow: (\n row: Row,\n _table: Table\n ): void => {\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n },\n\n createTable: (table: Table): void => {\n table.setColumnFilters = (updater: Updater) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n }\n\n table.resetColumnFilters = defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n }\n\n table.getPreFilteredRowModel = () => table.getCoreRowModel()\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n }\n },\n}\n\nexport function shouldAutoRemoveFilter(\n filterFn?: FilterFn,\n value?: any,\n column?: Column\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n","import { AggregationFn } from './features/ColumnGrouping'\nimport { isNumberArray } from './utils'\n\nconst sum: AggregationFn = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId)\n return sum + (typeof nextValue === 'number' ? nextValue : 0)\n }, 0)\n}\n\nconst min: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n\n if (\n value != null &&\n (min! > value || (min === undefined && value >= value))\n ) {\n min = value\n }\n })\n\n return min\n}\n\nconst max: AggregationFn = (columnId, _leafRows, childRows) => {\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (\n value != null &&\n (max! < value || (max === undefined && value >= value))\n ) {\n max = value\n }\n })\n\n return max\n}\n\nconst extent: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value\n } else {\n if (min > value) min = value\n if (max! < value) max = value\n }\n }\n })\n\n return [min, max]\n}\n\nconst mean: AggregationFn = (columnId, leafRows) => {\n let count = 0\n let sum = 0\n\n leafRows.forEach(row => {\n let value = row.getValue(columnId)\n if (value != null && (value = +value) >= value) {\n ++count, (sum += value)\n }\n })\n\n if (count) return sum / count\n\n return\n}\n\nconst median: AggregationFn = (columnId, leafRows) => {\n if (!leafRows.length) {\n return\n }\n\n const values = leafRows.map(row => row.getValue(columnId))\n if (!isNumberArray(values)) {\n return\n }\n if (values.length === 1) {\n return values[0]\n }\n\n const mid = Math.floor(values.length / 2)\n const nums = values.sort((a, b) => a - b)\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1]! + nums[mid]!) / 2\n}\n\nconst unique: AggregationFn = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values())\n}\n\nconst uniqueCount: AggregationFn = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size\n}\n\nconst count: AggregationFn = (_columnId, leafRows) => {\n return leafRows.length\n}\n\nexport const aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count,\n}\n\nexport type BuiltInAggregationFn = keyof typeof aggregationFns\n","import { RowModel } from '..'\nimport { BuiltInAggregationFn, aggregationFns } from '../aggregationFns'\nimport {\n AggregationFns,\n Cell,\n Column,\n ColumnDefTemplate,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type GroupingState = string[]\n\nexport interface GroupingTableState {\n grouping: GroupingState\n}\n\nexport type AggregationFn = (\n columnId: string,\n leafRows: Row[],\n childRows: Row[]\n) => any\n\nexport type CustomAggregationFns = Record>\n\nexport type AggregationFnOption =\n | 'auto'\n | keyof AggregationFns\n | BuiltInAggregationFn\n | AggregationFn\n\nexport interface GroupingColumnDef {\n /**\n * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregatedCell?: ColumnDefTemplate<\n ReturnType['getContext']>\n >\n /**\n * The resolved aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregationFn?: AggregationFnOption\n /**\n * Enables/disables grouping for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue?: (row: TData) => any\n}\n\nexport interface GroupingColumn {\n /**\n * Returns the aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAggregationFn: () => AggregationFn | undefined\n /**\n * Returns the automatically inferred aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAutoAggregationFn: () => AggregationFn | undefined\n /**\n * Returns whether or not the column can be grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getCanGroup: () => boolean\n /**\n * Returns the index of the column in the grouping state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedIndex: () => number\n /**\n * Returns whether or not the column is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getToggleGroupingHandler: () => () => void\n /**\n * Toggles the grouping state of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n toggleGrouping: () => void\n}\n\nexport interface GroupingRow {\n _groupingValuesCache: Record\n /**\n * Returns the grouping value for any row and column (including leaf rows).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue: (columnId: string) => unknown\n /**\n * Returns whether or not the row is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * If this row is grouped, this is the id of the column that this row is grouped by.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingColumnId?: string\n /**\n * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingValue?: unknown\n}\n\nexport interface GroupingCell {\n /**\n * Returns whether or not the cell is currently aggregated.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsAggregated: () => boolean\n /**\n * Returns whether or not the cell is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns whether or not the cell is currently a placeholder cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsPlaceholder: () => boolean\n}\n\nexport interface ColumnDefaultOptions {\n enableGrouping: boolean\n onGroupingChange: OnChangeFn\n}\n\ninterface GroupingOptionsBase {\n /**\n * Enables/disables grouping for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Returns the row model after grouping has taken place, but no further.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel?: (table: Table) => () => RowModel\n /**\n * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupedColumnMode?: false | 'reorder' | 'remove'\n /**\n * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n manualGrouping?: boolean\n /**\n * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n onGroupingChange?: OnChangeFn\n}\n\ntype ResolvedAggregationFns = keyof AggregationFns extends never\n ? {\n aggregationFns?: Record>\n }\n : {\n aggregationFns: Record>\n }\n\nexport interface GroupingOptions\n extends GroupingOptionsBase,\n ResolvedAggregationFns {}\n\nexport type GroupingColumnMode = false | 'reorder' | 'remove'\n\nexport interface GroupingInstance {\n _getGroupedRowModel?: () => RowModel\n /**\n * Returns the row model for the table after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel: () => RowModel\n /**\n * Returns the row model for the table before any grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getPreGroupedRowModel: () => RowModel\n /**\n * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n resetGrouping: (defaultState?: boolean) => void\n /**\n * Updates the grouping state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n setGrouping: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnGrouping: TableFeature = {\n getDefaultColumnDef: (): GroupingColumnDef<\n TData,\n unknown\n > => {\n return {\n aggregatedCell: props => (props.getValue() as any)?.toString?.() ?? null,\n aggregationFn: 'auto',\n }\n },\n\n getInitialState: (state): GroupingTableState => {\n return {\n grouping: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GroupingOptions => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder',\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleGrouping = () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old?.includes(column.id)) {\n return old.filter(d => d !== column.id)\n }\n\n return [...(old ?? []), column.id]\n })\n }\n\n column.getCanGroup = () => {\n return (\n (column.columnDef.enableGrouping ?? true) &&\n (table.options.enableGrouping ?? true) &&\n (!!column.accessorFn || !!column.columnDef.getGroupingValue)\n )\n }\n\n column.getIsGrouped = () => {\n return table.getState().grouping?.includes(column.id)\n }\n\n column.getGroupedIndex = () => table.getState().grouping?.indexOf(column.id)\n\n column.getToggleGroupingHandler = () => {\n const canGroup = column.getCanGroup()\n\n return () => {\n if (!canGroup) return\n column.toggleGrouping()\n }\n }\n column.getAutoAggregationFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent\n }\n }\n column.getAggregationFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column.getAutoAggregationFn()\n : table.options.aggregationFns?.[\n column.columnDef.aggregationFn as string\n ] ??\n aggregationFns[\n column.columnDef.aggregationFn as BuiltInAggregationFn\n ]\n }\n },\n\n createTable: (table: Table): void => {\n table.setGrouping = updater => table.options.onGroupingChange?.(updater)\n\n table.resetGrouping = defaultState => {\n table.setGrouping(defaultState ? [] : table.initialState?.grouping ?? [])\n }\n\n table.getPreGroupedRowModel = () => table.getFilteredRowModel()\n table.getGroupedRowModel = () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table)\n }\n\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._getGroupedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getIsGrouped = () => !!row.groupingColumnId\n row.getGroupingValue = columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original\n )\n\n return row._groupingValuesCache[columnId]\n }\n row._groupingValuesCache = {}\n },\n\n createCell: (\n cell: Cell,\n column: Column,\n row: Row,\n table: Table\n ): void => {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n cell.getIsGrouped = () =>\n column.getIsGrouped() && column.id === row.groupingColumnId\n cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped()\n cell.getIsAggregated = () =>\n !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length\n },\n}\n\nexport function orderColumns(\n leafColumns: Column[],\n grouping: string[],\n groupedColumnMode?: GroupingColumnMode\n) {\n if (!grouping?.length || !groupedColumnMode) {\n return leafColumns\n }\n\n const nonGroupingColumns = leafColumns.filter(\n col => !grouping.includes(col.id)\n )\n\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns\n }\n\n const groupingColumns = grouping\n .map(g => leafColumns.find(col => col.id === g)!)\n .filter(Boolean)\n\n return [...groupingColumns, ...nonGroupingColumns]\n}\n","import { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nimport {\n Column,\n OnChangeFn,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\n\nimport { orderColumns } from './ColumnGrouping'\nimport { ColumnPinningPosition, _getVisibleLeafColumns } from '..'\n\nexport interface ColumnOrderTableState {\n columnOrder: ColumnOrderState\n}\n\nexport type ColumnOrderState = string[]\n\nexport interface ColumnOrderOptions {\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n onColumnOrderChange?: OnChangeFn\n}\n\nexport interface ColumnOrderColumn {\n /**\n * Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIndex: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns `true` if the column is the first column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the first in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getisfirstcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsFirstColumn: (position?: ColumnPinningPosition | 'center') => boolean\n /**\n * Returns `true` if the column is the last column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the last in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getislastcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsLastColumn: (position?: ColumnPinningPosition | 'center') => boolean\n}\n\nexport interface ColumnOrderDefaultOptions {\n onColumnOrderChange: OnChangeFn\n}\n\nexport interface ColumnOrderInstance {\n _getOrderColumnsFn: () => (\n columns: Column[]\n ) => Column[]\n /**\n * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n resetColumnOrder: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnOrder` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n setColumnOrder: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnOrdering: TableFeature = {\n getInitialState: (state): ColumnOrderTableState => {\n return {\n columnOrder: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnOrderDefaultOptions => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getIndex = memo(\n position => [_getVisibleLeafColumns(table, position)],\n columns => columns.findIndex(d => d.id === column.id),\n getMemoOptions(table.options, 'debugColumns', 'getIndex')\n )\n column.getIsFirstColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[0]?.id === column.id\n }\n column.getIsLastColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[columns.length - 1]?.id === column.id\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnOrder = updater =>\n table.options.onColumnOrderChange?.(updater)\n table.resetColumnOrder = defaultState => {\n table.setColumnOrder(\n defaultState ? [] : table.initialState.columnOrder ?? []\n )\n }\n table._getOrderColumnsFn = memo(\n () => [\n table.getState().columnOrder,\n table.getState().grouping,\n table.options.groupedColumnMode,\n ],\n (columnOrder, grouping, groupedColumnMode) =>\n (columns: Column[]) => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns: Column[] = []\n\n // If there is no order, return the normal columns\n if (!columnOrder?.length) {\n orderedColumns = columns\n } else {\n const columnOrderCopy = [...columnOrder]\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns]\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift()\n const foundIndex = columnsCopy.findIndex(\n d => d.id === targetColumnId\n )\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy]\n }\n\n return orderColumns(orderedColumns, grouping, groupedColumnMode)\n },\n getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')\n )\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Column,\n Row,\n Cell,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type ColumnPinningPosition = false | 'left' | 'right'\n\nexport interface ColumnPinningState {\n left?: string[]\n right?: string[]\n}\n\nexport interface ColumnPinningTableState {\n columnPinning: ColumnPinningState\n}\n\nexport interface ColumnPinningOptions {\n /**\n * Enables/disables column pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enableColumnPinning?: boolean\n /**\n * @deprecated Use `enableColumnPinning` or `enableRowPinning` instead.\n * Enables/disables all pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange)\n */\n onColumnPinningChange?: OnChangeFn\n}\n\nexport interface ColumnPinningDefaultOptions {\n onColumnPinningChange: OnChangeFn\n}\n\nexport interface ColumnPinningColumnDef {\n /**\n * Enables/disables column pinning for this column. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n}\n\nexport interface ColumnPinningColumn {\n /**\n * Returns whether or not the column can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcanpin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the column. (`'left'`, `'right'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getispinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsPinned: () => ColumnPinningPosition\n /**\n * Returns the numeric pinned index of the column within a pinned column group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getpinnedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a column to the `'left'` or `'right'`, or unpins the column to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#pin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n pin: (position: ColumnPinningPosition) => void\n}\n\nexport interface ColumnPinningRow {\n /**\n * Returns all center pinned (unpinned) leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcentervisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterVisibleCells: () => Cell[]\n /**\n * Returns all left pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftVisibleCells: () => Cell[]\n /**\n * Returns all right pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightVisibleCells: () => Cell[]\n}\n\nexport interface ColumnPinningInstance {\n /**\n * Returns all center pinned (unpinned) leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcenterleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterLeafColumns: () => Column[]\n /**\n * Returns whether or not any columns are pinned. Optionally specify to only check for pinned columns in either the `left` or `right` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getissomecolumnspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean\n /**\n * Returns all left pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftLeafColumns: () => Column[]\n /**\n * Returns all right pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightLeafColumns: () => Column[]\n /**\n * Resets the **columnPinning** state to `initialState.columnPinning`, or `true` can be passed to force a default blank state reset to `{ left: [], right: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#resetcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n resetColumnPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#setcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n setColumnPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultColumnPinningState = (): ColumnPinningState => ({\n left: [],\n right: [],\n})\n\nexport const ColumnPinning: TableFeature = {\n getInitialState: (state): ColumnPinningTableState => {\n return {\n columnPinning: getDefaultColumnPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnPinningDefaultOptions => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.pin = position => {\n const columnIds = column\n .getLeafColumns()\n .map(d => d.id)\n .filter(Boolean) as string[]\n\n table.setColumnPinning(old => {\n if (position === 'right') {\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: [\n ...(old?.right ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n }\n }\n\n if (position === 'left') {\n return {\n left: [\n ...(old?.left ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n }\n\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n })\n }\n\n column.getCanPin = () => {\n const leafColumns = column.getLeafColumns()\n\n return leafColumns.some(\n d =>\n (d.columnDef.enablePinning ?? true) &&\n (table.options.enableColumnPinning ??\n table.options.enablePinning ??\n true)\n )\n }\n\n column.getIsPinned = () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id)\n\n const { left, right } = table.getState().columnPinning\n\n const isLeft = leafColumnIds.some(d => left?.includes(d))\n const isRight = leafColumnIds.some(d => right?.includes(d))\n\n return isLeft ? 'left' : isRight ? 'right' : false\n }\n\n column.getPinnedIndex = () => {\n const position = column.getIsPinned()\n\n return position\n ? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1\n : 0\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getCenterVisibleCells = memo(\n () => [\n row._getAllVisibleCells(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allCells, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allCells.filter(d => !leftAndRight.includes(d.column.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')\n )\n row.getLeftVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.left],\n (allCells, left) => {\n const cells = (left ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'left' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')\n )\n row.getRightVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.right],\n (allCells, right) => {\n const cells = (right ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'right' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n table.setColumnPinning = updater =>\n table.options.onColumnPinningChange?.(updater)\n\n table.resetColumnPinning = defaultState =>\n table.setColumnPinning(\n defaultState\n ? getDefaultColumnPinningState()\n : table.initialState?.columnPinning ?? getDefaultColumnPinningState()\n )\n\n table.getIsSomeColumnsPinned = position => {\n const pinningState = table.getState().columnPinning\n\n if (!position) {\n return Boolean(pinningState.left?.length || pinningState.right?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table.getLeftLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.left],\n (allColumns, left) => {\n return (left ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')\n )\n\n table.getRightLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.right],\n (allColumns, right) => {\n return (right ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')\n )\n\n table.getCenterLeafColumns = memo(\n () => [\n table.getAllLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allColumns.filter(d => !leftAndRight.includes(d.id))\n },\n getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')\n )\n },\n}\n","export function safelyAccessDocument(_document?: Document): Document | null {\n return _document || (typeof document !== 'undefined' ? document : null)\n}\n\nexport function safelyAccessDocumentEvent(event: Event): Document | null {\n return !!event &&\n !!event.target &&\n typeof event.target === 'object' &&\n 'ownerDocument' in event.target\n ? (event.target.ownerDocument as Document | null)\n : null\n}\n","import { _getVisibleLeafColumns } from '..'\nimport {\n RowData,\n Column,\n Header,\n OnChangeFn,\n Table,\n Updater,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\nimport { ColumnPinningPosition } from './ColumnPinning'\nimport { safelyAccessDocument } from '../utils/document'\n\n//\n\nexport interface ColumnSizingTableState {\n columnSizing: ColumnSizingState\n columnSizingInfo: ColumnSizingInfoState\n}\n\nexport type ColumnSizingState = Record\n\nexport interface ColumnSizingInfoState {\n columnSizingStart: [string, number][]\n deltaOffset: null | number\n deltaPercentage: null | number\n isResizingColumn: false | string\n startOffset: null | number\n startSize: null | number\n}\n\nexport type ColumnResizeMode = 'onChange' | 'onEnd'\n\nexport type ColumnResizeDirection = 'ltr' | 'rtl'\n\nexport interface ColumnSizingOptions {\n /**\n * Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnresizemode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeMode?: ColumnResizeMode\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enablecolumnresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableColumnResizing?: boolean\n /**\n * Enables or disables right-to-left support for resizing the column. defaults to 'ltr'.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnResizeDirection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeDirection?: ColumnResizeDirection\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingChange?: OnChangeFn\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizingInfo` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizingInfo` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizinginfochange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingInfoChange?: OnChangeFn\n}\n\nexport type ColumnSizingDefaultOptions = Pick<\n ColumnSizingOptions,\n | 'columnResizeMode'\n | 'onColumnSizingChange'\n | 'onColumnSizingInfoChange'\n | 'columnResizeDirection'\n>\n\nexport interface ColumnSizingInstance {\n /**\n * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcentertotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCenterTotalSize: () => number\n /**\n * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getlefttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getLeftTotalSize: () => number\n /**\n * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getrighttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getRightTotalSize: () => number\n /**\n * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#gettotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getTotalSize: () => number\n /**\n * Resets column sizing to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetColumnSizing: (defaultState?: boolean) => void\n /**\n * Resets column sizing info to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetheadersizeinfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetHeaderSizeInfo: (defaultState?: boolean) => void\n /**\n * Sets the column sizing state using an updater function or a value. This will trigger the underlying `onColumnSizingChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizing: (updater: Updater) => void\n /**\n * Sets the column sizing info state using an updater function or a value. This will trigger the underlying `onColumnSizingInfoChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizinginfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizingInfo: (updater: Updater) => void\n}\n\nexport interface ColumnSizingColumnDef {\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableResizing?: boolean\n /**\n * The maximum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n maxSize?: number\n /**\n * The minimum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n minSize?: number\n /**\n * The desired size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n size?: number\n}\n\nexport interface ColumnSizingColumn {\n /**\n * Returns `true` if the column can be resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcanresize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCanResize: () => boolean\n /**\n * Returns `true` if the column is currently being resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getisresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getIsResizing: () => boolean\n /**\n * Returns the current size of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column.\n */\n getAfter: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Resets the column to its initial size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetSize: () => void\n}\n\nexport interface ColumnSizingHeader {\n /**\n * Returns an event handler function that can be used to resize the header. It can be used as an:\n * - `onMouseDown` handler\n * - `onTouchStart` handler\n *\n * The dragging and release events are automatically handled for you.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getresizehandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getResizeHandler: (context?: Document) => (event: unknown) => void\n /**\n * Returns the current size of the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition) => number\n}\n\n//\n\nexport const defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n}\n\nconst getDefaultColumnSizingInfoState = (): ColumnSizingInfoState => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: [],\n})\n\nexport const ColumnSizing: TableFeature = {\n getDefaultColumnDef: (): ColumnSizingColumnDef => {\n return defaultColumnSizing\n },\n getInitialState: (state): ColumnSizingTableState => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnSizingDefaultOptions => {\n return {\n columnResizeMode: 'onEnd',\n columnResizeDirection: 'ltr',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getSize = () => {\n const columnSize = table.getState().columnSizing[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultColumnSizing.minSize,\n columnSize ?? column.columnDef.size ?? defaultColumnSizing.size\n ),\n column.columnDef.maxSize ?? defaultColumnSizing.maxSize\n )\n }\n\n column.getStart = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(0, column.getIndex(position))\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getStart')\n )\n\n column.getAfter = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(column.getIndex(position) + 1)\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getAfter')\n )\n\n column.resetSize = () => {\n table.setColumnSizing(({ [column.id]: _, ...rest }) => {\n return rest\n })\n }\n column.getCanResize = () => {\n return (\n (column.columnDef.enableResizing ?? true) &&\n (table.options.enableColumnResizing ?? true)\n )\n }\n column.getIsResizing = () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id\n }\n },\n\n createHeader: (\n header: Header,\n table: Table\n ): void => {\n header.getSize = () => {\n let sum = 0\n\n const recurse = (header: Header) => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse)\n } else {\n sum += header.column.getSize() ?? 0\n }\n }\n\n recurse(header)\n\n return sum\n }\n header.getStart = () => {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup.headers[header.index - 1]!\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()\n }\n\n return 0\n }\n header.getResizeHandler = _contextDocument => {\n const column = table.getColumn(header.column.id)\n const canResize = column?.getCanResize()\n\n return (e: unknown) => {\n if (!column || !canResize) {\n return\n }\n\n ;(e as any).persist?.()\n\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return\n }\n }\n\n const startSize = header.getSize()\n\n const columnSizingStart: [string, number][] = header\n ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()])\n : [[column.id, column.getSize()]]\n\n const clientX = isTouchStartEvent(e)\n ? Math.round(e.touches[0]!.clientX)\n : (e as MouseEvent).clientX\n\n const newColumnSizing: ColumnSizingState = {}\n\n const updateOffset = (\n eventType: 'move' | 'end',\n clientXPos?: number\n ) => {\n if (typeof clientXPos !== 'number') {\n return\n }\n\n table.setColumnSizingInfo(old => {\n const deltaDirection =\n table.options.columnResizeDirection === 'rtl' ? -1 : 1\n const deltaOffset =\n (clientXPos - (old?.startOffset ?? 0)) * deltaDirection\n const deltaPercentage = Math.max(\n deltaOffset / (old?.startSize ?? 0),\n -0.999999\n )\n\n old.columnSizingStart.forEach(([columnId, headerSize]) => {\n newColumnSizing[columnId] =\n Math.round(\n Math.max(headerSize + headerSize * deltaPercentage, 0) * 100\n ) / 100\n })\n\n return {\n ...old,\n deltaOffset,\n deltaPercentage,\n }\n })\n\n if (\n table.options.columnResizeMode === 'onChange' ||\n eventType === 'end'\n ) {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing,\n }))\n }\n }\n\n const onMove = (clientXPos?: number) => updateOffset('move', clientXPos)\n\n const onEnd = (clientXPos?: number) => {\n updateOffset('end', clientXPos)\n\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: [],\n }))\n }\n\n const contextDocument = safelyAccessDocument(_contextDocument)\n\n const mouseEvents = {\n moveHandler: (e: MouseEvent) => onMove(e.clientX),\n upHandler: (e: MouseEvent) => {\n contextDocument?.removeEventListener(\n 'mousemove',\n mouseEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'mouseup',\n mouseEvents.upHandler\n )\n onEnd(e.clientX)\n },\n }\n\n const touchEvents = {\n moveHandler: (e: TouchEvent) => {\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onMove(e.touches[0]!.clientX)\n return false\n },\n upHandler: (e: TouchEvent) => {\n contextDocument?.removeEventListener(\n 'touchmove',\n touchEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'touchend',\n touchEvents.upHandler\n )\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onEnd(e.touches[0]?.clientX)\n },\n }\n\n const passiveIfSupported = passiveEventSupported()\n ? { passive: false }\n : false\n\n if (isTouchStartEvent(e)) {\n contextDocument?.addEventListener(\n 'touchmove',\n touchEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'touchend',\n touchEvents.upHandler,\n passiveIfSupported\n )\n } else {\n contextDocument?.addEventListener(\n 'mousemove',\n mouseEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'mouseup',\n mouseEvents.upHandler,\n passiveIfSupported\n )\n }\n\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id,\n }))\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnSizing = updater =>\n table.options.onColumnSizingChange?.(updater)\n table.setColumnSizingInfo = updater =>\n table.options.onColumnSizingInfoChange?.(updater)\n table.resetColumnSizing = defaultState => {\n table.setColumnSizing(\n defaultState ? {} : table.initialState.columnSizing ?? {}\n )\n }\n table.resetHeaderSizeInfo = defaultState => {\n table.setColumnSizingInfo(\n defaultState\n ? getDefaultColumnSizingInfoState()\n : table.initialState.columnSizingInfo ??\n getDefaultColumnSizingInfoState()\n )\n }\n table.getTotalSize = () =>\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getLeftTotalSize = () =>\n table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getCenterTotalSize = () =>\n table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getRightTotalSize = () =>\n table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n },\n}\n\nlet passiveSupported: boolean | null = null\nexport function passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported\n\n let supported = false\n try {\n const options = {\n get passive() {\n supported = true\n return false\n },\n }\n\n const noop = () => {}\n\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop)\n } catch (err) {\n supported = false\n }\n passiveSupported = supported\n return passiveSupported\n}\n\nfunction isTouchStartEvent(e: unknown): e is TouchEvent {\n return (e as TouchEvent).type === 'touchstart'\n}\n","import { ColumnPinningPosition } from '..'\nimport {\n Cell,\n Column,\n OnChangeFn,\n Table,\n Updater,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type VisibilityState = Record\n\nexport interface VisibilityTableState {\n columnVisibility: VisibilityState\n}\n\nexport interface VisibilityOptions {\n /**\n * Whether to enable column hiding. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#enablehiding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n enableHiding?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n onColumnVisibilityChange?: OnChangeFn\n}\n\nexport type VisibilityDefaultOptions = Pick<\n VisibilityOptions,\n 'onColumnVisibilityChange'\n>\n\nexport interface VisibilityInstance {\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCenterVisibleLeafColumns: () => Column[]\n /**\n * Returns whether all columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsAllColumnsVisible: () => boolean\n /**\n * Returns whether any columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsSomeColumnsVisible: () => boolean\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getLeftVisibleLeafColumns: () => Column[]\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getRightVisibleLeafColumns: () => Column[]\n /**\n * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void\n /**\n * Returns a flat array of columns that are visible, including parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleFlatColumns: () => Column[]\n /**\n * Returns a flat array of leaf-node columns that are visible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleLeafColumns: () => Column[]\n /**\n * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n resetColumnVisibility: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnVisibility` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n setColumnVisibility: (updater: Updater) => void\n /**\n * Toggles the visibility of all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleAllColumnsVisible: (value?: boolean) => void\n}\n\nexport interface VisibilityColumnDef {\n enableHiding?: boolean\n}\n\nexport interface VisibilityRow {\n _getAllVisibleCells: () => Cell[]\n /**\n * Returns an array of cells that account for column visibility for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleCells: () => Cell[]\n}\n\nexport interface VisibilityColumn {\n /**\n * Returns whether the column can be hidden\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCanHide: () => boolean\n /**\n * Returns whether the column is visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsVisible: () => boolean\n /**\n * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleVisibilityHandler: () => (event: unknown) => void\n /**\n * Toggles the visibility of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleVisibility: (value?: boolean) => void\n}\n\n//\n\nexport const ColumnVisibility: TableFeature = {\n getInitialState: (state): VisibilityTableState => {\n return {\n columnVisibility: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): VisibilityDefaultOptions => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleVisibility = value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value ?? !column.getIsVisible(),\n }))\n }\n }\n column.getIsVisible = () => {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some(c => c.getIsVisible())\n : table.getState().columnVisibility?.[column.id]) ?? true\n )\n }\n\n column.getCanHide = () => {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (table.options.enableHiding ?? true)\n )\n }\n column.getToggleVisibilityHandler = () => {\n return (e: unknown) => {\n column.toggleVisibility?.(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row._getAllVisibleCells = memo(\n () => [row.getAllCells(), table.getState().columnVisibility],\n cells => {\n return cells.filter(cell => cell.column.getIsVisible())\n },\n getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')\n )\n row.getVisibleCells = memo(\n () => [\n row.getLeftVisibleCells(),\n row.getCenterVisibleCells(),\n row.getRightVisibleCells(),\n ],\n (left, center, right) => [...left, ...center, ...right],\n getMemoOptions(table.options, 'debugRows', 'getVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n const makeVisibleColumnsMethod = (\n key: string,\n getColumns: () => Column[]\n ): (() => Column[]) => {\n return memo(\n () => [\n getColumns(),\n getColumns()\n .filter(d => d.getIsVisible())\n .map(d => d.id)\n .join('_'),\n ],\n columns => {\n return columns.filter(d => d.getIsVisible?.())\n },\n getMemoOptions(table.options, 'debugColumns', key)\n )\n }\n\n table.getVisibleFlatColumns = makeVisibleColumnsMethod(\n 'getVisibleFlatColumns',\n () => table.getAllFlatColumns()\n )\n table.getVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getVisibleLeafColumns',\n () => table.getAllLeafColumns()\n )\n table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getLeftVisibleLeafColumns',\n () => table.getLeftLeafColumns()\n )\n table.getRightVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getRightVisibleLeafColumns',\n () => table.getRightLeafColumns()\n )\n table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getCenterVisibleLeafColumns',\n () => table.getCenterLeafColumns()\n )\n\n table.setColumnVisibility = updater =>\n table.options.onColumnVisibilityChange?.(updater)\n\n table.resetColumnVisibility = defaultState => {\n table.setColumnVisibility(\n defaultState ? {} : table.initialState.columnVisibility ?? {}\n )\n }\n\n table.toggleAllColumnsVisible = value => {\n value = value ?? !table.getIsAllColumnsVisible()\n\n table.setColumnVisibility(\n table.getAllLeafColumns().reduce(\n (obj, column) => ({\n ...obj,\n [column.id]: !value ? !column.getCanHide?.() : value,\n }),\n {}\n )\n )\n }\n\n table.getIsAllColumnsVisible = () =>\n !table.getAllLeafColumns().some(column => !column.getIsVisible?.())\n\n table.getIsSomeColumnsVisible = () =>\n table.getAllLeafColumns().some(column => column.getIsVisible?.())\n\n table.getToggleAllColumnsVisibilityHandler = () => {\n return (e: unknown) => {\n table.toggleAllColumnsVisible(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nexport function _getVisibleLeafColumns(\n table: Table,\n position?: ColumnPinningPosition | 'center'\n) {\n return !position\n ? table.getVisibleLeafColumns()\n : position === 'center'\n ? table.getCenterVisibleLeafColumns()\n : position === 'left'\n ? table.getLeftVisibleLeafColumns()\n : table.getRightVisibleLeafColumns()\n}\n","import { RowModel } from '..'\nimport { Table, RowData, TableFeature } from '../types'\n\nexport interface GlobalFacetingInstance {\n _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]\n _getGlobalFacetedRowModel?: () => RowModel\n _getGlobalFacetedUniqueValues?: () => Map\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model for the table after **global** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedRowModel: () => RowModel\n /**\n * Returns the faceted unique values for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedUniqueValues: () => Map\n}\n\n//\n\nexport const GlobalFaceting: TableFeature = {\n createTable: (table: Table): void => {\n table._getGlobalFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, '__global__')\n\n table.getGlobalFacetedRowModel = () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getGlobalFacetedRowModel()\n }\n\n table._getGlobalFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, '__global__')\n table.getGlobalFacetedUniqueValues = () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map()\n }\n\n return table._getGlobalFacetedUniqueValues()\n }\n\n table._getGlobalFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, '__global__')\n table.getGlobalFacetedMinMaxValues = () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return\n }\n\n return table._getGlobalFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn, FilterFnOption } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n OnChangeFn,\n Table,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport interface GlobalFilterTableState {\n globalFilter: any\n}\n\nexport interface GlobalFilterColumnDef {\n /**\n * Enables/disables the **global** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n}\n\nexport interface GlobalFilterColumn {\n /**\n * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getCanGlobalFilter: () => boolean\n}\n\nexport interface GlobalFilterOptions {\n /**\n * Enables/disables **global** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n /**\n * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering.\n *\n * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcolumncanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getColumnCanGlobalFilter?: (column: Column) => boolean\n /**\n * The filter function to use for global filtering.\n * - A `string` referencing a built-in filter function\n * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option\n * - A custom filter function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#globalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n globalFilterFn?: FilterFnOption\n /**\n * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#onglobalfilterchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n onGlobalFilterChange?: OnChangeFn\n}\n\nexport interface GlobalFilterInstance {\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalFilterFn: () => FilterFn | undefined\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const GlobalFiltering: TableFeature = {\n getInitialState: (state): GlobalFilterTableState => {\n return {\n globalFilter: undefined,\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GlobalFilterOptions => {\n return {\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n const value = table\n .getCoreRowModel()\n .flatRows[0]?._getAllCellsByColumnId()\n [column.id]?.getValue()\n\n return typeof value === 'string' || typeof value === 'number'\n },\n } as GlobalFilterOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getCanGlobalFilter = () => {\n return (\n (column.columnDef.enableGlobalFilter ?? true) &&\n (table.options.enableGlobalFilter ?? true) &&\n (table.options.enableFilters ?? true) &&\n (table.options.getColumnCanGlobalFilter?.(column) ?? true) &&\n !!column.accessorFn\n )\n }\n },\n\n createTable: (table: Table): void => {\n table.getGlobalAutoFilterFn = () => {\n return filterFns.includesString\n }\n\n table.getGlobalFilterFn = () => {\n const { globalFilterFn: globalFilterFn } = table.options\n\n return isFunction(globalFilterFn)\n ? globalFilterFn\n : globalFilterFn === 'auto'\n ? table.getGlobalAutoFilterFn()\n : table.options.filterFns?.[globalFilterFn as string] ??\n filterFns[globalFilterFn as BuiltInFilterFn]\n }\n\n table.setGlobalFilter = updater => {\n table.options.onGlobalFilterChange?.(updater)\n }\n\n table.resetGlobalFilter = defaultState => {\n table.setGlobalFilter(\n defaultState ? undefined : table.initialState.globalFilter\n )\n }\n },\n}\n","import { RowModel } from '..'\nimport {\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { makeStateUpdater } from '../utils'\n\nexport type ExpandedStateList = Record\nexport type ExpandedState = true | Record\nexport interface ExpandedTableState {\n expanded: ExpandedState\n}\n\nexport interface ExpandedRow {\n /**\n * Returns whether the row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanExpand: () => boolean\n /**\n * Returns whether all parent rows of the row are expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallparentsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllParentsExpanded: () => boolean\n /**\n * Returns whether the row is expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsExpanded: () => boolean\n /**\n * Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleExpandedHandler: () => () => void\n /**\n * Toggles the expanded state (or sets it if `expanded` is provided) for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleExpanded: (expanded?: boolean) => void\n}\n\nexport interface ExpandedOptions {\n /**\n * Enable this setting to automatically reset the expanded state of the table when expanding state changes.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#autoresetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n autoResetExpanded?: boolean\n /**\n * Enable/disable expanding for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#enableexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n enableExpanding?: boolean\n /**\n * This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported `getExpandedRowModel` function to get the expanded row model or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel?: (table: Table) => () => RowModel\n /**\n * If provided, allows you to override the default behavior of determining whether a row is currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisrowexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsRowExpanded?: (row: Row) => boolean\n /**\n * If provided, allows you to override the default behavior of determining whether a row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getrowcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getRowCanExpand?: (row: Row) => boolean\n /**\n * Enables manual row expansion. If this is set to `true`, `getExpandedRowModel` will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#manualexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n manualExpanding?: boolean\n /**\n * This function is called when the `expanded` table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the `tableOptions.state.expanded` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#onexpandedchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n onExpandedChange?: OnChangeFn\n /**\n * If `true` expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages). If `false` expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#paginateexpandedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n paginateExpandedRows?: boolean\n}\n\nexport interface ExpandedInstance {\n _autoResetExpanded: () => void\n _getExpandedRowModel?: () => RowModel\n /**\n * Returns whether there are any rows that can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcansomerowsexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanSomeRowsExpand: () => boolean\n /**\n * Returns the maximum depth of the expanded rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandeddepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedDepth: () => number\n /**\n * Returns the row model after expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel: () => RowModel\n /**\n * Returns whether all rows are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllRowsExpanded: () => boolean\n /**\n * Returns whether there are any rows that are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getissomerowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsSomeRowsExpanded: () => boolean\n /**\n * Returns the row model before expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getpreexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getPreExpandedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleallrowsexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleAllRowsExpandedHandler: () => (event: unknown) => void\n /**\n * Resets the expanded state of the table to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#resetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n resetExpanded: (defaultState?: boolean) => void\n /**\n * Updates the expanded state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#setexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n setExpanded: (updater: Updater) => void\n /**\n * Toggles the expanded state for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleAllRowsExpanded: (expanded?: boolean) => void\n}\n\n//\n\nexport const RowExpanding: TableFeature = {\n getInitialState: (state): ExpandedTableState => {\n return {\n expanded: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ExpandedOptions => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true,\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetExpanded = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetExpanded ??\n !table.options.manualExpanding\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetExpanded()\n queued = false\n })\n }\n }\n table.setExpanded = updater => table.options.onExpandedChange?.(updater)\n table.toggleAllRowsExpanded = expanded => {\n if (expanded ?? !table.getIsAllRowsExpanded()) {\n table.setExpanded(true)\n } else {\n table.setExpanded({})\n }\n }\n table.resetExpanded = defaultState => {\n table.setExpanded(defaultState ? {} : table.initialState?.expanded ?? {})\n }\n table.getCanSomeRowsExpand = () => {\n return table\n .getPrePaginationRowModel()\n .flatRows.some(row => row.getCanExpand())\n }\n table.getToggleAllRowsExpandedHandler = () => {\n return (e: unknown) => {\n ;(e as any).persist?.()\n table.toggleAllRowsExpanded()\n }\n }\n table.getIsSomeRowsExpanded = () => {\n const expanded = table.getState().expanded\n return expanded === true || Object.values(expanded).some(Boolean)\n }\n table.getIsAllRowsExpanded = () => {\n const expanded = table.getState().expanded\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true\n }\n\n if (!Object.keys(expanded).length) {\n return false\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false\n }\n\n // They must all be expanded :shrug:\n return true\n }\n table.getExpandedDepth = () => {\n let maxDepth = 0\n\n const rowIds =\n table.getState().expanded === true\n ? Object.keys(table.getRowModel().rowsById)\n : Object.keys(table.getState().expanded)\n\n rowIds.forEach(id => {\n const splitId = id.split('.')\n maxDepth = Math.max(maxDepth, splitId.length)\n })\n\n return maxDepth\n }\n table.getPreExpandedRowModel = () => table.getSortedRowModel()\n table.getExpandedRowModel = () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table)\n }\n\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._getExpandedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleExpanded = expanded => {\n table.setExpanded(old => {\n const exists = old === true ? true : !!old?.[row.id]\n\n let oldExpanded: ExpandedStateList = {}\n\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true\n })\n } else {\n oldExpanded = old\n }\n\n expanded = expanded ?? !exists\n\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true,\n }\n }\n\n if (exists && !expanded) {\n const { [row.id]: _, ...rest } = oldExpanded\n return rest\n }\n\n return old\n })\n }\n row.getIsExpanded = () => {\n const expanded = table.getState().expanded\n\n return !!(\n table.options.getIsRowExpanded?.(row) ??\n (expanded === true || expanded?.[row.id])\n )\n }\n row.getCanExpand = () => {\n return (\n table.options.getRowCanExpand?.(row) ??\n ((table.options.enableExpanding ?? true) && !!row.subRows?.length)\n )\n }\n row.getIsAllParentsExpanded = () => {\n let isFullyExpanded = true\n let currentRow = row\n\n while (isFullyExpanded && currentRow.parentId) {\n currentRow = table.getRow(currentRow.parentId, true)\n isFullyExpanded = currentRow.getIsExpanded()\n }\n\n return isFullyExpanded\n }\n row.getToggleExpandedHandler = () => {\n const canExpand = row.getCanExpand()\n\n return () => {\n if (!canExpand) return\n row.toggleExpanded()\n }\n }\n },\n}\n","import {\n OnChangeFn,\n Table,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport {\n functionalUpdate,\n getMemoOptions,\n makeStateUpdater,\n memo,\n} from '../utils'\n\nexport interface PaginationState {\n pageIndex: number\n pageSize: number\n}\n\nexport interface PaginationTableState {\n pagination: PaginationState\n}\n\nexport interface PaginationInitialTableState {\n pagination?: Partial\n}\n\nexport interface PaginationOptions {\n /**\n * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n autoResetPageIndex?: boolean\n /**\n * Returns the row model after pagination has taken place, but no further.\n *\n * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel?: (table: Table) => () => RowModel\n /**\n * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n manualPagination?: boolean\n /**\n * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n onPaginationChange?: OnChangeFn\n /**\n * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n pageCount?: number\n /**\n * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n rowCount?: number\n}\n\nexport interface PaginationDefaultOptions {\n onPaginationChange: OnChangeFn\n}\n\nexport interface PaginationInstance {\n _autoResetPageIndex: () => void\n _getPaginationRowModel?: () => RowModel\n /**\n * Returns whether the table can go to the next page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanNextPage: () => boolean\n /**\n * Returns whether the table can go to the previous page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanPreviousPage: () => boolean\n /**\n * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageCount: () => number\n /**\n * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getRowCount: () => number\n /**\n * Returns an array of page options (zero-index-based) for the current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageOptions: () => number[]\n /**\n * Returns the row model for the table after pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel: () => RowModel\n /**\n * Returns the row model for the table before any pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPrePaginationRowModel: () => RowModel\n /**\n * Increments the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n nextPage: () => void\n /**\n * Decrements the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n previousPage: () => void\n /**\n * Sets the page index to `0`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n firstPage: () => void\n /**\n * Sets the page index to the last page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n lastPage: () => void\n /**\n * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageIndex: (defaultState?: boolean) => void\n /**\n * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageSize: (defaultState?: boolean) => void\n /**\n * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPagination: (defaultState?: boolean) => void\n /**\n * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead.\n */\n setPageCount: (updater: Updater) => void\n /**\n * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageIndex: (updater: Updater) => void\n /**\n * Updates the page size using the provided function or value in the `state.pagination.pageSize` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageSize: (updater: Updater) => void\n /**\n * Sets or updates the `state.pagination` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPagination: (updater: Updater) => void\n}\n\n//\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\nconst getDefaultPaginationState = (): PaginationState => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n})\n\nexport const RowPagination: TableFeature = {\n getInitialState: (state): PaginationTableState => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...state?.pagination,\n },\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): PaginationDefaultOptions => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table),\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetPageIndex = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetPageIndex()\n queued = false\n })\n }\n }\n table.setPagination = updater => {\n const safeUpdater: Updater = old => {\n let newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n }\n table.resetPagination = defaultState => {\n table.setPagination(\n defaultState\n ? getDefaultPaginationState()\n : table.initialState.pagination ?? getDefaultPaginationState()\n )\n }\n table.setPageIndex = updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n }\n table.resetPageIndex = defaultState => {\n table.setPageIndex(\n defaultState\n ? defaultPageIndex\n : table.initialState?.pagination?.pageIndex ?? defaultPageIndex\n )\n }\n table.resetPageSize = defaultState => {\n table.setPageSize(\n defaultState\n ? defaultPageSize\n : table.initialState?.pagination?.pageSize ?? defaultPageSize\n )\n }\n table.setPageSize = updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex!\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n }\n //deprecated\n table.setPageCount = updater =>\n table.setPagination(old => {\n let newPageCount = functionalUpdate(\n updater,\n table.options.pageCount ?? -1\n )\n\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount)\n }\n\n return {\n ...old,\n pageCount: newPageCount,\n }\n })\n\n table.getPageOptions = memo(\n () => [table.getPageCount()],\n pageCount => {\n let pageOptions: number[] = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n },\n getMemoOptions(table.options, 'debugTable', 'getPageOptions')\n )\n\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0\n\n table.getCanNextPage = () => {\n const { pageIndex } = table.getState().pagination\n\n const pageCount = table.getPageCount()\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n }\n\n table.previousPage = () => {\n return table.setPageIndex(old => old - 1)\n }\n\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1\n })\n }\n\n table.firstPage = () => {\n return table.setPageIndex(0)\n }\n\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1)\n }\n\n table.getPrePaginationRowModel = () => table.getExpandedRowModel()\n table.getPaginationRowModel = () => {\n if (\n !table._getPaginationRowModel &&\n table.options.getPaginationRowModel\n ) {\n table._getPaginationRowModel =\n table.options.getPaginationRowModel(table)\n }\n\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel()\n }\n\n return table._getPaginationRowModel()\n }\n\n table.getPageCount = () => {\n return (\n table.options.pageCount ??\n Math.ceil(table.getRowCount() / table.getState().pagination.pageSize)\n )\n }\n\n table.getRowCount = () => {\n return (\n table.options.rowCount ?? table.getPrePaginationRowModel().rows.length\n )\n }\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance {\n _getPinnedRows: (\n visiblePinnedRows: Array>,\n pinnedRowIds: Array | undefined,\n position: 'top' | 'bottom'\n ) => Row[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top' ? table.getTopRows() : table.getBottomRows()\n )?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows.filter(Boolean).map(d => ({ ...d, position })) as Row[]\n }\n\n table.getTopRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.top],\n (allRows, topPinnedRowIds) =>\n table._getPinnedRows(allRows, topPinnedRowIds, 'top'),\n getMemoOptions(table.options, 'debugRows', 'getTopRows')\n )\n\n table.getBottomRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.bottom],\n (allRows, bottomPinnedRowIds) =>\n table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'),\n getMemoOptions(table.options, 'debugRows', 'getBottomRows')\n )\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n","import {\n OnChangeFn,\n Table,\n Row,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowSelectionState = Record\n\nexport interface RowSelectionTableState {\n rowSelection: RowSelectionState\n}\n\nexport interface RowSelectionOptions {\n /**\n * - Enables/disables multiple row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablemultirowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableMultiRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * - Enables/disables row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable row selection for that row\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablerowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * Enables/disables automatic sub-row selection when a parent row is selected, or a function that enables/disables automatic sub-row selection for each row.\n * (Use in combination with expanding or grouping features)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablesubrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableSubRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowSelection` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#onrowselectionchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n onRowSelectionChange?: OnChangeFn\n // enableGroupingRowSelection?:\n // | boolean\n // | ((\n // row: Row\n // ) => boolean)\n // isAdditiveSelectEvent?: (e: unknown) => boolean\n // isInclusiveSelectEvent?: (e: unknown) => boolean\n // selectRowsFn?: (\n // table: Table,\n // rowModel: RowModel\n // ) => RowModel\n}\n\nexport interface RowSelectionRow {\n /**\n * Returns whether or not the row can multi-select.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanmultiselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanMultiSelect: () => boolean\n /**\n * Returns whether or not the row can be selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelect: () => boolean\n /**\n * Returns whether or not the row can select sub rows automatically when the parent row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselectsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelectSubRows: () => boolean\n /**\n * Returns whether or not all of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallsubrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllSubRowsSelected: () => boolean\n /**\n * Returns whether or not the row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSelected: () => boolean\n /**\n * Returns whether or not some of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomeselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeSelected: () => boolean\n /**\n * Returns a handler that can be used to toggle the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleSelectedHandler: () => (event: unknown) => void\n /**\n * Selects/deselects the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleSelected: (value?: boolean, opts?: { selectChildren?: boolean }) => void\n}\n\nexport interface RowSelectionInstance {\n /**\n * Returns the row model of all rows that are selected after filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getfilteredselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getFilteredSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getgroupedselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getGroupedSelectedRowModel: () => RowModel\n /**\n * Returns whether or not all rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllPageRowsSelected: () => boolean\n /**\n * Returns whether or not all rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllRowsSelected: () => boolean\n /**\n * Returns whether or not any rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomePageRowsSelected: () => boolean\n /**\n * Returns whether or not any rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeRowsSelected: () => boolean\n /**\n * Returns the core row model of all rows before row selection has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getpreselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getPreSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getSelectedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallpagerowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Returns a handler that can be used to toggle all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallrowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Resets the **rowSelection** state to the `initialState.rowSelection`, or `true` can be passed to force a default blank state reset to `{}`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#resetrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n resetRowSelection: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowSelection` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#setrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n setRowSelection: (updater: Updater) => void\n /**\n * Selects/deselects all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllPageRowsSelected: (value?: boolean) => void\n /**\n * Selects/deselects all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllRowsSelected: (value?: boolean) => void\n}\n\n//\n\nexport const RowSelection: TableFeature = {\n getInitialState: (state): RowSelectionTableState => {\n return {\n rowSelection: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowSelectionOptions => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true,\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowSelection = updater =>\n table.options.onRowSelectionChange?.(updater)\n table.resetRowSelection = defaultState =>\n table.setRowSelection(\n defaultState ? {} : table.initialState.rowSelection ?? {}\n )\n table.toggleAllRowsSelected = value => {\n table.setRowSelection(old => {\n value =\n typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n }\n table.toggleAllPageRowsSelected = value =>\n table.setRowSelection(old => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table.getIsAllPageRowsSelected()\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n table.getPreSelectedRowModel = () => table.getCoreRowModel()\n table.getSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getCoreRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')\n )\n\n table.getFilteredSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getFilteredRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')\n )\n\n table.getGroupedSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getSortedRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')\n )\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n table.getIsAllRowsSelected = () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const { rowSelection } = table.getState()\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n row => row.getCanSelect() && !rowSelection[row.id]\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n }\n\n table.getIsAllPageRowsSelected = () => {\n const paginationFlatRows = table\n .getPaginationRowModel()\n .flatRows.filter(row => row.getCanSelect())\n const { rowSelection } = table.getState()\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some(row => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n }\n\n table.getIsSomeRowsSelected = () => {\n const totalSelected = Object.keys(\n table.getState().rowSelection ?? {}\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n }\n\n table.getIsSomePageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows\n return table.getIsAllPageRowsSelected()\n ? false\n : paginationFlatRows\n .filter(row => row.getCanSelect())\n .some(d => d.getIsSelected() || d.getIsSomeSelected())\n }\n\n table.getToggleAllRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n\n table.getToggleAllPageRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllPageRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleSelected = (value, opts) => {\n const isSelected = row.getIsSelected()\n\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row.getCanSelect() && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n table\n )\n\n return selectedRowIds\n })\n }\n row.getIsSelected = () => {\n const { rowSelection } = table.getState()\n return isRowSelected(row, rowSelection)\n }\n\n row.getIsSomeSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'some'\n }\n\n row.getIsAllSubRowsSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'all'\n }\n\n row.getCanSelect = () => {\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row)\n }\n\n return table.options.enableRowSelection ?? true\n }\n\n row.getCanSelectSubRows = () => {\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row)\n }\n\n return table.options.enableSubRowSelection ?? true\n }\n\n row.getCanMultiSelect = () => {\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row)\n }\n\n return table.options.enableMultiRowSelection ?? true\n }\n row.getToggleSelectedHandler = () => {\n const canSelect = row.getCanSelect()\n\n return (e: unknown) => {\n if (!canSelect) return\n row.toggleSelected(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nconst mutateRowIsSelected = (\n selectedRowIds: Record,\n id: string,\n value: boolean,\n includeChildren: boolean,\n table: Table\n) => {\n const row = table.getRow(id, true)\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key])\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true\n }\n } else {\n delete selectedRowIds[id]\n }\n // }\n\n if (includeChildren && row.subRows?.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row =>\n mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)\n )\n }\n}\n\nexport function selectRowsFn(\n table: Table,\n rowModel: RowModel\n): RowModel {\n const rowSelection = table.getState().rowSelection\n\n const newSelectedFlatRows: Row[] = []\n const newSelectedRowsById: Record> = {}\n\n // Filters top level and nested rows\n const recurseRows = (rows: Row[], depth = 0): Row[] => {\n return rows\n .map(row => {\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows?.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n return row\n }\n })\n .filter(Boolean) as Row[]\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\nexport function isRowSelected(\n row: Row,\n selection: Record\n): boolean {\n return selection[row.id] ?? false\n}\n\nexport function isSubRowSelected(\n row: Row,\n selection: Record,\n table: Table\n): boolean | 'some' | 'all' {\n if (!row.subRows?.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (subRow.getCanSelect()) {\n if (isRowSelected(subRow, selection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows && subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow, selection, table)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n","import { SortingFn } from './features/RowSorting'\n\nexport const reSplitAlphaNumeric = /([0-9]+)/gm\n\nconst alphanumeric: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\nconst alphanumericCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\nconst datetime: SortingFn = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId)\n const b = rowB.getValue(columnId)\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0\n}\n\nconst basic: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId))\n}\n\n// Utils\n\nfunction compareBasic(a: any, b: any) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction toString(a: any) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr: string, bStr: string) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean)\n\n // While\n while (a.length && b.length) {\n const aa = a.shift()!\n const bb = b.shift()!\n\n const an = parseInt(aa, 10)\n const bn = parseInt(bb, 10)\n\n const combo = [an, bn].sort()\n\n // Both are string\n if (isNaN(combo[0]!)) {\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1]!)) {\n return isNaN(an) ? -1 : 1\n }\n\n // Both are numbers\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n }\n\n return a.length - b.length\n}\n\n// Exports\n\nexport const sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic,\n}\n\nexport type BuiltInSortingFn = keyof typeof sortingFns\n","import { RowModel } from '..'\nimport {\n BuiltInSortingFn,\n reSplitAlphaNumeric,\n sortingFns,\n} from '../sortingFns'\n\nimport {\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n SortingFns,\n TableFeature,\n} from '../types'\n\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type SortDirection = 'asc' | 'desc'\n\nexport interface ColumnSort {\n desc: boolean\n id: string\n}\n\nexport type SortingState = ColumnSort[]\n\nexport interface SortingTableState {\n sorting: SortingState\n}\n\nexport interface SortingFn {\n (rowA: Row, rowB: Row, columnId: string): number\n}\n\nexport type CustomSortingFns = Record<\n string,\n SortingFn\n>\n\nexport type SortingFnOption =\n | 'auto'\n | keyof SortingFns\n | BuiltInSortingFn\n | SortingFn\n\nexport interface SortingColumnDef {\n /**\n * Enables/Disables multi-sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n invertSorting?: boolean\n /**\n * Set to `true` for sorting toggles on this column to start in the descending direction.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n /**\n * The sorting function to use with this column.\n * - A `string` referencing a built-in sorting function\n * - A custom sorting function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortingFn?: SortingFnOption\n /**\n * The priority of undefined values when sorting this column.\n * - `false`\n * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)\n * - `-1`\n * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)\n * - `1`\n * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortundefined)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n}\n\nexport interface SortingColumn {\n /**\n * Removes this column from the table's sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n clearSorting: () => void\n /**\n * Returns a sort direction automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortDir: () => SortDirection\n /**\n * Returns a sorting function automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortingFn: () => SortingFn\n /**\n * Returns whether this column can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanMultiSort: () => boolean\n /**\n * Returns whether this column can be sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanSort: () => boolean\n /**\n * Returns the first direction that should be used when sorting this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getFirstSortDir: () => SortDirection\n /**\n * Returns the current sort direction of this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getIsSorted: () => false | SortDirection\n /**\n * Returns the next sorting order.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getNextSortingOrder: () => SortDirection | false\n /**\n * Returns the index position of this column's sorting within the sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortIndex: () => number\n /**\n * Returns the resolved sorting function to be used for this column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortingFn: () => SortingFn\n /**\n * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getToggleSortingHandler: () => undefined | ((event: unknown) => void)\n /**\n * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n toggleSorting: (desc?: boolean, isMulti?: boolean) => void\n}\n\ninterface SortingOptionsBase {\n /**\n * Enables/disables the ability to remove multi-sorts\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiRemove?: boolean\n /**\n * Enables/Disables multi-sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Enables/Disables the ability to remove sorting for the table.\n * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ...\n * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ...\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSortingRemoval?: boolean\n /**\n * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel?: (table: Table) => () => RowModel\n /**\n * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n isMultiSortEvent?: (e: unknown) => boolean\n /**\n * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n manualSorting?: boolean\n /**\n * Set a maximum number of columns that can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n maxMultiSortColCount?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.sorting` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n onSortingChange?: OnChangeFn\n /**\n * If `true`, all sorts will default to descending as their first toggle state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n}\n\ntype ResolvedSortingFns = keyof SortingFns extends never\n ? {\n sortingFns?: Record>\n }\n : {\n sortingFns: Record>\n }\n\nexport interface SortingOptions\n extends SortingOptionsBase,\n ResolvedSortingFns {}\n\nexport interface SortingInstance {\n _getSortedRowModel?: () => RowModel\n /**\n * Returns the row model for the table before any sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getPreSortedRowModel: () => RowModel\n /**\n * Returns the row model for the table after sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel: () => RowModel\n /**\n * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n resetSorting: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.sorting` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n setSorting: (updater: Updater) => void\n}\n\n//\n\nexport const RowSorting: TableFeature = {\n getInitialState: (state): SortingTableState => {\n return {\n sorting: [],\n ...state,\n }\n },\n\n getDefaultColumnDef: (): SortingColumnDef => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): SortingOptions => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoSortingFn = () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row?.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric\n }\n }\n }\n\n if (isString) {\n return sortingFns.text\n }\n\n return sortingFns.basic\n }\n column.getAutoSortDir = () => {\n const firstRow = table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n }\n column.getSortingFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.sortingFn)\n ? column.columnDef.sortingFn\n : column.columnDef.sortingFn === 'auto'\n ? column.getAutoSortingFn()\n : table.options.sortingFns?.[column.columnDef.sortingFn as string] ??\n sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]\n }\n column.toggleSorting = (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder()\n const hasManualValue = typeof desc !== 'undefined' && desc !== null\n\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old?.find(d => d.id === column.id)\n const existingIndex = old?.findIndex(d => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old?.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old?.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n }\n\n column.getFirstSortDir = () => {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n table.options.sortDescFirst ??\n column.getAutoSortDir() === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n }\n\n column.getNextSortingOrder = (multi?: boolean) => {\n const firstSortDirection = column.getFirstSortDir()\n const isSorted = column.getIsSorted()\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n }\n\n column.getCanSort = () => {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getCanMultiSort = () => {\n return (\n column.columnDef.enableMultiSort ??\n table.options.enableMultiSort ??\n !!column.accessorFn\n )\n }\n\n column.getIsSorted = () => {\n const columnSort = table.getState().sorting?.find(d => d.id === column.id)\n\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n }\n\n column.getSortIndex = () =>\n table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1\n\n column.clearSorting = () => {\n //clear sorting for just 1 column\n table.setSorting(old =>\n old?.length ? old.filter(d => d.id !== column.id) : []\n )\n }\n\n column.getToggleSortingHandler = () => {\n const canSort = column.getCanSort()\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column.toggleSorting?.(\n undefined,\n column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false\n )\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setSorting = updater => table.options.onSortingChange?.(updater)\n table.resetSorting = defaultState => {\n table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])\n }\n table.getPreSortedRowModel = () => table.getGroupedRowModel()\n table.getSortedRowModel = () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table)\n }\n\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._getSortedRowModel()\n }\n },\n}\n","import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table) => () => RowModel\n /**\n * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row) => string\n /**\n * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions,\n options: Partial>\n ) => TableOptions\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial\n}\n\nexport interface CoreInstance {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record>\n _getColumnDefs: () => ColumnDef[]\n _getCoreRowModel?: () => RowModel\n _getDefaultColumnDef: () => Partial>\n _getRowId: (_: TData, index: number, parent?: Row) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater) => void\n}\n\nexport function createTable(\n options: TableOptionsResolved\n): Table {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved\n\n const mergeOptions = (options: TableOptionsResolved) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef[],\n parent?: Column,\n depth = 0\n ): Column[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n","import { createRow } from '../core/row'\nimport { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getCoreRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.options.data],\n (\n data\n ): {\n rows: Row[]\n flatRows: Row[]\n rowsById: Record>\n } => {\n const rowModel: RowModel = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: TData[],\n depth = 0,\n parentRow?: Row\n ): Row[] => {\n const rows = [] as Row[]\n\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(\n table,\n table._getRowId(originalRows[i]!, i, parentRow),\n originalRows[i]!,\n i,\n depth,\n undefined,\n parentRow?.id\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(\n originalRows[i]!,\n i\n )\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getExpandedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().expanded,\n table.getPreExpandedRowModel(),\n table.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel\n }\n\n return expandRows(rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')\n )\n}\n\nexport function expandRows(rowModel: RowModel) {\n const expandedRows: Row[] = []\n\n const handleRow = (row: Row) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedMinMaxValues(): (\n table: Table,\n columnId: string\n) => () => undefined | [number, number] {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return undefined\n\n const uniqueValues = facetedRowModel.flatRows\n .flatMap(flatRow => flatRow.getUniqueValues(columnId) ?? [])\n .map(Number)\n .filter(value => !Number.isNaN(value))\n\n if (!uniqueValues.length) return\n\n let facetedMinValue = uniqueValues[0]!\n let facetedMaxValue = uniqueValues[uniqueValues.length - 1]!\n\n for (const value of uniqueValues) {\n if (value < facetedMinValue) facetedMinValue = value\n else if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n return [facetedMinValue, facetedMaxValue]\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')\n )\n}\n","import { createRow } from '../core/row'\nimport { Row, RowModel, Table, RowData } from '../types'\n\nexport function filterRows(\n rows: Row[],\n filterRowImpl: (row: Row) => any,\n table: Table\n) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table)\n }\n\n return filterRowModelFromRoot(rows, filterRowImpl, table)\n}\n\nfunction filterRowModelFromLeafs(\n rowsToFilter: Row[],\n filterRow: (row: Row) => Row[],\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n const rows: Row[] = []\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.columnFilters = row.columnFilters\n\n if (row.subRows?.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n } else {\n row = newRow\n if (filterRow(row)) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n }\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n\nfunction filterRowModelFromRoot(\n rowsToFilter: Row[],\n filterRow: (row: Row) => any,\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n // Filters top level and nested rows\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n // Filter from parents downward first\n\n const rows: Row[] = []\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const pass = filterRow(row)\n\n if (pass) {\n if (row.subRows?.length && depth < maxDepth) {\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n }\n\n rows.push(row)\n newFilteredFlatRows.push(row)\n newFilteredRowsById[row.id] = row\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFacetedRowModel(): (\n table: Table,\n columnId: string\n) => () => RowModel {\n return (table, columnId) =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n table.getFilteredRowModel(),\n ],\n (preRowModel, columnFilters, globalFilter) => {\n if (\n !preRowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n return preRowModel\n }\n\n const filterableIds = [\n ...columnFilters.map(d => d.id).filter(d => d !== columnId),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as string[]\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')\n )\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedUniqueValues(): (\n table: Table,\n columnId: string\n) => () => Map {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return new Map()\n\n let facetedUniqueValues = new Map()\n\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values =\n facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]!\n\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n },\n getMemoOptions(\n table.options,\n 'debugTable',\n `getFacetedUniqueValues_${columnId}`\n )\n )\n}\n","import { ResolvedColumnFilter } from '../features/ColumnFiltering'\nimport { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFilteredRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n ],\n (rowModel, columnFilters, globalFilter) => {\n if (\n !rowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i]!.columnFilters = {}\n rowModel.flatRows[i]!.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: ResolvedColumnFilter[] = []\n const resolvedGlobalFilters: ResolvedColumnFilter[] = []\n\n ;(columnFilters ?? []).forEach(d => {\n const column = table.getColumn(d.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column.getFilterFn()\n\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`\n )\n }\n return\n }\n\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: filterFn.resolveFilterValue?.(d.value) ?? d.value,\n })\n })\n\n const filterableIds = (columnFilters ?? []).map(d => d.id)\n\n const globalFilterFn = table.getGlobalFilterFn()\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter(column => column.getCanGlobalFilter())\n\n if (\n globalFilter &&\n globalFilterFn &&\n globallyFilterableColumns.length\n ) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach(column => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ??\n globalFilter,\n })\n })\n }\n\n let currentColumnFilter\n let currentGlobalFilter\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j]!\n\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { createRow } from '../core/row'\nimport { Row, RowData, RowModel, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { GroupingState } from '../features/ColumnGrouping'\n\nexport function getGroupedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().grouping, table.getPreGroupedRowModel()],\n (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n rowModel.rows.forEach(row => {\n row.depth = 0\n row.parentId = undefined\n })\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId =>\n table.getColumn(columnId)\n )\n\n const groupedFlatRows: Row[] = []\n const groupedRowsById: Record> = {}\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Row[],\n depth = 0,\n parentId?: string\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId: string = existingGrouping[depth]!\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n subRows.forEach(subRow => {\n subRow.parentId = id\n })\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, row => row.subRows)\n : groupedRows\n\n const row = createRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId\n )\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (columnId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[columnId] =\n groupedRows[0].getValue(columnId) ?? undefined\n }\n\n return row._valuesCache[columnId]\n }\n\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId)\n const aggregateFn = column?.getAggregationFn()\n\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(\n columnId,\n leafRows,\n groupedRows\n )\n\n return row._groupingValuesCache[columnId]\n }\n },\n })\n\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return row\n }\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {\n table._queue(() => {\n table._autoResetExpanded()\n table._autoResetPageIndex()\n })\n })\n )\n}\n\nfunction groupBy(rows: Row[], columnId: string) {\n const groupMap = new Map[]>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel(opts?: {\n initialSync: boolean\n}): (table: Table) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().pagination,\n table.getPrePaginationRowModel(),\n table.options.paginateExpandedRows\n ? undefined\n : table.getState().expanded,\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n let paginatedRowModel: RowModel\n\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById,\n })\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById,\n }\n }\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row) => {\n paginatedRowModel.flatRows.push(row)\n if (row.subRows.length) {\n row.subRows.forEach(handleRow)\n }\n }\n\n paginatedRowModel.rows.forEach(handleRow)\n\n return paginatedRowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')\n )\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { SortingFn } from '../features/RowSorting'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getSortedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().sorting, table.getPreSortedRowModel()],\n (sorting, rowModel) => {\n if (!rowModel.rows.length || !sorting?.length) {\n return rowModel\n }\n\n const sortingState = table.getState().sorting\n\n const sortedFlatRows: Row[] = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort =>\n table.getColumn(sort.id)?.getCanSort()\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n invertSorting?: boolean\n sortingFn: SortingFn\n }\n > = {}\n\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn(),\n }\n })\n\n const sortData = (rows: Row[]) => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = rows.map(row => ({ ...row }))\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const sortUndefined = columnInfo.sortUndefined\n const isDesc = sortEntry?.desc ?? false\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1\n if (sortUndefined === 'last') return aUndefined ? 1 : -1\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? sortUndefined\n : -sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n sortedFlatRows.push(row)\n if (row.subRows?.length) {\n row.subRows = sortData(row.subRows)\n }\n })\n\n return sortedData\n }\n\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n"],"names":["createColumnHelper","accessor","column","accessorFn","accessorKey","display","group","functionalUpdate","updater","input","noop","makeStateUpdater","key","instance","setState","old","isFunction","d","Function","isNumberArray","Array","isArray","every","val","flattenBy","arr","getChildren","flat","recurse","subArr","forEach","item","push","children","length","memo","getDeps","fn","opts","deps","result","depArgs","depTime","debug","Date","now","newDeps","depsChanged","some","dep","index","resultTime","onChange","depEndTime","Math","round","resultEndTime","resultFpsPercentage","pad","str","num","String","console","info","max","min","getMemoOptions","tableOptions","debugLevel","_tableOptions$debugAl","debugAll","process","env","NODE_ENV","createCell","table","row","columnId","getRenderValue","_cell$getValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","_features","feature","createColumn","columnDef","depth","parent","_ref","_resolvedColumnDef$id","defaultColumn","_getDefaultColumnDef","resolvedColumnDef","prototype","replaceAll","replace","undefined","header","includes","originalRow","split","_result","warn","Error","columns","getFlatColumns","_column$columns","flatMap","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","leafColumns","createHeader","_options$id","isPlaceholder","placeholderId","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","map","Headers","createTable","getHeaderGroups","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","_left$map$filter","_right$map$filter","leftColumns","find","filter","Boolean","rightColumns","centerColumns","headerGroups","buildHeaderGroups","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","orderedLeafColumns","getRightHeaderGroups","_right$map$filter2","getFooterGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","getIsVisible","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","isLeafHeader","bottomHeaders","recurseHeadersForSpans","filteredHeaders","childRowSpans","childColSpan","childRowSpan","minChildRowSpan","createRow","original","rowIndex","subRows","parentId","_valuesCache","_uniqueValuesCache","hasOwnProperty","getColumn","getUniqueValues","_row$getValue","getLeafRows","getParentRow","getRow","getParentRows","parentRows","currentRow","parentRow","getAllCells","getAllLeafColumns","_getAllCellsByColumnId","allCells","reduce","acc","i","ColumnFaceting","_getFacetedRowModel","getFacetedRowModel","getPreFilteredRowModel","_getFacetedUniqueValues","getFacetedUniqueValues","Map","_getFacetedMinMaxValues","getFacetedMinMaxValues","includesString","filterValue","_filterValue$toString","search","toString","toLowerCase","autoRemove","testFalsey","includesStringSensitive","_row$getValue2","equalsString","_row$getValue3","arrIncludes","_row$getValue4","arrIncludesAll","_row$getValue5","arrIncludesSome","_row$getValue6","equals","weakEquals","inNumberRange","rowValue","resolveFilterValue","unsafeMin","unsafeMax","parsedMin","parseFloat","parsedMax","Number","isNaN","Infinity","temp","filterFns","ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","onColumnFiltersChange","filterFromLeafRows","maxLeafRowFilterDepth","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getFilterFn","_table$options$filter","_table$options$filter2","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","previousFilter","newFilter","shouldAutoRemoveFilter","_old$filter","newFilterObj","_old$map","_table","columnFiltersMeta","updateFn","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getFilteredRowModel","_getFilteredRowModel","manualFiltering","sum","_leafRows","childRows","next","nextValue","extent","mean","leafRows","count","median","values","mid","floor","nums","sort","a","b","unique","from","Set","uniqueCount","size","_columnId","aggregationFns","ColumnGrouping","aggregatedCell","props","_toString","_props$getValue","aggregationFn","grouping","onGroupingChange","groupedColumnMode","toggleGrouping","setGrouping","getCanGroup","enableGrouping","getGroupingValue","getIsGrouped","_table$getState$group","getGroupedIndex","_table$getState$group2","indexOf","getToggleGroupingHandler","canGroup","getAutoAggregationFn","Object","call","getAggregationFn","_table$options$aggreg","_table$options$aggreg2","resetGrouping","_table$initialState$g","getPreGroupedRowModel","getGroupedRowModel","_getGroupedRowModel","manualGrouping","groupingColumnId","_groupingValuesCache","getIsPlaceholder","getIsAggregated","_row$subRows","nonGroupingColumns","col","groupingColumns","g","ColumnOrdering","columnOrder","onColumnOrderChange","getIndex","position","_getVisibleLeafColumns","getIsFirstColumn","_columns$","getIsLastColumn","_columns","setColumnOrder","resetColumnOrder","orderedColumns","columnOrderCopy","columnsCopy","targetColumnId","shift","foundIndex","splice","getDefaultColumnPinningState","ColumnPinning","onColumnPinningChange","pin","columnIds","setColumnPinning","_old$left3","_old$right3","_old$left","_old$right","_old$left2","_old$right2","getCanPin","_d$columnDef$enablePi","enablePinning","enableColumnPinning","getIsPinned","leafColumnIds","isLeft","isRight","getPinnedIndex","getCenterVisibleCells","_getAllVisibleCells","leftAndRight","getLeftVisibleCells","cells","getRightVisibleCells","resetColumnPinning","getIsSomeColumnsPinned","_pinningState$positio","pinningState","_pinningState$left","_pinningState$right","getLeftLeafColumns","getRightLeafColumns","getCenterLeafColumns","safelyAccessDocument","_document","document","defaultColumnSizing","minSize","maxSize","MAX_SAFE_INTEGER","getDefaultColumnSizingInfoState","startOffset","startSize","deltaOffset","deltaPercentage","isResizingColumn","columnSizingStart","ColumnSizing","columnSizing","columnSizingInfo","columnResizeMode","columnResizeDirection","onColumnSizingChange","onColumnSizingInfoChange","getSize","_column$columnDef$min","_column$columnDef$max","columnSize","getStart","slice","getAfter","resetSize","setColumnSizing","_ref2","_","rest","getCanResize","enableResizing","enableColumnResizing","getIsResizing","_header$column$getSiz","prevSiblingHeader","getResizeHandler","_contextDocument","canResize","e","persist","isTouchStartEvent","touches","clientX","newColumnSizing","updateOffset","eventType","clientXPos","setColumnSizingInfo","_old$startOffset","_old$startSize","deltaDirection","_ref3","headerSize","onMove","onEnd","contextDocument","mouseEvents","moveHandler","upHandler","removeEventListener","touchEvents","cancelable","preventDefault","stopPropagation","_e$touches$","passiveIfSupported","passiveEventSupported","passive","addEventListener","resetColumnSizing","resetHeaderSizeInfo","_table$initialState$c2","getTotalSize","_table$getHeaderGroup","_table$getHeaderGroup2","getLeftTotalSize","_table$getLeftHeaderG","_table$getLeftHeaderG2","getCenterTotalSize","_table$getCenterHeade","_table$getCenterHeade2","getRightTotalSize","_table$getRightHeader","_table$getRightHeader2","passiveSupported","supported","window","err","type","ColumnVisibility","columnVisibility","onColumnVisibilityChange","toggleVisibility","getCanHide","setColumnVisibility","childColumns","c","enableHiding","getToggleVisibilityHandler","target","checked","getVisibleCells","makeVisibleColumnsMethod","getColumns","getVisibleFlatColumns","getAllFlatColumns","getLeftVisibleLeafColumns","getRightVisibleLeafColumns","getCenterVisibleLeafColumns","resetColumnVisibility","toggleAllColumnsVisible","_value","getIsAllColumnsVisible","obj","getIsSomeColumnsVisible","getToggleAllColumnsVisibilityHandler","_target","GlobalFaceting","_getGlobalFacetedRowModel","getGlobalFacetedRowModel","_getGlobalFacetedUniqueValues","getGlobalFacetedUniqueValues","_getGlobalFacetedMinMaxValues","getGlobalFacetedMinMaxValues","GlobalFiltering","globalFilter","onGlobalFilterChange","globalFilterFn","getColumnCanGlobalFilter","_table$getCoreRowMode","getCanGlobalFilter","_table$options$getCol","enableGlobalFilter","getGlobalAutoFilterFn","getGlobalFilterFn","setGlobalFilter","resetGlobalFilter","RowExpanding","expanded","onExpandedChange","paginateExpandedRows","registered","queued","_autoResetExpanded","_table$options$autoRe","_queue","autoResetAll","autoResetExpanded","manualExpanding","resetExpanded","setExpanded","toggleAllRowsExpanded","getIsAllRowsExpanded","_table$initialState$e","getCanSomeRowsExpand","getPrePaginationRowModel","getCanExpand","getToggleAllRowsExpandedHandler","getIsSomeRowsExpanded","keys","getRowModel","getIsExpanded","getExpandedDepth","rowIds","rowsById","splitId","getPreExpandedRowModel","getSortedRowModel","getExpandedRowModel","_getExpandedRowModel","toggleExpanded","_expanded","exists","oldExpanded","rowId","_table$options$getIsR","getIsRowExpanded","_table$options$getRow","getRowCanExpand","enableExpanding","getIsAllParentsExpanded","isFullyExpanded","getToggleExpandedHandler","canExpand","defaultPageIndex","defaultPageSize","getDefaultPaginationState","pageIndex","pageSize","RowPagination","pagination","onPaginationChange","_autoResetPageIndex","autoResetPageIndex","manualPagination","resetPageIndex","setPagination","safeUpdater","newState","resetPagination","_table$initialState$p","setPageIndex","maxPageIndex","pageCount","_table$initialState$p2","resetPageSize","_table$initialState$p3","_table$initialState2","setPageSize","topRowIndex","setPageCount","_table$options$pageCo","newPageCount","getPageOptions","getPageCount","pageOptions","fill","getCanPreviousPage","getCanNextPage","previousPage","nextPage","firstPage","lastPage","getPaginationRowModel","_getPaginationRowModel","_table$options$pageCo2","ceil","getRowCount","_table$options$rowCou","rowCount","rows","getDefaultRowPinningState","top","bottom","RowPinning","rowPinning","onRowPinningChange","includeLeafRows","includeParentRows","leafRowIds","parentRowIds","setRowPinning","_old$top3","_old$bottom3","_old$top","_old$bottom","has","_old$top2","_old$bottom2","enableRowPinning","isTop","isBottom","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","resetRowPinning","_table$initialState$r","getIsSomeRowsPinned","_pinningState$top","_pinningState$bottom","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","keepPinnedRows","allRows","topPinnedRowIds","bottomPinnedRowIds","getCenterRows","topAndBottom","RowSelection","rowSelection","onRowSelectionChange","enableRowSelection","enableMultiRowSelection","enableSubRowSelection","setRowSelection","resetRowSelection","toggleAllRowsSelected","getIsAllRowsSelected","preGroupedFlatRows","getCanSelect","toggleAllPageRowsSelected","resolvedValue","getIsAllPageRowsSelected","mutateRowIsSelected","getPreSelectedRowModel","getSelectedRowModel","rowModel","selectRowsFn","getFilteredSelectedRowModel","getGroupedSelectedRowModel","isAllRowsSelected","paginationFlatRows","isAllPageRowsSelected","getIsSomeRowsSelected","_table$getState$rowSe","totalSelected","getIsSomePageRowsSelected","getIsSelected","getIsSomeSelected","getToggleAllRowsSelectedHandler","getToggleAllPageRowsSelectedHandler","toggleSelected","isSelected","_opts$selectChildren","selectedRowIds","selectChildren","isRowSelected","isSubRowSelected","getIsAllSubRowsSelected","getCanSelectSubRows","getCanMultiSelect","_table$options$enable3","getToggleSelectedHandler","canSelect","includeChildren","newSelectedFlatRows","newSelectedRowsById","recurseRows","_row$subRows2","selection","_selection$row$id","_row$subRows3","allChildrenSelected","someSelected","subRow","subRowChildrenSelected","reSplitAlphaNumeric","alphanumeric","rowA","rowB","compareAlphanumeric","alphanumericCaseSensitive","text","compareBasic","textCaseSensitive","datetime","basic","aStr","bStr","aa","bb","an","parseInt","bn","combo","sortingFns","RowSorting","sorting","sortingFn","sortUndefined","onSortingChange","isMultiSortEvent","shiftKey","getAutoSortingFn","firstRows","isString","getAutoSortDir","getSortingFn","_table$options$sortin","_table$options$sortin2","toggleSorting","desc","multi","nextSortingOrder","getNextSortingOrder","hasManualValue","setSorting","existingSorting","existingIndex","newSorting","sortAction","nextDesc","getCanMultiSort","_table$options$maxMul","maxMultiSortColCount","getFirstSortDir","_column$columnDef$sor","sortDescFirst","firstSortDirection","isSorted","getIsSorted","enableSortingRemoval","enableMultiRemove","getCanSort","enableSorting","_column$columnDef$ena2","enableMultiSort","_table$getState$sorti","columnSort","getSortIndex","_table$getState$sorti2","_table$getState$sorti3","clearSorting","getToggleSortingHandler","canSort","resetSorting","_table$initialState$s","getPreSortedRowModel","_getSortedRowModel","manualSorting","builtInFeatures","_options$_features","_options$initialState","debugTable","defaultOptions","assign","mergeOptions","coreInitialState","_feature$getInitialSt","queuedTimeout","coreInstance","cb","Promise","resolve","then","catch","error","setTimeout","reset","setOptions","newOptions","onStateChange","_getRowId","getRowId","_getCoreRowModel","searchAll","_defaultColumn","_props$renderValue$to","_props$renderValue","_getColumnDefs","columnDefs","recurseColumns","groupingColumnDef","_getAllFlatColumnsById","flatColumns","data","accessRows","originalRows","getSubRows","_row$originalSubRows","originalSubRows","expandRows","expandedRows","handleRow","_table$getColumn","facetedRowModel","uniqueValues","flatRow","_flatRow$getUniqueVal","facetedMinValue","facetedMaxValue","filterRows","filterRowImpl","filterRowModelFromLeafs","filterRowModelFromRoot","rowsToFilter","filterRow","_table$options$maxLea","newFilteredFlatRows","newFilteredRowsById","recurseFilterRows","newRow","_table$options$maxLea2","pass","preRowModel","filterableIds","filterRowsImpl","facetedUniqueValues","j","_facetedUniqueValues$","set","get","resolvedColumnFilters","resolvedGlobalFilters","_filterFn$resolveFilt","globallyFilterableColumns","_globalFilterFn$resol","currentColumnFilter","currentGlobalFilter","filterMeta","__global__","existingGrouping","groupedFlatRows","groupedRowsById","groupUpRecursively","rowGroupsMap","groupBy","aggregatedGroupedRows","entries","groupingValue","groupedRows","_groupedRows$0$getVal","aggregateFn","groupMap","resKey","previous","pageStart","pageEnd","paginatedRowModel","sortingState","sortedFlatRows","availableSorting","columnInfoById","sortEntry","invertSorting","sortData","sortedData","_sortEntry$desc","columnInfo","isDesc","sortInt","aValue","bValue","aUndefined","bUndefined"],"mappings":";;;;;;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAsBO,SAASA,kBAAkBA,GAET;EACvB,OAAO;AACLC,IAAAA,QAAQ,EAAEA,CAACA,QAAQ,EAAEC,MAAM,KAAK;AAC9B,MAAA,OAAO,OAAOD,QAAQ,KAAK,UAAU,GAChC;AACC,QAAA,GAAGC,MAAM;AACTC,QAAAA,UAAU,EAAEF,QAAAA;AACd,OAAC,GACD;AACE,QAAA,GAAGC,MAAM;AACTE,QAAAA,WAAW,EAAE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AAI,CAAC,CAAC,CAAA;AACf,aAAA;YAEA,IAAIF,UAAU,CAACJ,aAAa,EAAE;cAC5BM,OAAO,IAAI,CAAC,CAAC,CAAA;AACf,aAAA;AAEA,YAAA,OAAOA,OAAO,CAAA;AAChB,WAAA;AACF,SAAA;AAEA,QAAA,OAAOtL,IAAI,CAACztB,KAAK,GAAG0tB,IAAI,CAAC1tB,KAAK,CAAA;AAChC,OAAC,CAAC,CAAA;;AAEF;AACA24B,MAAAA,UAAU,CAAC/5B,OAAO,CAAC8C,GAAG,IAAI;AAAA,QAAA,IAAAkT,YAAA,CAAA;AACxByjB,QAAAA,cAAc,CAACv5B,IAAI,CAAC4C,GAAG,CAAC,CAAA;QACxB,IAAAkT,CAAAA,YAAA,GAAIlT,GAAG,CAACiI,OAAO,KAAXiL,IAAAA,IAAAA,YAAA,CAAa5V,MAAM,EAAE;UACvB0C,GAAG,CAACiI,OAAO,GAAG+uB,QAAQ,CAACh3B,GAAG,CAACiI,OAAO,CAAC,CAAA;AACrC,SAAA;AACF,OAAC,CAAC,CAAA;AAEF,MAAA,OAAOgvB,UAAU,CAAA;KAClB,CAAA;IAED,OAAO;AACLzR,MAAAA,IAAI,EAAEwR,QAAQ,CAAC3N,QAAQ,CAAC7D,IAAI,CAAC;AAC7B1Y,MAAAA,QAAQ,EAAE6pB,cAAc;MACxBrV,QAAQ,EAAE+H,QAAQ,CAAC/H,QAAAA;KACpB,CAAA;AACH,GAAC,EACDhiB,cAAc,CAACS,KAAK,CAACO,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAC/DP,KAAK,CAACmjB,mBAAmB,EAC3B,CACF,CAAC,CAAA;AACL;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/index.js b/node_modules/@tanstack/table-core/build/lib/index.js new file mode 100644 index 00000000..cf129c27 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/index.js @@ -0,0 +1,100 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var columnHelper = require('./columnHelper.js'); +var cell = require('./core/cell.js'); +var column = require('./core/column.js'); +var headers = require('./core/headers.js'); +var row = require('./core/row.js'); +var table = require('./core/table.js'); +var ColumnFaceting = require('./features/ColumnFaceting.js'); +var ColumnFiltering = require('./features/ColumnFiltering.js'); +var ColumnGrouping = require('./features/ColumnGrouping.js'); +var ColumnOrdering = require('./features/ColumnOrdering.js'); +var ColumnPinning = require('./features/ColumnPinning.js'); +var ColumnSizing = require('./features/ColumnSizing.js'); +var ColumnVisibility = require('./features/ColumnVisibility.js'); +var GlobalFaceting = require('./features/GlobalFaceting.js'); +var GlobalFiltering = require('./features/GlobalFiltering.js'); +var RowExpanding = require('./features/RowExpanding.js'); +var RowPagination = require('./features/RowPagination.js'); +var RowPinning = require('./features/RowPinning.js'); +var RowSelection = require('./features/RowSelection.js'); +var RowSorting = require('./features/RowSorting.js'); +var utils = require('./utils.js'); +var getCoreRowModel = require('./utils/getCoreRowModel.js'); +var getExpandedRowModel = require('./utils/getExpandedRowModel.js'); +var getFacetedMinMaxValues = require('./utils/getFacetedMinMaxValues.js'); +var getFacetedRowModel = require('./utils/getFacetedRowModel.js'); +var getFacetedUniqueValues = require('./utils/getFacetedUniqueValues.js'); +var getFilteredRowModel = require('./utils/getFilteredRowModel.js'); +var getGroupedRowModel = require('./utils/getGroupedRowModel.js'); +var getPaginationRowModel = require('./utils/getPaginationRowModel.js'); +var getSortedRowModel = require('./utils/getSortedRowModel.js'); +var aggregationFns = require('./aggregationFns.js'); +var filterFns = require('./filterFns.js'); +var sortingFns = require('./sortingFns.js'); + + + +exports.createColumnHelper = columnHelper.createColumnHelper; +exports.createCell = cell.createCell; +exports.createColumn = column.createColumn; +exports.Headers = headers.Headers; +exports.buildHeaderGroups = headers.buildHeaderGroups; +exports.createRow = row.createRow; +exports.createTable = table.createTable; +exports.ColumnFaceting = ColumnFaceting.ColumnFaceting; +exports.ColumnFiltering = ColumnFiltering.ColumnFiltering; +exports.shouldAutoRemoveFilter = ColumnFiltering.shouldAutoRemoveFilter; +exports.ColumnGrouping = ColumnGrouping.ColumnGrouping; +exports.orderColumns = ColumnGrouping.orderColumns; +exports.ColumnOrdering = ColumnOrdering.ColumnOrdering; +exports.ColumnPinning = ColumnPinning.ColumnPinning; +exports.ColumnSizing = ColumnSizing.ColumnSizing; +exports.defaultColumnSizing = ColumnSizing.defaultColumnSizing; +exports.passiveEventSupported = ColumnSizing.passiveEventSupported; +exports.ColumnVisibility = ColumnVisibility.ColumnVisibility; +exports._getVisibleLeafColumns = ColumnVisibility._getVisibleLeafColumns; +exports.GlobalFaceting = GlobalFaceting.GlobalFaceting; +exports.GlobalFiltering = GlobalFiltering.GlobalFiltering; +exports.RowExpanding = RowExpanding.RowExpanding; +exports.RowPagination = RowPagination.RowPagination; +exports.RowPinning = RowPinning.RowPinning; +exports.RowSelection = RowSelection.RowSelection; +exports.isRowSelected = RowSelection.isRowSelected; +exports.isSubRowSelected = RowSelection.isSubRowSelected; +exports.selectRowsFn = RowSelection.selectRowsFn; +exports.RowSorting = RowSorting.RowSorting; +exports.flattenBy = utils.flattenBy; +exports.functionalUpdate = utils.functionalUpdate; +exports.getMemoOptions = utils.getMemoOptions; +exports.isFunction = utils.isFunction; +exports.isNumberArray = utils.isNumberArray; +exports.makeStateUpdater = utils.makeStateUpdater; +exports.memo = utils.memo; +exports.noop = utils.noop; +exports.getCoreRowModel = getCoreRowModel.getCoreRowModel; +exports.expandRows = getExpandedRowModel.expandRows; +exports.getExpandedRowModel = getExpandedRowModel.getExpandedRowModel; +exports.getFacetedMinMaxValues = getFacetedMinMaxValues.getFacetedMinMaxValues; +exports.getFacetedRowModel = getFacetedRowModel.getFacetedRowModel; +exports.getFacetedUniqueValues = getFacetedUniqueValues.getFacetedUniqueValues; +exports.getFilteredRowModel = getFilteredRowModel.getFilteredRowModel; +exports.getGroupedRowModel = getGroupedRowModel.getGroupedRowModel; +exports.getPaginationRowModel = getPaginationRowModel.getPaginationRowModel; +exports.getSortedRowModel = getSortedRowModel.getSortedRowModel; +exports.aggregationFns = aggregationFns.aggregationFns; +exports.filterFns = filterFns.filterFns; +exports.reSplitAlphaNumeric = sortingFns.reSplitAlphaNumeric; +exports.sortingFns = sortingFns.sortingFns; +//# sourceMappingURL=index.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/index.js.map b/node_modules/@tanstack/table-core/build/lib/index.js.map new file mode 100644 index 00000000..f8dbc9cf --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/index.mjs b/node_modules/@tanstack/table-core/build/lib/index.mjs new file mode 100644 index 00000000..b00ad055 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/index.mjs @@ -0,0 +1,3526 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +// type Person = { +// firstName: string +// lastName: string +// age: number +// visits: number +// status: string +// progress: number +// createdAt: Date +// nested: { +// foo: [ +// { +// bar: 'bar' +// } +// ] +// bar: { subBar: boolean }[] +// baz: { +// foo: 'foo' +// bar: { +// baz: 'baz' +// } +// } +// } +// } + +// const test: DeepKeys = 'nested.foo.0.bar' +// const test2: DeepKeys = 'nested.bar' + +// const helper = createColumnHelper() + +// helper.accessor('nested.foo', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.foo.0.bar', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.bar', { +// cell: info => info.getValue(), +// }) + +function createColumnHelper() { + return { + accessor: (accessor, column) => { + return typeof accessor === 'function' ? { + ...column, + accessorFn: accessor + } : { + ...column, + accessorKey: accessor + }; + }, + display: column => column, + group: column => column + }; +} + +// Is this type a tuple? + +// If this type is a tuple, what indices are allowed? + +/// + +function functionalUpdate(updater, input) { + return typeof updater === 'function' ? updater(input) : updater; +} +function noop() { + // +} +function makeStateUpdater(key, instance) { + return updater => { + instance.setState(old => { + return { + ...old, + [key]: functionalUpdate(updater, old[key]) + }; + }); + }; +} +function isFunction(d) { + return d instanceof Function; +} +function isNumberArray(d) { + return Array.isArray(d) && d.every(val => typeof val === 'number'); +} +function flattenBy(arr, getChildren) { + const flat = []; + const recurse = subArr => { + subArr.forEach(item => { + flat.push(item); + const children = getChildren(item); + if (children != null && children.length) { + recurse(children); + } + }); + }; + recurse(arr); + return flat; +} +function memo(getDeps, fn, opts) { + let deps = []; + let result; + return depArgs => { + let depTime; + if (opts.key && opts.debug) depTime = Date.now(); + const newDeps = getDeps(depArgs); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep); + if (!depsChanged) { + return result; + } + deps = newDeps; + let resultTime; + if (opts.key && opts.debug) resultTime = Date.now(); + result = fn(...newDeps); + opts == null || opts.onChange == null || opts.onChange(result); + if (opts.key && opts.debug) { + if (opts != null && opts.debug()) { + const depEndTime = Math.round((Date.now() - depTime) * 100) / 100; + const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100; + const resultFpsPercentage = resultEndTime / 16; + const pad = (str, num) => { + str = String(str); + while (str.length < num) { + str = ' ' + str; + } + return str; + }; + console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, ` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key); + } + } + return result; + }; +} +function getMemoOptions(tableOptions, debugLevel, key, onChange) { + return { + debug: () => { + var _tableOptions$debugAl; + return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel]; + }, + key: process.env.NODE_ENV === 'development' && key, + onChange + }; +} + +function createCell(table, row, column, columnId) { + const getRenderValue = () => { + var _cell$getValue; + return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + }; + const cell = { + id: `${row.id}_${column.id}`, + row, + column, + getValue: () => row.getValue(columnId), + renderValue: getRenderValue, + getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({ + table, + column, + row, + cell: cell, + getValue: cell.getValue, + renderValue: cell.renderValue + }), getMemoOptions(table.options, 'debugCells', 'cell.getContext')) + }; + table._features.forEach(feature => { + feature.createCell == null || feature.createCell(cell, column, row, table); + }, {}); + return cell; +} + +function createColumn(table, columnDef, depth, parent) { + var _ref, _resolvedColumnDef$id; + const defaultColumn = table._getDefaultColumnDef(); + const resolvedColumnDef = { + ...defaultColumn, + ...columnDef + }; + const accessorKey = resolvedColumnDef.accessorKey; + let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined; + let accessorFn; + if (resolvedColumnDef.accessorFn) { + accessorFn = resolvedColumnDef.accessorFn; + } else if (accessorKey) { + // Support deep accessor keys + if (accessorKey.includes('.')) { + accessorFn = originalRow => { + let result = originalRow; + for (const key of accessorKey.split('.')) { + var _result; + result = (_result = result) == null ? void 0 : _result[key]; + if (process.env.NODE_ENV !== 'production' && result === undefined) { + console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`); + } + } + return result; + }; + } else { + accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey]; + } + } + if (!id) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); + } + throw new Error(); + } + let column = { + id: `${String(id)}`, + accessorFn, + parent: parent, + depth, + columnDef: resolvedColumnDef, + columns: [], + getFlatColumns: memo(() => [true], () => { + var _column$columns; + return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')), + getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => { + var _column$columns2; + if ((_column$columns2 = column.columns) != null && _column$columns2.length) { + let leafColumns = column.columns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + } + return [column]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')) + }; + for (const feature of table._features) { + feature.createColumn == null || feature.createColumn(column, table); + } + + // Yes, we have to convert table to unknown, because we know more than the compiler here. + return column; +} + +const debug = 'debugHeaders'; +// + +function createHeader(table, column, options) { + var _options$id; + const id = (_options$id = options.id) != null ? _options$id : column.id; + let header = { + id, + column, + index: options.index, + isPlaceholder: !!options.isPlaceholder, + placeholderId: options.placeholderId, + depth: options.depth, + subHeaders: [], + colSpan: 0, + rowSpan: 0, + headerGroup: null, + getLeafHeaders: () => { + const leafHeaders = []; + const recurseHeader = h => { + if (h.subHeaders && h.subHeaders.length) { + h.subHeaders.map(recurseHeader); + } + leafHeaders.push(h); + }; + recurseHeader(header); + return leafHeaders; + }, + getContext: () => ({ + table, + header: header, + column + }) + }; + table._features.forEach(feature => { + feature.createHeader == null || feature.createHeader(header, table); + }); + return header; +} +const Headers = { + createTable: table => { + // Header Groups + + table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + var _left$map$filter, _right$map$filter; + const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; + const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; + const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); + return headerGroups; + }, getMemoOptions(table.options, debug, 'getHeaderGroups')); + table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + return buildHeaderGroups(allColumns, leafColumns, table, 'center'); + }, getMemoOptions(table.options, debug, 'getCenterHeaderGroups')); + table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => { + var _left$map$filter2; + const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left'); + }, getMemoOptions(table.options, debug, 'getLeftHeaderGroups')); + table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => { + var _right$map$filter2; + const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right'); + }, getMemoOptions(table.options, debug, 'getRightHeaderGroups')); + + // Footer Groups + + table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getFooterGroups')); + table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getLeftFooterGroups')); + table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getCenterFooterGroups')); + table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getRightFooterGroups')); + + // Flat Headers + + table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => { + return headerGroups.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getFlatHeaders')); + table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeftFlatHeaders')); + table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getCenterFlatHeaders')); + table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getRightFlatHeaders')); + + // Leaf Headers + + table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders; + return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); + }); + }, getMemoOptions(table.options, debug, 'getCenterLeafHeaders')); + table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders2; + return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); + }); + }, getMemoOptions(table.options, debug, 'getLeftLeafHeaders')); + table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders3; + return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); + }); + }, getMemoOptions(table.options, debug, 'getRightLeafHeaders')); + table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => { + var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$; + return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => { + return header.getLeafHeaders(); + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeafHeaders')); + } +}; +function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { + var _headerGroups$0$heade, _headerGroups$; + // Find the max depth of the columns: + // build the leaf column row + // build each buffer row going up + // placeholder for non-existent level + // real column for existing level + + let maxDepth = 0; + const findMaxDepth = function (columns, depth) { + if (depth === void 0) { + depth = 1; + } + maxDepth = Math.max(maxDepth, depth); + columns.filter(column => column.getIsVisible()).forEach(column => { + var _column$columns; + if ((_column$columns = column.columns) != null && _column$columns.length) { + findMaxDepth(column.columns, depth + 1); + } + }, 0); + }; + findMaxDepth(allColumns); + let headerGroups = []; + const createHeaderGroup = (headersToGroup, depth) => { + // The header group we are creating + const headerGroup = { + depth, + id: [headerFamily, `${depth}`].filter(Boolean).join('_'), + headers: [] + }; + + // The parent columns we're going to scan next + const pendingParentHeaders = []; + + // Scan each column for parents + headersToGroup.forEach(headerToGroup => { + // What is the latest (last) parent column? + + const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]; + const isLeafHeader = headerToGroup.column.depth === headerGroup.depth; + let column; + let isPlaceholder = false; + if (isLeafHeader && headerToGroup.column.parent) { + // The parent header is new + column = headerToGroup.column.parent; + } else { + // The parent header is repeated + column = headerToGroup.column; + isPlaceholder = true; + } + if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) { + // This column is repeated. Add it as a sub header to the next batch + latestPendingParentHeader.subHeaders.push(headerToGroup); + } else { + // This is a new header. Let's create it + const header = createHeader(table, column, { + id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'), + isPlaceholder, + placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined, + depth, + index: pendingParentHeaders.length + }); + + // Add the headerToGroup as a subHeader of the new header + header.subHeaders.push(headerToGroup); + // Add the new header to the pendingParentHeaders to get grouped + // in the next batch + pendingParentHeaders.push(header); + } + headerGroup.headers.push(headerToGroup); + headerToGroup.headerGroup = headerGroup; + }); + headerGroups.push(headerGroup); + if (depth > 0) { + createHeaderGroup(pendingParentHeaders, depth - 1); + } + }; + const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, { + depth: maxDepth, + index + })); + createHeaderGroup(bottomHeaders, maxDepth - 1); + headerGroups.reverse(); + + // headerGroups = headerGroups.filter(headerGroup => { + // return !headerGroup.headers.every(header => header.isPlaceholder) + // }) + + const recurseHeadersForSpans = headers => { + const filteredHeaders = headers.filter(header => header.column.getIsVisible()); + return filteredHeaders.map(header => { + let colSpan = 0; + let rowSpan = 0; + let childRowSpans = [0]; + if (header.subHeaders && header.subHeaders.length) { + childRowSpans = []; + recurseHeadersForSpans(header.subHeaders).forEach(_ref => { + let { + colSpan: childColSpan, + rowSpan: childRowSpan + } = _ref; + colSpan += childColSpan; + childRowSpans.push(childRowSpan); + }); + } else { + colSpan = 1; + } + const minChildRowSpan = Math.min(...childRowSpans); + rowSpan = rowSpan + minChildRowSpan; + header.colSpan = colSpan; + header.rowSpan = rowSpan; + return { + colSpan, + rowSpan + }; + }); + }; + recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); + return headerGroups; +} + +const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => { + let row = { + id, + index: rowIndex, + original, + depth, + parentId, + _valuesCache: {}, + _uniqueValuesCache: {}, + getValue: columnId => { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex); + return row._valuesCache[columnId]; + }, + getUniqueValues: columnId => { + if (row._uniqueValuesCache.hasOwnProperty(columnId)) { + return row._uniqueValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + if (!column.columnDef.getUniqueValues) { + row._uniqueValuesCache[columnId] = [row.getValue(columnId)]; + return row._uniqueValuesCache[columnId]; + } + row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex); + return row._uniqueValuesCache[columnId]; + }, + renderValue: columnId => { + var _row$getValue; + return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; + }, + subRows: subRows != null ? subRows : [], + getLeafRows: () => flattenBy(row.subRows, d => d.subRows), + getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined, + getParentRows: () => { + let parentRows = []; + let currentRow = row; + while (true) { + const parentRow = currentRow.getParentRow(); + if (!parentRow) break; + parentRows.push(parentRow); + currentRow = parentRow; + } + return parentRows.reverse(); + }, + getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => { + return leafColumns.map(column => { + return createCell(table, row, column, column.id); + }); + }, getMemoOptions(table.options, 'debugRows', 'getAllCells')), + _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => { + return allCells.reduce((acc, cell) => { + acc[cell.column.id] = cell; + return acc; + }, {}); + }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')) + }; + for (let i = 0; i < table._features.length; i++) { + const feature = table._features[i]; + feature == null || feature.createRow == null || feature.createRow(row, table); + } + return row; +}; + +// + +const ColumnFaceting = { + createColumn: (column, table) => { + column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id); + column.getFacetedRowModel = () => { + if (!column._getFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return column._getFacetedRowModel(); + }; + column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id); + column.getFacetedUniqueValues = () => { + if (!column._getFacetedUniqueValues) { + return new Map(); + } + return column._getFacetedUniqueValues(); + }; + column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id); + column.getFacetedMinMaxValues = () => { + if (!column._getFacetedMinMaxValues) { + return undefined; + } + return column._getFacetedMinMaxValues(); + }; + } +}; + +const includesString = (row, columnId, filterValue) => { + var _filterValue$toString, _row$getValue; + const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase(); + return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search)); +}; +includesString.autoRemove = val => testFalsey(val); +const includesStringSensitive = (row, columnId, filterValue) => { + var _row$getValue2; + return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue)); +}; +includesStringSensitive.autoRemove = val => testFalsey(val); +const equalsString = (row, columnId, filterValue) => { + var _row$getValue3; + return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase()); +}; +equalsString.autoRemove = val => testFalsey(val); +const arrIncludes = (row, columnId, filterValue) => { + var _row$getValue4; + return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue); +}; +arrIncludes.autoRemove = val => testFalsey(val); +const arrIncludesAll = (row, columnId, filterValue) => { + return !filterValue.some(val => { + var _row$getValue5; + return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val)); + }); +}; +arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length); +const arrIncludesSome = (row, columnId, filterValue) => { + return filterValue.some(val => { + var _row$getValue6; + return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val); + }); +}; +arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length); +const equals = (row, columnId, filterValue) => { + return row.getValue(columnId) === filterValue; +}; +equals.autoRemove = val => testFalsey(val); +const weakEquals = (row, columnId, filterValue) => { + return row.getValue(columnId) == filterValue; +}; +weakEquals.autoRemove = val => testFalsey(val); +const inNumberRange = (row, columnId, filterValue) => { + let [min, max] = filterValue; + const rowValue = row.getValue(columnId); + return rowValue >= min && rowValue <= max; +}; +inNumberRange.resolveFilterValue = val => { + let [unsafeMin, unsafeMax] = val; + let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin; + let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax; + let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin; + let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax; + if (min > max) { + const temp = min; + min = max; + max = temp; + } + return [min, max]; +}; +inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); + +// Export + +const filterFns = { + includesString, + includesStringSensitive, + equalsString, + arrIncludes, + arrIncludesAll, + arrIncludesSome, + equals, + weakEquals, + inNumberRange +}; +// Utils + +function testFalsey(val) { + return val === undefined || val === null || val === ''; +} + +// + +const ColumnFiltering = { + getDefaultColumnDef: () => { + return { + filterFn: 'auto' + }; + }, + getInitialState: state => { + return { + columnFilters: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnFiltersChange: makeStateUpdater('columnFilters', table), + filterFromLeafRows: false, + maxLeafRowFilterDepth: 100 + }; + }, + createColumn: (column, table) => { + column.getAutoFilterFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return filterFns.includesString; + } + if (typeof value === 'number') { + return filterFns.inNumberRange; + } + if (typeof value === 'boolean') { + return filterFns.equals; + } + if (value !== null && typeof value === 'object') { + return filterFns.equals; + } + if (Array.isArray(value)) { + return filterFns.arrIncludes; + } + return filterFns.weakEquals; + }; + column.getFilterFn = () => { + var _table$options$filter, _table$options$filter2; + return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore + (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn]; + }; + column.getCanFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2; + return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn; + }; + column.getIsFiltered = () => column.getFilterIndex() > -1; + column.getFilterValue = () => { + var _table$getState$colum; + return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value; + }; + column.getFilterIndex = () => { + var _table$getState$colum2, _table$getState$colum3; + return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1; + }; + column.setFilterValue = value => { + table.setColumnFilters(old => { + const filterFn = column.getFilterFn(); + const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id); + const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined); + + // + if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { + var _old$filter; + return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : []; + } + const newFilterObj = { + id: column.id, + value: newFilter + }; + if (previousFilter) { + var _old$map; + return (_old$map = old == null ? void 0 : old.map(d => { + if (d.id === column.id) { + return newFilterObj; + } + return d; + })) != null ? _old$map : []; + } + if (old != null && old.length) { + return [...old, newFilterObj]; + } + return [newFilterObj]; + }); + }; + }, + createRow: (row, _table) => { + row.columnFilters = {}; + row.columnFiltersMeta = {}; + }, + createTable: table => { + table.setColumnFilters = updater => { + const leafColumns = table.getAllLeafColumns(); + const updateFn = old => { + var _functionalUpdate; + return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => { + const column = leafColumns.find(d => d.id === filter.id); + if (column) { + const filterFn = column.getFilterFn(); + if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { + return false; + } + } + return true; + }); + }; + table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn); + }; + table.resetColumnFilters = defaultState => { + var _table$initialState$c, _table$initialState; + table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); + }; + table.getPreFilteredRowModel = () => table.getCoreRowModel(); + table.getFilteredRowModel = () => { + if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { + table._getFilteredRowModel = table.options.getFilteredRowModel(table); + } + if (table.options.manualFiltering || !table._getFilteredRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getFilteredRowModel(); + }; + } +}; +function shouldAutoRemoveFilter(filterFn, value, column) { + return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value; +} + +const sum = (columnId, _leafRows, childRows) => { + // It's faster to just add the aggregations together instead of + // process leaf nodes individually + return childRows.reduce((sum, next) => { + const nextValue = next.getValue(columnId); + return sum + (typeof nextValue === 'number' ? nextValue : 0); + }, 0); +}; +const min = (columnId, _leafRows, childRows) => { + let min; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (min > value || min === undefined && value >= value)) { + min = value; + } + }); + return min; +}; +const max = (columnId, _leafRows, childRows) => { + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (max < value || max === undefined && value >= value)) { + max = value; + } + }); + return max; +}; +const extent = (columnId, _leafRows, childRows) => { + let min; + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null) { + if (min === undefined) { + if (value >= value) min = max = value; + } else { + if (min > value) min = value; + if (max < value) max = value; + } + } + }); + return [min, max]; +}; +const mean = (columnId, leafRows) => { + let count = 0; + let sum = 0; + leafRows.forEach(row => { + let value = row.getValue(columnId); + if (value != null && (value = +value) >= value) { + ++count, sum += value; + } + }); + if (count) return sum / count; + return; +}; +const median = (columnId, leafRows) => { + if (!leafRows.length) { + return; + } + const values = leafRows.map(row => row.getValue(columnId)); + if (!isNumberArray(values)) { + return; + } + if (values.length === 1) { + return values[0]; + } + const mid = Math.floor(values.length / 2); + const nums = values.sort((a, b) => a - b); + return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2; +}; +const unique = (columnId, leafRows) => { + return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values()); +}; +const uniqueCount = (columnId, leafRows) => { + return new Set(leafRows.map(d => d.getValue(columnId))).size; +}; +const count = (_columnId, leafRows) => { + return leafRows.length; +}; +const aggregationFns = { + sum, + min, + max, + extent, + mean, + median, + unique, + uniqueCount, + count +}; + +// + +const ColumnGrouping = { + getDefaultColumnDef: () => { + return { + aggregatedCell: props => { + var _toString, _props$getValue; + return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null; + }, + aggregationFn: 'auto' + }; + }, + getInitialState: state => { + return { + grouping: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onGroupingChange: makeStateUpdater('grouping', table), + groupedColumnMode: 'reorder' + }; + }, + createColumn: (column, table) => { + column.toggleGrouping = () => { + table.setGrouping(old => { + // Find any existing grouping for this column + if (old != null && old.includes(column.id)) { + return old.filter(d => d !== column.id); + } + return [...(old != null ? old : []), column.id]; + }); + }; + column.getCanGroup = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue); + }; + column.getIsGrouped = () => { + var _table$getState$group; + return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id); + }; + column.getGroupedIndex = () => { + var _table$getState$group2; + return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id); + }; + column.getToggleGroupingHandler = () => { + const canGroup = column.getCanGroup(); + return () => { + if (!canGroup) return; + column.toggleGrouping(); + }; + }; + column.getAutoAggregationFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'number') { + return aggregationFns.sum; + } + if (Object.prototype.toString.call(value) === '[object Date]') { + return aggregationFns.extent; + } + }; + column.getAggregationFn = () => { + var _table$options$aggreg, _table$options$aggreg2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn]; + }; + }, + createTable: table => { + table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater); + table.resetGrouping = defaultState => { + var _table$initialState$g, _table$initialState; + table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); + }; + table.getPreGroupedRowModel = () => table.getFilteredRowModel(); + table.getGroupedRowModel = () => { + if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { + table._getGroupedRowModel = table.options.getGroupedRowModel(table); + } + if (table.options.manualGrouping || !table._getGroupedRowModel) { + return table.getPreGroupedRowModel(); + } + return table._getGroupedRowModel(); + }; + }, + createRow: (row, table) => { + row.getIsGrouped = () => !!row.groupingColumnId; + row.getGroupingValue = columnId => { + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.columnDef.getGroupingValue)) { + return row.getValue(columnId); + } + row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original); + return row._groupingValuesCache[columnId]; + }; + row._groupingValuesCache = {}; + }, + createCell: (cell, column, row, table) => { + cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId; + cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped(); + cell.getIsAggregated = () => { + var _row$subRows; + return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + } +}; +function orderColumns(leafColumns, grouping, groupedColumnMode) { + if (!(grouping != null && grouping.length) || !groupedColumnMode) { + return leafColumns; + } + const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id)); + if (groupedColumnMode === 'remove') { + return nonGroupingColumns; + } + const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean); + return [...groupingColumns, ...nonGroupingColumns]; +} + +// + +const ColumnOrdering = { + getInitialState: state => { + return { + columnOrder: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnOrderChange: makeStateUpdater('columnOrder', table) + }; + }, + createColumn: (column, table) => { + column.getIndex = memo(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex')); + column.getIsFirstColumn = position => { + var _columns$; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id; + }; + column.getIsLastColumn = position => { + var _columns; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id; + }; + }, + createTable: table => { + table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater); + table.resetColumnOrder = defaultState => { + var _table$initialState$c; + table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); + }; + table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => { + // Sort grouped columns to the start of the column list + // before the headers are built + let orderedColumns = []; + + // If there is no order, return the normal columns + if (!(columnOrder != null && columnOrder.length)) { + orderedColumns = columns; + } else { + const columnOrderCopy = [...columnOrder]; + + // If there is an order, make a copy of the columns + const columnsCopy = [...columns]; + + // And make a new ordered array of the columns + + // Loop over the columns and place them in order into the new array + while (columnsCopy.length && columnOrderCopy.length) { + const targetColumnId = columnOrderCopy.shift(); + const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId); + if (foundIndex > -1) { + orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); + } + } + + // If there are any columns left, add them to the end + orderedColumns = [...orderedColumns, ...columnsCopy]; + } + return orderColumns(orderedColumns, grouping, groupedColumnMode); + }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')); + } +}; + +// + +const getDefaultColumnPinningState = () => ({ + left: [], + right: [] +}); +const ColumnPinning = { + getInitialState: state => { + return { + columnPinning: getDefaultColumnPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnPinningChange: makeStateUpdater('columnPinning', table) + }; + }, + createColumn: (column, table) => { + column.pin = position => { + const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean); + table.setColumnPinning(old => { + var _old$left3, _old$right3; + if (position === 'right') { + var _old$left, _old$right; + return { + left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds] + }; + } + if (position === 'left') { + var _old$left2, _old$right2; + return { + left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds], + right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + } + return { + left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + }); + }; + column.getCanPin = () => { + const leafColumns = column.getLeafColumns(); + return leafColumns.some(d => { + var _d$columnDef$enablePi, _ref, _table$options$enable; + return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true); + }); + }; + column.getIsPinned = () => { + const leafColumnIds = column.getLeafColumns().map(d => d.id); + const { + left, + right + } = table.getState().columnPinning; + const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d)); + const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d)); + return isLeft ? 'left' : isRight ? 'right' : false; + }; + column.getPinnedIndex = () => { + var _table$getState$colum, _table$getState$colum2; + const position = column.getIsPinned(); + return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0; + }; + }, + createRow: (row, table) => { + row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allCells.filter(d => !leftAndRight.includes(d.column.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')); + row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => { + const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'left' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')); + row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { + const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'right' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')); + }, + createTable: table => { + table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater); + table.resetColumnPinning = defaultState => { + var _table$initialState$c, _table$initialState; + return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState()); + }; + table.getIsSomeColumnsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().columnPinning; + if (!position) { + var _pinningState$left, _pinningState$right; + return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { + return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')); + table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { + return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')); + table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allColumns.filter(d => !leftAndRight.includes(d.id)); + }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')); + } +}; + +function safelyAccessDocument(_document) { + return _document || (typeof document !== 'undefined' ? document : null); +} + +// + +// + +const defaultColumnSizing = { + size: 150, + minSize: 20, + maxSize: Number.MAX_SAFE_INTEGER +}; +const getDefaultColumnSizingInfoState = () => ({ + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + isResizingColumn: false, + columnSizingStart: [] +}); +const ColumnSizing = { + getDefaultColumnDef: () => { + return defaultColumnSizing; + }, + getInitialState: state => { + return { + columnSizing: {}, + columnSizingInfo: getDefaultColumnSizingInfoState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + columnResizeMode: 'onEnd', + columnResizeDirection: 'ltr', + onColumnSizingChange: makeStateUpdater('columnSizing', table), + onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table) + }; + }, + createColumn: (column, table) => { + column.getSize = () => { + var _column$columnDef$min, _ref, _column$columnDef$max; + const columnSize = table.getState().columnSizing[column.id]; + return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); + }; + column.getStart = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart')); + column.getAfter = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter')); + column.resetSize = () => { + table.setColumnSizing(_ref2 => { + let { + [column.id]: _, + ...rest + } = _ref2; + return rest; + }); + }; + column.getCanResize = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); + }; + column.getIsResizing = () => { + return table.getState().columnSizingInfo.isResizingColumn === column.id; + }; + }, + createHeader: (header, table) => { + header.getSize = () => { + let sum = 0; + const recurse = header => { + if (header.subHeaders.length) { + header.subHeaders.forEach(recurse); + } else { + var _header$column$getSiz; + sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0; + } + }; + recurse(header); + return sum; + }; + header.getStart = () => { + if (header.index > 0) { + const prevSiblingHeader = header.headerGroup.headers[header.index - 1]; + return prevSiblingHeader.getStart() + prevSiblingHeader.getSize(); + } + return 0; + }; + header.getResizeHandler = _contextDocument => { + const column = table.getColumn(header.column.id); + const canResize = column == null ? void 0 : column.getCanResize(); + return e => { + if (!column || !canResize) { + return; + } + e.persist == null || e.persist(); + if (isTouchStartEvent(e)) { + // lets not respond to multiple touches (e.g. 2 or 3 fingers) + if (e.touches && e.touches.length > 1) { + return; + } + } + const startSize = header.getSize(); + const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]]; + const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX; + const newColumnSizing = {}; + const updateOffset = (eventType, clientXPos) => { + if (typeof clientXPos !== 'number') { + return; + } + table.setColumnSizingInfo(old => { + var _old$startOffset, _old$startSize; + const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1; + const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection; + const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); + old.columnSizingStart.forEach(_ref3 => { + let [columnId, headerSize] = _ref3; + newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100; + }); + return { + ...old, + deltaOffset, + deltaPercentage + }; + }); + if (table.options.columnResizeMode === 'onChange' || eventType === 'end') { + table.setColumnSizing(old => ({ + ...old, + ...newColumnSizing + })); + } + }; + const onMove = clientXPos => updateOffset('move', clientXPos); + const onEnd = clientXPos => { + updateOffset('end', clientXPos); + table.setColumnSizingInfo(old => ({ + ...old, + isResizingColumn: false, + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + columnSizingStart: [] + })); + }; + const contextDocument = safelyAccessDocument(_contextDocument); + const mouseEvents = { + moveHandler: e => onMove(e.clientX), + upHandler: e => { + contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler); + onEnd(e.clientX); + } + }; + const touchEvents = { + moveHandler: e => { + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onMove(e.touches[0].clientX); + return false; + }, + upHandler: e => { + var _e$touches$; + contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler); + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX); + } + }; + const passiveIfSupported = passiveEventSupported() ? { + passive: false + } : false; + if (isTouchStartEvent(e)) { + contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported); + } else { + contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported); + } + table.setColumnSizingInfo(old => ({ + ...old, + startOffset: clientX, + startSize, + deltaOffset: 0, + deltaPercentage: 0, + columnSizingStart, + isResizingColumn: column.id + })); + }; + }; + }, + createTable: table => { + table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater); + table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater); + table.resetColumnSizing = defaultState => { + var _table$initialState$c; + table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); + }; + table.resetHeaderSizeInfo = defaultState => { + var _table$initialState$c2; + table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); + }; + table.getTotalSize = () => { + var _table$getHeaderGroup, _table$getHeaderGroup2; + return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getHeaderGroup : 0; + }; + table.getLeftTotalSize = () => { + var _table$getLeftHeaderG, _table$getLeftHeaderG2; + return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getLeftHeaderG : 0; + }; + table.getCenterTotalSize = () => { + var _table$getCenterHeade, _table$getCenterHeade2; + return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getCenterHeade : 0; + }; + table.getRightTotalSize = () => { + var _table$getRightHeader, _table$getRightHeader2; + return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getRightHeader : 0; + }; + } +}; +let passiveSupported = null; +function passiveEventSupported() { + if (typeof passiveSupported === 'boolean') return passiveSupported; + let supported = false; + try { + const options = { + get passive() { + supported = true; + return false; + } + }; + const noop = () => {}; + window.addEventListener('test', noop, options); + window.removeEventListener('test', noop); + } catch (err) { + supported = false; + } + passiveSupported = supported; + return passiveSupported; +} +function isTouchStartEvent(e) { + return e.type === 'touchstart'; +} + +// + +const ColumnVisibility = { + getInitialState: state => { + return { + columnVisibility: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnVisibilityChange: makeStateUpdater('columnVisibility', table) + }; + }, + createColumn: (column, table) => { + column.toggleVisibility = value => { + if (column.getCanHide()) { + table.setColumnVisibility(old => ({ + ...old, + [column.id]: value != null ? value : !column.getIsVisible() + })); + } + }; + column.getIsVisible = () => { + var _ref, _table$getState$colum; + const childColumns = column.columns; + return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true; + }; + column.getCanHide = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); + }; + column.getToggleVisibilityHandler = () => { + return e => { + column.toggleVisibility == null || column.toggleVisibility(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => { + return cells.filter(cell => cell.column.getIsVisible()); + }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')); + row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells')); + }, + createTable: table => { + const makeVisibleColumnsMethod = (key, getColumns) => { + return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => { + return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible()); + }, getMemoOptions(table.options, 'debugColumns', key)); + }; + table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()); + table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()); + table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()); + table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()); + table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()); + table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater); + table.resetColumnVisibility = defaultState => { + var _table$initialState$c; + table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); + }; + table.toggleAllColumnsVisible = value => { + var _value; + value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); + table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ + ...obj, + [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value + }), {})); + }; + table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())); + table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()); + table.getToggleAllColumnsVisibilityHandler = () => { + return e => { + var _target; + table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } +}; +function _getVisibleLeafColumns(table, position) { + return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); +} + +// + +const GlobalFaceting = { + createTable: table => { + table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'); + table.getGlobalFacetedRowModel = () => { + if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getGlobalFacetedRowModel(); + }; + table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'); + table.getGlobalFacetedUniqueValues = () => { + if (!table._getGlobalFacetedUniqueValues) { + return new Map(); + } + return table._getGlobalFacetedUniqueValues(); + }; + table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'); + table.getGlobalFacetedMinMaxValues = () => { + if (!table._getGlobalFacetedMinMaxValues) { + return; + } + return table._getGlobalFacetedMinMaxValues(); + }; + } +}; + +// + +const GlobalFiltering = { + getInitialState: state => { + return { + globalFilter: undefined, + ...state + }; + }, + getDefaultOptions: table => { + return { + onGlobalFilterChange: makeStateUpdater('globalFilter', table), + globalFilterFn: 'auto', + getColumnCanGlobalFilter: column => { + var _table$getCoreRowMode; + const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue(); + return typeof value === 'string' || typeof value === 'number'; + } + }; + }, + createColumn: (column, table) => { + column.getCanGlobalFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol; + return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn; + }; + }, + createTable: table => { + table.getGlobalAutoFilterFn = () => { + return filterFns.includesString; + }; + table.getGlobalFilterFn = () => { + var _table$options$filter, _table$options$filter2; + const { + globalFilterFn: globalFilterFn + } = table.options; + return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn]; + }; + table.setGlobalFilter = updater => { + table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater); + }; + table.resetGlobalFilter = defaultState => { + table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter); + }; + } +}; + +// + +const RowExpanding = { + getInitialState: state => { + return { + expanded: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onExpandedChange: makeStateUpdater('expanded', table), + paginateExpandedRows: true + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetExpanded = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetExpanded(); + queued = false; + }); + } + }; + table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater); + table.toggleAllRowsExpanded = expanded => { + if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { + table.setExpanded(true); + } else { + table.setExpanded({}); + } + }; + table.resetExpanded = defaultState => { + var _table$initialState$e, _table$initialState; + table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); + }; + table.getCanSomeRowsExpand = () => { + return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand()); + }; + table.getToggleAllRowsExpandedHandler = () => { + return e => { + e.persist == null || e.persist(); + table.toggleAllRowsExpanded(); + }; + }; + table.getIsSomeRowsExpanded = () => { + const expanded = table.getState().expanded; + return expanded === true || Object.values(expanded).some(Boolean); + }; + table.getIsAllRowsExpanded = () => { + const expanded = table.getState().expanded; + + // If expanded is true, save some cycles and return true + if (typeof expanded === 'boolean') { + return expanded === true; + } + if (!Object.keys(expanded).length) { + return false; + } + + // If any row is not expanded, return false + if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) { + return false; + } + + // They must all be expanded :shrug: + return true; + }; + table.getExpandedDepth = () => { + let maxDepth = 0; + const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); + rowIds.forEach(id => { + const splitId = id.split('.'); + maxDepth = Math.max(maxDepth, splitId.length); + }); + return maxDepth; + }; + table.getPreExpandedRowModel = () => table.getSortedRowModel(); + table.getExpandedRowModel = () => { + if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { + table._getExpandedRowModel = table.options.getExpandedRowModel(table); + } + if (table.options.manualExpanding || !table._getExpandedRowModel) { + return table.getPreExpandedRowModel(); + } + return table._getExpandedRowModel(); + }; + }, + createRow: (row, table) => { + row.toggleExpanded = expanded => { + table.setExpanded(old => { + var _expanded; + const exists = old === true ? true : !!(old != null && old[row.id]); + let oldExpanded = {}; + if (old === true) { + Object.keys(table.getRowModel().rowsById).forEach(rowId => { + oldExpanded[rowId] = true; + }); + } else { + oldExpanded = old; + } + expanded = (_expanded = expanded) != null ? _expanded : !exists; + if (!exists && expanded) { + return { + ...oldExpanded, + [row.id]: true + }; + } + if (exists && !expanded) { + const { + [row.id]: _, + ...rest + } = oldExpanded; + return rest; + } + return old; + }); + }; + row.getIsExpanded = () => { + var _table$options$getIsR; + const expanded = table.getState().expanded; + return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id])); + }; + row.getCanExpand = () => { + var _table$options$getRow, _table$options$enable, _row$subRows; + return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + row.getIsAllParentsExpanded = () => { + let isFullyExpanded = true; + let currentRow = row; + while (isFullyExpanded && currentRow.parentId) { + currentRow = table.getRow(currentRow.parentId, true); + isFullyExpanded = currentRow.getIsExpanded(); + } + return isFullyExpanded; + }; + row.getToggleExpandedHandler = () => { + const canExpand = row.getCanExpand(); + return () => { + if (!canExpand) return; + row.toggleExpanded(); + }; + }; + } +}; + +// + +const defaultPageIndex = 0; +const defaultPageSize = 10; +const getDefaultPaginationState = () => ({ + pageIndex: defaultPageIndex, + pageSize: defaultPageSize +}); +const RowPagination = { + getInitialState: state => { + return { + ...state, + pagination: { + ...getDefaultPaginationState(), + ...(state == null ? void 0 : state.pagination) + } + }; + }, + getDefaultOptions: table => { + return { + onPaginationChange: makeStateUpdater('pagination', table) + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetPageIndex = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetPageIndex(); + queued = false; + }); + } + }; + table.setPagination = updater => { + const safeUpdater = old => { + let newState = functionalUpdate(updater, old); + return newState; + }; + return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); + }; + table.resetPagination = defaultState => { + var _table$initialState$p; + table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); + }; + table.setPageIndex = updater => { + table.setPagination(old => { + let pageIndex = functionalUpdate(updater, old.pageIndex); + const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1; + pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex)); + return { + ...old, + pageIndex + }; + }); + }; + table.resetPageIndex = defaultState => { + var _table$initialState$p2, _table$initialState; + table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); + }; + table.resetPageSize = defaultState => { + var _table$initialState$p3, _table$initialState2; + table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize); + }; + table.setPageSize = updater => { + table.setPagination(old => { + const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize)); + const topRowIndex = old.pageSize * old.pageIndex; + const pageIndex = Math.floor(topRowIndex / pageSize); + return { + ...old, + pageIndex, + pageSize + }; + }); + }; + //deprecated + table.setPageCount = updater => table.setPagination(old => { + var _table$options$pageCo; + let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); + if (typeof newPageCount === 'number') { + newPageCount = Math.max(-1, newPageCount); + } + return { + ...old, + pageCount: newPageCount + }; + }); + table.getPageOptions = memo(() => [table.getPageCount()], pageCount => { + let pageOptions = []; + if (pageCount && pageCount > 0) { + pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i); + } + return pageOptions; + }, getMemoOptions(table.options, 'debugTable', 'getPageOptions')); + table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0; + table.getCanNextPage = () => { + const { + pageIndex + } = table.getState().pagination; + const pageCount = table.getPageCount(); + if (pageCount === -1) { + return true; + } + if (pageCount === 0) { + return false; + } + return pageIndex < pageCount - 1; + }; + table.previousPage = () => { + return table.setPageIndex(old => old - 1); + }; + table.nextPage = () => { + return table.setPageIndex(old => { + return old + 1; + }); + }; + table.firstPage = () => { + return table.setPageIndex(0); + }; + table.lastPage = () => { + return table.setPageIndex(table.getPageCount() - 1); + }; + table.getPrePaginationRowModel = () => table.getExpandedRowModel(); + table.getPaginationRowModel = () => { + if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { + table._getPaginationRowModel = table.options.getPaginationRowModel(table); + } + if (table.options.manualPagination || !table._getPaginationRowModel) { + return table.getPrePaginationRowModel(); + } + return table._getPaginationRowModel(); + }; + table.getPageCount = () => { + var _table$options$pageCo2; + return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize); + }; + table.getRowCount = () => { + var _table$options$rowCou; + return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length; + }; + } +}; + +// + +const getDefaultRowPinningState = () => ({ + top: [], + bottom: [] +}); +const RowPinning = { + getInitialState: state => { + return { + rowPinning: getDefaultRowPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowPinningChange: makeStateUpdater('rowPinning', table) + }; + }, + createRow: (row, table) => { + row.pin = (position, includeLeafRows, includeParentRows) => { + const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => { + let { + id + } = _ref; + return id; + }) : []; + const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => { + let { + id + } = _ref2; + return id; + }) : []; + const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]); + table.setRowPinning(old => { + var _old$top3, _old$bottom3; + if (position === 'bottom') { + var _old$top, _old$bottom; + return { + top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)] + }; + } + if (position === 'top') { + var _old$top2, _old$bottom2; + return { + top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)], + bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + } + return { + top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + }); + }; + row.getCanPin = () => { + var _ref3; + const { + enableRowPinning, + enablePinning + } = table.options; + if (typeof enableRowPinning === 'function') { + return enableRowPinning(row); + } + return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true; + }; + row.getIsPinned = () => { + const rowIds = [row.id]; + const { + top, + bottom + } = table.getState().rowPinning; + const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d)); + const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d)); + return isTop ? 'top' : isBottom ? 'bottom' : false; + }; + row.getPinnedIndex = () => { + var _ref4, _visiblePinnedRowIds$; + const position = row.getIsPinned(); + if (!position) return -1; + const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => { + let { + id + } = _ref5; + return id; + }); + return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1; + }; + }, + createTable: table => { + table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater); + table.resetRowPinning = defaultState => { + var _table$initialState$r, _table$initialState; + return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState()); + }; + table.getIsSomeRowsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().rowPinning; + if (!position) { + var _pinningState$top, _pinningState$bottom; + return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table._getPinnedRows = (visibleRows, pinnedRowIds, position) => { + var _table$options$keepPi; + const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? + //get all rows that are pinned even if they would not be otherwise visible + //account for expanded parent rows, but not pagination or filtering + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => { + const row = table.getRow(rowId, true); + return row.getIsAllParentsExpanded() ? row : null; + }) : + //else get only visible rows that are pinned + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId)); + return rows.filter(Boolean).map(d => ({ + ...d, + position + })); + }; + table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows')); + table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows')); + table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => { + const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]); + return allRows.filter(d => !topAndBottom.has(d.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterRows')); + } +}; + +// + +const RowSelection = { + getInitialState: state => { + return { + rowSelection: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowSelectionChange: makeStateUpdater('rowSelection', table), + enableRowSelection: true, + enableMultiRowSelection: true, + enableSubRowSelection: true + // enableGroupingRowSelection: false, + // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey, + // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey, + }; + }, + createTable: table => { + table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater); + table.resetRowSelection = defaultState => { + var _table$initialState$r; + return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); + }; + table.toggleAllRowsSelected = value => { + table.setRowSelection(old => { + value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected(); + const rowSelection = { + ...old + }; + const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; + + // We don't use `mutateRowIsSelected` here for performance reasons. + // All of the rows are flat already, so it wouldn't be worth it + if (value) { + preGroupedFlatRows.forEach(row => { + if (!row.getCanSelect()) { + return; + } + rowSelection[row.id] = true; + }); + } else { + preGroupedFlatRows.forEach(row => { + delete rowSelection[row.id]; + }); + } + return rowSelection; + }); + }; + table.toggleAllPageRowsSelected = value => table.setRowSelection(old => { + const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected(); + const rowSelection = { + ...old + }; + table.getRowModel().rows.forEach(row => { + mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table); + }); + return rowSelection; + }); + + // addRowSelectionRange: rowId => { + // const { + // rows, + // rowsById, + // options: { selectGroupingRows, selectSubRows }, + // } = table + + // const findSelectedRow = (rows: Row[]) => { + // let found + // rows.find(d => { + // if (d.getIsSelected()) { + // found = d + // return true + // } + // const subFound = findSelectedRow(d.subRows || []) + // if (subFound) { + // found = subFound + // return true + // } + // return false + // }) + // return found + // } + + // const firstRow = findSelectedRow(rows) || rows[0] + // const lastRow = rowsById[rowId] + + // let include = false + // const selectedRowIds = {} + + // const addRow = (row: Row) => { + // mutateRowIsSelected(selectedRowIds, row.id, true, { + // rowsById, + // selectGroupingRows: selectGroupingRows!, + // selectSubRows: selectSubRows!, + // }) + // } + + // table.rows.forEach(row => { + // const isFirstRow = row.id === firstRow.id + // const isLastRow = row.id === lastRow.id + + // if (isFirstRow || isLastRow) { + // if (!include) { + // include = true + // } else if (include) { + // addRow(row) + // include = false + // } + // } + + // if (include) { + // addRow(row) + // } + // }) + + // table.setRowSelection(selectedRowIds) + // }, + table.getPreSelectedRowModel = () => table.getCoreRowModel(); + table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')); + table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')); + table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')); + + /// + + // getGroupingRowCanSelect: rowId => { + // const row = table.getRow(rowId) + + // if (!row) { + // throw new Error() + // } + + // if (typeof table.options.enableGroupingRowSelection === 'function') { + // return table.options.enableGroupingRowSelection(row) + // } + + // return table.options.enableGroupingRowSelection ?? false + // }, + + table.getIsAllRowsSelected = () => { + const preGroupedFlatRows = table.getFilteredRowModel().flatRows; + const { + rowSelection + } = table.getState(); + let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); + if (isAllRowsSelected) { + if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) { + isAllRowsSelected = false; + } + } + return isAllRowsSelected; + }; + table.getIsAllPageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect()); + const { + rowSelection + } = table.getState(); + let isAllPageRowsSelected = !!paginationFlatRows.length; + if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) { + isAllPageRowsSelected = false; + } + return isAllPageRowsSelected; + }; + table.getIsSomeRowsSelected = () => { + var _table$getState$rowSe; + const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; + return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; + }; + table.getIsSomePageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows; + return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected()); + }; + table.getToggleAllRowsSelectedHandler = () => { + return e => { + table.toggleAllRowsSelected(e.target.checked); + }; + }; + table.getToggleAllPageRowsSelectedHandler = () => { + return e => { + table.toggleAllPageRowsSelected(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row.toggleSelected = (value, opts) => { + const isSelected = row.getIsSelected(); + table.setRowSelection(old => { + var _opts$selectChildren; + value = typeof value !== 'undefined' ? value : !isSelected; + if (row.getCanSelect() && isSelected === value) { + return old; + } + const selectedRowIds = { + ...old + }; + mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table); + return selectedRowIds; + }); + }; + row.getIsSelected = () => { + const { + rowSelection + } = table.getState(); + return isRowSelected(row, rowSelection); + }; + row.getIsSomeSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'some'; + }; + row.getIsAllSubRowsSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'all'; + }; + row.getCanSelect = () => { + var _table$options$enable; + if (typeof table.options.enableRowSelection === 'function') { + return table.options.enableRowSelection(row); + } + return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; + }; + row.getCanSelectSubRows = () => { + var _table$options$enable2; + if (typeof table.options.enableSubRowSelection === 'function') { + return table.options.enableSubRowSelection(row); + } + return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; + }; + row.getCanMultiSelect = () => { + var _table$options$enable3; + if (typeof table.options.enableMultiRowSelection === 'function') { + return table.options.enableMultiRowSelection(row); + } + return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; + }; + row.getToggleSelectedHandler = () => { + const canSelect = row.getCanSelect(); + return e => { + var _target; + if (!canSelect) return; + row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } +}; +const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => { + var _row$subRows; + const row = table.getRow(id, true); + + // const isGrouped = row.getIsGrouped() + + // if ( // TODO: enforce grouping row selection rules + // !isGrouped || + // (isGrouped && table.options.enableGroupingRowSelection) + // ) { + if (value) { + if (!row.getCanMultiSelect()) { + Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]); + } + if (row.getCanSelect()) { + selectedRowIds[id] = true; + } + } else { + delete selectedRowIds[id]; + } + // } + + if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { + row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)); + } +}; +function selectRowsFn(table, rowModel) { + const rowSelection = table.getState().rowSelection; + const newSelectedFlatRows = []; + const newSelectedRowsById = {}; + + // Filters top level and nested rows + const recurseRows = function (rows, depth) { + return rows.map(row => { + var _row$subRows2; + const isSelected = isRowSelected(row, rowSelection); + if (isSelected) { + newSelectedFlatRows.push(row); + newSelectedRowsById[row.id] = row; + } + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) { + row = { + ...row, + subRows: recurseRows(row.subRows) + }; + } + if (isSelected) { + return row; + } + }).filter(Boolean); + }; + return { + rows: recurseRows(rowModel.rows), + flatRows: newSelectedFlatRows, + rowsById: newSelectedRowsById + }; +} +function isRowSelected(row, selection) { + var _selection$row$id; + return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false; +} +function isSubRowSelected(row, selection, table) { + var _row$subRows3; + if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false; + let allChildrenSelected = true; + let someSelected = false; + row.subRows.forEach(subRow => { + // Bail out early if we know both of these + if (someSelected && !allChildrenSelected) { + return; + } + if (subRow.getCanSelect()) { + if (isRowSelected(subRow, selection)) { + someSelected = true; + } else { + allChildrenSelected = false; + } + } + + // Check row selection of nested subrows + if (subRow.subRows && subRow.subRows.length) { + const subRowChildrenSelected = isSubRowSelected(subRow, selection); + if (subRowChildrenSelected === 'all') { + someSelected = true; + } else if (subRowChildrenSelected === 'some') { + someSelected = true; + allChildrenSelected = false; + } else { + allChildrenSelected = false; + } + } + }); + return allChildrenSelected ? 'all' : someSelected ? 'some' : false; +} + +const reSplitAlphaNumeric = /([0-9]+)/gm; +const alphanumeric = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; +const alphanumericCaseSensitive = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; + +// The text filter is more basic (less numeric support) +// but is much faster +const text = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; + +// The text filter is more basic (less numeric support) +// but is much faster +const textCaseSensitive = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; +const datetime = (rowA, rowB, columnId) => { + const a = rowA.getValue(columnId); + const b = rowB.getValue(columnId); + + // Can handle nullish values + // Use > and < because == (and ===) doesn't work with + // Date objects (would require calling getTime()). + return a > b ? 1 : a < b ? -1 : 0; +}; +const basic = (rowA, rowB, columnId) => { + return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); +}; + +// Utils + +function compareBasic(a, b) { + return a === b ? 0 : a > b ? 1 : -1; +} +function toString(a) { + if (typeof a === 'number') { + if (isNaN(a) || a === Infinity || a === -Infinity) { + return ''; + } + return String(a); + } + if (typeof a === 'string') { + return a; + } + return ''; +} + +// Mixed sorting is slow, but very inclusive of many edge cases. +// It handles numbers, mixed alphanumeric combinations, and even +// null, undefined, and Infinity +function compareAlphanumeric(aStr, bStr) { + // Split on number groups, but keep the delimiter + // Then remove falsey split values + const a = aStr.split(reSplitAlphaNumeric).filter(Boolean); + const b = bStr.split(reSplitAlphaNumeric).filter(Boolean); + + // While + while (a.length && b.length) { + const aa = a.shift(); + const bb = b.shift(); + const an = parseInt(aa, 10); + const bn = parseInt(bb, 10); + const combo = [an, bn].sort(); + + // Both are string + if (isNaN(combo[0])) { + if (aa > bb) { + return 1; + } + if (bb > aa) { + return -1; + } + continue; + } + + // One is a string, one is a number + if (isNaN(combo[1])) { + return isNaN(an) ? -1 : 1; + } + + // Both are numbers + if (an > bn) { + return 1; + } + if (bn > an) { + return -1; + } + } + return a.length - b.length; +} + +// Exports + +const sortingFns = { + alphanumeric, + alphanumericCaseSensitive, + text, + textCaseSensitive, + datetime, + basic +}; + +// + +const RowSorting = { + getInitialState: state => { + return { + sorting: [], + ...state + }; + }, + getDefaultColumnDef: () => { + return { + sortingFn: 'auto', + sortUndefined: 1 + }; + }, + getDefaultOptions: table => { + return { + onSortingChange: makeStateUpdater('sorting', table), + isMultiSortEvent: e => { + return e.shiftKey; + } + }; + }, + createColumn: (column, table) => { + column.getAutoSortingFn = () => { + const firstRows = table.getFilteredRowModel().flatRows.slice(10); + let isString = false; + for (const row of firstRows) { + const value = row == null ? void 0 : row.getValue(column.id); + if (Object.prototype.toString.call(value) === '[object Date]') { + return sortingFns.datetime; + } + if (typeof value === 'string') { + isString = true; + if (value.split(reSplitAlphaNumeric).length > 1) { + return sortingFns.alphanumeric; + } + } + } + if (isString) { + return sortingFns.text; + } + return sortingFns.basic; + }; + column.getAutoSortDir = () => { + const firstRow = table.getFilteredRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return 'asc'; + } + return 'desc'; + }; + column.getSortingFn = () => { + var _table$options$sortin, _table$options$sortin2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn]; + }; + column.toggleSorting = (desc, multi) => { + // if (column.columns.length) { + // column.columns.forEach((c, i) => { + // if (c.id) { + // table.toggleColumnSorting(c.id, undefined, multi || !!i) + // } + // }) + // return + // } + + // this needs to be outside of table.setSorting to be in sync with rerender + const nextSortingOrder = column.getNextSortingOrder(); + const hasManualValue = typeof desc !== 'undefined' && desc !== null; + table.setSorting(old => { + // Find any existing sorting for this column + const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id); + const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id); + let newSorting = []; + + // What should we do with this sort action? + let sortAction; + let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; + + // Multi-mode + if (old != null && old.length && column.getCanMultiSort() && multi) { + if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'add'; + } + } else { + // Normal mode + if (old != null && old.length && existingIndex !== old.length - 1) { + sortAction = 'replace'; + } else if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'replace'; + } + } + + // Handle toggle states that will remove the sorting + if (sortAction === 'toggle') { + // If we are "actually" toggling (not a manual set value), should we remove the sorting? + if (!hasManualValue) { + // Is our intention to remove? + if (!nextSortingOrder) { + sortAction = 'remove'; + } + } + } + if (sortAction === 'add') { + var _table$options$maxMul; + newSorting = [...old, { + id: column.id, + desc: nextDesc + }]; + // Take latest n columns + newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); + } else if (sortAction === 'toggle') { + // This flips (or sets) the + newSorting = old.map(d => { + if (d.id === column.id) { + return { + ...d, + desc: nextDesc + }; + } + return d; + }); + } else if (sortAction === 'remove') { + newSorting = old.filter(d => d.id !== column.id); + } else { + newSorting = [{ + id: column.id, + desc: nextDesc + }]; + } + return newSorting; + }); + }; + column.getFirstSortDir = () => { + var _ref, _column$columnDef$sor; + const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc'; + return sortDescFirst ? 'desc' : 'asc'; + }; + column.getNextSortingOrder = multi => { + var _table$options$enable, _table$options$enable2; + const firstSortDirection = column.getFirstSortDir(); + const isSorted = column.getIsSorted(); + if (!isSorted) { + return firstSortDirection; + } + if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( + // If enableSortRemove, enable in general + multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove)) + ) { + return false; + } + return isSorted === 'desc' ? 'asc' : 'desc'; + }; + column.getCanSort = () => { + var _column$columnDef$ena, _table$options$enable3; + return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn; + }; + column.getCanMultiSort = () => { + var _ref2, _column$columnDef$ena2; + return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn; + }; + column.getIsSorted = () => { + var _table$getState$sorti; + const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id); + return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'; + }; + column.getSortIndex = () => { + var _table$getState$sorti2, _table$getState$sorti3; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1; + }; + column.clearSorting = () => { + //clear sorting for just 1 column + table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []); + }; + column.getToggleSortingHandler = () => { + const canSort = column.getCanSort(); + return e => { + if (!canSort) return; + e.persist == null || e.persist(); + column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false); + }; + }; + }, + createTable: table => { + table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater); + table.resetSorting = defaultState => { + var _table$initialState$s, _table$initialState; + table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); + }; + table.getPreSortedRowModel = () => table.getGroupedRowModel(); + table.getSortedRowModel = () => { + if (!table._getSortedRowModel && table.options.getSortedRowModel) { + table._getSortedRowModel = table.options.getSortedRowModel(table); + } + if (table.options.manualSorting || !table._getSortedRowModel) { + return table.getPreSortedRowModel(); + } + return table._getSortedRowModel(); + }; + } +}; + +const builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting, +//depends on ColumnFaceting +GlobalFiltering, +//depends on ColumnFiltering +RowSorting, ColumnGrouping, +//depends on RowSorting +RowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing]; + +// + +function createTable(options) { + var _options$_features, _options$initialState; + if (process.env.NODE_ENV !== 'production' && (options.debugAll || options.debugTable)) { + console.info('Creating Table Instance...'); + } + const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])]; + let table = { + _features + }; + const defaultOptions = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); + }, {}); + const mergeOptions = options => { + if (table.options.mergeOptions) { + return table.options.mergeOptions(defaultOptions, options); + } + return { + ...defaultOptions, + ...options + }; + }; + const coreInitialState = {}; + let initialState = { + ...coreInitialState, + ...((_options$initialState = options.initialState) != null ? _options$initialState : {}) + }; + table._features.forEach(feature => { + var _feature$getInitialSt; + initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState; + }); + const queued = []; + let queuedTimeout = false; + const coreInstance = { + _features, + options: { + ...defaultOptions, + ...options + }, + initialState, + _queue: cb => { + queued.push(cb); + if (!queuedTimeout) { + queuedTimeout = true; + + // Schedule a microtask to run the queued callbacks after + // the current call stack (render, etc) has finished. + Promise.resolve().then(() => { + while (queued.length) { + queued.shift()(); + } + queuedTimeout = false; + }).catch(error => setTimeout(() => { + throw error; + })); + } + }, + reset: () => { + table.setState(table.initialState); + }, + setOptions: updater => { + const newOptions = functionalUpdate(updater, table.options); + table.options = mergeOptions(newOptions); + }, + getState: () => { + return table.options.state; + }, + setState: updater => { + table.options.onStateChange == null || table.options.onStateChange(updater); + }, + _getRowId: (row, index, parent) => { + var _table$options$getRow; + return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`; + }, + getCoreRowModel: () => { + if (!table._getCoreRowModel) { + table._getCoreRowModel = table.options.getCoreRowModel(table); + } + return table._getCoreRowModel(); + }, + // The final calls start at the bottom of the model, + // expanded rows, which then work their way up + + getRowModel: () => { + return table.getPaginationRowModel(); + }, + //in next version, we should just pass in the row model as the optional 2nd arg + getRow: (id, searchAll) => { + let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id]; + if (!row) { + row = table.getCoreRowModel().rowsById[id]; + if (!row) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(`getRow could not find row with ID: ${id}`); + } + throw new Error(); + } + } + return row; + }, + _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => { + var _defaultColumn; + defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; + return { + header: props => { + const resolvedColumnDef = props.header.column.columnDef; + if (resolvedColumnDef.accessorKey) { + return resolvedColumnDef.accessorKey; + } + if (resolvedColumnDef.accessorFn) { + return resolvedColumnDef.id; + } + return null; + }, + // footer: props => props.header.column.id, + cell: props => { + var _props$renderValue$to, _props$renderValue; + return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; + }, + ...table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); + }, {}), + ...defaultColumn + }; + }, getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')), + _getColumnDefs: () => table.options.columns, + getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => { + const recurseColumns = function (columnDefs, parent, depth) { + if (depth === void 0) { + depth = 0; + } + return columnDefs.map(columnDef => { + const column = createColumn(table, columnDef, depth, parent); + const groupingColumnDef = columnDef; + column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : []; + return column; + }); + }; + return recurseColumns(columnDefs); + }, getMemoOptions(options, 'debugColumns', 'getAllColumns')), + getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => { + return allColumns.flatMap(column => { + return column.getFlatColumns(); + }); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')), + _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => { + return flatColumns.reduce((acc, column) => { + acc[column.id] = column; + return acc; + }, {}); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')), + getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => { + let leafColumns = allColumns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + }, getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')), + getColumn: columnId => { + const column = table._getAllFlatColumnsById()[columnId]; + if (process.env.NODE_ENV !== 'production' && !column) { + console.error(`[Table] Column with id '${columnId}' does not exist.`); + } + return column; + } + }; + Object.assign(table, coreInstance); + for (let index = 0; index < table._features.length; index++) { + const feature = table._features[index]; + feature == null || feature.createTable == null || feature.createTable(table); + } + return table; +} + +function getCoreRowModel() { + return table => memo(() => [table.options.data], data => { + const rowModel = { + rows: [], + flatRows: [], + rowsById: {} + }; + const accessRows = function (originalRows, depth, parentRow) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + for (let i = 0; i < originalRows.length; i++) { + // This could be an expensive check at scale, so we should move it somewhere else, but where? + // if (!id) { + // if (process.env.NODE_ENV !== 'production') { + // throw new Error(`getRowId expected an ID, but got ${id}`) + // } + // } + + // Make the row + const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id); + + // Keep track of every row in a flat array + rowModel.flatRows.push(row); + // Also keep track of every row by its ID + rowModel.rowsById[row.id] = row; + // Push table row into parent + rows.push(row); + + // Get the original subrows + if (table.options.getSubRows) { + var _row$originalSubRows; + row.originalSubRows = table.options.getSubRows(originalRows[i], i); + + // Then recursively access them + if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) { + row.subRows = accessRows(row.originalSubRows, depth + 1, row); + } + } + } + return rows; + }; + rowModel.rows = accessRows(data); + return rowModel; + }, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex())); +} + +function getExpandedRowModel() { + return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => { + if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) { + return rowModel; + } + if (!paginateExpandedRows) { + // Only expand rows at this point if they are being paginated + return rowModel; + } + return expandRows(rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')); +} +function expandRows(rowModel) { + const expandedRows = []; + const handleRow = row => { + var _row$subRows; + expandedRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) { + row.subRows.forEach(handleRow); + } + }; + rowModel.rows.forEach(handleRow); + return { + rows: expandedRows, + flatRows: rowModel.flatRows, + rowsById: rowModel.rowsById + }; +} + +function getFacetedMinMaxValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return undefined; + const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => { + var _flatRow$getUniqueVal; + return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : []; + }).map(Number).filter(value => !Number.isNaN(value)); + if (!uniqueValues.length) return; + let facetedMinValue = uniqueValues[0]; + let facetedMaxValue = uniqueValues[uniqueValues.length - 1]; + for (const value of uniqueValues) { + if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value; + } + return [facetedMinValue, facetedMaxValue]; + }, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')); +} + +function filterRows(rows, filterRowImpl, table) { + if (table.options.filterFromLeafRows) { + return filterRowModelFromLeafs(rows, filterRowImpl, table); + } + return filterRowModelFromRoot(rows, filterRowImpl, table); +} +function filterRowModelFromLeafs(rowsToFilter, filterRow, table) { + var _table$options$maxLea; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100; + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + + // Filter from children up first + for (let i = 0; i < rowsToFilter.length; i++) { + var _row$subRows; + let row = rowsToFilter[i]; + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.columnFilters = row.columnFilters; + if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) { + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + if (filterRow(row) && !newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + if (filterRow(row) || newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + } else { + row = newRow; + if (filterRow(row)) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + } + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; +} +function filterRowModelFromRoot(rowsToFilter, filterRow, table) { + var _table$options$maxLea2; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100; + + // Filters top level and nested rows + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + // Filter from parents downward first + + const rows = []; + + // Apply the filter to any subRows + for (let i = 0; i < rowsToFilter.length; i++) { + let row = rowsToFilter[i]; + const pass = filterRow(row); + if (pass) { + var _row$subRows2; + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) { + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + } + rows.push(row); + newFilteredFlatRows.push(row); + newFilteredRowsById[row.id] = row; + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; +} + +function getFacetedRowModel() { + return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => { + if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + return preRowModel; + } + const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean); + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + return filterRows(preRowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')); +} + +function getFacetedUniqueValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return new Map(); + let facetedUniqueValues = new Map(); + for (let i = 0; i < facetedRowModel.flatRows.length; i++) { + const values = facetedRowModel.flatRows[i].getUniqueValues(columnId); + for (let j = 0; j < values.length; j++) { + const value = values[j]; + if (facetedUniqueValues.has(value)) { + var _facetedUniqueValues$; + facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1); + } else { + facetedUniqueValues.set(value, 1); + } + } + } + return facetedUniqueValues; + }, getMemoOptions(table.options, 'debugTable', `getFacetedUniqueValues_${columnId}`)); +} + +function getFilteredRowModel() { + return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => { + if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + for (let i = 0; i < rowModel.flatRows.length; i++) { + rowModel.flatRows[i].columnFilters = {}; + rowModel.flatRows[i].columnFiltersMeta = {}; + } + return rowModel; + } + const resolvedColumnFilters = []; + const resolvedGlobalFilters = []; + (columnFilters != null ? columnFilters : []).forEach(d => { + var _filterFn$resolveFilt; + const column = table.getColumn(d.id); + if (!column) { + return; + } + const filterFn = column.getFilterFn(); + if (!filterFn) { + if (process.env.NODE_ENV !== 'production') { + console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`); + } + return; + } + resolvedColumnFilters.push({ + id: d.id, + filterFn, + resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value + }); + }); + const filterableIds = (columnFilters != null ? columnFilters : []).map(d => d.id); + const globalFilterFn = table.getGlobalFilterFn(); + const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter()); + if (globalFilter && globalFilterFn && globallyFilterableColumns.length) { + filterableIds.push('__global__'); + globallyFilterableColumns.forEach(column => { + var _globalFilterFn$resol; + resolvedGlobalFilters.push({ + id: column.id, + filterFn: globalFilterFn, + resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter + }); + }); + } + let currentColumnFilter; + let currentGlobalFilter; + + // Flag the prefiltered row model with each filter state + for (let j = 0; j < rowModel.flatRows.length; j++) { + const row = rowModel.flatRows[j]; + row.columnFilters = {}; + if (resolvedColumnFilters.length) { + for (let i = 0; i < resolvedColumnFilters.length; i++) { + currentColumnFilter = resolvedColumnFilters[i]; + const id = currentColumnFilter.id; + + // Tag the row with the column filter state + row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + }); + } + } + if (resolvedGlobalFilters.length) { + for (let i = 0; i < resolvedGlobalFilters.length; i++) { + currentGlobalFilter = resolvedGlobalFilters[i]; + const id = currentGlobalFilter.id; + // Tag the row with the first truthy global filter state + if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + })) { + row.columnFilters.__global__ = true; + break; + } + } + if (row.columnFilters.__global__ !== true) { + row.columnFilters.__global__ = false; + } + } + } + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + + // Filter final rows using all of the active filters + return filterRows(rowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => table._autoResetPageIndex())); +} + +function getGroupedRowModel() { + return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { + if (!rowModel.rows.length || !grouping.length) { + rowModel.rows.forEach(row => { + row.depth = 0; + row.parentId = undefined; + }); + return rowModel; + } + + // Filter the grouping list down to columns that exist + const existingGrouping = grouping.filter(columnId => table.getColumn(columnId)); + const groupedFlatRows = []; + const groupedRowsById = {}; + // const onlyGroupedFlatRows: Row[] = []; + // const onlyGroupedRowsById: Record = {}; + // const nonGroupedFlatRows: Row[] = []; + // const nonGroupedRowsById: Record = {}; + + // Recursively group the data + const groupUpRecursively = function (rows, depth, parentId) { + if (depth === void 0) { + depth = 0; + } + // Grouping depth has been been met + // Stop grouping and simply rewrite thd depth and row relationships + if (depth >= existingGrouping.length) { + return rows.map(row => { + row.depth = depth; + groupedFlatRows.push(row); + groupedRowsById[row.id] = row; + if (row.subRows) { + row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id); + } + return row; + }); + } + const columnId = existingGrouping[depth]; + + // Group the rows together for this level + const rowGroupsMap = groupBy(rows, columnId); + + // Perform aggregations for each group + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { + let [groupingValue, groupedRows] = _ref; + let id = `${columnId}:${groupingValue}`; + id = parentId ? `${parentId}>${id}` : id; + + // First, Recurse to group sub rows before aggregation + const subRows = groupUpRecursively(groupedRows, depth + 1, id); + subRows.forEach(subRow => { + subRow.parentId = id; + }); + + // Flatten the leaf rows of the rows in this group + const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows; + const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId); + Object.assign(row, { + groupingColumnId: columnId, + groupingValue, + subRows, + leafRows, + getValue: columnId => { + // Don't aggregate columns that are in the grouping + if (existingGrouping.includes(columnId)) { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + if (groupedRows[0]) { + var _groupedRows$0$getVal; + row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined; + } + return row._valuesCache[columnId]; + } + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + + // Aggregate the values + const column = table.getColumn(columnId); + const aggregateFn = column == null ? void 0 : column.getAggregationFn(); + if (aggregateFn) { + row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows); + return row._groupingValuesCache[columnId]; + } + } + }); + subRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return row; + }); + return aggregatedGroupedRows; + }; + const groupedRows = groupUpRecursively(rowModel.rows, 0); + groupedRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return { + rows: groupedRows, + flatRows: groupedFlatRows, + rowsById: groupedRowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => { + table._queue(() => { + table._autoResetExpanded(); + table._autoResetPageIndex(); + }); + })); +} +function groupBy(rows, columnId) { + const groupMap = new Map(); + return rows.reduce((map, row) => { + const resKey = `${row.getGroupingValue(columnId)}`; + const previous = map.get(resKey); + if (!previous) { + map.set(resKey, [row]); + } else { + previous.push(row); + } + return map; + }, groupMap); +} + +function getPaginationRowModel(opts) { + return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => { + if (!rowModel.rows.length) { + return rowModel; + } + const { + pageSize, + pageIndex + } = pagination; + let { + rows, + flatRows, + rowsById + } = rowModel; + const pageStart = pageSize * pageIndex; + const pageEnd = pageStart + pageSize; + rows = rows.slice(pageStart, pageEnd); + let paginatedRowModel; + if (!table.options.paginateExpandedRows) { + paginatedRowModel = expandRows({ + rows, + flatRows, + rowsById + }); + } else { + paginatedRowModel = { + rows, + flatRows, + rowsById + }; + } + paginatedRowModel.flatRows = []; + const handleRow = row => { + paginatedRowModel.flatRows.push(row); + if (row.subRows.length) { + row.subRows.forEach(handleRow); + } + }; + paginatedRowModel.rows.forEach(handleRow); + return paginatedRowModel; + }, getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')); +} + +function getSortedRowModel() { + return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => { + if (!rowModel.rows.length || !(sorting != null && sorting.length)) { + return rowModel; + } + const sortingState = table.getState().sorting; + const sortedFlatRows = []; + + // Filter out sortings that correspond to non existing columns + const availableSorting = sortingState.filter(sort => { + var _table$getColumn; + return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort(); + }); + const columnInfoById = {}; + availableSorting.forEach(sortEntry => { + const column = table.getColumn(sortEntry.id); + if (!column) return; + columnInfoById[sortEntry.id] = { + sortUndefined: column.columnDef.sortUndefined, + invertSorting: column.columnDef.invertSorting, + sortingFn: column.getSortingFn() + }; + }); + const sortData = rows => { + // This will also perform a stable sorting using the row index + // if needed. + const sortedData = rows.map(row => ({ + ...row + })); + sortedData.sort((rowA, rowB) => { + for (let i = 0; i < availableSorting.length; i += 1) { + var _sortEntry$desc; + const sortEntry = availableSorting[i]; + const columnInfo = columnInfoById[sortEntry.id]; + const sortUndefined = columnInfo.sortUndefined; + const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false; + let sortInt = 0; + + // All sorting ints should always return in ascending order + if (sortUndefined) { + const aValue = rowA.getValue(sortEntry.id); + const bValue = rowB.getValue(sortEntry.id); + const aUndefined = aValue === undefined; + const bUndefined = bValue === undefined; + if (aUndefined || bUndefined) { + if (sortUndefined === 'first') return aUndefined ? -1 : 1; + if (sortUndefined === 'last') return aUndefined ? 1 : -1; + sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined; + } + } + if (sortInt === 0) { + sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id); + } + + // If sorting is non-zero, take care of desc and inversion + if (sortInt !== 0) { + if (isDesc) { + sortInt *= -1; + } + if (columnInfo.invertSorting) { + sortInt *= -1; + } + return sortInt; + } + } + return rowA.index - rowB.index; + }); + + // If there are sub-rows, sort them + sortedData.forEach(row => { + var _row$subRows; + sortedFlatRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length) { + row.subRows = sortData(row.subRows); + } + }); + return sortedData; + }; + return { + rows: sortData(rowModel.rows), + flatRows: sortedFlatRows, + rowsById: rowModel.rowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex())); +} + +export { ColumnFaceting, ColumnFiltering, ColumnGrouping, ColumnOrdering, ColumnPinning, ColumnSizing, ColumnVisibility, GlobalFaceting, GlobalFiltering, Headers, RowExpanding, RowPagination, RowPinning, RowSelection, RowSorting, _getVisibleLeafColumns, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getMemoOptions, getPaginationRowModel, getSortedRowModel, isFunction, isNumberArray, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/@tanstack/table-core/build/lib/index.mjs.map b/node_modules/@tanstack/table-core/build/lib/index.mjs.map new file mode 100644 index 00000000..75d19fe3 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../../src/columnHelper.ts","../../src/utils.ts","../../src/core/cell.ts","../../src/core/column.ts","../../src/core/headers.ts","../../src/core/row.ts","../../src/features/ColumnFaceting.ts","../../src/filterFns.ts","../../src/features/ColumnFiltering.ts","../../src/aggregationFns.ts","../../src/features/ColumnGrouping.ts","../../src/features/ColumnOrdering.ts","../../src/features/ColumnPinning.ts","../../src/utils/document.ts","../../src/features/ColumnSizing.ts","../../src/features/ColumnVisibility.ts","../../src/features/GlobalFaceting.ts","../../src/features/GlobalFiltering.ts","../../src/features/RowExpanding.ts","../../src/features/RowPagination.ts","../../src/features/RowPinning.ts","../../src/features/RowSelection.ts","../../src/sortingFns.ts","../../src/features/RowSorting.ts","../../src/core/table.ts","../../src/utils/getCoreRowModel.ts","../../src/utils/getExpandedRowModel.ts","../../src/utils/getFacetedMinMaxValues.ts","../../src/utils/filterRowsUtils.ts","../../src/utils/getFacetedRowModel.ts","../../src/utils/getFacetedUniqueValues.ts","../../src/utils/getFilteredRowModel.ts","../../src/utils/getGroupedRowModel.ts","../../src/utils/getPaginationRowModel.ts","../../src/utils/getSortedRowModel.ts"],"sourcesContent":["import {\n AccessorFn,\n AccessorFnColumnDef,\n AccessorKeyColumnDef,\n DisplayColumnDef,\n GroupColumnDef,\n IdentifiedColumnDef,\n RowData,\n} from './types'\nimport { DeepKeys, DeepValue } from './utils'\n\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nexport type ColumnHelper = {\n accessor: <\n TAccessor extends AccessorFn | DeepKeys,\n TValue extends TAccessor extends AccessorFn\n ? TReturn\n : TAccessor extends DeepKeys\n ? DeepValue\n : never,\n >(\n accessor: TAccessor,\n column: TAccessor extends AccessorFn\n ? DisplayColumnDef\n : IdentifiedColumnDef\n ) => TAccessor extends AccessorFn\n ? AccessorFnColumnDef\n : AccessorKeyColumnDef\n display: (column: DisplayColumnDef) => DisplayColumnDef\n group: (column: GroupColumnDef) => GroupColumnDef\n}\n\nexport function createColumnHelper<\n TData extends RowData,\n>(): ColumnHelper {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function'\n ? ({\n ...column,\n accessorFn: accessor,\n } as any)\n : {\n ...column,\n accessorKey: accessor,\n }\n },\n display: column => column,\n group: column => column,\n }\n}\n","import { TableOptionsResolved, TableState, Updater } from './types'\n\nexport type PartialKeys = Omit & Partial>\nexport type RequiredKeys = Omit &\n Required>\nexport type Overwrite = Omit<\n T,\n keyof U\n> &\n U\n\nexport type UnionToIntersection = (\n T extends any ? (x: T) => any : never\n) extends (x: infer R) => any\n ? R\n : never\n\nexport type IsAny = 1 extends 0 & T ? Y : N\nexport type IsKnown = unknown extends T ? N : Y\n\ntype ComputeRange<\n N extends number,\n Result extends Array = [],\n> = Result['length'] extends N\n ? Result\n : ComputeRange\ntype Index40 = ComputeRange<40>[number]\n\n// Is this type a tuple?\ntype IsTuple = T extends readonly any[] & { length: infer Length }\n ? Length extends Index40\n ? T\n : never\n : never\n\n// If this type is a tuple, what indices are allowed?\ntype AllowedIndexes<\n Tuple extends ReadonlyArray,\n Keys extends number = never,\n> = Tuple extends readonly []\n ? Keys\n : Tuple extends readonly [infer _, ...infer Tail]\n ? AllowedIndexes\n : Keys\n\nexport type DeepKeys = TDepth['length'] extends 5\n ? never\n : unknown extends T\n ? string\n : T extends readonly any[] & IsTuple\n ? AllowedIndexes | DeepKeysPrefix, TDepth>\n : T extends any[]\n ? DeepKeys\n : T extends Date\n ? never\n : T extends object\n ? (keyof T & string) | DeepKeysPrefix\n : never\n\ntype DeepKeysPrefix<\n T,\n TPrefix,\n TDepth extends any[],\n> = TPrefix extends keyof T & (number | string)\n ? `${TPrefix}.${DeepKeys & string}`\n : never\n\nexport type DeepValue =\n T extends Record\n ? TProp extends `${infer TBranch}.${infer TDeepProp}`\n ? DeepValue\n : T[TProp & string]\n : never\n\nexport type NoInfer = [T][T extends any ? 0 : never]\n\nexport type Getter = () => NoInfer\n\n///\n\nexport function functionalUpdate(updater: Updater, input: T): T {\n return typeof updater === 'function'\n ? (updater as (input: T) => T)(input)\n : updater\n}\n\nexport function noop() {\n //\n}\n\nexport function makeStateUpdater(\n key: K,\n instance: unknown\n) {\n return (updater: Updater) => {\n ;(instance as any).setState((old: TTableState) => {\n return {\n ...old,\n [key]: functionalUpdate(updater, (old as any)[key]),\n }\n })\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\nexport function isFunction(d: any): d is T {\n return d instanceof Function\n}\n\nexport function isNumberArray(d: any): d is number[] {\n return Array.isArray(d) && d.every(val => typeof val === 'number')\n}\n\nexport function flattenBy(\n arr: TNode[],\n getChildren: (item: TNode) => TNode[]\n) {\n const flat: TNode[] = []\n\n const recurse = (subArr: TNode[]) => {\n subArr.forEach(item => {\n flat.push(item)\n const children = getChildren(item)\n if (children?.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\nexport function memo(\n getDeps: (depArgs?: TDepArgs) => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: any\n debug?: () => any\n onChange?: (result: TResult) => void\n }\n): (depArgs?: TDepArgs) => TResult {\n let deps: any[] = []\n let result: TResult | undefined\n\n return depArgs => {\n let depTime: number\n if (opts.key && opts.debug) depTime = Date.now()\n\n const newDeps = getDeps(depArgs)\n\n const depsChanged =\n newDeps.length !== deps.length ||\n newDeps.some((dep: any, index: number) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime: number\n if (opts.key && opts.debug) resultTime = Date.now()\n\n result = fn(...newDeps)\n opts?.onChange?.(result)\n\n if (opts.key && opts.debug) {\n if (opts?.debug()) {\n const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120)\n )}deg 100% 31%);`,\n opts?.key\n )\n }\n }\n\n return result!\n }\n}\n\nexport function getMemoOptions(\n tableOptions: Partial>,\n debugLevel:\n | 'debugAll'\n | 'debugCells'\n | 'debugTable'\n | 'debugColumns'\n | 'debugRows'\n | 'debugHeaders',\n key: string,\n onChange?: (result: any) => void\n) {\n return {\n debug: () => tableOptions?.debugAll ?? tableOptions[debugLevel],\n key: process.env.NODE_ENV === 'development' && key,\n onChange,\n }\n}\n","import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, getMemoOptions, memo } from '../utils'\n\nexport interface CellContext {\n cell: Cell\n column: Column\n getValue: Getter\n renderValue: Getter\n row: Row\n table: Table\n}\n\nexport interface CoreCell {\n /**\n * The associated Column object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n column: Column\n /**\n * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice:\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getContext: () => CellContext\n /**\n * Returns the value for the cell, accessed via the associated column's accessor key or accessor function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getValue: CellContext['getValue']\n /**\n * The unique ID for the cell across the entire table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n id: string\n /**\n * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n renderValue: CellContext['renderValue']\n /**\n * The associated Row object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n row: Row\n}\n\nexport function createCell(\n table: Table,\n row: Row,\n column: Column,\n columnId: string\n): Cell {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n getMemoOptions(table.options, 'debugCells', 'cell.getContext')\n ),\n }\n\n table._features.forEach(feature => {\n feature.createCell?.(\n cell as Cell,\n column,\n row as Row,\n table\n )\n }, {})\n\n return cell as Cell\n}\n","import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport interface CoreColumn {\n /**\n * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n accessorFn?: AccessorFn\n /**\n * The original column def used to create the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columnDef: ColumnDef\n /**\n * The child column (if the column is a group column). Will be an empty array if the column is not a group column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columns: Column[]\n /**\n * The depth of the column (if grouped) relative to the root column def array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n depth: number\n /**\n * Returns the flattened array of this column and all child/grand-child columns for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getFlatColumns: () => Column[]\n /**\n * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getLeafColumns: () => Column[]\n /**\n * The resolved unique identifier for the column resolved in this priority:\n - A manual `id` property from the column def\n - The accessor key from the column def\n - The header string from the column def\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n id: string\n /**\n * The parent column for this column. Will be undefined if this is a root column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n parent?: Column\n}\n\nexport function createColumn(\n table: Table,\n columnDef: ColumnDef,\n depth: number,\n parent?: Column\n): Column {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey\n ? typeof String.prototype.replaceAll === 'function'\n ? accessorKey.replaceAll('.', '_')\n : accessorKey.replace(/\\./g, '_')\n : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')\n ),\n }\n\n for (const feature of table._features) {\n feature.createColumn?.(column as Column, table)\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column as Column\n}\n","import {\n RowData,\n Column,\n Header,\n HeaderGroup,\n Table,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nconst debug = 'debugHeaders'\n\nexport interface CoreHeaderGroup {\n depth: number\n headers: Header[]\n id: string\n}\n\nexport interface HeaderContext {\n /**\n * An instance of a column.\n */\n column: Column\n /**\n * An instance of a header.\n */\n header: Header\n /**\n * The table instance.\n */\n table: Table\n}\n\nexport interface CoreHeader {\n /**\n * The col-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n colSpan: number\n /**\n * The header's associated column object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n column: Column\n /**\n * The depth of the header, zero-indexed based.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n depth: number\n /**\n * Returns the rendering context (or props) for column-based components like headers, footers and filters.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getContext: () => HeaderContext\n /**\n * Returns the leaf headers hierarchically nested under this header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * The header's associated header group object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n headerGroup: HeaderGroup\n /**\n * The unique identifier for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n id: string\n /**\n * The index for the header within the header group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n index: number\n /**\n * A boolean denoting if the header is a placeholder header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n isPlaceholder: boolean\n /**\n * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n placeholderId?: string\n /**\n * The row-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n rowSpan: number\n /**\n * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n subHeaders: Header[]\n}\n\nexport interface HeadersInstance {\n /**\n * Returns all header groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightHeaderGroups: () => HeaderGroup[]\n\n /**\n * Returns the footer groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFooterGroups: () => HeaderGroup[]\n\n /**\n * Returns headers for all columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFlatHeaders: () => Header[]\n\n /**\n * Returns headers for all leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightLeafHeaders: () => Header[]\n}\n\n//\n\nfunction createHeader(\n table: Table,\n column: Column,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header {\n const id = options.id ?? column.id\n\n let header: CoreHeader = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header[] => {\n const leafHeaders: Header[] = []\n\n const recurseHeader = (h: CoreHeader) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n feature.createHeader?.(header as Header, table)\n })\n\n return header as Header\n}\n\nexport const Headers: TableFeature = {\n createTable: (table: Table): void => {\n // Header Groups\n\n table.getHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n getMemoOptions(table.options, debug, 'getHeaderGroups')\n )\n\n table.getCenterHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n getMemoOptions(table.options, debug, 'getCenterHeaderGroups')\n )\n\n table.getLeftHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')\n },\n getMemoOptions(table.options, debug, 'getLeftHeaderGroups')\n )\n\n table.getRightHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')\n },\n getMemoOptions(table.options, debug, 'getRightHeaderGroups')\n )\n\n // Footer Groups\n\n table.getFooterGroups = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getFooterGroups')\n )\n\n table.getLeftFooterGroups = memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getLeftFooterGroups')\n )\n\n table.getCenterFooterGroups = memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getCenterFooterGroups')\n )\n\n table.getRightFooterGroups = memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getRightFooterGroups')\n )\n\n // Flat Headers\n\n table.getFlatHeaders = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getFlatHeaders')\n )\n\n table.getLeftFlatHeaders = memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeftFlatHeaders')\n )\n\n table.getCenterFlatHeaders = memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getCenterFlatHeaders')\n )\n\n table.getRightFlatHeaders = memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getRightFlatHeaders')\n )\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getCenterLeafHeaders')\n )\n\n table.getLeftLeafHeaders = memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getLeftLeafHeaders')\n )\n\n table.getRightLeafHeaders = memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getRightLeafHeaders')\n )\n\n table.getLeafHeaders = memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeafHeaders')\n )\n },\n}\n\nexport function buildHeaderGroups(\n allColumns: Column[],\n columnsToGroup: Column[],\n table: Table,\n headerFamily?: 'center' | 'left' | 'right'\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (columns: Column[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Header[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader?.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup?.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter(d => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n","import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow {\n _getAllCellsByColumnId: () => Record>\n _uniqueValuesCache: Record\n _valuesCache: Record\n /**\n * The depth of the row (if nested or grouped) relative to the root row array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n depth: number\n /**\n * Returns all of the cells for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getallcells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getAllCells: () => Cell[]\n /**\n * Returns the leaf rows for the row, not including any parent rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getLeafRows: () => Row[]\n /**\n * Returns the parent row for the row, if it exists.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRow: () => Row | undefined\n /**\n * Returns the parent rows for the row, all the way up to a root row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRows: () => Row[]\n /**\n * Returns a unique array of values from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getuniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getUniqueValues: (columnId: string) => TValue[]\n /**\n * Returns the value from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getValue: (columnId: string) => TValue\n /**\n * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n id: string\n /**\n * The index of the row within its parent array (or the root data array).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n index: number\n /**\n * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#original)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n original: TData\n /**\n * An array of the original subRows as returned by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#originalsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n originalSubRows?: TData[]\n /**\n * If nested, this row's parent row id.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#parentid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n parentId?: string\n /**\n * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n renderValue: (columnId: string) => TValue\n /**\n * An array of subRows for the row as returned and created by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#subrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n subRows: Row[]\n}\n\nexport const createRow = (\n table: Table,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row[],\n parentId?: string\n): Row => {\n let row: CoreRow = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () =>\n row.parentId ? table.getRow(row.parentId, true) : undefined,\n getParentRows: () => {\n let parentRows: Row[] = []\n let currentRow = row\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n },\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row, column, column.id)\n })\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCells')\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce(\n (acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n feature?.createRow?.(row as Row, table)\n }\n\n return row as Row\n}\n","import { RowModel } from '..'\nimport { Column, RowData, Table, TableFeature } from '../types'\n\nexport interface FacetedColumn {\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n _getFacetedRowModel?: () => RowModel\n _getFacetedUniqueValues?: () => Map\n /**\n * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.\n * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedRowModel: () => RowModel\n /**\n * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedUniqueValues: () => Map\n}\n\nexport interface FacetedOptions {\n getFacetedMinMaxValues?: (\n table: Table,\n columnId: string\n ) => () => undefined | [number, number]\n getFacetedRowModel?: (\n table: Table,\n columnId: string\n ) => () => RowModel\n getFacetedUniqueValues?: (\n table: Table,\n columnId: string\n ) => () => Map\n}\n\n//\n\nexport const ColumnFaceting: TableFeature = {\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column._getFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, column.id)\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return column._getFacetedRowModel()\n }\n column._getFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, column.id)\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map()\n }\n\n return column._getFacetedUniqueValues()\n }\n column._getFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, column.id)\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined\n }\n\n return column._getFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn } from './features/ColumnFiltering'\n\nconst includesString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n const search = filterValue?.toString()?.toLowerCase()\n return Boolean(\n row\n .getValue(columnId)\n ?.toString()\n ?.toLowerCase()\n ?.includes(search)\n )\n}\n\nincludesString.autoRemove = (val: any) => testFalsey(val)\n\nconst includesStringSensitive: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return Boolean(\n row.getValue(columnId)?.toString()?.includes(filterValue)\n )\n}\n\nincludesStringSensitive.autoRemove = (val: any) => testFalsey(val)\n\nconst equalsString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return (\n row.getValue(columnId)?.toString()?.toLowerCase() ===\n filterValue?.toLowerCase()\n )\n}\n\nequalsString.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludes: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId)?.includes(filterValue)\n}\n\narrIncludes.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludesAll: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return !filterValue.some(\n val => !row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst arrIncludesSome: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return filterValue.some(val =>\n row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesSome.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst equals: FilterFn = (row, columnId: string, filterValue: unknown) => {\n return row.getValue(columnId) === filterValue\n}\n\nequals.autoRemove = (val: any) => testFalsey(val)\n\nconst weakEquals: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId) == filterValue\n}\n\nweakEquals.autoRemove = (val: any) => testFalsey(val)\n\nconst inNumberRange: FilterFn = (\n row,\n columnId: string,\n filterValue: [number, number]\n) => {\n let [min, max] = filterValue\n\n const rowValue = row.getValue(columnId)\n return rowValue >= min && rowValue <= max\n}\n\ninNumberRange.resolveFilterValue = (val: [any, any]) => {\n let [unsafeMin, unsafeMax] = val\n\n let parsedMin =\n typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin\n let parsedMax =\n typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax\n\n let min =\n unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax\n\n if (min > max) {\n const temp = min\n min = max\n max = temp\n }\n\n return [min, max] as const\n}\n\ninNumberRange.autoRemove = (val: any) =>\n testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]))\n\n// Export\n\nexport const filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange,\n}\n\nexport type BuiltInFilterFn = keyof typeof filterFns\n\n// Utils\n\nfunction testFalsey(val: any) {\n return val === undefined || val === null || val === ''\n}\n","import { RowModel } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n FilterFns,\n FilterMeta,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface ColumnFiltersTableState {\n columnFilters: ColumnFiltersState\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter {\n filterFn: FilterFn\n id: string\n resolvedValue: unknown\n}\n\nexport interface FilterFn {\n (\n row: Row,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n autoRemove?: ColumnFilterAutoRemoveTestFn\n resolveFilterValue?: TransformFilterValueFn\n}\n\nexport type TransformFilterValueFn = (\n value: any,\n column?: Column\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn = (\n value: any,\n column?: Column\n) => boolean\n\nexport type CustomFilterFns = Record<\n string,\n FilterFn\n>\n\nexport type FilterFnOption =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn\n\nexport interface ColumnFiltersColumnDef {\n /**\n * Enables/disables the **column** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilter?: boolean\n /**\n * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFn?: FilterFnOption\n}\n\nexport interface ColumnFiltersColumn {\n /**\n * Returns an automatically calculated filter function for the column based off of the columns first known value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns whether or not the column can be **column** filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getCanFilter: () => boolean\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterFn: () => FilterFn | undefined\n /**\n * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterIndex: () => number\n /**\n * Returns the current filter value for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterValue: () => unknown\n /**\n * Returns whether or not the column is currently filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getIsFiltered: () => boolean\n /**\n * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setFilterValue: (updater: Updater) => void\n}\n\nexport interface ColumnFiltersRow {\n /**\n * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFilters: Record\n /**\n * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFiltersMeta: Record\n}\n\ninterface ColumnFiltersOptionsBase {\n /**\n * Enables/disables **column** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilters?: boolean\n /**\n * Enables/disables all filtering for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableFilters?: boolean\n /**\n * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFromLeafRows?: boolean\n /**\n * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.\n * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.\n * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel?: (table: Table) => () => RowModel\n /**\n * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n manualFiltering?: boolean\n /**\n * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.\n\n * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n maxLeafRowFilterDepth?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n onColumnFiltersChange?: OnChangeFn\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record>\n }\n : {\n filterFns: Record>\n }\n\nexport interface ColumnFiltersOptions\n extends ColumnFiltersOptionsBase,\n ResolvedFilterFns {}\n\nexport interface ColumnFiltersInstance {\n _getFilteredRowModel?: () => RowModel\n /**\n * Returns the row model for the table after **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel: () => RowModel\n /**\n * Returns the row model for the table before any **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getPreFilteredRowModel: () => RowModel\n /**\n * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetColumnFilters: (defaultState?: boolean) => void\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnFilters` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setColumnFilters: (updater: Updater) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnFiltering: TableFeature = {\n getDefaultColumnDef: <\n TData extends RowData,\n >(): ColumnFiltersColumnDef => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): ColumnFiltersTableState => {\n return {\n columnFilters: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnFiltersOptions => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n } as ColumnFiltersOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return filterFns.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns.arrIncludes\n }\n\n return filterFns.weakEquals\n }\n column.getFilterFn = () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n : // @ts-ignore\n table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n }\n column.getCanFilter = () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getIsFiltered = () => column.getFilterIndex() > -1\n\n column.getFilterValue = () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value\n\n column.getFilterIndex = () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1\n\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\n const previousFilter = old?.find(d => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined\n )\n\n //\n if (\n shouldAutoRemoveFilter(filterFn as FilterFn, newFilter, column)\n ) {\n return old?.filter(d => d.id !== column.id) ?? []\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n }\n },\n\n createRow: (\n row: Row,\n _table: Table\n ): void => {\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n },\n\n createTable: (table: Table): void => {\n table.setColumnFilters = (updater: Updater) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n }\n\n table.resetColumnFilters = defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n }\n\n table.getPreFilteredRowModel = () => table.getCoreRowModel()\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n }\n },\n}\n\nexport function shouldAutoRemoveFilter(\n filterFn?: FilterFn,\n value?: any,\n column?: Column\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n","import { AggregationFn } from './features/ColumnGrouping'\nimport { isNumberArray } from './utils'\n\nconst sum: AggregationFn = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId)\n return sum + (typeof nextValue === 'number' ? nextValue : 0)\n }, 0)\n}\n\nconst min: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n\n if (\n value != null &&\n (min! > value || (min === undefined && value >= value))\n ) {\n min = value\n }\n })\n\n return min\n}\n\nconst max: AggregationFn = (columnId, _leafRows, childRows) => {\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (\n value != null &&\n (max! < value || (max === undefined && value >= value))\n ) {\n max = value\n }\n })\n\n return max\n}\n\nconst extent: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value\n } else {\n if (min > value) min = value\n if (max! < value) max = value\n }\n }\n })\n\n return [min, max]\n}\n\nconst mean: AggregationFn = (columnId, leafRows) => {\n let count = 0\n let sum = 0\n\n leafRows.forEach(row => {\n let value = row.getValue(columnId)\n if (value != null && (value = +value) >= value) {\n ++count, (sum += value)\n }\n })\n\n if (count) return sum / count\n\n return\n}\n\nconst median: AggregationFn = (columnId, leafRows) => {\n if (!leafRows.length) {\n return\n }\n\n const values = leafRows.map(row => row.getValue(columnId))\n if (!isNumberArray(values)) {\n return\n }\n if (values.length === 1) {\n return values[0]\n }\n\n const mid = Math.floor(values.length / 2)\n const nums = values.sort((a, b) => a - b)\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1]! + nums[mid]!) / 2\n}\n\nconst unique: AggregationFn = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values())\n}\n\nconst uniqueCount: AggregationFn = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size\n}\n\nconst count: AggregationFn = (_columnId, leafRows) => {\n return leafRows.length\n}\n\nexport const aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count,\n}\n\nexport type BuiltInAggregationFn = keyof typeof aggregationFns\n","import { RowModel } from '..'\nimport { BuiltInAggregationFn, aggregationFns } from '../aggregationFns'\nimport {\n AggregationFns,\n Cell,\n Column,\n ColumnDefTemplate,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type GroupingState = string[]\n\nexport interface GroupingTableState {\n grouping: GroupingState\n}\n\nexport type AggregationFn = (\n columnId: string,\n leafRows: Row[],\n childRows: Row[]\n) => any\n\nexport type CustomAggregationFns = Record>\n\nexport type AggregationFnOption =\n | 'auto'\n | keyof AggregationFns\n | BuiltInAggregationFn\n | AggregationFn\n\nexport interface GroupingColumnDef {\n /**\n * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregatedCell?: ColumnDefTemplate<\n ReturnType['getContext']>\n >\n /**\n * The resolved aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregationFn?: AggregationFnOption\n /**\n * Enables/disables grouping for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue?: (row: TData) => any\n}\n\nexport interface GroupingColumn {\n /**\n * Returns the aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAggregationFn: () => AggregationFn | undefined\n /**\n * Returns the automatically inferred aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAutoAggregationFn: () => AggregationFn | undefined\n /**\n * Returns whether or not the column can be grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getCanGroup: () => boolean\n /**\n * Returns the index of the column in the grouping state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedIndex: () => number\n /**\n * Returns whether or not the column is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getToggleGroupingHandler: () => () => void\n /**\n * Toggles the grouping state of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n toggleGrouping: () => void\n}\n\nexport interface GroupingRow {\n _groupingValuesCache: Record\n /**\n * Returns the grouping value for any row and column (including leaf rows).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue: (columnId: string) => unknown\n /**\n * Returns whether or not the row is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * If this row is grouped, this is the id of the column that this row is grouped by.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingColumnId?: string\n /**\n * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingValue?: unknown\n}\n\nexport interface GroupingCell {\n /**\n * Returns whether or not the cell is currently aggregated.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsAggregated: () => boolean\n /**\n * Returns whether or not the cell is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns whether or not the cell is currently a placeholder cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsPlaceholder: () => boolean\n}\n\nexport interface ColumnDefaultOptions {\n enableGrouping: boolean\n onGroupingChange: OnChangeFn\n}\n\ninterface GroupingOptionsBase {\n /**\n * Enables/disables grouping for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Returns the row model after grouping has taken place, but no further.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel?: (table: Table) => () => RowModel\n /**\n * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupedColumnMode?: false | 'reorder' | 'remove'\n /**\n * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n manualGrouping?: boolean\n /**\n * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n onGroupingChange?: OnChangeFn\n}\n\ntype ResolvedAggregationFns = keyof AggregationFns extends never\n ? {\n aggregationFns?: Record>\n }\n : {\n aggregationFns: Record>\n }\n\nexport interface GroupingOptions\n extends GroupingOptionsBase,\n ResolvedAggregationFns {}\n\nexport type GroupingColumnMode = false | 'reorder' | 'remove'\n\nexport interface GroupingInstance {\n _getGroupedRowModel?: () => RowModel\n /**\n * Returns the row model for the table after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel: () => RowModel\n /**\n * Returns the row model for the table before any grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getPreGroupedRowModel: () => RowModel\n /**\n * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n resetGrouping: (defaultState?: boolean) => void\n /**\n * Updates the grouping state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n setGrouping: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnGrouping: TableFeature = {\n getDefaultColumnDef: (): GroupingColumnDef<\n TData,\n unknown\n > => {\n return {\n aggregatedCell: props => (props.getValue() as any)?.toString?.() ?? null,\n aggregationFn: 'auto',\n }\n },\n\n getInitialState: (state): GroupingTableState => {\n return {\n grouping: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GroupingOptions => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder',\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleGrouping = () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old?.includes(column.id)) {\n return old.filter(d => d !== column.id)\n }\n\n return [...(old ?? []), column.id]\n })\n }\n\n column.getCanGroup = () => {\n return (\n (column.columnDef.enableGrouping ?? true) &&\n (table.options.enableGrouping ?? true) &&\n (!!column.accessorFn || !!column.columnDef.getGroupingValue)\n )\n }\n\n column.getIsGrouped = () => {\n return table.getState().grouping?.includes(column.id)\n }\n\n column.getGroupedIndex = () => table.getState().grouping?.indexOf(column.id)\n\n column.getToggleGroupingHandler = () => {\n const canGroup = column.getCanGroup()\n\n return () => {\n if (!canGroup) return\n column.toggleGrouping()\n }\n }\n column.getAutoAggregationFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent\n }\n }\n column.getAggregationFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column.getAutoAggregationFn()\n : table.options.aggregationFns?.[\n column.columnDef.aggregationFn as string\n ] ??\n aggregationFns[\n column.columnDef.aggregationFn as BuiltInAggregationFn\n ]\n }\n },\n\n createTable: (table: Table): void => {\n table.setGrouping = updater => table.options.onGroupingChange?.(updater)\n\n table.resetGrouping = defaultState => {\n table.setGrouping(defaultState ? [] : table.initialState?.grouping ?? [])\n }\n\n table.getPreGroupedRowModel = () => table.getFilteredRowModel()\n table.getGroupedRowModel = () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table)\n }\n\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._getGroupedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getIsGrouped = () => !!row.groupingColumnId\n row.getGroupingValue = columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original\n )\n\n return row._groupingValuesCache[columnId]\n }\n row._groupingValuesCache = {}\n },\n\n createCell: (\n cell: Cell,\n column: Column,\n row: Row,\n table: Table\n ): void => {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n cell.getIsGrouped = () =>\n column.getIsGrouped() && column.id === row.groupingColumnId\n cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped()\n cell.getIsAggregated = () =>\n !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length\n },\n}\n\nexport function orderColumns(\n leafColumns: Column[],\n grouping: string[],\n groupedColumnMode?: GroupingColumnMode\n) {\n if (!grouping?.length || !groupedColumnMode) {\n return leafColumns\n }\n\n const nonGroupingColumns = leafColumns.filter(\n col => !grouping.includes(col.id)\n )\n\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns\n }\n\n const groupingColumns = grouping\n .map(g => leafColumns.find(col => col.id === g)!)\n .filter(Boolean)\n\n return [...groupingColumns, ...nonGroupingColumns]\n}\n","import { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nimport {\n Column,\n OnChangeFn,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\n\nimport { orderColumns } from './ColumnGrouping'\nimport { ColumnPinningPosition, _getVisibleLeafColumns } from '..'\n\nexport interface ColumnOrderTableState {\n columnOrder: ColumnOrderState\n}\n\nexport type ColumnOrderState = string[]\n\nexport interface ColumnOrderOptions {\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n onColumnOrderChange?: OnChangeFn\n}\n\nexport interface ColumnOrderColumn {\n /**\n * Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIndex: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns `true` if the column is the first column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the first in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getisfirstcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsFirstColumn: (position?: ColumnPinningPosition | 'center') => boolean\n /**\n * Returns `true` if the column is the last column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the last in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getislastcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsLastColumn: (position?: ColumnPinningPosition | 'center') => boolean\n}\n\nexport interface ColumnOrderDefaultOptions {\n onColumnOrderChange: OnChangeFn\n}\n\nexport interface ColumnOrderInstance {\n _getOrderColumnsFn: () => (\n columns: Column[]\n ) => Column[]\n /**\n * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n resetColumnOrder: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnOrder` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n setColumnOrder: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnOrdering: TableFeature = {\n getInitialState: (state): ColumnOrderTableState => {\n return {\n columnOrder: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnOrderDefaultOptions => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getIndex = memo(\n position => [_getVisibleLeafColumns(table, position)],\n columns => columns.findIndex(d => d.id === column.id),\n getMemoOptions(table.options, 'debugColumns', 'getIndex')\n )\n column.getIsFirstColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[0]?.id === column.id\n }\n column.getIsLastColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[columns.length - 1]?.id === column.id\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnOrder = updater =>\n table.options.onColumnOrderChange?.(updater)\n table.resetColumnOrder = defaultState => {\n table.setColumnOrder(\n defaultState ? [] : table.initialState.columnOrder ?? []\n )\n }\n table._getOrderColumnsFn = memo(\n () => [\n table.getState().columnOrder,\n table.getState().grouping,\n table.options.groupedColumnMode,\n ],\n (columnOrder, grouping, groupedColumnMode) =>\n (columns: Column[]) => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns: Column[] = []\n\n // If there is no order, return the normal columns\n if (!columnOrder?.length) {\n orderedColumns = columns\n } else {\n const columnOrderCopy = [...columnOrder]\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns]\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift()\n const foundIndex = columnsCopy.findIndex(\n d => d.id === targetColumnId\n )\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy]\n }\n\n return orderColumns(orderedColumns, grouping, groupedColumnMode)\n },\n getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')\n )\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Column,\n Row,\n Cell,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type ColumnPinningPosition = false | 'left' | 'right'\n\nexport interface ColumnPinningState {\n left?: string[]\n right?: string[]\n}\n\nexport interface ColumnPinningTableState {\n columnPinning: ColumnPinningState\n}\n\nexport interface ColumnPinningOptions {\n /**\n * Enables/disables column pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enableColumnPinning?: boolean\n /**\n * @deprecated Use `enableColumnPinning` or `enableRowPinning` instead.\n * Enables/disables all pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange)\n */\n onColumnPinningChange?: OnChangeFn\n}\n\nexport interface ColumnPinningDefaultOptions {\n onColumnPinningChange: OnChangeFn\n}\n\nexport interface ColumnPinningColumnDef {\n /**\n * Enables/disables column pinning for this column. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n}\n\nexport interface ColumnPinningColumn {\n /**\n * Returns whether or not the column can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcanpin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the column. (`'left'`, `'right'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getispinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsPinned: () => ColumnPinningPosition\n /**\n * Returns the numeric pinned index of the column within a pinned column group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getpinnedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a column to the `'left'` or `'right'`, or unpins the column to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#pin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n pin: (position: ColumnPinningPosition) => void\n}\n\nexport interface ColumnPinningRow {\n /**\n * Returns all center pinned (unpinned) leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcentervisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterVisibleCells: () => Cell[]\n /**\n * Returns all left pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftVisibleCells: () => Cell[]\n /**\n * Returns all right pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightVisibleCells: () => Cell[]\n}\n\nexport interface ColumnPinningInstance {\n /**\n * Returns all center pinned (unpinned) leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcenterleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterLeafColumns: () => Column[]\n /**\n * Returns whether or not any columns are pinned. Optionally specify to only check for pinned columns in either the `left` or `right` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getissomecolumnspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean\n /**\n * Returns all left pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftLeafColumns: () => Column[]\n /**\n * Returns all right pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightLeafColumns: () => Column[]\n /**\n * Resets the **columnPinning** state to `initialState.columnPinning`, or `true` can be passed to force a default blank state reset to `{ left: [], right: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#resetcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n resetColumnPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#setcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n setColumnPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultColumnPinningState = (): ColumnPinningState => ({\n left: [],\n right: [],\n})\n\nexport const ColumnPinning: TableFeature = {\n getInitialState: (state): ColumnPinningTableState => {\n return {\n columnPinning: getDefaultColumnPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnPinningDefaultOptions => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.pin = position => {\n const columnIds = column\n .getLeafColumns()\n .map(d => d.id)\n .filter(Boolean) as string[]\n\n table.setColumnPinning(old => {\n if (position === 'right') {\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: [\n ...(old?.right ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n }\n }\n\n if (position === 'left') {\n return {\n left: [\n ...(old?.left ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n }\n\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n })\n }\n\n column.getCanPin = () => {\n const leafColumns = column.getLeafColumns()\n\n return leafColumns.some(\n d =>\n (d.columnDef.enablePinning ?? true) &&\n (table.options.enableColumnPinning ??\n table.options.enablePinning ??\n true)\n )\n }\n\n column.getIsPinned = () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id)\n\n const { left, right } = table.getState().columnPinning\n\n const isLeft = leafColumnIds.some(d => left?.includes(d))\n const isRight = leafColumnIds.some(d => right?.includes(d))\n\n return isLeft ? 'left' : isRight ? 'right' : false\n }\n\n column.getPinnedIndex = () => {\n const position = column.getIsPinned()\n\n return position\n ? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1\n : 0\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getCenterVisibleCells = memo(\n () => [\n row._getAllVisibleCells(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allCells, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allCells.filter(d => !leftAndRight.includes(d.column.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')\n )\n row.getLeftVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.left],\n (allCells, left) => {\n const cells = (left ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'left' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')\n )\n row.getRightVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.right],\n (allCells, right) => {\n const cells = (right ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'right' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n table.setColumnPinning = updater =>\n table.options.onColumnPinningChange?.(updater)\n\n table.resetColumnPinning = defaultState =>\n table.setColumnPinning(\n defaultState\n ? getDefaultColumnPinningState()\n : table.initialState?.columnPinning ?? getDefaultColumnPinningState()\n )\n\n table.getIsSomeColumnsPinned = position => {\n const pinningState = table.getState().columnPinning\n\n if (!position) {\n return Boolean(pinningState.left?.length || pinningState.right?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table.getLeftLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.left],\n (allColumns, left) => {\n return (left ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')\n )\n\n table.getRightLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.right],\n (allColumns, right) => {\n return (right ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')\n )\n\n table.getCenterLeafColumns = memo(\n () => [\n table.getAllLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allColumns.filter(d => !leftAndRight.includes(d.id))\n },\n getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')\n )\n },\n}\n","export function safelyAccessDocument(_document?: Document): Document | null {\n return _document || (typeof document !== 'undefined' ? document : null)\n}\n\nexport function safelyAccessDocumentEvent(event: Event): Document | null {\n return !!event &&\n !!event.target &&\n typeof event.target === 'object' &&\n 'ownerDocument' in event.target\n ? (event.target.ownerDocument as Document | null)\n : null\n}\n","import { _getVisibleLeafColumns } from '..'\nimport {\n RowData,\n Column,\n Header,\n OnChangeFn,\n Table,\n Updater,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\nimport { ColumnPinningPosition } from './ColumnPinning'\nimport { safelyAccessDocument } from '../utils/document'\n\n//\n\nexport interface ColumnSizingTableState {\n columnSizing: ColumnSizingState\n columnSizingInfo: ColumnSizingInfoState\n}\n\nexport type ColumnSizingState = Record\n\nexport interface ColumnSizingInfoState {\n columnSizingStart: [string, number][]\n deltaOffset: null | number\n deltaPercentage: null | number\n isResizingColumn: false | string\n startOffset: null | number\n startSize: null | number\n}\n\nexport type ColumnResizeMode = 'onChange' | 'onEnd'\n\nexport type ColumnResizeDirection = 'ltr' | 'rtl'\n\nexport interface ColumnSizingOptions {\n /**\n * Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnresizemode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeMode?: ColumnResizeMode\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enablecolumnresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableColumnResizing?: boolean\n /**\n * Enables or disables right-to-left support for resizing the column. defaults to 'ltr'.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnResizeDirection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeDirection?: ColumnResizeDirection\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingChange?: OnChangeFn\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizingInfo` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizingInfo` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizinginfochange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingInfoChange?: OnChangeFn\n}\n\nexport type ColumnSizingDefaultOptions = Pick<\n ColumnSizingOptions,\n | 'columnResizeMode'\n | 'onColumnSizingChange'\n | 'onColumnSizingInfoChange'\n | 'columnResizeDirection'\n>\n\nexport interface ColumnSizingInstance {\n /**\n * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcentertotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCenterTotalSize: () => number\n /**\n * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getlefttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getLeftTotalSize: () => number\n /**\n * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getrighttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getRightTotalSize: () => number\n /**\n * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#gettotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getTotalSize: () => number\n /**\n * Resets column sizing to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetColumnSizing: (defaultState?: boolean) => void\n /**\n * Resets column sizing info to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetheadersizeinfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetHeaderSizeInfo: (defaultState?: boolean) => void\n /**\n * Sets the column sizing state using an updater function or a value. This will trigger the underlying `onColumnSizingChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizing: (updater: Updater) => void\n /**\n * Sets the column sizing info state using an updater function or a value. This will trigger the underlying `onColumnSizingInfoChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizinginfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizingInfo: (updater: Updater) => void\n}\n\nexport interface ColumnSizingColumnDef {\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableResizing?: boolean\n /**\n * The maximum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n maxSize?: number\n /**\n * The minimum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n minSize?: number\n /**\n * The desired size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n size?: number\n}\n\nexport interface ColumnSizingColumn {\n /**\n * Returns `true` if the column can be resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcanresize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCanResize: () => boolean\n /**\n * Returns `true` if the column is currently being resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getisresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getIsResizing: () => boolean\n /**\n * Returns the current size of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column.\n */\n getAfter: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Resets the column to its initial size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetSize: () => void\n}\n\nexport interface ColumnSizingHeader {\n /**\n * Returns an event handler function that can be used to resize the header. It can be used as an:\n * - `onMouseDown` handler\n * - `onTouchStart` handler\n *\n * The dragging and release events are automatically handled for you.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getresizehandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getResizeHandler: (context?: Document) => (event: unknown) => void\n /**\n * Returns the current size of the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition) => number\n}\n\n//\n\nexport const defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n}\n\nconst getDefaultColumnSizingInfoState = (): ColumnSizingInfoState => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: [],\n})\n\nexport const ColumnSizing: TableFeature = {\n getDefaultColumnDef: (): ColumnSizingColumnDef => {\n return defaultColumnSizing\n },\n getInitialState: (state): ColumnSizingTableState => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnSizingDefaultOptions => {\n return {\n columnResizeMode: 'onEnd',\n columnResizeDirection: 'ltr',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getSize = () => {\n const columnSize = table.getState().columnSizing[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultColumnSizing.minSize,\n columnSize ?? column.columnDef.size ?? defaultColumnSizing.size\n ),\n column.columnDef.maxSize ?? defaultColumnSizing.maxSize\n )\n }\n\n column.getStart = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(0, column.getIndex(position))\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getStart')\n )\n\n column.getAfter = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(column.getIndex(position) + 1)\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getAfter')\n )\n\n column.resetSize = () => {\n table.setColumnSizing(({ [column.id]: _, ...rest }) => {\n return rest\n })\n }\n column.getCanResize = () => {\n return (\n (column.columnDef.enableResizing ?? true) &&\n (table.options.enableColumnResizing ?? true)\n )\n }\n column.getIsResizing = () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id\n }\n },\n\n createHeader: (\n header: Header,\n table: Table\n ): void => {\n header.getSize = () => {\n let sum = 0\n\n const recurse = (header: Header) => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse)\n } else {\n sum += header.column.getSize() ?? 0\n }\n }\n\n recurse(header)\n\n return sum\n }\n header.getStart = () => {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup.headers[header.index - 1]!\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()\n }\n\n return 0\n }\n header.getResizeHandler = _contextDocument => {\n const column = table.getColumn(header.column.id)\n const canResize = column?.getCanResize()\n\n return (e: unknown) => {\n if (!column || !canResize) {\n return\n }\n\n ;(e as any).persist?.()\n\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return\n }\n }\n\n const startSize = header.getSize()\n\n const columnSizingStart: [string, number][] = header\n ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()])\n : [[column.id, column.getSize()]]\n\n const clientX = isTouchStartEvent(e)\n ? Math.round(e.touches[0]!.clientX)\n : (e as MouseEvent).clientX\n\n const newColumnSizing: ColumnSizingState = {}\n\n const updateOffset = (\n eventType: 'move' | 'end',\n clientXPos?: number\n ) => {\n if (typeof clientXPos !== 'number') {\n return\n }\n\n table.setColumnSizingInfo(old => {\n const deltaDirection =\n table.options.columnResizeDirection === 'rtl' ? -1 : 1\n const deltaOffset =\n (clientXPos - (old?.startOffset ?? 0)) * deltaDirection\n const deltaPercentage = Math.max(\n deltaOffset / (old?.startSize ?? 0),\n -0.999999\n )\n\n old.columnSizingStart.forEach(([columnId, headerSize]) => {\n newColumnSizing[columnId] =\n Math.round(\n Math.max(headerSize + headerSize * deltaPercentage, 0) * 100\n ) / 100\n })\n\n return {\n ...old,\n deltaOffset,\n deltaPercentage,\n }\n })\n\n if (\n table.options.columnResizeMode === 'onChange' ||\n eventType === 'end'\n ) {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing,\n }))\n }\n }\n\n const onMove = (clientXPos?: number) => updateOffset('move', clientXPos)\n\n const onEnd = (clientXPos?: number) => {\n updateOffset('end', clientXPos)\n\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: [],\n }))\n }\n\n const contextDocument = safelyAccessDocument(_contextDocument)\n\n const mouseEvents = {\n moveHandler: (e: MouseEvent) => onMove(e.clientX),\n upHandler: (e: MouseEvent) => {\n contextDocument?.removeEventListener(\n 'mousemove',\n mouseEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'mouseup',\n mouseEvents.upHandler\n )\n onEnd(e.clientX)\n },\n }\n\n const touchEvents = {\n moveHandler: (e: TouchEvent) => {\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onMove(e.touches[0]!.clientX)\n return false\n },\n upHandler: (e: TouchEvent) => {\n contextDocument?.removeEventListener(\n 'touchmove',\n touchEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'touchend',\n touchEvents.upHandler\n )\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onEnd(e.touches[0]?.clientX)\n },\n }\n\n const passiveIfSupported = passiveEventSupported()\n ? { passive: false }\n : false\n\n if (isTouchStartEvent(e)) {\n contextDocument?.addEventListener(\n 'touchmove',\n touchEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'touchend',\n touchEvents.upHandler,\n passiveIfSupported\n )\n } else {\n contextDocument?.addEventListener(\n 'mousemove',\n mouseEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'mouseup',\n mouseEvents.upHandler,\n passiveIfSupported\n )\n }\n\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id,\n }))\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnSizing = updater =>\n table.options.onColumnSizingChange?.(updater)\n table.setColumnSizingInfo = updater =>\n table.options.onColumnSizingInfoChange?.(updater)\n table.resetColumnSizing = defaultState => {\n table.setColumnSizing(\n defaultState ? {} : table.initialState.columnSizing ?? {}\n )\n }\n table.resetHeaderSizeInfo = defaultState => {\n table.setColumnSizingInfo(\n defaultState\n ? getDefaultColumnSizingInfoState()\n : table.initialState.columnSizingInfo ??\n getDefaultColumnSizingInfoState()\n )\n }\n table.getTotalSize = () =>\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getLeftTotalSize = () =>\n table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getCenterTotalSize = () =>\n table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getRightTotalSize = () =>\n table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n },\n}\n\nlet passiveSupported: boolean | null = null\nexport function passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported\n\n let supported = false\n try {\n const options = {\n get passive() {\n supported = true\n return false\n },\n }\n\n const noop = () => {}\n\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop)\n } catch (err) {\n supported = false\n }\n passiveSupported = supported\n return passiveSupported\n}\n\nfunction isTouchStartEvent(e: unknown): e is TouchEvent {\n return (e as TouchEvent).type === 'touchstart'\n}\n","import { ColumnPinningPosition } from '..'\nimport {\n Cell,\n Column,\n OnChangeFn,\n Table,\n Updater,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type VisibilityState = Record\n\nexport interface VisibilityTableState {\n columnVisibility: VisibilityState\n}\n\nexport interface VisibilityOptions {\n /**\n * Whether to enable column hiding. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#enablehiding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n enableHiding?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n onColumnVisibilityChange?: OnChangeFn\n}\n\nexport type VisibilityDefaultOptions = Pick<\n VisibilityOptions,\n 'onColumnVisibilityChange'\n>\n\nexport interface VisibilityInstance {\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCenterVisibleLeafColumns: () => Column[]\n /**\n * Returns whether all columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsAllColumnsVisible: () => boolean\n /**\n * Returns whether any columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsSomeColumnsVisible: () => boolean\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getLeftVisibleLeafColumns: () => Column[]\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getRightVisibleLeafColumns: () => Column[]\n /**\n * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void\n /**\n * Returns a flat array of columns that are visible, including parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleFlatColumns: () => Column[]\n /**\n * Returns a flat array of leaf-node columns that are visible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleLeafColumns: () => Column[]\n /**\n * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n resetColumnVisibility: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnVisibility` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n setColumnVisibility: (updater: Updater) => void\n /**\n * Toggles the visibility of all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleAllColumnsVisible: (value?: boolean) => void\n}\n\nexport interface VisibilityColumnDef {\n enableHiding?: boolean\n}\n\nexport interface VisibilityRow {\n _getAllVisibleCells: () => Cell[]\n /**\n * Returns an array of cells that account for column visibility for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleCells: () => Cell[]\n}\n\nexport interface VisibilityColumn {\n /**\n * Returns whether the column can be hidden\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCanHide: () => boolean\n /**\n * Returns whether the column is visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsVisible: () => boolean\n /**\n * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleVisibilityHandler: () => (event: unknown) => void\n /**\n * Toggles the visibility of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleVisibility: (value?: boolean) => void\n}\n\n//\n\nexport const ColumnVisibility: TableFeature = {\n getInitialState: (state): VisibilityTableState => {\n return {\n columnVisibility: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): VisibilityDefaultOptions => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleVisibility = value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value ?? !column.getIsVisible(),\n }))\n }\n }\n column.getIsVisible = () => {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some(c => c.getIsVisible())\n : table.getState().columnVisibility?.[column.id]) ?? true\n )\n }\n\n column.getCanHide = () => {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (table.options.enableHiding ?? true)\n )\n }\n column.getToggleVisibilityHandler = () => {\n return (e: unknown) => {\n column.toggleVisibility?.(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row._getAllVisibleCells = memo(\n () => [row.getAllCells(), table.getState().columnVisibility],\n cells => {\n return cells.filter(cell => cell.column.getIsVisible())\n },\n getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')\n )\n row.getVisibleCells = memo(\n () => [\n row.getLeftVisibleCells(),\n row.getCenterVisibleCells(),\n row.getRightVisibleCells(),\n ],\n (left, center, right) => [...left, ...center, ...right],\n getMemoOptions(table.options, 'debugRows', 'getVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n const makeVisibleColumnsMethod = (\n key: string,\n getColumns: () => Column[]\n ): (() => Column[]) => {\n return memo(\n () => [\n getColumns(),\n getColumns()\n .filter(d => d.getIsVisible())\n .map(d => d.id)\n .join('_'),\n ],\n columns => {\n return columns.filter(d => d.getIsVisible?.())\n },\n getMemoOptions(table.options, 'debugColumns', key)\n )\n }\n\n table.getVisibleFlatColumns = makeVisibleColumnsMethod(\n 'getVisibleFlatColumns',\n () => table.getAllFlatColumns()\n )\n table.getVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getVisibleLeafColumns',\n () => table.getAllLeafColumns()\n )\n table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getLeftVisibleLeafColumns',\n () => table.getLeftLeafColumns()\n )\n table.getRightVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getRightVisibleLeafColumns',\n () => table.getRightLeafColumns()\n )\n table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getCenterVisibleLeafColumns',\n () => table.getCenterLeafColumns()\n )\n\n table.setColumnVisibility = updater =>\n table.options.onColumnVisibilityChange?.(updater)\n\n table.resetColumnVisibility = defaultState => {\n table.setColumnVisibility(\n defaultState ? {} : table.initialState.columnVisibility ?? {}\n )\n }\n\n table.toggleAllColumnsVisible = value => {\n value = value ?? !table.getIsAllColumnsVisible()\n\n table.setColumnVisibility(\n table.getAllLeafColumns().reduce(\n (obj, column) => ({\n ...obj,\n [column.id]: !value ? !column.getCanHide?.() : value,\n }),\n {}\n )\n )\n }\n\n table.getIsAllColumnsVisible = () =>\n !table.getAllLeafColumns().some(column => !column.getIsVisible?.())\n\n table.getIsSomeColumnsVisible = () =>\n table.getAllLeafColumns().some(column => column.getIsVisible?.())\n\n table.getToggleAllColumnsVisibilityHandler = () => {\n return (e: unknown) => {\n table.toggleAllColumnsVisible(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nexport function _getVisibleLeafColumns(\n table: Table,\n position?: ColumnPinningPosition | 'center'\n) {\n return !position\n ? table.getVisibleLeafColumns()\n : position === 'center'\n ? table.getCenterVisibleLeafColumns()\n : position === 'left'\n ? table.getLeftVisibleLeafColumns()\n : table.getRightVisibleLeafColumns()\n}\n","import { RowModel } from '..'\nimport { Table, RowData, TableFeature } from '../types'\n\nexport interface GlobalFacetingInstance {\n _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]\n _getGlobalFacetedRowModel?: () => RowModel\n _getGlobalFacetedUniqueValues?: () => Map\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model for the table after **global** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedRowModel: () => RowModel\n /**\n * Returns the faceted unique values for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedUniqueValues: () => Map\n}\n\n//\n\nexport const GlobalFaceting: TableFeature = {\n createTable: (table: Table): void => {\n table._getGlobalFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, '__global__')\n\n table.getGlobalFacetedRowModel = () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getGlobalFacetedRowModel()\n }\n\n table._getGlobalFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, '__global__')\n table.getGlobalFacetedUniqueValues = () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map()\n }\n\n return table._getGlobalFacetedUniqueValues()\n }\n\n table._getGlobalFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, '__global__')\n table.getGlobalFacetedMinMaxValues = () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return\n }\n\n return table._getGlobalFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn, FilterFnOption } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n OnChangeFn,\n Table,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport interface GlobalFilterTableState {\n globalFilter: any\n}\n\nexport interface GlobalFilterColumnDef {\n /**\n * Enables/disables the **global** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n}\n\nexport interface GlobalFilterColumn {\n /**\n * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getCanGlobalFilter: () => boolean\n}\n\nexport interface GlobalFilterOptions {\n /**\n * Enables/disables **global** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n /**\n * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering.\n *\n * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcolumncanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getColumnCanGlobalFilter?: (column: Column) => boolean\n /**\n * The filter function to use for global filtering.\n * - A `string` referencing a built-in filter function\n * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option\n * - A custom filter function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#globalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n globalFilterFn?: FilterFnOption\n /**\n * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#onglobalfilterchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n onGlobalFilterChange?: OnChangeFn\n}\n\nexport interface GlobalFilterInstance {\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalFilterFn: () => FilterFn | undefined\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const GlobalFiltering: TableFeature = {\n getInitialState: (state): GlobalFilterTableState => {\n return {\n globalFilter: undefined,\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GlobalFilterOptions => {\n return {\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n const value = table\n .getCoreRowModel()\n .flatRows[0]?._getAllCellsByColumnId()\n [column.id]?.getValue()\n\n return typeof value === 'string' || typeof value === 'number'\n },\n } as GlobalFilterOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getCanGlobalFilter = () => {\n return (\n (column.columnDef.enableGlobalFilter ?? true) &&\n (table.options.enableGlobalFilter ?? true) &&\n (table.options.enableFilters ?? true) &&\n (table.options.getColumnCanGlobalFilter?.(column) ?? true) &&\n !!column.accessorFn\n )\n }\n },\n\n createTable: (table: Table): void => {\n table.getGlobalAutoFilterFn = () => {\n return filterFns.includesString\n }\n\n table.getGlobalFilterFn = () => {\n const { globalFilterFn: globalFilterFn } = table.options\n\n return isFunction(globalFilterFn)\n ? globalFilterFn\n : globalFilterFn === 'auto'\n ? table.getGlobalAutoFilterFn()\n : table.options.filterFns?.[globalFilterFn as string] ??\n filterFns[globalFilterFn as BuiltInFilterFn]\n }\n\n table.setGlobalFilter = updater => {\n table.options.onGlobalFilterChange?.(updater)\n }\n\n table.resetGlobalFilter = defaultState => {\n table.setGlobalFilter(\n defaultState ? undefined : table.initialState.globalFilter\n )\n }\n },\n}\n","import { RowModel } from '..'\nimport {\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { makeStateUpdater } from '../utils'\n\nexport type ExpandedStateList = Record\nexport type ExpandedState = true | Record\nexport interface ExpandedTableState {\n expanded: ExpandedState\n}\n\nexport interface ExpandedRow {\n /**\n * Returns whether the row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanExpand: () => boolean\n /**\n * Returns whether all parent rows of the row are expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallparentsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllParentsExpanded: () => boolean\n /**\n * Returns whether the row is expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsExpanded: () => boolean\n /**\n * Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleExpandedHandler: () => () => void\n /**\n * Toggles the expanded state (or sets it if `expanded` is provided) for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleExpanded: (expanded?: boolean) => void\n}\n\nexport interface ExpandedOptions {\n /**\n * Enable this setting to automatically reset the expanded state of the table when expanding state changes.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#autoresetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n autoResetExpanded?: boolean\n /**\n * Enable/disable expanding for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#enableexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n enableExpanding?: boolean\n /**\n * This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported `getExpandedRowModel` function to get the expanded row model or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel?: (table: Table) => () => RowModel\n /**\n * If provided, allows you to override the default behavior of determining whether a row is currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisrowexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsRowExpanded?: (row: Row) => boolean\n /**\n * If provided, allows you to override the default behavior of determining whether a row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getrowcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getRowCanExpand?: (row: Row) => boolean\n /**\n * Enables manual row expansion. If this is set to `true`, `getExpandedRowModel` will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#manualexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n manualExpanding?: boolean\n /**\n * This function is called when the `expanded` table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the `tableOptions.state.expanded` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#onexpandedchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n onExpandedChange?: OnChangeFn\n /**\n * If `true` expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages). If `false` expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#paginateexpandedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n paginateExpandedRows?: boolean\n}\n\nexport interface ExpandedInstance {\n _autoResetExpanded: () => void\n _getExpandedRowModel?: () => RowModel\n /**\n * Returns whether there are any rows that can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcansomerowsexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanSomeRowsExpand: () => boolean\n /**\n * Returns the maximum depth of the expanded rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandeddepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedDepth: () => number\n /**\n * Returns the row model after expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel: () => RowModel\n /**\n * Returns whether all rows are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllRowsExpanded: () => boolean\n /**\n * Returns whether there are any rows that are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getissomerowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsSomeRowsExpanded: () => boolean\n /**\n * Returns the row model before expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getpreexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getPreExpandedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleallrowsexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleAllRowsExpandedHandler: () => (event: unknown) => void\n /**\n * Resets the expanded state of the table to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#resetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n resetExpanded: (defaultState?: boolean) => void\n /**\n * Updates the expanded state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#setexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n setExpanded: (updater: Updater) => void\n /**\n * Toggles the expanded state for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleAllRowsExpanded: (expanded?: boolean) => void\n}\n\n//\n\nexport const RowExpanding: TableFeature = {\n getInitialState: (state): ExpandedTableState => {\n return {\n expanded: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ExpandedOptions => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true,\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetExpanded = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetExpanded ??\n !table.options.manualExpanding\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetExpanded()\n queued = false\n })\n }\n }\n table.setExpanded = updater => table.options.onExpandedChange?.(updater)\n table.toggleAllRowsExpanded = expanded => {\n if (expanded ?? !table.getIsAllRowsExpanded()) {\n table.setExpanded(true)\n } else {\n table.setExpanded({})\n }\n }\n table.resetExpanded = defaultState => {\n table.setExpanded(defaultState ? {} : table.initialState?.expanded ?? {})\n }\n table.getCanSomeRowsExpand = () => {\n return table\n .getPrePaginationRowModel()\n .flatRows.some(row => row.getCanExpand())\n }\n table.getToggleAllRowsExpandedHandler = () => {\n return (e: unknown) => {\n ;(e as any).persist?.()\n table.toggleAllRowsExpanded()\n }\n }\n table.getIsSomeRowsExpanded = () => {\n const expanded = table.getState().expanded\n return expanded === true || Object.values(expanded).some(Boolean)\n }\n table.getIsAllRowsExpanded = () => {\n const expanded = table.getState().expanded\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true\n }\n\n if (!Object.keys(expanded).length) {\n return false\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false\n }\n\n // They must all be expanded :shrug:\n return true\n }\n table.getExpandedDepth = () => {\n let maxDepth = 0\n\n const rowIds =\n table.getState().expanded === true\n ? Object.keys(table.getRowModel().rowsById)\n : Object.keys(table.getState().expanded)\n\n rowIds.forEach(id => {\n const splitId = id.split('.')\n maxDepth = Math.max(maxDepth, splitId.length)\n })\n\n return maxDepth\n }\n table.getPreExpandedRowModel = () => table.getSortedRowModel()\n table.getExpandedRowModel = () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table)\n }\n\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._getExpandedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleExpanded = expanded => {\n table.setExpanded(old => {\n const exists = old === true ? true : !!old?.[row.id]\n\n let oldExpanded: ExpandedStateList = {}\n\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true\n })\n } else {\n oldExpanded = old\n }\n\n expanded = expanded ?? !exists\n\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true,\n }\n }\n\n if (exists && !expanded) {\n const { [row.id]: _, ...rest } = oldExpanded\n return rest\n }\n\n return old\n })\n }\n row.getIsExpanded = () => {\n const expanded = table.getState().expanded\n\n return !!(\n table.options.getIsRowExpanded?.(row) ??\n (expanded === true || expanded?.[row.id])\n )\n }\n row.getCanExpand = () => {\n return (\n table.options.getRowCanExpand?.(row) ??\n ((table.options.enableExpanding ?? true) && !!row.subRows?.length)\n )\n }\n row.getIsAllParentsExpanded = () => {\n let isFullyExpanded = true\n let currentRow = row\n\n while (isFullyExpanded && currentRow.parentId) {\n currentRow = table.getRow(currentRow.parentId, true)\n isFullyExpanded = currentRow.getIsExpanded()\n }\n\n return isFullyExpanded\n }\n row.getToggleExpandedHandler = () => {\n const canExpand = row.getCanExpand()\n\n return () => {\n if (!canExpand) return\n row.toggleExpanded()\n }\n }\n },\n}\n","import {\n OnChangeFn,\n Table,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport {\n functionalUpdate,\n getMemoOptions,\n makeStateUpdater,\n memo,\n} from '../utils'\n\nexport interface PaginationState {\n pageIndex: number\n pageSize: number\n}\n\nexport interface PaginationTableState {\n pagination: PaginationState\n}\n\nexport interface PaginationInitialTableState {\n pagination?: Partial\n}\n\nexport interface PaginationOptions {\n /**\n * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n autoResetPageIndex?: boolean\n /**\n * Returns the row model after pagination has taken place, but no further.\n *\n * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel?: (table: Table) => () => RowModel\n /**\n * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n manualPagination?: boolean\n /**\n * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n onPaginationChange?: OnChangeFn\n /**\n * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n pageCount?: number\n /**\n * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n rowCount?: number\n}\n\nexport interface PaginationDefaultOptions {\n onPaginationChange: OnChangeFn\n}\n\nexport interface PaginationInstance {\n _autoResetPageIndex: () => void\n _getPaginationRowModel?: () => RowModel\n /**\n * Returns whether the table can go to the next page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanNextPage: () => boolean\n /**\n * Returns whether the table can go to the previous page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanPreviousPage: () => boolean\n /**\n * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageCount: () => number\n /**\n * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getRowCount: () => number\n /**\n * Returns an array of page options (zero-index-based) for the current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageOptions: () => number[]\n /**\n * Returns the row model for the table after pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel: () => RowModel\n /**\n * Returns the row model for the table before any pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPrePaginationRowModel: () => RowModel\n /**\n * Increments the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n nextPage: () => void\n /**\n * Decrements the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n previousPage: () => void\n /**\n * Sets the page index to `0`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n firstPage: () => void\n /**\n * Sets the page index to the last page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n lastPage: () => void\n /**\n * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageIndex: (defaultState?: boolean) => void\n /**\n * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageSize: (defaultState?: boolean) => void\n /**\n * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPagination: (defaultState?: boolean) => void\n /**\n * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead.\n */\n setPageCount: (updater: Updater) => void\n /**\n * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageIndex: (updater: Updater) => void\n /**\n * Updates the page size using the provided function or value in the `state.pagination.pageSize` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageSize: (updater: Updater) => void\n /**\n * Sets or updates the `state.pagination` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPagination: (updater: Updater) => void\n}\n\n//\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\nconst getDefaultPaginationState = (): PaginationState => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n})\n\nexport const RowPagination: TableFeature = {\n getInitialState: (state): PaginationTableState => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...state?.pagination,\n },\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): PaginationDefaultOptions => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table),\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetPageIndex = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetPageIndex()\n queued = false\n })\n }\n }\n table.setPagination = updater => {\n const safeUpdater: Updater = old => {\n let newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n }\n table.resetPagination = defaultState => {\n table.setPagination(\n defaultState\n ? getDefaultPaginationState()\n : table.initialState.pagination ?? getDefaultPaginationState()\n )\n }\n table.setPageIndex = updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n }\n table.resetPageIndex = defaultState => {\n table.setPageIndex(\n defaultState\n ? defaultPageIndex\n : table.initialState?.pagination?.pageIndex ?? defaultPageIndex\n )\n }\n table.resetPageSize = defaultState => {\n table.setPageSize(\n defaultState\n ? defaultPageSize\n : table.initialState?.pagination?.pageSize ?? defaultPageSize\n )\n }\n table.setPageSize = updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex!\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n }\n //deprecated\n table.setPageCount = updater =>\n table.setPagination(old => {\n let newPageCount = functionalUpdate(\n updater,\n table.options.pageCount ?? -1\n )\n\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount)\n }\n\n return {\n ...old,\n pageCount: newPageCount,\n }\n })\n\n table.getPageOptions = memo(\n () => [table.getPageCount()],\n pageCount => {\n let pageOptions: number[] = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n },\n getMemoOptions(table.options, 'debugTable', 'getPageOptions')\n )\n\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0\n\n table.getCanNextPage = () => {\n const { pageIndex } = table.getState().pagination\n\n const pageCount = table.getPageCount()\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n }\n\n table.previousPage = () => {\n return table.setPageIndex(old => old - 1)\n }\n\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1\n })\n }\n\n table.firstPage = () => {\n return table.setPageIndex(0)\n }\n\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1)\n }\n\n table.getPrePaginationRowModel = () => table.getExpandedRowModel()\n table.getPaginationRowModel = () => {\n if (\n !table._getPaginationRowModel &&\n table.options.getPaginationRowModel\n ) {\n table._getPaginationRowModel =\n table.options.getPaginationRowModel(table)\n }\n\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel()\n }\n\n return table._getPaginationRowModel()\n }\n\n table.getPageCount = () => {\n return (\n table.options.pageCount ??\n Math.ceil(table.getRowCount() / table.getState().pagination.pageSize)\n )\n }\n\n table.getRowCount = () => {\n return (\n table.options.rowCount ?? table.getPrePaginationRowModel().rows.length\n )\n }\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance {\n _getPinnedRows: (\n visiblePinnedRows: Array>,\n pinnedRowIds: Array | undefined,\n position: 'top' | 'bottom'\n ) => Row[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top' ? table.getTopRows() : table.getBottomRows()\n )?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows.filter(Boolean).map(d => ({ ...d, position })) as Row[]\n }\n\n table.getTopRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.top],\n (allRows, topPinnedRowIds) =>\n table._getPinnedRows(allRows, topPinnedRowIds, 'top'),\n getMemoOptions(table.options, 'debugRows', 'getTopRows')\n )\n\n table.getBottomRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.bottom],\n (allRows, bottomPinnedRowIds) =>\n table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'),\n getMemoOptions(table.options, 'debugRows', 'getBottomRows')\n )\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n","import {\n OnChangeFn,\n Table,\n Row,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowSelectionState = Record\n\nexport interface RowSelectionTableState {\n rowSelection: RowSelectionState\n}\n\nexport interface RowSelectionOptions {\n /**\n * - Enables/disables multiple row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablemultirowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableMultiRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * - Enables/disables row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable row selection for that row\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablerowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * Enables/disables automatic sub-row selection when a parent row is selected, or a function that enables/disables automatic sub-row selection for each row.\n * (Use in combination with expanding or grouping features)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablesubrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableSubRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowSelection` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#onrowselectionchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n onRowSelectionChange?: OnChangeFn\n // enableGroupingRowSelection?:\n // | boolean\n // | ((\n // row: Row\n // ) => boolean)\n // isAdditiveSelectEvent?: (e: unknown) => boolean\n // isInclusiveSelectEvent?: (e: unknown) => boolean\n // selectRowsFn?: (\n // table: Table,\n // rowModel: RowModel\n // ) => RowModel\n}\n\nexport interface RowSelectionRow {\n /**\n * Returns whether or not the row can multi-select.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanmultiselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanMultiSelect: () => boolean\n /**\n * Returns whether or not the row can be selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelect: () => boolean\n /**\n * Returns whether or not the row can select sub rows automatically when the parent row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselectsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelectSubRows: () => boolean\n /**\n * Returns whether or not all of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallsubrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllSubRowsSelected: () => boolean\n /**\n * Returns whether or not the row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSelected: () => boolean\n /**\n * Returns whether or not some of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomeselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeSelected: () => boolean\n /**\n * Returns a handler that can be used to toggle the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleSelectedHandler: () => (event: unknown) => void\n /**\n * Selects/deselects the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleSelected: (value?: boolean, opts?: { selectChildren?: boolean }) => void\n}\n\nexport interface RowSelectionInstance {\n /**\n * Returns the row model of all rows that are selected after filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getfilteredselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getFilteredSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getgroupedselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getGroupedSelectedRowModel: () => RowModel\n /**\n * Returns whether or not all rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllPageRowsSelected: () => boolean\n /**\n * Returns whether or not all rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllRowsSelected: () => boolean\n /**\n * Returns whether or not any rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomePageRowsSelected: () => boolean\n /**\n * Returns whether or not any rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeRowsSelected: () => boolean\n /**\n * Returns the core row model of all rows before row selection has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getpreselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getPreSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getSelectedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallpagerowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Returns a handler that can be used to toggle all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallrowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Resets the **rowSelection** state to the `initialState.rowSelection`, or `true` can be passed to force a default blank state reset to `{}`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#resetrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n resetRowSelection: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowSelection` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#setrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n setRowSelection: (updater: Updater) => void\n /**\n * Selects/deselects all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllPageRowsSelected: (value?: boolean) => void\n /**\n * Selects/deselects all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllRowsSelected: (value?: boolean) => void\n}\n\n//\n\nexport const RowSelection: TableFeature = {\n getInitialState: (state): RowSelectionTableState => {\n return {\n rowSelection: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowSelectionOptions => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true,\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowSelection = updater =>\n table.options.onRowSelectionChange?.(updater)\n table.resetRowSelection = defaultState =>\n table.setRowSelection(\n defaultState ? {} : table.initialState.rowSelection ?? {}\n )\n table.toggleAllRowsSelected = value => {\n table.setRowSelection(old => {\n value =\n typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n }\n table.toggleAllPageRowsSelected = value =>\n table.setRowSelection(old => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table.getIsAllPageRowsSelected()\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n table.getPreSelectedRowModel = () => table.getCoreRowModel()\n table.getSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getCoreRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')\n )\n\n table.getFilteredSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getFilteredRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')\n )\n\n table.getGroupedSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getSortedRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')\n )\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n table.getIsAllRowsSelected = () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const { rowSelection } = table.getState()\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n row => row.getCanSelect() && !rowSelection[row.id]\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n }\n\n table.getIsAllPageRowsSelected = () => {\n const paginationFlatRows = table\n .getPaginationRowModel()\n .flatRows.filter(row => row.getCanSelect())\n const { rowSelection } = table.getState()\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some(row => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n }\n\n table.getIsSomeRowsSelected = () => {\n const totalSelected = Object.keys(\n table.getState().rowSelection ?? {}\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n }\n\n table.getIsSomePageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows\n return table.getIsAllPageRowsSelected()\n ? false\n : paginationFlatRows\n .filter(row => row.getCanSelect())\n .some(d => d.getIsSelected() || d.getIsSomeSelected())\n }\n\n table.getToggleAllRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n\n table.getToggleAllPageRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllPageRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleSelected = (value, opts) => {\n const isSelected = row.getIsSelected()\n\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row.getCanSelect() && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n table\n )\n\n return selectedRowIds\n })\n }\n row.getIsSelected = () => {\n const { rowSelection } = table.getState()\n return isRowSelected(row, rowSelection)\n }\n\n row.getIsSomeSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'some'\n }\n\n row.getIsAllSubRowsSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'all'\n }\n\n row.getCanSelect = () => {\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row)\n }\n\n return table.options.enableRowSelection ?? true\n }\n\n row.getCanSelectSubRows = () => {\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row)\n }\n\n return table.options.enableSubRowSelection ?? true\n }\n\n row.getCanMultiSelect = () => {\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row)\n }\n\n return table.options.enableMultiRowSelection ?? true\n }\n row.getToggleSelectedHandler = () => {\n const canSelect = row.getCanSelect()\n\n return (e: unknown) => {\n if (!canSelect) return\n row.toggleSelected(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nconst mutateRowIsSelected = (\n selectedRowIds: Record,\n id: string,\n value: boolean,\n includeChildren: boolean,\n table: Table\n) => {\n const row = table.getRow(id, true)\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key])\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true\n }\n } else {\n delete selectedRowIds[id]\n }\n // }\n\n if (includeChildren && row.subRows?.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row =>\n mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)\n )\n }\n}\n\nexport function selectRowsFn(\n table: Table,\n rowModel: RowModel\n): RowModel {\n const rowSelection = table.getState().rowSelection\n\n const newSelectedFlatRows: Row[] = []\n const newSelectedRowsById: Record> = {}\n\n // Filters top level and nested rows\n const recurseRows = (rows: Row[], depth = 0): Row[] => {\n return rows\n .map(row => {\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows?.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n return row\n }\n })\n .filter(Boolean) as Row[]\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\nexport function isRowSelected(\n row: Row,\n selection: Record\n): boolean {\n return selection[row.id] ?? false\n}\n\nexport function isSubRowSelected(\n row: Row,\n selection: Record,\n table: Table\n): boolean | 'some' | 'all' {\n if (!row.subRows?.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (subRow.getCanSelect()) {\n if (isRowSelected(subRow, selection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows && subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow, selection, table)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n","import { SortingFn } from './features/RowSorting'\n\nexport const reSplitAlphaNumeric = /([0-9]+)/gm\n\nconst alphanumeric: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\nconst alphanumericCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\nconst datetime: SortingFn = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId)\n const b = rowB.getValue(columnId)\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0\n}\n\nconst basic: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId))\n}\n\n// Utils\n\nfunction compareBasic(a: any, b: any) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction toString(a: any) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr: string, bStr: string) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean)\n\n // While\n while (a.length && b.length) {\n const aa = a.shift()!\n const bb = b.shift()!\n\n const an = parseInt(aa, 10)\n const bn = parseInt(bb, 10)\n\n const combo = [an, bn].sort()\n\n // Both are string\n if (isNaN(combo[0]!)) {\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1]!)) {\n return isNaN(an) ? -1 : 1\n }\n\n // Both are numbers\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n }\n\n return a.length - b.length\n}\n\n// Exports\n\nexport const sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic,\n}\n\nexport type BuiltInSortingFn = keyof typeof sortingFns\n","import { RowModel } from '..'\nimport {\n BuiltInSortingFn,\n reSplitAlphaNumeric,\n sortingFns,\n} from '../sortingFns'\n\nimport {\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n SortingFns,\n TableFeature,\n} from '../types'\n\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type SortDirection = 'asc' | 'desc'\n\nexport interface ColumnSort {\n desc: boolean\n id: string\n}\n\nexport type SortingState = ColumnSort[]\n\nexport interface SortingTableState {\n sorting: SortingState\n}\n\nexport interface SortingFn {\n (rowA: Row, rowB: Row, columnId: string): number\n}\n\nexport type CustomSortingFns = Record<\n string,\n SortingFn\n>\n\nexport type SortingFnOption =\n | 'auto'\n | keyof SortingFns\n | BuiltInSortingFn\n | SortingFn\n\nexport interface SortingColumnDef {\n /**\n * Enables/Disables multi-sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n invertSorting?: boolean\n /**\n * Set to `true` for sorting toggles on this column to start in the descending direction.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n /**\n * The sorting function to use with this column.\n * - A `string` referencing a built-in sorting function\n * - A custom sorting function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortingFn?: SortingFnOption\n /**\n * The priority of undefined values when sorting this column.\n * - `false`\n * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)\n * - `-1`\n * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)\n * - `1`\n * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortundefined)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n}\n\nexport interface SortingColumn {\n /**\n * Removes this column from the table's sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n clearSorting: () => void\n /**\n * Returns a sort direction automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortDir: () => SortDirection\n /**\n * Returns a sorting function automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortingFn: () => SortingFn\n /**\n * Returns whether this column can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanMultiSort: () => boolean\n /**\n * Returns whether this column can be sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanSort: () => boolean\n /**\n * Returns the first direction that should be used when sorting this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getFirstSortDir: () => SortDirection\n /**\n * Returns the current sort direction of this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getIsSorted: () => false | SortDirection\n /**\n * Returns the next sorting order.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getNextSortingOrder: () => SortDirection | false\n /**\n * Returns the index position of this column's sorting within the sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortIndex: () => number\n /**\n * Returns the resolved sorting function to be used for this column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortingFn: () => SortingFn\n /**\n * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getToggleSortingHandler: () => undefined | ((event: unknown) => void)\n /**\n * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n toggleSorting: (desc?: boolean, isMulti?: boolean) => void\n}\n\ninterface SortingOptionsBase {\n /**\n * Enables/disables the ability to remove multi-sorts\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiRemove?: boolean\n /**\n * Enables/Disables multi-sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Enables/Disables the ability to remove sorting for the table.\n * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ...\n * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ...\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSortingRemoval?: boolean\n /**\n * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel?: (table: Table) => () => RowModel\n /**\n * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n isMultiSortEvent?: (e: unknown) => boolean\n /**\n * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n manualSorting?: boolean\n /**\n * Set a maximum number of columns that can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n maxMultiSortColCount?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.sorting` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n onSortingChange?: OnChangeFn\n /**\n * If `true`, all sorts will default to descending as their first toggle state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n}\n\ntype ResolvedSortingFns = keyof SortingFns extends never\n ? {\n sortingFns?: Record>\n }\n : {\n sortingFns: Record>\n }\n\nexport interface SortingOptions\n extends SortingOptionsBase,\n ResolvedSortingFns {}\n\nexport interface SortingInstance {\n _getSortedRowModel?: () => RowModel\n /**\n * Returns the row model for the table before any sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getPreSortedRowModel: () => RowModel\n /**\n * Returns the row model for the table after sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel: () => RowModel\n /**\n * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n resetSorting: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.sorting` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n setSorting: (updater: Updater) => void\n}\n\n//\n\nexport const RowSorting: TableFeature = {\n getInitialState: (state): SortingTableState => {\n return {\n sorting: [],\n ...state,\n }\n },\n\n getDefaultColumnDef: (): SortingColumnDef => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): SortingOptions => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoSortingFn = () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row?.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric\n }\n }\n }\n\n if (isString) {\n return sortingFns.text\n }\n\n return sortingFns.basic\n }\n column.getAutoSortDir = () => {\n const firstRow = table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n }\n column.getSortingFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.sortingFn)\n ? column.columnDef.sortingFn\n : column.columnDef.sortingFn === 'auto'\n ? column.getAutoSortingFn()\n : table.options.sortingFns?.[column.columnDef.sortingFn as string] ??\n sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]\n }\n column.toggleSorting = (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder()\n const hasManualValue = typeof desc !== 'undefined' && desc !== null\n\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old?.find(d => d.id === column.id)\n const existingIndex = old?.findIndex(d => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old?.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old?.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n }\n\n column.getFirstSortDir = () => {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n table.options.sortDescFirst ??\n column.getAutoSortDir() === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n }\n\n column.getNextSortingOrder = (multi?: boolean) => {\n const firstSortDirection = column.getFirstSortDir()\n const isSorted = column.getIsSorted()\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n }\n\n column.getCanSort = () => {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getCanMultiSort = () => {\n return (\n column.columnDef.enableMultiSort ??\n table.options.enableMultiSort ??\n !!column.accessorFn\n )\n }\n\n column.getIsSorted = () => {\n const columnSort = table.getState().sorting?.find(d => d.id === column.id)\n\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n }\n\n column.getSortIndex = () =>\n table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1\n\n column.clearSorting = () => {\n //clear sorting for just 1 column\n table.setSorting(old =>\n old?.length ? old.filter(d => d.id !== column.id) : []\n )\n }\n\n column.getToggleSortingHandler = () => {\n const canSort = column.getCanSort()\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column.toggleSorting?.(\n undefined,\n column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false\n )\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setSorting = updater => table.options.onSortingChange?.(updater)\n table.resetSorting = defaultState => {\n table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])\n }\n table.getPreSortedRowModel = () => table.getGroupedRowModel()\n table.getSortedRowModel = () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table)\n }\n\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._getSortedRowModel()\n }\n },\n}\n","import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table) => () => RowModel\n /**\n * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row) => string\n /**\n * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions,\n options: Partial>\n ) => TableOptions\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial\n}\n\nexport interface CoreInstance {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record>\n _getColumnDefs: () => ColumnDef[]\n _getCoreRowModel?: () => RowModel\n _getDefaultColumnDef: () => Partial>\n _getRowId: (_: TData, index: number, parent?: Row) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater) => void\n}\n\nexport function createTable(\n options: TableOptionsResolved\n): Table {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved\n\n const mergeOptions = (options: TableOptionsResolved) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef[],\n parent?: Column,\n depth = 0\n ): Column[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n","import { createRow } from '../core/row'\nimport { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getCoreRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.options.data],\n (\n data\n ): {\n rows: Row[]\n flatRows: Row[]\n rowsById: Record>\n } => {\n const rowModel: RowModel = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: TData[],\n depth = 0,\n parentRow?: Row\n ): Row[] => {\n const rows = [] as Row[]\n\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(\n table,\n table._getRowId(originalRows[i]!, i, parentRow),\n originalRows[i]!,\n i,\n depth,\n undefined,\n parentRow?.id\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(\n originalRows[i]!,\n i\n )\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getExpandedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().expanded,\n table.getPreExpandedRowModel(),\n table.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel\n }\n\n return expandRows(rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')\n )\n}\n\nexport function expandRows(rowModel: RowModel) {\n const expandedRows: Row[] = []\n\n const handleRow = (row: Row) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedMinMaxValues(): (\n table: Table,\n columnId: string\n) => () => undefined | [number, number] {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return undefined\n\n const uniqueValues = facetedRowModel.flatRows\n .flatMap(flatRow => flatRow.getUniqueValues(columnId) ?? [])\n .map(Number)\n .filter(value => !Number.isNaN(value))\n\n if (!uniqueValues.length) return\n\n let facetedMinValue = uniqueValues[0]!\n let facetedMaxValue = uniqueValues[uniqueValues.length - 1]!\n\n for (const value of uniqueValues) {\n if (value < facetedMinValue) facetedMinValue = value\n else if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n return [facetedMinValue, facetedMaxValue]\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')\n )\n}\n","import { createRow } from '../core/row'\nimport { Row, RowModel, Table, RowData } from '../types'\n\nexport function filterRows(\n rows: Row[],\n filterRowImpl: (row: Row) => any,\n table: Table\n) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table)\n }\n\n return filterRowModelFromRoot(rows, filterRowImpl, table)\n}\n\nfunction filterRowModelFromLeafs(\n rowsToFilter: Row[],\n filterRow: (row: Row) => Row[],\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n const rows: Row[] = []\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.columnFilters = row.columnFilters\n\n if (row.subRows?.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n } else {\n row = newRow\n if (filterRow(row)) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n }\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n\nfunction filterRowModelFromRoot(\n rowsToFilter: Row[],\n filterRow: (row: Row) => any,\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n // Filters top level and nested rows\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n // Filter from parents downward first\n\n const rows: Row[] = []\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const pass = filterRow(row)\n\n if (pass) {\n if (row.subRows?.length && depth < maxDepth) {\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n }\n\n rows.push(row)\n newFilteredFlatRows.push(row)\n newFilteredRowsById[row.id] = row\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFacetedRowModel(): (\n table: Table,\n columnId: string\n) => () => RowModel {\n return (table, columnId) =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n table.getFilteredRowModel(),\n ],\n (preRowModel, columnFilters, globalFilter) => {\n if (\n !preRowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n return preRowModel\n }\n\n const filterableIds = [\n ...columnFilters.map(d => d.id).filter(d => d !== columnId),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as string[]\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')\n )\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedUniqueValues(): (\n table: Table,\n columnId: string\n) => () => Map {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return new Map()\n\n let facetedUniqueValues = new Map()\n\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values =\n facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]!\n\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n },\n getMemoOptions(\n table.options,\n 'debugTable',\n `getFacetedUniqueValues_${columnId}`\n )\n )\n}\n","import { ResolvedColumnFilter } from '../features/ColumnFiltering'\nimport { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFilteredRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n ],\n (rowModel, columnFilters, globalFilter) => {\n if (\n !rowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i]!.columnFilters = {}\n rowModel.flatRows[i]!.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: ResolvedColumnFilter[] = []\n const resolvedGlobalFilters: ResolvedColumnFilter[] = []\n\n ;(columnFilters ?? []).forEach(d => {\n const column = table.getColumn(d.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column.getFilterFn()\n\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`\n )\n }\n return\n }\n\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: filterFn.resolveFilterValue?.(d.value) ?? d.value,\n })\n })\n\n const filterableIds = (columnFilters ?? []).map(d => d.id)\n\n const globalFilterFn = table.getGlobalFilterFn()\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter(column => column.getCanGlobalFilter())\n\n if (\n globalFilter &&\n globalFilterFn &&\n globallyFilterableColumns.length\n ) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach(column => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ??\n globalFilter,\n })\n })\n }\n\n let currentColumnFilter\n let currentGlobalFilter\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j]!\n\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { createRow } from '../core/row'\nimport { Row, RowData, RowModel, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { GroupingState } from '../features/ColumnGrouping'\n\nexport function getGroupedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().grouping, table.getPreGroupedRowModel()],\n (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n rowModel.rows.forEach(row => {\n row.depth = 0\n row.parentId = undefined\n })\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId =>\n table.getColumn(columnId)\n )\n\n const groupedFlatRows: Row[] = []\n const groupedRowsById: Record> = {}\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Row[],\n depth = 0,\n parentId?: string\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId: string = existingGrouping[depth]!\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n subRows.forEach(subRow => {\n subRow.parentId = id\n })\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, row => row.subRows)\n : groupedRows\n\n const row = createRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId\n )\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (columnId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[columnId] =\n groupedRows[0].getValue(columnId) ?? undefined\n }\n\n return row._valuesCache[columnId]\n }\n\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId)\n const aggregateFn = column?.getAggregationFn()\n\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(\n columnId,\n leafRows,\n groupedRows\n )\n\n return row._groupingValuesCache[columnId]\n }\n },\n })\n\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return row\n }\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {\n table._queue(() => {\n table._autoResetExpanded()\n table._autoResetPageIndex()\n })\n })\n )\n}\n\nfunction groupBy(rows: Row[], columnId: string) {\n const groupMap = new Map[]>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel(opts?: {\n initialSync: boolean\n}): (table: Table) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().pagination,\n table.getPrePaginationRowModel(),\n table.options.paginateExpandedRows\n ? undefined\n : table.getState().expanded,\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n let paginatedRowModel: RowModel\n\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById,\n })\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById,\n }\n }\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row) => {\n paginatedRowModel.flatRows.push(row)\n if (row.subRows.length) {\n row.subRows.forEach(handleRow)\n }\n }\n\n paginatedRowModel.rows.forEach(handleRow)\n\n return paginatedRowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')\n )\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { SortingFn } from '../features/RowSorting'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getSortedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().sorting, table.getPreSortedRowModel()],\n (sorting, rowModel) => {\n if (!rowModel.rows.length || !sorting?.length) {\n return rowModel\n }\n\n const sortingState = table.getState().sorting\n\n const sortedFlatRows: Row[] = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort =>\n table.getColumn(sort.id)?.getCanSort()\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n invertSorting?: boolean\n sortingFn: SortingFn\n }\n > = {}\n\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn(),\n }\n })\n\n const sortData = (rows: Row[]) => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = rows.map(row => ({ ...row }))\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const sortUndefined = columnInfo.sortUndefined\n const isDesc = sortEntry?.desc ?? false\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1\n if (sortUndefined === 'last') return aUndefined ? 1 : -1\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? sortUndefined\n : -sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n sortedFlatRows.push(row)\n if (row.subRows?.length) {\n row.subRows = sortData(row.subRows)\n }\n })\n\n return sortedData\n }\n\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n"],"names":["createColumnHelper","accessor","column","accessorFn","accessorKey","display","group","functionalUpdate","updater","input","noop","makeStateUpdater","key","instance","setState","old","isFunction","d","Function","isNumberArray","Array","isArray","every","val","flattenBy","arr","getChildren","flat","recurse","subArr","forEach","item","push","children","length","memo","getDeps","fn","opts","deps","result","depArgs","depTime","debug","Date","now","newDeps","depsChanged","some","dep","index","resultTime","onChange","depEndTime","Math","round","resultEndTime","resultFpsPercentage","pad","str","num","String","console","info","max","min","getMemoOptions","tableOptions","debugLevel","_tableOptions$debugAl","debugAll","process","env","NODE_ENV","createCell","table","row","columnId","getRenderValue","_cell$getValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","_features","feature","createColumn","columnDef","depth","parent","_ref","_resolvedColumnDef$id","defaultColumn","_getDefaultColumnDef","resolvedColumnDef","prototype","replaceAll","replace","undefined","header","includes","originalRow","split","_result","warn","Error","columns","getFlatColumns","_column$columns","flatMap","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","leafColumns","createHeader","_options$id","isPlaceholder","placeholderId","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","map","Headers","createTable","getHeaderGroups","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","_left$map$filter","_right$map$filter","leftColumns","find","filter","Boolean","rightColumns","centerColumns","headerGroups","buildHeaderGroups","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","orderedLeafColumns","getRightHeaderGroups","_right$map$filter2","getFooterGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","getIsVisible","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","isLeafHeader","bottomHeaders","recurseHeadersForSpans","filteredHeaders","childRowSpans","childColSpan","childRowSpan","minChildRowSpan","createRow","original","rowIndex","subRows","parentId","_valuesCache","_uniqueValuesCache","hasOwnProperty","getColumn","getUniqueValues","_row$getValue","getLeafRows","getParentRow","getRow","getParentRows","parentRows","currentRow","parentRow","getAllCells","getAllLeafColumns","_getAllCellsByColumnId","allCells","reduce","acc","i","ColumnFaceting","_getFacetedRowModel","getFacetedRowModel","getPreFilteredRowModel","_getFacetedUniqueValues","getFacetedUniqueValues","Map","_getFacetedMinMaxValues","getFacetedMinMaxValues","includesString","filterValue","_filterValue$toString","search","toString","toLowerCase","autoRemove","testFalsey","includesStringSensitive","_row$getValue2","equalsString","_row$getValue3","arrIncludes","_row$getValue4","arrIncludesAll","_row$getValue5","arrIncludesSome","_row$getValue6","equals","weakEquals","inNumberRange","rowValue","resolveFilterValue","unsafeMin","unsafeMax","parsedMin","parseFloat","parsedMax","Number","isNaN","Infinity","temp","filterFns","ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","onColumnFiltersChange","filterFromLeafRows","maxLeafRowFilterDepth","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getFilterFn","_table$options$filter","_table$options$filter2","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","previousFilter","newFilter","shouldAutoRemoveFilter","_old$filter","newFilterObj","_old$map","_table","columnFiltersMeta","updateFn","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getFilteredRowModel","_getFilteredRowModel","manualFiltering","sum","_leafRows","childRows","next","nextValue","extent","mean","leafRows","count","median","values","mid","floor","nums","sort","a","b","unique","from","Set","uniqueCount","size","_columnId","aggregationFns","ColumnGrouping","aggregatedCell","props","_toString","_props$getValue","aggregationFn","grouping","onGroupingChange","groupedColumnMode","toggleGrouping","setGrouping","getCanGroup","enableGrouping","getGroupingValue","getIsGrouped","_table$getState$group","getGroupedIndex","_table$getState$group2","indexOf","getToggleGroupingHandler","canGroup","getAutoAggregationFn","Object","call","getAggregationFn","_table$options$aggreg","_table$options$aggreg2","resetGrouping","_table$initialState$g","getPreGroupedRowModel","getGroupedRowModel","_getGroupedRowModel","manualGrouping","groupingColumnId","_groupingValuesCache","getIsPlaceholder","getIsAggregated","_row$subRows","nonGroupingColumns","col","groupingColumns","g","ColumnOrdering","columnOrder","onColumnOrderChange","getIndex","position","_getVisibleLeafColumns","getIsFirstColumn","_columns$","getIsLastColumn","_columns","setColumnOrder","resetColumnOrder","orderedColumns","columnOrderCopy","columnsCopy","targetColumnId","shift","foundIndex","splice","getDefaultColumnPinningState","ColumnPinning","onColumnPinningChange","pin","columnIds","setColumnPinning","_old$left3","_old$right3","_old$left","_old$right","_old$left2","_old$right2","getCanPin","_d$columnDef$enablePi","enablePinning","enableColumnPinning","getIsPinned","leafColumnIds","isLeft","isRight","getPinnedIndex","getCenterVisibleCells","_getAllVisibleCells","leftAndRight","getLeftVisibleCells","cells","getRightVisibleCells","resetColumnPinning","getIsSomeColumnsPinned","_pinningState$positio","pinningState","_pinningState$left","_pinningState$right","getLeftLeafColumns","getRightLeafColumns","getCenterLeafColumns","safelyAccessDocument","_document","document","defaultColumnSizing","minSize","maxSize","MAX_SAFE_INTEGER","getDefaultColumnSizingInfoState","startOffset","startSize","deltaOffset","deltaPercentage","isResizingColumn","columnSizingStart","ColumnSizing","columnSizing","columnSizingInfo","columnResizeMode","columnResizeDirection","onColumnSizingChange","onColumnSizingInfoChange","getSize","_column$columnDef$min","_column$columnDef$max","columnSize","getStart","slice","getAfter","resetSize","setColumnSizing","_ref2","_","rest","getCanResize","enableResizing","enableColumnResizing","getIsResizing","_header$column$getSiz","prevSiblingHeader","getResizeHandler","_contextDocument","canResize","e","persist","isTouchStartEvent","touches","clientX","newColumnSizing","updateOffset","eventType","clientXPos","setColumnSizingInfo","_old$startOffset","_old$startSize","deltaDirection","_ref3","headerSize","onMove","onEnd","contextDocument","mouseEvents","moveHandler","upHandler","removeEventListener","touchEvents","cancelable","preventDefault","stopPropagation","_e$touches$","passiveIfSupported","passiveEventSupported","passive","addEventListener","resetColumnSizing","resetHeaderSizeInfo","_table$initialState$c2","getTotalSize","_table$getHeaderGroup","_table$getHeaderGroup2","getLeftTotalSize","_table$getLeftHeaderG","_table$getLeftHeaderG2","getCenterTotalSize","_table$getCenterHeade","_table$getCenterHeade2","getRightTotalSize","_table$getRightHeader","_table$getRightHeader2","passiveSupported","supported","window","err","type","ColumnVisibility","columnVisibility","onColumnVisibilityChange","toggleVisibility","getCanHide","setColumnVisibility","childColumns","c","enableHiding","getToggleVisibilityHandler","target","checked","getVisibleCells","makeVisibleColumnsMethod","getColumns","getVisibleFlatColumns","getAllFlatColumns","getLeftVisibleLeafColumns","getRightVisibleLeafColumns","getCenterVisibleLeafColumns","resetColumnVisibility","toggleAllColumnsVisible","_value","getIsAllColumnsVisible","obj","getIsSomeColumnsVisible","getToggleAllColumnsVisibilityHandler","_target","GlobalFaceting","_getGlobalFacetedRowModel","getGlobalFacetedRowModel","_getGlobalFacetedUniqueValues","getGlobalFacetedUniqueValues","_getGlobalFacetedMinMaxValues","getGlobalFacetedMinMaxValues","GlobalFiltering","globalFilter","onGlobalFilterChange","globalFilterFn","getColumnCanGlobalFilter","_table$getCoreRowMode","getCanGlobalFilter","_table$options$getCol","enableGlobalFilter","getGlobalAutoFilterFn","getGlobalFilterFn","setGlobalFilter","resetGlobalFilter","RowExpanding","expanded","onExpandedChange","paginateExpandedRows","registered","queued","_autoResetExpanded","_table$options$autoRe","_queue","autoResetAll","autoResetExpanded","manualExpanding","resetExpanded","setExpanded","toggleAllRowsExpanded","getIsAllRowsExpanded","_table$initialState$e","getCanSomeRowsExpand","getPrePaginationRowModel","getCanExpand","getToggleAllRowsExpandedHandler","getIsSomeRowsExpanded","keys","getRowModel","getIsExpanded","getExpandedDepth","rowIds","rowsById","splitId","getPreExpandedRowModel","getSortedRowModel","getExpandedRowModel","_getExpandedRowModel","toggleExpanded","_expanded","exists","oldExpanded","rowId","_table$options$getIsR","getIsRowExpanded","_table$options$getRow","getRowCanExpand","enableExpanding","getIsAllParentsExpanded","isFullyExpanded","getToggleExpandedHandler","canExpand","defaultPageIndex","defaultPageSize","getDefaultPaginationState","pageIndex","pageSize","RowPagination","pagination","onPaginationChange","_autoResetPageIndex","autoResetPageIndex","manualPagination","resetPageIndex","setPagination","safeUpdater","newState","resetPagination","_table$initialState$p","setPageIndex","maxPageIndex","pageCount","_table$initialState$p2","resetPageSize","_table$initialState$p3","_table$initialState2","setPageSize","topRowIndex","setPageCount","_table$options$pageCo","newPageCount","getPageOptions","getPageCount","pageOptions","fill","getCanPreviousPage","getCanNextPage","previousPage","nextPage","firstPage","lastPage","getPaginationRowModel","_getPaginationRowModel","_table$options$pageCo2","ceil","getRowCount","_table$options$rowCou","rowCount","rows","getDefaultRowPinningState","top","bottom","RowPinning","rowPinning","onRowPinningChange","includeLeafRows","includeParentRows","leafRowIds","parentRowIds","setRowPinning","_old$top3","_old$bottom3","_old$top","_old$bottom","has","_old$top2","_old$bottom2","enableRowPinning","isTop","isBottom","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","resetRowPinning","_table$initialState$r","getIsSomeRowsPinned","_pinningState$top","_pinningState$bottom","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","keepPinnedRows","allRows","topPinnedRowIds","bottomPinnedRowIds","getCenterRows","topAndBottom","RowSelection","rowSelection","onRowSelectionChange","enableRowSelection","enableMultiRowSelection","enableSubRowSelection","setRowSelection","resetRowSelection","toggleAllRowsSelected","getIsAllRowsSelected","preGroupedFlatRows","getCanSelect","toggleAllPageRowsSelected","resolvedValue","getIsAllPageRowsSelected","mutateRowIsSelected","getPreSelectedRowModel","getSelectedRowModel","rowModel","selectRowsFn","getFilteredSelectedRowModel","getGroupedSelectedRowModel","isAllRowsSelected","paginationFlatRows","isAllPageRowsSelected","getIsSomeRowsSelected","_table$getState$rowSe","totalSelected","getIsSomePageRowsSelected","getIsSelected","getIsSomeSelected","getToggleAllRowsSelectedHandler","getToggleAllPageRowsSelectedHandler","toggleSelected","isSelected","_opts$selectChildren","selectedRowIds","selectChildren","isRowSelected","isSubRowSelected","getIsAllSubRowsSelected","getCanSelectSubRows","getCanMultiSelect","_table$options$enable3","getToggleSelectedHandler","canSelect","includeChildren","newSelectedFlatRows","newSelectedRowsById","recurseRows","_row$subRows2","selection","_selection$row$id","_row$subRows3","allChildrenSelected","someSelected","subRow","subRowChildrenSelected","reSplitAlphaNumeric","alphanumeric","rowA","rowB","compareAlphanumeric","alphanumericCaseSensitive","text","compareBasic","textCaseSensitive","datetime","basic","aStr","bStr","aa","bb","an","parseInt","bn","combo","sortingFns","RowSorting","sorting","sortingFn","sortUndefined","onSortingChange","isMultiSortEvent","shiftKey","getAutoSortingFn","firstRows","isString","getAutoSortDir","getSortingFn","_table$options$sortin","_table$options$sortin2","toggleSorting","desc","multi","nextSortingOrder","getNextSortingOrder","hasManualValue","setSorting","existingSorting","existingIndex","newSorting","sortAction","nextDesc","getCanMultiSort","_table$options$maxMul","maxMultiSortColCount","getFirstSortDir","_column$columnDef$sor","sortDescFirst","firstSortDirection","isSorted","getIsSorted","enableSortingRemoval","enableMultiRemove","getCanSort","enableSorting","_column$columnDef$ena2","enableMultiSort","_table$getState$sorti","columnSort","getSortIndex","_table$getState$sorti2","_table$getState$sorti3","clearSorting","getToggleSortingHandler","canSort","resetSorting","_table$initialState$s","getPreSortedRowModel","_getSortedRowModel","manualSorting","builtInFeatures","_options$_features","_options$initialState","debugTable","defaultOptions","assign","mergeOptions","coreInitialState","_feature$getInitialSt","queuedTimeout","coreInstance","cb","Promise","resolve","then","catch","error","setTimeout","reset","setOptions","newOptions","onStateChange","_getRowId","getRowId","_getCoreRowModel","searchAll","_defaultColumn","_props$renderValue$to","_props$renderValue","_getColumnDefs","columnDefs","recurseColumns","groupingColumnDef","_getAllFlatColumnsById","flatColumns","data","accessRows","originalRows","getSubRows","_row$originalSubRows","originalSubRows","expandRows","expandedRows","handleRow","_table$getColumn","facetedRowModel","uniqueValues","flatRow","_flatRow$getUniqueVal","facetedMinValue","facetedMaxValue","filterRows","filterRowImpl","filterRowModelFromLeafs","filterRowModelFromRoot","rowsToFilter","filterRow","_table$options$maxLea","newFilteredFlatRows","newFilteredRowsById","recurseFilterRows","newRow","_table$options$maxLea2","pass","preRowModel","filterableIds","filterRowsImpl","facetedUniqueValues","j","_facetedUniqueValues$","set","get","resolvedColumnFilters","resolvedGlobalFilters","_filterFn$resolveFilt","globallyFilterableColumns","_globalFilterFn$resol","currentColumnFilter","currentGlobalFilter","filterMeta","__global__","existingGrouping","groupedFlatRows","groupedRowsById","groupUpRecursively","rowGroupsMap","groupBy","aggregatedGroupedRows","entries","groupingValue","groupedRows","_groupedRows$0$getVal","aggregateFn","groupMap","resKey","previous","pageStart","pageEnd","paginatedRowModel","sortingState","sortedFlatRows","availableSorting","columnInfoById","sortEntry","invertSorting","sortData","sortedData","_sortEntry$desc","columnInfo","isDesc","sortInt","aValue","bValue","aUndefined","bUndefined"],"mappings":";;;;;;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAsBO,SAASA,kBAAkBA,GAET;EACvB,OAAO;AACLC,IAAAA,QAAQ,EAAEA,CAACA,QAAQ,EAAEC,MAAM,KAAK;AAC9B,MAAA,OAAO,OAAOD,QAAQ,KAAK,UAAU,GAChC;AACC,QAAA,GAAGC,MAAM;AACTC,QAAAA,UAAU,EAAEF,QAAAA;AACd,OAAC,GACD;AACE,QAAA,GAAGC,MAAM;AACTE,QAAAA,WAAW,EAAEH,QAAAA;OACd,CAAA;KACN;IACDI,OAAO,EAAEH,MAAM,IAAIA,MAAM;IACzBI,KAAK,EAAEJ,MAAM,IAAIA,MAAAA;GAClB,CAAA;AACH;;AC9DA;;AAOA;;AA2CA;;AAEO,SAASK,gBAAgBA,CAAIC,OAAmB,EAAEC,KAAQ,EAAK;EACpE,OAAO,OAAOD,OAAO,KAAK,UAAU,GAC/BA,OAAO,CAAqBC,KAAK,CAAC,GACnCD,OAAO,CAAA;AACb,CAAA;AAEO,SAASE,IAAIA,GAAG;AACrB;AAAA,CAAA;AAGK,SAASC,gBAAgBA,CAC9BC,GAAM,EACNC,QA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CAACv5B,IAAI,CAAC4C,GAAG,CAAC,CAAA;QACxB,IAAAkT,CAAAA,YAAA,GAAIlT,GAAG,CAACiI,OAAO,KAAXiL,IAAAA,IAAAA,YAAA,CAAa5V,MAAM,EAAE;UACvB0C,GAAG,CAACiI,OAAO,GAAG+uB,QAAQ,CAACh3B,GAAG,CAACiI,OAAO,CAAC,CAAA;AACrC,SAAA;AACF,OAAC,CAAC,CAAA;AAEF,MAAA,OAAOgvB,UAAU,CAAA;KAClB,CAAA;IAED,OAAO;AACLzR,MAAAA,IAAI,EAAEwR,QAAQ,CAAC3N,QAAQ,CAAC7D,IAAI,CAAC;AAC7B1Y,MAAAA,QAAQ,EAAE6pB,cAAc;MACxBrV,QAAQ,EAAE+H,QAAQ,CAAC/H,QAAAA;KACpB,CAAA;AACH,GAAC,EACDhiB,cAAc,CAACS,KAAK,CAACO,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAC/DP,KAAK,CAACmjB,mBAAmB,EAC3B,CACF,CAAC,CAAA;AACL;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/sortingFns.d.ts b/node_modules/@tanstack/table-core/build/lib/sortingFns.d.ts new file mode 100644 index 00000000..279a851f --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/sortingFns.d.ts @@ -0,0 +1,11 @@ +import { SortingFn } from './features/RowSorting'; +export declare const reSplitAlphaNumeric: RegExp; +export declare const sortingFns: { + alphanumeric: SortingFn; + alphanumericCaseSensitive: SortingFn; + text: SortingFn; + textCaseSensitive: SortingFn; + datetime: SortingFn; + basic: SortingFn; +}; +export type BuiltInSortingFn = keyof typeof sortingFns; diff --git a/node_modules/@tanstack/table-core/build/lib/sortingFns.js b/node_modules/@tanstack/table-core/build/lib/sortingFns.js new file mode 100644 index 00000000..696966a4 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/sortingFns.js @@ -0,0 +1,120 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +const reSplitAlphaNumeric = /([0-9]+)/gm; +const alphanumeric = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; +const alphanumericCaseSensitive = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; + +// The text filter is more basic (less numeric support) +// but is much faster +const text = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); +}; + +// The text filter is more basic (less numeric support) +// but is much faster +const textCaseSensitive = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); +}; +const datetime = (rowA, rowB, columnId) => { + const a = rowA.getValue(columnId); + const b = rowB.getValue(columnId); + + // Can handle nullish values + // Use > and < because == (and ===) doesn't work with + // Date objects (would require calling getTime()). + return a > b ? 1 : a < b ? -1 : 0; +}; +const basic = (rowA, rowB, columnId) => { + return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); +}; + +// Utils + +function compareBasic(a, b) { + return a === b ? 0 : a > b ? 1 : -1; +} +function toString(a) { + if (typeof a === 'number') { + if (isNaN(a) || a === Infinity || a === -Infinity) { + return ''; + } + return String(a); + } + if (typeof a === 'string') { + return a; + } + return ''; +} + +// Mixed sorting is slow, but very inclusive of many edge cases. +// It handles numbers, mixed alphanumeric combinations, and even +// null, undefined, and Infinity +function compareAlphanumeric(aStr, bStr) { + // Split on number groups, but keep the delimiter + // Then remove falsey split values + const a = aStr.split(reSplitAlphaNumeric).filter(Boolean); + const b = bStr.split(reSplitAlphaNumeric).filter(Boolean); + + // While + while (a.length && b.length) { + const aa = a.shift(); + const bb = b.shift(); + const an = parseInt(aa, 10); + const bn = parseInt(bb, 10); + const combo = [an, bn].sort(); + + // Both are string + if (isNaN(combo[0])) { + if (aa > bb) { + return 1; + } + if (bb > aa) { + return -1; + } + continue; + } + + // One is a string, one is a number + if (isNaN(combo[1])) { + return isNaN(an) ? -1 : 1; + } + + // Both are numbers + if (an > bn) { + return 1; + } + if (bn > an) { + return -1; + } + } + return a.length - b.length; +} + +// Exports + +const sortingFns = { + alphanumeric, + alphanumericCaseSensitive, + text, + textCaseSensitive, + datetime, + basic +}; + +exports.reSplitAlphaNumeric = reSplitAlphaNumeric; +exports.sortingFns = sortingFns; +//# sourceMappingURL=sortingFns.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/sortingFns.js.map b/node_modules/@tanstack/table-core/build/lib/sortingFns.js.map new file mode 100644 index 00000000..5309c6de --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/sortingFns.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sortingFns.js","sources":["../../src/sortingFns.ts"],"sourcesContent":["import { SortingFn } from './features/RowSorting'\n\nexport const reSplitAlphaNumeric = /([0-9]+)/gm\n\nconst alphanumeric: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\nconst alphanumericCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\nconst datetime: SortingFn = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId)\n const b = rowB.getValue(columnId)\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0\n}\n\nconst basic: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId))\n}\n\n// Utils\n\nfunction compareBasic(a: any, b: any) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction toString(a: any) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr: string, bStr: string) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean)\n\n // While\n while (a.length && b.length) {\n const aa = a.shift()!\n const bb = b.shift()!\n\n const an = parseInt(aa, 10)\n const bn = parseInt(bb, 10)\n\n const combo = [an, bn].sort()\n\n // Both are string\n if (isNaN(combo[0]!)) {\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1]!)) {\n return isNaN(an) ? -1 : 1\n }\n\n // Both are numbers\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n }\n\n return a.length - b.length\n}\n\n// Exports\n\nexport const sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic,\n}\n\nexport type BuiltInSortingFn = keyof typeof sortingFns\n"],"names":["reSplitAlphaNumeric","alphanumeric","rowA","rowB","columnId","compareAlphanumeric","toString","getValue","toLowerCase","alphanumericCaseSensitive","text","compareBasic","textCaseSensitive","datetime","a","b","basic","isNaN","Infinity","String","aStr","bStr","split","filter","Boolean","length","aa","shift","bb","an","parseInt","bn","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AAO,CAAC,CAAC,CAAA;AACX,KAAA;AACF,GAAA;AAEA,EAAA,OAAOf,CAAC,CAACW,MAAM,GAAGV,CAAC,CAACU,MAAM,CAAA;AAC5B,CAAA;;AAEA;;AAEO,MAAMS,UAAU,GAAG;EACxBjC,YAAY;EACZQ,yBAAyB;EACzBC,IAAI;EACJE,iBAAiB;EACjBC,QAAQ;AACRG,EAAAA,KAAAA;AACF;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/types.d.ts b/node_modules/@tanstack/table-core/build/lib/types.d.ts new file mode 100644 index 00000000..e5bc9b7d --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/types.d.ts @@ -0,0 +1,119 @@ +import { CoreOptions, CoreTableState, CoreInstance } from './core/table'; +import { VisibilityInstance, VisibilityTableState, VisibilityColumn as ColumnVisibilityColumn, VisibilityOptions, VisibilityColumnDef, VisibilityRow } from './features/ColumnVisibility'; +import { ColumnOrderColumn, ColumnOrderInstance, ColumnOrderOptions, ColumnOrderTableState } from './features/ColumnOrdering'; +import { ColumnPinningColumn, ColumnPinningColumnDef, ColumnPinningInstance, ColumnPinningOptions, ColumnPinningRow, ColumnPinningTableState } from './features/ColumnPinning'; +import { RowPinningInstance, RowPinningOptions, RowPinningRow, RowPinningTableState } from './features/RowPinning'; +import { CoreHeader, CoreHeaderGroup, HeaderContext, HeadersInstance } from './core/headers'; +import { FacetedColumn, FacetedOptions } from './features/ColumnFaceting'; +import { GlobalFacetingInstance } from './features/GlobalFaceting'; +import { ColumnFiltersColumn, ColumnFiltersColumnDef, ColumnFiltersInstance, ColumnFiltersOptions, ColumnFiltersRow, ColumnFiltersTableState } from './features/ColumnFiltering'; +import { GlobalFilterColumn, GlobalFilterColumnDef, GlobalFilterInstance, GlobalFilterOptions, GlobalFilterTableState } from './features/GlobalFiltering'; +import { SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState } from './features/RowSorting'; +import { GroupingCell, GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState } from './features/ColumnGrouping'; +import { ExpandedInstance, ExpandedOptions, ExpandedTableState, ExpandedRow } from './features/RowExpanding'; +import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingHeader, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing'; +import { PaginationInitialTableState, PaginationInstance, PaginationOptions, PaginationTableState } from './features/RowPagination'; +import { RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState } from './features/RowSelection'; +import { CoreRow } from './core/row'; +import { PartialKeys, UnionToIntersection } from './utils'; +import { CellContext, CoreCell } from './core/cell'; +import { CoreColumn } from './core/column'; +export interface TableFeature { + createCell?: (cell: Cell, column: Column, row: Row, table: Table) => void; + createColumn?: (column: Column, table: Table) => void; + createHeader?: (header: Header, table: Table) => void; + createRow?: (row: Row, table: Table) => void; + createTable?: (table: Table) => void; + getDefaultColumnDef?: () => Partial>; + getDefaultOptions?: (table: Table) => Partial>; + getInitialState?: (initialState?: InitialTableState) => Partial; +} +export interface TableMeta { +} +export interface ColumnMeta { +} +export interface FilterMeta { +} +export interface FilterFns { +} +export interface SortingFns { +} +export interface AggregationFns { +} +export type Updater = T | ((old: T) => T); +export type OnChangeFn = (updaterOrValue: Updater) => void; +export type RowData = unknown | object | any[]; +export type AnyRender = (Comp: any, props: any) => any; +export interface Table extends CoreInstance, HeadersInstance, VisibilityInstance, ColumnOrderInstance, ColumnPinningInstance, RowPinningInstance, ColumnFiltersInstance, GlobalFilterInstance, GlobalFacetingInstance, SortingInstance, GroupingInstance, ColumnSizingInstance, ExpandedInstance, PaginationInstance, RowSelectionInstance { +} +interface FeatureOptions extends VisibilityOptions, ColumnOrderOptions, ColumnPinningOptions, RowPinningOptions, FacetedOptions, ColumnFiltersOptions, GlobalFilterOptions, SortingOptions, GroupingOptions, ExpandedOptions, ColumnSizingOptions, PaginationOptions, RowSelectionOptions { +} +export interface TableOptionsResolved extends CoreOptions, FeatureOptions { +} +export interface TableOptions extends PartialKeys, 'state' | 'onStateChange' | 'renderFallbackValue'> { +} +export interface TableState extends CoreTableState, VisibilityTableState, ColumnOrderTableState, ColumnPinningTableState, RowPinningTableState, ColumnFiltersTableState, GlobalFilterTableState, SortingTableState, ExpandedTableState, GroupingTableState, ColumnSizingTableState, PaginationTableState, RowSelectionTableState { +} +interface CompleteInitialTableState extends CoreTableState, VisibilityTableState, ColumnOrderTableState, ColumnPinningTableState, RowPinningTableState, ColumnFiltersTableState, GlobalFilterTableState, SortingTableState, ExpandedTableState, GroupingTableState, ColumnSizingTableState, PaginationInitialTableState, RowSelectionTableState { +} +export interface InitialTableState extends Partial { +} +export interface Row extends CoreRow, VisibilityRow, ColumnPinningRow, RowPinningRow, ColumnFiltersRow, GroupingRow, RowSelectionRow, ExpandedRow { +} +export interface RowModel { + rows: Row[]; + flatRows: Row[]; + rowsById: Record>; +} +export type AccessorFn = (originalRow: TData, index: number) => TValue; +export type ColumnDefTemplate = string | ((props: TProps) => any); +export type StringOrTemplateHeader = string | ColumnDefTemplate>; +export interface StringHeaderIdentifier { + header: string; + id?: string; +} +export interface IdIdentifier { + id: string; + header?: StringOrTemplateHeader; +} +type ColumnIdentifiers = IdIdentifier | StringHeaderIdentifier; +interface ColumnDefExtensions extends VisibilityColumnDef, ColumnPinningColumnDef, ColumnFiltersColumnDef, GlobalFilterColumnDef, SortingColumnDef, GroupingColumnDef, ColumnSizingColumnDef { +} +export interface ColumnDefBase extends ColumnDefExtensions { + getUniqueValues?: AccessorFn; + footer?: ColumnDefTemplate>; + cell?: ColumnDefTemplate>; + meta?: ColumnMeta; +} +export interface IdentifiedColumnDef extends ColumnDefBase { + id?: string; + header?: StringOrTemplateHeader; +} +export type DisplayColumnDef = ColumnDefBase & ColumnIdentifiers; +interface GroupColumnDefBase extends ColumnDefBase { + columns?: ColumnDef[]; +} +export type GroupColumnDef = GroupColumnDefBase & ColumnIdentifiers; +export interface AccessorFnColumnDefBase extends ColumnDefBase { + accessorFn: AccessorFn; +} +export type AccessorFnColumnDef = AccessorFnColumnDefBase & ColumnIdentifiers; +export interface AccessorKeyColumnDefBase extends ColumnDefBase { + id?: string; + accessorKey: (string & {}) | keyof TData; +} +export type AccessorKeyColumnDef = AccessorKeyColumnDefBase & Partial>; +export type AccessorColumnDef = AccessorKeyColumnDef | AccessorFnColumnDef; +export type ColumnDef = DisplayColumnDef | GroupColumnDef | AccessorColumnDef; +export type ColumnDefResolved = Partial>> & { + accessorKey?: string; +}; +export interface Column extends CoreColumn, ColumnVisibilityColumn, ColumnPinningColumn, FacetedColumn, ColumnFiltersColumn, GlobalFilterColumn, SortingColumn, GroupingColumn, ColumnSizingColumn, ColumnOrderColumn { +} +export interface Cell extends CoreCell, GroupingCell { +} +export interface Header extends CoreHeader, ColumnSizingHeader { +} +export interface HeaderGroup extends CoreHeaderGroup { +} +export {}; diff --git a/node_modules/@tanstack/table-core/build/lib/utils.d.ts b/node_modules/@tanstack/table-core/build/lib/utils.d.ts new file mode 100644 index 00000000..073e10c2 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils.d.ts @@ -0,0 +1,38 @@ +import { TableOptionsResolved, TableState, Updater } from './types'; +export type PartialKeys = Omit & Partial>; +export type RequiredKeys = Omit & Required>; +export type Overwrite = Omit & U; +export type UnionToIntersection = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never; +export type IsAny = 1 extends 0 & T ? Y : N; +export type IsKnown = unknown extends T ? N : Y; +type ComputeRange = []> = Result['length'] extends N ? Result : ComputeRange; +type Index40 = ComputeRange<40>[number]; +type IsTuple = T extends readonly any[] & { + length: infer Length; +} ? Length extends Index40 ? T : never : never; +type AllowedIndexes, Keys extends number = never> = Tuple extends readonly [] ? Keys : Tuple extends readonly [infer _, ...infer Tail] ? AllowedIndexes : Keys; +export type DeepKeys = TDepth['length'] extends 5 ? never : unknown extends T ? string : T extends readonly any[] & IsTuple ? AllowedIndexes | DeepKeysPrefix, TDepth> : T extends any[] ? DeepKeys : T extends Date ? never : T extends object ? (keyof T & string) | DeepKeysPrefix : never; +type DeepKeysPrefix = TPrefix extends keyof T & (number | string) ? `${TPrefix}.${DeepKeys & string}` : never; +export type DeepValue = T extends Record ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue : T[TProp & string] : never; +export type NoInfer = [T][T extends any ? 0 : never]; +export type Getter = () => NoInfer; +export declare function functionalUpdate(updater: Updater, input: T): T; +export declare function noop(): void; +export declare function makeStateUpdater(key: K, instance: unknown): (updater: Updater) => void; +type AnyFunction = (...args: any) => any; +export declare function isFunction(d: any): d is T; +export declare function isNumberArray(d: any): d is number[]; +export declare function flattenBy(arr: TNode[], getChildren: (item: TNode) => TNode[]): TNode[]; +export declare function memo(getDeps: (depArgs?: TDepArgs) => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, opts: { + key: any; + debug?: () => any; + onChange?: (result: TResult) => void; +}): (depArgs?: TDepArgs) => TResult; +export declare function getMemoOptions(tableOptions: Partial>, debugLevel: 'debugAll' | 'debugCells' | 'debugTable' | 'debugColumns' | 'debugRows' | 'debugHeaders', key: string, onChange?: (result: any) => void): { + debug: () => boolean | undefined; + key: string | false; + onChange: ((result: any) => void) | undefined; +}; +export {}; diff --git a/node_modules/@tanstack/table-core/build/lib/utils.js b/node_modules/@tanstack/table-core/build/lib/utils.js new file mode 100644 index 00000000..a153f7d2 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils.js @@ -0,0 +1,111 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +// Is this type a tuple? + +// If this type is a tuple, what indices are allowed? + +/// + +function functionalUpdate(updater, input) { + return typeof updater === 'function' ? updater(input) : updater; +} +function noop() { + // +} +function makeStateUpdater(key, instance) { + return updater => { + instance.setState(old => { + return { + ...old, + [key]: functionalUpdate(updater, old[key]) + }; + }); + }; +} +function isFunction(d) { + return d instanceof Function; +} +function isNumberArray(d) { + return Array.isArray(d) && d.every(val => typeof val === 'number'); +} +function flattenBy(arr, getChildren) { + const flat = []; + const recurse = subArr => { + subArr.forEach(item => { + flat.push(item); + const children = getChildren(item); + if (children != null && children.length) { + recurse(children); + } + }); + }; + recurse(arr); + return flat; +} +function memo(getDeps, fn, opts) { + let deps = []; + let result; + return depArgs => { + let depTime; + if (opts.key && opts.debug) depTime = Date.now(); + const newDeps = getDeps(depArgs); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep); + if (!depsChanged) { + return result; + } + deps = newDeps; + let resultTime; + if (opts.key && opts.debug) resultTime = Date.now(); + result = fn(...newDeps); + opts == null || opts.onChange == null || opts.onChange(result); + if (opts.key && opts.debug) { + if (opts != null && opts.debug()) { + const depEndTime = Math.round((Date.now() - depTime) * 100) / 100; + const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100; + const resultFpsPercentage = resultEndTime / 16; + const pad = (str, num) => { + str = String(str); + while (str.length < num) { + str = ' ' + str; + } + return str; + }; + console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, ` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key); + } + } + return result; + }; +} +function getMemoOptions(tableOptions, debugLevel, key, onChange) { + return { + debug: () => { + var _tableOptions$debugAl; + return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel]; + }, + key: process.env.NODE_ENV === 'development' && key, + onChange + }; +} + +exports.flattenBy = flattenBy; +exports.functionalUpdate = functionalUpdate; +exports.getMemoOptions = getMemoOptions; +exports.isFunction = isFunction; +exports.isNumberArray = isNumberArray; +exports.makeStateUpdater = makeStateUpdater; +exports.memo = memo; +exports.noop = noop; +//# sourceMappingURL=utils.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils.js.map b/node_modules/@tanstack/table-core/build/lib/utils.js.map new file mode 100644 index 00000000..c9f421f3 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import { TableOptionsResolved, TableState, Updater } from './types'\n\nexport type PartialKeys = Omit & Partial>\nexport type RequiredKeys = Omit &\n Required>\nexport type Overwrite = Omit<\n T,\n keyof U\n> &\n U\n\nexport type UnionToIntersection = (\n T extends any ? (x: T) => any : never\n) extends (x: infer R) => any\n ? R\n : never\n\nexport type IsAny = 1 extends 0 & T ? Y : N\nexport type IsKnown = unknown extends T ? N : Y\n\ntype ComputeRange<\n N extends number,\n Result extends Array = [],\n> = Result['length'] extends N\n ? Result\n : ComputeRange\ntype Index40 = ComputeRange<40>[number]\n\n// Is this type a tuple?\ntype IsTuple = T extends readonly any[] & { length: infer Length }\n ? Length extends Index40\n ? T\n : never\n : never\n\n// If this type is a tuple, what indices are allowed?\ntype AllowedIndexes<\n Tuple extends ReadonlyArray,\n Keys extends number = never,\n> = Tuple extends readonly []\n ? Keys\n : Tuple extends readonly [infer _, ...infer Tail]\n ? AllowedIndexes\n : Keys\n\nexport type DeepKeys = TDepth['length'] extends 5\n ? never\n : unknown extends T\n ? string\n : T extends readonly any[] & IsTuple\n ? AllowedIndexes | DeepKeysPrefix, TDepth>\n : T extends any[]\n ? DeepKeys\n : T extends Date\n ? never\n : T extends object\n ? (keyof T & string) | DeepKeysPrefix\n : never\n\ntype DeepKeysPrefix<\n T,\n TPrefix,\n TDepth extends any[],\n> = TPrefix extends keyof T & (number | string)\n ? `${TPrefix}.${DeepKeys & string}`\n : never\n\nexport type DeepValue =\n T extends Record\n ? TProp extends `${infer TBranch}.${infer TDeepProp}`\n ? DeepValue\n : T[TProp & string]\n : never\n\nexport type NoInfer = [T][T extends any ? 0 : never]\n\nexport type Getter = () => NoInfer\n\n///\n\nexport function functionalUpdate(updater: Updater, input: T): T {\n return typeof updater === 'function'\n ? (updater as (input: T) => T)(input)\n : updater\n}\n\nexport function noop() {\n //\n}\n\nexport function makeStateUpdater(\n key: K,\n instance: unknown\n) {\n return (updater: Updater) => {\n ;(instance as any).setState((old: TTableState) => {\n return {\n ...old,\n [key]: functionalUpdate(updater, (old as any)[key]),\n }\n })\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\nexport function isFunction(d: any): d is T {\n return d instanceof Function\n}\n\nexport function isNumberArray(d: any): d is number[] {\n return Array.isArray(d) && d.every(val => typeof val === 'number')\n}\n\nexport function flattenBy(\n arr: TNode[],\n getChildren: (item: TNode) => TNode[]\n) {\n const flat: TNode[] = []\n\n const recurse = (subArr: TNode[]) => {\n subArr.forEach(item => {\n flat.push(item)\n const children = getChildren(item)\n if (children?.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\nexport function memo(\n getDeps: (depArgs?: TDepArgs) => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: any\n debug?: () => any\n onChange?: (result: TResult) => void\n }\n): (depArgs?: TDepArgs) => TResult {\n let deps: any[] = []\n let result: TResult | undefined\n\n return depArgs => {\n let depTime: number\n if (opts.key && opts.debug) depTime = Date.now()\n\n const newDeps = getDeps(depArgs)\n\n const depsChanged =\n newDeps.length !== deps.length ||\n newDeps.some((dep: any, index: number) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime: number\n if (opts.key && opts.debug) resultTime = Date.now()\n\n result = fn(...newDeps)\n opts?.onChange?.(result)\n\n if (opts.key && opts.debug) {\n if (opts?.debug()) {\n const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120)\n )}deg 100% 31%);`,\n opts?.key\n )\n }\n }\n\n return result!\n }\n}\n\nexport function getMemoOptions(\n tableOptions: Partial>,\n debugLevel:\n | 'debugAll'\n | 'debugCells'\n | 'debugTable'\n | 'debugColumns'\n | 'debugRows'\n | 'debugHeaders',\n key: string,\n onChange?: (result: any) => void\n) {\n return {\n debug: () => tableOptions?.debugAll ?? tableOptions[debugLevel],\n key: process.env.NODE_ENV === 'development' && key,\n onChange,\n }\n}\n"],"names":["functionalUpdate","updater","input","noop","makeStateUpdater","key","instance","setState","old","isFunction","d","Function","isNumberArray","Array","isArray","every","val","flattenBy","arr","getChildren","flat","recurse","subArr","forEach","item","push","children","length","memo","getDeps","fn","opts","deps","result","depArgs","depTime","debug","Date","now","newDeps","depsChanged","some","dep","index","resultTime","onChange","depEndTime","Math","round","resultEndTime","resultFpsPercentage","pad","str","num","String","console","info","max","min","getMemoOptions","tableOptions","debugLevel","_tableOptions$debugAl","debugAll","process","env","NODE_ENV"],"mappings":";;;;;;;;;;;;AA4BA;;AAOA;;AA2CA;;AAEO,SAASA,gBAAgBA,CAAIC,OAAmB,EAAEC,KAAQ,EAAK;EACpE,OAAO,OAAOD,OAAO,KAAK,UAAU,GAC/BA,OAAO,CAAqBC,KAAK,CAAC,GACnCD,OAAO,CAAA;AACb,CAAA;AAEO,SAASE,IAAIA,GAAG;AACrB;AAAA,CAAA;AAGK,SAASC,gBAAgBA,CAC9BC,GAAM,EACNC,QAAiB,EACjB;AACA,EAAA,OAAQL,OAA+B,IAAK;AACxCK,IAAAA,QAAQ,CAASC,QAAQ,CAAeC,GAAgB,IAAK;MAC7D,OAAO;AACL,QAAA,GAAGA,GAAG;QACN,CAACH,GAAG,GAAGL,gBAAgB,CAACC,OAAO,EAAGO,GAAG,CAASH,GAAG,CAAC,C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AAGE,MAAM,CAACF,GAAG,CAAC,CAAA;AACjB,UAAA,OAAOA,GAAG,CAACzB,MAAM,GAAG0B,GAAG,EAAE;YACvBD,GAAG,GAAG,GAAG,GAAGA,GAAG,CAAA;AACjB,WAAA;AACA,UAAA,OAAOA,GAAG,CAAA;SACX,CAAA;AAEDG,QAAAA,OAAO,CAACC,IAAI,CACV,OAAOL,GAAG,CAACF,aAAa,EAAE,CAAC,CAAC,CAAA,EAAA,EAAKE,GAAG,CAACL,UAAU,EAAE,CAAC,CAAC,KAAK,EACxD,CAAA;AACV;AACA;AACA,uBAAyBC,EAAAA,IAAI,CAACU,GAAG,CACnB,CAAC,EACDV,IAAI,CAACW,GAAG,CAAC,GAAG,GAAG,GAAG,GAAGR,mBAAmB,EAAE,GAAG,CAC/C,CAAC,CAAA,cAAA,CAAgB,EACnBnB,IAAI,IAAJA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,IAAI,CAAE1B,GACR,CAAC,CAAA;AACH,OAAA;AACF,KAAA;AAEA,IAAA,OAAO4B,MAAM,CAAA;GACd,CAAA;AACH,CAAA;AAEO,SAAS0B,cAAcA,CAC5BC,YAAgD,EAChDC,UAMkB,EAClBxD,GAAW,EACXwC,QAAgC,EAChC;EACA,OAAO;AACLT,IAAAA,KAAK,EAAEA,MAAA;AAAA,MAAA,IAAA0B,qBAAA,CAAA;AAAA,MAAA,OAAA,CAAAA,qBAAA,GAAMF,YAAY,IAAA,IAAA,GAAA,KAAA,CAAA,GAAZA,YAAY,CAAEG,QAAQ,KAAA,IAAA,GAAAD,qBAAA,GAAIF,YAAY,CAACC,UAAU,CAAC,CAAA;AAAA,KAAA;IAC/DxD,GAAG,EAAE2D,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IAAI7D,GAAG;AAClDwC,IAAAA,QAAAA;GACD,CAAA;AACH;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/document.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/document.d.ts new file mode 100644 index 00000000..def4e619 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/document.d.ts @@ -0,0 +1,2 @@ +export declare function safelyAccessDocument(_document?: Document): Document | null; +export declare function safelyAccessDocumentEvent(event: Event): Document | null; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/document.js b/node_modules/@tanstack/table-core/build/lib/utils/document.js new file mode 100644 index 00000000..13ad6a0d --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/document.js @@ -0,0 +1,18 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +function safelyAccessDocument(_document) { + return _document || (typeof document !== 'undefined' ? document : null); +} + +exports.safelyAccessDocument = safelyAccessDocument; +//# sourceMappingURL=document.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/document.js.map b/node_modules/@tanstack/table-core/build/lib/utils/document.js.map new file mode 100644 index 00000000..baf0c025 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/document.js.map @@ -0,0 +1 @@ +{"version":3,"file":"document.js","sources":["../../../src/utils/document.ts"],"sourcesContent":["export function safelyAccessDocument(_document?: Document): Document | null {\n return _document || (typeof document !== 'undefined' ? document : null)\n}\n\nexport function safelyAccessDocumentEvent(event: Event): Document | null {\n return !!event &&\n !!event.target &&\n typeof event.target === 'object' &&\n 'ownerDocument' in event.target\n ? (event.target.ownerDocument as Document | null)\n : null\n}\n"],"names":["safelyAccessDocument","_document","document"],"mappings":";;;;;;;;;;;;AAAO,SAASA,oBAAoBA,CAACC,SAAoB,EAAmB;EAC1E,OAAOA,SAAS,KAAK,OAAOC,QAAQ,KAAK,WAAW,GAAGA,QAAQ,GAAG,IAAI,CAAC,CAAA;AACzE;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.d.ts new file mode 100644 index 00000000..aaa95664 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.d.ts @@ -0,0 +1,2 @@ +import { Row, RowModel, Table, RowData } from '../types'; +export declare function filterRows(rows: Row[], filterRowImpl: (row: Row) => any, table: Table): RowModel; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.js b/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.js new file mode 100644 index 00000000..fa542c66 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.js @@ -0,0 +1,111 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var row = require('../core/row.js'); + +function filterRows(rows, filterRowImpl, table) { + if (table.options.filterFromLeafRows) { + return filterRowModelFromLeafs(rows, filterRowImpl, table); + } + return filterRowModelFromRoot(rows, filterRowImpl, table); +} +function filterRowModelFromLeafs(rowsToFilter, filterRow, table) { + var _table$options$maxLea; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100; + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + + // Filter from children up first + for (let i = 0; i < rowsToFilter.length; i++) { + var _row$subRows; + let row$1 = rowsToFilter[i]; + const newRow = row.createRow(table, row$1.id, row$1.original, row$1.index, row$1.depth, undefined, row$1.parentId); + newRow.columnFilters = row$1.columnFilters; + if ((_row$subRows = row$1.subRows) != null && _row$subRows.length && depth < maxDepth) { + newRow.subRows = recurseFilterRows(row$1.subRows, depth + 1); + row$1 = newRow; + if (filterRow(row$1) && !newRow.subRows.length) { + rows.push(row$1); + newFilteredRowsById[row$1.id] = row$1; + newFilteredFlatRows.push(row$1); + continue; + } + if (filterRow(row$1) || newRow.subRows.length) { + rows.push(row$1); + newFilteredRowsById[row$1.id] = row$1; + newFilteredFlatRows.push(row$1); + continue; + } + } else { + row$1 = newRow; + if (filterRow(row$1)) { + rows.push(row$1); + newFilteredRowsById[row$1.id] = row$1; + newFilteredFlatRows.push(row$1); + } + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; +} +function filterRowModelFromRoot(rowsToFilter, filterRow, table) { + var _table$options$maxLea2; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100; + + // Filters top level and nested rows + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + // Filter from parents downward first + + const rows = []; + + // Apply the filter to any subRows + for (let i = 0; i < rowsToFilter.length; i++) { + let row$1 = rowsToFilter[i]; + const pass = filterRow(row$1); + if (pass) { + var _row$subRows2; + if ((_row$subRows2 = row$1.subRows) != null && _row$subRows2.length && depth < maxDepth) { + const newRow = row.createRow(table, row$1.id, row$1.original, row$1.index, row$1.depth, undefined, row$1.parentId); + newRow.subRows = recurseFilterRows(row$1.subRows, depth + 1); + row$1 = newRow; + } + rows.push(row$1); + newFilteredFlatRows.push(row$1); + newFilteredRowsById[row$1.id] = row$1; + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; +} + +exports.filterRows = filterRows; +//# sourceMappingURL=filterRowsUtils.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.js.map b/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.js.map new file mode 100644 index 00000000..95022d68 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/filterRowsUtils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filterRowsUtils.js","sources":["../../../src/utils/filterRowsUtils.ts"],"sourcesContent":["import { createRow } from '../core/row'\nimport { Row, RowModel, Table, RowData } from '../types'\n\nexport function filterRows(\n rows: Row[],\n filterRowImpl: (row: Row) => any,\n table: Table\n) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table)\n }\n\n return filterRowModelFromRoot(rows, filterRowImpl, table)\n}\n\nfunction filterRowModelFromLeafs(\n rowsToFilter: Row[],\n filterRow: (row: Row) => Row[],\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n const rows: Row[] = []\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.columnFilters = row.columnFilters\n\n if (row.subRows?.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n } else {\n row = newRow\n if (filterRow(row)) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n }\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n\nfunction filterRowModelFromRoot(\n rowsToFilter: Row[],\n filterRow: (row: Row) => any,\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n // Filters top level and nested rows\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n // Filter from parents downward first\n\n const rows: Row[] = []\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const pass = filterRow(row)\n\n if (pass) {\n if (row.subRows?.length && depth < maxDepth) {\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n }\n\n rows.push(row)\n newFilteredFlatRows.push(row)\n newFilteredRowsById[row.id] = row\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n"],"names":["filterRows","rows","filterRowImpl","table","options","filterFromLeafRows","filterRowModelFromLeafs","filterRowModelFromRoot","rowsToFilter","filterRow","_table$options$maxLea","newFilteredFlatRows","newFilteredRowsById","maxDepth","maxLeafRowFilterDepth","recurseFilterRows","depth","i","length","_row$subRows","row","newRow","createRow","id","original","index","undefined","parentId","columnFilters","subRows","push","flatRows","rowsById","_table$options$maxLea2","pass","_row$subRows2"],"mappings":";;;;;;;;;;;;;;AAGO,SAASA,UAAUA,CACxBC,IAAkB,EAClBC,aAAuC,EACvCC,KAAmB,EACnB;AACA,EAAA,IAAIA,KAAK,CAACC,OAAO,CAACC,kBAAkB,EAAE;AACpC,IAAA,OAAOC,uBAAuB,CAACL,IAAI,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAA;AAC5D,GAAA;AAEA,EAAA,OAAOI,sBAAsB,CAACN,IAAI,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAA;AAC3D,CAAA;AAEA,SAASG,uBAAuBA,CAC9BE,YAA0B,EAC1BC,SAA4C,EAC5CN,KAAmB,EACF;AAAA,EAAA,IAAAO,qBAAA,CAAA;EACjB,MAAMC,mBAAiC,GAAG,EAAE,CAAA;EAC5C,MAAMC,mBAA+C,GAAG,EAAE,CAAA;AAC1D,EA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C,CAAA;AAC7BR,QAAAA,mBAAmB,CAACQ,KAAG,CAACG,EAAE,CAAC,GAAGH,KAAG,CAAA;AACnC,OAAA;AACF,KAAA;AAEA,IAAA,OAAOnB,IAAI,CAAA;GACZ,CAAA;EAED,OAAO;AACLA,IAAAA,IAAI,EAAEc,iBAAiB,CAACP,YAAY,CAAC;AACrCuB,IAAAA,QAAQ,EAAEpB,mBAAmB;AAC7BqB,IAAAA,QAAQ,EAAEpB,mBAAAA;GACX,CAAA;AACH;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.d.ts new file mode 100644 index 00000000..2ed311ba --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.d.ts @@ -0,0 +1,2 @@ +import { Table, RowModel, RowData } from '../types'; +export declare function getCoreRowModel(): (table: Table) => () => RowModel; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.js b/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.js new file mode 100644 index 00000000..27832829 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.js @@ -0,0 +1,65 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var row = require('../core/row.js'); +var utils = require('../utils.js'); + +function getCoreRowModel() { + return table => utils.memo(() => [table.options.data], data => { + const rowModel = { + rows: [], + flatRows: [], + rowsById: {} + }; + const accessRows = function (originalRows, depth, parentRow) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + for (let i = 0; i < originalRows.length; i++) { + // This could be an expensive check at scale, so we should move it somewhere else, but where? + // if (!id) { + // if (process.env.NODE_ENV !== 'production') { + // throw new Error(`getRowId expected an ID, but got ${id}`) + // } + // } + + // Make the row + const row$1 = row.createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id); + + // Keep track of every row in a flat array + rowModel.flatRows.push(row$1); + // Also keep track of every row by its ID + rowModel.rowsById[row$1.id] = row$1; + // Push table row into parent + rows.push(row$1); + + // Get the original subrows + if (table.options.getSubRows) { + var _row$originalSubRows; + row$1.originalSubRows = table.options.getSubRows(originalRows[i], i); + + // Then recursively access them + if ((_row$originalSubRows = row$1.originalSubRows) != null && _row$originalSubRows.length) { + row$1.subRows = accessRows(row$1.originalSubRows, depth + 1, row$1); + } + } + } + return rows; + }; + rowModel.rows = accessRows(data); + return rowModel; + }, utils.getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex())); +} + +exports.getCoreRowModel = getCoreRowModel; +//# sourceMappingURL=getCoreRowModel.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.js.map new file mode 100644 index 00000000..06df8781 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getCoreRowModel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getCoreRowModel.js","sources":["../../../src/utils/getCoreRowModel.ts"],"sourcesContent":["import { createRow } from '../core/row'\nimport { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getCoreRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.options.data],\n (\n data\n ): {\n rows: Row[]\n flatRows: Row[]\n rowsById: Record>\n } => {\n const rowModel: RowModel = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: TData[],\n depth = 0,\n parentRow?: Row\n ): Row[] => {\n const rows = [] as Row[]\n\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(\n table,\n table._getRowId(originalRows[i]!, i, parentRow),\n originalRows[i]!,\n i,\n depth,\n undefined,\n parentRow?.id\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(\n originalRows[i]!,\n i\n )\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n"],"names":["getCoreRowModel","table","memo","options","data","rowModel","rows","flatRows","rowsById","accessRows","originalRows","depth","parentRow","i","length","row","createRow","_getRowId","undefined","id","push","getSubRows","_row$originalSubRows","originalSubRows","subRows","getMemoOptions","_autoResetPageIndex"],"mappings":";;;;;;;;;;;;;;;AAIO,SAASA,eAAeA,GAEJ;AACzB,EAAA,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CAACD,KAAK,CAACE,OAAO,CAACC,IAAI,CAAC,EAExBA,IAAI,IAKD;AACH,IAAA,MAAMC,QAAyB,GAAG;AAChCC,MAAAA,IAAI,EAAE,EAAE;AACRC,MAAAA,QAAQ,EAAE,EAAE;AACZC,MAAAA,QAAQ,EAAE,EAAC;KACZ,CAAA;IAED,MAAMC,UAAU,GAAG,UACjBC,YAAqB,EACrBC,KAAK,EACLC,SAAsB,EACL;AAAA,MAAA,IAFjBD,KAAK,KAAA,KAAA,CAAA,EAAA;AAALA,QAAAA,KAAK,GAAG,CAAC,CAAA;AAAA,OAAA;MAGT,MAAML,IAAI,GAAG,EAAkB,CAAA;AAE/B,MAAA,KAAK,IAAIO,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,YAAY,CAACI,MAAM,EAAED,CAAC,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AK,CAACE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MACzDF,KAAK,CAACyB,mBAAmB,EAC3B,CACF,CAAC,CAAA;AACL;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.d.ts new file mode 100644 index 00000000..fe262eff --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.d.ts @@ -0,0 +1,7 @@ +import { Table, Row, RowModel, RowData } from '../types'; +export declare function getExpandedRowModel(): (table: Table) => () => RowModel; +export declare function expandRows(rowModel: RowModel): { + rows: Row[]; + flatRows: Row[]; + rowsById: Record>; +}; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.js b/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.js new file mode 100644 index 00000000..df49fbf8 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.js @@ -0,0 +1,46 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +function getExpandedRowModel() { + return table => utils.memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => { + if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) { + return rowModel; + } + if (!paginateExpandedRows) { + // Only expand rows at this point if they are being paginated + return rowModel; + } + return expandRows(rowModel); + }, utils.getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')); +} +function expandRows(rowModel) { + const expandedRows = []; + const handleRow = row => { + var _row$subRows; + expandedRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) { + row.subRows.forEach(handleRow); + } + }; + rowModel.rows.forEach(handleRow); + return { + rows: expandedRows, + flatRows: rowModel.flatRows, + rowsById: rowModel.rowsById + }; +} + +exports.expandRows = expandRows; +exports.getExpandedRowModel = getExpandedRowModel; +//# sourceMappingURL=getExpandedRowModel.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.js.map new file mode 100644 index 00000000..51bd8e82 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getExpandedRowModel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getExpandedRowModel.js","sources":["../../../src/utils/getExpandedRowModel.ts"],"sourcesContent":["import { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getExpandedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().expanded,\n table.getPreExpandedRowModel(),\n table.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel\n }\n\n return expandRows(rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')\n )\n}\n\nexport function expandRows(rowModel: RowModel) {\n const expandedRows: Row[] = []\n\n const handleRow = (row: Row) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n"],"names":["getExpandedRowModel","table","memo","getState","expanded","getPreExpandedRowModel","options","paginateExpandedRows","rowModel","rows","length","Object","keys","expandRows","getMemoOptions","expandedRows","handleRow","row","_row$subRows","push","subRows","getIsExpanded","forEach","flatRows","rowsById"],"mappings":";;;;;;;;;;;;;;AAGO,SAASA,mBAAmBA,GAER;AACzB,EAAA,OAA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,EAAEf,QAAQ,CAACe,QAAQ;IAC3BC,QAAQ,EAAEhB,QAAQ,CAACgB,QAAAA;GACpB,CAAA;AACH;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.d.ts new file mode 100644 index 00000000..bfecb73c --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.d.ts @@ -0,0 +1,2 @@ +import { Table, RowData } from '../types'; +export declare function getFacetedMinMaxValues(): (table: Table, columnId: string) => () => undefined | [number, number]; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.js b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.js new file mode 100644 index 00000000..68baffed --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.js @@ -0,0 +1,36 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +function getFacetedMinMaxValues() { + return (table, columnId) => utils.memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return undefined; + const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => { + var _flatRow$getUniqueVal; + return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : []; + }).map(Number).filter(value => !Number.isNaN(value)); + if (!uniqueValues.length) return; + let facetedMinValue = uniqueValues[0]; + let facetedMaxValue = uniqueValues[uniqueValues.length - 1]; + for (const value of uniqueValues) { + if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value; + } + return [facetedMinValue, facetedMaxValue]; + }, utils.getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')); +} + +exports.getFacetedMinMaxValues = getFacetedMinMaxValues; +//# sourceMappingURL=getFacetedMinMaxValues.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.js.map new file mode 100644 index 00000000..0e2cff21 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedMinMaxValues.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFacetedMinMaxValues.js","sources":["../../../src/utils/getFacetedMinMaxValues.ts"],"sourcesContent":["import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedMinMaxValues(): (\n table: Table,\n columnId: string\n) => () => undefined | [number, number] {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return undefined\n\n const uniqueValues = facetedRowModel.flatRows\n .flatMap(flatRow => flatRow.getUniqueValues(columnId) ?? [])\n .map(Number)\n .filter(value => !Number.isNaN(value))\n\n if (!uniqueValues.length) return\n\n let facetedMinValue = uniqueValues[0]!\n let facetedMaxValue = uniqueValues[uniqueValues.length - 1]!\n\n for (const value of uniqueValues) {\n if (value < facetedMinValue) facetedMinValue = value\n else if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n return [facetedMinValue, facetedMaxValue]\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')\n )\n}\n"],"names":["getFacetedMinMaxValues","table","columnId","memo","_table$getColumn","getColumn","getFacetedRowModel","facetedRowModel","undefined","uniqueValues","flatRows","flatMap","flatRow","_flatRow$getUniqueVal","getUniqueValues","map","Number","filter","value","isNaN","length","facetedMinValue","facetedMaxValue","getMemoOptions","options"],"mappings":";;;;;;;;;;;;;;AAGO,SAASA,sBAAsBA,GAGE;AACtC,EAAA,OAAO,CAACC,KAAK,EAAEC,QAAQ,KACrBC,UAAI,CACF,MAAA;AA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.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.d.ts new file mode 100644 index 00000000..174725fd --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.d.ts @@ -0,0 +1,2 @@ +import { Table, RowModel, RowData } from '../types'; +export declare function getFacetedRowModel(): (table: Table, columnId: string) => () => RowModel; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.js b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.js new file mode 100644 index 00000000..5f2166ba --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.js @@ -0,0 +1,36 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); +var filterRowsUtils = require('./filterRowsUtils.js'); + +function getFacetedRowModel() { + return (table, columnId) => utils.memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => { + if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + return preRowModel; + } + const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean); + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + return filterRowsUtils.filterRows(preRowModel.rows, filterRowsImpl, table); + }, utils.getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')); +} + +exports.getFacetedRowModel = getFacetedRowModel; +//# sourceMappingURL=getFacetedRowModel.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.js.map new file mode 100644 index 00000000..2da1b579 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedRowModel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFacetedRowModel.js","sources":["../../../src/utils/getFacetedRowModel.ts"],"sourcesContent":["import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFacetedRowModel(): (\n table: Table,\n columnId: string\n) => () => RowModel {\n return (table, columnId) =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n table.getFilteredRowModel(),\n ],\n (preRowModel, columnFilters, globalFilter) => {\n if (\n !preRowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n return preRowModel\n }\n\n const filterableIds = [\n ...columnFilters.map(d => d.id).filter(d => d !== columnId),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as string[]\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')\n )\n}\n"],"names":["getFacetedRowModel","table","columnId","memo","getPreFilteredRowModel","getState","columnFilters","globalFilter","getFilteredRowModel","preRowModel","rows","length","filterableIds","map","d","id","filter","undefined","Boolean","filterRowsImpl","row","i","filterRows","getMemoOptions","options"],"mappings":";;;;;;;;;;;;;;;AAIO,SAASA,kBAAkBA,GAGP;EACzB,OAAO,CAACC,KAAK,EAAEC,QAAQ,KACrBC,UAAI,CACF,MAAM,CACJF,KAAK,CAACG,sBAAsB,EAAE,EAC9BH,KAAK,CAACI,QAAQ,EAAE,CAACC,aAAa,EAC9BL,KAAK,CAACI,QAAQ,EAAE,CAACE,YAAY,EAC7BN,KAAK,CAACO,mBAAmB,EAAE,CAC5B,EACD,CAACC,WAAW,EAAEH,aAAa,EAAEC,YAAY,KAAK;AAC5C,IAAA,IACE,CAACE,WAAW,CAACC,IAAI,CAACC,MAAM,IACvB,EAACL,aAAa,IAAA,IAAA,IAAbA,aAAa,CAAEK,MAAM,CAAI,IAAA,CAACJ,YAAa,EACzC;AACA,MAAA,OAAOE,WAAW,CAAA;AACpB,KAAA;AAEA,IAAA,MAAMG,aAAa,GAAG,CACpB,GAAGN,aAAa,CAACO,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,EAAE,CAAC,CAACC,MAAM,CAACF,CAAC,IAAIA,CAAC,KAAKZ,QAAQ,CAAC,EAC3DK,YAAY,GAAG,YAAY,GAAGU,SAAS,CACxC,CAACD,MAAM,CAACE,OAAO,CAAa,CAAA;IAE7B,MAAMC,cAAc,GAAIC,GAAe,IAAK;AAC1C;AACA,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGT,aAAa,CAACD,MAAM,EAAEU,CAAC,EAAE,EAAE;QAC7C,IAAID,GAAG,CAACd,aAAa,CAACM,aAAa,CAACS,CAAC,CAAC,CAAE,KAAK,KAAK,EAAE;AAClD,UAAA,OAAO,KAAK,CAAA;AACd,SAAA;AACF,OAAA;AACA,MAAA,OAAO,IAAI,CAAA;KACZ,CAAA;IAED,OAAOC,0BAAU,CAACb,WAAW,CAACC,IAAI,EAAES,cAAc,EAAElB,KAAK,CAAC,CAAA;GAC3D,EACDsB,oBAAc,CAACtB,KAAK,CAACuB,OAAO,EAAE,YAAY,EAAE,oBAAoB,CAClE,CAAC,CAAA;AACL;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.d.ts new file mode 100644 index 00000000..539a2596 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.d.ts @@ -0,0 +1,2 @@ +import { Table, RowData } from '../types'; +export declare function getFacetedUniqueValues(): (table: Table, columnId: string) => () => Map; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.js b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.js new file mode 100644 index 00000000..44828b28 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.js @@ -0,0 +1,39 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +function getFacetedUniqueValues() { + return (table, columnId) => utils.memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return new Map(); + let facetedUniqueValues = new Map(); + for (let i = 0; i < facetedRowModel.flatRows.length; i++) { + const values = facetedRowModel.flatRows[i].getUniqueValues(columnId); + for (let j = 0; j < values.length; j++) { + const value = values[j]; + if (facetedUniqueValues.has(value)) { + var _facetedUniqueValues$; + facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1); + } else { + facetedUniqueValues.set(value, 1); + } + } + } + return facetedUniqueValues; + }, utils.getMemoOptions(table.options, 'debugTable', `getFacetedUniqueValues_${columnId}`)); +} + +exports.getFacetedUniqueValues = getFacetedUniqueValues; +//# sourceMappingURL=getFacetedUniqueValues.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.js.map new file mode 100644 index 00000000..46fae738 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFacetedUniqueValues.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFacetedUniqueValues.js","sources":["../../../src/utils/getFacetedUniqueValues.ts"],"sourcesContent":["import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedUniqueValues(): (\n table: Table,\n columnId: string\n) => () => Map {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return new Map()\n\n let facetedUniqueValues = new Map()\n\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values =\n facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]!\n\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n },\n getMemoOptions(\n table.options,\n 'debugTable',\n `getFacetedUniqueValues_${columnId}`\n )\n )\n}\n"],"names":["getFacetedUniqueValues","table","columnId","memo","_table$getColumn","getColumn","getFacetedRowModel","facetedRowModel","Map","facetedUniqueValues","i","flatRows","length","values","getUniqueValues","j","value","has","_facetedUniqueValues$","set","get","getMemoOptions","options"],"mappings":";;;;;;;;;;;;;;AAGO,SAASA,sBAAsBA,GAGV;AAC1B,EAAA,OAAO,CAACC,KAAK,EAAEC,QAAQ,KACrBC,UAAI,CACF,MAAA;AAAA,IAAA,IAAAC,gBAAA,CAAA;AAAA,IAAA,OAAM,CAAAA,CAAAA,gBAAA,GAACH,KAAK,CAACI,SAAS,CAACH,QAAQ,CAAC,qBAAzBE,gBAAA,CAA2BE,kBAAkB,EAAE,CAAC,CAAA;AAAA,GAAA,EACvDC,eAAe,IAAI;AACjB,IAAA,IAAI,CAACA,eAAe,EAAE,OAAO,IAAIC,GAAG,EAAE,CAAA;AAEtC,IAAA,IAAIC,mBAAmB,GAAG,IAAID,GAAG,EAAe,CAAA;AAEhD,IAAA,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,eAAe,CAACI,QAAQ,CAACC,MAAM,EAAEF,CAAC,EAAE,EAAE;AACxD,MAAA,MAAMG,MAAM,GACVN,eAAe,CAACI,QAAQ,CAACD,CAAC,CAAC,CAAEI,eAAe,CAASZ,QAAQ,CAAC,CAAA;AAEhE,MAAA,KAAK,IAAIa,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,CAACD,MAAM,EAAEG,CAAC,EAAE,EAAE;AACtC,QAAA,MAAMC,KAAK,GAAGH,MAAM,CAACE,CAAC,CAAE,CAAA;AAExB,QAAA,IAAIN,mBAAmB,CAACQ,GAAG,CAACD,KAAK,CAAC,EAAE;AAAA,UAAA,IAAAE,qBAAA,CAAA;UAClCT,mBAAmB,CAACU,GAAG,CACrBH,KAAK,EACL,CAAAE,CAAAA,qBAAA,GAACT,mBAAmB,CAACW,GAAG,CAACJ,KAAK,CAAC,KAAAE,IAAAA,GAAAA,qBAAA,GAAI,CAAC,IAAI,CAC1C,CAAC,CAAA;AACH,SAAC,MAAM;AACLT,UAAAA,mBAAmB,CAACU,GAAG,CAACH,KAAK,EAAE,CAAC,CAAC,CAAA;AACnC,SAAA;AACF,OAAA;AACF,KAAA;AAEA,IAAA,OAAOP,mBAAmB,CAAA;AAC5B,GAAC,EACDY,oBAAc,CACZpB,KAAK,CAACqB,OAAO,EACb,YAAY,EACZ,CAAA,uBAAA,EAA0BpB,QAAQ,CAAA,CACpC,CACF,CAAC,CAAA;AACL;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.d.ts new file mode 100644 index 00000000..f73b41a3 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.d.ts @@ -0,0 +1,2 @@ +import { Table, RowModel, RowData } from '../types'; +export declare function getFilteredRowModel(): (table: Table) => () => RowModel; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.js b/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.js new file mode 100644 index 00000000..3c2c3c48 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.js @@ -0,0 +1,111 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); +var filterRowsUtils = require('./filterRowsUtils.js'); + +function getFilteredRowModel() { + return table => utils.memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => { + if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + for (let i = 0; i < rowModel.flatRows.length; i++) { + rowModel.flatRows[i].columnFilters = {}; + rowModel.flatRows[i].columnFiltersMeta = {}; + } + return rowModel; + } + const resolvedColumnFilters = []; + const resolvedGlobalFilters = []; + (columnFilters != null ? columnFilters : []).forEach(d => { + var _filterFn$resolveFilt; + const column = table.getColumn(d.id); + if (!column) { + return; + } + const filterFn = column.getFilterFn(); + if (!filterFn) { + if (process.env.NODE_ENV !== 'production') { + console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`); + } + return; + } + resolvedColumnFilters.push({ + id: d.id, + filterFn, + resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value + }); + }); + const filterableIds = (columnFilters != null ? columnFilters : []).map(d => d.id); + const globalFilterFn = table.getGlobalFilterFn(); + const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter()); + if (globalFilter && globalFilterFn && globallyFilterableColumns.length) { + filterableIds.push('__global__'); + globallyFilterableColumns.forEach(column => { + var _globalFilterFn$resol; + resolvedGlobalFilters.push({ + id: column.id, + filterFn: globalFilterFn, + resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter + }); + }); + } + let currentColumnFilter; + let currentGlobalFilter; + + // Flag the prefiltered row model with each filter state + for (let j = 0; j < rowModel.flatRows.length; j++) { + const row = rowModel.flatRows[j]; + row.columnFilters = {}; + if (resolvedColumnFilters.length) { + for (let i = 0; i < resolvedColumnFilters.length; i++) { + currentColumnFilter = resolvedColumnFilters[i]; + const id = currentColumnFilter.id; + + // Tag the row with the column filter state + row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + }); + } + } + if (resolvedGlobalFilters.length) { + for (let i = 0; i < resolvedGlobalFilters.length; i++) { + currentGlobalFilter = resolvedGlobalFilters[i]; + const id = currentGlobalFilter.id; + // Tag the row with the first truthy global filter state + if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + })) { + row.columnFilters.__global__ = true; + break; + } + } + if (row.columnFilters.__global__ !== true) { + row.columnFilters.__global__ = false; + } + } + } + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + + // Filter final rows using all of the active filters + return filterRowsUtils.filterRows(rowModel.rows, filterRowsImpl, table); + }, utils.getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => table._autoResetPageIndex())); +} + +exports.getFilteredRowModel = getFilteredRowModel; +//# sourceMappingURL=getFilteredRowModel.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.js.map new file mode 100644 index 00000000..8f562ea1 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getFilteredRowModel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFilteredRowModel.js","sources":["../../../src/utils/getFilteredRowModel.ts"],"sourcesContent":["import { ResolvedColumnFilter } from '../features/ColumnFiltering'\nimport { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFilteredRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n ],\n (rowModel, columnFilters, globalFilter) => {\n if (\n !rowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i]!.columnFilters = {}\n rowModel.flatRows[i]!.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: ResolvedColumnFilter[] = []\n const resolvedGlobalFilters: ResolvedColumnFilter[] = []\n\n ;(columnFilters ?? []).forEach(d => {\n const column = table.getColumn(d.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column.getFilterFn()\n\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`\n )\n }\n return\n }\n\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: filterFn.resolveFilterValue?.(d.value) ?? d.value,\n })\n })\n\n const filterableIds = (columnFilters ?? []).map(d => d.id)\n\n const globalFilterFn = table.getGlobalFilterFn()\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter(column => column.getCanGlobalFilter())\n\n if (\n globalFilter &&\n globalFilterFn &&\n globallyFilterableColumns.length\n ) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach(column => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ??\n globalFilter,\n })\n })\n }\n\n let currentColumnFilter\n let currentGlobalFilter\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j]!\n\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n"],"names":["getFilteredRowModel","table","memo","getPreFilteredRowModel","getState","columnFilters","globalFilter","rowModel","rows","length","i","flatRows","columnFiltersMeta","resolvedColumnFilters","resolvedGlobalFilters","forEach","d","_filterFn$resolveFilt","column","getColumn","id","filterFn","getFilterFn","process","env","NODE_ENV","console","warn","push","resolvedValue","resolveFilterValue","value","filterableIds","map","globalFilterFn","getGlobalFilterFn","globallyFilterableColumns","getAllLeafColumns","filter","getCanGlobalFilter","_globalFilterFn$resol","currentColumnFilter","currentGlobalFilter","j","row","filterMeta","__global__","filterRowsImpl","filterRows","getMemoOptions","options","_autoResetPageIndex"],"mappings":";;;;;;;;;;;;;;;AAKO,SAASA,mBAAmBA,GAER;AACzB,EAAA,OAAOC,KAAK,IACVC,UAAI,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tB,EAAE,CAAA;AACjC;AACA,UAAA,IACEsB,mBAAmB,CAACrB,QAAQ,CAC1BuB,GAAG,EACHxB,EAAE,EACFsB,mBAAmB,CAACb,aAAa,EACjCgB,UAAU,IAAI;AACZD,YAAAA,GAAG,CAAChC,iBAAiB,CAACQ,EAAE,CAAC,GAAGyB,UAAU,CAAA;AACxC,WACF,CAAC,EACD;AACAD,YAAAA,GAAG,CAACvC,aAAa,CAACyC,UAAU,GAAG,IAAI,CAAA;AACnC,YAAA,MAAA;AACF,WAAA;AACF,SAAA;AAEA,QAAA,IAAIF,GAAG,CAACvC,aAAa,CAACyC,UAAU,KAAK,IAAI,EAAE;AACzCF,UAAAA,GAAG,CAACvC,aAAa,CAACyC,UAAU,GAAG,KAAK,CAAA;AACtC,SAAA;AACF,OAAA;AACF,KAAA;IAEA,MAAMC,cAAc,GAAIH,GAAe,IAAK;AAC1C;AACA,MAAA,KAAK,IAAIlC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGsB,aAAa,CAACvB,MAAM,EAAEC,CAAC,EAAE,EAAE;QAC7C,IAAIkC,GAAG,CAACvC,aAAa,CAAC2B,aAAa,CAACtB,CAAC,CAAC,CAAE,KAAK,KAAK,EAAE;AAClD,UAAA,OAAO,KAAK,CAAA;AACd,SAAA;AACF,OAAA;AACA,MAAA,OAAO,IAAI,CAAA;KACZ,CAAA;;AAED;IACA,OAAOsC,0BAAU,CAACzC,QAAQ,CAACC,IAAI,EAAEuC,cAAc,EAAE9C,KAAK,CAAC,CAAA;AACzD,GAAC,EACDgD,oBAAc,CAAChD,KAAK,CAACiD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MACjEjD,KAAK,CAACkD,mBAAmB,EAC3B,CACF,CAAC,CAAA;AACL;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.d.ts new file mode 100644 index 00000000..adae36c0 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.d.ts @@ -0,0 +1,2 @@ +import { RowData, RowModel, Table } from '../types'; +export declare function getGroupedRowModel(): (table: Table) => () => RowModel; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.js b/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.js new file mode 100644 index 00000000..2b067397 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.js @@ -0,0 +1,157 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var row = require('../core/row.js'); +var utils = require('../utils.js'); + +function getGroupedRowModel() { + return table => utils.memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { + if (!rowModel.rows.length || !grouping.length) { + rowModel.rows.forEach(row => { + row.depth = 0; + row.parentId = undefined; + }); + return rowModel; + } + + // Filter the grouping list down to columns that exist + const existingGrouping = grouping.filter(columnId => table.getColumn(columnId)); + const groupedFlatRows = []; + const groupedRowsById = {}; + // const onlyGroupedFlatRows: Row[] = []; + // const onlyGroupedRowsById: Record = {}; + // const nonGroupedFlatRows: Row[] = []; + // const nonGroupedRowsById: Record = {}; + + // Recursively group the data + const groupUpRecursively = function (rows, depth, parentId) { + if (depth === void 0) { + depth = 0; + } + // Grouping depth has been been met + // Stop grouping and simply rewrite thd depth and row relationships + if (depth >= existingGrouping.length) { + return rows.map(row => { + row.depth = depth; + groupedFlatRows.push(row); + groupedRowsById[row.id] = row; + if (row.subRows) { + row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id); + } + return row; + }); + } + const columnId = existingGrouping[depth]; + + // Group the rows together for this level + const rowGroupsMap = groupBy(rows, columnId); + + // Perform aggregations for each group + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { + let [groupingValue, groupedRows] = _ref; + let id = `${columnId}:${groupingValue}`; + id = parentId ? `${parentId}>${id}` : id; + + // First, Recurse to group sub rows before aggregation + const subRows = groupUpRecursively(groupedRows, depth + 1, id); + subRows.forEach(subRow => { + subRow.parentId = id; + }); + + // Flatten the leaf rows of the rows in this group + const leafRows = depth ? utils.flattenBy(groupedRows, row => row.subRows) : groupedRows; + const row$1 = row.createRow(table, id, leafRows[0].original, index, depth, undefined, parentId); + Object.assign(row$1, { + groupingColumnId: columnId, + groupingValue, + subRows, + leafRows, + getValue: columnId => { + // Don't aggregate columns that are in the grouping + if (existingGrouping.includes(columnId)) { + if (row$1._valuesCache.hasOwnProperty(columnId)) { + return row$1._valuesCache[columnId]; + } + if (groupedRows[0]) { + var _groupedRows$0$getVal; + row$1._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined; + } + return row$1._valuesCache[columnId]; + } + if (row$1._groupingValuesCache.hasOwnProperty(columnId)) { + return row$1._groupingValuesCache[columnId]; + } + + // Aggregate the values + const column = table.getColumn(columnId); + const aggregateFn = column == null ? void 0 : column.getAggregationFn(); + if (aggregateFn) { + row$1._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows); + return row$1._groupingValuesCache[columnId]; + } + } + }); + subRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return row$1; + }); + return aggregatedGroupedRows; + }; + const groupedRows = groupUpRecursively(rowModel.rows, 0); + groupedRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return { + rows: groupedRows, + flatRows: groupedFlatRows, + rowsById: groupedRowsById + }; + }, utils.getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => { + table._queue(() => { + table._autoResetExpanded(); + table._autoResetPageIndex(); + }); + })); +} +function groupBy(rows, columnId) { + const groupMap = new Map(); + return rows.reduce((map, row) => { + const resKey = `${row.getGroupingValue(columnId)}`; + const previous = map.get(resKey); + if (!previous) { + map.set(resKey, [row]); + } else { + previous.push(row); + } + return map; + }, groupMap); +} + +exports.getGroupedRowModel = getGroupedRowModel; +//# sourceMappingURL=getGroupedRowModel.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.js.map new file mode 100644 index 00000000..506a5480 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getGroupedRowModel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getGroupedRowModel.js","sources":["../../../src/utils/getGroupedRowModel.ts"],"sourcesContent":["import { createRow } from '../core/row'\nimport { Row, RowData, RowModel, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { GroupingState } from '../features/ColumnGrouping'\n\nexport function getGroupedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().grouping, table.getPreGroupedRowModel()],\n (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n rowModel.rows.forEach(row => {\n row.depth = 0\n row.parentId = undefined\n })\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId =>\n table.getColumn(columnId)\n )\n\n const groupedFlatRows: Row[] = []\n const groupedRowsById: Record> = {}\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Row[],\n depth = 0,\n parentId?: string\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId: string = existingGrouping[depth]!\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n subRows.forEach(subRow => {\n subRow.parentId = id\n })\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, row => row.subRows)\n : groupedRows\n\n const row = createRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId\n )\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (columnId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[columnId] =\n groupedRows[0].getValue(columnId) ?? undefined\n }\n\n return row._valuesCache[columnId]\n }\n\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId)\n const aggregateFn = column?.getAggregationFn()\n\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(\n columnId,\n leafRows,\n groupedRows\n )\n\n return row._groupingValuesCache[columnId]\n }\n },\n })\n\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return row\n }\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {\n table._queue(() => {\n table._autoResetExpanded()\n table._autoResetPageIndex()\n })\n })\n )\n}\n\nfunction groupBy(rows: Row[], columnId: string) {\n const groupMap = new Map[]>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n"],"names":["getGroupedRowModel","table","memo","getState","grouping","getPreGroupedRowModel","rowModel","rows","length","forEach","row","depth","parentId","undefined","existingGrouping","filter","columnId","getColumn","groupedFlatRows","groupedRowsById","groupUpRecursively","map","push","id","subRows","rowGroupsMap","groupBy","aggregatedGroupedRows","Array","from","entries","_ref","index","groupingValue","groupedRows","subRow","leafRows","flattenBy","createRow","original","Object","assign","groupingColumnId","getValue","includes","_valuesCache","hasOwnProperty","_groupedRows$0$getVal","_groupingValuesCache","column","aggregateFn","getAggregationFn","flatRows","rowsById","getMemoOptions","options","_queue","_autoResetExpanded","_autoResetPageIndex","groupMap","Map","reduce","resKey","getGroupingValue","previous","get","set"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AACwD,kBAAkB,EAAE,CAAA;MAC1BxD,KAAK,CAACyD,mBAAmB,EAAE,CAAA;AAC7B,KAAC,CAAC,CAAA;AACJ,GAAC,CACH,CAAC,CAAA;AACL,CAAA;AAEA,SAAShC,OAAOA,CAAwBnB,IAAkB,EAAES,QAAgB,EAAE;AAC5E,EAAA,MAAM2C,QAAQ,GAAG,IAAIC,GAAG,EAAqB,CAAA;EAE7C,OAAOrD,IAAI,CAACsD,MAAM,CAAC,CAACxC,GAAG,EAAEX,GAAG,KAAK;IAC/B,MAAMoD,MAAM,GAAG,CAAGpD,EAAAA,GAAG,CAACqD,gBAAgB,CAAC/C,QAAQ,CAAC,CAAE,CAAA,CAAA;AAClD,IAAA,MAAMgD,QAAQ,GAAG3C,GAAG,CAAC4C,GAAG,CAACH,MAAM,CAAC,CAAA;IAChC,IAAI,CAACE,QAAQ,EAAE;MACb3C,GAAG,CAAC6C,GAAG,CAACJ,MAAM,EAAE,CAACpD,GAAG,CAAC,CAAC,CAAA;AACxB,KAAC,MAAM;AACLsD,MAAAA,QAAQ,CAAC1C,IAAI,CAACZ,GAAG,CAAC,CAAA;AACpB,KAAA;AACA,IAAA,OAAOW,GAAG,CAAA;GACX,EAAEsC,QAAQ,CAAC,CAAA;AACd;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.d.ts new file mode 100644 index 00000000..3f5257c3 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.d.ts @@ -0,0 +1,4 @@ +import { Table, RowModel, RowData } from '../types'; +export declare function getPaginationRowModel(opts?: { + initialSync: boolean; +}): (table: Table) => () => RowModel; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.js b/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.js new file mode 100644 index 00000000..7a6c6302 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.js @@ -0,0 +1,60 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); +var getExpandedRowModel = require('./getExpandedRowModel.js'); + +function getPaginationRowModel(opts) { + return table => utils.memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => { + if (!rowModel.rows.length) { + return rowModel; + } + const { + pageSize, + pageIndex + } = pagination; + let { + rows, + flatRows, + rowsById + } = rowModel; + const pageStart = pageSize * pageIndex; + const pageEnd = pageStart + pageSize; + rows = rows.slice(pageStart, pageEnd); + let paginatedRowModel; + if (!table.options.paginateExpandedRows) { + paginatedRowModel = getExpandedRowModel.expandRows({ + rows, + flatRows, + rowsById + }); + } else { + paginatedRowModel = { + rows, + flatRows, + rowsById + }; + } + paginatedRowModel.flatRows = []; + const handleRow = row => { + paginatedRowModel.flatRows.push(row); + if (row.subRows.length) { + row.subRows.forEach(handleRow); + } + }; + paginatedRowModel.rows.forEach(handleRow); + return paginatedRowModel; + }, utils.getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')); +} + +exports.getPaginationRowModel = getPaginationRowModel; +//# sourceMappingURL=getPaginationRowModel.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.js.map new file mode 100644 index 00000000..e2b981f8 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getPaginationRowModel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getPaginationRowModel.js","sources":["../../../src/utils/getPaginationRowModel.ts"],"sourcesContent":["import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel(opts?: {\n initialSync: boolean\n}): (table: Table) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().pagination,\n table.getPrePaginationRowModel(),\n table.options.paginateExpandedRows\n ? undefined\n : table.getState().expanded,\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n let paginatedRowModel: RowModel\n\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById,\n })\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById,\n }\n }\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row) => {\n paginatedRowModel.flatRows.push(row)\n if (row.subRows.length) {\n row.subRows.forEach(handleRow)\n }\n }\n\n paginatedRowModel.rows.forEach(handleRow)\n\n return paginatedRowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')\n )\n}\n"],"names":["getPaginationRowModel","opts","table","memo","getState","pagination","getPrePaginationRowModel","options","paginateExpandedRows","undefined","expanded","rowModel","rows","length","pageSize","pageIndex","flatRows","rowsById","pageStart","pageEnd","slice","paginatedRowModel","expandRows","handleRow","row","push","subRows","forEach","getMemoOptions"],"mappings":";;;;;;;;;;;;;;;AAIO,SAASA,qBAAqBA,CAAwBC,IAE5D,EAAkD;AACjD,EAAA,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CACJD,KAAK,CAACE,QAAQ,EAAE,CAACC,UAAU,EAC3BH,KAAK,CAACI,wBAAwB,EAAE,EAChCJ,KAAK,CAACK,OAAO,CAACC,oBAAoB,GAC9BC,SAAS,GACTP,KAAK,CAACE,QAAQ,EAAE,CAACM,QAAQ,CAC9B,EACD,CAACL,UAAU,EAAEM,QAAQ,KAAK;AACxB,IAAA,IAAI,CAACA,QAAQ,CAACC,IAAI,CAACC,MAAM,EAAE;AACzB,MAAA,OAAOF,Q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} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.d.ts b/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.d.ts new file mode 100644 index 00000000..e6a401f6 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.d.ts @@ -0,0 +1,2 @@ +import { Table, RowModel, RowData } from '../types'; +export declare function getSortedRowModel(): (table: Table) => () => RowModel; diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.js b/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.js new file mode 100644 index 00000000..96ff3cc8 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.js @@ -0,0 +1,102 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +'use strict'; + +var utils = require('../utils.js'); + +function getSortedRowModel() { + return table => utils.memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => { + if (!rowModel.rows.length || !(sorting != null && sorting.length)) { + return rowModel; + } + const sortingState = table.getState().sorting; + const sortedFlatRows = []; + + // Filter out sortings that correspond to non existing columns + const availableSorting = sortingState.filter(sort => { + var _table$getColumn; + return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort(); + }); + const columnInfoById = {}; + availableSorting.forEach(sortEntry => { + const column = table.getColumn(sortEntry.id); + if (!column) return; + columnInfoById[sortEntry.id] = { + sortUndefined: column.columnDef.sortUndefined, + invertSorting: column.columnDef.invertSorting, + sortingFn: column.getSortingFn() + }; + }); + const sortData = rows => { + // This will also perform a stable sorting using the row index + // if needed. + const sortedData = rows.map(row => ({ + ...row + })); + sortedData.sort((rowA, rowB) => { + for (let i = 0; i < availableSorting.length; i += 1) { + var _sortEntry$desc; + const sortEntry = availableSorting[i]; + const columnInfo = columnInfoById[sortEntry.id]; + const sortUndefined = columnInfo.sortUndefined; + const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false; + let sortInt = 0; + + // All sorting ints should always return in ascending order + if (sortUndefined) { + const aValue = rowA.getValue(sortEntry.id); + const bValue = rowB.getValue(sortEntry.id); + const aUndefined = aValue === undefined; + const bUndefined = bValue === undefined; + if (aUndefined || bUndefined) { + if (sortUndefined === 'first') return aUndefined ? -1 : 1; + if (sortUndefined === 'last') return aUndefined ? 1 : -1; + sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined; + } + } + if (sortInt === 0) { + sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id); + } + + // If sorting is non-zero, take care of desc and inversion + if (sortInt !== 0) { + if (isDesc) { + sortInt *= -1; + } + if (columnInfo.invertSorting) { + sortInt *= -1; + } + return sortInt; + } + } + return rowA.index - rowB.index; + }); + + // If there are sub-rows, sort them + sortedData.forEach(row => { + var _row$subRows; + sortedFlatRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length) { + row.subRows = sortData(row.subRows); + } + }); + return sortedData; + }; + return { + rows: sortData(rowModel.rows), + flatRows: sortedFlatRows, + rowsById: rowModel.rowsById + }; + }, utils.getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex())); +} + +exports.getSortedRowModel = getSortedRowModel; +//# sourceMappingURL=getSortedRowModel.js.map diff --git a/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.js.map b/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.js.map new file mode 100644 index 00000000..38066e5c --- /dev/null +++ b/node_modules/@tanstack/table-core/build/lib/utils/getSortedRowModel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getSortedRowModel.js","sources":["../../../src/utils/getSortedRowModel.ts"],"sourcesContent":["import { Table, Row, RowModel, RowData } from '../types'\nimport { SortingFn } from '../features/RowSorting'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getSortedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().sorting, table.getPreSortedRowModel()],\n (sorting, rowModel) => {\n if (!rowModel.rows.length || !sorting?.length) {\n return rowModel\n }\n\n const sortingState = table.getState().sorting\n\n const sortedFlatRows: Row[] = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort =>\n table.getColumn(sort.id)?.getCanSort()\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n invertSorting?: boolean\n sortingFn: SortingFn\n }\n > = {}\n\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn(),\n }\n })\n\n const sortData = (rows: Row[]) => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = rows.map(row => ({ ...row }))\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const sortUndefined = columnInfo.sortUndefined\n const isDesc = sortEntry?.desc ?? false\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1\n if (sortUndefined === 'last') return aUndefined ? 1 : -1\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? sortUndefined\n : -sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n sortedFlatRows.push(row)\n if (row.subRows?.length) {\n row.subRows = sortData(row.subRows)\n }\n })\n\n return sortedData\n }\n\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n"],"names":["getSortedRowModel","table","memo","getState","sorting","getPreSortedRowModel","rowModel","rows","length","sortingState","sortedFlatRows","availableSorting","filter","sort","_table$getColumn","getColumn","id","getCanSort","columnInfoById","forEach","sortEntry","column","sortUndefined","columnDef","invertSorting","sortingFn","getSortingFn","sortData","sortedData","map","row","rowA","rowB","i","_sortEntry$desc","columnInfo","isDesc","desc","sortInt","aValue","getValue","bValue","aUndefined","undefined","bUndefined","index","_row$subRows","push","subRows","flatRows","rowsById","getMemoOptions","options","_autoResetPageIndex"],"mappings":";;;;;;;;;;;;;;AAIO,SAASA,iBAAiBA,GAEN;EACzB,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CAACD,KAAK,CAACE,QAAQ,EAAE,CAACC,OAAO,EAAEH,KAAK,CAACI,oBAAoB,EAAE,CAAC,EAC9D,CAACD,OAAO,EAAEE,QAAQ,KAAK;AACrB,IAAA,IAAI,CAACA,QAAQ,CAACC,IAAI,CAACC,MAAM,IAAI,EAACJ,OAAO,IAAA,IAAA,IAAPA,OAAO,CAAEI,MAAM,CAAE,EAAA;AAC7C,MAAA,OAAOF,QAAQ,CAAA;AACjB,KAAA;IAEA,MAAMG,YAAY,GAAGR,KAAK,CAACE,QAAQ,EAAE,CAACC,OAAO,CAAA;IAE7C,MAAMM,cAA4B,GAAG,EAAE,CAAA;;AAEvC;AACA,IAAA,MAAMC,gBAAgB,GAAGF,YAAY,CAACG,MAAM,CAACC,IAAI,IAAA;AAAA,MAAA,IA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Aa,EAAE;cAC5Bc,OAAO,IAAI,CAAC,CAAC,CAAA;AACf,aAAA;AAEA,YAAA,OAAOA,OAAO,CAAA;AAChB,WAAA;AACF,SAAA;AAEA,QAAA,OAAOP,IAAI,CAACc,KAAK,GAAGb,IAAI,CAACa,KAAK,CAAA;AAChC,OAAC,CAAC,CAAA;;AAEF;AACAjB,MAAAA,UAAU,CAACT,OAAO,CAACW,GAAG,IAAI;AAAA,QAAA,IAAAgB,YAAA,CAAA;AACxBpC,QAAAA,cAAc,CAACqC,IAAI,CAACjB,GAAG,CAAC,CAAA;QACxB,IAAAgB,CAAAA,YAAA,GAAIhB,GAAG,CAACkB,OAAO,KAAXF,IAAAA,IAAAA,YAAA,CAAatC,MAAM,EAAE;UACvBsB,GAAG,CAACkB,OAAO,GAAGrB,QAAQ,CAACG,GAAG,CAACkB,OAAO,CAAC,CAAA;AACrC,SAAA;AACF,OAAC,CAAC,CAAA;AAEF,MAAA,OAAOpB,UAAU,CAAA;KAClB,CAAA;IAED,OAAO;AACLrB,MAAAA,IAAI,EAAEoB,QAAQ,CAACrB,QAAQ,CAACC,IAAI,CAAC;AAC7B0C,MAAAA,QAAQ,EAAEvC,cAAc;MACxBwC,QAAQ,EAAE5C,QAAQ,CAAC4C,QAAAA;KACpB,CAAA;AACH,GAAC,EACDC,oBAAc,CAAClD,KAAK,CAACmD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAC/DnD,KAAK,CAACoD,mBAAmB,EAC3B,CACF,CAAC,CAAA;AACL;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/umd/index.development.js b/node_modules/@tanstack/table-core/build/umd/index.development.js new file mode 100644 index 00000000..a38aa6df --- /dev/null +++ b/node_modules/@tanstack/table-core/build/umd/index.development.js @@ -0,0 +1,3582 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TableCore = {})); +})(this, (function (exports) { 'use strict'; + + // type Person = { + // firstName: string + // lastName: string + // age: number + // visits: number + // status: string + // progress: number + // createdAt: Date + // nested: { + // foo: [ + // { + // bar: 'bar' + // } + // ] + // bar: { subBar: boolean }[] + // baz: { + // foo: 'foo' + // bar: { + // baz: 'baz' + // } + // } + // } + // } + + // const test: DeepKeys = 'nested.foo.0.bar' + // const test2: DeepKeys = 'nested.bar' + + // const helper = createColumnHelper() + + // helper.accessor('nested.foo', { + // cell: info => info.getValue(), + // }) + + // helper.accessor('nested.foo.0.bar', { + // cell: info => info.getValue(), + // }) + + // helper.accessor('nested.bar', { + // cell: info => info.getValue(), + // }) + + function createColumnHelper() { + return { + accessor: (accessor, column) => { + return typeof accessor === 'function' ? { + ...column, + accessorFn: accessor + } : { + ...column, + accessorKey: accessor + }; + }, + display: column => column, + group: column => column + }; + } + + // Is this type a tuple? + + // If this type is a tuple, what indices are allowed? + + /// + + function functionalUpdate(updater, input) { + return typeof updater === 'function' ? updater(input) : updater; + } + function noop() { + // + } + function makeStateUpdater(key, instance) { + return updater => { + instance.setState(old => { + return { + ...old, + [key]: functionalUpdate(updater, old[key]) + }; + }); + }; + } + function isFunction(d) { + return d instanceof Function; + } + function isNumberArray(d) { + return Array.isArray(d) && d.every(val => typeof val === 'number'); + } + function flattenBy(arr, getChildren) { + const flat = []; + const recurse = subArr => { + subArr.forEach(item => { + flat.push(item); + const children = getChildren(item); + if (children != null && children.length) { + recurse(children); + } + }); + }; + recurse(arr); + return flat; + } + function memo(getDeps, fn, opts) { + let deps = []; + let result; + return depArgs => { + let depTime; + if (opts.key && opts.debug) depTime = Date.now(); + const newDeps = getDeps(depArgs); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep); + if (!depsChanged) { + return result; + } + deps = newDeps; + let resultTime; + if (opts.key && opts.debug) resultTime = Date.now(); + result = fn(...newDeps); + opts == null || opts.onChange == null || opts.onChange(result); + if (opts.key && opts.debug) { + if (opts != null && opts.debug()) { + const depEndTime = Math.round((Date.now() - depTime) * 100) / 100; + const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100; + const resultFpsPercentage = resultEndTime / 16; + const pad = (str, num) => { + str = String(str); + while (str.length < num) { + str = ' ' + str; + } + return str; + }; + console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, ` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key); + } + } + return result; + }; + } + function getMemoOptions(tableOptions, debugLevel, key, onChange) { + return { + debug: () => { + var _tableOptions$debugAl; + return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel]; + }, + key: key, + onChange + }; + } + + function createCell(table, row, column, columnId) { + const getRenderValue = () => { + var _cell$getValue; + return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue; + }; + const cell = { + id: `${row.id}_${column.id}`, + row, + column, + getValue: () => row.getValue(columnId), + renderValue: getRenderValue, + getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({ + table, + column, + row, + cell: cell, + getValue: cell.getValue, + renderValue: cell.renderValue + }), getMemoOptions(table.options, 'debugCells', 'cell.getContext')) + }; + table._features.forEach(feature => { + feature.createCell == null || feature.createCell(cell, column, row, table); + }, {}); + return cell; + } + + function createColumn(table, columnDef, depth, parent) { + var _ref, _resolvedColumnDef$id; + const defaultColumn = table._getDefaultColumnDef(); + const resolvedColumnDef = { + ...defaultColumn, + ...columnDef + }; + const accessorKey = resolvedColumnDef.accessorKey; + let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined; + let accessorFn; + if (resolvedColumnDef.accessorFn) { + accessorFn = resolvedColumnDef.accessorFn; + } else if (accessorKey) { + // Support deep accessor keys + if (accessorKey.includes('.')) { + accessorFn = originalRow => { + let result = originalRow; + for (const key of accessorKey.split('.')) { + var _result; + result = (_result = result) == null ? void 0 : _result[key]; + if (result === undefined) { + console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`); + } + } + return result; + }; + } else { + accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey]; + } + } + if (!id) { + { + throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); + } + } + let column = { + id: `${String(id)}`, + accessorFn, + parent: parent, + depth, + columnDef: resolvedColumnDef, + columns: [], + getFlatColumns: memo(() => [true], () => { + var _column$columns; + return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')), + getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => { + var _column$columns2; + if ((_column$columns2 = column.columns) != null && _column$columns2.length) { + let leafColumns = column.columns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + } + return [column]; + }, getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')) + }; + for (const feature of table._features) { + feature.createColumn == null || feature.createColumn(column, table); + } + + // Yes, we have to convert table to unknown, because we know more than the compiler here. + return column; + } + + const debug = 'debugHeaders'; + // + + function createHeader(table, column, options) { + var _options$id; + const id = (_options$id = options.id) != null ? _options$id : column.id; + let header = { + id, + column, + index: options.index, + isPlaceholder: !!options.isPlaceholder, + placeholderId: options.placeholderId, + depth: options.depth, + subHeaders: [], + colSpan: 0, + rowSpan: 0, + headerGroup: null, + getLeafHeaders: () => { + const leafHeaders = []; + const recurseHeader = h => { + if (h.subHeaders && h.subHeaders.length) { + h.subHeaders.map(recurseHeader); + } + leafHeaders.push(h); + }; + recurseHeader(header); + return leafHeaders; + }, + getContext: () => ({ + table, + header: header, + column + }) + }; + table._features.forEach(feature => { + feature.createHeader == null || feature.createHeader(header, table); + }); + return header; + } + const Headers = { + createTable: table => { + // Header Groups + + table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + var _left$map$filter, _right$map$filter; + const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; + const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; + const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); + return headerGroups; + }, getMemoOptions(table.options, debug, 'getHeaderGroups')); + table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { + leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); + return buildHeaderGroups(allColumns, leafColumns, table, 'center'); + }, getMemoOptions(table.options, debug, 'getCenterHeaderGroups')); + table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => { + var _left$map$filter2; + const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left'); + }, getMemoOptions(table.options, debug, 'getLeftHeaderGroups')); + table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => { + var _right$map$filter2; + const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right'); + }, getMemoOptions(table.options, debug, 'getRightHeaderGroups')); + + // Footer Groups + + table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getFooterGroups')); + table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getLeftFooterGroups')); + table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getCenterFooterGroups')); + table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => { + return [...headerGroups].reverse(); + }, getMemoOptions(table.options, debug, 'getRightFooterGroups')); + + // Flat Headers + + table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => { + return headerGroups.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getFlatHeaders')); + table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeftFlatHeaders')); + table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getCenterFlatHeaders')); + table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => { + return left.map(headerGroup => { + return headerGroup.headers; + }).flat(); + }, getMemoOptions(table.options, debug, 'getRightFlatHeaders')); + + // Leaf Headers + + table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders; + return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length); + }); + }, getMemoOptions(table.options, debug, 'getCenterLeafHeaders')); + table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders2; + return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length); + }); + }, getMemoOptions(table.options, debug, 'getLeftLeafHeaders')); + table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => { + return flatHeaders.filter(header => { + var _header$subHeaders3; + return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length); + }); + }, getMemoOptions(table.options, debug, 'getRightLeafHeaders')); + table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => { + var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$; + return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => { + return header.getLeafHeaders(); + }).flat(); + }, getMemoOptions(table.options, debug, 'getLeafHeaders')); + } + }; + function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { + var _headerGroups$0$heade, _headerGroups$; + // Find the max depth of the columns: + // build the leaf column row + // build each buffer row going up + // placeholder for non-existent level + // real column for existing level + + let maxDepth = 0; + const findMaxDepth = function (columns, depth) { + if (depth === void 0) { + depth = 1; + } + maxDepth = Math.max(maxDepth, depth); + columns.filter(column => column.getIsVisible()).forEach(column => { + var _column$columns; + if ((_column$columns = column.columns) != null && _column$columns.length) { + findMaxDepth(column.columns, depth + 1); + } + }, 0); + }; + findMaxDepth(allColumns); + let headerGroups = []; + const createHeaderGroup = (headersToGroup, depth) => { + // The header group we are creating + const headerGroup = { + depth, + id: [headerFamily, `${depth}`].filter(Boolean).join('_'), + headers: [] + }; + + // The parent columns we're going to scan next + const pendingParentHeaders = []; + + // Scan each column for parents + headersToGroup.forEach(headerToGroup => { + // What is the latest (last) parent column? + + const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]; + const isLeafHeader = headerToGroup.column.depth === headerGroup.depth; + let column; + let isPlaceholder = false; + if (isLeafHeader && headerToGroup.column.parent) { + // The parent header is new + column = headerToGroup.column.parent; + } else { + // The parent header is repeated + column = headerToGroup.column; + isPlaceholder = true; + } + if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) { + // This column is repeated. Add it as a sub header to the next batch + latestPendingParentHeader.subHeaders.push(headerToGroup); + } else { + // This is a new header. Let's create it + const header = createHeader(table, column, { + id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'), + isPlaceholder, + placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined, + depth, + index: pendingParentHeaders.length + }); + + // Add the headerToGroup as a subHeader of the new header + header.subHeaders.push(headerToGroup); + // Add the new header to the pendingParentHeaders to get grouped + // in the next batch + pendingParentHeaders.push(header); + } + headerGroup.headers.push(headerToGroup); + headerToGroup.headerGroup = headerGroup; + }); + headerGroups.push(headerGroup); + if (depth > 0) { + createHeaderGroup(pendingParentHeaders, depth - 1); + } + }; + const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, { + depth: maxDepth, + index + })); + createHeaderGroup(bottomHeaders, maxDepth - 1); + headerGroups.reverse(); + + // headerGroups = headerGroups.filter(headerGroup => { + // return !headerGroup.headers.every(header => header.isPlaceholder) + // }) + + const recurseHeadersForSpans = headers => { + const filteredHeaders = headers.filter(header => header.column.getIsVisible()); + return filteredHeaders.map(header => { + let colSpan = 0; + let rowSpan = 0; + let childRowSpans = [0]; + if (header.subHeaders && header.subHeaders.length) { + childRowSpans = []; + recurseHeadersForSpans(header.subHeaders).forEach(_ref => { + let { + colSpan: childColSpan, + rowSpan: childRowSpan + } = _ref; + colSpan += childColSpan; + childRowSpans.push(childRowSpan); + }); + } else { + colSpan = 1; + } + const minChildRowSpan = Math.min(...childRowSpans); + rowSpan = rowSpan + minChildRowSpan; + header.colSpan = colSpan; + header.rowSpan = rowSpan; + return { + colSpan, + rowSpan + }; + }); + }; + recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []); + return headerGroups; + } + + const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => { + let row = { + id, + index: rowIndex, + original, + depth, + parentId, + _valuesCache: {}, + _uniqueValuesCache: {}, + getValue: columnId => { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex); + return row._valuesCache[columnId]; + }, + getUniqueValues: columnId => { + if (row._uniqueValuesCache.hasOwnProperty(columnId)) { + return row._uniqueValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.accessorFn)) { + return undefined; + } + if (!column.columnDef.getUniqueValues) { + row._uniqueValuesCache[columnId] = [row.getValue(columnId)]; + return row._uniqueValuesCache[columnId]; + } + row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex); + return row._uniqueValuesCache[columnId]; + }, + renderValue: columnId => { + var _row$getValue; + return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; + }, + subRows: subRows != null ? subRows : [], + getLeafRows: () => flattenBy(row.subRows, d => d.subRows), + getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined, + getParentRows: () => { + let parentRows = []; + let currentRow = row; + while (true) { + const parentRow = currentRow.getParentRow(); + if (!parentRow) break; + parentRows.push(parentRow); + currentRow = parentRow; + } + return parentRows.reverse(); + }, + getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => { + return leafColumns.map(column => { + return createCell(table, row, column, column.id); + }); + }, getMemoOptions(table.options, 'debugRows', 'getAllCells')), + _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => { + return allCells.reduce((acc, cell) => { + acc[cell.column.id] = cell; + return acc; + }, {}); + }, getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')) + }; + for (let i = 0; i < table._features.length; i++) { + const feature = table._features[i]; + feature == null || feature.createRow == null || feature.createRow(row, table); + } + return row; + }; + + // + + const ColumnFaceting = { + createColumn: (column, table) => { + column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id); + column.getFacetedRowModel = () => { + if (!column._getFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return column._getFacetedRowModel(); + }; + column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id); + column.getFacetedUniqueValues = () => { + if (!column._getFacetedUniqueValues) { + return new Map(); + } + return column._getFacetedUniqueValues(); + }; + column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id); + column.getFacetedMinMaxValues = () => { + if (!column._getFacetedMinMaxValues) { + return undefined; + } + return column._getFacetedMinMaxValues(); + }; + } + }; + + const includesString = (row, columnId, filterValue) => { + var _filterValue$toString, _row$getValue; + const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase(); + return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search)); + }; + includesString.autoRemove = val => testFalsey(val); + const includesStringSensitive = (row, columnId, filterValue) => { + var _row$getValue2; + return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue)); + }; + includesStringSensitive.autoRemove = val => testFalsey(val); + const equalsString = (row, columnId, filterValue) => { + var _row$getValue3; + return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase()); + }; + equalsString.autoRemove = val => testFalsey(val); + const arrIncludes = (row, columnId, filterValue) => { + var _row$getValue4; + return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue); + }; + arrIncludes.autoRemove = val => testFalsey(val); + const arrIncludesAll = (row, columnId, filterValue) => { + return !filterValue.some(val => { + var _row$getValue5; + return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val)); + }); + }; + arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length); + const arrIncludesSome = (row, columnId, filterValue) => { + return filterValue.some(val => { + var _row$getValue6; + return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val); + }); + }; + arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length); + const equals = (row, columnId, filterValue) => { + return row.getValue(columnId) === filterValue; + }; + equals.autoRemove = val => testFalsey(val); + const weakEquals = (row, columnId, filterValue) => { + return row.getValue(columnId) == filterValue; + }; + weakEquals.autoRemove = val => testFalsey(val); + const inNumberRange = (row, columnId, filterValue) => { + let [min, max] = filterValue; + const rowValue = row.getValue(columnId); + return rowValue >= min && rowValue <= max; + }; + inNumberRange.resolveFilterValue = val => { + let [unsafeMin, unsafeMax] = val; + let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin; + let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax; + let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin; + let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax; + if (min > max) { + const temp = min; + min = max; + max = temp; + } + return [min, max]; + }; + inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]); + + // Export + + const filterFns = { + includesString, + includesStringSensitive, + equalsString, + arrIncludes, + arrIncludesAll, + arrIncludesSome, + equals, + weakEquals, + inNumberRange + }; + // Utils + + function testFalsey(val) { + return val === undefined || val === null || val === ''; + } + + // + + const ColumnFiltering = { + getDefaultColumnDef: () => { + return { + filterFn: 'auto' + }; + }, + getInitialState: state => { + return { + columnFilters: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnFiltersChange: makeStateUpdater('columnFilters', table), + filterFromLeafRows: false, + maxLeafRowFilterDepth: 100 + }; + }, + createColumn: (column, table) => { + column.getAutoFilterFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return filterFns.includesString; + } + if (typeof value === 'number') { + return filterFns.inNumberRange; + } + if (typeof value === 'boolean') { + return filterFns.equals; + } + if (value !== null && typeof value === 'object') { + return filterFns.equals; + } + if (Array.isArray(value)) { + return filterFns.arrIncludes; + } + return filterFns.weakEquals; + }; + column.getFilterFn = () => { + var _table$options$filter, _table$options$filter2; + return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore + (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn]; + }; + column.getCanFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2; + return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn; + }; + column.getIsFiltered = () => column.getFilterIndex() > -1; + column.getFilterValue = () => { + var _table$getState$colum; + return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value; + }; + column.getFilterIndex = () => { + var _table$getState$colum2, _table$getState$colum3; + return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1; + }; + column.setFilterValue = value => { + table.setColumnFilters(old => { + const filterFn = column.getFilterFn(); + const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id); + const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined); + + // + if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { + var _old$filter; + return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : []; + } + const newFilterObj = { + id: column.id, + value: newFilter + }; + if (previousFilter) { + var _old$map; + return (_old$map = old == null ? void 0 : old.map(d => { + if (d.id === column.id) { + return newFilterObj; + } + return d; + })) != null ? _old$map : []; + } + if (old != null && old.length) { + return [...old, newFilterObj]; + } + return [newFilterObj]; + }); + }; + }, + createRow: (row, _table) => { + row.columnFilters = {}; + row.columnFiltersMeta = {}; + }, + createTable: table => { + table.setColumnFilters = updater => { + const leafColumns = table.getAllLeafColumns(); + const updateFn = old => { + var _functionalUpdate; + return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => { + const column = leafColumns.find(d => d.id === filter.id); + if (column) { + const filterFn = column.getFilterFn(); + if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { + return false; + } + } + return true; + }); + }; + table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn); + }; + table.resetColumnFilters = defaultState => { + var _table$initialState$c, _table$initialState; + table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []); + }; + table.getPreFilteredRowModel = () => table.getCoreRowModel(); + table.getFilteredRowModel = () => { + if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { + table._getFilteredRowModel = table.options.getFilteredRowModel(table); + } + if (table.options.manualFiltering || !table._getFilteredRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getFilteredRowModel(); + }; + } + }; + function shouldAutoRemoveFilter(filterFn, value, column) { + return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value; + } + + const sum = (columnId, _leafRows, childRows) => { + // It's faster to just add the aggregations together instead of + // process leaf nodes individually + return childRows.reduce((sum, next) => { + const nextValue = next.getValue(columnId); + return sum + (typeof nextValue === 'number' ? nextValue : 0); + }, 0); + }; + const min = (columnId, _leafRows, childRows) => { + let min; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (min > value || min === undefined && value >= value)) { + min = value; + } + }); + return min; + }; + const max = (columnId, _leafRows, childRows) => { + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null && (max < value || max === undefined && value >= value)) { + max = value; + } + }); + return max; + }; + const extent = (columnId, _leafRows, childRows) => { + let min; + let max; + childRows.forEach(row => { + const value = row.getValue(columnId); + if (value != null) { + if (min === undefined) { + if (value >= value) min = max = value; + } else { + if (min > value) min = value; + if (max < value) max = value; + } + } + }); + return [min, max]; + }; + const mean = (columnId, leafRows) => { + let count = 0; + let sum = 0; + leafRows.forEach(row => { + let value = row.getValue(columnId); + if (value != null && (value = +value) >= value) { + ++count, sum += value; + } + }); + if (count) return sum / count; + return; + }; + const median = (columnId, leafRows) => { + if (!leafRows.length) { + return; + } + const values = leafRows.map(row => row.getValue(columnId)); + if (!isNumberArray(values)) { + return; + } + if (values.length === 1) { + return values[0]; + } + const mid = Math.floor(values.length / 2); + const nums = values.sort((a, b) => a - b); + return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2; + }; + const unique = (columnId, leafRows) => { + return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values()); + }; + const uniqueCount = (columnId, leafRows) => { + return new Set(leafRows.map(d => d.getValue(columnId))).size; + }; + const count = (_columnId, leafRows) => { + return leafRows.length; + }; + const aggregationFns = { + sum, + min, + max, + extent, + mean, + median, + unique, + uniqueCount, + count + }; + + // + + const ColumnGrouping = { + getDefaultColumnDef: () => { + return { + aggregatedCell: props => { + var _toString, _props$getValue; + return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null; + }, + aggregationFn: 'auto' + }; + }, + getInitialState: state => { + return { + grouping: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onGroupingChange: makeStateUpdater('grouping', table), + groupedColumnMode: 'reorder' + }; + }, + createColumn: (column, table) => { + column.toggleGrouping = () => { + table.setGrouping(old => { + // Find any existing grouping for this column + if (old != null && old.includes(column.id)) { + return old.filter(d => d !== column.id); + } + return [...(old != null ? old : []), column.id]; + }); + }; + column.getCanGroup = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue); + }; + column.getIsGrouped = () => { + var _table$getState$group; + return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id); + }; + column.getGroupedIndex = () => { + var _table$getState$group2; + return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id); + }; + column.getToggleGroupingHandler = () => { + const canGroup = column.getCanGroup(); + return () => { + if (!canGroup) return; + column.toggleGrouping(); + }; + }; + column.getAutoAggregationFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'number') { + return aggregationFns.sum; + } + if (Object.prototype.toString.call(value) === '[object Date]') { + return aggregationFns.extent; + } + }; + column.getAggregationFn = () => { + var _table$options$aggreg, _table$options$aggreg2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn]; + }; + }, + createTable: table => { + table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater); + table.resetGrouping = defaultState => { + var _table$initialState$g, _table$initialState; + table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []); + }; + table.getPreGroupedRowModel = () => table.getFilteredRowModel(); + table.getGroupedRowModel = () => { + if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { + table._getGroupedRowModel = table.options.getGroupedRowModel(table); + } + if (table.options.manualGrouping || !table._getGroupedRowModel) { + return table.getPreGroupedRowModel(); + } + return table._getGroupedRowModel(); + }; + }, + createRow: (row, table) => { + row.getIsGrouped = () => !!row.groupingColumnId; + row.getGroupingValue = columnId => { + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + const column = table.getColumn(columnId); + if (!(column != null && column.columnDef.getGroupingValue)) { + return row.getValue(columnId); + } + row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original); + return row._groupingValuesCache[columnId]; + }; + row._groupingValuesCache = {}; + }, + createCell: (cell, column, row, table) => { + cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId; + cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped(); + cell.getIsAggregated = () => { + var _row$subRows; + return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + } + }; + function orderColumns(leafColumns, grouping, groupedColumnMode) { + if (!(grouping != null && grouping.length) || !groupedColumnMode) { + return leafColumns; + } + const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id)); + if (groupedColumnMode === 'remove') { + return nonGroupingColumns; + } + const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean); + return [...groupingColumns, ...nonGroupingColumns]; + } + + // + + const ColumnOrdering = { + getInitialState: state => { + return { + columnOrder: [], + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnOrderChange: makeStateUpdater('columnOrder', table) + }; + }, + createColumn: (column, table) => { + column.getIndex = memo(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns', 'getIndex')); + column.getIsFirstColumn = position => { + var _columns$; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id; + }; + column.getIsLastColumn = position => { + var _columns; + const columns = _getVisibleLeafColumns(table, position); + return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id; + }; + }, + createTable: table => { + table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater); + table.resetColumnOrder = defaultState => { + var _table$initialState$c; + table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []); + }; + table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => { + // Sort grouped columns to the start of the column list + // before the headers are built + let orderedColumns = []; + + // If there is no order, return the normal columns + if (!(columnOrder != null && columnOrder.length)) { + orderedColumns = columns; + } else { + const columnOrderCopy = [...columnOrder]; + + // If there is an order, make a copy of the columns + const columnsCopy = [...columns]; + + // And make a new ordered array of the columns + + // Loop over the columns and place them in order into the new array + while (columnsCopy.length && columnOrderCopy.length) { + const targetColumnId = columnOrderCopy.shift(); + const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId); + if (foundIndex > -1) { + orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); + } + } + + // If there are any columns left, add them to the end + orderedColumns = [...orderedColumns, ...columnsCopy]; + } + return orderColumns(orderedColumns, grouping, groupedColumnMode); + }, getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')); + } + }; + + // + + const getDefaultColumnPinningState = () => ({ + left: [], + right: [] + }); + const ColumnPinning = { + getInitialState: state => { + return { + columnPinning: getDefaultColumnPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnPinningChange: makeStateUpdater('columnPinning', table) + }; + }, + createColumn: (column, table) => { + column.pin = position => { + const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean); + table.setColumnPinning(old => { + var _old$left3, _old$right3; + if (position === 'right') { + var _old$left, _old$right; + return { + left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds] + }; + } + if (position === 'left') { + var _old$left2, _old$right2; + return { + left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds], + right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + } + return { + left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))), + right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d))) + }; + }); + }; + column.getCanPin = () => { + const leafColumns = column.getLeafColumns(); + return leafColumns.some(d => { + var _d$columnDef$enablePi, _ref, _table$options$enable; + return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true); + }); + }; + column.getIsPinned = () => { + const leafColumnIds = column.getLeafColumns().map(d => d.id); + const { + left, + right + } = table.getState().columnPinning; + const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d)); + const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d)); + return isLeft ? 'left' : isRight ? 'right' : false; + }; + column.getPinnedIndex = () => { + var _table$getState$colum, _table$getState$colum2; + const position = column.getIsPinned(); + return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0; + }; + }, + createRow: (row, table) => { + row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allCells.filter(d => !leftAndRight.includes(d.column.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')); + row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => { + const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'left' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')); + row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { + const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ + ...d, + position: 'right' + })); + return cells; + }, getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')); + }, + createTable: table => { + table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater); + table.resetColumnPinning = defaultState => { + var _table$initialState$c, _table$initialState; + return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState()); + }; + table.getIsSomeColumnsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().columnPinning; + if (!position) { + var _pinningState$left, _pinningState$right; + return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => { + return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')); + table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => { + return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean); + }, getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')); + table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { + const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])]; + return allColumns.filter(d => !leftAndRight.includes(d.id)); + }, getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')); + } + }; + + function safelyAccessDocument(_document) { + return _document || (typeof document !== 'undefined' ? document : null); + } + + // + + // + + const defaultColumnSizing = { + size: 150, + minSize: 20, + maxSize: Number.MAX_SAFE_INTEGER + }; + const getDefaultColumnSizingInfoState = () => ({ + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + isResizingColumn: false, + columnSizingStart: [] + }); + const ColumnSizing = { + getDefaultColumnDef: () => { + return defaultColumnSizing; + }, + getInitialState: state => { + return { + columnSizing: {}, + columnSizingInfo: getDefaultColumnSizingInfoState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + columnResizeMode: 'onEnd', + columnResizeDirection: 'ltr', + onColumnSizingChange: makeStateUpdater('columnSizing', table), + onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table) + }; + }, + createColumn: (column, table) => { + column.getSize = () => { + var _column$columnDef$min, _ref, _column$columnDef$max; + const columnSize = table.getState().columnSizing[column.id]; + return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize); + }; + column.getStart = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getStart')); + column.getAfter = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns', 'getAfter')); + column.resetSize = () => { + table.setColumnSizing(_ref2 => { + let { + [column.id]: _, + ...rest + } = _ref2; + return rest; + }); + }; + column.getCanResize = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true); + }; + column.getIsResizing = () => { + return table.getState().columnSizingInfo.isResizingColumn === column.id; + }; + }, + createHeader: (header, table) => { + header.getSize = () => { + let sum = 0; + const recurse = header => { + if (header.subHeaders.length) { + header.subHeaders.forEach(recurse); + } else { + var _header$column$getSiz; + sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0; + } + }; + recurse(header); + return sum; + }; + header.getStart = () => { + if (header.index > 0) { + const prevSiblingHeader = header.headerGroup.headers[header.index - 1]; + return prevSiblingHeader.getStart() + prevSiblingHeader.getSize(); + } + return 0; + }; + header.getResizeHandler = _contextDocument => { + const column = table.getColumn(header.column.id); + const canResize = column == null ? void 0 : column.getCanResize(); + return e => { + if (!column || !canResize) { + return; + } + e.persist == null || e.persist(); + if (isTouchStartEvent(e)) { + // lets not respond to multiple touches (e.g. 2 or 3 fingers) + if (e.touches && e.touches.length > 1) { + return; + } + } + const startSize = header.getSize(); + const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]]; + const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX; + const newColumnSizing = {}; + const updateOffset = (eventType, clientXPos) => { + if (typeof clientXPos !== 'number') { + return; + } + table.setColumnSizingInfo(old => { + var _old$startOffset, _old$startSize; + const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1; + const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection; + const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999); + old.columnSizingStart.forEach(_ref3 => { + let [columnId, headerSize] = _ref3; + newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100; + }); + return { + ...old, + deltaOffset, + deltaPercentage + }; + }); + if (table.options.columnResizeMode === 'onChange' || eventType === 'end') { + table.setColumnSizing(old => ({ + ...old, + ...newColumnSizing + })); + } + }; + const onMove = clientXPos => updateOffset('move', clientXPos); + const onEnd = clientXPos => { + updateOffset('end', clientXPos); + table.setColumnSizingInfo(old => ({ + ...old, + isResizingColumn: false, + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + columnSizingStart: [] + })); + }; + const contextDocument = safelyAccessDocument(_contextDocument); + const mouseEvents = { + moveHandler: e => onMove(e.clientX), + upHandler: e => { + contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler); + onEnd(e.clientX); + } + }; + const touchEvents = { + moveHandler: e => { + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onMove(e.touches[0].clientX); + return false; + }, + upHandler: e => { + var _e$touches$; + contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler); + contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler); + if (e.cancelable) { + e.preventDefault(); + e.stopPropagation(); + } + onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX); + } + }; + const passiveIfSupported = passiveEventSupported() ? { + passive: false + } : false; + if (isTouchStartEvent(e)) { + contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported); + } else { + contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported); + contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported); + } + table.setColumnSizingInfo(old => ({ + ...old, + startOffset: clientX, + startSize, + deltaOffset: 0, + deltaPercentage: 0, + columnSizingStart, + isResizingColumn: column.id + })); + }; + }; + }, + createTable: table => { + table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater); + table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater); + table.resetColumnSizing = defaultState => { + var _table$initialState$c; + table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {}); + }; + table.resetHeaderSizeInfo = defaultState => { + var _table$initialState$c2; + table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState()); + }; + table.getTotalSize = () => { + var _table$getHeaderGroup, _table$getHeaderGroup2; + return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getHeaderGroup : 0; + }; + table.getLeftTotalSize = () => { + var _table$getLeftHeaderG, _table$getLeftHeaderG2; + return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getLeftHeaderG : 0; + }; + table.getCenterTotalSize = () => { + var _table$getCenterHeade, _table$getCenterHeade2; + return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getCenterHeade : 0; + }; + table.getRightTotalSize = () => { + var _table$getRightHeader, _table$getRightHeader2; + return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => { + return sum + header.getSize(); + }, 0)) != null ? _table$getRightHeader : 0; + }; + } + }; + let passiveSupported = null; + function passiveEventSupported() { + if (typeof passiveSupported === 'boolean') return passiveSupported; + let supported = false; + try { + const options = { + get passive() { + supported = true; + return false; + } + }; + const noop = () => {}; + window.addEventListener('test', noop, options); + window.removeEventListener('test', noop); + } catch (err) { + supported = false; + } + passiveSupported = supported; + return passiveSupported; + } + function isTouchStartEvent(e) { + return e.type === 'touchstart'; + } + + // + + const ColumnVisibility = { + getInitialState: state => { + return { + columnVisibility: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onColumnVisibilityChange: makeStateUpdater('columnVisibility', table) + }; + }, + createColumn: (column, table) => { + column.toggleVisibility = value => { + if (column.getCanHide()) { + table.setColumnVisibility(old => ({ + ...old, + [column.id]: value != null ? value : !column.getIsVisible() + })); + } + }; + column.getIsVisible = () => { + var _ref, _table$getState$colum; + const childColumns = column.columns; + return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true; + }; + column.getCanHide = () => { + var _column$columnDef$ena, _table$options$enable; + return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true); + }; + column.getToggleVisibilityHandler = () => { + return e => { + column.toggleVisibility == null || column.toggleVisibility(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => { + return cells.filter(cell => cell.column.getIsVisible()); + }, getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')); + row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows', 'getVisibleCells')); + }, + createTable: table => { + const makeVisibleColumnsMethod = (key, getColumns) => { + return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => { + return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible()); + }, getMemoOptions(table.options, 'debugColumns', key)); + }; + table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()); + table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()); + table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()); + table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()); + table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()); + table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater); + table.resetColumnVisibility = defaultState => { + var _table$initialState$c; + table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {}); + }; + table.toggleAllColumnsVisible = value => { + var _value; + value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible(); + table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ + ...obj, + [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value + }), {})); + }; + table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())); + table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()); + table.getToggleAllColumnsVisibilityHandler = () => { + return e => { + var _target; + table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } + }; + function _getVisibleLeafColumns(table, position) { + return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); + } + + // + + const GlobalFaceting = { + createTable: table => { + table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'); + table.getGlobalFacetedRowModel = () => { + if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { + return table.getPreFilteredRowModel(); + } + return table._getGlobalFacetedRowModel(); + }; + table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'); + table.getGlobalFacetedUniqueValues = () => { + if (!table._getGlobalFacetedUniqueValues) { + return new Map(); + } + return table._getGlobalFacetedUniqueValues(); + }; + table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'); + table.getGlobalFacetedMinMaxValues = () => { + if (!table._getGlobalFacetedMinMaxValues) { + return; + } + return table._getGlobalFacetedMinMaxValues(); + }; + } + }; + + // + + const GlobalFiltering = { + getInitialState: state => { + return { + globalFilter: undefined, + ...state + }; + }, + getDefaultOptions: table => { + return { + onGlobalFilterChange: makeStateUpdater('globalFilter', table), + globalFilterFn: 'auto', + getColumnCanGlobalFilter: column => { + var _table$getCoreRowMode; + const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue(); + return typeof value === 'string' || typeof value === 'number'; + } + }; + }, + createColumn: (column, table) => { + column.getCanGlobalFilter = () => { + var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol; + return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn; + }; + }, + createTable: table => { + table.getGlobalAutoFilterFn = () => { + return filterFns.includesString; + }; + table.getGlobalFilterFn = () => { + var _table$options$filter, _table$options$filter2; + const { + globalFilterFn: globalFilterFn + } = table.options; + return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn]; + }; + table.setGlobalFilter = updater => { + table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater); + }; + table.resetGlobalFilter = defaultState => { + table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter); + }; + } + }; + + // + + const RowExpanding = { + getInitialState: state => { + return { + expanded: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onExpandedChange: makeStateUpdater('expanded', table), + paginateExpandedRows: true + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetExpanded = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetExpanded(); + queued = false; + }); + } + }; + table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater); + table.toggleAllRowsExpanded = expanded => { + if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) { + table.setExpanded(true); + } else { + table.setExpanded({}); + } + }; + table.resetExpanded = defaultState => { + var _table$initialState$e, _table$initialState; + table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {}); + }; + table.getCanSomeRowsExpand = () => { + return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand()); + }; + table.getToggleAllRowsExpandedHandler = () => { + return e => { + e.persist == null || e.persist(); + table.toggleAllRowsExpanded(); + }; + }; + table.getIsSomeRowsExpanded = () => { + const expanded = table.getState().expanded; + return expanded === true || Object.values(expanded).some(Boolean); + }; + table.getIsAllRowsExpanded = () => { + const expanded = table.getState().expanded; + + // If expanded is true, save some cycles and return true + if (typeof expanded === 'boolean') { + return expanded === true; + } + if (!Object.keys(expanded).length) { + return false; + } + + // If any row is not expanded, return false + if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) { + return false; + } + + // They must all be expanded :shrug: + return true; + }; + table.getExpandedDepth = () => { + let maxDepth = 0; + const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); + rowIds.forEach(id => { + const splitId = id.split('.'); + maxDepth = Math.max(maxDepth, splitId.length); + }); + return maxDepth; + }; + table.getPreExpandedRowModel = () => table.getSortedRowModel(); + table.getExpandedRowModel = () => { + if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { + table._getExpandedRowModel = table.options.getExpandedRowModel(table); + } + if (table.options.manualExpanding || !table._getExpandedRowModel) { + return table.getPreExpandedRowModel(); + } + return table._getExpandedRowModel(); + }; + }, + createRow: (row, table) => { + row.toggleExpanded = expanded => { + table.setExpanded(old => { + var _expanded; + const exists = old === true ? true : !!(old != null && old[row.id]); + let oldExpanded = {}; + if (old === true) { + Object.keys(table.getRowModel().rowsById).forEach(rowId => { + oldExpanded[rowId] = true; + }); + } else { + oldExpanded = old; + } + expanded = (_expanded = expanded) != null ? _expanded : !exists; + if (!exists && expanded) { + return { + ...oldExpanded, + [row.id]: true + }; + } + if (exists && !expanded) { + const { + [row.id]: _, + ...rest + } = oldExpanded; + return rest; + } + return old; + }); + }; + row.getIsExpanded = () => { + var _table$options$getIsR; + const expanded = table.getState().expanded; + return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id])); + }; + row.getCanExpand = () => { + var _table$options$getRow, _table$options$enable, _row$subRows; + return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length); + }; + row.getIsAllParentsExpanded = () => { + let isFullyExpanded = true; + let currentRow = row; + while (isFullyExpanded && currentRow.parentId) { + currentRow = table.getRow(currentRow.parentId, true); + isFullyExpanded = currentRow.getIsExpanded(); + } + return isFullyExpanded; + }; + row.getToggleExpandedHandler = () => { + const canExpand = row.getCanExpand(); + return () => { + if (!canExpand) return; + row.toggleExpanded(); + }; + }; + } + }; + + // + + const defaultPageIndex = 0; + const defaultPageSize = 10; + const getDefaultPaginationState = () => ({ + pageIndex: defaultPageIndex, + pageSize: defaultPageSize + }); + const RowPagination = { + getInitialState: state => { + return { + ...state, + pagination: { + ...getDefaultPaginationState(), + ...(state == null ? void 0 : state.pagination) + } + }; + }, + getDefaultOptions: table => { + return { + onPaginationChange: makeStateUpdater('pagination', table) + }; + }, + createTable: table => { + let registered = false; + let queued = false; + table._autoResetPageIndex = () => { + var _ref, _table$options$autoRe; + if (!registered) { + table._queue(() => { + registered = true; + }); + return; + } + if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) { + if (queued) return; + queued = true; + table._queue(() => { + table.resetPageIndex(); + queued = false; + }); + } + }; + table.setPagination = updater => { + const safeUpdater = old => { + let newState = functionalUpdate(updater, old); + return newState; + }; + return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater); + }; + table.resetPagination = defaultState => { + var _table$initialState$p; + table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState()); + }; + table.setPageIndex = updater => { + table.setPagination(old => { + let pageIndex = functionalUpdate(updater, old.pageIndex); + const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1; + pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex)); + return { + ...old, + pageIndex + }; + }); + }; + table.resetPageIndex = defaultState => { + var _table$initialState$p2, _table$initialState; + table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex); + }; + table.resetPageSize = defaultState => { + var _table$initialState$p3, _table$initialState2; + table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize); + }; + table.setPageSize = updater => { + table.setPagination(old => { + const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize)); + const topRowIndex = old.pageSize * old.pageIndex; + const pageIndex = Math.floor(topRowIndex / pageSize); + return { + ...old, + pageIndex, + pageSize + }; + }); + }; + //deprecated + table.setPageCount = updater => table.setPagination(old => { + var _table$options$pageCo; + let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1); + if (typeof newPageCount === 'number') { + newPageCount = Math.max(-1, newPageCount); + } + return { + ...old, + pageCount: newPageCount + }; + }); + table.getPageOptions = memo(() => [table.getPageCount()], pageCount => { + let pageOptions = []; + if (pageCount && pageCount > 0) { + pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i); + } + return pageOptions; + }, getMemoOptions(table.options, 'debugTable', 'getPageOptions')); + table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0; + table.getCanNextPage = () => { + const { + pageIndex + } = table.getState().pagination; + const pageCount = table.getPageCount(); + if (pageCount === -1) { + return true; + } + if (pageCount === 0) { + return false; + } + return pageIndex < pageCount - 1; + }; + table.previousPage = () => { + return table.setPageIndex(old => old - 1); + }; + table.nextPage = () => { + return table.setPageIndex(old => { + return old + 1; + }); + }; + table.firstPage = () => { + return table.setPageIndex(0); + }; + table.lastPage = () => { + return table.setPageIndex(table.getPageCount() - 1); + }; + table.getPrePaginationRowModel = () => table.getExpandedRowModel(); + table.getPaginationRowModel = () => { + if (!table._getPaginationRowModel && table.options.getPaginationRowModel) { + table._getPaginationRowModel = table.options.getPaginationRowModel(table); + } + if (table.options.manualPagination || !table._getPaginationRowModel) { + return table.getPrePaginationRowModel(); + } + return table._getPaginationRowModel(); + }; + table.getPageCount = () => { + var _table$options$pageCo2; + return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize); + }; + table.getRowCount = () => { + var _table$options$rowCou; + return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length; + }; + } + }; + + // + + const getDefaultRowPinningState = () => ({ + top: [], + bottom: [] + }); + const RowPinning = { + getInitialState: state => { + return { + rowPinning: getDefaultRowPinningState(), + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowPinningChange: makeStateUpdater('rowPinning', table) + }; + }, + createRow: (row, table) => { + row.pin = (position, includeLeafRows, includeParentRows) => { + const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => { + let { + id + } = _ref; + return id; + }) : []; + const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => { + let { + id + } = _ref2; + return id; + }) : []; + const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]); + table.setRowPinning(old => { + var _old$top3, _old$bottom3; + if (position === 'bottom') { + var _old$top, _old$bottom; + return { + top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)] + }; + } + if (position === 'top') { + var _old$top2, _old$bottom2; + return { + top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)], + bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + } + return { + top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))), + bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d))) + }; + }); + }; + row.getCanPin = () => { + var _ref3; + const { + enableRowPinning, + enablePinning + } = table.options; + if (typeof enableRowPinning === 'function') { + return enableRowPinning(row); + } + return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true; + }; + row.getIsPinned = () => { + const rowIds = [row.id]; + const { + top, + bottom + } = table.getState().rowPinning; + const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d)); + const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d)); + return isTop ? 'top' : isBottom ? 'bottom' : false; + }; + row.getPinnedIndex = () => { + var _ref4, _visiblePinnedRowIds$; + const position = row.getIsPinned(); + if (!position) return -1; + const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => { + let { + id + } = _ref5; + return id; + }); + return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1; + }; + }, + createTable: table => { + table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater); + table.resetRowPinning = defaultState => { + var _table$initialState$r, _table$initialState; + return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState()); + }; + table.getIsSomeRowsPinned = position => { + var _pinningState$positio; + const pinningState = table.getState().rowPinning; + if (!position) { + var _pinningState$top, _pinningState$bottom; + return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length)); + } + return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length); + }; + table._getPinnedRows = (visibleRows, pinnedRowIds, position) => { + var _table$options$keepPi; + const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ? + //get all rows that are pinned even if they would not be otherwise visible + //account for expanded parent rows, but not pagination or filtering + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => { + const row = table.getRow(rowId, true); + return row.getIsAllParentsExpanded() ? row : null; + }) : + //else get only visible rows that are pinned + (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId)); + return rows.filter(Boolean).map(d => ({ + ...d, + position + })); + }; + table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows')); + table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows')); + table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => { + const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]); + return allRows.filter(d => !topAndBottom.has(d.id)); + }, getMemoOptions(table.options, 'debugRows', 'getCenterRows')); + } + }; + + // + + const RowSelection = { + getInitialState: state => { + return { + rowSelection: {}, + ...state + }; + }, + getDefaultOptions: table => { + return { + onRowSelectionChange: makeStateUpdater('rowSelection', table), + enableRowSelection: true, + enableMultiRowSelection: true, + enableSubRowSelection: true + // enableGroupingRowSelection: false, + // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey, + // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey, + }; + }, + createTable: table => { + table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater); + table.resetRowSelection = defaultState => { + var _table$initialState$r; + return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {}); + }; + table.toggleAllRowsSelected = value => { + table.setRowSelection(old => { + value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected(); + const rowSelection = { + ...old + }; + const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; + + // We don't use `mutateRowIsSelected` here for performance reasons. + // All of the rows are flat already, so it wouldn't be worth it + if (value) { + preGroupedFlatRows.forEach(row => { + if (!row.getCanSelect()) { + return; + } + rowSelection[row.id] = true; + }); + } else { + preGroupedFlatRows.forEach(row => { + delete rowSelection[row.id]; + }); + } + return rowSelection; + }); + }; + table.toggleAllPageRowsSelected = value => table.setRowSelection(old => { + const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected(); + const rowSelection = { + ...old + }; + table.getRowModel().rows.forEach(row => { + mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table); + }); + return rowSelection; + }); + + // addRowSelectionRange: rowId => { + // const { + // rows, + // rowsById, + // options: { selectGroupingRows, selectSubRows }, + // } = table + + // const findSelectedRow = (rows: Row[]) => { + // let found + // rows.find(d => { + // if (d.getIsSelected()) { + // found = d + // return true + // } + // const subFound = findSelectedRow(d.subRows || []) + // if (subFound) { + // found = subFound + // return true + // } + // return false + // }) + // return found + // } + + // const firstRow = findSelectedRow(rows) || rows[0] + // const lastRow = rowsById[rowId] + + // let include = false + // const selectedRowIds = {} + + // const addRow = (row: Row) => { + // mutateRowIsSelected(selectedRowIds, row.id, true, { + // rowsById, + // selectGroupingRows: selectGroupingRows!, + // selectSubRows: selectSubRows!, + // }) + // } + + // table.rows.forEach(row => { + // const isFirstRow = row.id === firstRow.id + // const isLastRow = row.id === lastRow.id + + // if (isFirstRow || isLastRow) { + // if (!include) { + // include = true + // } else if (include) { + // addRow(row) + // include = false + // } + // } + + // if (include) { + // addRow(row) + // } + // }) + + // table.setRowSelection(selectedRowIds) + // }, + table.getPreSelectedRowModel = () => table.getCoreRowModel(); + table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')); + table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')); + table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {} + }; + } + return selectRowsFn(table, rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')); + + /// + + // getGroupingRowCanSelect: rowId => { + // const row = table.getRow(rowId) + + // if (!row) { + // throw new Error() + // } + + // if (typeof table.options.enableGroupingRowSelection === 'function') { + // return table.options.enableGroupingRowSelection(row) + // } + + // return table.options.enableGroupingRowSelection ?? false + // }, + + table.getIsAllRowsSelected = () => { + const preGroupedFlatRows = table.getFilteredRowModel().flatRows; + const { + rowSelection + } = table.getState(); + let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length); + if (isAllRowsSelected) { + if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) { + isAllRowsSelected = false; + } + } + return isAllRowsSelected; + }; + table.getIsAllPageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect()); + const { + rowSelection + } = table.getState(); + let isAllPageRowsSelected = !!paginationFlatRows.length; + if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) { + isAllPageRowsSelected = false; + } + return isAllPageRowsSelected; + }; + table.getIsSomeRowsSelected = () => { + var _table$getState$rowSe; + const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length; + return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length; + }; + table.getIsSomePageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows; + return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected()); + }; + table.getToggleAllRowsSelectedHandler = () => { + return e => { + table.toggleAllRowsSelected(e.target.checked); + }; + }; + table.getToggleAllPageRowsSelectedHandler = () => { + return e => { + table.toggleAllPageRowsSelected(e.target.checked); + }; + }; + }, + createRow: (row, table) => { + row.toggleSelected = (value, opts) => { + const isSelected = row.getIsSelected(); + table.setRowSelection(old => { + var _opts$selectChildren; + value = typeof value !== 'undefined' ? value : !isSelected; + if (row.getCanSelect() && isSelected === value) { + return old; + } + const selectedRowIds = { + ...old + }; + mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table); + return selectedRowIds; + }); + }; + row.getIsSelected = () => { + const { + rowSelection + } = table.getState(); + return isRowSelected(row, rowSelection); + }; + row.getIsSomeSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'some'; + }; + row.getIsAllSubRowsSelected = () => { + const { + rowSelection + } = table.getState(); + return isSubRowSelected(row, rowSelection) === 'all'; + }; + row.getCanSelect = () => { + var _table$options$enable; + if (typeof table.options.enableRowSelection === 'function') { + return table.options.enableRowSelection(row); + } + return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true; + }; + row.getCanSelectSubRows = () => { + var _table$options$enable2; + if (typeof table.options.enableSubRowSelection === 'function') { + return table.options.enableSubRowSelection(row); + } + return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true; + }; + row.getCanMultiSelect = () => { + var _table$options$enable3; + if (typeof table.options.enableMultiRowSelection === 'function') { + return table.options.enableMultiRowSelection(row); + } + return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true; + }; + row.getToggleSelectedHandler = () => { + const canSelect = row.getCanSelect(); + return e => { + var _target; + if (!canSelect) return; + row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked); + }; + }; + } + }; + const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => { + var _row$subRows; + const row = table.getRow(id, true); + + // const isGrouped = row.getIsGrouped() + + // if ( // TODO: enforce grouping row selection rules + // !isGrouped || + // (isGrouped && table.options.enableGroupingRowSelection) + // ) { + if (value) { + if (!row.getCanMultiSelect()) { + Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]); + } + if (row.getCanSelect()) { + selectedRowIds[id] = true; + } + } else { + delete selectedRowIds[id]; + } + // } + + if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { + row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)); + } + }; + function selectRowsFn(table, rowModel) { + const rowSelection = table.getState().rowSelection; + const newSelectedFlatRows = []; + const newSelectedRowsById = {}; + + // Filters top level and nested rows + const recurseRows = function (rows, depth) { + return rows.map(row => { + var _row$subRows2; + const isSelected = isRowSelected(row, rowSelection); + if (isSelected) { + newSelectedFlatRows.push(row); + newSelectedRowsById[row.id] = row; + } + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) { + row = { + ...row, + subRows: recurseRows(row.subRows) + }; + } + if (isSelected) { + return row; + } + }).filter(Boolean); + }; + return { + rows: recurseRows(rowModel.rows), + flatRows: newSelectedFlatRows, + rowsById: newSelectedRowsById + }; + } + function isRowSelected(row, selection) { + var _selection$row$id; + return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false; + } + function isSubRowSelected(row, selection, table) { + var _row$subRows3; + if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false; + let allChildrenSelected = true; + let someSelected = false; + row.subRows.forEach(subRow => { + // Bail out early if we know both of these + if (someSelected && !allChildrenSelected) { + return; + } + if (subRow.getCanSelect()) { + if (isRowSelected(subRow, selection)) { + someSelected = true; + } else { + allChildrenSelected = false; + } + } + + // Check row selection of nested subrows + if (subRow.subRows && subRow.subRows.length) { + const subRowChildrenSelected = isSubRowSelected(subRow, selection); + if (subRowChildrenSelected === 'all') { + someSelected = true; + } else if (subRowChildrenSelected === 'some') { + someSelected = true; + allChildrenSelected = false; + } else { + allChildrenSelected = false; + } + } + }); + return allChildrenSelected ? 'all' : someSelected ? 'some' : false; + } + + const reSplitAlphaNumeric = /([0-9]+)/gm; + const alphanumeric = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); + }; + const alphanumericCaseSensitive = (rowA, rowB, columnId) => { + return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); + }; + + // The text filter is more basic (less numeric support) + // but is much faster + const text = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase()); + }; + + // The text filter is more basic (less numeric support) + // but is much faster + const textCaseSensitive = (rowA, rowB, columnId) => { + return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId))); + }; + const datetime = (rowA, rowB, columnId) => { + const a = rowA.getValue(columnId); + const b = rowB.getValue(columnId); + + // Can handle nullish values + // Use > and < because == (and ===) doesn't work with + // Date objects (would require calling getTime()). + return a > b ? 1 : a < b ? -1 : 0; + }; + const basic = (rowA, rowB, columnId) => { + return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); + }; + + // Utils + + function compareBasic(a, b) { + return a === b ? 0 : a > b ? 1 : -1; + } + function toString(a) { + if (typeof a === 'number') { + if (isNaN(a) || a === Infinity || a === -Infinity) { + return ''; + } + return String(a); + } + if (typeof a === 'string') { + return a; + } + return ''; + } + + // Mixed sorting is slow, but very inclusive of many edge cases. + // It handles numbers, mixed alphanumeric combinations, and even + // null, undefined, and Infinity + function compareAlphanumeric(aStr, bStr) { + // Split on number groups, but keep the delimiter + // Then remove falsey split values + const a = aStr.split(reSplitAlphaNumeric).filter(Boolean); + const b = bStr.split(reSplitAlphaNumeric).filter(Boolean); + + // While + while (a.length && b.length) { + const aa = a.shift(); + const bb = b.shift(); + const an = parseInt(aa, 10); + const bn = parseInt(bb, 10); + const combo = [an, bn].sort(); + + // Both are string + if (isNaN(combo[0])) { + if (aa > bb) { + return 1; + } + if (bb > aa) { + return -1; + } + continue; + } + + // One is a string, one is a number + if (isNaN(combo[1])) { + return isNaN(an) ? -1 : 1; + } + + // Both are numbers + if (an > bn) { + return 1; + } + if (bn > an) { + return -1; + } + } + return a.length - b.length; + } + + // Exports + + const sortingFns = { + alphanumeric, + alphanumericCaseSensitive, + text, + textCaseSensitive, + datetime, + basic + }; + + // + + const RowSorting = { + getInitialState: state => { + return { + sorting: [], + ...state + }; + }, + getDefaultColumnDef: () => { + return { + sortingFn: 'auto', + sortUndefined: 1 + }; + }, + getDefaultOptions: table => { + return { + onSortingChange: makeStateUpdater('sorting', table), + isMultiSortEvent: e => { + return e.shiftKey; + } + }; + }, + createColumn: (column, table) => { + column.getAutoSortingFn = () => { + const firstRows = table.getFilteredRowModel().flatRows.slice(10); + let isString = false; + for (const row of firstRows) { + const value = row == null ? void 0 : row.getValue(column.id); + if (Object.prototype.toString.call(value) === '[object Date]') { + return sortingFns.datetime; + } + if (typeof value === 'string') { + isString = true; + if (value.split(reSplitAlphaNumeric).length > 1) { + return sortingFns.alphanumeric; + } + } + } + if (isString) { + return sortingFns.text; + } + return sortingFns.basic; + }; + column.getAutoSortDir = () => { + const firstRow = table.getFilteredRowModel().flatRows[0]; + const value = firstRow == null ? void 0 : firstRow.getValue(column.id); + if (typeof value === 'string') { + return 'asc'; + } + return 'desc'; + }; + column.getSortingFn = () => { + var _table$options$sortin, _table$options$sortin2; + if (!column) { + throw new Error(); + } + return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn]; + }; + column.toggleSorting = (desc, multi) => { + // if (column.columns.length) { + // column.columns.forEach((c, i) => { + // if (c.id) { + // table.toggleColumnSorting(c.id, undefined, multi || !!i) + // } + // }) + // return + // } + + // this needs to be outside of table.setSorting to be in sync with rerender + const nextSortingOrder = column.getNextSortingOrder(); + const hasManualValue = typeof desc !== 'undefined' && desc !== null; + table.setSorting(old => { + // Find any existing sorting for this column + const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id); + const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id); + let newSorting = []; + + // What should we do with this sort action? + let sortAction; + let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; + + // Multi-mode + if (old != null && old.length && column.getCanMultiSort() && multi) { + if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'add'; + } + } else { + // Normal mode + if (old != null && old.length && existingIndex !== old.length - 1) { + sortAction = 'replace'; + } else if (existingSorting) { + sortAction = 'toggle'; + } else { + sortAction = 'replace'; + } + } + + // Handle toggle states that will remove the sorting + if (sortAction === 'toggle') { + // If we are "actually" toggling (not a manual set value), should we remove the sorting? + if (!hasManualValue) { + // Is our intention to remove? + if (!nextSortingOrder) { + sortAction = 'remove'; + } + } + } + if (sortAction === 'add') { + var _table$options$maxMul; + newSorting = [...old, { + id: column.id, + desc: nextDesc + }]; + // Take latest n columns + newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); + } else if (sortAction === 'toggle') { + // This flips (or sets) the + newSorting = old.map(d => { + if (d.id === column.id) { + return { + ...d, + desc: nextDesc + }; + } + return d; + }); + } else if (sortAction === 'remove') { + newSorting = old.filter(d => d.id !== column.id); + } else { + newSorting = [{ + id: column.id, + desc: nextDesc + }]; + } + return newSorting; + }); + }; + column.getFirstSortDir = () => { + var _ref, _column$columnDef$sor; + const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc'; + return sortDescFirst ? 'desc' : 'asc'; + }; + column.getNextSortingOrder = multi => { + var _table$options$enable, _table$options$enable2; + const firstSortDirection = column.getFirstSortDir(); + const isSorted = column.getIsSorted(); + if (!isSorted) { + return firstSortDirection; + } + if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( + // If enableSortRemove, enable in general + multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove)) + ) { + return false; + } + return isSorted === 'desc' ? 'asc' : 'desc'; + }; + column.getCanSort = () => { + var _column$columnDef$ena, _table$options$enable3; + return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn; + }; + column.getCanMultiSort = () => { + var _ref2, _column$columnDef$ena2; + return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn; + }; + column.getIsSorted = () => { + var _table$getState$sorti; + const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id); + return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'; + }; + column.getSortIndex = () => { + var _table$getState$sorti2, _table$getState$sorti3; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1; + }; + column.clearSorting = () => { + //clear sorting for just 1 column + table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []); + }; + column.getToggleSortingHandler = () => { + const canSort = column.getCanSort(); + return e => { + if (!canSort) return; + e.persist == null || e.persist(); + column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false); + }; + }; + }, + createTable: table => { + table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater); + table.resetSorting = defaultState => { + var _table$initialState$s, _table$initialState; + table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []); + }; + table.getPreSortedRowModel = () => table.getGroupedRowModel(); + table.getSortedRowModel = () => { + if (!table._getSortedRowModel && table.options.getSortedRowModel) { + table._getSortedRowModel = table.options.getSortedRowModel(table); + } + if (table.options.manualSorting || !table._getSortedRowModel) { + return table.getPreSortedRowModel(); + } + return table._getSortedRowModel(); + }; + } + }; + + const builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting, + //depends on ColumnFaceting + GlobalFiltering, + //depends on ColumnFiltering + RowSorting, ColumnGrouping, + //depends on RowSorting + RowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing]; + + // + + function createTable(options) { + var _options$_features, _options$initialState; + if ((options.debugAll || options.debugTable)) { + console.info('Creating Table Instance...'); + } + const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])]; + let table = { + _features + }; + const defaultOptions = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table)); + }, {}); + const mergeOptions = options => { + if (table.options.mergeOptions) { + return table.options.mergeOptions(defaultOptions, options); + } + return { + ...defaultOptions, + ...options + }; + }; + const coreInitialState = {}; + let initialState = { + ...coreInitialState, + ...((_options$initialState = options.initialState) != null ? _options$initialState : {}) + }; + table._features.forEach(feature => { + var _feature$getInitialSt; + initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState; + }); + const queued = []; + let queuedTimeout = false; + const coreInstance = { + _features, + options: { + ...defaultOptions, + ...options + }, + initialState, + _queue: cb => { + queued.push(cb); + if (!queuedTimeout) { + queuedTimeout = true; + + // Schedule a microtask to run the queued callbacks after + // the current call stack (render, etc) has finished. + Promise.resolve().then(() => { + while (queued.length) { + queued.shift()(); + } + queuedTimeout = false; + }).catch(error => setTimeout(() => { + throw error; + })); + } + }, + reset: () => { + table.setState(table.initialState); + }, + setOptions: updater => { + const newOptions = functionalUpdate(updater, table.options); + table.options = mergeOptions(newOptions); + }, + getState: () => { + return table.options.state; + }, + setState: updater => { + table.options.onStateChange == null || table.options.onStateChange(updater); + }, + _getRowId: (row, index, parent) => { + var _table$options$getRow; + return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`; + }, + getCoreRowModel: () => { + if (!table._getCoreRowModel) { + table._getCoreRowModel = table.options.getCoreRowModel(table); + } + return table._getCoreRowModel(); + }, + // The final calls start at the bottom of the model, + // expanded rows, which then work their way up + + getRowModel: () => { + return table.getPaginationRowModel(); + }, + //in next version, we should just pass in the row model as the optional 2nd arg + getRow: (id, searchAll) => { + let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id]; + if (!row) { + row = table.getCoreRowModel().rowsById[id]; + if (!row) { + { + throw new Error(`getRow could not find row with ID: ${id}`); + } + } + } + return row; + }, + _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => { + var _defaultColumn; + defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {}; + return { + header: props => { + const resolvedColumnDef = props.header.column.columnDef; + if (resolvedColumnDef.accessorKey) { + return resolvedColumnDef.accessorKey; + } + if (resolvedColumnDef.accessorFn) { + return resolvedColumnDef.id; + } + return null; + }, + // footer: props => props.header.column.id, + cell: props => { + var _props$renderValue$to, _props$renderValue; + return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null; + }, + ...table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef()); + }, {}), + ...defaultColumn + }; + }, getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')), + _getColumnDefs: () => table.options.columns, + getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => { + const recurseColumns = function (columnDefs, parent, depth) { + if (depth === void 0) { + depth = 0; + } + return columnDefs.map(columnDef => { + const column = createColumn(table, columnDef, depth, parent); + const groupingColumnDef = columnDef; + column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : []; + return column; + }); + }; + return recurseColumns(columnDefs); + }, getMemoOptions(options, 'debugColumns', 'getAllColumns')), + getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => { + return allColumns.flatMap(column => { + return column.getFlatColumns(); + }); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')), + _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => { + return flatColumns.reduce((acc, column) => { + acc[column.id] = column; + return acc; + }, {}); + }, getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')), + getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => { + let leafColumns = allColumns.flatMap(column => column.getLeafColumns()); + return orderColumns(leafColumns); + }, getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')), + getColumn: columnId => { + const column = table._getAllFlatColumnsById()[columnId]; + if (!column) { + console.error(`[Table] Column with id '${columnId}' does not exist.`); + } + return column; + } + }; + Object.assign(table, coreInstance); + for (let index = 0; index < table._features.length; index++) { + const feature = table._features[index]; + feature == null || feature.createTable == null || feature.createTable(table); + } + return table; + } + + function getCoreRowModel() { + return table => memo(() => [table.options.data], data => { + const rowModel = { + rows: [], + flatRows: [], + rowsById: {} + }; + const accessRows = function (originalRows, depth, parentRow) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + for (let i = 0; i < originalRows.length; i++) { + // This could be an expensive check at scale, so we should move it somewhere else, but where? + // if (!id) { + // if ("development" !== 'production') { + // throw new Error(`getRowId expected an ID, but got ${id}`) + // } + // } + + // Make the row + const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id); + + // Keep track of every row in a flat array + rowModel.flatRows.push(row); + // Also keep track of every row by its ID + rowModel.rowsById[row.id] = row; + // Push table row into parent + rows.push(row); + + // Get the original subrows + if (table.options.getSubRows) { + var _row$originalSubRows; + row.originalSubRows = table.options.getSubRows(originalRows[i], i); + + // Then recursively access them + if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) { + row.subRows = accessRows(row.originalSubRows, depth + 1, row); + } + } + } + return rows; + }; + rowModel.rows = accessRows(data); + return rowModel; + }, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex())); + } + + function getExpandedRowModel() { + return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => { + if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) { + return rowModel; + } + if (!paginateExpandedRows) { + // Only expand rows at this point if they are being paginated + return rowModel; + } + return expandRows(rowModel); + }, getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')); + } + function expandRows(rowModel) { + const expandedRows = []; + const handleRow = row => { + var _row$subRows; + expandedRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) { + row.subRows.forEach(handleRow); + } + }; + rowModel.rows.forEach(handleRow); + return { + rows: expandedRows, + flatRows: rowModel.flatRows, + rowsById: rowModel.rowsById + }; + } + + function getFacetedMinMaxValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return undefined; + const uniqueValues = facetedRowModel.flatRows.flatMap(flatRow => { + var _flatRow$getUniqueVal; + return (_flatRow$getUniqueVal = flatRow.getUniqueValues(columnId)) != null ? _flatRow$getUniqueVal : []; + }).map(Number).filter(value => !Number.isNaN(value)); + if (!uniqueValues.length) return; + let facetedMinValue = uniqueValues[0]; + let facetedMaxValue = uniqueValues[uniqueValues.length - 1]; + for (const value of uniqueValues) { + if (value < facetedMinValue) facetedMinValue = value;else if (value > facetedMaxValue) facetedMaxValue = value; + } + return [facetedMinValue, facetedMaxValue]; + }, getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')); + } + + function filterRows(rows, filterRowImpl, table) { + if (table.options.filterFromLeafRows) { + return filterRowModelFromLeafs(rows, filterRowImpl, table); + } + return filterRowModelFromRoot(rows, filterRowImpl, table); + } + function filterRowModelFromLeafs(rowsToFilter, filterRow, table) { + var _table$options$maxLea; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100; + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + const rows = []; + + // Filter from children up first + for (let i = 0; i < rowsToFilter.length; i++) { + var _row$subRows; + let row = rowsToFilter[i]; + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.columnFilters = row.columnFilters; + if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) { + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + if (filterRow(row) && !newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + if (filterRow(row) || newRow.subRows.length) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + continue; + } + } else { + row = newRow; + if (filterRow(row)) { + rows.push(row); + newFilteredRowsById[row.id] = row; + newFilteredFlatRows.push(row); + } + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; + } + function filterRowModelFromRoot(rowsToFilter, filterRow, table) { + var _table$options$maxLea2; + const newFilteredFlatRows = []; + const newFilteredRowsById = {}; + const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100; + + // Filters top level and nested rows + const recurseFilterRows = function (rowsToFilter, depth) { + if (depth === void 0) { + depth = 0; + } + // Filter from parents downward first + + const rows = []; + + // Apply the filter to any subRows + for (let i = 0; i < rowsToFilter.length; i++) { + let row = rowsToFilter[i]; + const pass = filterRow(row); + if (pass) { + var _row$subRows2; + if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) { + const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId); + newRow.subRows = recurseFilterRows(row.subRows, depth + 1); + row = newRow; + } + rows.push(row); + newFilteredFlatRows.push(row); + newFilteredRowsById[row.id] = row; + } + } + return rows; + }; + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById + }; + } + + function getFacetedRowModel() { + return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => { + if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + return preRowModel; + } + const filterableIds = [...columnFilters.map(d => d.id).filter(d => d !== columnId), globalFilter ? '__global__' : undefined].filter(Boolean); + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + return filterRows(preRowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')); + } + + function getFacetedUniqueValues() { + return (table, columnId) => memo(() => { + var _table$getColumn; + return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()]; + }, facetedRowModel => { + if (!facetedRowModel) return new Map(); + let facetedUniqueValues = new Map(); + for (let i = 0; i < facetedRowModel.flatRows.length; i++) { + const values = facetedRowModel.flatRows[i].getUniqueValues(columnId); + for (let j = 0; j < values.length; j++) { + const value = values[j]; + if (facetedUniqueValues.has(value)) { + var _facetedUniqueValues$; + facetedUniqueValues.set(value, ((_facetedUniqueValues$ = facetedUniqueValues.get(value)) != null ? _facetedUniqueValues$ : 0) + 1); + } else { + facetedUniqueValues.set(value, 1); + } + } + } + return facetedUniqueValues; + }, getMemoOptions(table.options, 'debugTable', `getFacetedUniqueValues_${columnId}`)); + } + + function getFilteredRowModel() { + return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => { + if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) { + for (let i = 0; i < rowModel.flatRows.length; i++) { + rowModel.flatRows[i].columnFilters = {}; + rowModel.flatRows[i].columnFiltersMeta = {}; + } + return rowModel; + } + const resolvedColumnFilters = []; + const resolvedGlobalFilters = []; + (columnFilters != null ? columnFilters : []).forEach(d => { + var _filterFn$resolveFilt; + const column = table.getColumn(d.id); + if (!column) { + return; + } + const filterFn = column.getFilterFn(); + if (!filterFn) { + { + console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`); + } + return; + } + resolvedColumnFilters.push({ + id: d.id, + filterFn, + resolvedValue: (_filterFn$resolveFilt = filterFn.resolveFilterValue == null ? void 0 : filterFn.resolveFilterValue(d.value)) != null ? _filterFn$resolveFilt : d.value + }); + }); + const filterableIds = (columnFilters != null ? columnFilters : []).map(d => d.id); + const globalFilterFn = table.getGlobalFilterFn(); + const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter()); + if (globalFilter && globalFilterFn && globallyFilterableColumns.length) { + filterableIds.push('__global__'); + globallyFilterableColumns.forEach(column => { + var _globalFilterFn$resol; + resolvedGlobalFilters.push({ + id: column.id, + filterFn: globalFilterFn, + resolvedValue: (_globalFilterFn$resol = globalFilterFn.resolveFilterValue == null ? void 0 : globalFilterFn.resolveFilterValue(globalFilter)) != null ? _globalFilterFn$resol : globalFilter + }); + }); + } + let currentColumnFilter; + let currentGlobalFilter; + + // Flag the prefiltered row model with each filter state + for (let j = 0; j < rowModel.flatRows.length; j++) { + const row = rowModel.flatRows[j]; + row.columnFilters = {}; + if (resolvedColumnFilters.length) { + for (let i = 0; i < resolvedColumnFilters.length; i++) { + currentColumnFilter = resolvedColumnFilters[i]; + const id = currentColumnFilter.id; + + // Tag the row with the column filter state + row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + }); + } + } + if (resolvedGlobalFilters.length) { + for (let i = 0; i < resolvedGlobalFilters.length; i++) { + currentGlobalFilter = resolvedGlobalFilters[i]; + const id = currentGlobalFilter.id; + // Tag the row with the first truthy global filter state + if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => { + row.columnFiltersMeta[id] = filterMeta; + })) { + row.columnFilters.__global__ = true; + break; + } + } + if (row.columnFilters.__global__ !== true) { + row.columnFilters.__global__ = false; + } + } + } + const filterRowsImpl = row => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]] === false) { + return false; + } + } + return true; + }; + + // Filter final rows using all of the active filters + return filterRows(rowModel.rows, filterRowsImpl, table); + }, getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => table._autoResetPageIndex())); + } + + function getGroupedRowModel() { + return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => { + if (!rowModel.rows.length || !grouping.length) { + rowModel.rows.forEach(row => { + row.depth = 0; + row.parentId = undefined; + }); + return rowModel; + } + + // Filter the grouping list down to columns that exist + const existingGrouping = grouping.filter(columnId => table.getColumn(columnId)); + const groupedFlatRows = []; + const groupedRowsById = {}; + // const onlyGroupedFlatRows: Row[] = []; + // const onlyGroupedRowsById: Record = {}; + // const nonGroupedFlatRows: Row[] = []; + // const nonGroupedRowsById: Record = {}; + + // Recursively group the data + const groupUpRecursively = function (rows, depth, parentId) { + if (depth === void 0) { + depth = 0; + } + // Grouping depth has been been met + // Stop grouping and simply rewrite thd depth and row relationships + if (depth >= existingGrouping.length) { + return rows.map(row => { + row.depth = depth; + groupedFlatRows.push(row); + groupedRowsById[row.id] = row; + if (row.subRows) { + row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id); + } + return row; + }); + } + const columnId = existingGrouping[depth]; + + // Group the rows together for this level + const rowGroupsMap = groupBy(rows, columnId); + + // Perform aggregations for each group + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { + let [groupingValue, groupedRows] = _ref; + let id = `${columnId}:${groupingValue}`; + id = parentId ? `${parentId}>${id}` : id; + + // First, Recurse to group sub rows before aggregation + const subRows = groupUpRecursively(groupedRows, depth + 1, id); + subRows.forEach(subRow => { + subRow.parentId = id; + }); + + // Flatten the leaf rows of the rows in this group + const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows; + const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId); + Object.assign(row, { + groupingColumnId: columnId, + groupingValue, + subRows, + leafRows, + getValue: columnId => { + // Don't aggregate columns that are in the grouping + if (existingGrouping.includes(columnId)) { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId]; + } + if (groupedRows[0]) { + var _groupedRows$0$getVal; + row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined; + } + return row._valuesCache[columnId]; + } + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId]; + } + + // Aggregate the values + const column = table.getColumn(columnId); + const aggregateFn = column == null ? void 0 : column.getAggregationFn(); + if (aggregateFn) { + row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows); + return row._groupingValuesCache[columnId]; + } + } + }); + subRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return row; + }); + return aggregatedGroupedRows; + }; + const groupedRows = groupUpRecursively(rowModel.rows, 0); + groupedRows.forEach(subRow => { + groupedFlatRows.push(subRow); + groupedRowsById[subRow.id] = subRow; + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }); + return { + rows: groupedRows, + flatRows: groupedFlatRows, + rowsById: groupedRowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => { + table._queue(() => { + table._autoResetExpanded(); + table._autoResetPageIndex(); + }); + })); + } + function groupBy(rows, columnId) { + const groupMap = new Map(); + return rows.reduce((map, row) => { + const resKey = `${row.getGroupingValue(columnId)}`; + const previous = map.get(resKey); + if (!previous) { + map.set(resKey, [row]); + } else { + previous.push(row); + } + return map; + }, groupMap); + } + + function getPaginationRowModel(opts) { + return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => { + if (!rowModel.rows.length) { + return rowModel; + } + const { + pageSize, + pageIndex + } = pagination; + let { + rows, + flatRows, + rowsById + } = rowModel; + const pageStart = pageSize * pageIndex; + const pageEnd = pageStart + pageSize; + rows = rows.slice(pageStart, pageEnd); + let paginatedRowModel; + if (!table.options.paginateExpandedRows) { + paginatedRowModel = expandRows({ + rows, + flatRows, + rowsById + }); + } else { + paginatedRowModel = { + rows, + flatRows, + rowsById + }; + } + paginatedRowModel.flatRows = []; + const handleRow = row => { + paginatedRowModel.flatRows.push(row); + if (row.subRows.length) { + row.subRows.forEach(handleRow); + } + }; + paginatedRowModel.rows.forEach(handleRow); + return paginatedRowModel; + }, getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')); + } + + function getSortedRowModel() { + return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => { + if (!rowModel.rows.length || !(sorting != null && sorting.length)) { + return rowModel; + } + const sortingState = table.getState().sorting; + const sortedFlatRows = []; + + // Filter out sortings that correspond to non existing columns + const availableSorting = sortingState.filter(sort => { + var _table$getColumn; + return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort(); + }); + const columnInfoById = {}; + availableSorting.forEach(sortEntry => { + const column = table.getColumn(sortEntry.id); + if (!column) return; + columnInfoById[sortEntry.id] = { + sortUndefined: column.columnDef.sortUndefined, + invertSorting: column.columnDef.invertSorting, + sortingFn: column.getSortingFn() + }; + }); + const sortData = rows => { + // This will also perform a stable sorting using the row index + // if needed. + const sortedData = rows.map(row => ({ + ...row + })); + sortedData.sort((rowA, rowB) => { + for (let i = 0; i < availableSorting.length; i += 1) { + var _sortEntry$desc; + const sortEntry = availableSorting[i]; + const columnInfo = columnInfoById[sortEntry.id]; + const sortUndefined = columnInfo.sortUndefined; + const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false; + let sortInt = 0; + + // All sorting ints should always return in ascending order + if (sortUndefined) { + const aValue = rowA.getValue(sortEntry.id); + const bValue = rowB.getValue(sortEntry.id); + const aUndefined = aValue === undefined; + const bUndefined = bValue === undefined; + if (aUndefined || bUndefined) { + if (sortUndefined === 'first') return aUndefined ? -1 : 1; + if (sortUndefined === 'last') return aUndefined ? 1 : -1; + sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined; + } + } + if (sortInt === 0) { + sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id); + } + + // If sorting is non-zero, take care of desc and inversion + if (sortInt !== 0) { + if (isDesc) { + sortInt *= -1; + } + if (columnInfo.invertSorting) { + sortInt *= -1; + } + return sortInt; + } + } + return rowA.index - rowB.index; + }); + + // If there are sub-rows, sort them + sortedData.forEach(row => { + var _row$subRows; + sortedFlatRows.push(row); + if ((_row$subRows = row.subRows) != null && _row$subRows.length) { + row.subRows = sortData(row.subRows); + } + }); + return sortedData; + }; + return { + rows: sortData(rowModel.rows), + flatRows: sortedFlatRows, + rowsById: rowModel.rowsById + }; + }, getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => table._autoResetPageIndex())); + } + + exports.ColumnFaceting = ColumnFaceting; + exports.ColumnFiltering = ColumnFiltering; + exports.ColumnGrouping = ColumnGrouping; + exports.ColumnOrdering = ColumnOrdering; + exports.ColumnPinning = ColumnPinning; + exports.ColumnSizing = ColumnSizing; + exports.ColumnVisibility = ColumnVisibility; + exports.GlobalFaceting = GlobalFaceting; + exports.GlobalFiltering = GlobalFiltering; + exports.Headers = Headers; + exports.RowExpanding = RowExpanding; + exports.RowPagination = RowPagination; + exports.RowPinning = RowPinning; + exports.RowSelection = RowSelection; + exports.RowSorting = RowSorting; + exports._getVisibleLeafColumns = _getVisibleLeafColumns; + exports.aggregationFns = aggregationFns; + exports.buildHeaderGroups = buildHeaderGroups; + exports.createCell = createCell; + exports.createColumn = createColumn; + exports.createColumnHelper = createColumnHelper; + exports.createRow = createRow; + exports.createTable = createTable; + exports.defaultColumnSizing = defaultColumnSizing; + exports.expandRows = expandRows; + exports.filterFns = filterFns; + exports.flattenBy = flattenBy; + exports.functionalUpdate = functionalUpdate; + exports.getCoreRowModel = getCoreRowModel; + exports.getExpandedRowModel = getExpandedRowModel; + exports.getFacetedMinMaxValues = getFacetedMinMaxValues; + exports.getFacetedRowModel = getFacetedRowModel; + exports.getFacetedUniqueValues = getFacetedUniqueValues; + exports.getFilteredRowModel = getFilteredRowModel; + exports.getGroupedRowModel = getGroupedRowModel; + exports.getMemoOptions = getMemoOptions; + exports.getPaginationRowModel = getPaginationRowModel; + exports.getSortedRowModel = getSortedRowModel; + exports.isFunction = isFunction; + exports.isNumberArray = isNumberArray; + exports.isRowSelected = isRowSelected; + exports.isSubRowSelected = isSubRowSelected; + exports.makeStateUpdater = makeStateUpdater; + exports.memo = memo; + exports.noop = noop; + exports.orderColumns = orderColumns; + exports.passiveEventSupported = passiveEventSupported; + exports.reSplitAlphaNumeric = reSplitAlphaNumeric; + exports.selectRowsFn = selectRowsFn; + exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter; + exports.sortingFns = sortingFns; + +})); +//# sourceMappingURL=index.development.js.map diff --git a/node_modules/@tanstack/table-core/build/umd/index.development.js.map b/node_modules/@tanstack/table-core/build/umd/index.development.js.map new file mode 100644 index 00000000..0e6b87ef --- /dev/null +++ b/node_modules/@tanstack/table-core/build/umd/index.development.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.development.js","sources":["../../src/columnHelper.ts","../../src/utils.ts","../../src/core/cell.ts","../../src/core/column.ts","../../src/core/headers.ts","../../src/core/row.ts","../../src/features/ColumnFaceting.ts","../../src/filterFns.ts","../../src/features/ColumnFiltering.ts","../../src/aggregationFns.ts","../../src/features/ColumnGrouping.ts","../../src/features/ColumnOrdering.ts","../../src/features/ColumnPinning.ts","../../src/utils/document.ts","../../src/features/ColumnSizing.ts","../../src/features/ColumnVisibility.ts","../../src/features/GlobalFaceting.ts","../../src/features/GlobalFiltering.ts","../../src/features/RowExpanding.ts","../../src/features/RowPagination.ts","../../src/features/RowPinning.ts","../../src/features/RowSelection.ts","../../src/sortingFns.ts","../../src/features/RowSorting.ts","../../src/core/table.ts","../../src/utils/getCoreRowModel.ts","../../src/utils/getExpandedRowModel.ts","../../src/utils/getFacetedMinMaxValues.ts","../../src/utils/filterRowsUtils.ts","../../src/utils/getFacetedRowModel.ts","../../src/utils/getFacetedUniqueValues.ts","../../src/utils/getFilteredRowModel.ts","../../src/utils/getGroupedRowModel.ts","../../src/utils/getPaginationRowModel.ts","../../src/utils/getSortedRowModel.ts"],"sourcesContent":["import {\n AccessorFn,\n AccessorFnColumnDef,\n AccessorKeyColumnDef,\n DisplayColumnDef,\n GroupColumnDef,\n IdentifiedColumnDef,\n RowData,\n} from './types'\nimport { DeepKeys, DeepValue } from './utils'\n\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nexport type ColumnHelper = {\n accessor: <\n TAccessor extends AccessorFn | DeepKeys,\n TValue extends TAccessor extends AccessorFn\n ? TReturn\n : TAccessor extends DeepKeys\n ? DeepValue\n : never,\n >(\n accessor: TAccessor,\n column: TAccessor extends AccessorFn\n ? DisplayColumnDef\n : IdentifiedColumnDef\n ) => TAccessor extends AccessorFn\n ? AccessorFnColumnDef\n : AccessorKeyColumnDef\n display: (column: DisplayColumnDef) => DisplayColumnDef\n group: (column: GroupColumnDef) => GroupColumnDef\n}\n\nexport function createColumnHelper<\n TData extends RowData,\n>(): ColumnHelper {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function'\n ? ({\n ...column,\n accessorFn: accessor,\n } as any)\n : {\n ...column,\n accessorKey: accessor,\n }\n },\n display: column => column,\n group: column => column,\n }\n}\n","import { TableOptionsResolved, TableState, Updater } from './types'\n\nexport type PartialKeys = Omit & Partial>\nexport type RequiredKeys = Omit &\n Required>\nexport type Overwrite = Omit<\n T,\n keyof U\n> &\n U\n\nexport type UnionToIntersection = (\n T extends any ? (x: T) => any : never\n) extends (x: infer R) => any\n ? R\n : never\n\nexport type IsAny = 1 extends 0 & T ? Y : N\nexport type IsKnown = unknown extends T ? N : Y\n\ntype ComputeRange<\n N extends number,\n Result extends Array = [],\n> = Result['length'] extends N\n ? Result\n : ComputeRange\ntype Index40 = ComputeRange<40>[number]\n\n// Is this type a tuple?\ntype IsTuple = T extends readonly any[] & { length: infer Length }\n ? Length extends Index40\n ? T\n : never\n : never\n\n// If this type is a tuple, what indices are allowed?\ntype AllowedIndexes<\n Tuple extends ReadonlyArray,\n Keys extends number = never,\n> = Tuple extends readonly []\n ? Keys\n : Tuple extends readonly [infer _, ...infer Tail]\n ? AllowedIndexes\n : Keys\n\nexport type DeepKeys = TDepth['length'] extends 5\n ? never\n : unknown extends T\n ? string\n : T extends readonly any[] & IsTuple\n ? AllowedIndexes | DeepKeysPrefix, TDepth>\n : T extends any[]\n ? DeepKeys\n : T extends Date\n ? never\n : T extends object\n ? (keyof T & string) | DeepKeysPrefix\n : never\n\ntype DeepKeysPrefix<\n T,\n TPrefix,\n TDepth extends any[],\n> = TPrefix extends keyof T & (number | string)\n ? `${TPrefix}.${DeepKeys & string}`\n : never\n\nexport type DeepValue =\n T extends Record\n ? TProp extends `${infer TBranch}.${infer TDeepProp}`\n ? DeepValue\n : T[TProp & string]\n : never\n\nexport type NoInfer = [T][T extends any ? 0 : never]\n\nexport type Getter = () => NoInfer\n\n///\n\nexport function functionalUpdate(updater: Updater, input: T): T {\n return typeof updater === 'function'\n ? (updater as (input: T) => T)(input)\n : updater\n}\n\nexport function noop() {\n //\n}\n\nexport function makeStateUpdater(\n key: K,\n instance: unknown\n) {\n return (updater: Updater) => {\n ;(instance as any).setState((old: TTableState) => {\n return {\n ...old,\n [key]: functionalUpdate(updater, (old as any)[key]),\n }\n })\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\nexport function isFunction(d: any): d is T {\n return d instanceof Function\n}\n\nexport function isNumberArray(d: any): d is number[] {\n return Array.isArray(d) && d.every(val => typeof val === 'number')\n}\n\nexport function flattenBy(\n arr: TNode[],\n getChildren: (item: TNode) => TNode[]\n) {\n const flat: TNode[] = []\n\n const recurse = (subArr: TNode[]) => {\n subArr.forEach(item => {\n flat.push(item)\n const children = getChildren(item)\n if (children?.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\nexport function memo(\n getDeps: (depArgs?: TDepArgs) => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: any\n debug?: () => any\n onChange?: (result: TResult) => void\n }\n): (depArgs?: TDepArgs) => TResult {\n let deps: any[] = []\n let result: TResult | undefined\n\n return depArgs => {\n let depTime: number\n if (opts.key && opts.debug) depTime = Date.now()\n\n const newDeps = getDeps(depArgs)\n\n const depsChanged =\n newDeps.length !== deps.length ||\n newDeps.some((dep: any, index: number) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime: number\n if (opts.key && opts.debug) resultTime = Date.now()\n\n result = fn(...newDeps)\n opts?.onChange?.(result)\n\n if (opts.key && opts.debug) {\n if (opts?.debug()) {\n const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120)\n )}deg 100% 31%);`,\n opts?.key\n )\n }\n }\n\n return result!\n }\n}\n\nexport function getMemoOptions(\n tableOptions: Partial>,\n debugLevel:\n | 'debugAll'\n | 'debugCells'\n | 'debugTable'\n | 'debugColumns'\n | 'debugRows'\n | 'debugHeaders',\n key: string,\n onChange?: (result: any) => void\n) {\n return {\n debug: () => tableOptions?.debugAll ?? tableOptions[debugLevel],\n key: process.env.NODE_ENV === 'development' && key,\n onChange,\n }\n}\n","import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, getMemoOptions, memo } from '../utils'\n\nexport interface CellContext {\n cell: Cell\n column: Column\n getValue: Getter\n renderValue: Getter\n row: Row\n table: Table\n}\n\nexport interface CoreCell {\n /**\n * The associated Column object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n column: Column\n /**\n * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice:\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getContext: () => CellContext\n /**\n * Returns the value for the cell, accessed via the associated column's accessor key or accessor function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getValue: CellContext['getValue']\n /**\n * The unique ID for the cell across the entire table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n id: string\n /**\n * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n renderValue: CellContext['renderValue']\n /**\n * The associated Row object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n row: Row\n}\n\nexport function createCell(\n table: Table,\n row: Row,\n column: Column,\n columnId: string\n): Cell {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n getMemoOptions(table.options, 'debugCells', 'cell.getContext')\n ),\n }\n\n table._features.forEach(feature => {\n feature.createCell?.(\n cell as Cell,\n column,\n row as Row,\n table\n )\n }, {})\n\n return cell as Cell\n}\n","import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport interface CoreColumn {\n /**\n * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n accessorFn?: AccessorFn\n /**\n * The original column def used to create the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columnDef: ColumnDef\n /**\n * The child column (if the column is a group column). Will be an empty array if the column is not a group column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columns: Column[]\n /**\n * The depth of the column (if grouped) relative to the root column def array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n depth: number\n /**\n * Returns the flattened array of this column and all child/grand-child columns for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getFlatColumns: () => Column[]\n /**\n * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getLeafColumns: () => Column[]\n /**\n * The resolved unique identifier for the column resolved in this priority:\n - A manual `id` property from the column def\n - The accessor key from the column def\n - The header string from the column def\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n id: string\n /**\n * The parent column for this column. Will be undefined if this is a root column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n parent?: Column\n}\n\nexport function createColumn(\n table: Table,\n columnDef: ColumnDef,\n depth: number,\n parent?: Column\n): Column {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey\n ? typeof String.prototype.replaceAll === 'function'\n ? accessorKey.replaceAll('.', '_')\n : accessorKey.replace(/\\./g, '_')\n : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')\n ),\n }\n\n for (const feature of table._features) {\n feature.createColumn?.(column as Column, table)\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column as Column\n}\n","import {\n RowData,\n Column,\n Header,\n HeaderGroup,\n Table,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nconst debug = 'debugHeaders'\n\nexport interface CoreHeaderGroup {\n depth: number\n headers: Header[]\n id: string\n}\n\nexport interface HeaderContext {\n /**\n * An instance of a column.\n */\n column: Column\n /**\n * An instance of a header.\n */\n header: Header\n /**\n * The table instance.\n */\n table: Table\n}\n\nexport interface CoreHeader {\n /**\n * The col-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n colSpan: number\n /**\n * The header's associated column object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n column: Column\n /**\n * The depth of the header, zero-indexed based.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n depth: number\n /**\n * Returns the rendering context (or props) for column-based components like headers, footers and filters.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getContext: () => HeaderContext\n /**\n * Returns the leaf headers hierarchically nested under this header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * The header's associated header group object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n headerGroup: HeaderGroup\n /**\n * The unique identifier for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n id: string\n /**\n * The index for the header within the header group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n index: number\n /**\n * A boolean denoting if the header is a placeholder header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n isPlaceholder: boolean\n /**\n * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n placeholderId?: string\n /**\n * The row-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n rowSpan: number\n /**\n * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n subHeaders: Header[]\n}\n\nexport interface HeadersInstance {\n /**\n * Returns all header groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightHeaderGroups: () => HeaderGroup[]\n\n /**\n * Returns the footer groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFooterGroups: () => HeaderGroup[]\n\n /**\n * Returns headers for all columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFlatHeaders: () => Header[]\n\n /**\n * Returns headers for all leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightLeafHeaders: () => Header[]\n}\n\n//\n\nfunction createHeader(\n table: Table,\n column: Column,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header {\n const id = options.id ?? column.id\n\n let header: CoreHeader = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header[] => {\n const leafHeaders: Header[] = []\n\n const recurseHeader = (h: CoreHeader) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n feature.createHeader?.(header as Header, table)\n })\n\n return header as Header\n}\n\nexport const Headers: TableFeature = {\n createTable: (table: Table): void => {\n // Header Groups\n\n table.getHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n getMemoOptions(table.options, debug, 'getHeaderGroups')\n )\n\n table.getCenterHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n getMemoOptions(table.options, debug, 'getCenterHeaderGroups')\n )\n\n table.getLeftHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')\n },\n getMemoOptions(table.options, debug, 'getLeftHeaderGroups')\n )\n\n table.getRightHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')\n },\n getMemoOptions(table.options, debug, 'getRightHeaderGroups')\n )\n\n // Footer Groups\n\n table.getFooterGroups = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getFooterGroups')\n )\n\n table.getLeftFooterGroups = memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getLeftFooterGroups')\n )\n\n table.getCenterFooterGroups = memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getCenterFooterGroups')\n )\n\n table.getRightFooterGroups = memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getRightFooterGroups')\n )\n\n // Flat Headers\n\n table.getFlatHeaders = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getFlatHeaders')\n )\n\n table.getLeftFlatHeaders = memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeftFlatHeaders')\n )\n\n table.getCenterFlatHeaders = memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getCenterFlatHeaders')\n )\n\n table.getRightFlatHeaders = memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getRightFlatHeaders')\n )\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getCenterLeafHeaders')\n )\n\n table.getLeftLeafHeaders = memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getLeftLeafHeaders')\n )\n\n table.getRightLeafHeaders = memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getRightLeafHeaders')\n )\n\n table.getLeafHeaders = memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeafHeaders')\n )\n },\n}\n\nexport function buildHeaderGroups(\n allColumns: Column[],\n columnsToGroup: Column[],\n table: Table,\n headerFamily?: 'center' | 'left' | 'right'\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (columns: Column[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Header[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader?.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup?.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter(d => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n","import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow {\n _getAllCellsByColumnId: () => Record>\n _uniqueValuesCache: Record\n _valuesCache: Record\n /**\n * The depth of the row (if nested or grouped) relative to the root row array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n depth: number\n /**\n * Returns all of the cells for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getallcells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getAllCells: () => Cell[]\n /**\n * Returns the leaf rows for the row, not including any parent rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getLeafRows: () => Row[]\n /**\n * Returns the parent row for the row, if it exists.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRow: () => Row | undefined\n /**\n * Returns the parent rows for the row, all the way up to a root row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRows: () => Row[]\n /**\n * Returns a unique array of values from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getuniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getUniqueValues: (columnId: string) => TValue[]\n /**\n * Returns the value from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getValue: (columnId: string) => TValue\n /**\n * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n id: string\n /**\n * The index of the row within its parent array (or the root data array).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n index: number\n /**\n * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#original)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n original: TData\n /**\n * An array of the original subRows as returned by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#originalsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n originalSubRows?: TData[]\n /**\n * If nested, this row's parent row id.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#parentid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n parentId?: string\n /**\n * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n renderValue: (columnId: string) => TValue\n /**\n * An array of subRows for the row as returned and created by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#subrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n subRows: Row[]\n}\n\nexport const createRow = (\n table: Table,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row[],\n parentId?: string\n): Row => {\n let row: CoreRow = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () =>\n row.parentId ? table.getRow(row.parentId, true) : undefined,\n getParentRows: () => {\n let parentRows: Row[] = []\n let currentRow = row\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n },\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row, column, column.id)\n })\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCells')\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce(\n (acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n feature?.createRow?.(row as Row, table)\n }\n\n return row as Row\n}\n","import { RowModel } from '..'\nimport { Column, RowData, Table, TableFeature } from '../types'\n\nexport interface FacetedColumn {\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n _getFacetedRowModel?: () => RowModel\n _getFacetedUniqueValues?: () => Map\n /**\n * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.\n * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedRowModel: () => RowModel\n /**\n * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedUniqueValues: () => Map\n}\n\nexport interface FacetedOptions {\n getFacetedMinMaxValues?: (\n table: Table,\n columnId: string\n ) => () => undefined | [number, number]\n getFacetedRowModel?: (\n table: Table,\n columnId: string\n ) => () => RowModel\n getFacetedUniqueValues?: (\n table: Table,\n columnId: string\n ) => () => Map\n}\n\n//\n\nexport const ColumnFaceting: TableFeature = {\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column._getFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, column.id)\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return column._getFacetedRowModel()\n }\n column._getFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, column.id)\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map()\n }\n\n return column._getFacetedUniqueValues()\n }\n column._getFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, column.id)\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined\n }\n\n return column._getFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn } from './features/ColumnFiltering'\n\nconst includesString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n const search = filterValue?.toString()?.toLowerCase()\n return Boolean(\n row\n .getValue(columnId)\n ?.toString()\n ?.toLowerCase()\n ?.includes(search)\n )\n}\n\nincludesString.autoRemove = (val: any) => testFalsey(val)\n\nconst includesStringSensitive: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return Boolean(\n row.getValue(columnId)?.toString()?.includes(filterValue)\n )\n}\n\nincludesStringSensitive.autoRemove = (val: any) => testFalsey(val)\n\nconst equalsString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return (\n row.getValue(columnId)?.toString()?.toLowerCase() ===\n filterValue?.toLowerCase()\n )\n}\n\nequalsString.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludes: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId)?.includes(filterValue)\n}\n\narrIncludes.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludesAll: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return !filterValue.some(\n val => !row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst arrIncludesSome: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return filterValue.some(val =>\n row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesSome.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst equals: FilterFn = (row, columnId: string, filterValue: unknown) => {\n return row.getValue(columnId) === filterValue\n}\n\nequals.autoRemove = (val: any) => testFalsey(val)\n\nconst weakEquals: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId) == filterValue\n}\n\nweakEquals.autoRemove = (val: any) => testFalsey(val)\n\nconst inNumberRange: FilterFn = (\n row,\n columnId: string,\n filterValue: [number, number]\n) => {\n let [min, max] = filterValue\n\n const rowValue = row.getValue(columnId)\n return rowValue >= min && rowValue <= max\n}\n\ninNumberRange.resolveFilterValue = (val: [any, any]) => {\n let [unsafeMin, unsafeMax] = val\n\n let parsedMin =\n typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin\n let parsedMax =\n typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax\n\n let min =\n unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax\n\n if (min > max) {\n const temp = min\n min = max\n max = temp\n }\n\n return [min, max] as const\n}\n\ninNumberRange.autoRemove = (val: any) =>\n testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]))\n\n// Export\n\nexport const filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange,\n}\n\nexport type BuiltInFilterFn = keyof typeof filterFns\n\n// Utils\n\nfunction testFalsey(val: any) {\n return val === undefined || val === null || val === ''\n}\n","import { RowModel } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n FilterFns,\n FilterMeta,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface ColumnFiltersTableState {\n columnFilters: ColumnFiltersState\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter {\n filterFn: FilterFn\n id: string\n resolvedValue: unknown\n}\n\nexport interface FilterFn {\n (\n row: Row,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n autoRemove?: ColumnFilterAutoRemoveTestFn\n resolveFilterValue?: TransformFilterValueFn\n}\n\nexport type TransformFilterValueFn = (\n value: any,\n column?: Column\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn = (\n value: any,\n column?: Column\n) => boolean\n\nexport type CustomFilterFns = Record<\n string,\n FilterFn\n>\n\nexport type FilterFnOption =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn\n\nexport interface ColumnFiltersColumnDef {\n /**\n * Enables/disables the **column** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilter?: boolean\n /**\n * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFn?: FilterFnOption\n}\n\nexport interface ColumnFiltersColumn {\n /**\n * Returns an automatically calculated filter function for the column based off of the columns first known value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns whether or not the column can be **column** filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getCanFilter: () => boolean\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterFn: () => FilterFn | undefined\n /**\n * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterIndex: () => number\n /**\n * Returns the current filter value for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterValue: () => unknown\n /**\n * Returns whether or not the column is currently filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getIsFiltered: () => boolean\n /**\n * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setFilterValue: (updater: Updater) => void\n}\n\nexport interface ColumnFiltersRow {\n /**\n * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFilters: Record\n /**\n * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFiltersMeta: Record\n}\n\ninterface ColumnFiltersOptionsBase {\n /**\n * Enables/disables **column** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilters?: boolean\n /**\n * Enables/disables all filtering for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableFilters?: boolean\n /**\n * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFromLeafRows?: boolean\n /**\n * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.\n * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.\n * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel?: (table: Table) => () => RowModel\n /**\n * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n manualFiltering?: boolean\n /**\n * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.\n\n * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n maxLeafRowFilterDepth?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n onColumnFiltersChange?: OnChangeFn\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record>\n }\n : {\n filterFns: Record>\n }\n\nexport interface ColumnFiltersOptions\n extends ColumnFiltersOptionsBase,\n ResolvedFilterFns {}\n\nexport interface ColumnFiltersInstance {\n _getFilteredRowModel?: () => RowModel\n /**\n * Returns the row model for the table after **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel: () => RowModel\n /**\n * Returns the row model for the table before any **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getPreFilteredRowModel: () => RowModel\n /**\n * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetColumnFilters: (defaultState?: boolean) => void\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnFilters` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setColumnFilters: (updater: Updater) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnFiltering: TableFeature = {\n getDefaultColumnDef: <\n TData extends RowData,\n >(): ColumnFiltersColumnDef => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): ColumnFiltersTableState => {\n return {\n columnFilters: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnFiltersOptions => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n } as ColumnFiltersOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return filterFns.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns.arrIncludes\n }\n\n return filterFns.weakEquals\n }\n column.getFilterFn = () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n : // @ts-ignore\n table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n }\n column.getCanFilter = () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getIsFiltered = () => column.getFilterIndex() > -1\n\n column.getFilterValue = () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value\n\n column.getFilterIndex = () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1\n\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\n const previousFilter = old?.find(d => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined\n )\n\n //\n if (\n shouldAutoRemoveFilter(filterFn as FilterFn, newFilter, column)\n ) {\n return old?.filter(d => d.id !== column.id) ?? []\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n }\n },\n\n createRow: (\n row: Row,\n _table: Table\n ): void => {\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n },\n\n createTable: (table: Table): void => {\n table.setColumnFilters = (updater: Updater) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n }\n\n table.resetColumnFilters = defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n }\n\n table.getPreFilteredRowModel = () => table.getCoreRowModel()\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n }\n },\n}\n\nexport function shouldAutoRemoveFilter(\n filterFn?: FilterFn,\n value?: any,\n column?: Column\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n","import { AggregationFn } from './features/ColumnGrouping'\nimport { isNumberArray } from './utils'\n\nconst sum: AggregationFn = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId)\n return sum + (typeof nextValue === 'number' ? nextValue : 0)\n }, 0)\n}\n\nconst min: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n\n if (\n value != null &&\n (min! > value || (min === undefined && value >= value))\n ) {\n min = value\n }\n })\n\n return min\n}\n\nconst max: AggregationFn = (columnId, _leafRows, childRows) => {\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (\n value != null &&\n (max! < value || (max === undefined && value >= value))\n ) {\n max = value\n }\n })\n\n return max\n}\n\nconst extent: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value\n } else {\n if (min > value) min = value\n if (max! < value) max = value\n }\n }\n })\n\n return [min, max]\n}\n\nconst mean: AggregationFn = (columnId, leafRows) => {\n let count = 0\n let sum = 0\n\n leafRows.forEach(row => {\n let value = row.getValue(columnId)\n if (value != null && (value = +value) >= value) {\n ++count, (sum += value)\n }\n })\n\n if (count) return sum / count\n\n return\n}\n\nconst median: AggregationFn = (columnId, leafRows) => {\n if (!leafRows.length) {\n return\n }\n\n const values = leafRows.map(row => row.getValue(columnId))\n if (!isNumberArray(values)) {\n return\n }\n if (values.length === 1) {\n return values[0]\n }\n\n const mid = Math.floor(values.length / 2)\n const nums = values.sort((a, b) => a - b)\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1]! + nums[mid]!) / 2\n}\n\nconst unique: AggregationFn = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values())\n}\n\nconst uniqueCount: AggregationFn = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size\n}\n\nconst count: AggregationFn = (_columnId, leafRows) => {\n return leafRows.length\n}\n\nexport const aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count,\n}\n\nexport type BuiltInAggregationFn = keyof typeof aggregationFns\n","import { RowModel } from '..'\nimport { BuiltInAggregationFn, aggregationFns } from '../aggregationFns'\nimport {\n AggregationFns,\n Cell,\n Column,\n ColumnDefTemplate,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type GroupingState = string[]\n\nexport interface GroupingTableState {\n grouping: GroupingState\n}\n\nexport type AggregationFn = (\n columnId: string,\n leafRows: Row[],\n childRows: Row[]\n) => any\n\nexport type CustomAggregationFns = Record>\n\nexport type AggregationFnOption =\n | 'auto'\n | keyof AggregationFns\n | BuiltInAggregationFn\n | AggregationFn\n\nexport interface GroupingColumnDef {\n /**\n * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregatedCell?: ColumnDefTemplate<\n ReturnType['getContext']>\n >\n /**\n * The resolved aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregationFn?: AggregationFnOption\n /**\n * Enables/disables grouping for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue?: (row: TData) => any\n}\n\nexport interface GroupingColumn {\n /**\n * Returns the aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAggregationFn: () => AggregationFn | undefined\n /**\n * Returns the automatically inferred aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAutoAggregationFn: () => AggregationFn | undefined\n /**\n * Returns whether or not the column can be grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getCanGroup: () => boolean\n /**\n * Returns the index of the column in the grouping state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedIndex: () => number\n /**\n * Returns whether or not the column is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getToggleGroupingHandler: () => () => void\n /**\n * Toggles the grouping state of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n toggleGrouping: () => void\n}\n\nexport interface GroupingRow {\n _groupingValuesCache: Record\n /**\n * Returns the grouping value for any row and column (including leaf rows).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue: (columnId: string) => unknown\n /**\n * Returns whether or not the row is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * If this row is grouped, this is the id of the column that this row is grouped by.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingColumnId?: string\n /**\n * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingValue?: unknown\n}\n\nexport interface GroupingCell {\n /**\n * Returns whether or not the cell is currently aggregated.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsAggregated: () => boolean\n /**\n * Returns whether or not the cell is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns whether or not the cell is currently a placeholder cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsPlaceholder: () => boolean\n}\n\nexport interface ColumnDefaultOptions {\n enableGrouping: boolean\n onGroupingChange: OnChangeFn\n}\n\ninterface GroupingOptionsBase {\n /**\n * Enables/disables grouping for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Returns the row model after grouping has taken place, but no further.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel?: (table: Table) => () => RowModel\n /**\n * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupedColumnMode?: false | 'reorder' | 'remove'\n /**\n * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n manualGrouping?: boolean\n /**\n * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n onGroupingChange?: OnChangeFn\n}\n\ntype ResolvedAggregationFns = keyof AggregationFns extends never\n ? {\n aggregationFns?: Record>\n }\n : {\n aggregationFns: Record>\n }\n\nexport interface GroupingOptions\n extends GroupingOptionsBase,\n ResolvedAggregationFns {}\n\nexport type GroupingColumnMode = false | 'reorder' | 'remove'\n\nexport interface GroupingInstance {\n _getGroupedRowModel?: () => RowModel\n /**\n * Returns the row model for the table after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel: () => RowModel\n /**\n * Returns the row model for the table before any grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getPreGroupedRowModel: () => RowModel\n /**\n * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n resetGrouping: (defaultState?: boolean) => void\n /**\n * Updates the grouping state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n setGrouping: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnGrouping: TableFeature = {\n getDefaultColumnDef: (): GroupingColumnDef<\n TData,\n unknown\n > => {\n return {\n aggregatedCell: props => (props.getValue() as any)?.toString?.() ?? null,\n aggregationFn: 'auto',\n }\n },\n\n getInitialState: (state): GroupingTableState => {\n return {\n grouping: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GroupingOptions => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder',\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleGrouping = () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old?.includes(column.id)) {\n return old.filter(d => d !== column.id)\n }\n\n return [...(old ?? []), column.id]\n })\n }\n\n column.getCanGroup = () => {\n return (\n (column.columnDef.enableGrouping ?? true) &&\n (table.options.enableGrouping ?? true) &&\n (!!column.accessorFn || !!column.columnDef.getGroupingValue)\n )\n }\n\n column.getIsGrouped = () => {\n return table.getState().grouping?.includes(column.id)\n }\n\n column.getGroupedIndex = () => table.getState().grouping?.indexOf(column.id)\n\n column.getToggleGroupingHandler = () => {\n const canGroup = column.getCanGroup()\n\n return () => {\n if (!canGroup) return\n column.toggleGrouping()\n }\n }\n column.getAutoAggregationFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent\n }\n }\n column.getAggregationFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column.getAutoAggregationFn()\n : table.options.aggregationFns?.[\n column.columnDef.aggregationFn as string\n ] ??\n aggregationFns[\n column.columnDef.aggregationFn as BuiltInAggregationFn\n ]\n }\n },\n\n createTable: (table: Table): void => {\n table.setGrouping = updater => table.options.onGroupingChange?.(updater)\n\n table.resetGrouping = defaultState => {\n table.setGrouping(defaultState ? [] : table.initialState?.grouping ?? [])\n }\n\n table.getPreGroupedRowModel = () => table.getFilteredRowModel()\n table.getGroupedRowModel = () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table)\n }\n\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._getGroupedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getIsGrouped = () => !!row.groupingColumnId\n row.getGroupingValue = columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original\n )\n\n return row._groupingValuesCache[columnId]\n }\n row._groupingValuesCache = {}\n },\n\n createCell: (\n cell: Cell,\n column: Column,\n row: Row,\n table: Table\n ): void => {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n cell.getIsGrouped = () =>\n column.getIsGrouped() && column.id === row.groupingColumnId\n cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped()\n cell.getIsAggregated = () =>\n !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length\n },\n}\n\nexport function orderColumns(\n leafColumns: Column[],\n grouping: string[],\n groupedColumnMode?: GroupingColumnMode\n) {\n if (!grouping?.length || !groupedColumnMode) {\n return leafColumns\n }\n\n const nonGroupingColumns = leafColumns.filter(\n col => !grouping.includes(col.id)\n )\n\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns\n }\n\n const groupingColumns = grouping\n .map(g => leafColumns.find(col => col.id === g)!)\n .filter(Boolean)\n\n return [...groupingColumns, ...nonGroupingColumns]\n}\n","import { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nimport {\n Column,\n OnChangeFn,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\n\nimport { orderColumns } from './ColumnGrouping'\nimport { ColumnPinningPosition, _getVisibleLeafColumns } from '..'\n\nexport interface ColumnOrderTableState {\n columnOrder: ColumnOrderState\n}\n\nexport type ColumnOrderState = string[]\n\nexport interface ColumnOrderOptions {\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n onColumnOrderChange?: OnChangeFn\n}\n\nexport interface ColumnOrderColumn {\n /**\n * Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIndex: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns `true` if the column is the first column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the first in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getisfirstcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsFirstColumn: (position?: ColumnPinningPosition | 'center') => boolean\n /**\n * Returns `true` if the column is the last column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the last in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getislastcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsLastColumn: (position?: ColumnPinningPosition | 'center') => boolean\n}\n\nexport interface ColumnOrderDefaultOptions {\n onColumnOrderChange: OnChangeFn\n}\n\nexport interface ColumnOrderInstance {\n _getOrderColumnsFn: () => (\n columns: Column[]\n ) => Column[]\n /**\n * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n resetColumnOrder: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnOrder` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n setColumnOrder: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnOrdering: TableFeature = {\n getInitialState: (state): ColumnOrderTableState => {\n return {\n columnOrder: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnOrderDefaultOptions => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getIndex = memo(\n position => [_getVisibleLeafColumns(table, position)],\n columns => columns.findIndex(d => d.id === column.id),\n getMemoOptions(table.options, 'debugColumns', 'getIndex')\n )\n column.getIsFirstColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[0]?.id === column.id\n }\n column.getIsLastColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[columns.length - 1]?.id === column.id\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnOrder = updater =>\n table.options.onColumnOrderChange?.(updater)\n table.resetColumnOrder = defaultState => {\n table.setColumnOrder(\n defaultState ? [] : table.initialState.columnOrder ?? []\n )\n }\n table._getOrderColumnsFn = memo(\n () => [\n table.getState().columnOrder,\n table.getState().grouping,\n table.options.groupedColumnMode,\n ],\n (columnOrder, grouping, groupedColumnMode) =>\n (columns: Column[]) => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns: Column[] = []\n\n // If there is no order, return the normal columns\n if (!columnOrder?.length) {\n orderedColumns = columns\n } else {\n const columnOrderCopy = [...columnOrder]\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns]\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift()\n const foundIndex = columnsCopy.findIndex(\n d => d.id === targetColumnId\n )\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy]\n }\n\n return orderColumns(orderedColumns, grouping, groupedColumnMode)\n },\n getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')\n )\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Column,\n Row,\n Cell,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type ColumnPinningPosition = false | 'left' | 'right'\n\nexport interface ColumnPinningState {\n left?: string[]\n right?: string[]\n}\n\nexport interface ColumnPinningTableState {\n columnPinning: ColumnPinningState\n}\n\nexport interface ColumnPinningOptions {\n /**\n * Enables/disables column pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enableColumnPinning?: boolean\n /**\n * @deprecated Use `enableColumnPinning` or `enableRowPinning` instead.\n * Enables/disables all pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange)\n */\n onColumnPinningChange?: OnChangeFn\n}\n\nexport interface ColumnPinningDefaultOptions {\n onColumnPinningChange: OnChangeFn\n}\n\nexport interface ColumnPinningColumnDef {\n /**\n * Enables/disables column pinning for this column. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n}\n\nexport interface ColumnPinningColumn {\n /**\n * Returns whether or not the column can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcanpin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the column. (`'left'`, `'right'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getispinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsPinned: () => ColumnPinningPosition\n /**\n * Returns the numeric pinned index of the column within a pinned column group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getpinnedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a column to the `'left'` or `'right'`, or unpins the column to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#pin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n pin: (position: ColumnPinningPosition) => void\n}\n\nexport interface ColumnPinningRow {\n /**\n * Returns all center pinned (unpinned) leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcentervisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterVisibleCells: () => Cell[]\n /**\n * Returns all left pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftVisibleCells: () => Cell[]\n /**\n * Returns all right pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightVisibleCells: () => Cell[]\n}\n\nexport interface ColumnPinningInstance {\n /**\n * Returns all center pinned (unpinned) leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcenterleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterLeafColumns: () => Column[]\n /**\n * Returns whether or not any columns are pinned. Optionally specify to only check for pinned columns in either the `left` or `right` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getissomecolumnspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean\n /**\n * Returns all left pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftLeafColumns: () => Column[]\n /**\n * Returns all right pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightLeafColumns: () => Column[]\n /**\n * Resets the **columnPinning** state to `initialState.columnPinning`, or `true` can be passed to force a default blank state reset to `{ left: [], right: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#resetcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n resetColumnPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#setcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n setColumnPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultColumnPinningState = (): ColumnPinningState => ({\n left: [],\n right: [],\n})\n\nexport const ColumnPinning: TableFeature = {\n getInitialState: (state): ColumnPinningTableState => {\n return {\n columnPinning: getDefaultColumnPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnPinningDefaultOptions => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.pin = position => {\n const columnIds = column\n .getLeafColumns()\n .map(d => d.id)\n .filter(Boolean) as string[]\n\n table.setColumnPinning(old => {\n if (position === 'right') {\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: [\n ...(old?.right ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n }\n }\n\n if (position === 'left') {\n return {\n left: [\n ...(old?.left ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n }\n\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n })\n }\n\n column.getCanPin = () => {\n const leafColumns = column.getLeafColumns()\n\n return leafColumns.some(\n d =>\n (d.columnDef.enablePinning ?? true) &&\n (table.options.enableColumnPinning ??\n table.options.enablePinning ??\n true)\n )\n }\n\n column.getIsPinned = () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id)\n\n const { left, right } = table.getState().columnPinning\n\n const isLeft = leafColumnIds.some(d => left?.includes(d))\n const isRight = leafColumnIds.some(d => right?.includes(d))\n\n return isLeft ? 'left' : isRight ? 'right' : false\n }\n\n column.getPinnedIndex = () => {\n const position = column.getIsPinned()\n\n return position\n ? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1\n : 0\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getCenterVisibleCells = memo(\n () => [\n row._getAllVisibleCells(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allCells, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allCells.filter(d => !leftAndRight.includes(d.column.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')\n )\n row.getLeftVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.left],\n (allCells, left) => {\n const cells = (left ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'left' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')\n )\n row.getRightVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.right],\n (allCells, right) => {\n const cells = (right ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'right' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n table.setColumnPinning = updater =>\n table.options.onColumnPinningChange?.(updater)\n\n table.resetColumnPinning = defaultState =>\n table.setColumnPinning(\n defaultState\n ? getDefaultColumnPinningState()\n : table.initialState?.columnPinning ?? getDefaultColumnPinningState()\n )\n\n table.getIsSomeColumnsPinned = position => {\n const pinningState = table.getState().columnPinning\n\n if (!position) {\n return Boolean(pinningState.left?.length || pinningState.right?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table.getLeftLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.left],\n (allColumns, left) => {\n return (left ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')\n )\n\n table.getRightLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.right],\n (allColumns, right) => {\n return (right ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')\n )\n\n table.getCenterLeafColumns = memo(\n () => [\n table.getAllLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allColumns.filter(d => !leftAndRight.includes(d.id))\n },\n getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')\n )\n },\n}\n","export function safelyAccessDocument(_document?: Document): Document | null {\n return _document || (typeof document !== 'undefined' ? document : null)\n}\n\nexport function safelyAccessDocumentEvent(event: Event): Document | null {\n return !!event &&\n !!event.target &&\n typeof event.target === 'object' &&\n 'ownerDocument' in event.target\n ? (event.target.ownerDocument as Document | null)\n : null\n}\n","import { _getVisibleLeafColumns } from '..'\nimport {\n RowData,\n Column,\n Header,\n OnChangeFn,\n Table,\n Updater,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\nimport { ColumnPinningPosition } from './ColumnPinning'\nimport { safelyAccessDocument } from '../utils/document'\n\n//\n\nexport interface ColumnSizingTableState {\n columnSizing: ColumnSizingState\n columnSizingInfo: ColumnSizingInfoState\n}\n\nexport type ColumnSizingState = Record\n\nexport interface ColumnSizingInfoState {\n columnSizingStart: [string, number][]\n deltaOffset: null | number\n deltaPercentage: null | number\n isResizingColumn: false | string\n startOffset: null | number\n startSize: null | number\n}\n\nexport type ColumnResizeMode = 'onChange' | 'onEnd'\n\nexport type ColumnResizeDirection = 'ltr' | 'rtl'\n\nexport interface ColumnSizingOptions {\n /**\n * Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnresizemode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeMode?: ColumnResizeMode\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enablecolumnresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableColumnResizing?: boolean\n /**\n * Enables or disables right-to-left support for resizing the column. defaults to 'ltr'.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnResizeDirection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeDirection?: ColumnResizeDirection\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingChange?: OnChangeFn\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizingInfo` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizingInfo` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizinginfochange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingInfoChange?: OnChangeFn\n}\n\nexport type ColumnSizingDefaultOptions = Pick<\n ColumnSizingOptions,\n | 'columnResizeMode'\n | 'onColumnSizingChange'\n | 'onColumnSizingInfoChange'\n | 'columnResizeDirection'\n>\n\nexport interface ColumnSizingInstance {\n /**\n * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcentertotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCenterTotalSize: () => number\n /**\n * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getlefttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getLeftTotalSize: () => number\n /**\n * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getrighttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getRightTotalSize: () => number\n /**\n * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#gettotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getTotalSize: () => number\n /**\n * Resets column sizing to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetColumnSizing: (defaultState?: boolean) => void\n /**\n * Resets column sizing info to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetheadersizeinfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetHeaderSizeInfo: (defaultState?: boolean) => void\n /**\n * Sets the column sizing state using an updater function or a value. This will trigger the underlying `onColumnSizingChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizing: (updater: Updater) => void\n /**\n * Sets the column sizing info state using an updater function or a value. This will trigger the underlying `onColumnSizingInfoChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizinginfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizingInfo: (updater: Updater) => void\n}\n\nexport interface ColumnSizingColumnDef {\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableResizing?: boolean\n /**\n * The maximum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n maxSize?: number\n /**\n * The minimum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n minSize?: number\n /**\n * The desired size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n size?: number\n}\n\nexport interface ColumnSizingColumn {\n /**\n * Returns `true` if the column can be resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcanresize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCanResize: () => boolean\n /**\n * Returns `true` if the column is currently being resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getisresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getIsResizing: () => boolean\n /**\n * Returns the current size of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column.\n */\n getAfter: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Resets the column to its initial size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetSize: () => void\n}\n\nexport interface ColumnSizingHeader {\n /**\n * Returns an event handler function that can be used to resize the header. It can be used as an:\n * - `onMouseDown` handler\n * - `onTouchStart` handler\n *\n * The dragging and release events are automatically handled for you.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getresizehandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getResizeHandler: (context?: Document) => (event: unknown) => void\n /**\n * Returns the current size of the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition) => number\n}\n\n//\n\nexport const defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n}\n\nconst getDefaultColumnSizingInfoState = (): ColumnSizingInfoState => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: [],\n})\n\nexport const ColumnSizing: TableFeature = {\n getDefaultColumnDef: (): ColumnSizingColumnDef => {\n return defaultColumnSizing\n },\n getInitialState: (state): ColumnSizingTableState => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnSizingDefaultOptions => {\n return {\n columnResizeMode: 'onEnd',\n columnResizeDirection: 'ltr',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getSize = () => {\n const columnSize = table.getState().columnSizing[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultColumnSizing.minSize,\n columnSize ?? column.columnDef.size ?? defaultColumnSizing.size\n ),\n column.columnDef.maxSize ?? defaultColumnSizing.maxSize\n )\n }\n\n column.getStart = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(0, column.getIndex(position))\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getStart')\n )\n\n column.getAfter = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(column.getIndex(position) + 1)\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getAfter')\n )\n\n column.resetSize = () => {\n table.setColumnSizing(({ [column.id]: _, ...rest }) => {\n return rest\n })\n }\n column.getCanResize = () => {\n return (\n (column.columnDef.enableResizing ?? true) &&\n (table.options.enableColumnResizing ?? true)\n )\n }\n column.getIsResizing = () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id\n }\n },\n\n createHeader: (\n header: Header,\n table: Table\n ): void => {\n header.getSize = () => {\n let sum = 0\n\n const recurse = (header: Header) => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse)\n } else {\n sum += header.column.getSize() ?? 0\n }\n }\n\n recurse(header)\n\n return sum\n }\n header.getStart = () => {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup.headers[header.index - 1]!\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()\n }\n\n return 0\n }\n header.getResizeHandler = _contextDocument => {\n const column = table.getColumn(header.column.id)\n const canResize = column?.getCanResize()\n\n return (e: unknown) => {\n if (!column || !canResize) {\n return\n }\n\n ;(e as any).persist?.()\n\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return\n }\n }\n\n const startSize = header.getSize()\n\n const columnSizingStart: [string, number][] = header\n ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()])\n : [[column.id, column.getSize()]]\n\n const clientX = isTouchStartEvent(e)\n ? Math.round(e.touches[0]!.clientX)\n : (e as MouseEvent).clientX\n\n const newColumnSizing: ColumnSizingState = {}\n\n const updateOffset = (\n eventType: 'move' | 'end',\n clientXPos?: number\n ) => {\n if (typeof clientXPos !== 'number') {\n return\n }\n\n table.setColumnSizingInfo(old => {\n const deltaDirection =\n table.options.columnResizeDirection === 'rtl' ? -1 : 1\n const deltaOffset =\n (clientXPos - (old?.startOffset ?? 0)) * deltaDirection\n const deltaPercentage = Math.max(\n deltaOffset / (old?.startSize ?? 0),\n -0.999999\n )\n\n old.columnSizingStart.forEach(([columnId, headerSize]) => {\n newColumnSizing[columnId] =\n Math.round(\n Math.max(headerSize + headerSize * deltaPercentage, 0) * 100\n ) / 100\n })\n\n return {\n ...old,\n deltaOffset,\n deltaPercentage,\n }\n })\n\n if (\n table.options.columnResizeMode === 'onChange' ||\n eventType === 'end'\n ) {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing,\n }))\n }\n }\n\n const onMove = (clientXPos?: number) => updateOffset('move', clientXPos)\n\n const onEnd = (clientXPos?: number) => {\n updateOffset('end', clientXPos)\n\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: [],\n }))\n }\n\n const contextDocument = safelyAccessDocument(_contextDocument)\n\n const mouseEvents = {\n moveHandler: (e: MouseEvent) => onMove(e.clientX),\n upHandler: (e: MouseEvent) => {\n contextDocument?.removeEventListener(\n 'mousemove',\n mouseEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'mouseup',\n mouseEvents.upHandler\n )\n onEnd(e.clientX)\n },\n }\n\n const touchEvents = {\n moveHandler: (e: TouchEvent) => {\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onMove(e.touches[0]!.clientX)\n return false\n },\n upHandler: (e: TouchEvent) => {\n contextDocument?.removeEventListener(\n 'touchmove',\n touchEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'touchend',\n touchEvents.upHandler\n )\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onEnd(e.touches[0]?.clientX)\n },\n }\n\n const passiveIfSupported = passiveEventSupported()\n ? { passive: false }\n : false\n\n if (isTouchStartEvent(e)) {\n contextDocument?.addEventListener(\n 'touchmove',\n touchEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'touchend',\n touchEvents.upHandler,\n passiveIfSupported\n )\n } else {\n contextDocument?.addEventListener(\n 'mousemove',\n mouseEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'mouseup',\n mouseEvents.upHandler,\n passiveIfSupported\n )\n }\n\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id,\n }))\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnSizing = updater =>\n table.options.onColumnSizingChange?.(updater)\n table.setColumnSizingInfo = updater =>\n table.options.onColumnSizingInfoChange?.(updater)\n table.resetColumnSizing = defaultState => {\n table.setColumnSizing(\n defaultState ? {} : table.initialState.columnSizing ?? {}\n )\n }\n table.resetHeaderSizeInfo = defaultState => {\n table.setColumnSizingInfo(\n defaultState\n ? getDefaultColumnSizingInfoState()\n : table.initialState.columnSizingInfo ??\n getDefaultColumnSizingInfoState()\n )\n }\n table.getTotalSize = () =>\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getLeftTotalSize = () =>\n table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getCenterTotalSize = () =>\n table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getRightTotalSize = () =>\n table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n },\n}\n\nlet passiveSupported: boolean | null = null\nexport function passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported\n\n let supported = false\n try {\n const options = {\n get passive() {\n supported = true\n return false\n },\n }\n\n const noop = () => {}\n\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop)\n } catch (err) {\n supported = false\n }\n passiveSupported = supported\n return passiveSupported\n}\n\nfunction isTouchStartEvent(e: unknown): e is TouchEvent {\n return (e as TouchEvent).type === 'touchstart'\n}\n","import { ColumnPinningPosition } from '..'\nimport {\n Cell,\n Column,\n OnChangeFn,\n Table,\n Updater,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type VisibilityState = Record\n\nexport interface VisibilityTableState {\n columnVisibility: VisibilityState\n}\n\nexport interface VisibilityOptions {\n /**\n * Whether to enable column hiding. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#enablehiding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n enableHiding?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n onColumnVisibilityChange?: OnChangeFn\n}\n\nexport type VisibilityDefaultOptions = Pick<\n VisibilityOptions,\n 'onColumnVisibilityChange'\n>\n\nexport interface VisibilityInstance {\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCenterVisibleLeafColumns: () => Column[]\n /**\n * Returns whether all columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsAllColumnsVisible: () => boolean\n /**\n * Returns whether any columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsSomeColumnsVisible: () => boolean\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getLeftVisibleLeafColumns: () => Column[]\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getRightVisibleLeafColumns: () => Column[]\n /**\n * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void\n /**\n * Returns a flat array of columns that are visible, including parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleFlatColumns: () => Column[]\n /**\n * Returns a flat array of leaf-node columns that are visible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleLeafColumns: () => Column[]\n /**\n * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n resetColumnVisibility: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnVisibility` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n setColumnVisibility: (updater: Updater) => void\n /**\n * Toggles the visibility of all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleAllColumnsVisible: (value?: boolean) => void\n}\n\nexport interface VisibilityColumnDef {\n enableHiding?: boolean\n}\n\nexport interface VisibilityRow {\n _getAllVisibleCells: () => Cell[]\n /**\n * Returns an array of cells that account for column visibility for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleCells: () => Cell[]\n}\n\nexport interface VisibilityColumn {\n /**\n * Returns whether the column can be hidden\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCanHide: () => boolean\n /**\n * Returns whether the column is visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsVisible: () => boolean\n /**\n * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleVisibilityHandler: () => (event: unknown) => void\n /**\n * Toggles the visibility of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleVisibility: (value?: boolean) => void\n}\n\n//\n\nexport const ColumnVisibility: TableFeature = {\n getInitialState: (state): VisibilityTableState => {\n return {\n columnVisibility: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): VisibilityDefaultOptions => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleVisibility = value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value ?? !column.getIsVisible(),\n }))\n }\n }\n column.getIsVisible = () => {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some(c => c.getIsVisible())\n : table.getState().columnVisibility?.[column.id]) ?? true\n )\n }\n\n column.getCanHide = () => {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (table.options.enableHiding ?? true)\n )\n }\n column.getToggleVisibilityHandler = () => {\n return (e: unknown) => {\n column.toggleVisibility?.(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row._getAllVisibleCells = memo(\n () => [row.getAllCells(), table.getState().columnVisibility],\n cells => {\n return cells.filter(cell => cell.column.getIsVisible())\n },\n getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')\n )\n row.getVisibleCells = memo(\n () => [\n row.getLeftVisibleCells(),\n row.getCenterVisibleCells(),\n row.getRightVisibleCells(),\n ],\n (left, center, right) => [...left, ...center, ...right],\n getMemoOptions(table.options, 'debugRows', 'getVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n const makeVisibleColumnsMethod = (\n key: string,\n getColumns: () => Column[]\n ): (() => Column[]) => {\n return memo(\n () => [\n getColumns(),\n getColumns()\n .filter(d => d.getIsVisible())\n .map(d => d.id)\n .join('_'),\n ],\n columns => {\n return columns.filter(d => d.getIsVisible?.())\n },\n getMemoOptions(table.options, 'debugColumns', key)\n )\n }\n\n table.getVisibleFlatColumns = makeVisibleColumnsMethod(\n 'getVisibleFlatColumns',\n () => table.getAllFlatColumns()\n )\n table.getVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getVisibleLeafColumns',\n () => table.getAllLeafColumns()\n )\n table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getLeftVisibleLeafColumns',\n () => table.getLeftLeafColumns()\n )\n table.getRightVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getRightVisibleLeafColumns',\n () => table.getRightLeafColumns()\n )\n table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getCenterVisibleLeafColumns',\n () => table.getCenterLeafColumns()\n )\n\n table.setColumnVisibility = updater =>\n table.options.onColumnVisibilityChange?.(updater)\n\n table.resetColumnVisibility = defaultState => {\n table.setColumnVisibility(\n defaultState ? {} : table.initialState.columnVisibility ?? {}\n )\n }\n\n table.toggleAllColumnsVisible = value => {\n value = value ?? !table.getIsAllColumnsVisible()\n\n table.setColumnVisibility(\n table.getAllLeafColumns().reduce(\n (obj, column) => ({\n ...obj,\n [column.id]: !value ? !column.getCanHide?.() : value,\n }),\n {}\n )\n )\n }\n\n table.getIsAllColumnsVisible = () =>\n !table.getAllLeafColumns().some(column => !column.getIsVisible?.())\n\n table.getIsSomeColumnsVisible = () =>\n table.getAllLeafColumns().some(column => column.getIsVisible?.())\n\n table.getToggleAllColumnsVisibilityHandler = () => {\n return (e: unknown) => {\n table.toggleAllColumnsVisible(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nexport function _getVisibleLeafColumns(\n table: Table,\n position?: ColumnPinningPosition | 'center'\n) {\n return !position\n ? table.getVisibleLeafColumns()\n : position === 'center'\n ? table.getCenterVisibleLeafColumns()\n : position === 'left'\n ? table.getLeftVisibleLeafColumns()\n : table.getRightVisibleLeafColumns()\n}\n","import { RowModel } from '..'\nimport { Table, RowData, TableFeature } from '../types'\n\nexport interface GlobalFacetingInstance {\n _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]\n _getGlobalFacetedRowModel?: () => RowModel\n _getGlobalFacetedUniqueValues?: () => Map\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model for the table after **global** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedRowModel: () => RowModel\n /**\n * Returns the faceted unique values for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedUniqueValues: () => Map\n}\n\n//\n\nexport const GlobalFaceting: TableFeature = {\n createTable: (table: Table): void => {\n table._getGlobalFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, '__global__')\n\n table.getGlobalFacetedRowModel = () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getGlobalFacetedRowModel()\n }\n\n table._getGlobalFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, '__global__')\n table.getGlobalFacetedUniqueValues = () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map()\n }\n\n return table._getGlobalFacetedUniqueValues()\n }\n\n table._getGlobalFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, '__global__')\n table.getGlobalFacetedMinMaxValues = () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return\n }\n\n return table._getGlobalFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn, FilterFnOption } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n OnChangeFn,\n Table,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport interface GlobalFilterTableState {\n globalFilter: any\n}\n\nexport interface GlobalFilterColumnDef {\n /**\n * Enables/disables the **global** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n}\n\nexport interface GlobalFilterColumn {\n /**\n * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getCanGlobalFilter: () => boolean\n}\n\nexport interface GlobalFilterOptions {\n /**\n * Enables/disables **global** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n /**\n * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering.\n *\n * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcolumncanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getColumnCanGlobalFilter?: (column: Column) => boolean\n /**\n * The filter function to use for global filtering.\n * - A `string` referencing a built-in filter function\n * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option\n * - A custom filter function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#globalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n globalFilterFn?: FilterFnOption\n /**\n * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#onglobalfilterchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n onGlobalFilterChange?: OnChangeFn\n}\n\nexport interface GlobalFilterInstance {\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalFilterFn: () => FilterFn | undefined\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const GlobalFiltering: TableFeature = {\n getInitialState: (state): GlobalFilterTableState => {\n return {\n globalFilter: undefined,\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GlobalFilterOptions => {\n return {\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n const value = table\n .getCoreRowModel()\n .flatRows[0]?._getAllCellsByColumnId()\n [column.id]?.getValue()\n\n return typeof value === 'string' || typeof value === 'number'\n },\n } as GlobalFilterOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getCanGlobalFilter = () => {\n return (\n (column.columnDef.enableGlobalFilter ?? true) &&\n (table.options.enableGlobalFilter ?? true) &&\n (table.options.enableFilters ?? true) &&\n (table.options.getColumnCanGlobalFilter?.(column) ?? true) &&\n !!column.accessorFn\n )\n }\n },\n\n createTable: (table: Table): void => {\n table.getGlobalAutoFilterFn = () => {\n return filterFns.includesString\n }\n\n table.getGlobalFilterFn = () => {\n const { globalFilterFn: globalFilterFn } = table.options\n\n return isFunction(globalFilterFn)\n ? globalFilterFn\n : globalFilterFn === 'auto'\n ? table.getGlobalAutoFilterFn()\n : table.options.filterFns?.[globalFilterFn as string] ??\n filterFns[globalFilterFn as BuiltInFilterFn]\n }\n\n table.setGlobalFilter = updater => {\n table.options.onGlobalFilterChange?.(updater)\n }\n\n table.resetGlobalFilter = defaultState => {\n table.setGlobalFilter(\n defaultState ? undefined : table.initialState.globalFilter\n )\n }\n },\n}\n","import { RowModel } from '..'\nimport {\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { makeStateUpdater } from '../utils'\n\nexport type ExpandedStateList = Record\nexport type ExpandedState = true | Record\nexport interface ExpandedTableState {\n expanded: ExpandedState\n}\n\nexport interface ExpandedRow {\n /**\n * Returns whether the row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanExpand: () => boolean\n /**\n * Returns whether all parent rows of the row are expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallparentsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllParentsExpanded: () => boolean\n /**\n * Returns whether the row is expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsExpanded: () => boolean\n /**\n * Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleExpandedHandler: () => () => void\n /**\n * Toggles the expanded state (or sets it if `expanded` is provided) for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleExpanded: (expanded?: boolean) => void\n}\n\nexport interface ExpandedOptions {\n /**\n * Enable this setting to automatically reset the expanded state of the table when expanding state changes.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#autoresetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n autoResetExpanded?: boolean\n /**\n * Enable/disable expanding for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#enableexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n enableExpanding?: boolean\n /**\n * This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported `getExpandedRowModel` function to get the expanded row model or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel?: (table: Table) => () => RowModel\n /**\n * If provided, allows you to override the default behavior of determining whether a row is currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisrowexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsRowExpanded?: (row: Row) => boolean\n /**\n * If provided, allows you to override the default behavior of determining whether a row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getrowcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getRowCanExpand?: (row: Row) => boolean\n /**\n * Enables manual row expansion. If this is set to `true`, `getExpandedRowModel` will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#manualexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n manualExpanding?: boolean\n /**\n * This function is called when the `expanded` table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the `tableOptions.state.expanded` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#onexpandedchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n onExpandedChange?: OnChangeFn\n /**\n * If `true` expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages). If `false` expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#paginateexpandedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n paginateExpandedRows?: boolean\n}\n\nexport interface ExpandedInstance {\n _autoResetExpanded: () => void\n _getExpandedRowModel?: () => RowModel\n /**\n * Returns whether there are any rows that can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcansomerowsexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanSomeRowsExpand: () => boolean\n /**\n * Returns the maximum depth of the expanded rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandeddepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedDepth: () => number\n /**\n * Returns the row model after expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel: () => RowModel\n /**\n * Returns whether all rows are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllRowsExpanded: () => boolean\n /**\n * Returns whether there are any rows that are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getissomerowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsSomeRowsExpanded: () => boolean\n /**\n * Returns the row model before expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getpreexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getPreExpandedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleallrowsexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleAllRowsExpandedHandler: () => (event: unknown) => void\n /**\n * Resets the expanded state of the table to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#resetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n resetExpanded: (defaultState?: boolean) => void\n /**\n * Updates the expanded state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#setexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n setExpanded: (updater: Updater) => void\n /**\n * Toggles the expanded state for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleAllRowsExpanded: (expanded?: boolean) => void\n}\n\n//\n\nexport const RowExpanding: TableFeature = {\n getInitialState: (state): ExpandedTableState => {\n return {\n expanded: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ExpandedOptions => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true,\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetExpanded = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetExpanded ??\n !table.options.manualExpanding\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetExpanded()\n queued = false\n })\n }\n }\n table.setExpanded = updater => table.options.onExpandedChange?.(updater)\n table.toggleAllRowsExpanded = expanded => {\n if (expanded ?? !table.getIsAllRowsExpanded()) {\n table.setExpanded(true)\n } else {\n table.setExpanded({})\n }\n }\n table.resetExpanded = defaultState => {\n table.setExpanded(defaultState ? {} : table.initialState?.expanded ?? {})\n }\n table.getCanSomeRowsExpand = () => {\n return table\n .getPrePaginationRowModel()\n .flatRows.some(row => row.getCanExpand())\n }\n table.getToggleAllRowsExpandedHandler = () => {\n return (e: unknown) => {\n ;(e as any).persist?.()\n table.toggleAllRowsExpanded()\n }\n }\n table.getIsSomeRowsExpanded = () => {\n const expanded = table.getState().expanded\n return expanded === true || Object.values(expanded).some(Boolean)\n }\n table.getIsAllRowsExpanded = () => {\n const expanded = table.getState().expanded\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true\n }\n\n if (!Object.keys(expanded).length) {\n return false\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false\n }\n\n // They must all be expanded :shrug:\n return true\n }\n table.getExpandedDepth = () => {\n let maxDepth = 0\n\n const rowIds =\n table.getState().expanded === true\n ? Object.keys(table.getRowModel().rowsById)\n : Object.keys(table.getState().expanded)\n\n rowIds.forEach(id => {\n const splitId = id.split('.')\n maxDepth = Math.max(maxDepth, splitId.length)\n })\n\n return maxDepth\n }\n table.getPreExpandedRowModel = () => table.getSortedRowModel()\n table.getExpandedRowModel = () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table)\n }\n\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._getExpandedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleExpanded = expanded => {\n table.setExpanded(old => {\n const exists = old === true ? true : !!old?.[row.id]\n\n let oldExpanded: ExpandedStateList = {}\n\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true\n })\n } else {\n oldExpanded = old\n }\n\n expanded = expanded ?? !exists\n\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true,\n }\n }\n\n if (exists && !expanded) {\n const { [row.id]: _, ...rest } = oldExpanded\n return rest\n }\n\n return old\n })\n }\n row.getIsExpanded = () => {\n const expanded = table.getState().expanded\n\n return !!(\n table.options.getIsRowExpanded?.(row) ??\n (expanded === true || expanded?.[row.id])\n )\n }\n row.getCanExpand = () => {\n return (\n table.options.getRowCanExpand?.(row) ??\n ((table.options.enableExpanding ?? true) && !!row.subRows?.length)\n )\n }\n row.getIsAllParentsExpanded = () => {\n let isFullyExpanded = true\n let currentRow = row\n\n while (isFullyExpanded && currentRow.parentId) {\n currentRow = table.getRow(currentRow.parentId, true)\n isFullyExpanded = currentRow.getIsExpanded()\n }\n\n return isFullyExpanded\n }\n row.getToggleExpandedHandler = () => {\n const canExpand = row.getCanExpand()\n\n return () => {\n if (!canExpand) return\n row.toggleExpanded()\n }\n }\n },\n}\n","import {\n OnChangeFn,\n Table,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport {\n functionalUpdate,\n getMemoOptions,\n makeStateUpdater,\n memo,\n} from '../utils'\n\nexport interface PaginationState {\n pageIndex: number\n pageSize: number\n}\n\nexport interface PaginationTableState {\n pagination: PaginationState\n}\n\nexport interface PaginationInitialTableState {\n pagination?: Partial\n}\n\nexport interface PaginationOptions {\n /**\n * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n autoResetPageIndex?: boolean\n /**\n * Returns the row model after pagination has taken place, but no further.\n *\n * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel?: (table: Table) => () => RowModel\n /**\n * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n manualPagination?: boolean\n /**\n * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n onPaginationChange?: OnChangeFn\n /**\n * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n pageCount?: number\n /**\n * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n rowCount?: number\n}\n\nexport interface PaginationDefaultOptions {\n onPaginationChange: OnChangeFn\n}\n\nexport interface PaginationInstance {\n _autoResetPageIndex: () => void\n _getPaginationRowModel?: () => RowModel\n /**\n * Returns whether the table can go to the next page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanNextPage: () => boolean\n /**\n * Returns whether the table can go to the previous page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanPreviousPage: () => boolean\n /**\n * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageCount: () => number\n /**\n * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getRowCount: () => number\n /**\n * Returns an array of page options (zero-index-based) for the current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageOptions: () => number[]\n /**\n * Returns the row model for the table after pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel: () => RowModel\n /**\n * Returns the row model for the table before any pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPrePaginationRowModel: () => RowModel\n /**\n * Increments the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n nextPage: () => void\n /**\n * Decrements the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n previousPage: () => void\n /**\n * Sets the page index to `0`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n firstPage: () => void\n /**\n * Sets the page index to the last page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n lastPage: () => void\n /**\n * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageIndex: (defaultState?: boolean) => void\n /**\n * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageSize: (defaultState?: boolean) => void\n /**\n * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPagination: (defaultState?: boolean) => void\n /**\n * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead.\n */\n setPageCount: (updater: Updater) => void\n /**\n * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageIndex: (updater: Updater) => void\n /**\n * Updates the page size using the provided function or value in the `state.pagination.pageSize` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageSize: (updater: Updater) => void\n /**\n * Sets or updates the `state.pagination` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPagination: (updater: Updater) => void\n}\n\n//\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\nconst getDefaultPaginationState = (): PaginationState => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n})\n\nexport const RowPagination: TableFeature = {\n getInitialState: (state): PaginationTableState => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...state?.pagination,\n },\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): PaginationDefaultOptions => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table),\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetPageIndex = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetPageIndex()\n queued = false\n })\n }\n }\n table.setPagination = updater => {\n const safeUpdater: Updater = old => {\n let newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n }\n table.resetPagination = defaultState => {\n table.setPagination(\n defaultState\n ? getDefaultPaginationState()\n : table.initialState.pagination ?? getDefaultPaginationState()\n )\n }\n table.setPageIndex = updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n }\n table.resetPageIndex = defaultState => {\n table.setPageIndex(\n defaultState\n ? defaultPageIndex\n : table.initialState?.pagination?.pageIndex ?? defaultPageIndex\n )\n }\n table.resetPageSize = defaultState => {\n table.setPageSize(\n defaultState\n ? defaultPageSize\n : table.initialState?.pagination?.pageSize ?? defaultPageSize\n )\n }\n table.setPageSize = updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex!\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n }\n //deprecated\n table.setPageCount = updater =>\n table.setPagination(old => {\n let newPageCount = functionalUpdate(\n updater,\n table.options.pageCount ?? -1\n )\n\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount)\n }\n\n return {\n ...old,\n pageCount: newPageCount,\n }\n })\n\n table.getPageOptions = memo(\n () => [table.getPageCount()],\n pageCount => {\n let pageOptions: number[] = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n },\n getMemoOptions(table.options, 'debugTable', 'getPageOptions')\n )\n\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0\n\n table.getCanNextPage = () => {\n const { pageIndex } = table.getState().pagination\n\n const pageCount = table.getPageCount()\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n }\n\n table.previousPage = () => {\n return table.setPageIndex(old => old - 1)\n }\n\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1\n })\n }\n\n table.firstPage = () => {\n return table.setPageIndex(0)\n }\n\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1)\n }\n\n table.getPrePaginationRowModel = () => table.getExpandedRowModel()\n table.getPaginationRowModel = () => {\n if (\n !table._getPaginationRowModel &&\n table.options.getPaginationRowModel\n ) {\n table._getPaginationRowModel =\n table.options.getPaginationRowModel(table)\n }\n\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel()\n }\n\n return table._getPaginationRowModel()\n }\n\n table.getPageCount = () => {\n return (\n table.options.pageCount ??\n Math.ceil(table.getRowCount() / table.getState().pagination.pageSize)\n )\n }\n\n table.getRowCount = () => {\n return (\n table.options.rowCount ?? table.getPrePaginationRowModel().rows.length\n )\n }\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance {\n _getPinnedRows: (\n visiblePinnedRows: Array>,\n pinnedRowIds: Array | undefined,\n position: 'top' | 'bottom'\n ) => Row[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top' ? table.getTopRows() : table.getBottomRows()\n )?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows.filter(Boolean).map(d => ({ ...d, position })) as Row[]\n }\n\n table.getTopRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.top],\n (allRows, topPinnedRowIds) =>\n table._getPinnedRows(allRows, topPinnedRowIds, 'top'),\n getMemoOptions(table.options, 'debugRows', 'getTopRows')\n )\n\n table.getBottomRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.bottom],\n (allRows, bottomPinnedRowIds) =>\n table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'),\n getMemoOptions(table.options, 'debugRows', 'getBottomRows')\n )\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n","import {\n OnChangeFn,\n Table,\n Row,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowSelectionState = Record\n\nexport interface RowSelectionTableState {\n rowSelection: RowSelectionState\n}\n\nexport interface RowSelectionOptions {\n /**\n * - Enables/disables multiple row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablemultirowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableMultiRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * - Enables/disables row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable row selection for that row\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablerowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * Enables/disables automatic sub-row selection when a parent row is selected, or a function that enables/disables automatic sub-row selection for each row.\n * (Use in combination with expanding or grouping features)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablesubrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableSubRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowSelection` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#onrowselectionchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n onRowSelectionChange?: OnChangeFn\n // enableGroupingRowSelection?:\n // | boolean\n // | ((\n // row: Row\n // ) => boolean)\n // isAdditiveSelectEvent?: (e: unknown) => boolean\n // isInclusiveSelectEvent?: (e: unknown) => boolean\n // selectRowsFn?: (\n // table: Table,\n // rowModel: RowModel\n // ) => RowModel\n}\n\nexport interface RowSelectionRow {\n /**\n * Returns whether or not the row can multi-select.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanmultiselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanMultiSelect: () => boolean\n /**\n * Returns whether or not the row can be selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelect: () => boolean\n /**\n * Returns whether or not the row can select sub rows automatically when the parent row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselectsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelectSubRows: () => boolean\n /**\n * Returns whether or not all of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallsubrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllSubRowsSelected: () => boolean\n /**\n * Returns whether or not the row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSelected: () => boolean\n /**\n * Returns whether or not some of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomeselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeSelected: () => boolean\n /**\n * Returns a handler that can be used to toggle the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleSelectedHandler: () => (event: unknown) => void\n /**\n * Selects/deselects the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleSelected: (value?: boolean, opts?: { selectChildren?: boolean }) => void\n}\n\nexport interface RowSelectionInstance {\n /**\n * Returns the row model of all rows that are selected after filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getfilteredselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getFilteredSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getgroupedselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getGroupedSelectedRowModel: () => RowModel\n /**\n * Returns whether or not all rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllPageRowsSelected: () => boolean\n /**\n * Returns whether or not all rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllRowsSelected: () => boolean\n /**\n * Returns whether or not any rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomePageRowsSelected: () => boolean\n /**\n * Returns whether or not any rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeRowsSelected: () => boolean\n /**\n * Returns the core row model of all rows before row selection has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getpreselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getPreSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getSelectedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallpagerowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Returns a handler that can be used to toggle all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallrowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Resets the **rowSelection** state to the `initialState.rowSelection`, or `true` can be passed to force a default blank state reset to `{}`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#resetrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n resetRowSelection: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowSelection` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#setrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n setRowSelection: (updater: Updater) => void\n /**\n * Selects/deselects all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllPageRowsSelected: (value?: boolean) => void\n /**\n * Selects/deselects all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllRowsSelected: (value?: boolean) => void\n}\n\n//\n\nexport const RowSelection: TableFeature = {\n getInitialState: (state): RowSelectionTableState => {\n return {\n rowSelection: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowSelectionOptions => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true,\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowSelection = updater =>\n table.options.onRowSelectionChange?.(updater)\n table.resetRowSelection = defaultState =>\n table.setRowSelection(\n defaultState ? {} : table.initialState.rowSelection ?? {}\n )\n table.toggleAllRowsSelected = value => {\n table.setRowSelection(old => {\n value =\n typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n }\n table.toggleAllPageRowsSelected = value =>\n table.setRowSelection(old => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table.getIsAllPageRowsSelected()\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n table.getPreSelectedRowModel = () => table.getCoreRowModel()\n table.getSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getCoreRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')\n )\n\n table.getFilteredSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getFilteredRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')\n )\n\n table.getGroupedSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getSortedRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')\n )\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n table.getIsAllRowsSelected = () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const { rowSelection } = table.getState()\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n row => row.getCanSelect() && !rowSelection[row.id]\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n }\n\n table.getIsAllPageRowsSelected = () => {\n const paginationFlatRows = table\n .getPaginationRowModel()\n .flatRows.filter(row => row.getCanSelect())\n const { rowSelection } = table.getState()\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some(row => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n }\n\n table.getIsSomeRowsSelected = () => {\n const totalSelected = Object.keys(\n table.getState().rowSelection ?? {}\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n }\n\n table.getIsSomePageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows\n return table.getIsAllPageRowsSelected()\n ? false\n : paginationFlatRows\n .filter(row => row.getCanSelect())\n .some(d => d.getIsSelected() || d.getIsSomeSelected())\n }\n\n table.getToggleAllRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n\n table.getToggleAllPageRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllPageRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleSelected = (value, opts) => {\n const isSelected = row.getIsSelected()\n\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row.getCanSelect() && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n table\n )\n\n return selectedRowIds\n })\n }\n row.getIsSelected = () => {\n const { rowSelection } = table.getState()\n return isRowSelected(row, rowSelection)\n }\n\n row.getIsSomeSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'some'\n }\n\n row.getIsAllSubRowsSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'all'\n }\n\n row.getCanSelect = () => {\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row)\n }\n\n return table.options.enableRowSelection ?? true\n }\n\n row.getCanSelectSubRows = () => {\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row)\n }\n\n return table.options.enableSubRowSelection ?? true\n }\n\n row.getCanMultiSelect = () => {\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row)\n }\n\n return table.options.enableMultiRowSelection ?? true\n }\n row.getToggleSelectedHandler = () => {\n const canSelect = row.getCanSelect()\n\n return (e: unknown) => {\n if (!canSelect) return\n row.toggleSelected(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nconst mutateRowIsSelected = (\n selectedRowIds: Record,\n id: string,\n value: boolean,\n includeChildren: boolean,\n table: Table\n) => {\n const row = table.getRow(id, true)\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key])\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true\n }\n } else {\n delete selectedRowIds[id]\n }\n // }\n\n if (includeChildren && row.subRows?.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row =>\n mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)\n )\n }\n}\n\nexport function selectRowsFn(\n table: Table,\n rowModel: RowModel\n): RowModel {\n const rowSelection = table.getState().rowSelection\n\n const newSelectedFlatRows: Row[] = []\n const newSelectedRowsById: Record> = {}\n\n // Filters top level and nested rows\n const recurseRows = (rows: Row[], depth = 0): Row[] => {\n return rows\n .map(row => {\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows?.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n return row\n }\n })\n .filter(Boolean) as Row[]\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\nexport function isRowSelected(\n row: Row,\n selection: Record\n): boolean {\n return selection[row.id] ?? false\n}\n\nexport function isSubRowSelected(\n row: Row,\n selection: Record,\n table: Table\n): boolean | 'some' | 'all' {\n if (!row.subRows?.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (subRow.getCanSelect()) {\n if (isRowSelected(subRow, selection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows && subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow, selection, table)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n","import { SortingFn } from './features/RowSorting'\n\nexport const reSplitAlphaNumeric = /([0-9]+)/gm\n\nconst alphanumeric: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\nconst alphanumericCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\nconst datetime: SortingFn = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId)\n const b = rowB.getValue(columnId)\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0\n}\n\nconst basic: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId))\n}\n\n// Utils\n\nfunction compareBasic(a: any, b: any) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction toString(a: any) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr: string, bStr: string) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean)\n\n // While\n while (a.length && b.length) {\n const aa = a.shift()!\n const bb = b.shift()!\n\n const an = parseInt(aa, 10)\n const bn = parseInt(bb, 10)\n\n const combo = [an, bn].sort()\n\n // Both are string\n if (isNaN(combo[0]!)) {\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1]!)) {\n return isNaN(an) ? -1 : 1\n }\n\n // Both are numbers\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n }\n\n return a.length - b.length\n}\n\n// Exports\n\nexport const sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic,\n}\n\nexport type BuiltInSortingFn = keyof typeof sortingFns\n","import { RowModel } from '..'\nimport {\n BuiltInSortingFn,\n reSplitAlphaNumeric,\n sortingFns,\n} from '../sortingFns'\n\nimport {\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n SortingFns,\n TableFeature,\n} from '../types'\n\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type SortDirection = 'asc' | 'desc'\n\nexport interface ColumnSort {\n desc: boolean\n id: string\n}\n\nexport type SortingState = ColumnSort[]\n\nexport interface SortingTableState {\n sorting: SortingState\n}\n\nexport interface SortingFn {\n (rowA: Row, rowB: Row, columnId: string): number\n}\n\nexport type CustomSortingFns = Record<\n string,\n SortingFn\n>\n\nexport type SortingFnOption =\n | 'auto'\n | keyof SortingFns\n | BuiltInSortingFn\n | SortingFn\n\nexport interface SortingColumnDef {\n /**\n * Enables/Disables multi-sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n invertSorting?: boolean\n /**\n * Set to `true` for sorting toggles on this column to start in the descending direction.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n /**\n * The sorting function to use with this column.\n * - A `string` referencing a built-in sorting function\n * - A custom sorting function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortingFn?: SortingFnOption\n /**\n * The priority of undefined values when sorting this column.\n * - `false`\n * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)\n * - `-1`\n * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)\n * - `1`\n * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortundefined)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n}\n\nexport interface SortingColumn {\n /**\n * Removes this column from the table's sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n clearSorting: () => void\n /**\n * Returns a sort direction automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortDir: () => SortDirection\n /**\n * Returns a sorting function automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortingFn: () => SortingFn\n /**\n * Returns whether this column can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanMultiSort: () => boolean\n /**\n * Returns whether this column can be sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanSort: () => boolean\n /**\n * Returns the first direction that should be used when sorting this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getFirstSortDir: () => SortDirection\n /**\n * Returns the current sort direction of this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getIsSorted: () => false | SortDirection\n /**\n * Returns the next sorting order.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getNextSortingOrder: () => SortDirection | false\n /**\n * Returns the index position of this column's sorting within the sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortIndex: () => number\n /**\n * Returns the resolved sorting function to be used for this column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortingFn: () => SortingFn\n /**\n * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getToggleSortingHandler: () => undefined | ((event: unknown) => void)\n /**\n * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n toggleSorting: (desc?: boolean, isMulti?: boolean) => void\n}\n\ninterface SortingOptionsBase {\n /**\n * Enables/disables the ability to remove multi-sorts\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiRemove?: boolean\n /**\n * Enables/Disables multi-sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Enables/Disables the ability to remove sorting for the table.\n * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ...\n * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ...\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSortingRemoval?: boolean\n /**\n * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel?: (table: Table) => () => RowModel\n /**\n * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n isMultiSortEvent?: (e: unknown) => boolean\n /**\n * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n manualSorting?: boolean\n /**\n * Set a maximum number of columns that can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n maxMultiSortColCount?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.sorting` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n onSortingChange?: OnChangeFn\n /**\n * If `true`, all sorts will default to descending as their first toggle state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n}\n\ntype ResolvedSortingFns = keyof SortingFns extends never\n ? {\n sortingFns?: Record>\n }\n : {\n sortingFns: Record>\n }\n\nexport interface SortingOptions\n extends SortingOptionsBase,\n ResolvedSortingFns {}\n\nexport interface SortingInstance {\n _getSortedRowModel?: () => RowModel\n /**\n * Returns the row model for the table before any sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getPreSortedRowModel: () => RowModel\n /**\n * Returns the row model for the table after sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel: () => RowModel\n /**\n * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n resetSorting: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.sorting` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n setSorting: (updater: Updater) => void\n}\n\n//\n\nexport const RowSorting: TableFeature = {\n getInitialState: (state): SortingTableState => {\n return {\n sorting: [],\n ...state,\n }\n },\n\n getDefaultColumnDef: (): SortingColumnDef => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): SortingOptions => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoSortingFn = () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row?.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric\n }\n }\n }\n\n if (isString) {\n return sortingFns.text\n }\n\n return sortingFns.basic\n }\n column.getAutoSortDir = () => {\n const firstRow = table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n }\n column.getSortingFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.sortingFn)\n ? column.columnDef.sortingFn\n : column.columnDef.sortingFn === 'auto'\n ? column.getAutoSortingFn()\n : table.options.sortingFns?.[column.columnDef.sortingFn as string] ??\n sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]\n }\n column.toggleSorting = (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder()\n const hasManualValue = typeof desc !== 'undefined' && desc !== null\n\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old?.find(d => d.id === column.id)\n const existingIndex = old?.findIndex(d => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old?.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old?.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n }\n\n column.getFirstSortDir = () => {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n table.options.sortDescFirst ??\n column.getAutoSortDir() === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n }\n\n column.getNextSortingOrder = (multi?: boolean) => {\n const firstSortDirection = column.getFirstSortDir()\n const isSorted = column.getIsSorted()\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n }\n\n column.getCanSort = () => {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getCanMultiSort = () => {\n return (\n column.columnDef.enableMultiSort ??\n table.options.enableMultiSort ??\n !!column.accessorFn\n )\n }\n\n column.getIsSorted = () => {\n const columnSort = table.getState().sorting?.find(d => d.id === column.id)\n\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n }\n\n column.getSortIndex = () =>\n table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1\n\n column.clearSorting = () => {\n //clear sorting for just 1 column\n table.setSorting(old =>\n old?.length ? old.filter(d => d.id !== column.id) : []\n )\n }\n\n column.getToggleSortingHandler = () => {\n const canSort = column.getCanSort()\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column.toggleSorting?.(\n undefined,\n column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false\n )\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setSorting = updater => table.options.onSortingChange?.(updater)\n table.resetSorting = defaultState => {\n table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])\n }\n table.getPreSortedRowModel = () => table.getGroupedRowModel()\n table.getSortedRowModel = () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table)\n }\n\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._getSortedRowModel()\n }\n },\n}\n","import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table) => () => RowModel\n /**\n * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row) => string\n /**\n * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions,\n options: Partial>\n ) => TableOptions\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial\n}\n\nexport interface CoreInstance {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record>\n _getColumnDefs: () => ColumnDef[]\n _getCoreRowModel?: () => RowModel\n _getDefaultColumnDef: () => Partial>\n _getRowId: (_: TData, index: number, parent?: Row) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater) => void\n}\n\nexport function createTable(\n options: TableOptionsResolved\n): Table {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved\n\n const mergeOptions = (options: TableOptionsResolved) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef[],\n parent?: Column,\n depth = 0\n ): Column[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n","import { createRow } from '../core/row'\nimport { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getCoreRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.options.data],\n (\n data\n ): {\n rows: Row[]\n flatRows: Row[]\n rowsById: Record>\n } => {\n const rowModel: RowModel = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: TData[],\n depth = 0,\n parentRow?: Row\n ): Row[] => {\n const rows = [] as Row[]\n\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(\n table,\n table._getRowId(originalRows[i]!, i, parentRow),\n originalRows[i]!,\n i,\n depth,\n undefined,\n parentRow?.id\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(\n originalRows[i]!,\n i\n )\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getExpandedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().expanded,\n table.getPreExpandedRowModel(),\n table.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel\n }\n\n return expandRows(rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')\n )\n}\n\nexport function expandRows(rowModel: RowModel) {\n const expandedRows: Row[] = []\n\n const handleRow = (row: Row) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedMinMaxValues(): (\n table: Table,\n columnId: string\n) => () => undefined | [number, number] {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return undefined\n\n const uniqueValues = facetedRowModel.flatRows\n .flatMap(flatRow => flatRow.getUniqueValues(columnId) ?? [])\n .map(Number)\n .filter(value => !Number.isNaN(value))\n\n if (!uniqueValues.length) return\n\n let facetedMinValue = uniqueValues[0]!\n let facetedMaxValue = uniqueValues[uniqueValues.length - 1]!\n\n for (const value of uniqueValues) {\n if (value < facetedMinValue) facetedMinValue = value\n else if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n return [facetedMinValue, facetedMaxValue]\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')\n )\n}\n","import { createRow } from '../core/row'\nimport { Row, RowModel, Table, RowData } from '../types'\n\nexport function filterRows(\n rows: Row[],\n filterRowImpl: (row: Row) => any,\n table: Table\n) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table)\n }\n\n return filterRowModelFromRoot(rows, filterRowImpl, table)\n}\n\nfunction filterRowModelFromLeafs(\n rowsToFilter: Row[],\n filterRow: (row: Row) => Row[],\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n const rows: Row[] = []\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.columnFilters = row.columnFilters\n\n if (row.subRows?.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n } else {\n row = newRow\n if (filterRow(row)) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n }\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n\nfunction filterRowModelFromRoot(\n rowsToFilter: Row[],\n filterRow: (row: Row) => any,\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n // Filters top level and nested rows\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n // Filter from parents downward first\n\n const rows: Row[] = []\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const pass = filterRow(row)\n\n if (pass) {\n if (row.subRows?.length && depth < maxDepth) {\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n }\n\n rows.push(row)\n newFilteredFlatRows.push(row)\n newFilteredRowsById[row.id] = row\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFacetedRowModel(): (\n table: Table,\n columnId: string\n) => () => RowModel {\n return (table, columnId) =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n table.getFilteredRowModel(),\n ],\n (preRowModel, columnFilters, globalFilter) => {\n if (\n !preRowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n return preRowModel\n }\n\n const filterableIds = [\n ...columnFilters.map(d => d.id).filter(d => d !== columnId),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as string[]\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')\n )\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedUniqueValues(): (\n table: Table,\n columnId: string\n) => () => Map {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return new Map()\n\n let facetedUniqueValues = new Map()\n\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values =\n facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]!\n\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n },\n getMemoOptions(\n table.options,\n 'debugTable',\n `getFacetedUniqueValues_${columnId}`\n )\n )\n}\n","import { ResolvedColumnFilter } from '../features/ColumnFiltering'\nimport { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFilteredRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n ],\n (rowModel, columnFilters, globalFilter) => {\n if (\n !rowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i]!.columnFilters = {}\n rowModel.flatRows[i]!.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: ResolvedColumnFilter[] = []\n const resolvedGlobalFilters: ResolvedColumnFilter[] = []\n\n ;(columnFilters ?? []).forEach(d => {\n const column = table.getColumn(d.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column.getFilterFn()\n\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`\n )\n }\n return\n }\n\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: filterFn.resolveFilterValue?.(d.value) ?? d.value,\n })\n })\n\n const filterableIds = (columnFilters ?? []).map(d => d.id)\n\n const globalFilterFn = table.getGlobalFilterFn()\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter(column => column.getCanGlobalFilter())\n\n if (\n globalFilter &&\n globalFilterFn &&\n globallyFilterableColumns.length\n ) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach(column => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ??\n globalFilter,\n })\n })\n }\n\n let currentColumnFilter\n let currentGlobalFilter\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j]!\n\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { createRow } from '../core/row'\nimport { Row, RowData, RowModel, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { GroupingState } from '../features/ColumnGrouping'\n\nexport function getGroupedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().grouping, table.getPreGroupedRowModel()],\n (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n rowModel.rows.forEach(row => {\n row.depth = 0\n row.parentId = undefined\n })\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId =>\n table.getColumn(columnId)\n )\n\n const groupedFlatRows: Row[] = []\n const groupedRowsById: Record> = {}\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Row[],\n depth = 0,\n parentId?: string\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId: string = existingGrouping[depth]!\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n subRows.forEach(subRow => {\n subRow.parentId = id\n })\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, row => row.subRows)\n : groupedRows\n\n const row = createRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId\n )\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (columnId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[columnId] =\n groupedRows[0].getValue(columnId) ?? undefined\n }\n\n return row._valuesCache[columnId]\n }\n\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId)\n const aggregateFn = column?.getAggregationFn()\n\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(\n columnId,\n leafRows,\n groupedRows\n )\n\n return row._groupingValuesCache[columnId]\n }\n },\n })\n\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return row\n }\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {\n table._queue(() => {\n table._autoResetExpanded()\n table._autoResetPageIndex()\n })\n })\n )\n}\n\nfunction groupBy(rows: Row[], columnId: string) {\n const groupMap = new Map[]>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel(opts?: {\n initialSync: boolean\n}): (table: Table) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().pagination,\n table.getPrePaginationRowModel(),\n table.options.paginateExpandedRows\n ? undefined\n : table.getState().expanded,\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n let paginatedRowModel: RowModel\n\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById,\n })\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById,\n }\n }\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row) => {\n paginatedRowModel.flatRows.push(row)\n if (row.subRows.length) {\n row.subRows.forEach(handleRow)\n }\n }\n\n paginatedRowModel.rows.forEach(handleRow)\n\n return paginatedRowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')\n )\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { SortingFn } from '../features/RowSorting'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getSortedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().sorting, table.getPreSortedRowModel()],\n (sorting, rowModel) => {\n if (!rowModel.rows.length || !sorting?.length) {\n return rowModel\n }\n\n const sortingState = table.getState().sorting\n\n const sortedFlatRows: Row[] = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort =>\n table.getColumn(sort.id)?.getCanSort()\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n invertSorting?: boolean\n sortingFn: SortingFn\n }\n > = {}\n\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn(),\n }\n })\n\n const sortData = (rows: Row[]) => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = rows.map(row => ({ ...row }))\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const sortUndefined = columnInfo.sortUndefined\n const isDesc = sortEntry?.desc ?? false\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1\n if (sortUndefined === 'last') return aUndefined ? 1 : -1\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? sortUndefined\n : -sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n sortedFlatRows.push(row)\n if (row.subRows?.length) {\n row.subRows = sortData(row.subRows)\n }\n })\n\n return sortedData\n }\n\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n"],"names":["createColumnHelper","accessor","column","accessorFn","accessorKey","display","group","functionalUpdate","updater","input","noop","makeStateUpdater","key","instance","setState","old","isFunction","d","Function","isNumberArray","Array","isArray","every","val","flattenBy","arr","getChildren","flat","recurse","subArr","forEach","item","push","children","length","memo","getDeps","fn","opts","deps","result","depArgs","depTime","debug","Date","now","newDeps","depsChanged","some","dep","index","resultTime","onChange","depEndTime","Math","round","resultEndTime","resultFpsPercentage","pad","str","num","String","console","info","max","min","getMemoOptions","tableOptions","debugLevel","_tableOptions$debugAl","debugAll","createCell","table","row","columnId","getRenderValue","_cell$getValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","_features","feature","createColumn","columnDef","depth","parent","_ref","_resolvedColumnDef$id","defaultColumn","_getDefaultColumnDef","resolvedColumnDef","prototype","replaceAll","replace","undefined","header","includes","originalRow","split","_result","warn","Error","columns","getFlatColumns","_column$columns","flatMap","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","leafColumns","createHeader","_options$id","isPlaceholder","placeholderId","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","map","Headers","createTable","getHeaderGroups","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","_left$map$filter","_right$map$filter","leftColumns","find","filter","Boolean","rightColumns","centerColumns","headerGroups","buildHeaderGroups","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","orderedLeafColumns","getRightHeaderGroups","_right$map$filter2","getFooterGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","getIsVisible","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","isLeafHeader","bottomHeaders","recurseHeadersForSpans","filteredHeaders","childRowSpans","childColSpan","childRowSpan","minChildRowSpan","createRow","original","rowIndex","subRows","parentId","_valuesCache","_uniqueValuesCache","hasOwnProperty","getColumn","getUniqueValues","_row$getValue","getLeafRows","getParentRow","getRow","getParentRows","parentRows","currentRow","parentRow","getAllCells","getAllLeafColumns","_getAllCellsByColumnId","allCells","reduce","acc","i","ColumnFaceting","_getFacetedRowModel","getFacetedRowModel","getPreFilteredRowModel","_getFacetedUniqueValues","getFacetedUniqueValues","Map","_getFacetedMinMaxValues","getFacetedMinMaxValues","includesString","filterValue","_filterValue$toString","search","toString","toLowerCase","autoRemove","testFalsey","includesStringSensitive","_row$getValue2","equalsString","_row$getValue3","arrIncludes","_row$getValue4","arrIncludesAll","_row$getValue5","arrIncludesSome","_row$getValue6","equals","weakEquals","inNumberRange","rowValue","resolveFilterValue","unsafeMin","unsafeMax","parsedMin","parseFloat","parsedMax","Number","isNaN","Infinity","temp","filterFns","ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","onColumnFiltersChange","filterFromLeafRows","maxLeafRowFilterDepth","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getFilterFn","_table$options$filter","_table$options$filter2","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","previousFilter","newFilter","shouldAutoRemoveFilter","_old$filter","newFilterObj","_old$map","_table","columnFiltersMeta","updateFn","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getFilteredRowModel","_getFilteredRowModel","manualFiltering","sum","_leafRows","childRows","next","nextValue","extent","mean","leafRows","count","median","values","mid","floor","nums","sort","a","b","unique","from","Set","uniqueCount","size","_columnId","aggregationFns","ColumnGrouping","aggregatedCell","props","_toString","_props$getValue","aggregationFn","grouping","onGroupingChange","groupedColumnMode","toggleGrouping","setGrouping","getCanGroup","enableGrouping","getGroupingValue","getIsGrouped","_table$getState$group","getGroupedIndex","_table$getState$group2","indexOf","getToggleGroupingHandler","canGroup","getAutoAggregationFn","Object","call","getAggregationFn","_table$options$aggreg","_table$options$aggreg2","resetGrouping","_table$initialState$g","getPreGroupedRowModel","getGroupedRowModel","_getGroupedRowModel","manualGrouping","groupingColumnId","_groupingValuesCache","getIsPlaceholder","getIsAggregated","_row$subRows","nonGroupingColumns","col","groupingColumns","g","ColumnOrdering","columnOrder","onColumnOrderChange","getIndex","position","_getVisibleLeafColumns","getIsFirstColumn","_columns$","getIsLastColumn","_columns","setColumnOrder","resetColumnOrder","orderedColumns","columnOrderCopy","columnsCopy","targetColumnId","shift","foundIndex","splice","getDefaultColumnPinningState","ColumnPinning","onColumnPinningChange","pin","columnIds","setColumnPinning","_old$left3","_old$right3","_old$left","_old$right","_old$left2","_old$right2","getCanPin","_d$columnDef$enablePi","enablePinning","enableColumnPinning","getIsPinned","leafColumnIds","isLeft","isRight","getPinnedIndex","getCenterVisibleCells","_getAllVisibleCells","leftAndRight","getLeftVisibleCells","cells","getRightVisibleCells","resetColumnPinning","getIsSomeColumnsPinned","_pinningState$positio","pinningState","_pinningState$left","_pinningState$right","getLeftLeafColumns","getRightLeafColumns","getCenterLeafColumns","safelyAccessDocument","_document","document","defaultColumnSizing","minSize","maxSize","MAX_SAFE_INTEGER","getDefaultColumnSizingInfoState","startOffset","startSize","deltaOffset","deltaPercentage","isResizingColumn","columnSizingStart","ColumnSizing","columnSizing","columnSizingInfo","columnResizeMode","columnResizeDirection","onColumnSizingChange","onColumnSizingInfoChange","getSize","_column$columnDef$min","_column$columnDef$max","columnSize","getStart","slice","getAfter","resetSize","setColumnSizing","_ref2","_","rest","getCanResize","enableResizing","enableColumnResizing","getIsResizing","_header$column$getSiz","prevSiblingHeader","getResizeHandler","_contextDocument","canResize","e","persist","isTouchStartEvent","touches","clientX","newColumnSizing","updateOffset","eventType","clientXPos","setColumnSizingInfo","_old$startOffset","_old$startSize","deltaDirection","_ref3","headerSize","onMove","onEnd","contextDocument","mouseEvents","moveHandler","upHandler","removeEventListener","touchEvents","cancelable","preventDefault","stopPropagation","_e$touches$","passiveIfSupported","passiveEventSupported","passive","addEventListener","resetColumnSizing","resetHeaderSizeInfo","_table$initialState$c2","getTotalSize","_table$getHeaderGroup","_table$getHeaderGroup2","getLeftTotalSize","_table$getLeftHeaderG","_table$getLeftHeaderG2","getCenterTotalSize","_table$getCenterHeade","_table$getCenterHeade2","getRightTotalSize","_table$getRightHeader","_table$getRightHeader2","passiveSupported","supported","window","err","type","ColumnVisibility","columnVisibility","onColumnVisibilityChange","toggleVisibility","getCanHide","setColumnVisibility","childColumns","c","enableHiding","getToggleVisibilityHandler","target","checked","getVisibleCells","makeVisibleColumnsMethod","getColumns","getVisibleFlatColumns","getAllFlatColumns","getLeftVisibleLeafColumns","getRightVisibleLeafColumns","getCenterVisibleLeafColumns","resetColumnVisibility","toggleAllColumnsVisible","_value","getIsAllColumnsVisible","obj","getIsSomeColumnsVisible","getToggleAllColumnsVisibilityHandler","_target","GlobalFaceting","_getGlobalFacetedRowModel","getGlobalFacetedRowModel","_getGlobalFacetedUniqueValues","getGlobalFacetedUniqueValues","_getGlobalFacetedMinMaxValues","getGlobalFacetedMinMaxValues","GlobalFiltering","globalFilter","onGlobalFilterChange","globalFilterFn","getColumnCanGlobalFilter","_table$getCoreRowMode","getCanGlobalFilter","_table$options$getCol","enableGlobalFilter","getGlobalAutoFilterFn","getGlobalFilterFn","setGlobalFilter","resetGlobalFilter","RowExpanding","expanded","onExpandedChange","paginateExpandedRows","registered","queued","_autoResetExpanded","_table$options$autoRe","_queue","autoResetAll","autoResetExpanded","manualExpanding","resetExpanded","setExpanded","toggleAllRowsExpanded","getIsAllRowsExpanded","_table$initialState$e","getCanSomeRowsExpand","getPrePaginationRowModel","getCanExpand","getToggleAllRowsExpandedHandler","getIsSomeRowsExpanded","keys","getRowModel","getIsExpanded","getExpandedDepth","rowIds","rowsById","splitId","getPreExpandedRowModel","getSortedRowModel","getExpandedRowModel","_getExpandedRowModel","toggleExpanded","_expanded","exists","oldExpanded","rowId","_table$options$getIsR","getIsRowExpanded","_table$options$getRow","getRowCanExpand","enableExpanding","getIsAllParentsExpanded","isFullyExpanded","getToggleExpandedHandler","canExpand","defaultPageIndex","defaultPageSize","getDefaultPaginationState","pageIndex","pageSize","RowPagination","pagination","onPaginationChange","_autoResetPageIndex","autoResetPageIndex","manualPagination","resetPageIndex","setPagination","safeUpdater","newState","resetPagination","_table$initialState$p","setPageIndex","maxPageIndex","pageCount","_table$initialState$p2","resetPageSize","_table$initialState$p3","_table$initialState2","setPageSize","topRowIndex","setPageCount","_table$options$pageCo","newPageCount","getPageOptions","getPageCount","pageOptions","fill","getCanPreviousPage","getCanNextPage","previousPage","nextPage","firstPage","lastPage","getPaginationRowModel","_getPaginationRowModel","_table$options$pageCo2","ceil","getRowCount","_table$options$rowCou","rowCount","rows","getDefaultRowPinningState","top","bottom","RowPinning","rowPinning","onRowPinningChange","includeLeafRows","includeParentRows","leafRowIds","parentRowIds","setRowPinning","_old$top3","_old$bottom3","_old$top","_old$bottom","has","_old$top2","_old$bottom2","enableRowPinning","isTop","isBottom","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","resetRowPinning","_table$initialState$r","getIsSomeRowsPinned","_pinningState$top","_pinningState$bottom","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","keepPinnedRows","allRows","topPinnedRowIds","bottomPinnedRowIds","getCenterRows","topAndBottom","RowSelection","rowSelection","onRowSelectionChange","enableRowSelection","enableMultiRowSelection","enableSubRowSelection","setRowSelection","resetRowSelection","toggleAllRowsSelected","getIsAllRowsSelected","preGroupedFlatRows","getCanSelect","toggleAllPageRowsSelected","resolvedValue","getIsAllPageRowsSelected","mutateRowIsSelected","getPreSelectedRowModel","getSelectedRowModel","rowModel","selectRowsFn","getFilteredSelectedRowModel","getGroupedSelectedRowModel","isAllRowsSelected","paginationFlatRows","isAllPageRowsSelected","getIsSomeRowsSelected","_table$getState$rowSe","totalSelected","getIsSomePageRowsSelected","getIsSelected","getIsSomeSelected","getToggleAllRowsSelectedHandler","getToggleAllPageRowsSelectedHandler","toggleSelected","isSelected","_opts$selectChildren","selectedRowIds","selectChildren","isRowSelected","isSubRowSelected","getIsAllSubRowsSelected","getCanSelectSubRows","getCanMultiSelect","_table$options$enable3","getToggleSelectedHandler","canSelect","includeChildren","newSelectedFlatRows","newSelectedRowsById","recurseRows","_row$subRows2","selection","_selection$row$id","_row$subRows3","allChildrenSelected","someSelected","subRow","subRowChildrenSelected","reSplitAlphaNumeric","alphanumeric","rowA","rowB","compareAlphanumeric","alphanumericCaseSensitive","text","compareBasic","textCaseSensitive","datetime","basic","aStr","bStr","aa","bb","an","parseInt","bn","combo","sortingFns","RowSorting","sorting","sortingFn","sortUndefined","onSortingChange","isMultiSortEvent","shiftKey","getAutoSortingFn","firstRows","isString","getAutoSortDir","getSortingFn","_table$options$sortin","_table$options$sortin2","toggleSorting","desc","multi","nextSortingOrder","getNextSortingOrder","hasManualValue","setSorting","existingSorting","existingIndex","newSorting","sortAction","nextDesc","getCanMultiSort","_table$options$maxMul","maxMultiSortColCount","getFirstSortDir","_column$columnDef$sor","sortDescFirst","firstSortDirection","isSorted","getIsSorted","enableSortingRemoval","enableMultiRemove","getCanSort","enableSorting","_column$columnDef$ena2","enableMultiSort","_table$getState$sorti","columnSort","getSortIndex","_table$getState$sorti2","_table$getState$sorti3","clearSorting","getToggleSortingHandler","canSort","resetSorting","_table$initialState$s","getPreSortedRowModel","_getSortedRowModel","manualSorting","builtInFeatures","_options$_features","_options$initialState","debugTable","defaultOptions","assign","mergeOptions","coreInitialState","_feature$getInitialSt","queuedTimeout","coreInstance","cb","Promise","resolve","then","catch","error","setTimeout","reset","setOptions","newOptions","onStateChange","_getRowId","getRowId","_getCoreRowModel","searchAll","_defaultColumn","_props$renderValue$to","_props$renderValue","_getColumnDefs","columnDefs","recurseColumns","groupingColumnDef","_getAllFlatColumnsById","flatColumns","data","accessRows","originalRows","getSubRows","_row$originalSubRows","originalSubRows","expandRows","expandedRows","handleRow","_table$getColumn","facetedRowModel","uniqueValues","flatRow","_flatRow$getUniqueVal","facetedMinValue","facetedMaxValue","filterRows","filterRowImpl","filterRowModelFromLeafs","filterRowModelFromRoot","rowsToFilter","filterRow","_table$options$maxLea","newFilteredFlatRows","newFilteredRowsById","recurseFilterRows","newRow","_table$options$maxLea2","pass","preRowModel","filterableIds","filterRowsImpl","facetedUniqueValues","j","_facetedUniqueValues$","set","get","resolvedColumnFilters","resolvedGlobalFilters","_filterFn$resolveFilt","globallyFilterableColumns","_globalFilterFn$resol","currentColumnFilter","currentGlobalFilter","filterMeta","__global__","existingGrouping","groupedFlatRows","groupedRowsById","groupUpRecursively","rowGroupsMap","groupBy","aggregatedGroupedRows","entries","groupingValue","groupedRows","_groupedRows$0$getVal","aggregateFn","groupMap","resKey","previous","pageStart","pageEnd","paginatedRowModel","sortingState","sortedFlatRows","availableSorting","columnInfoById","sortEntry","invertSorting","sortData","sortedData","_sortEntry$desc","columnInfo","isDesc","sortInt","aValue","bValue","aUndefined","bUndefined"],"mappings":";;;;;;;;;;;;;;;;EAWA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;EACA;EACA;;EAsBO,SAASA,kBAAkBA,GAET;IACvB,OAAO;EACLC,IAAAA,QAAQ,EAAEA,CAACA,QAAQ,EAAEC,MAAM,KAAK;EAC9B,MAAA,OAAO,OAAOD,QAAQ,KAAK,UAAU,GAChC;EACC,QAAA,GAAGC,MAAM;EACTC,QAAAA,UAAU,EAAEF,QAAAA;EACd,OAAC,GACD;EACE,QAAA,GAAGC,MAAM;EACTE,QAAAA,WAAW,EAAEH,QAAAA;SACd,CAAA;OACN;MACDI,OAAO,EAAEH,MAAM,IAAIA,MAAM;MACzBI,KAAK,EAAEJ,MAAM,IAAIA,MAAAA;KAClB,CAAA;EACH;;EC9DA;;EAOA;;EA2CA;;EAEO,SAASK,gBAAgBA,CAAIC,OAAmB,EAAEC,KAAQ,EAAK;IACpE,OAAO,OAAOD,OAAO,KAAK,UAAU,GAC/BA,OAAO,CAAqBC,KAAK,CAAC,GACnCD,OAAO,CAAA;EACb,CAAA;EAEO,SAASE,IAAIA,GAAG;EACrB;EAAA,CAAA;EAGK,SAASC,gBAAgBA,CAC9BC,GAAM,EACNC,QAAiB,EACjB;EACA,EAAA,OAAQL,OAA+B,IAAK;EACxCK,IAAAA,QAAQ,CAASC,QAAQ,CAAeC,GAAgB,IAAK;QAC7D,OAAO;EACL,QAAA,GAAGA,GAAG;UACN,CA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AAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAC/DP,KAAK,CAACmjB,mBAAmB,EAC3B,CACF,CAAC,CAAA;EACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/build/umd/index.production.js b/node_modules/@tanstack/table-core/build/umd/index.production.js new file mode 100644 index 00000000..00029674 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/umd/index.production.js @@ -0,0 +1,12 @@ +/** + * table-core + * + * Copyright (c) TanStack + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TableCore={})}(this,(function(e){"use strict";function t(e,t){return"function"==typeof e?e(t):e}function n(e,n){return l=>{n.setState((n=>({...n,[e]:t(l,n[e])})))}}function l(e){return e instanceof Function}function o(e){return Array.isArray(e)&&e.every((e=>"number"==typeof e))}function i(e,t){const n=[],l=e=>{e.forEach((e=>{n.push(e);const o=t(e);null!=o&&o.length&&l(o)}))};return l(e),n}function r(e,t,n){let l,o=[];return i=>{let r;n.key&&n.debug&&(r=Date.now());const u=e(i);if(!(u.length!==o.length||u.some(((e,t)=>o[t]!==e))))return l;let a;if(o=u,n.key&&n.debug&&(a=Date.now()),l=t(...u),null==n||null==n.onChange||n.onChange(l),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-r))/100,t=Math.round(100*(Date.now()-a))/100,l=t/16,o=(e,t)=>{for(e=String(e);e.length{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:l}}function a(e,t,n,l){const o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(l),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:r((()=>[e,n,t,o]),((e,t,n,l)=>({table:e,column:t,row:n,cell:l,getValue:l.getValue,renderValue:l.renderValue})),u(e.options,"debugCells"))};return e._features.forEach((l=>{null==l.createCell||l.createCell(o,n,t,e)}),{}),o}function s(e,t,n,l){var o,i;const a={...e._getDefaultColumnDef(),...t},s=a.accessorKey;let g,d=null!=(o=null!=(i=a.id)?i:s?"function"==typeof String.prototype.replaceAll?s.replaceAll(".","_"):s.replace(/\./g,"_"):void 0)?o:"string"==typeof a.header?a.header:void 0;if(a.accessorFn?g=a.accessorFn:s&&(g=s.includes(".")?e=>{let t=e;for(const e of s.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[a.accessorKey]),!d)throw new Error;let c={id:`${String(d)}`,accessorFn:g,parent:l,depth:n,columnDef:a,columns:[],getFlatColumns:r((()=>[!0]),(()=>{var e;return[c,...null==(e=c.columns)?void 0:e.flatMap((e=>e.getFlatColumns()))]}),u(e.options,"debugColumns")),getLeafColumns:r((()=>[e._getOrderColumnsFn()]),(e=>{var t;if(null!=(t=c.columns)&&t.length){let t=c.columns.flatMap((e=>e.getLeafColumns()));return e(t)}return[c]}),u(e.options,"debugColumns"))};for(const t of e._features)null==t.createColumn||t.createColumn(c,e);return c}const g="debugHeaders";function d(e,t,n){var l;let o={id:null!=(l=n.id)?l:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach((t=>{null==t.createHeader||t.createHeader(o,e)})),o}const c={createTable:e=>{e.getHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>{var i,r;const u=null!=(i=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?i:[],a=null!=(r=null==o?void 0:o.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?r:[];return p(t,[...u,...n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),...a],e)}),u(e.options,g)),e.getCenterHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,l,o)=>p(t,n=n.filter((e=>!(null!=l&&l.includes(e.id)||null!=o&&o.includes(e.id)))),e,"center")),u(e.options,g)),e.getLeftHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left]),((t,n,l)=>{var o;return p(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"left")}),u(e.options,g)),e.getRightHeaderGroups=r((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right]),((t,n,l)=>{var o;return p(t,null!=(o=null==l?void 0:l.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[],e,"right")}),u(e.options,g)),e.getFooterGroups=r((()=>[e.getHeaderGroups()]),(e=>[...e].reverse()),u(e.options,g)),e.getLeftFooterGroups=r((()=>[e.getLeftHeaderGroups()]),(e=>[...e].reverse()),u(e.options,g)),e.getCenterFooterGroups=r((()=>[e.getCenterHeaderGroups()]),(e=>[...e].reverse()),u(e.options,g)),e.getRightFooterGroups=r((()=>[e.getRightHeaderGroups()]),(e=>[...e].reverse()),u(e.options,g)),e.getFlatHeaders=r((()=>[e.getHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),u(e.options,g)),e.getLeftFlatHeaders=r((()=>[e.getLeftHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),u(e.options,g)),e.getCenterFlatHeaders=r((()=>[e.getCenterHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),u(e.options,g)),e.getRightFlatHeaders=r((()=>[e.getRightHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),u(e.options,g)),e.getCenterLeafHeaders=r((()=>[e.getCenterFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),u(e.options,g)),e.getLeftLeafHeaders=r((()=>[e.getLeftFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),u(e.options,g)),e.getRightLeafHeaders=r((()=>[e.getRightFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),u(e.options,g)),e.getLeafHeaders=r((()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()]),((e,t,n)=>{var l,o,i,r,u,a;return[...null!=(l=null==(o=e[0])?void 0:o.headers)?l:[],...null!=(i=null==(r=t[0])?void 0:r.headers)?i:[],...null!=(u=null==(a=n[0])?void 0:a.headers)?u:[]].map((e=>e.getLeafHeaders())).flat()}),u(e.options,g))}};function p(e,t,n,l){var o,i;let r=0;const u=function(e,t){void 0===t&&(t=1),r=Math.max(r,t),e.filter((e=>e.getIsVisible())).forEach((e=>{var n;null!=(n=e.columns)&&n.length&&u(e.columns,t+1)}),0)};u(e);let a=[];const s=(e,t)=>{const o={depth:t,id:[l,`${t}`].filter(Boolean).join("_"),headers:[]},i=[];e.forEach((e=>{const r=[...i].reverse()[0];let u,a=!1;if(e.column.depth===o.depth&&e.column.parent?u=e.column.parent:(u=e.column,a=!0),r&&(null==r?void 0:r.column)===u)r.subHeaders.push(e);else{const o=d(n,u,{id:[l,t,u.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:a,placeholderId:a?`${i.filter((e=>e.column===u)).length}`:void 0,depth:t,index:i.length});o.subHeaders.push(e),i.push(o)}o.headers.push(e),e.headerGroup=o})),a.push(o),t>0&&s(i,t-1)},g=t.map(((e,t)=>d(n,e,{depth:r,index:t})));s(g,r-1),a.reverse();const c=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,n=0,l=[0];e.subHeaders&&e.subHeaders.length?(l=[],c(e.subHeaders).forEach((e=>{let{colSpan:n,rowSpan:o}=e;t+=n,l.push(o)}))):t=1;return n+=Math.min(...l),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}}));return c(null!=(o=null==(i=a[0])?void 0:i.headers)?o:[]),a}const f=(e,t,n,l,o,s,g)=>{let d={id:t,index:l,original:n,depth:o,parentId:g,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(d._valuesCache.hasOwnProperty(t))return d._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(d._valuesCache[t]=n.accessorFn(d.original,l),d._valuesCache[t]):void 0},getUniqueValues:t=>{if(d._uniqueValuesCache.hasOwnProperty(t))return d._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(d._uniqueValuesCache[t]=n.columnDef.getUniqueValues(d.original,l),d._uniqueValuesCache[t]):(d._uniqueValuesCache[t]=[d.getValue(t)],d._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=d.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=s?s:[],getLeafRows:()=>i(d.subRows,(e=>e.subRows)),getParentRow:()=>d.parentId?e.getRow(d.parentId,!0):void 0,getParentRows:()=>{let e=[],t=d;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:r((()=>[e.getAllLeafColumns()]),(t=>t.map((t=>a(e,d,t,t.id)))),u(e.options,"debugRows")),_getAllCellsByColumnId:r((()=>[d.getAllCells()]),(e=>e.reduce(((e,t)=>(e[t.column.id]=t,e)),{})),u(e.options,"debugRows"))};for(let t=0;t{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},w=(e,t,n)=>{var l,o;const i=null==n||null==(l=n.toString())?void 0:l.toLowerCase();return Boolean(null==(o=e.getValue(t))||null==(o=o.toString())||null==(o=o.toLowerCase())?void 0:o.includes(i))};w.autoRemove=e=>I(e);const h=(e,t,n)=>{var l;return Boolean(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.includes(n))};h.autoRemove=e=>I(e);const S=(e,t,n)=>{var l;return(null==(l=e.getValue(t))||null==(l=l.toString())?void 0:l.toLowerCase())===(null==n?void 0:n.toLowerCase())};S.autoRemove=e=>I(e);const C=(e,t,n)=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)};C.autoRemove=e=>I(e);const v=(e,t,n)=>!n.some((n=>{var l;return!(null!=(l=e.getValue(t))&&l.includes(n))}));v.autoRemove=e=>I(e)||!(null!=e&&e.length);const R=(e,t,n)=>n.some((n=>{var l;return null==(l=e.getValue(t))?void 0:l.includes(n)}));R.autoRemove=e=>I(e)||!(null!=e&&e.length);const b=(e,t,n)=>e.getValue(t)===n;b.autoRemove=e=>I(e);const F=(e,t,n)=>e.getValue(t)==n;F.autoRemove=e=>I(e);const M=(e,t,n)=>{let[l,o]=n;const i=e.getValue(t);return i>=l&&i<=o};M.resolveFilterValue=e=>{let[t,n]=e,l="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,i=null===t||Number.isNaN(l)?-1/0:l,r=null===n||Number.isNaN(o)?1/0:o;if(i>r){const e=i;i=r,r=e}return[i,r]},M.autoRemove=e=>I(e)||I(e[0])&&I(e[1]);const V={includesString:w,includesStringSensitive:h,equalsString:S,arrIncludes:C,arrIncludesAll:v,arrIncludesSome:R,equals:b,weakEquals:F,inNumberRange:M};function I(e){return null==e||""===e}const P={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:n("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],l=null==t?void 0:t.getValue(e.id);return"string"==typeof l?V.includesString:"number"==typeof l?V.inNumberRange:"boolean"==typeof l||null!==l&&"object"==typeof l?V.equals:Array.isArray(l)?V.arrIncludes:V.weakEquals},e.getFilterFn=()=>{var t,o;return l(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(t=null==(o=n.options.filterFns)?void 0:o[e.columnDef.filterFn])?t:V[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,l,o;return(null==(t=e.columnDef.enableColumnFilter)||t)&&(null==(l=n.options.enableColumnFilters)||l)&&(null==(o=n.options.enableFilters)||o)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return null==(t=n.getState().columnFilters)||null==(t=t.find((t=>t.id===e.id)))?void 0:t.value},e.getFilterIndex=()=>{var t,l;return null!=(t=null==(l=n.getState().columnFilters)?void 0:l.findIndex((t=>t.id===e.id)))?t:-1},e.setFilterValue=l=>{n.setColumnFilters((n=>{const o=e.getFilterFn(),i=null==n?void 0:n.find((t=>t.id===e.id)),r=t(l,i?i.value:void 0);var u;if(x(o,r,e))return null!=(u=null==n?void 0:n.filter((t=>t.id!==e.id)))?u:[];const a={id:e.id,value:r};var s;return i?null!=(s=null==n?void 0:n.map((t=>t.id===e.id?a:t)))?s:[]:null!=n&&n.length?[...n,a]:[a]}))}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const l=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange((e=>{var o;return null==(o=t(n,e))?void 0:o.filter((e=>{const t=l.find((t=>t.id===e.id));if(t){if(x(t.getFilterFn(),e.value,t))return!1}return!0}))}))},e.resetColumnFilters=t=>{var n,l;e.setColumnFilters(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function x(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const _={sum:(e,t,n)=>n.reduce(((t,n)=>{const l=n.getValue(e);return t+("number"==typeof l?l:0)}),0),min:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l>n||void 0===l&&n>=n)&&(l=n)})),l},max:(e,t,n)=>{let l;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(l=n)&&(l=n)})),l},extent:(e,t,n)=>{let l,o;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(void 0===l?n>=n&&(l=o=n):(l>n&&(l=n),o{let n=0,l=0;if(t.forEach((t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,l+=o)})),n)return l/n},median:(e,t)=>{if(!t.length)return;const n=t.map((t=>t.getValue(e)));if(!o(n))return;if(1===n.length)return n[0];const l=Math.floor(n.length/2),i=n.sort(((e,t)=>e-t));return n.length%2!=0?i[l]:(i[l-1]+i[l])/2},unique:(e,t)=>Array.from(new Set(t.map((t=>t.getValue(e)))).values()),uniqueCount:(e,t)=>new Set(t.map((t=>t.getValue(e)))).size,count:(e,t)=>t.length},y={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:n("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping((t=>null!=t&&t.includes(e.id)?t.filter((t=>t!==e.id)):[...null!=t?t:[],e.id]))},e.getCanGroup=()=>{var n,l;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(l=t.options.enableGrouping)||l)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],l=null==n?void 0:n.getValue(e.id);return"number"==typeof l?_.sum:"[object Date]"===Object.prototype.toString.call(l)?_.extent:void 0},e.getAggregationFn=()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(o=t.options.aggregationFns)?void 0:o[e.columnDef.aggregationFn])?n:_[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,l;e.setGrouping(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const l=t.getColumn(n);return null!=l&&l.columnDef.getGroupingValue?(e._groupingValuesCache[n]=l.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,l)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}};function E(e,t,n){if(null==t||!t.length||!n)return e;const l=e.filter((e=>!t.includes(e.id)));if("remove"===n)return l;return[...t.map((t=>e.find((e=>e.id===t)))).filter(Boolean),...l]}const G={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:n("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=r((e=>[B(t,e)]),(t=>t.findIndex((t=>t.id===e.id))),u(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var l;return(null==(l=B(t,n)[0])?void 0:l.id)===e.id},e.getIsLastColumn=n=>{var l;const o=B(t,n);return(null==(l=o[o.length-1])?void 0:l.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=r((()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode]),((e,t,n)=>l=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...l];for(;n.length&&t.length;){const e=t.shift(),l=n.findIndex((t=>t.id===e));l>-1&&o.push(n.splice(l,1)[0])}o=[...o,...n]}else o=l;return E(o,t,n)}),u(e.options,"debugTable"))}},z={getInitialState:e=>({columnPinning:{left:[],right:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:n("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const l=e.getLeafColumns().map((e=>e.id)).filter(Boolean);t.setColumnPinning((e=>{var t,o,i,r,u,a;return"right"===n?{left:(null!=(i=null==e?void 0:e.left)?i:[]).filter((e=>!(null!=l&&l.includes(e)))),right:[...(null!=(r=null==e?void 0:e.right)?r:[]).filter((e=>!(null!=l&&l.includes(e)))),...l]}:"left"===n?{left:[...(null!=(u=null==e?void 0:e.left)?u:[]).filter((e=>!(null!=l&&l.includes(e)))),...l],right:(null!=(a=null==e?void 0:e.right)?a:[]).filter((e=>!(null!=l&&l.includes(e))))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter((e=>!(null!=l&&l.includes(e)))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter((e=>!(null!=l&&l.includes(e))))}}))},e.getCanPin=()=>e.getLeafColumns().some((e=>{var n,l,o;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(l=null!=(o=t.options.enableColumnPinning)?o:t.options.enablePinning)||l)})),e.getIsPinned=()=>{const n=e.getLeafColumns().map((e=>e.id)),{left:l,right:o}=t.getState().columnPinning,i=n.some((e=>null==l?void 0:l.includes(e))),r=n.some((e=>null==o?void 0:o.includes(e)));return i?"left":!!r&&"right"},e.getPinnedIndex=()=>{var n,l;const o=e.getIsPinned();return o?null!=(n=null==(l=t.getState().columnPinning)||null==(l=l[o])?void 0:l.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.column.id)))}),u(t.options,"debugRows")),e.getLeftVisibleCells=r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"left"})))),u(t.options,"debugRows")),e.getRightVisibleCells=r((()=>[e._getAllVisibleCells(),t.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"right"})))),u(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,l;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(l=e.initialState)?void 0:l.columnPinning)?n:{left:[],right:[]})},e.getIsSomeColumnsPinned=t=>{var n;const l=e.getState().columnPinning;var o,i;return t?Boolean(null==(n=l[t])?void 0:n.length):Boolean((null==(o=l.left)?void 0:o.length)||(null==(i=l.right)?void 0:i.length))},e.getLeftLeafColumns=r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),u(e.options,"debugColumns")),e.getRightLeafColumns=r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),u(e.options,"debugColumns")),e.getCenterLeafColumns=r((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((e,t,n)=>{const l=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!l.includes(e.id)))}),u(e.options,"debugColumns"))}};const A={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},D={getDefaultColumnDef:()=>A,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:n("columnSizing",e),onColumnSizingInfoChange:n("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,l,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:A.minSize,null!=(l=null!=i?i:e.columnDef.size)?l:A.size),null!=(o=e.columnDef.maxSize)?o:A.maxSize)},e.getStart=r((e=>[e,B(t,e),t.getState().columnSizing]),((t,n)=>n.slice(0,e.getIndex(t)).reduce(((e,t)=>e+t.getSize()),0)),u(t.options,"debugColumns")),e.getAfter=r((e=>[e,B(t,e),t.getState().columnSizing]),((t,n)=>n.slice(e.getIndex(t)+1).reduce(((e,t)=>e+t.getSize()),0)),u(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing((t=>{let{[e.id]:n,...l}=t;return l}))},e.getCanResize=()=>{var n,l;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(l=t.options.enableColumnResizing)||l)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const n=e=>{var l;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(l=e.column.getSize())?l:0};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{const l=t.getColumn(e.column.id),o=null==l?void 0:l.getCanResize();return i=>{if(!l||!o)return;if(null==i.persist||i.persist(),O(i)&&i.touches&&i.touches.length>1)return;const r=e.getSize(),u=e?e.getLeafHeaders().map((e=>[e.column.id,e.column.getSize()])):[[l.id,l.getSize()]],a=O(i)?Math.round(i.touches[0].clientX):i.clientX,s={},g=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo((e=>{var l,o;const i="rtl"===t.options.columnResizeDirection?-1:1,r=(n-(null!=(l=null==e?void 0:e.startOffset)?l:0))*i,u=Math.max(r/(null!=(o=null==e?void 0:e.startSize)?o:0),-.999999);return e.columnSizingStart.forEach((e=>{let[t,n]=e;s[t]=Math.round(100*Math.max(n+n*u,0))/100})),{...e,deltaOffset:r,deltaPercentage:u}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...s}))))},d=e=>g("move",e),c=e=>{g("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},p=n||("undefined"!=typeof document?document:null);const f={moveHandler:e=>d(e.clientX),upHandler:e=>{null==p||p.removeEventListener("mousemove",f.moveHandler),null==p||p.removeEventListener("mouseup",f.upHandler),c(e.clientX)}},m={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{var t;null==p||p.removeEventListener("touchmove",m.moveHandler),null==p||p.removeEventListener("touchend",m.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),c(null==(t=e.touches[0])?void 0:t.clientX)}},w=!!H()&&{passive:!1};O(i)?(null==p||p.addEventListener("touchmove",m.moveHandler,w),null==p||p.addEventListener("touchend",m.upHandler,w)):(null==p||p.addEventListener("mousemove",f.moveHandler,w),null==p||p.addEventListener("mouseup",f.upHandler,w)),t.setColumnSizingInfo((e=>({...e,startOffset:a,startSize:r,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:l.id})))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0}}};let L=null;function H(){if("boolean"==typeof L)return L;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return L=e,L}function O(e){return"touchstart"===e.type}const T={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:n("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility((t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()})))},e.getIsVisible=()=>{var n,l;const o=e.columns;return null==(n=o.length?o.some((e=>e.getIsVisible())):null==(l=t.getState().columnVisibility)?void 0:l[e.id])||n},e.getCanHide=()=>{var n,l;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(l=t.options.enableHiding)||l)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=r((()=>[e.getAllCells(),t.getState().columnVisibility]),(e=>e.filter((e=>e.column.getIsVisible()))),u(t.options,"debugRows")),e.getVisibleCells=r((()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()]),((e,t,n)=>[...e,...t,...n]),u(t.options,"debugRows"))},createTable:e=>{const t=(t,n)=>r((()=>[n(),n().filter((e=>e.getIsVisible())).map((e=>e.id)).join("_")]),(e=>e.filter((e=>null==e.getIsVisible?void 0:e.getIsVisible()))),u(e.options,"debugColumns"));e.getVisibleFlatColumns=t(0,(()=>e.getAllFlatColumns())),e.getVisibleLeafColumns=t(0,(()=>e.getAllLeafColumns())),e.getLeftVisibleLeafColumns=t(0,(()=>e.getLeftLeafColumns())),e.getRightVisibleLeafColumns=t(0,(()=>e.getRightLeafColumns())),e.getCenterVisibleLeafColumns=t(0,(()=>e.getCenterLeafColumns())),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce(((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())})),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some((e=>!(null!=e.getIsVisible&&e.getIsVisible()))),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some((e=>null==e.getIsVisible?void 0:e.getIsVisible())),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}};function B(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const q={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},N={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:n("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const l=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof l||"number"==typeof l}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,l,o,i;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(l=t.options.enableGlobalFilter)||l)&&(null==(o=t.options.enableFilters)||o)&&(null==(i=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||i)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>V.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:o}=e.options;return l(o)?o:"auto"===o?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[o])?t:V[o]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},k={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:n("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var l,o;if(t){if(null!=(l=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?l:!e.options.manualExpanding){if(n)return;n=!0,e._queue((()=>{e.resetExpanded(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,l;e.setExpanded(t?{}:null!=(n=null==(l=e.initialState)?void 0:l.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some((e=>e.getCanExpand())),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some((e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((e=>{const n=e.split(".");t=Math.max(t,n.length)})),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded((l=>{var o;const i=!0===l||!(null==l||!l[e.id]);let r={};if(!0===l?Object.keys(t.getRowModel().rowsById).forEach((e=>{r[e]=!0})):r=l,n=null!=(o=n)?o:!i,!i&&n)return{...r,[e.id]:!0};if(i&&!n){const{[e.id]:t,...n}=r;return n}return l}))},e.getIsExpanded=()=>{var n;const l=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===l||(null==l?void 0:l[e.id]))},e.getCanExpand=()=>{var n,l,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(l=t.options.enableExpanding)||l)&&!(null==(o=e.subRows)||!o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,l=e;for(;n&&l.parentId;)l=t.getRow(l.parentId,!0),n=l.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},j={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:n("pagination",e)}),createTable:e=>{let n=!1,l=!1;e._autoResetPageIndex=()=>{var t,o;if(n){if(null!=(t=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?t:!e.options.manualPagination){if(l)return;l=!0,e._queue((()=>{e.resetPageIndex(),l=!1}))}}else e._queue((()=>{n=!0}))},e.setPagination=n=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange((e=>t(n,e))),e.resetPagination=t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},e.setPageIndex=n=>{e.setPagination((l=>{let o=t(n,l.pageIndex);const i=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,i)),{...l,pageIndex:o}}))},e.resetPageIndex=t=>{var n,l;e.setPageIndex(t?0:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageIndex)?n:0)},e.resetPageSize=t=>{var n,l;e.setPageSize(t?10:null!=(n=null==(l=e.initialState)||null==(l=l.pagination)?void 0:l.pageSize)?n:10)},e.setPageSize=n=>{e.setPagination((e=>{const l=Math.max(1,t(n,e.pageSize)),o=e.pageSize*e.pageIndex,i=Math.floor(o/l);return{...e,pageIndex:i,pageSize:l}}))},e.setPageCount=n=>e.setPagination((l=>{var o;let i=t(n,null!=(o=e.options.pageCount)?o:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...l,pageCount:i}})),e.getPageOptions=r((()=>[e.getPageCount()]),(e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map(((e,t)=>t))),t}),u(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&te.setPageIndex((e=>e-1)),e.nextPage=()=>e.setPageIndex((e=>e+1)),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},U={getInitialState:e=>({rowPinning:{top:[],bottom:[]},...e}),getDefaultOptions:e=>({onRowPinningChange:n("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,l,o)=>{const i=l?e.getLeafRows().map((e=>{let{id:t}=e;return t})):[],r=o?e.getParentRows().map((e=>{let{id:t}=e;return t})):[],u=new Set([...r,e.id,...i]);t.setRowPinning((e=>{var t,l,o,i,r,a;return"bottom"===n?{top:(null!=(o=null==e?void 0:e.top)?o:[]).filter((e=>!(null!=u&&u.has(e)))),bottom:[...(null!=(i=null==e?void 0:e.bottom)?i:[]).filter((e=>!(null!=u&&u.has(e)))),...Array.from(u)]}:"top"===n?{top:[...(null!=(r=null==e?void 0:e.top)?r:[]).filter((e=>!(null!=u&&u.has(e)))),...Array.from(u)],bottom:(null!=(a=null==e?void 0:e.bottom)?a:[]).filter((e=>!(null!=u&&u.has(e))))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter((e=>!(null!=u&&u.has(e)))),bottom:(null!=(l=null==e?void 0:e.bottom)?l:[]).filter((e=>!(null!=u&&u.has(e))))}}))},e.getCanPin=()=>{var n;const{enableRowPinning:l,enablePinning:o}=t.options;return"function"==typeof l?l(e):null==(n=null!=l?l:o)||n},e.getIsPinned=()=>{const n=[e.id],{top:l,bottom:o}=t.getState().rowPinning,i=n.some((e=>null==l?void 0:l.includes(e))),r=n.some((e=>null==o?void 0:o.includes(e)));return i?"top":!!r&&"bottom"},e.getPinnedIndex=()=>{var n,l;const o=e.getIsPinned();if(!o)return-1;const i=null==(n="top"===o?t.getTopRows():t.getBottomRows())?void 0:n.map((e=>{let{id:t}=e;return t}));return null!=(l=null==i?void 0:i.indexOf(e.id))?l:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,l;return e.setRowPinning(t?{top:[],bottom:[]}:null!=(n=null==(l=e.initialState)?void 0:l.rowPinning)?n:{top:[],bottom:[]})},e.getIsSomeRowsPinned=t=>{var n;const l=e.getState().rowPinning;var o,i;return t?Boolean(null==(n=l[t])?void 0:n.length):Boolean((null==(o=l.top)?void 0:o.length)||(null==(i=l.bottom)?void 0:i.length))},e._getPinnedRows=(t,n,l)=>{var o;return(null==(o=e.options.keepPinnedRows)||o?(null!=n?n:[]).map((t=>{const n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null})):(null!=n?n:[]).map((e=>t.find((t=>t.id===e))))).filter(Boolean).map((e=>({...e,position:l})))},e.getTopRows=r((()=>[e.getRowModel().rows,e.getState().rowPinning.top]),((t,n)=>e._getPinnedRows(t,n,"top")),u(e.options,"debugRows")),e.getBottomRows=r((()=>[e.getRowModel().rows,e.getState().rowPinning.bottom]),((t,n)=>e._getPinnedRows(t,n,"bottom")),u(e.options,"debugRows")),e.getCenterRows=r((()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom]),((e,t,n)=>{const l=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter((e=>!l.has(e.id)))}),u(e.options,"debugRows"))}},$={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:n("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection((n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const l={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach((e=>{e.getCanSelect()&&(l[e.id]=!0)})):o.forEach((e=>{delete l[e.id]})),l}))},e.toggleAllPageRowsSelected=t=>e.setRowSelection((n=>{const l=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach((t=>{X(o,t.id,l,!0,e)})),o})),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=r((()=>[e.getState().rowSelection,e.getCoreRowModel()]),((t,n)=>Object.keys(t).length?K(e,n):{rows:[],flatRows:[],rowsById:{}}),u(e.options,"debugTable")),e.getFilteredSelectedRowModel=r((()=>[e.getState().rowSelection,e.getFilteredRowModel()]),((t,n)=>Object.keys(t).length?K(e,n):{rows:[],flatRows:[],rowsById:{}}),u(e.options,"debugTable")),e.getGroupedSelectedRowModel=r((()=>[e.getState().rowSelection,e.getSortedRowModel()]),((t,n)=>Object.keys(t).length?K(e,n):{rows:[],flatRows:[],rowsById:{}}),u(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let l=Boolean(t.length&&Object.keys(n).length);return l&&t.some((e=>e.getCanSelect()&&!n[e.id]))&&(l=!1),l},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter((e=>e.getCanSelect())),{rowSelection:n}=e.getState();let l=!!t.length;return l&&t.some((e=>!n[e.id]))&&(l=!1),l},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter((e=>e.getCanSelect())).some((e=>e.getIsSelected()||e.getIsSomeSelected()))},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,l)=>{const o=e.getIsSelected();t.setRowSelection((i=>{var r;if(n=void 0!==n?n:!o,e.getCanSelect()&&o===n)return i;const u={...i};return X(u,e.id,n,null==(r=null==l?void 0:l.selectChildren)||r,t),u}))},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return J(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===Q(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===Q(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var l;t&&e.toggleSelected(null==(l=n.target)?void 0:l.checked)}}}},X=(e,t,n,l,o)=>{var i;const r=o.getRow(t,!0);n?(r.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),r.getCanSelect()&&(e[t]=!0)):delete e[t],l&&null!=(i=r.subRows)&&i.length&&r.getCanSelectSubRows()&&r.subRows.forEach((t=>X(e,t.id,n,l,o)))};function K(e,t){const n=e.getState().rowSelection,l=[],o={},i=function(e,t){return e.map((e=>{var t;const r=J(e,n);if(r&&(l.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:i(e.subRows)}),r)return e})).filter(Boolean)};return{rows:i(t.rows),flatRows:l,rowsById:o}}function J(e,t){var n;return null!=(n=t[e.id])&&n}function Q(e,t,n){var l;if(null==(l=e.subRows)||!l.length)return!1;let o=!0,i=!1;return e.subRows.forEach((e=>{if((!i||o)&&(e.getCanSelect()&&(J(e,t)?i=!0:o=!1),e.subRows&&e.subRows.length)){const n=Q(e,t);"all"===n?i=!0:"some"===n?(i=!0,o=!1):o=!1}})),o?"all":!!i&&"some"}const W=/([0-9]+)/gm;function Y(e,t){return e===t?0:e>t?1:-1}function Z(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function ee(e,t){const n=e.split(W).filter(Boolean),l=t.split(W).filter(Boolean);for(;n.length&&l.length;){const e=n.shift(),t=l.shift(),o=parseInt(e,10),i=parseInt(t,10),r=[o,i].sort();if(isNaN(r[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(r[1]))return isNaN(o)?-1:1;if(o>i)return 1;if(i>o)return-1}}return n.length-l.length}const te={alphanumeric:(e,t,n)=>ee(Z(e.getValue(n)).toLowerCase(),Z(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>ee(Z(e.getValue(n)),Z(t.getValue(n))),text:(e,t,n)=>Y(Z(e.getValue(n)).toLowerCase(),Z(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>Y(Z(e.getValue(n)),Z(t.getValue(n))),datetime:(e,t,n)=>{const l=e.getValue(n),o=t.getValue(n);return l>o?1:lY(e.getValue(n),t.getValue(n))},ne={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:n("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let l=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return te.datetime;if("string"==typeof n&&(l=!0,n.split(W).length>1))return te.alphanumeric}return l?te.text:te.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,o;if(!e)throw new Error;return l(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(o=t.options.sortingFns)?void 0:o[e.columnDef.sortingFn])?n:te[e.columnDef.sortingFn]},e.toggleSorting=(n,l)=>{const o=e.getNextSortingOrder(),i=null!=n;t.setSorting((r=>{const u=null==r?void 0:r.find((t=>t.id===e.id)),a=null==r?void 0:r.findIndex((t=>t.id===e.id));let s,g=[],d=i?n:"desc"===o;var c;(s=null!=r&&r.length&&e.getCanMultiSort()&&l?u?"toggle":"add":null!=r&&r.length&&a!==r.length-1?"replace":u?"toggle":"replace","toggle"===s&&(i||o||(s="remove")),"add"===s)?(g=[...r,{id:e.id,desc:d}],g.splice(0,g.length-(null!=(c=t.options.maxMultiSortColCount)?c:Number.MAX_SAFE_INTEGER))):g="toggle"===s?r.map((t=>t.id===e.id?{...t,desc:d}:t)):"remove"===s?r.filter((t=>t.id!==e.id)):[{id:e.id,desc:d}];return g}))},e.getFirstSortDir=()=>{var n,l;return(null!=(n=null!=(l=e.columnDef.sortDescFirst)?l:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var l,o;const i=e.getFirstSortDir(),r=e.getIsSorted();return r?!!(r===i||null!=(l=t.options.enableSortingRemoval)&&!l||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===r?"asc":"desc"):i},e.getCanSort=()=>{var n,l;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(l=t.options.enableSorting)||l)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,l;return null!=(n=null!=(l=e.columnDef.enableMultiSort)?l:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const l=null==(n=t.getState().sorting)?void 0:n.find((t=>t.id===e.id));return!!l&&(l.desc?"desc":"asc")},e.getSortIndex=()=>{var n,l;return null!=(n=null==(l=t.getState().sorting)?void 0:l.findIndex((t=>t.id===e.id)))?n:-1},e.clearSorting=()=>{t.setSorting((t=>null!=t&&t.length?t.filter((t=>t.id!==e.id)):[]))},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return l=>{n&&(null==l.persist||l.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(l))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,l;e.setSorting(t?[]:null!=(n=null==(l=e.initialState)?void 0:l.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},le=[c,T,G,z,m,P,q,N,ne,y,k,j,U,$,D];function oe(e){const t=[],n=e=>{var l;t.push(e),null!=(l=e.subRows)&&l.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function ie(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var l;const o=[],i={},r=null!=(l=n.options.maxLeafRowFilterDepth)?l:100,u=function(e,l){void 0===l&&(l=0);const a=[];for(let g=0;g"function"==typeof e?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}},e.createRow=f,e.createTable=function(e){var n,l;const o=[...le,...null!=(n=e._features)?n:[]];let i={_features:o};const a=i._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(i))),{});let g={...null!=(l=e.initialState)?l:{}};i._features.forEach((e=>{var t;g=null!=(t=null==e.getInitialState?void 0:e.getInitialState(g))?t:g}));const d=[];let c=!1;const p={_features:o,options:{...a,...e},initialState:g,_queue:e=>{d.push(e),c||(c=!0,Promise.resolve().then((()=>{for(;d.length;)d.shift()();c=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{const n=t(e,i.options);i.options=(e=>i.options.mergeOptions?i.options.mergeOptions(a,e):{...a,...e})(n)},getState:()=>i.options.state,setState:e=>{null==i.options.onStateChange||i.options.onStateChange(e)},_getRowId:(e,t,n)=>{var l;return null!=(l=null==i.options.getRowId?void 0:i.options.getRowId(e,t,n))?l:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?i.getPrePaginationRowModel():i.getRowModel()).rowsById[e];if(!n&&(n=i.getCoreRowModel().rowsById[e],!n))throw new Error;return n},_getDefaultColumnDef:r((()=>[i.options.defaultColumn]),(e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...i._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef())),{}),...e}}),u(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:r((()=>[i._getColumnDefs()]),(e=>{const t=function(e,n,l){return void 0===l&&(l=0),e.map((e=>{const o=s(i,e,l,n),r=e;return o.columns=r.columns?t(r.columns,o,l+1):[],o}))};return t(e)}),u(e,"debugColumns")),getAllFlatColumns:r((()=>[i.getAllColumns()]),(e=>e.flatMap((e=>e.getFlatColumns()))),u(e,"debugColumns")),_getAllFlatColumnsById:r((()=>[i.getAllFlatColumns()]),(e=>e.reduce(((e,t)=>(e[t.id]=t,e)),{})),u(e,"debugColumns")),getAllLeafColumns:r((()=>[i.getAllColumns(),i._getOrderColumnsFn()]),((e,t)=>t(e.flatMap((e=>e.getLeafColumns())))),u(e,"debugColumns")),getColumn:e=>i._getAllFlatColumnsById()[e]};Object.assign(i,p);for(let e=0;er((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},l=function(t,o,i){void 0===o&&(o=0);const r=[];for(let a=0;ae._autoResetPageIndex())))},e.getExpandedRowModel=function(){return e=>r((()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows]),((e,t,n)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:n?oe(t):t),u(e.options,"debugTable"))},e.getFacetedMinMaxValues=function(){return(e,t)=>r((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{if(!e)return;const n=e.flatRows.flatMap((e=>{var n;return null!=(n=e.getUniqueValues(t))?n:[]})).map(Number).filter((e=>!Number.isNaN(e)));if(!n.length)return;let l=n[0],o=n[n.length-1];for(const e of n)eo&&(o=e);return[l,o]}),u(e.options,"debugTable"))},e.getFacetedRowModel=function(){return(e,t)=>r((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()]),((n,l,o)=>{if(!n.rows.length||(null==l||!l.length)&&!o)return n;const i=[...l.map((e=>e.id)).filter((e=>e!==t)),o?"__global__":void 0].filter(Boolean);return ie(n.rows,(e=>{for(let t=0;tr((()=>{var n;return[null==(n=e.getColumn(t))?void 0:n.getFacetedRowModel()]}),(e=>{if(!e)return new Map;let n=new Map;for(let o=0;or((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,l)=>{if(!t.rows.length||(null==n||!n.length)&&!l){for(let e=0;e{var n;const l=e.getColumn(t.id);if(!l)return;const i=l.getFilterFn();i&&o.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})}));const r=(null!=n?n:[]).map((e=>e.id)),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,g;l&&u&&a.length&&(r.push("__global__"),a.forEach((e=>{var t;i.push({id:e.id,filterFn:u,resolvedValue:null!=(t=null==u.resolveFilterValue?void 0:u.resolveFilterValue(l))?t:l})})));for(let e=0;e{n.columnFiltersMeta[t]=e}))}if(i.length){for(let e=0;e{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return ie(t.rows,(e=>{for(let t=0;te._autoResetPageIndex())))},e.getGroupedRowModel=function(){return e=>r((()=>[e.getState().grouping,e.getPreGroupedRowModel()]),((t,n)=>{if(!n.rows.length||!t.length)return n.rows.forEach((e=>{e.depth=0,e.parentId=void 0})),n;const l=t.filter((t=>e.getColumn(t))),o=[],r={},u=function(t,n,a){if(void 0===n&&(n=0),n>=l.length)return t.map((e=>(e.depth=n,o.push(e),r[e.id]=e,e.subRows&&(e.subRows=u(e.subRows,n+1,e.id)),e)));const s=l[n],g=function(e,t){const n=new Map;return e.reduce(((e,n)=>{const l=`${n.getGroupingValue(t)}`,o=e.get(l);return o?o.push(n):e.set(l,[n]),e}),n)}(t,s),d=Array.from(g.entries()).map(((t,g)=>{let[d,c]=t,p=`${s}:${d}`;p=a?`${a}>${p}`:p;const m=u(c,n+1,p);m.forEach((e=>{e.parentId=p}));const w=n?i(c,(e=>e.subRows)):c,h=f(e,p,w[0].original,g,n,void 0,a);return Object.assign(h,{groupingColumnId:s,groupingValue:d,subRows:m,leafRows:w,getValue:t=>{if(l.includes(t)){if(h._valuesCache.hasOwnProperty(t))return h._valuesCache[t];var n;if(c[0])h._valuesCache[t]=null!=(n=c[0].getValue(t))?n:void 0;return h._valuesCache[t]}if(h._groupingValuesCache.hasOwnProperty(t))return h._groupingValuesCache[t];const o=e.getColumn(t),i=null==o?void 0:o.getAggregationFn();return i?(h._groupingValuesCache[t]=i(t,w,c),h._groupingValuesCache[t]):void 0}}),m.forEach((e=>{o.push(e),r[e.id]=e})),h}));return d},a=u(n.rows,0);return a.forEach((e=>{o.push(e),r[e.id]=e})),{rows:a,flatRows:o,rowsById:r}}),u(e.options,"debugTable",0,(()=>{e._queue((()=>{e._autoResetExpanded(),e._autoResetPageIndex()}))})))},e.getMemoOptions=u,e.getPaginationRowModel=function(e){return e=>r((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:l,pageIndex:o}=t;let{rows:i,flatRows:r,rowsById:u}=n;const a=l*o,s=a+l;let g;i=i.slice(a,s),g=e.options.paginateExpandedRows?{rows:i,flatRows:r,rowsById:u}:oe({rows:i,flatRows:r,rowsById:u}),g.flatRows=[];const d=e=>{g.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d)};return g.rows.forEach(d),g}),u(e.options,"debugTable"))},e.getSortedRowModel=function(){return e=>r((()=>[e.getState().sorting,e.getPreSortedRowModel()]),((t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const l=e.getState().sorting,o=[],i=l.filter((t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()})),r={};i.forEach((t=>{const n=e.getColumn(t.id);n&&(r[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})}));const u=e=>{const t=e.map((e=>({...e})));return t.sort(((e,t)=>{for(let l=0;l{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=u(e.subRows))})),t};return{rows:u(n.rows),flatRows:o,rowsById:n.rowsById}}),u(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))},e.isFunction=l,e.isNumberArray=o,e.isRowSelected=J,e.isSubRowSelected=Q,e.makeStateUpdater=n,e.memo=r,e.noop=function(){},e.orderColumns=E,e.passiveEventSupported=H,e.reSplitAlphaNumeric=W,e.selectRowsFn=K,e.shouldAutoRemoveFilter=x,e.sortingFns=te})); +//# sourceMappingURL=index.production.js.map diff --git a/node_modules/@tanstack/table-core/build/umd/index.production.js.map b/node_modules/@tanstack/table-core/build/umd/index.production.js.map new file mode 100644 index 00000000..4d8f6ab5 --- /dev/null +++ b/node_modules/@tanstack/table-core/build/umd/index.production.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.production.js","sources":["../../src/utils.ts","../../src/core/cell.ts","../../src/core/column.ts","../../src/core/headers.ts","../../src/core/row.ts","../../src/features/ColumnFaceting.ts","../../src/filterFns.ts","../../src/features/ColumnFiltering.ts","../../src/aggregationFns.ts","../../src/features/ColumnGrouping.ts","../../src/features/ColumnOrdering.ts","../../src/features/ColumnPinning.ts","../../src/features/ColumnSizing.ts","../../src/utils/document.ts","../../src/features/ColumnVisibility.ts","../../src/features/GlobalFaceting.ts","../../src/features/GlobalFiltering.ts","../../src/features/RowExpanding.ts","../../src/features/RowPagination.ts","../../src/features/RowPinning.ts","../../src/features/RowSelection.ts","../../src/sortingFns.ts","../../src/features/RowSorting.ts","../../src/core/table.ts","../../src/utils/getExpandedRowModel.ts","../../src/utils/filterRowsUtils.ts","../../src/columnHelper.ts","../../src/utils/getCoreRowModel.ts","../../src/utils/getFacetedMinMaxValues.ts","../../src/utils/getFacetedRowModel.ts","../../src/utils/getFacetedUniqueValues.ts","../../src/utils/getFilteredRowModel.ts","../../src/utils/getGroupedRowModel.ts","../../src/utils/getPaginationRowModel.ts","../../src/utils/getSortedRowModel.ts"],"sourcesContent":["import { TableOptionsResolved, TableState, Updater } from './types'\n\nexport type PartialKeys = Omit & Partial>\nexport type RequiredKeys = Omit &\n Required>\nexport type Overwrite = Omit<\n T,\n keyof U\n> &\n U\n\nexport type UnionToIntersection = (\n T extends any ? (x: T) => any : never\n) extends (x: infer R) => any\n ? R\n : never\n\nexport type IsAny = 1 extends 0 & T ? Y : N\nexport type IsKnown = unknown extends T ? N : Y\n\ntype ComputeRange<\n N extends number,\n Result extends Array = [],\n> = Result['length'] extends N\n ? Result\n : ComputeRange\ntype Index40 = ComputeRange<40>[number]\n\n// Is this type a tuple?\ntype IsTuple = T extends readonly any[] & { length: infer Length }\n ? Length extends Index40\n ? T\n : never\n : never\n\n// If this type is a tuple, what indices are allowed?\ntype AllowedIndexes<\n Tuple extends ReadonlyArray,\n Keys extends number = never,\n> = Tuple extends readonly []\n ? Keys\n : Tuple extends readonly [infer _, ...infer Tail]\n ? AllowedIndexes\n : Keys\n\nexport type DeepKeys = TDepth['length'] extends 5\n ? never\n : unknown extends T\n ? string\n : T extends readonly any[] & IsTuple\n ? AllowedIndexes | DeepKeysPrefix, TDepth>\n : T extends any[]\n ? DeepKeys\n : T extends Date\n ? never\n : T extends object\n ? (keyof T & string) | DeepKeysPrefix\n : never\n\ntype DeepKeysPrefix<\n T,\n TPrefix,\n TDepth extends any[],\n> = TPrefix extends keyof T & (number | string)\n ? `${TPrefix}.${DeepKeys & string}`\n : never\n\nexport type DeepValue =\n T extends Record\n ? TProp extends `${infer TBranch}.${infer TDeepProp}`\n ? DeepValue\n : T[TProp & string]\n : never\n\nexport type NoInfer = [T][T extends any ? 0 : never]\n\nexport type Getter = () => NoInfer\n\n///\n\nexport function functionalUpdate(updater: Updater, input: T): T {\n return typeof updater === 'function'\n ? (updater as (input: T) => T)(input)\n : updater\n}\n\nexport function noop() {\n //\n}\n\nexport function makeStateUpdater(\n key: K,\n instance: unknown\n) {\n return (updater: Updater) => {\n ;(instance as any).setState((old: TTableState) => {\n return {\n ...old,\n [key]: functionalUpdate(updater, (old as any)[key]),\n }\n })\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\nexport function isFunction(d: any): d is T {\n return d instanceof Function\n}\n\nexport function isNumberArray(d: any): d is number[] {\n return Array.isArray(d) && d.every(val => typeof val === 'number')\n}\n\nexport function flattenBy(\n arr: TNode[],\n getChildren: (item: TNode) => TNode[]\n) {\n const flat: TNode[] = []\n\n const recurse = (subArr: TNode[]) => {\n subArr.forEach(item => {\n flat.push(item)\n const children = getChildren(item)\n if (children?.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\nexport function memo(\n getDeps: (depArgs?: TDepArgs) => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: any\n debug?: () => any\n onChange?: (result: TResult) => void\n }\n): (depArgs?: TDepArgs) => TResult {\n let deps: any[] = []\n let result: TResult | undefined\n\n return depArgs => {\n let depTime: number\n if (opts.key && opts.debug) depTime = Date.now()\n\n const newDeps = getDeps(depArgs)\n\n const depsChanged =\n newDeps.length !== deps.length ||\n newDeps.some((dep: any, index: number) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime: number\n if (opts.key && opts.debug) resultTime = Date.now()\n\n result = fn(...newDeps)\n opts?.onChange?.(result)\n\n if (opts.key && opts.debug) {\n if (opts?.debug()) {\n const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120)\n )}deg 100% 31%);`,\n opts?.key\n )\n }\n }\n\n return result!\n }\n}\n\nexport function getMemoOptions(\n tableOptions: Partial>,\n debugLevel:\n | 'debugAll'\n | 'debugCells'\n | 'debugTable'\n | 'debugColumns'\n | 'debugRows'\n | 'debugHeaders',\n key: string,\n onChange?: (result: any) => void\n) {\n return {\n debug: () => tableOptions?.debugAll ?? tableOptions[debugLevel],\n key: process.env.NODE_ENV === 'development' && key,\n onChange,\n }\n}\n","import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, getMemoOptions, memo } from '../utils'\n\nexport interface CellContext {\n cell: Cell\n column: Column\n getValue: Getter\n renderValue: Getter\n row: Row\n table: Table\n}\n\nexport interface CoreCell {\n /**\n * The associated Column object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n column: Column\n /**\n * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice:\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getContext: () => CellContext\n /**\n * Returns the value for the cell, accessed via the associated column's accessor key or accessor function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n getValue: CellContext['getValue']\n /**\n * The unique ID for the cell across the entire table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n id: string\n /**\n * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n renderValue: CellContext['renderValue']\n /**\n * The associated Row object for the cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells)\n */\n row: Row\n}\n\nexport function createCell(\n table: Table,\n row: Row,\n column: Column,\n columnId: string\n): Cell {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n getMemoOptions(table.options, 'debugCells', 'cell.getContext')\n ),\n }\n\n table._features.forEach(feature => {\n feature.createCell?.(\n cell as Cell,\n column,\n row as Row,\n table\n )\n }, {})\n\n return cell as Cell\n}\n","import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport interface CoreColumn {\n /**\n * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n accessorFn?: AccessorFn\n /**\n * The original column def used to create the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columnDef: ColumnDef\n /**\n * The child column (if the column is a group column). Will be an empty array if the column is not a group column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n columns: Column[]\n /**\n * The depth of the column (if grouped) relative to the root column def array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n depth: number\n /**\n * Returns the flattened array of this column and all child/grand-child columns for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getFlatColumns: () => Column[]\n /**\n * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n getLeafColumns: () => Column[]\n /**\n * The resolved unique identifier for the column resolved in this priority:\n - A manual `id` property from the column def\n - The accessor key from the column def\n - The header string from the column def\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n id: string\n /**\n * The parent column for this column. Will be undefined if this is a root column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs)\n */\n parent?: Column\n}\n\nexport function createColumn(\n table: Table,\n columnDef: ColumnDef,\n depth: number,\n parent?: Column\n): Column {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey\n ? typeof String.prototype.replaceAll === 'function'\n ? accessorKey.replaceAll('.', '_')\n : accessorKey.replace(/\\./g, '_')\n : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns')\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column]\n },\n getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns')\n ),\n }\n\n for (const feature of table._features) {\n feature.createColumn?.(column as Column, table)\n }\n\n // Yes, we have to convert table to unknown, because we know more than the compiler here.\n return column as Column\n}\n","import {\n RowData,\n Column,\n Header,\n HeaderGroup,\n Table,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nconst debug = 'debugHeaders'\n\nexport interface CoreHeaderGroup {\n depth: number\n headers: Header[]\n id: string\n}\n\nexport interface HeaderContext {\n /**\n * An instance of a column.\n */\n column: Column\n /**\n * An instance of a header.\n */\n header: Header\n /**\n * The table instance.\n */\n table: Table\n}\n\nexport interface CoreHeader {\n /**\n * The col-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n colSpan: number\n /**\n * The header's associated column object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n column: Column\n /**\n * The depth of the header, zero-indexed based.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n depth: number\n /**\n * Returns the rendering context (or props) for column-based components like headers, footers and filters.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getContext: () => HeaderContext\n /**\n * Returns the leaf headers hierarchically nested under this header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * The header's associated header group object.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n headerGroup: HeaderGroup\n /**\n * The unique identifier for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n id: string\n /**\n * The index for the header within the header group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n index: number\n /**\n * A boolean denoting if the header is a placeholder header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n isPlaceholder: boolean\n /**\n * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n placeholderId?: string\n /**\n * The row-span for the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n rowSpan: number\n /**\n * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n subHeaders: Header[]\n}\n\nexport interface HeadersInstance {\n /**\n * Returns all header groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterHeaderGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the header groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightHeaderGroups: () => HeaderGroup[]\n\n /**\n * Returns the footer groups for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the left pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for columns that are not pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFooterGroups: () => HeaderGroup[]\n /**\n * If pinning, returns the footer groups for the right pinned columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFooterGroups: () => HeaderGroup[]\n\n /**\n * Returns headers for all columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterFlatHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned columns in the table, including parent headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightFlatHeaders: () => Header[]\n\n /**\n * Returns headers for all leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getLeftLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all columns that are not pinned, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getCenterLeafHeaders: () => Header[]\n /**\n * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers)\n */\n getRightLeafHeaders: () => Header[]\n}\n\n//\n\nfunction createHeader(\n table: Table,\n column: Column,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header {\n const id = options.id ?? column.id\n\n let header: CoreHeader = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header[] => {\n const leafHeaders: Header[] = []\n\n const recurseHeader = (h: CoreHeader) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n feature.createHeader?.(header as Header, table)\n })\n\n return header as Header\n}\n\nexport const Headers: TableFeature = {\n createTable: (table: Table): void => {\n // Header Groups\n\n table.getHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n getMemoOptions(table.options, debug, 'getHeaderGroups')\n )\n\n table.getCenterHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n getMemoOptions(table.options, debug, 'getCenterHeaderGroups')\n )\n\n table.getLeftHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left')\n },\n getMemoOptions(table.options, debug, 'getLeftHeaderGroups')\n )\n\n table.getRightHeaderGroups = memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right')\n },\n getMemoOptions(table.options, debug, 'getRightHeaderGroups')\n )\n\n // Footer Groups\n\n table.getFooterGroups = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getFooterGroups')\n )\n\n table.getLeftFooterGroups = memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getLeftFooterGroups')\n )\n\n table.getCenterFooterGroups = memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getCenterFooterGroups')\n )\n\n table.getRightFooterGroups = memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n getMemoOptions(table.options, debug, 'getRightFooterGroups')\n )\n\n // Flat Headers\n\n table.getFlatHeaders = memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getFlatHeaders')\n )\n\n table.getLeftFlatHeaders = memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeftFlatHeaders')\n )\n\n table.getCenterFlatHeaders = memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getCenterFlatHeaders')\n )\n\n table.getRightFlatHeaders = memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getRightFlatHeaders')\n )\n\n // Leaf Headers\n\n table.getCenterLeafHeaders = memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getCenterLeafHeaders')\n )\n\n table.getLeftLeafHeaders = memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getLeftLeafHeaders')\n )\n\n table.getRightLeafHeaders = memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n getMemoOptions(table.options, debug, 'getRightLeafHeaders')\n )\n\n table.getLeafHeaders = memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n getMemoOptions(table.options, debug, 'getLeafHeaders')\n )\n },\n}\n\nexport function buildHeaderGroups(\n allColumns: Column[],\n columnsToGroup: Column[],\n table: Table,\n headerFamily?: 'center' | 'left' | 'right'\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (columns: Column[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Header[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader?.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup?.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter(d => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n","import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow {\n _getAllCellsByColumnId: () => Record>\n _uniqueValuesCache: Record\n _valuesCache: Record\n /**\n * The depth of the row (if nested or grouped) relative to the root row array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#depth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n depth: number\n /**\n * Returns all of the cells for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getallcells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getAllCells: () => Cell[]\n /**\n * Returns the leaf rows for the row, not including any parent rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getLeafRows: () => Row[]\n /**\n * Returns the parent row for the row, if it exists.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRow: () => Row | undefined\n /**\n * Returns the parent rows for the row, all the way up to a root row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getParentRows: () => Row[]\n /**\n * Returns a unique array of values from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getuniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getUniqueValues: (columnId: string) => TValue[]\n /**\n * Returns the value from the row for a given columnId.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n getValue: (columnId: string) => TValue\n /**\n * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#id)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n id: string\n /**\n * The index of the row within its parent array (or the root data array).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#index)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n index: number\n /**\n * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#original)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n original: TData\n /**\n * An array of the original subRows as returned by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#originalsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n originalSubRows?: TData[]\n /**\n * If nested, this row's parent row id.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#parentid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n parentId?: string\n /**\n * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#rendervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n renderValue: (columnId: string) => TValue\n /**\n * An array of subRows for the row as returned and created by the `options.getSubRows` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#subrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows)\n */\n subRows: Row[]\n}\n\nexport const createRow = (\n table: Table,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row[],\n parentId?: string\n): Row => {\n let row: CoreRow = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () =>\n row.parentId ? table.getRow(row.parentId, true) : undefined,\n getParentRows: () => {\n let parentRows: Row[] = []\n let currentRow = row\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n },\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row, column, column.id)\n })\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCells')\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce(\n (acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId')\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n feature?.createRow?.(row as Row, table)\n }\n\n return row as Row\n}\n","import { RowModel } from '..'\nimport { Column, RowData, Table, TableFeature } from '../types'\n\nexport interface FacetedColumn {\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n _getFacetedRowModel?: () => RowModel\n _getFacetedUniqueValues?: () => Map\n /**\n * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.\n * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedRowModel: () => RowModel\n /**\n * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedUniqueValues: () => Map\n}\n\nexport interface FacetedOptions {\n getFacetedMinMaxValues?: (\n table: Table,\n columnId: string\n ) => () => undefined | [number, number]\n getFacetedRowModel?: (\n table: Table,\n columnId: string\n ) => () => RowModel\n getFacetedUniqueValues?: (\n table: Table,\n columnId: string\n ) => () => Map\n}\n\n//\n\nexport const ColumnFaceting: TableFeature = {\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column._getFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, column.id)\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return column._getFacetedRowModel()\n }\n column._getFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, column.id)\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map()\n }\n\n return column._getFacetedUniqueValues()\n }\n column._getFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, column.id)\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined\n }\n\n return column._getFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn } from './features/ColumnFiltering'\n\nconst includesString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n const search = filterValue?.toString()?.toLowerCase()\n return Boolean(\n row\n .getValue(columnId)\n ?.toString()\n ?.toLowerCase()\n ?.includes(search)\n )\n}\n\nincludesString.autoRemove = (val: any) => testFalsey(val)\n\nconst includesStringSensitive: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return Boolean(\n row.getValue(columnId)?.toString()?.includes(filterValue)\n )\n}\n\nincludesStringSensitive.autoRemove = (val: any) => testFalsey(val)\n\nconst equalsString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return (\n row.getValue(columnId)?.toString()?.toLowerCase() ===\n filterValue?.toLowerCase()\n )\n}\n\nequalsString.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludes: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId)?.includes(filterValue)\n}\n\narrIncludes.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludesAll: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return !filterValue.some(\n val => !row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst arrIncludesSome: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return filterValue.some(val =>\n row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesSome.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst equals: FilterFn = (row, columnId: string, filterValue: unknown) => {\n return row.getValue(columnId) === filterValue\n}\n\nequals.autoRemove = (val: any) => testFalsey(val)\n\nconst weakEquals: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId) == filterValue\n}\n\nweakEquals.autoRemove = (val: any) => testFalsey(val)\n\nconst inNumberRange: FilterFn = (\n row,\n columnId: string,\n filterValue: [number, number]\n) => {\n let [min, max] = filterValue\n\n const rowValue = row.getValue(columnId)\n return rowValue >= min && rowValue <= max\n}\n\ninNumberRange.resolveFilterValue = (val: [any, any]) => {\n let [unsafeMin, unsafeMax] = val\n\n let parsedMin =\n typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin\n let parsedMax =\n typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax\n\n let min =\n unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax\n\n if (min > max) {\n const temp = min\n min = max\n max = temp\n }\n\n return [min, max] as const\n}\n\ninNumberRange.autoRemove = (val: any) =>\n testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]))\n\n// Export\n\nexport const filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange,\n}\n\nexport type BuiltInFilterFn = keyof typeof filterFns\n\n// Utils\n\nfunction testFalsey(val: any) {\n return val === undefined || val === null || val === ''\n}\n","import { RowModel } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n FilterFns,\n FilterMeta,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface ColumnFiltersTableState {\n columnFilters: ColumnFiltersState\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter {\n filterFn: FilterFn\n id: string\n resolvedValue: unknown\n}\n\nexport interface FilterFn {\n (\n row: Row,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n autoRemove?: ColumnFilterAutoRemoveTestFn\n resolveFilterValue?: TransformFilterValueFn\n}\n\nexport type TransformFilterValueFn = (\n value: any,\n column?: Column\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn = (\n value: any,\n column?: Column\n) => boolean\n\nexport type CustomFilterFns = Record<\n string,\n FilterFn\n>\n\nexport type FilterFnOption =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn\n\nexport interface ColumnFiltersColumnDef {\n /**\n * Enables/disables the **column** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilter?: boolean\n /**\n * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFn?: FilterFnOption\n}\n\nexport interface ColumnFiltersColumn {\n /**\n * Returns an automatically calculated filter function for the column based off of the columns first known value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns whether or not the column can be **column** filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getCanFilter: () => boolean\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterFn: () => FilterFn | undefined\n /**\n * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterIndex: () => number\n /**\n * Returns the current filter value for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterValue: () => unknown\n /**\n * Returns whether or not the column is currently filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getIsFiltered: () => boolean\n /**\n * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setFilterValue: (updater: Updater) => void\n}\n\nexport interface ColumnFiltersRow {\n /**\n * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFilters: Record\n /**\n * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFiltersMeta: Record\n}\n\ninterface ColumnFiltersOptionsBase {\n /**\n * Enables/disables **column** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilters?: boolean\n /**\n * Enables/disables all filtering for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableFilters?: boolean\n /**\n * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFromLeafRows?: boolean\n /**\n * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.\n * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.\n * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel?: (table: Table) => () => RowModel\n /**\n * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n manualFiltering?: boolean\n /**\n * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.\n\n * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n maxLeafRowFilterDepth?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n onColumnFiltersChange?: OnChangeFn\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record>\n }\n : {\n filterFns: Record>\n }\n\nexport interface ColumnFiltersOptions\n extends ColumnFiltersOptionsBase,\n ResolvedFilterFns {}\n\nexport interface ColumnFiltersInstance {\n _getFilteredRowModel?: () => RowModel\n /**\n * Returns the row model for the table after **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel: () => RowModel\n /**\n * Returns the row model for the table before any **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getPreFilteredRowModel: () => RowModel\n /**\n * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetColumnFilters: (defaultState?: boolean) => void\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnFilters` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setColumnFilters: (updater: Updater) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnFiltering: TableFeature = {\n getDefaultColumnDef: <\n TData extends RowData,\n >(): ColumnFiltersColumnDef => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): ColumnFiltersTableState => {\n return {\n columnFilters: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnFiltersOptions => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n } as ColumnFiltersOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return filterFns.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns.arrIncludes\n }\n\n return filterFns.weakEquals\n }\n column.getFilterFn = () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n : // @ts-ignore\n table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n }\n column.getCanFilter = () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getIsFiltered = () => column.getFilterIndex() > -1\n\n column.getFilterValue = () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value\n\n column.getFilterIndex = () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1\n\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\n const previousFilter = old?.find(d => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined\n )\n\n //\n if (\n shouldAutoRemoveFilter(filterFn as FilterFn, newFilter, column)\n ) {\n return old?.filter(d => d.id !== column.id) ?? []\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n }\n },\n\n createRow: (\n row: Row,\n _table: Table\n ): void => {\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n },\n\n createTable: (table: Table): void => {\n table.setColumnFilters = (updater: Updater) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n }\n\n table.resetColumnFilters = defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n }\n\n table.getPreFilteredRowModel = () => table.getCoreRowModel()\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n }\n },\n}\n\nexport function shouldAutoRemoveFilter(\n filterFn?: FilterFn,\n value?: any,\n column?: Column\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n","import { AggregationFn } from './features/ColumnGrouping'\nimport { isNumberArray } from './utils'\n\nconst sum: AggregationFn = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId)\n return sum + (typeof nextValue === 'number' ? nextValue : 0)\n }, 0)\n}\n\nconst min: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n\n if (\n value != null &&\n (min! > value || (min === undefined && value >= value))\n ) {\n min = value\n }\n })\n\n return min\n}\n\nconst max: AggregationFn = (columnId, _leafRows, childRows) => {\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (\n value != null &&\n (max! < value || (max === undefined && value >= value))\n ) {\n max = value\n }\n })\n\n return max\n}\n\nconst extent: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value\n } else {\n if (min > value) min = value\n if (max! < value) max = value\n }\n }\n })\n\n return [min, max]\n}\n\nconst mean: AggregationFn = (columnId, leafRows) => {\n let count = 0\n let sum = 0\n\n leafRows.forEach(row => {\n let value = row.getValue(columnId)\n if (value != null && (value = +value) >= value) {\n ++count, (sum += value)\n }\n })\n\n if (count) return sum / count\n\n return\n}\n\nconst median: AggregationFn = (columnId, leafRows) => {\n if (!leafRows.length) {\n return\n }\n\n const values = leafRows.map(row => row.getValue(columnId))\n if (!isNumberArray(values)) {\n return\n }\n if (values.length === 1) {\n return values[0]\n }\n\n const mid = Math.floor(values.length / 2)\n const nums = values.sort((a, b) => a - b)\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1]! + nums[mid]!) / 2\n}\n\nconst unique: AggregationFn = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values())\n}\n\nconst uniqueCount: AggregationFn = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size\n}\n\nconst count: AggregationFn = (_columnId, leafRows) => {\n return leafRows.length\n}\n\nexport const aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count,\n}\n\nexport type BuiltInAggregationFn = keyof typeof aggregationFns\n","import { RowModel } from '..'\nimport { BuiltInAggregationFn, aggregationFns } from '../aggregationFns'\nimport {\n AggregationFns,\n Cell,\n Column,\n ColumnDefTemplate,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type GroupingState = string[]\n\nexport interface GroupingTableState {\n grouping: GroupingState\n}\n\nexport type AggregationFn = (\n columnId: string,\n leafRows: Row[],\n childRows: Row[]\n) => any\n\nexport type CustomAggregationFns = Record>\n\nexport type AggregationFnOption =\n | 'auto'\n | keyof AggregationFns\n | BuiltInAggregationFn\n | AggregationFn\n\nexport interface GroupingColumnDef {\n /**\n * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregatedCell?: ColumnDefTemplate<\n ReturnType['getContext']>\n >\n /**\n * The resolved aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n aggregationFn?: AggregationFnOption\n /**\n * Enables/disables grouping for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue?: (row: TData) => any\n}\n\nexport interface GroupingColumn {\n /**\n * Returns the aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAggregationFn: () => AggregationFn | undefined\n /**\n * Returns the automatically inferred aggregation function for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getAutoAggregationFn: () => AggregationFn | undefined\n /**\n * Returns whether or not the column can be grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getCanGroup: () => boolean\n /**\n * Returns the index of the column in the grouping state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedIndex: () => number\n /**\n * Returns whether or not the column is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getToggleGroupingHandler: () => () => void\n /**\n * Toggles the grouping state of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n toggleGrouping: () => void\n}\n\nexport interface GroupingRow {\n _groupingValuesCache: Record\n /**\n * Returns the grouping value for any row and column (including leaf rows).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupingValue: (columnId: string) => unknown\n /**\n * Returns whether or not the row is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * If this row is grouped, this is the id of the column that this row is grouped by.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingColumnId?: string\n /**\n * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupingValue?: unknown\n}\n\nexport interface GroupingCell {\n /**\n * Returns whether or not the cell is currently aggregated.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsAggregated: () => boolean\n /**\n * Returns whether or not the cell is currently grouped.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsGrouped: () => boolean\n /**\n * Returns whether or not the cell is currently a placeholder cell.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getIsPlaceholder: () => boolean\n}\n\nexport interface ColumnDefaultOptions {\n enableGrouping: boolean\n onGroupingChange: OnChangeFn\n}\n\ninterface GroupingOptionsBase {\n /**\n * Enables/disables grouping for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n enableGrouping?: boolean\n /**\n * Returns the row model after grouping has taken place, but no further.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel?: (table: Table) => () => RowModel\n /**\n * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n groupedColumnMode?: false | 'reorder' | 'remove'\n /**\n * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n manualGrouping?: boolean\n /**\n * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n onGroupingChange?: OnChangeFn\n}\n\ntype ResolvedAggregationFns = keyof AggregationFns extends never\n ? {\n aggregationFns?: Record>\n }\n : {\n aggregationFns: Record>\n }\n\nexport interface GroupingOptions\n extends GroupingOptionsBase,\n ResolvedAggregationFns {}\n\nexport type GroupingColumnMode = false | 'reorder' | 'remove'\n\nexport interface GroupingInstance {\n _getGroupedRowModel?: () => RowModel\n /**\n * Returns the row model for the table after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getGroupedRowModel: () => RowModel\n /**\n * Returns the row model for the table before any grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n getPreGroupedRowModel: () => RowModel\n /**\n * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n resetGrouping: (defaultState?: boolean) => void\n /**\n * Updates the grouping state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)\n */\n setGrouping: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnGrouping: TableFeature = {\n getDefaultColumnDef: (): GroupingColumnDef<\n TData,\n unknown\n > => {\n return {\n aggregatedCell: props => (props.getValue() as any)?.toString?.() ?? null,\n aggregationFn: 'auto',\n }\n },\n\n getInitialState: (state): GroupingTableState => {\n return {\n grouping: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GroupingOptions => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder',\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleGrouping = () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old?.includes(column.id)) {\n return old.filter(d => d !== column.id)\n }\n\n return [...(old ?? []), column.id]\n })\n }\n\n column.getCanGroup = () => {\n return (\n (column.columnDef.enableGrouping ?? true) &&\n (table.options.enableGrouping ?? true) &&\n (!!column.accessorFn || !!column.columnDef.getGroupingValue)\n )\n }\n\n column.getIsGrouped = () => {\n return table.getState().grouping?.includes(column.id)\n }\n\n column.getGroupedIndex = () => table.getState().grouping?.indexOf(column.id)\n\n column.getToggleGroupingHandler = () => {\n const canGroup = column.getCanGroup()\n\n return () => {\n if (!canGroup) return\n column.toggleGrouping()\n }\n }\n column.getAutoAggregationFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent\n }\n }\n column.getAggregationFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column.getAutoAggregationFn()\n : table.options.aggregationFns?.[\n column.columnDef.aggregationFn as string\n ] ??\n aggregationFns[\n column.columnDef.aggregationFn as BuiltInAggregationFn\n ]\n }\n },\n\n createTable: (table: Table): void => {\n table.setGrouping = updater => table.options.onGroupingChange?.(updater)\n\n table.resetGrouping = defaultState => {\n table.setGrouping(defaultState ? [] : table.initialState?.grouping ?? [])\n }\n\n table.getPreGroupedRowModel = () => table.getFilteredRowModel()\n table.getGroupedRowModel = () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table)\n }\n\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._getGroupedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getIsGrouped = () => !!row.groupingColumnId\n row.getGroupingValue = columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original\n )\n\n return row._groupingValuesCache[columnId]\n }\n row._groupingValuesCache = {}\n },\n\n createCell: (\n cell: Cell,\n column: Column,\n row: Row,\n table: Table\n ): void => {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n cell.getIsGrouped = () =>\n column.getIsGrouped() && column.id === row.groupingColumnId\n cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped()\n cell.getIsAggregated = () =>\n !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length\n },\n}\n\nexport function orderColumns(\n leafColumns: Column[],\n grouping: string[],\n groupedColumnMode?: GroupingColumnMode\n) {\n if (!grouping?.length || !groupedColumnMode) {\n return leafColumns\n }\n\n const nonGroupingColumns = leafColumns.filter(\n col => !grouping.includes(col.id)\n )\n\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns\n }\n\n const groupingColumns = grouping\n .map(g => leafColumns.find(col => col.id === g)!)\n .filter(Boolean)\n\n return [...groupingColumns, ...nonGroupingColumns]\n}\n","import { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nimport {\n Column,\n OnChangeFn,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\n\nimport { orderColumns } from './ColumnGrouping'\nimport { ColumnPinningPosition, _getVisibleLeafColumns } from '..'\n\nexport interface ColumnOrderTableState {\n columnOrder: ColumnOrderState\n}\n\nexport type ColumnOrderState = string[]\n\nexport interface ColumnOrderOptions {\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n onColumnOrderChange?: OnChangeFn\n}\n\nexport interface ColumnOrderColumn {\n /**\n * Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIndex: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns `true` if the column is the first column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the first in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getisfirstcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsFirstColumn: (position?: ColumnPinningPosition | 'center') => boolean\n /**\n * Returns `true` if the column is the last column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the last in a sub-section of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getislastcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n getIsLastColumn: (position?: ColumnPinningPosition | 'center') => boolean\n}\n\nexport interface ColumnOrderDefaultOptions {\n onColumnOrderChange: OnChangeFn\n}\n\nexport interface ColumnOrderInstance {\n _getOrderColumnsFn: () => (\n columns: Column[]\n ) => Column[]\n /**\n * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n resetColumnOrder: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnOrder` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)\n */\n setColumnOrder: (updater: Updater) => void\n}\n\n//\n\nexport const ColumnOrdering: TableFeature = {\n getInitialState: (state): ColumnOrderTableState => {\n return {\n columnOrder: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnOrderDefaultOptions => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getIndex = memo(\n position => [_getVisibleLeafColumns(table, position)],\n columns => columns.findIndex(d => d.id === column.id),\n getMemoOptions(table.options, 'debugColumns', 'getIndex')\n )\n column.getIsFirstColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[0]?.id === column.id\n }\n column.getIsLastColumn = position => {\n const columns = _getVisibleLeafColumns(table, position)\n return columns[columns.length - 1]?.id === column.id\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnOrder = updater =>\n table.options.onColumnOrderChange?.(updater)\n table.resetColumnOrder = defaultState => {\n table.setColumnOrder(\n defaultState ? [] : table.initialState.columnOrder ?? []\n )\n }\n table._getOrderColumnsFn = memo(\n () => [\n table.getState().columnOrder,\n table.getState().grouping,\n table.options.groupedColumnMode,\n ],\n (columnOrder, grouping, groupedColumnMode) =>\n (columns: Column[]) => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns: Column[] = []\n\n // If there is no order, return the normal columns\n if (!columnOrder?.length) {\n orderedColumns = columns\n } else {\n const columnOrderCopy = [...columnOrder]\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns]\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift()\n const foundIndex = columnsCopy.findIndex(\n d => d.id === targetColumnId\n )\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy]\n }\n\n return orderColumns(orderedColumns, grouping, groupedColumnMode)\n },\n getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn')\n )\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Column,\n Row,\n Cell,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type ColumnPinningPosition = false | 'left' | 'right'\n\nexport interface ColumnPinningState {\n left?: string[]\n right?: string[]\n}\n\nexport interface ColumnPinningTableState {\n columnPinning: ColumnPinningState\n}\n\nexport interface ColumnPinningOptions {\n /**\n * Enables/disables column pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enableColumnPinning?: boolean\n /**\n * @deprecated Use `enableColumnPinning` or `enableRowPinning` instead.\n * Enables/disables all pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange)\n */\n onColumnPinningChange?: OnChangeFn\n}\n\nexport interface ColumnPinningDefaultOptions {\n onColumnPinningChange: OnChangeFn\n}\n\nexport interface ColumnPinningColumnDef {\n /**\n * Enables/disables column pinning for this column. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n enablePinning?: boolean\n}\n\nexport interface ColumnPinningColumn {\n /**\n * Returns whether or not the column can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcanpin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the column. (`'left'`, `'right'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getispinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsPinned: () => ColumnPinningPosition\n /**\n * Returns the numeric pinned index of the column within a pinned column group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getpinnedindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a column to the `'left'` or `'right'`, or unpins the column to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#pin)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n pin: (position: ColumnPinningPosition) => void\n}\n\nexport interface ColumnPinningRow {\n /**\n * Returns all center pinned (unpinned) leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcentervisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterVisibleCells: () => Cell[]\n /**\n * Returns all left pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftVisibleCells: () => Cell[]\n /**\n * Returns all right pinned leaf cells in the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightVisibleCells: () => Cell[]\n}\n\nexport interface ColumnPinningInstance {\n /**\n * Returns all center pinned (unpinned) leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcenterleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getCenterLeafColumns: () => Column[]\n /**\n * Returns whether or not any columns are pinned. Optionally specify to only check for pinned columns in either the `left` or `right` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getissomecolumnspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean\n /**\n * Returns all left pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getLeftLeafColumns: () => Column[]\n /**\n * Returns all right pinned leaf columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n getRightLeafColumns: () => Column[]\n /**\n * Resets the **columnPinning** state to `initialState.columnPinning`, or `true` can be passed to force a default blank state reset to `{ left: [], right: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#resetcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n resetColumnPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#setcolumnpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)\n */\n setColumnPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultColumnPinningState = (): ColumnPinningState => ({\n left: [],\n right: [],\n})\n\nexport const ColumnPinning: TableFeature = {\n getInitialState: (state): ColumnPinningTableState => {\n return {\n columnPinning: getDefaultColumnPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnPinningDefaultOptions => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.pin = position => {\n const columnIds = column\n .getLeafColumns()\n .map(d => d.id)\n .filter(Boolean) as string[]\n\n table.setColumnPinning(old => {\n if (position === 'right') {\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: [\n ...(old?.right ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n }\n }\n\n if (position === 'left') {\n return {\n left: [\n ...(old?.left ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n }\n\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n })\n }\n\n column.getCanPin = () => {\n const leafColumns = column.getLeafColumns()\n\n return leafColumns.some(\n d =>\n (d.columnDef.enablePinning ?? true) &&\n (table.options.enableColumnPinning ??\n table.options.enablePinning ??\n true)\n )\n }\n\n column.getIsPinned = () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id)\n\n const { left, right } = table.getState().columnPinning\n\n const isLeft = leafColumnIds.some(d => left?.includes(d))\n const isRight = leafColumnIds.some(d => right?.includes(d))\n\n return isLeft ? 'left' : isRight ? 'right' : false\n }\n\n column.getPinnedIndex = () => {\n const position = column.getIsPinned()\n\n return position\n ? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1\n : 0\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.getCenterVisibleCells = memo(\n () => [\n row._getAllVisibleCells(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allCells, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allCells.filter(d => !leftAndRight.includes(d.column.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells')\n )\n row.getLeftVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.left],\n (allCells, left) => {\n const cells = (left ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'left' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells')\n )\n row.getRightVisibleCells = memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.right],\n (allCells, right) => {\n const cells = (right ?? [])\n .map(columnId => allCells.find(cell => cell.column.id === columnId)!)\n .filter(Boolean)\n .map(d => ({ ...d, position: 'right' }) as Cell)\n\n return cells\n },\n getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n table.setColumnPinning = updater =>\n table.options.onColumnPinningChange?.(updater)\n\n table.resetColumnPinning = defaultState =>\n table.setColumnPinning(\n defaultState\n ? getDefaultColumnPinningState()\n : table.initialState?.columnPinning ?? getDefaultColumnPinningState()\n )\n\n table.getIsSomeColumnsPinned = position => {\n const pinningState = table.getState().columnPinning\n\n if (!position) {\n return Boolean(pinningState.left?.length || pinningState.right?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table.getLeftLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.left],\n (allColumns, left) => {\n return (left ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns')\n )\n\n table.getRightLeafColumns = memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.right],\n (allColumns, right) => {\n return (right ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns')\n )\n\n table.getCenterLeafColumns = memo(\n () => [\n table.getAllLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allColumns.filter(d => !leftAndRight.includes(d.id))\n },\n getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns')\n )\n },\n}\n","import { _getVisibleLeafColumns } from '..'\nimport {\n RowData,\n Column,\n Header,\n OnChangeFn,\n Table,\n Updater,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\nimport { ColumnPinningPosition } from './ColumnPinning'\nimport { safelyAccessDocument } from '../utils/document'\n\n//\n\nexport interface ColumnSizingTableState {\n columnSizing: ColumnSizingState\n columnSizingInfo: ColumnSizingInfoState\n}\n\nexport type ColumnSizingState = Record\n\nexport interface ColumnSizingInfoState {\n columnSizingStart: [string, number][]\n deltaOffset: null | number\n deltaPercentage: null | number\n isResizingColumn: false | string\n startOffset: null | number\n startSize: null | number\n}\n\nexport type ColumnResizeMode = 'onChange' | 'onEnd'\n\nexport type ColumnResizeDirection = 'ltr' | 'rtl'\n\nexport interface ColumnSizingOptions {\n /**\n * Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnresizemode)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeMode?: ColumnResizeMode\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enablecolumnresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableColumnResizing?: boolean\n /**\n * Enables or disables right-to-left support for resizing the column. defaults to 'ltr'.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnResizeDirection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n columnResizeDirection?: ColumnResizeDirection\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingChange?: OnChangeFn\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnSizingInfo` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizingInfo` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizinginfochange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n onColumnSizingInfoChange?: OnChangeFn\n}\n\nexport type ColumnSizingDefaultOptions = Pick<\n ColumnSizingOptions,\n | 'columnResizeMode'\n | 'onColumnSizingChange'\n | 'onColumnSizingInfoChange'\n | 'columnResizeDirection'\n>\n\nexport interface ColumnSizingInstance {\n /**\n * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcentertotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCenterTotalSize: () => number\n /**\n * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getlefttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getLeftTotalSize: () => number\n /**\n * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getrighttotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getRightTotalSize: () => number\n /**\n * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#gettotalsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getTotalSize: () => number\n /**\n * Resets column sizing to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetColumnSizing: (defaultState?: boolean) => void\n /**\n * Resets column sizing info to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetheadersizeinfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetHeaderSizeInfo: (defaultState?: boolean) => void\n /**\n * Sets the column sizing state using an updater function or a value. This will trigger the underlying `onColumnSizingChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizing: (updater: Updater) => void\n /**\n * Sets the column sizing info state using an updater function or a value. This will trigger the underlying `onColumnSizingInfoChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizinginfo)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n setColumnSizingInfo: (updater: Updater) => void\n}\n\nexport interface ColumnSizingColumnDef {\n /**\n * Enables or disables column resizing for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n enableResizing?: boolean\n /**\n * The maximum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n maxSize?: number\n /**\n * The minimum allowed size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n minSize?: number\n /**\n * The desired size for the column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n size?: number\n}\n\nexport interface ColumnSizingColumn {\n /**\n * Returns `true` if the column can be resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcanresize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getCanResize: () => boolean\n /**\n * Returns `true` if the column is currently being resized.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getisresizing)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getIsResizing: () => boolean\n /**\n * Returns the current size of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column.\n */\n getAfter: (position?: ColumnPinningPosition | 'center') => number\n /**\n * Resets the column to its initial size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n resetSize: () => void\n}\n\nexport interface ColumnSizingHeader {\n /**\n * Returns an event handler function that can be used to resize the header. It can be used as an:\n * - `onMouseDown` handler\n * - `onTouchStart` handler\n *\n * The dragging and release events are automatically handled for you.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getresizehandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getResizeHandler: (context?: Document) => (event: unknown) => void\n /**\n * Returns the current size of the header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getSize: () => number\n /**\n * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding headers.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)\n */\n getStart: (position?: ColumnPinningPosition) => number\n}\n\n//\n\nexport const defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n}\n\nconst getDefaultColumnSizingInfoState = (): ColumnSizingInfoState => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: [],\n})\n\nexport const ColumnSizing: TableFeature = {\n getDefaultColumnDef: (): ColumnSizingColumnDef => {\n return defaultColumnSizing\n },\n getInitialState: (state): ColumnSizingTableState => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnSizingDefaultOptions => {\n return {\n columnResizeMode: 'onEnd',\n columnResizeDirection: 'ltr',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getSize = () => {\n const columnSize = table.getState().columnSizing[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultColumnSizing.minSize,\n columnSize ?? column.columnDef.size ?? defaultColumnSizing.size\n ),\n column.columnDef.maxSize ?? defaultColumnSizing.maxSize\n )\n }\n\n column.getStart = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(0, column.getIndex(position))\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getStart')\n )\n\n column.getAfter = memo(\n position => [\n position,\n _getVisibleLeafColumns(table, position),\n table.getState().columnSizing,\n ],\n (position, columns) =>\n columns\n .slice(column.getIndex(position) + 1)\n .reduce((sum, column) => sum + column.getSize(), 0),\n getMemoOptions(table.options, 'debugColumns', 'getAfter')\n )\n\n column.resetSize = () => {\n table.setColumnSizing(({ [column.id]: _, ...rest }) => {\n return rest\n })\n }\n column.getCanResize = () => {\n return (\n (column.columnDef.enableResizing ?? true) &&\n (table.options.enableColumnResizing ?? true)\n )\n }\n column.getIsResizing = () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id\n }\n },\n\n createHeader: (\n header: Header,\n table: Table\n ): void => {\n header.getSize = () => {\n let sum = 0\n\n const recurse = (header: Header) => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse)\n } else {\n sum += header.column.getSize() ?? 0\n }\n }\n\n recurse(header)\n\n return sum\n }\n header.getStart = () => {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup.headers[header.index - 1]!\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()\n }\n\n return 0\n }\n header.getResizeHandler = _contextDocument => {\n const column = table.getColumn(header.column.id)\n const canResize = column?.getCanResize()\n\n return (e: unknown) => {\n if (!column || !canResize) {\n return\n }\n\n ;(e as any).persist?.()\n\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return\n }\n }\n\n const startSize = header.getSize()\n\n const columnSizingStart: [string, number][] = header\n ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()])\n : [[column.id, column.getSize()]]\n\n const clientX = isTouchStartEvent(e)\n ? Math.round(e.touches[0]!.clientX)\n : (e as MouseEvent).clientX\n\n const newColumnSizing: ColumnSizingState = {}\n\n const updateOffset = (\n eventType: 'move' | 'end',\n clientXPos?: number\n ) => {\n if (typeof clientXPos !== 'number') {\n return\n }\n\n table.setColumnSizingInfo(old => {\n const deltaDirection =\n table.options.columnResizeDirection === 'rtl' ? -1 : 1\n const deltaOffset =\n (clientXPos - (old?.startOffset ?? 0)) * deltaDirection\n const deltaPercentage = Math.max(\n deltaOffset / (old?.startSize ?? 0),\n -0.999999\n )\n\n old.columnSizingStart.forEach(([columnId, headerSize]) => {\n newColumnSizing[columnId] =\n Math.round(\n Math.max(headerSize + headerSize * deltaPercentage, 0) * 100\n ) / 100\n })\n\n return {\n ...old,\n deltaOffset,\n deltaPercentage,\n }\n })\n\n if (\n table.options.columnResizeMode === 'onChange' ||\n eventType === 'end'\n ) {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing,\n }))\n }\n }\n\n const onMove = (clientXPos?: number) => updateOffset('move', clientXPos)\n\n const onEnd = (clientXPos?: number) => {\n updateOffset('end', clientXPos)\n\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: [],\n }))\n }\n\n const contextDocument = safelyAccessDocument(_contextDocument)\n\n const mouseEvents = {\n moveHandler: (e: MouseEvent) => onMove(e.clientX),\n upHandler: (e: MouseEvent) => {\n contextDocument?.removeEventListener(\n 'mousemove',\n mouseEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'mouseup',\n mouseEvents.upHandler\n )\n onEnd(e.clientX)\n },\n }\n\n const touchEvents = {\n moveHandler: (e: TouchEvent) => {\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onMove(e.touches[0]!.clientX)\n return false\n },\n upHandler: (e: TouchEvent) => {\n contextDocument?.removeEventListener(\n 'touchmove',\n touchEvents.moveHandler\n )\n contextDocument?.removeEventListener(\n 'touchend',\n touchEvents.upHandler\n )\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onEnd(e.touches[0]?.clientX)\n },\n }\n\n const passiveIfSupported = passiveEventSupported()\n ? { passive: false }\n : false\n\n if (isTouchStartEvent(e)) {\n contextDocument?.addEventListener(\n 'touchmove',\n touchEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'touchend',\n touchEvents.upHandler,\n passiveIfSupported\n )\n } else {\n contextDocument?.addEventListener(\n 'mousemove',\n mouseEvents.moveHandler,\n passiveIfSupported\n )\n contextDocument?.addEventListener(\n 'mouseup',\n mouseEvents.upHandler,\n passiveIfSupported\n )\n }\n\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id,\n }))\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setColumnSizing = updater =>\n table.options.onColumnSizingChange?.(updater)\n table.setColumnSizingInfo = updater =>\n table.options.onColumnSizingInfoChange?.(updater)\n table.resetColumnSizing = defaultState => {\n table.setColumnSizing(\n defaultState ? {} : table.initialState.columnSizing ?? {}\n )\n }\n table.resetHeaderSizeInfo = defaultState => {\n table.setColumnSizingInfo(\n defaultState\n ? getDefaultColumnSizingInfoState()\n : table.initialState.columnSizingInfo ??\n getDefaultColumnSizingInfoState()\n )\n }\n table.getTotalSize = () =>\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getLeftTotalSize = () =>\n table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getCenterTotalSize = () =>\n table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n table.getRightTotalSize = () =>\n table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0\n },\n}\n\nlet passiveSupported: boolean | null = null\nexport function passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported\n\n let supported = false\n try {\n const options = {\n get passive() {\n supported = true\n return false\n },\n }\n\n const noop = () => {}\n\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop)\n } catch (err) {\n supported = false\n }\n passiveSupported = supported\n return passiveSupported\n}\n\nfunction isTouchStartEvent(e: unknown): e is TouchEvent {\n return (e as TouchEvent).type === 'touchstart'\n}\n","export function safelyAccessDocument(_document?: Document): Document | null {\n return _document || (typeof document !== 'undefined' ? document : null)\n}\n\nexport function safelyAccessDocumentEvent(event: Event): Document | null {\n return !!event &&\n !!event.target &&\n typeof event.target === 'object' &&\n 'ownerDocument' in event.target\n ? (event.target.ownerDocument as Document | null)\n : null\n}\n","import { ColumnPinningPosition } from '..'\nimport {\n Cell,\n Column,\n OnChangeFn,\n Table,\n Updater,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type VisibilityState = Record\n\nexport interface VisibilityTableState {\n columnVisibility: VisibilityState\n}\n\nexport interface VisibilityOptions {\n /**\n * Whether to enable column hiding. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#enablehiding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n enableHiding?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n onColumnVisibilityChange?: OnChangeFn\n}\n\nexport type VisibilityDefaultOptions = Pick<\n VisibilityOptions,\n 'onColumnVisibilityChange'\n>\n\nexport interface VisibilityInstance {\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCenterVisibleLeafColumns: () => Column[]\n /**\n * Returns whether all columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsAllColumnsVisible: () => boolean\n /**\n * Returns whether any columns are visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsSomeColumnsVisible: () => boolean\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getLeftVisibleLeafColumns: () => Column[]\n /**\n * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getRightVisibleLeafColumns: () => Column[]\n /**\n * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void\n /**\n * Returns a flat array of columns that are visible, including parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleFlatColumns: () => Column[]\n /**\n * Returns a flat array of leaf-node columns that are visible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleLeafColumns: () => Column[]\n /**\n * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n resetColumnVisibility: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnVisibility` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n setColumnVisibility: (updater: Updater) => void\n /**\n * Toggles the visibility of all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleAllColumnsVisible: (value?: boolean) => void\n}\n\nexport interface VisibilityColumnDef {\n enableHiding?: boolean\n}\n\nexport interface VisibilityRow {\n _getAllVisibleCells: () => Cell[]\n /**\n * Returns an array of cells that account for column visibility for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getVisibleCells: () => Cell[]\n}\n\nexport interface VisibilityColumn {\n /**\n * Returns whether the column can be hidden\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getCanHide: () => boolean\n /**\n * Returns whether the column is visible\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getIsVisible: () => boolean\n /**\n * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n getToggleVisibilityHandler: () => (event: unknown) => void\n /**\n * Toggles the visibility of the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)\n */\n toggleVisibility: (value?: boolean) => void\n}\n\n//\n\nexport const ColumnVisibility: TableFeature = {\n getInitialState: (state): VisibilityTableState => {\n return {\n columnVisibility: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): VisibilityDefaultOptions => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.toggleVisibility = value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value ?? !column.getIsVisible(),\n }))\n }\n }\n column.getIsVisible = () => {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some(c => c.getIsVisible())\n : table.getState().columnVisibility?.[column.id]) ?? true\n )\n }\n\n column.getCanHide = () => {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (table.options.enableHiding ?? true)\n )\n }\n column.getToggleVisibilityHandler = () => {\n return (e: unknown) => {\n column.toggleVisibility?.(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row._getAllVisibleCells = memo(\n () => [row.getAllCells(), table.getState().columnVisibility],\n cells => {\n return cells.filter(cell => cell.column.getIsVisible())\n },\n getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells')\n )\n row.getVisibleCells = memo(\n () => [\n row.getLeftVisibleCells(),\n row.getCenterVisibleCells(),\n row.getRightVisibleCells(),\n ],\n (left, center, right) => [...left, ...center, ...right],\n getMemoOptions(table.options, 'debugRows', 'getVisibleCells')\n )\n },\n\n createTable: (table: Table): void => {\n const makeVisibleColumnsMethod = (\n key: string,\n getColumns: () => Column[]\n ): (() => Column[]) => {\n return memo(\n () => [\n getColumns(),\n getColumns()\n .filter(d => d.getIsVisible())\n .map(d => d.id)\n .join('_'),\n ],\n columns => {\n return columns.filter(d => d.getIsVisible?.())\n },\n getMemoOptions(table.options, 'debugColumns', key)\n )\n }\n\n table.getVisibleFlatColumns = makeVisibleColumnsMethod(\n 'getVisibleFlatColumns',\n () => table.getAllFlatColumns()\n )\n table.getVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getVisibleLeafColumns',\n () => table.getAllLeafColumns()\n )\n table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getLeftVisibleLeafColumns',\n () => table.getLeftLeafColumns()\n )\n table.getRightVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getRightVisibleLeafColumns',\n () => table.getRightLeafColumns()\n )\n table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod(\n 'getCenterVisibleLeafColumns',\n () => table.getCenterLeafColumns()\n )\n\n table.setColumnVisibility = updater =>\n table.options.onColumnVisibilityChange?.(updater)\n\n table.resetColumnVisibility = defaultState => {\n table.setColumnVisibility(\n defaultState ? {} : table.initialState.columnVisibility ?? {}\n )\n }\n\n table.toggleAllColumnsVisible = value => {\n value = value ?? !table.getIsAllColumnsVisible()\n\n table.setColumnVisibility(\n table.getAllLeafColumns().reduce(\n (obj, column) => ({\n ...obj,\n [column.id]: !value ? !column.getCanHide?.() : value,\n }),\n {}\n )\n )\n }\n\n table.getIsAllColumnsVisible = () =>\n !table.getAllLeafColumns().some(column => !column.getIsVisible?.())\n\n table.getIsSomeColumnsVisible = () =>\n table.getAllLeafColumns().some(column => column.getIsVisible?.())\n\n table.getToggleAllColumnsVisibilityHandler = () => {\n return (e: unknown) => {\n table.toggleAllColumnsVisible(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nexport function _getVisibleLeafColumns(\n table: Table,\n position?: ColumnPinningPosition | 'center'\n) {\n return !position\n ? table.getVisibleLeafColumns()\n : position === 'center'\n ? table.getCenterVisibleLeafColumns()\n : position === 'left'\n ? table.getLeftVisibleLeafColumns()\n : table.getRightVisibleLeafColumns()\n}\n","import { RowModel } from '..'\nimport { Table, RowData, TableFeature } from '../types'\n\nexport interface GlobalFacetingInstance {\n _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]\n _getGlobalFacetedRowModel?: () => RowModel\n _getGlobalFacetedUniqueValues?: () => Map\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model for the table after **global** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedRowModel: () => RowModel\n /**\n * Returns the faceted unique values for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting)\n */\n getGlobalFacetedUniqueValues: () => Map\n}\n\n//\n\nexport const GlobalFaceting: TableFeature = {\n createTable: (table: Table): void => {\n table._getGlobalFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, '__global__')\n\n table.getGlobalFacetedRowModel = () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getGlobalFacetedRowModel()\n }\n\n table._getGlobalFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, '__global__')\n table.getGlobalFacetedUniqueValues = () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map()\n }\n\n return table._getGlobalFacetedUniqueValues()\n }\n\n table._getGlobalFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, '__global__')\n table.getGlobalFacetedMinMaxValues = () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return\n }\n\n return table._getGlobalFacetedMinMaxValues()\n }\n },\n}\n","import { FilterFn, FilterFnOption } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n OnChangeFn,\n Table,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport interface GlobalFilterTableState {\n globalFilter: any\n}\n\nexport interface GlobalFilterColumnDef {\n /**\n * Enables/disables the **global** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n}\n\nexport interface GlobalFilterColumn {\n /**\n * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getCanGlobalFilter: () => boolean\n}\n\nexport interface GlobalFilterOptions {\n /**\n * Enables/disables **global** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n enableGlobalFilter?: boolean\n /**\n * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering.\n *\n * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcolumncanglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getColumnCanGlobalFilter?: (column: Column) => boolean\n /**\n * The filter function to use for global filtering.\n * - A `string` referencing a built-in filter function\n * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option\n * - A custom filter function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#globalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n globalFilterFn?: FilterFnOption\n /**\n * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#onglobalfilterchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n onGlobalFilterChange?: OnChangeFn\n}\n\nexport interface GlobalFilterInstance {\n /**\n * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalAutoFilterFn: () => FilterFn | undefined\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n getGlobalFilterFn: () => FilterFn | undefined\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)\n */\n setGlobalFilter: (updater: Updater) => void\n}\n\n//\n\nexport const GlobalFiltering: TableFeature = {\n getInitialState: (state): GlobalFilterTableState => {\n return {\n globalFilter: undefined,\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GlobalFilterOptions => {\n return {\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n const value = table\n .getCoreRowModel()\n .flatRows[0]?._getAllCellsByColumnId()\n [column.id]?.getValue()\n\n return typeof value === 'string' || typeof value === 'number'\n },\n } as GlobalFilterOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getCanGlobalFilter = () => {\n return (\n (column.columnDef.enableGlobalFilter ?? true) &&\n (table.options.enableGlobalFilter ?? true) &&\n (table.options.enableFilters ?? true) &&\n (table.options.getColumnCanGlobalFilter?.(column) ?? true) &&\n !!column.accessorFn\n )\n }\n },\n\n createTable: (table: Table): void => {\n table.getGlobalAutoFilterFn = () => {\n return filterFns.includesString\n }\n\n table.getGlobalFilterFn = () => {\n const { globalFilterFn: globalFilterFn } = table.options\n\n return isFunction(globalFilterFn)\n ? globalFilterFn\n : globalFilterFn === 'auto'\n ? table.getGlobalAutoFilterFn()\n : table.options.filterFns?.[globalFilterFn as string] ??\n filterFns[globalFilterFn as BuiltInFilterFn]\n }\n\n table.setGlobalFilter = updater => {\n table.options.onGlobalFilterChange?.(updater)\n }\n\n table.resetGlobalFilter = defaultState => {\n table.setGlobalFilter(\n defaultState ? undefined : table.initialState.globalFilter\n )\n }\n },\n}\n","import { RowModel } from '..'\nimport {\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { makeStateUpdater } from '../utils'\n\nexport type ExpandedStateList = Record\nexport type ExpandedState = true | Record\nexport interface ExpandedTableState {\n expanded: ExpandedState\n}\n\nexport interface ExpandedRow {\n /**\n * Returns whether the row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanExpand: () => boolean\n /**\n * Returns whether all parent rows of the row are expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallparentsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllParentsExpanded: () => boolean\n /**\n * Returns whether the row is expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsExpanded: () => boolean\n /**\n * Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleExpandedHandler: () => () => void\n /**\n * Toggles the expanded state (or sets it if `expanded` is provided) for the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleExpanded: (expanded?: boolean) => void\n}\n\nexport interface ExpandedOptions {\n /**\n * Enable this setting to automatically reset the expanded state of the table when expanding state changes.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#autoresetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n autoResetExpanded?: boolean\n /**\n * Enable/disable expanding for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#enableexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n enableExpanding?: boolean\n /**\n * This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported `getExpandedRowModel` function to get the expanded row model or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel?: (table: Table) => () => RowModel\n /**\n * If provided, allows you to override the default behavior of determining whether a row is currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisrowexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsRowExpanded?: (row: Row) => boolean\n /**\n * If provided, allows you to override the default behavior of determining whether a row can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getrowcanexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getRowCanExpand?: (row: Row) => boolean\n /**\n * Enables manual row expansion. If this is set to `true`, `getExpandedRowModel` will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#manualexpanding)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n manualExpanding?: boolean\n /**\n * This function is called when the `expanded` table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the `tableOptions.state.expanded` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#onexpandedchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n onExpandedChange?: OnChangeFn\n /**\n * If `true` expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages). If `false` expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#paginateexpandedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n paginateExpandedRows?: boolean\n}\n\nexport interface ExpandedInstance {\n _autoResetExpanded: () => void\n _getExpandedRowModel?: () => RowModel\n /**\n * Returns whether there are any rows that can be expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcansomerowsexpand)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getCanSomeRowsExpand: () => boolean\n /**\n * Returns the maximum depth of the expanded rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandeddepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedDepth: () => number\n /**\n * Returns the row model after expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getExpandedRowModel: () => RowModel\n /**\n * Returns whether all rows are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsAllRowsExpanded: () => boolean\n /**\n * Returns whether there are any rows that are currently expanded.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getissomerowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getIsSomeRowsExpanded: () => boolean\n /**\n * Returns the row model before expansion has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getpreexpandedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getPreExpandedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an `input[type=checkbox]` element.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleallrowsexpandedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n getToggleAllRowsExpandedHandler: () => (event: unknown) => void\n /**\n * Resets the expanded state of the table to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#resetexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n resetExpanded: (defaultState?: boolean) => void\n /**\n * Updates the expanded state of the table via an update function or value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#setexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n setExpanded: (updater: Updater) => void\n /**\n * Toggles the expanded state for all rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleallrowsexpanded)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)\n */\n toggleAllRowsExpanded: (expanded?: boolean) => void\n}\n\n//\n\nexport const RowExpanding: TableFeature = {\n getInitialState: (state): ExpandedTableState => {\n return {\n expanded: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ExpandedOptions => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true,\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetExpanded = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetExpanded ??\n !table.options.manualExpanding\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetExpanded()\n queued = false\n })\n }\n }\n table.setExpanded = updater => table.options.onExpandedChange?.(updater)\n table.toggleAllRowsExpanded = expanded => {\n if (expanded ?? !table.getIsAllRowsExpanded()) {\n table.setExpanded(true)\n } else {\n table.setExpanded({})\n }\n }\n table.resetExpanded = defaultState => {\n table.setExpanded(defaultState ? {} : table.initialState?.expanded ?? {})\n }\n table.getCanSomeRowsExpand = () => {\n return table\n .getPrePaginationRowModel()\n .flatRows.some(row => row.getCanExpand())\n }\n table.getToggleAllRowsExpandedHandler = () => {\n return (e: unknown) => {\n ;(e as any).persist?.()\n table.toggleAllRowsExpanded()\n }\n }\n table.getIsSomeRowsExpanded = () => {\n const expanded = table.getState().expanded\n return expanded === true || Object.values(expanded).some(Boolean)\n }\n table.getIsAllRowsExpanded = () => {\n const expanded = table.getState().expanded\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true\n }\n\n if (!Object.keys(expanded).length) {\n return false\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false\n }\n\n // They must all be expanded :shrug:\n return true\n }\n table.getExpandedDepth = () => {\n let maxDepth = 0\n\n const rowIds =\n table.getState().expanded === true\n ? Object.keys(table.getRowModel().rowsById)\n : Object.keys(table.getState().expanded)\n\n rowIds.forEach(id => {\n const splitId = id.split('.')\n maxDepth = Math.max(maxDepth, splitId.length)\n })\n\n return maxDepth\n }\n table.getPreExpandedRowModel = () => table.getSortedRowModel()\n table.getExpandedRowModel = () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table)\n }\n\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._getExpandedRowModel()\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleExpanded = expanded => {\n table.setExpanded(old => {\n const exists = old === true ? true : !!old?.[row.id]\n\n let oldExpanded: ExpandedStateList = {}\n\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true\n })\n } else {\n oldExpanded = old\n }\n\n expanded = expanded ?? !exists\n\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true,\n }\n }\n\n if (exists && !expanded) {\n const { [row.id]: _, ...rest } = oldExpanded\n return rest\n }\n\n return old\n })\n }\n row.getIsExpanded = () => {\n const expanded = table.getState().expanded\n\n return !!(\n table.options.getIsRowExpanded?.(row) ??\n (expanded === true || expanded?.[row.id])\n )\n }\n row.getCanExpand = () => {\n return (\n table.options.getRowCanExpand?.(row) ??\n ((table.options.enableExpanding ?? true) && !!row.subRows?.length)\n )\n }\n row.getIsAllParentsExpanded = () => {\n let isFullyExpanded = true\n let currentRow = row\n\n while (isFullyExpanded && currentRow.parentId) {\n currentRow = table.getRow(currentRow.parentId, true)\n isFullyExpanded = currentRow.getIsExpanded()\n }\n\n return isFullyExpanded\n }\n row.getToggleExpandedHandler = () => {\n const canExpand = row.getCanExpand()\n\n return () => {\n if (!canExpand) return\n row.toggleExpanded()\n }\n }\n },\n}\n","import {\n OnChangeFn,\n Table,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport {\n functionalUpdate,\n getMemoOptions,\n makeStateUpdater,\n memo,\n} from '../utils'\n\nexport interface PaginationState {\n pageIndex: number\n pageSize: number\n}\n\nexport interface PaginationTableState {\n pagination: PaginationState\n}\n\nexport interface PaginationInitialTableState {\n pagination?: Partial\n}\n\nexport interface PaginationOptions {\n /**\n * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n autoResetPageIndex?: boolean\n /**\n * Returns the row model after pagination has taken place, but no further.\n *\n * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel?: (table: Table) => () => RowModel\n /**\n * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n manualPagination?: boolean\n /**\n * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n onPaginationChange?: OnChangeFn\n /**\n * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n pageCount?: number\n /**\n * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n rowCount?: number\n}\n\nexport interface PaginationDefaultOptions {\n onPaginationChange: OnChangeFn\n}\n\nexport interface PaginationInstance {\n _autoResetPageIndex: () => void\n _getPaginationRowModel?: () => RowModel\n /**\n * Returns whether the table can go to the next page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanNextPage: () => boolean\n /**\n * Returns whether the table can go to the previous page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanPreviousPage: () => boolean\n /**\n * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageCount: () => number\n /**\n * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getRowCount: () => number\n /**\n * Returns an array of page options (zero-index-based) for the current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageOptions: () => number[]\n /**\n * Returns the row model for the table after pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel: () => RowModel\n /**\n * Returns the row model for the table before any pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPrePaginationRowModel: () => RowModel\n /**\n * Increments the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n nextPage: () => void\n /**\n * Decrements the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n previousPage: () => void\n /**\n * Sets the page index to `0`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n firstPage: () => void\n /**\n * Sets the page index to the last page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n lastPage: () => void\n /**\n * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageIndex: (defaultState?: boolean) => void\n /**\n * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageSize: (defaultState?: boolean) => void\n /**\n * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPagination: (defaultState?: boolean) => void\n /**\n * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead.\n */\n setPageCount: (updater: Updater) => void\n /**\n * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageIndex: (updater: Updater) => void\n /**\n * Updates the page size using the provided function or value in the `state.pagination.pageSize` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageSize: (updater: Updater) => void\n /**\n * Sets or updates the `state.pagination` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPagination: (updater: Updater) => void\n}\n\n//\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\nconst getDefaultPaginationState = (): PaginationState => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n})\n\nexport const RowPagination: TableFeature = {\n getInitialState: (state): PaginationTableState => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...state?.pagination,\n },\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): PaginationDefaultOptions => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table),\n }\n },\n\n createTable: (table: Table): void => {\n let registered = false\n let queued = false\n\n table._autoResetPageIndex = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetPageIndex()\n queued = false\n })\n }\n }\n table.setPagination = updater => {\n const safeUpdater: Updater = old => {\n let newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n }\n table.resetPagination = defaultState => {\n table.setPagination(\n defaultState\n ? getDefaultPaginationState()\n : table.initialState.pagination ?? getDefaultPaginationState()\n )\n }\n table.setPageIndex = updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n }\n table.resetPageIndex = defaultState => {\n table.setPageIndex(\n defaultState\n ? defaultPageIndex\n : table.initialState?.pagination?.pageIndex ?? defaultPageIndex\n )\n }\n table.resetPageSize = defaultState => {\n table.setPageSize(\n defaultState\n ? defaultPageSize\n : table.initialState?.pagination?.pageSize ?? defaultPageSize\n )\n }\n table.setPageSize = updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex!\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n }\n //deprecated\n table.setPageCount = updater =>\n table.setPagination(old => {\n let newPageCount = functionalUpdate(\n updater,\n table.options.pageCount ?? -1\n )\n\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount)\n }\n\n return {\n ...old,\n pageCount: newPageCount,\n }\n })\n\n table.getPageOptions = memo(\n () => [table.getPageCount()],\n pageCount => {\n let pageOptions: number[] = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n },\n getMemoOptions(table.options, 'debugTable', 'getPageOptions')\n )\n\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0\n\n table.getCanNextPage = () => {\n const { pageIndex } = table.getState().pagination\n\n const pageCount = table.getPageCount()\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n }\n\n table.previousPage = () => {\n return table.setPageIndex(old => old - 1)\n }\n\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1\n })\n }\n\n table.firstPage = () => {\n return table.setPageIndex(0)\n }\n\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1)\n }\n\n table.getPrePaginationRowModel = () => table.getExpandedRowModel()\n table.getPaginationRowModel = () => {\n if (\n !table._getPaginationRowModel &&\n table.options.getPaginationRowModel\n ) {\n table._getPaginationRowModel =\n table.options.getPaginationRowModel(table)\n }\n\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel()\n }\n\n return table._getPaginationRowModel()\n }\n\n table.getPageCount = () => {\n return (\n table.options.pageCount ??\n Math.ceil(table.getRowCount() / table.getState().pagination.pageSize)\n )\n }\n\n table.getRowCount = () => {\n return (\n table.options.rowCount ?? table.getPrePaginationRowModel().rows.length\n )\n }\n },\n}\n","import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance {\n _getPinnedRows: (\n visiblePinnedRows: Array>,\n pinnedRowIds: Array | undefined,\n position: 'top' | 'bottom'\n ) => Row[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top' ? table.getTopRows() : table.getBottomRows()\n )?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows.filter(Boolean).map(d => ({ ...d, position })) as Row[]\n }\n\n table.getTopRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.top],\n (allRows, topPinnedRowIds) =>\n table._getPinnedRows(allRows, topPinnedRowIds, 'top'),\n getMemoOptions(table.options, 'debugRows', 'getTopRows')\n )\n\n table.getBottomRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.bottom],\n (allRows, bottomPinnedRowIds) =>\n table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'),\n getMemoOptions(table.options, 'debugRows', 'getBottomRows')\n )\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n","import {\n OnChangeFn,\n Table,\n Row,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowSelectionState = Record\n\nexport interface RowSelectionTableState {\n rowSelection: RowSelectionState\n}\n\nexport interface RowSelectionOptions {\n /**\n * - Enables/disables multiple row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablemultirowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableMultiRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * - Enables/disables row selection for all rows in the table OR\n * - A function that given a row, returns whether to enable/disable row selection for that row\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablerowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * Enables/disables automatic sub-row selection when a parent row is selected, or a function that enables/disables automatic sub-row selection for each row.\n * (Use in combination with expanding or grouping features)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablesubrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n enableSubRowSelection?: boolean | ((row: Row) => boolean)\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowSelection` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#onrowselectionchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n onRowSelectionChange?: OnChangeFn\n // enableGroupingRowSelection?:\n // | boolean\n // | ((\n // row: Row\n // ) => boolean)\n // isAdditiveSelectEvent?: (e: unknown) => boolean\n // isInclusiveSelectEvent?: (e: unknown) => boolean\n // selectRowsFn?: (\n // table: Table,\n // rowModel: RowModel\n // ) => RowModel\n}\n\nexport interface RowSelectionRow {\n /**\n * Returns whether or not the row can multi-select.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanmultiselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanMultiSelect: () => boolean\n /**\n * Returns whether or not the row can be selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselect)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelect: () => boolean\n /**\n * Returns whether or not the row can select sub rows automatically when the parent row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselectsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getCanSelectSubRows: () => boolean\n /**\n * Returns whether or not all of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallsubrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllSubRowsSelected: () => boolean\n /**\n * Returns whether or not the row is selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSelected: () => boolean\n /**\n * Returns whether or not some of the row's sub rows are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomeselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeSelected: () => boolean\n /**\n * Returns a handler that can be used to toggle the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleSelectedHandler: () => (event: unknown) => void\n /**\n * Selects/deselects the row.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleSelected: (value?: boolean, opts?: { selectChildren?: boolean }) => void\n}\n\nexport interface RowSelectionInstance {\n /**\n * Returns the row model of all rows that are selected after filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getfilteredselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getFilteredSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected after grouping has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getgroupedselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getGroupedSelectedRowModel: () => RowModel\n /**\n * Returns whether or not all rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllPageRowsSelected: () => boolean\n /**\n * Returns whether or not all rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsAllRowsSelected: () => boolean\n /**\n * Returns whether or not any rows on the current page are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomePageRowsSelected: () => boolean\n /**\n * Returns whether or not any rows in the table are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getIsSomeRowsSelected: () => boolean\n /**\n * Returns the core row model of all rows before row selection has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getpreselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getPreSelectedRowModel: () => RowModel\n /**\n * Returns the row model of all rows that are selected.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getselectedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getSelectedRowModel: () => RowModel\n /**\n * Returns a handler that can be used to toggle all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallpagerowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Returns a handler that can be used to toggle all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallrowsselectedhandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n getToggleAllRowsSelectedHandler: () => (event: unknown) => void\n /**\n * Resets the **rowSelection** state to the `initialState.rowSelection`, or `true` can be passed to force a default blank state reset to `{}`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#resetrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n resetRowSelection: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowSelection` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#setrowselection)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n setRowSelection: (updater: Updater) => void\n /**\n * Selects/deselects all rows on the current page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallpagerowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllPageRowsSelected: (value?: boolean) => void\n /**\n * Selects/deselects all rows in the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallrowsselected)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)\n */\n toggleAllRowsSelected: (value?: boolean) => void\n}\n\n//\n\nexport const RowSelection: TableFeature = {\n getInitialState: (state): RowSelectionTableState => {\n return {\n rowSelection: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowSelectionOptions => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true,\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n }\n },\n\n createTable: (table: Table): void => {\n table.setRowSelection = updater =>\n table.options.onRowSelectionChange?.(updater)\n table.resetRowSelection = defaultState =>\n table.setRowSelection(\n defaultState ? {} : table.initialState.rowSelection ?? {}\n )\n table.toggleAllRowsSelected = value => {\n table.setRowSelection(old => {\n value =\n typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n }\n table.toggleAllPageRowsSelected = value =>\n table.setRowSelection(old => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table.getIsAllPageRowsSelected()\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n table.getPreSelectedRowModel = () => table.getCoreRowModel()\n table.getSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getCoreRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel')\n )\n\n table.getFilteredSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getFilteredRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel')\n )\n\n table.getGroupedSelectedRowModel = memo(\n () => [table.getState().rowSelection, table.getSortedRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel')\n )\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n table.getIsAllRowsSelected = () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const { rowSelection } = table.getState()\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n row => row.getCanSelect() && !rowSelection[row.id]\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n }\n\n table.getIsAllPageRowsSelected = () => {\n const paginationFlatRows = table\n .getPaginationRowModel()\n .flatRows.filter(row => row.getCanSelect())\n const { rowSelection } = table.getState()\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some(row => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n }\n\n table.getIsSomeRowsSelected = () => {\n const totalSelected = Object.keys(\n table.getState().rowSelection ?? {}\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n }\n\n table.getIsSomePageRowsSelected = () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows\n return table.getIsAllPageRowsSelected()\n ? false\n : paginationFlatRows\n .filter(row => row.getCanSelect())\n .some(d => d.getIsSelected() || d.getIsSomeSelected())\n }\n\n table.getToggleAllRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n\n table.getToggleAllPageRowsSelectedHandler = () => {\n return (e: unknown) => {\n table.toggleAllPageRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): void => {\n row.toggleSelected = (value, opts) => {\n const isSelected = row.getIsSelected()\n\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row.getCanSelect() && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n table\n )\n\n return selectedRowIds\n })\n }\n row.getIsSelected = () => {\n const { rowSelection } = table.getState()\n return isRowSelected(row, rowSelection)\n }\n\n row.getIsSomeSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'some'\n }\n\n row.getIsAllSubRowsSelected = () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'all'\n }\n\n row.getCanSelect = () => {\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row)\n }\n\n return table.options.enableRowSelection ?? true\n }\n\n row.getCanSelectSubRows = () => {\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row)\n }\n\n return table.options.enableSubRowSelection ?? true\n }\n\n row.getCanMultiSelect = () => {\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row)\n }\n\n return table.options.enableMultiRowSelection ?? true\n }\n row.getToggleSelectedHandler = () => {\n const canSelect = row.getCanSelect()\n\n return (e: unknown) => {\n if (!canSelect) return\n row.toggleSelected(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n }\n },\n}\n\nconst mutateRowIsSelected = (\n selectedRowIds: Record,\n id: string,\n value: boolean,\n includeChildren: boolean,\n table: Table\n) => {\n const row = table.getRow(id, true)\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key])\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true\n }\n } else {\n delete selectedRowIds[id]\n }\n // }\n\n if (includeChildren && row.subRows?.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row =>\n mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table)\n )\n }\n}\n\nexport function selectRowsFn(\n table: Table,\n rowModel: RowModel\n): RowModel {\n const rowSelection = table.getState().rowSelection\n\n const newSelectedFlatRows: Row[] = []\n const newSelectedRowsById: Record> = {}\n\n // Filters top level and nested rows\n const recurseRows = (rows: Row[], depth = 0): Row[] => {\n return rows\n .map(row => {\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows?.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n return row\n }\n })\n .filter(Boolean) as Row[]\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\nexport function isRowSelected(\n row: Row,\n selection: Record\n): boolean {\n return selection[row.id] ?? false\n}\n\nexport function isSubRowSelected(\n row: Row,\n selection: Record,\n table: Table\n): boolean | 'some' | 'all' {\n if (!row.subRows?.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (subRow.getCanSelect()) {\n if (isRowSelected(subRow, selection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows && subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow, selection, table)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n","import { SortingFn } from './features/RowSorting'\n\nexport const reSplitAlphaNumeric = /([0-9]+)/gm\n\nconst alphanumeric: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\nconst alphanumericCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\nconst datetime: SortingFn = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId)\n const b = rowB.getValue(columnId)\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0\n}\n\nconst basic: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId))\n}\n\n// Utils\n\nfunction compareBasic(a: any, b: any) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction toString(a: any) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr: string, bStr: string) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean)\n\n // While\n while (a.length && b.length) {\n const aa = a.shift()!\n const bb = b.shift()!\n\n const an = parseInt(aa, 10)\n const bn = parseInt(bb, 10)\n\n const combo = [an, bn].sort()\n\n // Both are string\n if (isNaN(combo[0]!)) {\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1]!)) {\n return isNaN(an) ? -1 : 1\n }\n\n // Both are numbers\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n }\n\n return a.length - b.length\n}\n\n// Exports\n\nexport const sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic,\n}\n\nexport type BuiltInSortingFn = keyof typeof sortingFns\n","import { RowModel } from '..'\nimport {\n BuiltInSortingFn,\n reSplitAlphaNumeric,\n sortingFns,\n} from '../sortingFns'\n\nimport {\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n SortingFns,\n TableFeature,\n} from '../types'\n\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type SortDirection = 'asc' | 'desc'\n\nexport interface ColumnSort {\n desc: boolean\n id: string\n}\n\nexport type SortingState = ColumnSort[]\n\nexport interface SortingTableState {\n sorting: SortingState\n}\n\nexport interface SortingFn {\n (rowA: Row, rowB: Row, columnId: string): number\n}\n\nexport type CustomSortingFns = Record<\n string,\n SortingFn\n>\n\nexport type SortingFnOption =\n | 'auto'\n | keyof SortingFns\n | BuiltInSortingFn\n | SortingFn\n\nexport interface SortingColumnDef {\n /**\n * Enables/Disables multi-sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n invertSorting?: boolean\n /**\n * Set to `true` for sorting toggles on this column to start in the descending direction.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n /**\n * The sorting function to use with this column.\n * - A `string` referencing a built-in sorting function\n * - A custom sorting function\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortingFn?: SortingFnOption\n /**\n * The priority of undefined values when sorting this column.\n * - `false`\n * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)\n * - `-1`\n * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)\n * - `1`\n * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortundefined)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n}\n\nexport interface SortingColumn {\n /**\n * Removes this column from the table's sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n clearSorting: () => void\n /**\n * Returns a sort direction automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortDir: () => SortDirection\n /**\n * Returns a sorting function automatically inferred based on the columns values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getAutoSortingFn: () => SortingFn\n /**\n * Returns whether this column can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanMultiSort: () => boolean\n /**\n * Returns whether this column can be sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getCanSort: () => boolean\n /**\n * Returns the first direction that should be used when sorting this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getFirstSortDir: () => SortDirection\n /**\n * Returns the current sort direction of this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getIsSorted: () => false | SortDirection\n /**\n * Returns the next sorting order.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getNextSortingOrder: () => SortDirection | false\n /**\n * Returns the index position of this column's sorting within the sorting state\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortIndex: () => number\n /**\n * Returns the resolved sorting function to be used for this column\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortingFn: () => SortingFn\n /**\n * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getToggleSortingHandler: () => undefined | ((event: unknown) => void)\n /**\n * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n toggleSorting: (desc?: boolean, isMulti?: boolean) => void\n}\n\ninterface SortingOptionsBase {\n /**\n * Enables/disables the ability to remove multi-sorts\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiRemove?: boolean\n /**\n * Enables/Disables multi-sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableMultiSort?: boolean\n /**\n * Enables/Disables sorting for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSorting?: boolean\n /**\n * Enables/Disables the ability to remove sorting for the table.\n * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ...\n * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ...\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n enableSortingRemoval?: boolean\n /**\n * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel?: (table: Table) => () => RowModel\n /**\n * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n isMultiSortEvent?: (e: unknown) => boolean\n /**\n * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n manualSorting?: boolean\n /**\n * Set a maximum number of columns that can be multi-sorted.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n maxMultiSortColCount?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.sorting` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n onSortingChange?: OnChangeFn\n /**\n * If `true`, all sorts will default to descending as their first toggle state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n sortDescFirst?: boolean\n}\n\ntype ResolvedSortingFns = keyof SortingFns extends never\n ? {\n sortingFns?: Record>\n }\n : {\n sortingFns: Record>\n }\n\nexport interface SortingOptions\n extends SortingOptionsBase,\n ResolvedSortingFns {}\n\nexport interface SortingInstance {\n _getSortedRowModel?: () => RowModel\n /**\n * Returns the row model for the table before any sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getPreSortedRowModel: () => RowModel\n /**\n * Returns the row model for the table after sorting has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n getSortedRowModel: () => RowModel\n /**\n * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n resetSorting: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.sorting` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)\n */\n setSorting: (updater: Updater) => void\n}\n\n//\n\nexport const RowSorting: TableFeature = {\n getInitialState: (state): SortingTableState => {\n return {\n sorting: [],\n ...state,\n }\n },\n\n getDefaultColumnDef: (): SortingColumnDef => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): SortingOptions => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): void => {\n column.getAutoSortingFn = () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row?.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric\n }\n }\n }\n\n if (isString) {\n return sortingFns.text\n }\n\n return sortingFns.basic\n }\n column.getAutoSortDir = () => {\n const firstRow = table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n }\n column.getSortingFn = () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.sortingFn)\n ? column.columnDef.sortingFn\n : column.columnDef.sortingFn === 'auto'\n ? column.getAutoSortingFn()\n : table.options.sortingFns?.[column.columnDef.sortingFn as string] ??\n sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]\n }\n column.toggleSorting = (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder()\n const hasManualValue = typeof desc !== 'undefined' && desc !== null\n\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old?.find(d => d.id === column.id)\n const existingIndex = old?.findIndex(d => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old?.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old?.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n }\n\n column.getFirstSortDir = () => {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n table.options.sortDescFirst ??\n column.getAutoSortDir() === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n }\n\n column.getNextSortingOrder = (multi?: boolean) => {\n const firstSortDirection = column.getFirstSortDir()\n const isSorted = column.getIsSorted()\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n }\n\n column.getCanSort = () => {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getCanMultiSort = () => {\n return (\n column.columnDef.enableMultiSort ??\n table.options.enableMultiSort ??\n !!column.accessorFn\n )\n }\n\n column.getIsSorted = () => {\n const columnSort = table.getState().sorting?.find(d => d.id === column.id)\n\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n }\n\n column.getSortIndex = () =>\n table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1\n\n column.clearSorting = () => {\n //clear sorting for just 1 column\n table.setSorting(old =>\n old?.length ? old.filter(d => d.id !== column.id) : []\n )\n }\n\n column.getToggleSortingHandler = () => {\n const canSort = column.getCanSort()\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column.toggleSorting?.(\n undefined,\n column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false\n )\n }\n }\n },\n\n createTable: (table: Table): void => {\n table.setSorting = updater => table.options.onSortingChange?.(updater)\n table.resetSorting = defaultState => {\n table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])\n }\n table.getPreSortedRowModel = () => table.getGroupedRowModel()\n table.getSortedRowModel = () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table)\n }\n\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._getSortedRowModel()\n }\n },\n}\n","import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table) => () => RowModel\n /**\n * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row) => string\n /**\n * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions,\n options: Partial>\n ) => TableOptions\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial\n}\n\nexport interface CoreInstance {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record>\n _getColumnDefs: () => ColumnDef[]\n _getCoreRowModel?: () => RowModel\n _getDefaultColumnDef: () => Partial>\n _getRowId: (_: TData, index: number, parent?: Row) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater) => void\n}\n\nexport function createTable(\n options: TableOptionsResolved\n): Table {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved\n\n const mergeOptions = (options: TableOptionsResolved) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef[],\n parent?: Column,\n depth = 0\n ): Column[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getExpandedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().expanded,\n table.getPreExpandedRowModel(),\n table.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel\n }\n\n return expandRows(rowModel)\n },\n getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')\n )\n}\n\nexport function expandRows(rowModel: RowModel) {\n const expandedRows: Row[] = []\n\n const handleRow = (row: Row) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n","import { createRow } from '../core/row'\nimport { Row, RowModel, Table, RowData } from '../types'\n\nexport function filterRows(\n rows: Row[],\n filterRowImpl: (row: Row) => any,\n table: Table\n) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table)\n }\n\n return filterRowModelFromRoot(rows, filterRowImpl, table)\n}\n\nfunction filterRowModelFromLeafs(\n rowsToFilter: Row[],\n filterRow: (row: Row) => Row[],\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n const rows: Row[] = []\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.columnFilters = row.columnFilters\n\n if (row.subRows?.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n continue\n }\n } else {\n row = newRow\n if (filterRow(row)) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredFlatRows.push(row)\n }\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n\nfunction filterRowModelFromRoot(\n rowsToFilter: Row[],\n filterRow: (row: Row) => any,\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n // Filters top level and nested rows\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n // Filter from parents downward first\n\n const rows: Row[] = []\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const pass = filterRow(row)\n\n if (pass) {\n if (row.subRows?.length && depth < maxDepth) {\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n }\n\n rows.push(row)\n newFilteredFlatRows.push(row)\n newFilteredRowsById[row.id] = row\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n","import {\n AccessorFn,\n AccessorFnColumnDef,\n AccessorKeyColumnDef,\n DisplayColumnDef,\n GroupColumnDef,\n IdentifiedColumnDef,\n RowData,\n} from './types'\nimport { DeepKeys, DeepValue } from './utils'\n\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nexport type ColumnHelper = {\n accessor: <\n TAccessor extends AccessorFn | DeepKeys,\n TValue extends TAccessor extends AccessorFn\n ? TReturn\n : TAccessor extends DeepKeys\n ? DeepValue\n : never,\n >(\n accessor: TAccessor,\n column: TAccessor extends AccessorFn\n ? DisplayColumnDef\n : IdentifiedColumnDef\n ) => TAccessor extends AccessorFn\n ? AccessorFnColumnDef\n : AccessorKeyColumnDef\n display: (column: DisplayColumnDef) => DisplayColumnDef\n group: (column: GroupColumnDef) => GroupColumnDef\n}\n\nexport function createColumnHelper<\n TData extends RowData,\n>(): ColumnHelper {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function'\n ? ({\n ...column,\n accessorFn: accessor,\n } as any)\n : {\n ...column,\n accessorKey: accessor,\n }\n },\n display: column => column,\n group: column => column,\n }\n}\n","import { createRow } from '../core/row'\nimport { Table, Row, RowModel, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getCoreRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.options.data],\n (\n data\n ): {\n rows: Row[]\n flatRows: Row[]\n rowsById: Record>\n } => {\n const rowModel: RowModel = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: TData[],\n depth = 0,\n parentRow?: Row\n ): Row[] => {\n const rows = [] as Row[]\n\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(\n table,\n table._getRowId(originalRows[i]!, i, parentRow),\n originalRows[i]!,\n i,\n depth,\n undefined,\n parentRow?.id\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(\n originalRows[i]!,\n i\n )\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedMinMaxValues(): (\n table: Table,\n columnId: string\n) => () => undefined | [number, number] {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return undefined\n\n const uniqueValues = facetedRowModel.flatRows\n .flatMap(flatRow => flatRow.getUniqueValues(columnId) ?? [])\n .map(Number)\n .filter(value => !Number.isNaN(value))\n\n if (!uniqueValues.length) return\n\n let facetedMinValue = uniqueValues[0]!\n let facetedMaxValue = uniqueValues[uniqueValues.length - 1]!\n\n for (const value of uniqueValues) {\n if (value < facetedMinValue) facetedMinValue = value\n else if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n return [facetedMinValue, facetedMaxValue]\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')\n )\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFacetedRowModel(): (\n table: Table,\n columnId: string\n) => () => RowModel {\n return (table, columnId) =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n table.getFilteredRowModel(),\n ],\n (preRowModel, columnFilters, globalFilter) => {\n if (\n !preRowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n return preRowModel\n }\n\n const filterableIds = [\n ...columnFilters.map(d => d.id).filter(d => d !== columnId),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as string[]\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel')\n )\n}\n","import { Table, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getFacetedUniqueValues(): (\n table: Table,\n columnId: string\n) => () => Map {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return new Map()\n\n let facetedUniqueValues = new Map()\n\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values =\n facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]!\n\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n },\n getMemoOptions(\n table.options,\n 'debugTable',\n `getFacetedUniqueValues_${columnId}`\n )\n )\n}\n","import { ResolvedColumnFilter } from '../features/ColumnFiltering'\nimport { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFilteredRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n ],\n (rowModel, columnFilters, globalFilter) => {\n if (\n !rowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i]!.columnFilters = {}\n rowModel.flatRows[i]!.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: ResolvedColumnFilter[] = []\n const resolvedGlobalFilters: ResolvedColumnFilter[] = []\n\n ;(columnFilters ?? []).forEach(d => {\n const column = table.getColumn(d.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column.getFilterFn()\n\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`\n )\n }\n return\n }\n\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: filterFn.resolveFilterValue?.(d.value) ?? d.value,\n })\n })\n\n const filterableIds = (columnFilters ?? []).map(d => d.id)\n\n const globalFilterFn = table.getGlobalFilterFn()\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter(column => column.getCanGlobalFilter())\n\n if (\n globalFilter &&\n globalFilterFn &&\n globallyFilterableColumns.length\n ) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach(column => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ??\n globalFilter,\n })\n })\n }\n\n let currentColumnFilter\n let currentGlobalFilter\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j]!\n\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table)\n },\n getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n","import { createRow } from '../core/row'\nimport { Row, RowData, RowModel, Table } from '../types'\nimport { flattenBy, getMemoOptions, memo } from '../utils'\nimport { GroupingState } from '../features/ColumnGrouping'\n\nexport function getGroupedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().grouping, table.getPreGroupedRowModel()],\n (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n rowModel.rows.forEach(row => {\n row.depth = 0\n row.parentId = undefined\n })\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId =>\n table.getColumn(columnId)\n )\n\n const groupedFlatRows: Row[] = []\n const groupedRowsById: Record> = {}\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Row[],\n depth = 0,\n parentId?: string\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId: string = existingGrouping[depth]!\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n subRows.forEach(subRow => {\n subRow.parentId = id\n })\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, row => row.subRows)\n : groupedRows\n\n const row = createRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId\n )\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (columnId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[columnId] =\n groupedRows[0].getValue(columnId) ?? undefined\n }\n\n return row._valuesCache[columnId]\n }\n\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId)\n const aggregateFn = column?.getAggregationFn()\n\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(\n columnId,\n leafRows,\n groupedRows\n )\n\n return row._groupingValuesCache[columnId]\n }\n },\n })\n\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return row\n }\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {\n table._queue(() => {\n table._autoResetExpanded()\n table._autoResetPageIndex()\n })\n })\n )\n}\n\nfunction groupBy(rows: Row[], columnId: string) {\n const groupMap = new Map[]>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n","import { Table, RowModel, Row, RowData } from '../types'\nimport { getMemoOptions, memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel(opts?: {\n initialSync: boolean\n}): (table: Table) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().pagination,\n table.getPrePaginationRowModel(),\n table.options.paginateExpandedRows\n ? undefined\n : table.getState().expanded,\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n let paginatedRowModel: RowModel\n\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById,\n })\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById,\n }\n }\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row) => {\n paginatedRowModel.flatRows.push(row)\n if (row.subRows.length) {\n row.subRows.forEach(handleRow)\n }\n }\n\n paginatedRowModel.rows.forEach(handleRow)\n\n return paginatedRowModel\n },\n getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel')\n )\n}\n","import { Table, Row, RowModel, RowData } from '../types'\nimport { SortingFn } from '../features/RowSorting'\nimport { getMemoOptions, memo } from '../utils'\n\nexport function getSortedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().sorting, table.getPreSortedRowModel()],\n (sorting, rowModel) => {\n if (!rowModel.rows.length || !sorting?.length) {\n return rowModel\n }\n\n const sortingState = table.getState().sorting\n\n const sortedFlatRows: Row[] = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort =>\n table.getColumn(sort.id)?.getCanSort()\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1 | 'first' | 'last'\n invertSorting?: boolean\n sortingFn: SortingFn\n }\n > = {}\n\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn(),\n }\n })\n\n const sortData = (rows: Row[]) => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = rows.map(row => ({ ...row }))\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const sortUndefined = columnInfo.sortUndefined\n const isDesc = sortEntry?.desc ?? false\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1\n if (sortUndefined === 'last') return aUndefined ? 1 : -1\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? sortUndefined\n : -sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n sortedFlatRows.push(row)\n if (row.subRows?.length) {\n row.subRows = sortData(row.subRows)\n }\n })\n\n return sortedData\n }\n\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById,\n }\n },\n getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () =>\n table._autoResetPageIndex()\n )\n )\n}\n"],"names":["functionalUpdate","updater","input","makeStateUpdater","key","instance","setState","old","isFunction","d","Function","isNumberArray","Array","isArray","every","val","flattenBy","arr","getChildren","flat","recurse","subArr","forEach","item","push","children","length","memo","getDeps","fn","opts","result","deps","depArgs","depTime","debug","Date","now","newDeps","some","dep","index","resultTime","onChange","depEndTime","Math","round","resultEndTime","resultFpsPercentage","pad","str","num","String","console","info","max","min","getMemoOptions","tableOptions","debugLevel","_tableOptions$debugAl","debugAll","process","createCell","table","row","column","columnId","cell","id","getValue","renderValue","getRenderValue","_cell$getValue","options","renderFallbackValue","getContext","_features","feature","createColumn","columnDef","depth","parent","_ref","_resolvedColumnDef$id","resolvedColumnDef","_getDefaultColumnDef","accessorKey","accessorFn","prototype","replaceAll","replace","undefined","header","includes","originalRow","split","_result","Error","columns","getFlatColumns","_column$columns","flatMap","getLeafColumns","_getOrderColumnsFn","orderColumns","_column$columns2","leafColumns","createHeader","_options$id","isPlaceholder","placeholderId","subHeaders","colSpan","rowSpan","headerGroup","getLeafHeaders","leafHeaders","recurseHeader","h","map","Headers","createTable","getHeaderGroups","getAllColumns","getVisibleLeafColumns","getState","columnPinning","left","right","allColumns","_left$map$filter","_right$map$filter","leftColumns","find","filter","Boolean","rightColumns","buildHeaderGroups","getCenterHeaderGroups","getLeftHeaderGroups","_left$map$filter2","getRightHeaderGroups","_right$map$filter2","getFooterGroups","headerGroups","reverse","getLeftFooterGroups","getCenterFooterGroups","getRightFooterGroups","getFlatHeaders","headers","getLeftFlatHeaders","getCenterFlatHeaders","getRightFlatHeaders","getCenterLeafHeaders","flatHeaders","_header$subHeaders","getLeftLeafHeaders","_header$subHeaders2","getRightLeafHeaders","_header$subHeaders3","center","_left$0$headers","_left$","_center$0$headers","_center$","_right$0$headers","_right$","columnsToGroup","headerFamily","_headerGroups$0$heade","_headerGroups$","maxDepth","findMaxDepth","getIsVisible","createHeaderGroup","headersToGroup","join","pendingParentHeaders","headerToGroup","latestPendingParentHeader","bottomHeaders","recurseHeadersForSpans","childRowSpans","childColSpan","childRowSpan","createRow","original","rowIndex","subRows","parentId","_valuesCache","_uniqueValuesCache","hasOwnProperty","getColumn","getUniqueValues","_row$getValue","getLeafRows","getParentRow","getRow","getParentRows","parentRows","currentRow","parentRow","getAllCells","getAllLeafColumns","_getAllCellsByColumnId","allCells","reduce","acc","i","ColumnFaceting","_getFacetedRowModel","getFacetedRowModel","getPreFilteredRowModel","_getFacetedUniqueValues","getFacetedUniqueValues","Map","_getFacetedMinMaxValues","getFacetedMinMaxValues","includesString","filterValue","_filterValue$toString","search","toString","toLowerCase","autoRemove","testFalsey","includesStringSensitive","_row$getValue2","equalsString","_row$getValue3","arrIncludes","_row$getValue4","arrIncludesAll","_row$getValue5","arrIncludesSome","_row$getValue6","equals","weakEquals","inNumberRange","rowValue","resolveFilterValue","unsafeMin","unsafeMax","parsedMin","parseFloat","parsedMax","Number","isNaN","Infinity","temp","filterFns","ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","onColumnFiltersChange","filterFromLeafRows","maxLeafRowFilterDepth","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getFilterFn","_table$options$filter","_table$options$filter2","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","previousFilter","newFilter","_old$filter","shouldAutoRemoveFilter","newFilterObj","_old$map","_table","columnFiltersMeta","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getFilteredRowModel","_getFilteredRowModel","manualFiltering","aggregationFns","sum","_leafRows","childRows","next","nextValue","extent","mean","leafRows","count","median","values","mid","floor","nums","sort","a","b","unique","from","Set","uniqueCount","size","_columnId","ColumnGrouping","aggregatedCell","props","_toString","_props$getValue","aggregationFn","grouping","onGroupingChange","groupedColumnMode","toggleGrouping","setGrouping","getCanGroup","enableGrouping","getGroupingValue","getIsGrouped","_table$getState$group","getGroupedIndex","_table$getState$group2","indexOf","getToggleGroupingHandler","canGroup","getAutoAggregationFn","Object","call","getAggregationFn","_table$options$aggreg","_table$options$aggreg2","resetGrouping","_table$initialState$g","getPreGroupedRowModel","getGroupedRowModel","_getGroupedRowModel","manualGrouping","groupingColumnId","_groupingValuesCache","getIsPlaceholder","getIsAggregated","_row$subRows","nonGroupingColumns","col","g","ColumnOrdering","columnOrder","onColumnOrderChange","getIndex","position","_getVisibleLeafColumns","getIsFirstColumn","_columns$","getIsLastColumn","_columns","setColumnOrder","resetColumnOrder","orderedColumns","columnOrderCopy","columnsCopy","targetColumnId","shift","foundIndex","splice","ColumnPinning","onColumnPinningChange","pin","columnIds","setColumnPinning","_old$left3","_old$right3","_old$left","_old$right","_old$left2","_old$right2","getCanPin","_d$columnDef$enablePi","enablePinning","enableColumnPinning","getIsPinned","leafColumnIds","isLeft","isRight","getPinnedIndex","getCenterVisibleCells","_getAllVisibleCells","leftAndRight","getLeftVisibleCells","getRightVisibleCells","resetColumnPinning","getIsSomeColumnsPinned","_pinningState$positio","pinningState","_pinningState$left","_pinningState$right","getLeftLeafColumns","getRightLeafColumns","getCenterLeafColumns","defaultColumnSizing","minSize","maxSize","MAX_SAFE_INTEGER","ColumnSizing","columnSizing","columnSizingInfo","startOffset","startSize","deltaOffset","deltaPercentage","isResizingColumn","columnSizingStart","columnResizeMode","columnResizeDirection","onColumnSizingChange","onColumnSizingInfoChange","getSize","_column$columnDef$min","_column$columnDef$max","columnSize","getStart","slice","getAfter","resetSize","setColumnSizing","_ref2","_","rest","getCanResize","enableResizing","enableColumnResizing","getIsResizing","_header$column$getSiz","prevSiblingHeader","getResizeHandler","_contextDocument","canResize","e","persist","isTouchStartEvent","touches","clientX","newColumnSizing","updateOffset","eventType","clientXPos","setColumnSizingInfo","_old$startOffset","_old$startSize","deltaDirection","_ref3","headerSize","onMove","onEnd","contextDocument","document","mouseEvents","moveHandler","upHandler","removeEventListener","touchEvents","cancelable","preventDefault","stopPropagation","_e$touches$","passiveIfSupported","passiveEventSupported","passive","addEventListener","resetColumnSizing","resetHeaderSizeInfo","_table$initialState$c2","getTotalSize","_table$getHeaderGroup","_table$getHeaderGroup2","getLeftTotalSize","_table$getLeftHeaderG","_table$getLeftHeaderG2","getCenterTotalSize","_table$getCenterHeade","_table$getCenterHeade2","getRightTotalSize","_table$getRightHeader","_table$getRightHeader2","passiveSupported","supported","noop","window","err","type","ColumnVisibility","columnVisibility","onColumnVisibilityChange","toggleVisibility","getCanHide","setColumnVisibility","childColumns","c","enableHiding","getToggleVisibilityHandler","target","checked","cells","getVisibleCells","makeVisibleColumnsMethod","getColumns","getVisibleFlatColumns","getAllFlatColumns","getLeftVisibleLeafColumns","getRightVisibleLeafColumns","getCenterVisibleLeafColumns","resetColumnVisibility","toggleAllColumnsVisible","_value","getIsAllColumnsVisible","obj","getIsSomeColumnsVisible","getToggleAllColumnsVisibilityHandler","_target","GlobalFaceting","_getGlobalFacetedRowModel","getGlobalFacetedRowModel","_getGlobalFacetedUniqueValues","getGlobalFacetedUniqueValues","_getGlobalFacetedMinMaxValues","getGlobalFacetedMinMaxValues","GlobalFiltering","globalFilter","onGlobalFilterChange","globalFilterFn","getColumnCanGlobalFilter","_table$getCoreRowMode","getCanGlobalFilter","_table$options$getCol","enableGlobalFilter","getGlobalAutoFilterFn","getGlobalFilterFn","setGlobalFilter","resetGlobalFilter","RowExpanding","expanded","onExpandedChange","paginateExpandedRows","registered","queued","_autoResetExpanded","_table$options$autoRe","autoResetAll","autoResetExpanded","manualExpanding","_queue","resetExpanded","setExpanded","toggleAllRowsExpanded","getIsAllRowsExpanded","_table$initialState$e","getCanSomeRowsExpand","getPrePaginationRowModel","getCanExpand","getToggleAllRowsExpandedHandler","getIsSomeRowsExpanded","keys","getRowModel","getIsExpanded","getExpandedDepth","rowsById","splitId","getPreExpandedRowModel","getSortedRowModel","getExpandedRowModel","_getExpandedRowModel","toggleExpanded","_expanded","exists","oldExpanded","rowId","_table$options$getIsR","getIsRowExpanded","_table$options$getRow","getRowCanExpand","enableExpanding","getIsAllParentsExpanded","isFullyExpanded","getToggleExpandedHandler","canExpand","RowPagination","pagination","pageIndex","pageSize","onPaginationChange","_autoResetPageIndex","autoResetPageIndex","manualPagination","resetPageIndex","setPagination","resetPagination","_table$initialState$p","setPageIndex","maxPageIndex","pageCount","_table$initialState$p2","resetPageSize","_table$initialState$p3","_table$initialState2","setPageSize","topRowIndex","setPageCount","_table$options$pageCo","newPageCount","getPageOptions","getPageCount","pageOptions","fill","getCanPreviousPage","getCanNextPage","previousPage","nextPage","firstPage","lastPage","getPaginationRowModel","_getPaginationRowModel","_table$options$pageCo2","ceil","getRowCount","_table$options$rowCou","rowCount","rows","RowPinning","rowPinning","top","bottom","onRowPinningChange","includeLeafRows","includeParentRows","leafRowIds","parentRowIds","rowIds","setRowPinning","_old$top3","_old$bottom3","_old$top","_old$bottom","_old$top2","_old$bottom2","has","enableRowPinning","isTop","isBottom","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","resetRowPinning","_table$initialState$r","getIsSomeRowsPinned","_pinningState$top","_pinningState$bottom","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","keepPinnedRows","allRows","topPinnedRowIds","bottomPinnedRowIds","getCenterRows","topAndBottom","RowSelection","rowSelection","onRowSelectionChange","enableRowSelection","enableMultiRowSelection","enableSubRowSelection","setRowSelection","resetRowSelection","toggleAllRowsSelected","getIsAllRowsSelected","preGroupedFlatRows","getCanSelect","toggleAllPageRowsSelected","resolvedValue","getIsAllPageRowsSelected","mutateRowIsSelected","getPreSelectedRowModel","getSelectedRowModel","rowModel","selectRowsFn","getFilteredSelectedRowModel","getGroupedSelectedRowModel","isAllRowsSelected","paginationFlatRows","isAllPageRowsSelected","getIsSomeRowsSelected","_table$getState$rowSe","totalSelected","getIsSomePageRowsSelected","getIsSelected","getIsSomeSelected","getToggleAllRowsSelectedHandler","getToggleAllPageRowsSelectedHandler","toggleSelected","isSelected","_opts$selectChildren","selectedRowIds","selectChildren","isRowSelected","isSubRowSelected","getIsAllSubRowsSelected","getCanSelectSubRows","getCanMultiSelect","_table$options$enable3","getToggleSelectedHandler","canSelect","includeChildren","newSelectedFlatRows","newSelectedRowsById","recurseRows","_row$subRows2","selection","_selection$row$id","_row$subRows3","allChildrenSelected","someSelected","subRow","subRowChildrenSelected","reSplitAlphaNumeric","compareBasic","compareAlphanumeric","aStr","bStr","aa","bb","an","parseInt","bn","combo","sortingFns","alphanumeric","rowA","rowB","alphanumericCaseSensitive","text","textCaseSensitive","datetime","basic","RowSorting","sorting","sortingFn","sortUndefined","onSortingChange","isMultiSortEvent","shiftKey","getAutoSortingFn","firstRows","isString","getAutoSortDir","getSortingFn","_table$options$sortin","_table$options$sortin2","toggleSorting","desc","multi","nextSortingOrder","getNextSortingOrder","hasManualValue","setSorting","existingSorting","existingIndex","sortAction","newSorting","nextDesc","_table$options$maxMul","getCanMultiSort","maxMultiSortColCount","getFirstSortDir","_column$columnDef$sor","sortDescFirst","firstSortDirection","isSorted","getIsSorted","enableSortingRemoval","enableMultiRemove","getCanSort","enableSorting","_column$columnDef$ena2","enableMultiSort","_table$getState$sorti","columnSort","getSortIndex","_table$getState$sorti2","_table$getState$sorti3","clearSorting","getToggleSortingHandler","canSort","resetSorting","_table$initialState$s","getPreSortedRowModel","_getSortedRowModel","manualSorting","builtInFeatures","expandRows","expandedRows","handleRow","filterRows","filterRowImpl","rowsToFilter","filterRow","_table$options$maxLea","newFilteredFlatRows","newFilteredRowsById","recurseFilterRows","newRow","filterRowModelFromLeafs","_table$options$maxLea2","filterRowModelFromRoot","accessor","display","group","_options$_features","_options$initialState","defaultOptions","assign","_feature$getInitialSt","queuedTimeout","coreInstance","cb","Promise","resolve","then","catch","error","setTimeout","reset","setOptions","newOptions","mergeOptions","onStateChange","_getRowId","getRowId","_getCoreRowModel","searchAll","defaultColumn","_defaultColumn","_props$renderValue$to","_props$renderValue","_getColumnDefs","columnDefs","recurseColumns","groupingColumnDef","_getAllFlatColumnsById","flatColumns","data","accessRows","originalRows","_row$originalSubRows","getSubRows","originalSubRows","_table$getColumn","facetedRowModel","uniqueValues","flatRow","_flatRow$getUniqueVal","facetedMinValue","facetedMaxValue","preRowModel","filterableIds","facetedUniqueValues","j","_facetedUniqueValues$","set","get","resolvedColumnFilters","resolvedGlobalFilters","_filterFn$resolveFilt","globallyFilterableColumns","currentColumnFilter","currentGlobalFilter","_globalFilterFn$resol","filterMeta","__global__","existingGrouping","groupedFlatRows","groupedRowsById","groupUpRecursively","rowGroupsMap","groupMap","resKey","previous","groupBy","aggregatedGroupedRows","entries","groupingValue","groupedRows","_groupedRows$0$getVal","aggregateFn","pageStart","pageEnd","paginatedRowModel","sortingState","sortedFlatRows","availableSorting","columnInfoById","sortEntry","invertSorting","sortData","sortedData","_sortEntry$desc","columnInfo","isDesc","sortInt","aUndefined","bUndefined"],"mappings":";;;;;;;;;;iPAgFO,SAASA,EAAoBC,EAAqBC,GACvD,MAA0B,mBAAZD,EACTA,EAA4BC,GAC7BD,CACN,CAMO,SAASE,EACdC,EACAC,GAEA,OAAQJ,IACJI,EAAiBC,UAAuBC,IACjC,IACFA,EACHH,CAACA,GAAMJ,EAA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AC7B,IAGKquB,CAAU,EAGnB,MAAO,CACLzR,KAAMwR,EAAS3N,EAAS7D,MACxB/X,SAAUkpB,EACVhV,SAAU0H,EAAS1H,SACpB,GAEHphB,EAAeO,EAAMU,QAAS,aAAc,GAAqB,IAC/DV,EAAMsiB,wBAGd,+GlClCO,WACL"} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/package.json b/node_modules/@tanstack/table-core/package.json new file mode 100644 index 00000000..456696bf --- /dev/null +++ b/node_modules/@tanstack/table-core/package.json @@ -0,0 +1,47 @@ +{ + "name": "@tanstack/table-core", + "version": "8.21.3", + "description": "Headless UI for building powerful tables & datagrids for TS/JS.", + "author": "Tanner Linsley", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/TanStack/table.git", + "directory": "packages/table-core" + }, + "homepage": "https://tanstack.com/table", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "keywords": [ + "react", + "vue", + "solid", + "table", + "table-core", + "datagrid" + ], + "type": "commonjs", + "module": "build/lib/index.esm.js", + "main": "build/lib/index.js", + "types": "build/lib/index.d.ts", + "exports": { + ".": { + "types": "./build/lib/index.d.ts", + "import": "./build/lib/index.mjs", + "default": "./build/lib/index.js" + }, + "./package.json": "./package.json" + }, + "sideEffects": false, + "engines": { + "node": ">=12" + }, + "files": [ + "build/lib/*", + "build/umd/*", + "src" + ], + "scripts": {} +} \ No newline at end of file diff --git a/node_modules/@tanstack/table-core/src/aggregationFns.ts b/node_modules/@tanstack/table-core/src/aggregationFns.ts new file mode 100644 index 00000000..06c7f95a --- /dev/null +++ b/node_modules/@tanstack/table-core/src/aggregationFns.ts @@ -0,0 +1,123 @@ +import { AggregationFn } from './features/ColumnGrouping' +import { isNumberArray } from './utils' + +const sum: AggregationFn = (columnId, _leafRows, childRows) => { + // It's faster to just add the aggregations together instead of + // process leaf nodes individually + return childRows.reduce((sum, next) => { + const nextValue = next.getValue(columnId) + return sum + (typeof nextValue === 'number' ? nextValue : 0) + }, 0) +} + +const min: AggregationFn = (columnId, _leafRows, childRows) => { + let min: number | undefined + + childRows.forEach(row => { + const value = row.getValue(columnId) + + if ( + value != null && + (min! > value || (min === undefined && value >= value)) + ) { + min = value + } + }) + + return min +} + +const max: AggregationFn = (columnId, _leafRows, childRows) => { + let max: number | undefined + + childRows.forEach(row => { + const value = row.getValue(columnId) + if ( + value != null && + (max! < value || (max === undefined && value >= value)) + ) { + max = value + } + }) + + return max +} + +const extent: AggregationFn = (columnId, _leafRows, childRows) => { + let min: number | undefined + let max: number | undefined + + childRows.forEach(row => { + const value = row.getValue(columnId) + if (value != null) { + if (min === undefined) { + if (value >= value) min = max = value + } else { + if (min > value) min = value + if (max! < value) max = value + } + } + }) + + return [min, max] +} + +const mean: AggregationFn = (columnId, leafRows) => { + let count = 0 + let sum = 0 + + leafRows.forEach(row => { + let value = row.getValue(columnId) + if (value != null && (value = +value) >= value) { + ++count, (sum += value) + } + }) + + if (count) return sum / count + + return +} + +const median: AggregationFn = (columnId, leafRows) => { + if (!leafRows.length) { + return + } + + const values = leafRows.map(row => row.getValue(columnId)) + if (!isNumberArray(values)) { + return + } + if (values.length === 1) { + return values[0] + } + + const mid = Math.floor(values.length / 2) + const nums = values.sort((a, b) => a - b) + return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1]! + nums[mid]!) / 2 +} + +const unique: AggregationFn = (columnId, leafRows) => { + return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values()) +} + +const uniqueCount: AggregationFn = (columnId, leafRows) => { + return new Set(leafRows.map(d => d.getValue(columnId))).size +} + +const count: AggregationFn = (_columnId, leafRows) => { + return leafRows.length +} + +export const aggregationFns = { + sum, + min, + max, + extent, + mean, + median, + unique, + uniqueCount, + count, +} + +export type BuiltInAggregationFn = keyof typeof aggregationFns diff --git a/node_modules/@tanstack/table-core/src/columnHelper.ts b/node_modules/@tanstack/table-core/src/columnHelper.ts new file mode 100644 index 00000000..975a5e5b --- /dev/null +++ b/node_modules/@tanstack/table-core/src/columnHelper.ts @@ -0,0 +1,91 @@ +import { + AccessorFn, + AccessorFnColumnDef, + AccessorKeyColumnDef, + DisplayColumnDef, + GroupColumnDef, + IdentifiedColumnDef, + RowData, +} from './types' +import { DeepKeys, DeepValue } from './utils' + +// type Person = { +// firstName: string +// lastName: string +// age: number +// visits: number +// status: string +// progress: number +// createdAt: Date +// nested: { +// foo: [ +// { +// bar: 'bar' +// } +// ] +// bar: { subBar: boolean }[] +// baz: { +// foo: 'foo' +// bar: { +// baz: 'baz' +// } +// } +// } +// } + +// const test: DeepKeys = 'nested.foo.0.bar' +// const test2: DeepKeys = 'nested.bar' + +// const helper = createColumnHelper() + +// helper.accessor('nested.foo', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.foo.0.bar', { +// cell: info => info.getValue(), +// }) + +// helper.accessor('nested.bar', { +// cell: info => info.getValue(), +// }) + +export type ColumnHelper = { + accessor: < + TAccessor extends AccessorFn | DeepKeys, + TValue extends TAccessor extends AccessorFn + ? TReturn + : TAccessor extends DeepKeys + ? DeepValue + : never, + >( + accessor: TAccessor, + column: TAccessor extends AccessorFn + ? DisplayColumnDef + : IdentifiedColumnDef + ) => TAccessor extends AccessorFn + ? AccessorFnColumnDef + : AccessorKeyColumnDef + display: (column: DisplayColumnDef) => DisplayColumnDef + group: (column: GroupColumnDef) => GroupColumnDef +} + +export function createColumnHelper< + TData extends RowData, +>(): ColumnHelper { + return { + accessor: (accessor, column) => { + return typeof accessor === 'function' + ? ({ + ...column, + accessorFn: accessor, + } as any) + : { + ...column, + accessorKey: accessor, + } + }, + display: column => column, + group: column => column, + } +} diff --git a/node_modules/@tanstack/table-core/src/core/cell.ts b/node_modules/@tanstack/table-core/src/core/cell.ts new file mode 100644 index 00000000..bacd6622 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/core/cell.ts @@ -0,0 +1,91 @@ +import { RowData, Cell, Column, Row, Table } from '../types' +import { Getter, getMemoOptions, memo } from '../utils' + +export interface CellContext { + cell: Cell + column: Column + getValue: Getter + renderValue: Getter + row: Row + table: Table +} + +export interface CoreCell { + /** + * The associated Column object for the cell. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#column) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + column: Column + /** + * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice: + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getcontext) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + getContext: () => CellContext + /** + * Returns the value for the cell, accessed via the associated column's accessor key or accessor function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#getvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + getValue: CellContext['getValue'] + /** + * The unique ID for the cell across the entire table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + id: string + /** + * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#rendervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + renderValue: CellContext['renderValue'] + /** + * The associated Row object for the cell. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/cell#row) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/cells) + */ + row: Row +} + +export function createCell( + table: Table, + row: Row, + column: Column, + columnId: string +): Cell { + const getRenderValue = () => + cell.getValue() ?? table.options.renderFallbackValue + + const cell: CoreCell = { + id: `${row.id}_${column.id}`, + row, + column, + getValue: () => row.getValue(columnId), + renderValue: getRenderValue, + getContext: memo( + () => [table, column, row, cell], + (table, column, row, cell) => ({ + table, + column, + row, + cell: cell as Cell, + getValue: cell.getValue, + renderValue: cell.renderValue, + }), + getMemoOptions(table.options, 'debugCells', 'cell.getContext') + ), + } + + table._features.forEach(feature => { + feature.createCell?.( + cell as Cell, + column, + row as Row, + table + ) + }, {}) + + return cell as Cell +} diff --git a/node_modules/@tanstack/table-core/src/core/column.ts b/node_modules/@tanstack/table-core/src/core/column.ts new file mode 100644 index 00000000..97ee3e68 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/core/column.ts @@ -0,0 +1,169 @@ +import { + Column, + Table, + AccessorFn, + ColumnDef, + RowData, + ColumnDefResolved, +} from '../types' +import { getMemoOptions, memo } from '../utils' + +export interface CoreColumn { + /** + * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#accessorfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + accessorFn?: AccessorFn + /** + * The original column def used to create the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columndef) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + columnDef: ColumnDef + /** + * The child column (if the column is a group column). Will be an empty array if the column is not a group column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#columns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + columns: Column[] + /** + * The depth of the column (if grouped) relative to the root column def array. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#depth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + depth: number + /** + * Returns the flattened array of this column and all child/grand-child columns for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getflatcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + getFlatColumns: () => Column[] + /** + * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#getleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + getLeafColumns: () => Column[] + /** + * The resolved unique identifier for the column resolved in this priority: + - A manual `id` property from the column def + - The accessor key from the column def + - The header string from the column def + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + id: string + /** + * The parent column for this column. Will be undefined if this is a root column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/column#parent) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-defs) + */ + parent?: Column +} + +export function createColumn( + table: Table, + columnDef: ColumnDef, + depth: number, + parent?: Column +): Column { + const defaultColumn = table._getDefaultColumnDef() + + const resolvedColumnDef = { + ...defaultColumn, + ...columnDef, + } as ColumnDefResolved + + const accessorKey = resolvedColumnDef.accessorKey + + let id = + resolvedColumnDef.id ?? + (accessorKey + ? typeof String.prototype.replaceAll === 'function' + ? accessorKey.replaceAll('.', '_') + : accessorKey.replace(/\./g, '_') + : undefined) ?? + (typeof resolvedColumnDef.header === 'string' + ? resolvedColumnDef.header + : undefined) + + let accessorFn: AccessorFn | undefined + + if (resolvedColumnDef.accessorFn) { + accessorFn = resolvedColumnDef.accessorFn + } else if (accessorKey) { + // Support deep accessor keys + if (accessorKey.includes('.')) { + accessorFn = (originalRow: TData) => { + let result = originalRow as Record + + for (const key of accessorKey.split('.')) { + result = result?.[key] + if (process.env.NODE_ENV !== 'production' && result === undefined) { + console.warn( + `"${key}" in deeply nested key "${accessorKey}" returned undefined.` + ) + } + } + + return result + } + } else { + accessorFn = (originalRow: TData) => + (originalRow as any)[resolvedColumnDef.accessorKey] + } + } + + if (!id) { + if (process.env.NODE_ENV !== 'production') { + throw new Error( + resolvedColumnDef.accessorFn + ? `Columns require an id when using an accessorFn` + : `Columns require an id when using a non-string header` + ) + } + throw new Error() + } + + let column: CoreColumn = { + id: `${String(id)}`, + accessorFn, + parent: parent as any, + depth, + columnDef: resolvedColumnDef as ColumnDef, + columns: [], + getFlatColumns: memo( + () => [true], + () => { + return [ + column as Column, + ...column.columns?.flatMap(d => d.getFlatColumns()), + ] + }, + getMemoOptions(table.options, 'debugColumns', 'column.getFlatColumns') + ), + getLeafColumns: memo( + () => [table._getOrderColumnsFn()], + orderColumns => { + if (column.columns?.length) { + let leafColumns = column.columns.flatMap(column => + column.getLeafColumns() + ) + + return orderColumns(leafColumns) + } + + return [column as Column] + }, + getMemoOptions(table.options, 'debugColumns', 'column.getLeafColumns') + ), + } + + for (const feature of table._features) { + feature.createColumn?.(column as Column, table) + } + + // Yes, we have to convert table to unknown, because we know more than the compiler here. + return column as Column +} diff --git a/node_modules/@tanstack/table-core/src/core/headers.ts b/node_modules/@tanstack/table-core/src/core/headers.ts new file mode 100644 index 00000000..263da8d2 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/core/headers.ts @@ -0,0 +1,639 @@ +import { + RowData, + Column, + Header, + HeaderGroup, + Table, + TableFeature, +} from '../types' +import { getMemoOptions, memo } from '../utils' + +const debug = 'debugHeaders' + +export interface CoreHeaderGroup { + depth: number + headers: Header[] + id: string +} + +export interface HeaderContext { + /** + * An instance of a column. + */ + column: Column + /** + * An instance of a header. + */ + header: Header + /** + * The table instance. + */ + table: Table +} + +export interface CoreHeader { + /** + * The col-span for the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#colspan) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + colSpan: number + /** + * The header's associated column object. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#column) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + column: Column + /** + * The depth of the header, zero-indexed based. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#depth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + depth: number + /** + * Returns the rendering context (or props) for column-based components like headers, footers and filters. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getcontext) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getContext: () => HeaderContext + /** + * Returns the leaf headers hierarchically nested under this header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#getleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeafHeaders: () => Header[] + /** + * The header's associated header group object. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#headergroup) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + headerGroup: HeaderGroup + /** + * The unique identifier for the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + id: string + /** + * The index for the header within the header group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#index) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + index: number + /** + * A boolean denoting if the header is a placeholder header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#isplaceholder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + isPlaceholder: boolean + /** + * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#placeholderid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + placeholderId?: string + /** + * The row-span for the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#rowspan) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + rowSpan: number + /** + * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/header#subheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + subHeaders: Header[] +} + +export interface HeadersInstance { + /** + * Returns all header groups for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getHeaderGroups: () => HeaderGroup[] + /** + * If pinning, returns the header groups for the left pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftHeaderGroups: () => HeaderGroup[] + /** + * If pinning, returns the header groups for columns that are not pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterHeaderGroups: () => HeaderGroup[] + /** + * If pinning, returns the header groups for the right pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightheadergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightHeaderGroups: () => HeaderGroup[] + + /** + * Returns the footer groups for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getFooterGroups: () => HeaderGroup[] + /** + * If pinning, returns the footer groups for the left pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftFooterGroups: () => HeaderGroup[] + /** + * If pinning, returns the footer groups for columns that are not pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterFooterGroups: () => HeaderGroup[] + /** + * If pinning, returns the footer groups for the right pinned columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightfootergroups) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightFooterGroups: () => HeaderGroup[] + + /** + * Returns headers for all columns in the table, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getFlatHeaders: () => Header[] + /** + * If pinning, returns headers for all left pinned columns in the table, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftFlatHeaders: () => Header[] + /** + * If pinning, returns headers for all columns that are not pinned, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterFlatHeaders: () => Header[] + /** + * If pinning, returns headers for all right pinned columns in the table, including parent headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightflatheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightFlatHeaders: () => Header[] + + /** + * Returns headers for all leaf columns in the table, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeafHeaders: () => Header[] + /** + * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getleftleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getLeftLeafHeaders: () => Header[] + /** + * If pinning, returns headers for all columns that are not pinned, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getcenterleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getCenterLeafHeaders: () => Header[] + /** + * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/headers#getrightleafheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/headers) + */ + getRightLeafHeaders: () => Header[] +} + +// + +function createHeader( + table: Table, + column: Column, + options: { + id?: string + isPlaceholder?: boolean + placeholderId?: string + index: number + depth: number + } +): Header { + const id = options.id ?? column.id + + let header: CoreHeader = { + id, + column, + index: options.index, + isPlaceholder: !!options.isPlaceholder, + placeholderId: options.placeholderId, + depth: options.depth, + subHeaders: [], + colSpan: 0, + rowSpan: 0, + headerGroup: null!, + getLeafHeaders: (): Header[] => { + const leafHeaders: Header[] = [] + + const recurseHeader = (h: CoreHeader) => { + if (h.subHeaders && h.subHeaders.length) { + h.subHeaders.map(recurseHeader) + } + leafHeaders.push(h as Header) + } + + recurseHeader(header) + + return leafHeaders + }, + getContext: () => ({ + table, + header: header as Header, + column, + }), + } + + table._features.forEach(feature => { + feature.createHeader?.(header as Header, table) + }) + + return header as Header +} + +export const Headers: TableFeature = { + createTable: (table: Table): void => { + // Header Groups + + table.getHeaderGroups = memo( + () => [ + table.getAllColumns(), + table.getVisibleLeafColumns(), + table.getState().columnPinning.left, + table.getState().columnPinning.right, + ], + (allColumns, leafColumns, left, right) => { + const leftColumns = + left + ?.map(columnId => leafColumns.find(d => d.id === columnId)!) + .filter(Boolean) ?? [] + + const rightColumns = + right + ?.map(columnId => leafColumns.find(d => d.id === columnId)!) + .filter(Boolean) ?? [] + + const centerColumns = leafColumns.filter( + column => !left?.includes(column.id) && !right?.includes(column.id) + ) + + const headerGroups = buildHeaderGroups( + allColumns, + [...leftColumns, ...centerColumns, ...rightColumns], + table + ) + + return headerGroups + }, + getMemoOptions(table.options, debug, 'getHeaderGroups') + ) + + table.getCenterHeaderGroups = memo( + () => [ + table.getAllColumns(), + table.getVisibleLeafColumns(), + table.getState().columnPinning.left, + table.getState().columnPinning.right, + ], + (allColumns, leafColumns, left, right) => { + leafColumns = leafColumns.filter( + column => !left?.includes(column.id) && !right?.includes(column.id) + ) + return buildHeaderGroups(allColumns, leafColumns, table, 'center') + }, + getMemoOptions(table.options, debug, 'getCenterHeaderGroups') + ) + + table.getLeftHeaderGroups = memo( + () => [ + table.getAllColumns(), + table.getVisibleLeafColumns(), + table.getState().columnPinning.left, + ], + (allColumns, leafColumns, left) => { + const orderedLeafColumns = + left + ?.map(columnId => leafColumns.find(d => d.id === columnId)!) + .filter(Boolean) ?? [] + + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left') + }, + getMemoOptions(table.options, debug, 'getLeftHeaderGroups') + ) + + table.getRightHeaderGroups = memo( + () => [ + table.getAllColumns(), + table.getVisibleLeafColumns(), + table.getState().columnPinning.right, + ], + (allColumns, leafColumns, right) => { + const orderedLeafColumns = + right + ?.map(columnId => leafColumns.find(d => d.id === columnId)!) + .filter(Boolean) ?? [] + + return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right') + }, + getMemoOptions(table.options, debug, 'getRightHeaderGroups') + ) + + // Footer Groups + + table.getFooterGroups = memo( + () => [table.getHeaderGroups()], + headerGroups => { + return [...headerGroups].reverse() + }, + getMemoOptions(table.options, debug, 'getFooterGroups') + ) + + table.getLeftFooterGroups = memo( + () => [table.getLeftHeaderGroups()], + headerGroups => { + return [...headerGroups].reverse() + }, + getMemoOptions(table.options, debug, 'getLeftFooterGroups') + ) + + table.getCenterFooterGroups = memo( + () => [table.getCenterHeaderGroups()], + headerGroups => { + return [...headerGroups].reverse() + }, + getMemoOptions(table.options, debug, 'getCenterFooterGroups') + ) + + table.getRightFooterGroups = memo( + () => [table.getRightHeaderGroups()], + headerGroups => { + return [...headerGroups].reverse() + }, + getMemoOptions(table.options, debug, 'getRightFooterGroups') + ) + + // Flat Headers + + table.getFlatHeaders = memo( + () => [table.getHeaderGroups()], + headerGroups => { + return headerGroups + .map(headerGroup => { + return headerGroup.headers + }) + .flat() + }, + getMemoOptions(table.options, debug, 'getFlatHeaders') + ) + + table.getLeftFlatHeaders = memo( + () => [table.getLeftHeaderGroups()], + left => { + return left + .map(headerGroup => { + return headerGroup.headers + }) + .flat() + }, + getMemoOptions(table.options, debug, 'getLeftFlatHeaders') + ) + + table.getCenterFlatHeaders = memo( + () => [table.getCenterHeaderGroups()], + left => { + return left + .map(headerGroup => { + return headerGroup.headers + }) + .flat() + }, + getMemoOptions(table.options, debug, 'getCenterFlatHeaders') + ) + + table.getRightFlatHeaders = memo( + () => [table.getRightHeaderGroups()], + left => { + return left + .map(headerGroup => { + return headerGroup.headers + }) + .flat() + }, + getMemoOptions(table.options, debug, 'getRightFlatHeaders') + ) + + // Leaf Headers + + table.getCenterLeafHeaders = memo( + () => [table.getCenterFlatHeaders()], + flatHeaders => { + return flatHeaders.filter(header => !header.subHeaders?.length) + }, + getMemoOptions(table.options, debug, 'getCenterLeafHeaders') + ) + + table.getLeftLeafHeaders = memo( + () => [table.getLeftFlatHeaders()], + flatHeaders => { + return flatHeaders.filter(header => !header.subHeaders?.length) + }, + getMemoOptions(table.options, debug, 'getLeftLeafHeaders') + ) + + table.getRightLeafHeaders = memo( + () => [table.getRightFlatHeaders()], + flatHeaders => { + return flatHeaders.filter(header => !header.subHeaders?.length) + }, + getMemoOptions(table.options, debug, 'getRightLeafHeaders') + ) + + table.getLeafHeaders = memo( + () => [ + table.getLeftHeaderGroups(), + table.getCenterHeaderGroups(), + table.getRightHeaderGroups(), + ], + (left, center, right) => { + return [ + ...(left[0]?.headers ?? []), + ...(center[0]?.headers ?? []), + ...(right[0]?.headers ?? []), + ] + .map(header => { + return header.getLeafHeaders() + }) + .flat() + }, + getMemoOptions(table.options, debug, 'getLeafHeaders') + ) + }, +} + +export function buildHeaderGroups( + allColumns: Column[], + columnsToGroup: Column[], + table: Table, + headerFamily?: 'center' | 'left' | 'right' +) { + // Find the max depth of the columns: + // build the leaf column row + // build each buffer row going up + // placeholder for non-existent level + // real column for existing level + + let maxDepth = 0 + + const findMaxDepth = (columns: Column[], depth = 1) => { + maxDepth = Math.max(maxDepth, depth) + + columns + .filter(column => column.getIsVisible()) + .forEach(column => { + if (column.columns?.length) { + findMaxDepth(column.columns, depth + 1) + } + }, 0) + } + + findMaxDepth(allColumns) + + let headerGroups: HeaderGroup[] = [] + + const createHeaderGroup = ( + headersToGroup: Header[], + depth: number + ) => { + // The header group we are creating + const headerGroup: HeaderGroup = { + depth, + id: [headerFamily, `${depth}`].filter(Boolean).join('_'), + headers: [], + } + + // The parent columns we're going to scan next + const pendingParentHeaders: Header[] = [] + + // Scan each column for parents + headersToGroup.forEach(headerToGroup => { + // What is the latest (last) parent column? + + const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0] + + const isLeafHeader = headerToGroup.column.depth === headerGroup.depth + + let column: Column + let isPlaceholder = false + + if (isLeafHeader && headerToGroup.column.parent) { + // The parent header is new + column = headerToGroup.column.parent + } else { + // The parent header is repeated + column = headerToGroup.column + isPlaceholder = true + } + + if ( + latestPendingParentHeader && + latestPendingParentHeader?.column === column + ) { + // This column is repeated. Add it as a sub header to the next batch + latestPendingParentHeader.subHeaders.push(headerToGroup) + } else { + // This is a new header. Let's create it + const header = createHeader(table, column, { + id: [headerFamily, depth, column.id, headerToGroup?.id] + .filter(Boolean) + .join('_'), + isPlaceholder, + placeholderId: isPlaceholder + ? `${pendingParentHeaders.filter(d => d.column === column).length}` + : undefined, + depth, + index: pendingParentHeaders.length, + }) + + // Add the headerToGroup as a subHeader of the new header + header.subHeaders.push(headerToGroup) + // Add the new header to the pendingParentHeaders to get grouped + // in the next batch + pendingParentHeaders.push(header) + } + + headerGroup.headers.push(headerToGroup) + headerToGroup.headerGroup = headerGroup + }) + + headerGroups.push(headerGroup) + + if (depth > 0) { + createHeaderGroup(pendingParentHeaders, depth - 1) + } + } + + const bottomHeaders = columnsToGroup.map((column, index) => + createHeader(table, column, { + depth: maxDepth, + index, + }) + ) + + createHeaderGroup(bottomHeaders, maxDepth - 1) + + headerGroups.reverse() + + // headerGroups = headerGroups.filter(headerGroup => { + // return !headerGroup.headers.every(header => header.isPlaceholder) + // }) + + const recurseHeadersForSpans = ( + headers: Header[] + ): { colSpan: number; rowSpan: number }[] => { + const filteredHeaders = headers.filter(header => + header.column.getIsVisible() + ) + + return filteredHeaders.map(header => { + let colSpan = 0 + let rowSpan = 0 + let childRowSpans = [0] + + if (header.subHeaders && header.subHeaders.length) { + childRowSpans = [] + + recurseHeadersForSpans(header.subHeaders).forEach( + ({ colSpan: childColSpan, rowSpan: childRowSpan }) => { + colSpan += childColSpan + childRowSpans.push(childRowSpan) + } + ) + } else { + colSpan = 1 + } + + const minChildRowSpan = Math.min(...childRowSpans) + rowSpan = rowSpan + minChildRowSpan + + header.colSpan = colSpan + header.rowSpan = rowSpan + + return { colSpan, rowSpan } + }) + } + + recurseHeadersForSpans(headerGroups[0]?.headers ?? []) + + return headerGroups +} diff --git a/node_modules/@tanstack/table-core/src/core/row.ts b/node_modules/@tanstack/table-core/src/core/row.ts new file mode 100644 index 00000000..0af28aa9 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/core/row.ts @@ -0,0 +1,201 @@ +import { RowData, Cell, Row, Table } from '../types' +import { flattenBy, getMemoOptions, memo } from '../utils' +import { createCell } from './cell' + +export interface CoreRow { + _getAllCellsByColumnId: () => Record> + _uniqueValuesCache: Record + _valuesCache: Record + /** + * The depth of the row (if nested or grouped) relative to the root row array. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#depth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + depth: number + /** + * Returns all of the cells for the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getallcells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getAllCells: () => Cell[] + /** + * Returns the leaf rows for the row, not including any parent rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getleafrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getLeafRows: () => Row[] + /** + * Returns the parent row for the row, if it exists. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrow) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getParentRow: () => Row | undefined + /** + * Returns the parent rows for the row, all the way up to a root row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getparentrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getParentRows: () => Row[] + /** + * Returns a unique array of values from the row for a given columnId. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getuniquevalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getUniqueValues: (columnId: string) => TValue[] + /** + * Returns the value from the row for a given columnId. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#getvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + getValue: (columnId: string) => TValue + /** + * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#id) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + id: string + /** + * The index of the row within its parent array (or the root data array). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#index) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + index: number + /** + * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#original) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + original: TData + /** + * An array of the original subRows as returned by the `options.getSubRows` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#originalsubrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + originalSubRows?: TData[] + /** + * If nested, this row's parent row id. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#parentid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + parentId?: string + /** + * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#rendervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + renderValue: (columnId: string) => TValue + /** + * An array of subRows for the row as returned and created by the `options.getSubRows` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/row#subrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/rows) + */ + subRows: Row[] +} + +export const createRow = ( + table: Table, + id: string, + original: TData, + rowIndex: number, + depth: number, + subRows?: Row[], + parentId?: string +): Row => { + let row: CoreRow = { + id, + index: rowIndex, + original, + depth, + parentId, + _valuesCache: {}, + _uniqueValuesCache: {}, + getValue: columnId => { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId] + } + + const column = table.getColumn(columnId) + + if (!column?.accessorFn) { + return undefined + } + + row._valuesCache[columnId] = column.accessorFn( + row.original as TData, + rowIndex + ) + + return row._valuesCache[columnId] as any + }, + getUniqueValues: columnId => { + if (row._uniqueValuesCache.hasOwnProperty(columnId)) { + return row._uniqueValuesCache[columnId] + } + + const column = table.getColumn(columnId) + + if (!column?.accessorFn) { + return undefined + } + + if (!column.columnDef.getUniqueValues) { + row._uniqueValuesCache[columnId] = [row.getValue(columnId)] + return row._uniqueValuesCache[columnId] + } + + row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues( + row.original as TData, + rowIndex + ) + + return row._uniqueValuesCache[columnId] as any + }, + renderValue: columnId => + row.getValue(columnId) ?? table.options.renderFallbackValue, + subRows: subRows ?? [], + getLeafRows: () => flattenBy(row.subRows, d => d.subRows), + getParentRow: () => + row.parentId ? table.getRow(row.parentId, true) : undefined, + getParentRows: () => { + let parentRows: Row[] = [] + let currentRow = row + while (true) { + const parentRow = currentRow.getParentRow() + if (!parentRow) break + parentRows.push(parentRow) + currentRow = parentRow + } + return parentRows.reverse() + }, + getAllCells: memo( + () => [table.getAllLeafColumns()], + leafColumns => { + return leafColumns.map(column => { + return createCell(table, row as Row, column, column.id) + }) + }, + getMemoOptions(table.options, 'debugRows', 'getAllCells') + ), + + _getAllCellsByColumnId: memo( + () => [row.getAllCells()], + allCells => { + return allCells.reduce( + (acc, cell) => { + acc[cell.column.id] = cell + return acc + }, + {} as Record> + ) + }, + getMemoOptions(table.options, 'debugRows', 'getAllCellsByColumnId') + ), + } + + for (let i = 0; i < table._features.length; i++) { + const feature = table._features[i] + feature?.createRow?.(row as Row, table) + } + + return row as Row +} diff --git a/node_modules/@tanstack/table-core/src/core/table.ts b/node_modules/@tanstack/table-core/src/core/table.ts new file mode 100644 index 00000000..00d62da9 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/core/table.ts @@ -0,0 +1,527 @@ +import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils' + +import { + Updater, + TableOptionsResolved, + TableState, + Table, + InitialTableState, + Row, + Column, + RowModel, + ColumnDef, + TableOptions, + RowData, + TableMeta, + ColumnDefResolved, + GroupColumnDef, + TableFeature, +} from '../types' + +// +import { createColumn } from './column' +import { Headers } from './headers' +// + +import { ColumnFaceting } from '../features/ColumnFaceting' +import { ColumnFiltering } from '../features/ColumnFiltering' +import { ColumnGrouping } from '../features/ColumnGrouping' +import { ColumnOrdering } from '../features/ColumnOrdering' +import { ColumnPinning } from '../features/ColumnPinning' +import { ColumnSizing } from '../features/ColumnSizing' +import { ColumnVisibility } from '../features/ColumnVisibility' +import { GlobalFaceting } from '../features/GlobalFaceting' +import { GlobalFiltering } from '../features/GlobalFiltering' +import { RowExpanding } from '../features/RowExpanding' +import { RowPagination } from '../features/RowPagination' +import { RowPinning } from '../features/RowPinning' +import { RowSelection } from '../features/RowSelection' +import { RowSorting } from '../features/RowSorting' + +const builtInFeatures = [ + Headers, + ColumnVisibility, + ColumnOrdering, + ColumnPinning, + ColumnFaceting, + ColumnFiltering, + GlobalFaceting, //depends on ColumnFaceting + GlobalFiltering, //depends on ColumnFiltering + RowSorting, + ColumnGrouping, //depends on RowSorting + RowExpanding, + RowPagination, + RowPinning, + RowSelection, + ColumnSizing, +] as const + +// + +export interface CoreTableState {} + +export interface CoreOptions { + /** + * An array of extra features that you can add to the table instance. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + _features?: TableFeature[] + /** + * Set this option to override any of the `autoReset...` feature options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + autoResetAll?: boolean + /** + * The array of column defs to use for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + columns: ColumnDef[] + /** + * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + data: TData[] + /** + * Set this option to `true` to output all debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugAll?: boolean + /** + * Set this option to `true` to output cell debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells] + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugCells?: boolean + /** + * Set this option to `true` to output column debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugColumns?: boolean + /** + * Set this option to `true` to output header debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugHeaders?: boolean + /** + * Set this option to `true` to output row debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugRows?: boolean + /** + * Set this option to `true` to output table debugging information to the console. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + debugTable?: boolean + /** + * Default column options to use for all column defs supplied to the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + defaultColumn?: Partial> + /** + * This required option is a factory for a function that computes and returns the core row model for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getCoreRowModel: (table: Table) => () => RowModel + /** + * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc. + * @example getRowId: row => row.userId + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getRowId?: (originalRow: TData, index: number, parent?: Row) => string + /** + * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row. + * @example getSubRows: row => row.subRows + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getSubRows?: (originalRow: TData, index: number) => undefined | TData[] + /** + * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state. + * + * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable. + * + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + initialState?: InitialTableState + /** + * This option is used to optionally implement the merging of table options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + mergeOptions?: ( + defaultOptions: TableOptions, + options: Partial> + ) => TableOptions + /** + * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + meta?: TableMeta + /** + * The `onStateChange` option can be used to optionally listen to state changes within the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + onStateChange: (updater: Updater) => void + /** + * Value used when the desired value is not found in the data. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + renderFallbackValue: any + /** + * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option. + * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + state: Partial +} + +export interface CoreInstance { + _features: readonly TableFeature[] + _getAllFlatColumnsById: () => Record> + _getColumnDefs: () => ColumnDef[] + _getCoreRowModel?: () => RowModel + _getDefaultColumnDef: () => Partial> + _getRowId: (_: TData, index: number, parent?: Row) => string + _queue: (cb: () => void) => void + /** + * Returns all columns in the table in their normalized and nested hierarchy. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getAllColumns: () => Column[] + /** + * Returns all columns in the table flattened to a single level. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getAllFlatColumns: () => Column[] + /** + * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getAllLeafColumns: () => Column[] + /** + * Returns a single column by its ID. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getColumn: (columnId: string) => Column | undefined + /** + * Returns the core row model before any processing has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getCoreRowModel: () => RowModel + /** + * Returns the row with the given ID. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getRow: (id: string, searchAll?: boolean) => Row + /** + * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getRowModel: () => RowModel + /** + * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + getState: () => TableState + /** + * This is the resolved initial state of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + initialState: TableState + /** + * A read-only reference to the table's current options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + options: RequiredKeys, 'state'> + /** + * Call this function to reset the table state to the initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + reset: () => void + /** + * This function can be used to update the table options. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + setOptions: (newOptions: Updater>) => void + /** + * Call this function to update the table state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables) + */ + setState: (updater: Updater) => void +} + +export function createTable( + options: TableOptionsResolved +): Table { + if ( + process.env.NODE_ENV !== 'production' && + (options.debugAll || options.debugTable) + ) { + console.info('Creating Table Instance...') + } + + const _features = [...builtInFeatures, ...(options._features ?? [])] + + let table = { _features } as unknown as Table + + const defaultOptions = table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultOptions?.(table)) + }, {}) as TableOptionsResolved + + const mergeOptions = (options: TableOptionsResolved) => { + if (table.options.mergeOptions) { + return table.options.mergeOptions(defaultOptions, options) + } + + return { + ...defaultOptions, + ...options, + } + } + + const coreInitialState: CoreTableState = {} + + let initialState = { + ...coreInitialState, + ...(options.initialState ?? {}), + } as TableState + + table._features.forEach(feature => { + initialState = (feature.getInitialState?.(initialState) ?? + initialState) as TableState + }) + + const queued: (() => void)[] = [] + let queuedTimeout = false + + const coreInstance: CoreInstance = { + _features, + options: { + ...defaultOptions, + ...options, + }, + initialState, + _queue: cb => { + queued.push(cb) + + if (!queuedTimeout) { + queuedTimeout = true + + // Schedule a microtask to run the queued callbacks after + // the current call stack (render, etc) has finished. + Promise.resolve() + .then(() => { + while (queued.length) { + queued.shift()!() + } + queuedTimeout = false + }) + .catch(error => + setTimeout(() => { + throw error + }) + ) + } + }, + reset: () => { + table.setState(table.initialState) + }, + setOptions: updater => { + const newOptions = functionalUpdate(updater, table.options) + table.options = mergeOptions(newOptions) as RequiredKeys< + TableOptionsResolved, + 'state' + > + }, + + getState: () => { + return table.options.state as TableState + }, + + setState: (updater: Updater) => { + table.options.onStateChange?.(updater) + }, + + _getRowId: (row: TData, index: number, parent?: Row) => + table.options.getRowId?.(row, index, parent) ?? + `${parent ? [parent.id, index].join('.') : index}`, + + getCoreRowModel: () => { + if (!table._getCoreRowModel) { + table._getCoreRowModel = table.options.getCoreRowModel(table) + } + + return table._getCoreRowModel!() + }, + + // The final calls start at the bottom of the model, + // expanded rows, which then work their way up + + getRowModel: () => { + return table.getPaginationRowModel() + }, + //in next version, we should just pass in the row model as the optional 2nd arg + getRow: (id: string, searchAll?: boolean) => { + let row = ( + searchAll ? table.getPrePaginationRowModel() : table.getRowModel() + ).rowsById[id] + + if (!row) { + row = table.getCoreRowModel().rowsById[id] + if (!row) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(`getRow could not find row with ID: ${id}`) + } + throw new Error() + } + } + + return row + }, + _getDefaultColumnDef: memo( + () => [table.options.defaultColumn], + defaultColumn => { + defaultColumn = (defaultColumn ?? {}) as Partial< + ColumnDef + > + + return { + header: props => { + const resolvedColumnDef = props.header.column + .columnDef as ColumnDefResolved + + if (resolvedColumnDef.accessorKey) { + return resolvedColumnDef.accessorKey + } + + if (resolvedColumnDef.accessorFn) { + return resolvedColumnDef.id + } + + return null + }, + // footer: props => props.header.column.id, + cell: props => props.renderValue()?.toString?.() ?? null, + ...table._features.reduce((obj, feature) => { + return Object.assign(obj, feature.getDefaultColumnDef?.()) + }, {}), + ...defaultColumn, + } as Partial> + }, + getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef') + ), + + _getColumnDefs: () => table.options.columns, + + getAllColumns: memo( + () => [table._getColumnDefs()], + columnDefs => { + const recurseColumns = ( + columnDefs: ColumnDef[], + parent?: Column, + depth = 0 + ): Column[] => { + return columnDefs.map(columnDef => { + const column = createColumn(table, columnDef, depth, parent) + + const groupingColumnDef = columnDef as GroupColumnDef< + TData, + unknown + > + + column.columns = groupingColumnDef.columns + ? recurseColumns(groupingColumnDef.columns, column, depth + 1) + : [] + + return column + }) + } + + return recurseColumns(columnDefs) + }, + getMemoOptions(options, 'debugColumns', 'getAllColumns') + ), + + getAllFlatColumns: memo( + () => [table.getAllColumns()], + allColumns => { + return allColumns.flatMap(column => { + return column.getFlatColumns() + }) + }, + getMemoOptions(options, 'debugColumns', 'getAllFlatColumns') + ), + + _getAllFlatColumnsById: memo( + () => [table.getAllFlatColumns()], + flatColumns => { + return flatColumns.reduce( + (acc, column) => { + acc[column.id] = column + return acc + }, + {} as Record> + ) + }, + getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById') + ), + + getAllLeafColumns: memo( + () => [table.getAllColumns(), table._getOrderColumnsFn()], + (allColumns, orderColumns) => { + let leafColumns = allColumns.flatMap(column => column.getLeafColumns()) + return orderColumns(leafColumns) + }, + getMemoOptions(options, 'debugColumns', 'getAllLeafColumns') + ), + + getColumn: columnId => { + const column = table._getAllFlatColumnsById()[columnId] + + if (process.env.NODE_ENV !== 'production' && !column) { + console.error(`[Table] Column with id '${columnId}' does not exist.`) + } + + return column + }, + } + + Object.assign(table, coreInstance) + + for (let index = 0; index < table._features.length; index++) { + const feature = table._features[index] + feature?.createTable?.(table) + } + + return table +} diff --git a/node_modules/@tanstack/table-core/src/features/ColumnFaceting.ts b/node_modules/@tanstack/table-core/src/features/ColumnFaceting.ts new file mode 100644 index 00000000..1997d0c9 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/ColumnFaceting.ts @@ -0,0 +1,84 @@ +import { RowModel } from '..' +import { Column, RowData, Table, TableFeature } from '../types' + +export interface FacetedColumn { + _getFacetedMinMaxValues?: () => undefined | [number, number] + _getFacetedRowModel?: () => RowModel + _getFacetedUniqueValues?: () => Map + /** + * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values. + * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting) + */ + getFacetedMinMaxValues: () => undefined | [number, number] + /** + * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts. + * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting) + */ + getFacetedRowModel: () => RowModel + /** + * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values. + * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting) + */ + getFacetedUniqueValues: () => Map +} + +export interface FacetedOptions { + getFacetedMinMaxValues?: ( + table: Table, + columnId: string + ) => () => undefined | [number, number] + getFacetedRowModel?: ( + table: Table, + columnId: string + ) => () => RowModel + getFacetedUniqueValues?: ( + table: Table, + columnId: string + ) => () => Map +} + +// + +export const ColumnFaceting: TableFeature = { + createColumn: ( + column: Column, + table: Table + ): void => { + column._getFacetedRowModel = + table.options.getFacetedRowModel && + table.options.getFacetedRowModel(table, column.id) + column.getFacetedRowModel = () => { + if (!column._getFacetedRowModel) { + return table.getPreFilteredRowModel() + } + + return column._getFacetedRowModel() + } + column._getFacetedUniqueValues = + table.options.getFacetedUniqueValues && + table.options.getFacetedUniqueValues(table, column.id) + column.getFacetedUniqueValues = () => { + if (!column._getFacetedUniqueValues) { + return new Map() + } + + return column._getFacetedUniqueValues() + } + column._getFacetedMinMaxValues = + table.options.getFacetedMinMaxValues && + table.options.getFacetedMinMaxValues(table, column.id) + column.getFacetedMinMaxValues = () => { + if (!column._getFacetedMinMaxValues) { + return undefined + } + + return column._getFacetedMinMaxValues() + } + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/ColumnFiltering.ts b/node_modules/@tanstack/table-core/src/features/ColumnFiltering.ts new file mode 100644 index 00000000..24ebaeda --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/ColumnFiltering.ts @@ -0,0 +1,429 @@ +import { RowModel } from '..' +import { BuiltInFilterFn, filterFns } from '../filterFns' +import { + Column, + FilterFns, + FilterMeta, + OnChangeFn, + Row, + RowData, + Table, + TableFeature, + Updater, +} from '../types' +import { functionalUpdate, isFunction, makeStateUpdater } from '../utils' + +export interface ColumnFiltersTableState { + columnFilters: ColumnFiltersState +} + +export type ColumnFiltersState = ColumnFilter[] + +export interface ColumnFilter { + id: string + value: unknown +} + +export interface ResolvedColumnFilter { + filterFn: FilterFn + id: string + resolvedValue: unknown +} + +export interface FilterFn { + ( + row: Row, + columnId: string, + filterValue: any, + addMeta: (meta: FilterMeta) => void + ): boolean + autoRemove?: ColumnFilterAutoRemoveTestFn + resolveFilterValue?: TransformFilterValueFn +} + +export type TransformFilterValueFn = ( + value: any, + column?: Column +) => unknown + +export type ColumnFilterAutoRemoveTestFn = ( + value: any, + column?: Column +) => boolean + +export type CustomFilterFns = Record< + string, + FilterFn +> + +export type FilterFnOption = + | 'auto' + | BuiltInFilterFn + | keyof FilterFns + | FilterFn + +export interface ColumnFiltersColumnDef { + /** + * Enables/disables the **column** filter for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + enableColumnFilter?: boolean + /** + * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + filterFn?: FilterFnOption +} + +export interface ColumnFiltersColumn { + /** + * Returns an automatically calculated filter function for the column based off of the columns first known value. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getAutoFilterFn: () => FilterFn | undefined + /** + * Returns whether or not the column can be **column** filtered. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getCanFilter: () => boolean + /** + * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilterFn: () => FilterFn | undefined + /** + * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilterIndex: () => number + /** + * Returns the current filter value for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilterValue: () => unknown + /** + * Returns whether or not the column is currently filtered. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getIsFiltered: () => boolean + /** + * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + setFilterValue: (updater: Updater) => void +} + +export interface ColumnFiltersRow { + /** + * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + columnFilters: Record + /** + * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + columnFiltersMeta: Record +} + +interface ColumnFiltersOptionsBase { + /** + * Enables/disables **column** filtering for all columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + enableColumnFilters?: boolean + /** + * Enables/disables all filtering for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + enableFilters?: boolean + /** + * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + filterFromLeafRows?: boolean + /** + * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered. + * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model. + * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilteredRowModel?: (table: Table) => () => RowModel + /** + * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + manualFiltering?: boolean + /** + * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on. + + * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + maxLeafRowFilterDepth?: number + /** + * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + onColumnFiltersChange?: OnChangeFn +} + +type ResolvedFilterFns = keyof FilterFns extends never + ? { + filterFns?: Record> + } + : { + filterFns: Record> + } + +export interface ColumnFiltersOptions + extends ColumnFiltersOptionsBase, + ResolvedFilterFns {} + +export interface ColumnFiltersInstance { + _getFilteredRowModel?: () => RowModel + /** + * Returns the row model for the table after **column** filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getFilteredRowModel: () => RowModel + /** + * Returns the row model for the table before any **column** filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + getPreFilteredRowModel: () => RowModel + /** + * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + resetColumnFilters: (defaultState?: boolean) => void + /** + * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + resetGlobalFilter: (defaultState?: boolean) => void + /** + * Sets or updates the `state.columnFilters` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + setColumnFilters: (updater: Updater) => void + /** + * Sets or updates the `state.globalFilter` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering) + */ + setGlobalFilter: (updater: Updater) => void +} + +// + +export const ColumnFiltering: TableFeature = { + getDefaultColumnDef: < + TData extends RowData, + >(): ColumnFiltersColumnDef => { + return { + filterFn: 'auto', + } + }, + + getInitialState: (state): ColumnFiltersTableState => { + return { + columnFilters: [], + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): ColumnFiltersOptions => { + return { + onColumnFiltersChange: makeStateUpdater('columnFilters', table), + filterFromLeafRows: false, + maxLeafRowFilterDepth: 100, + } as ColumnFiltersOptions + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.getAutoFilterFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0] + + const value = firstRow?.getValue(column.id) + + if (typeof value === 'string') { + return filterFns.includesString + } + + if (typeof value === 'number') { + return filterFns.inNumberRange + } + + if (typeof value === 'boolean') { + return filterFns.equals + } + + if (value !== null && typeof value === 'object') { + return filterFns.equals + } + + if (Array.isArray(value)) { + return filterFns.arrIncludes + } + + return filterFns.weakEquals + } + column.getFilterFn = () => { + return isFunction(column.columnDef.filterFn) + ? column.columnDef.filterFn + : column.columnDef.filterFn === 'auto' + ? column.getAutoFilterFn() + : // @ts-ignore + table.options.filterFns?.[column.columnDef.filterFn as string] ?? + filterFns[column.columnDef.filterFn as BuiltInFilterFn] + } + column.getCanFilter = () => { + return ( + (column.columnDef.enableColumnFilter ?? true) && + (table.options.enableColumnFilters ?? true) && + (table.options.enableFilters ?? true) && + !!column.accessorFn + ) + } + + column.getIsFiltered = () => column.getFilterIndex() > -1 + + column.getFilterValue = () => + table.getState().columnFilters?.find(d => d.id === column.id)?.value + + column.getFilterIndex = () => + table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1 + + column.setFilterValue = value => { + table.setColumnFilters(old => { + const filterFn = column.getFilterFn() + const previousFilter = old?.find(d => d.id === column.id) + + const newFilter = functionalUpdate( + value, + previousFilter ? previousFilter.value : undefined + ) + + // + if ( + shouldAutoRemoveFilter(filterFn as FilterFn, newFilter, column) + ) { + return old?.filter(d => d.id !== column.id) ?? [] + } + + const newFilterObj = { id: column.id, value: newFilter } + + if (previousFilter) { + return ( + old?.map(d => { + if (d.id === column.id) { + return newFilterObj + } + return d + }) ?? [] + ) + } + + if (old?.length) { + return [...old, newFilterObj] + } + + return [newFilterObj] + }) + } + }, + + createRow: ( + row: Row, + _table: Table + ): void => { + row.columnFilters = {} + row.columnFiltersMeta = {} + }, + + createTable: (table: Table): void => { + table.setColumnFilters = (updater: Updater) => { + const leafColumns = table.getAllLeafColumns() + + const updateFn = (old: ColumnFiltersState) => { + return functionalUpdate(updater, old)?.filter(filter => { + const column = leafColumns.find(d => d.id === filter.id) + + if (column) { + const filterFn = column.getFilterFn() + + if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { + return false + } + } + + return true + }) + } + + table.options.onColumnFiltersChange?.(updateFn) + } + + table.resetColumnFilters = defaultState => { + table.setColumnFilters( + defaultState ? [] : table.initialState?.columnFilters ?? [] + ) + } + + table.getPreFilteredRowModel = () => table.getCoreRowModel() + table.getFilteredRowModel = () => { + if (!table._getFilteredRowModel && table.options.getFilteredRowModel) { + table._getFilteredRowModel = table.options.getFilteredRowModel(table) + } + + if (table.options.manualFiltering || !table._getFilteredRowModel) { + return table.getPreFilteredRowModel() + } + + return table._getFilteredRowModel() + } + }, +} + +export function shouldAutoRemoveFilter( + filterFn?: FilterFn, + value?: any, + column?: Column +) { + return ( + (filterFn && filterFn.autoRemove + ? filterFn.autoRemove(value, column) + : false) || + typeof value === 'undefined' || + (typeof value === 'string' && !value) + ) +} diff --git a/node_modules/@tanstack/table-core/src/features/ColumnGrouping.ts b/node_modules/@tanstack/table-core/src/features/ColumnGrouping.ts new file mode 100644 index 00000000..21e8781c --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/ColumnGrouping.ts @@ -0,0 +1,422 @@ +import { RowModel } from '..' +import { BuiltInAggregationFn, aggregationFns } from '../aggregationFns' +import { + AggregationFns, + Cell, + Column, + ColumnDefTemplate, + OnChangeFn, + Row, + RowData, + Table, + TableFeature, + Updater, +} from '../types' +import { isFunction, makeStateUpdater } from '../utils' + +export type GroupingState = string[] + +export interface GroupingTableState { + grouping: GroupingState +} + +export type AggregationFn = ( + columnId: string, + leafRows: Row[], + childRows: Row[] +) => any + +export type CustomAggregationFns = Record> + +export type AggregationFnOption = + | 'auto' + | keyof AggregationFns + | BuiltInAggregationFn + | AggregationFn + +export interface GroupingColumnDef { + /** + * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + aggregatedCell?: ColumnDefTemplate< + ReturnType['getContext']> + > + /** + * The resolved aggregation function for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + aggregationFn?: AggregationFnOption + /** + * Enables/disables grouping for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + enableGrouping?: boolean + /** + * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupingValue?: (row: TData) => any +} + +export interface GroupingColumn { + /** + * Returns the aggregation function for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getAggregationFn: () => AggregationFn | undefined + /** + * Returns the automatically inferred aggregation function for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getAutoAggregationFn: () => AggregationFn | undefined + /** + * Returns whether or not the column can be grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getCanGroup: () => boolean + /** + * Returns the index of the column in the grouping state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupedIndex: () => number + /** + * Returns whether or not the column is currently grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsGrouped: () => boolean + /** + * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getToggleGroupingHandler: () => () => void + /** + * Toggles the grouping state of the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + toggleGrouping: () => void +} + +export interface GroupingRow { + _groupingValuesCache: Record + /** + * Returns the grouping value for any row and column (including leaf rows). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupingValue: (columnId: string) => unknown + /** + * Returns whether or not the row is currently grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsGrouped: () => boolean + /** + * If this row is grouped, this is the id of the column that this row is grouped by. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + groupingColumnId?: string + /** + * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + groupingValue?: unknown +} + +export interface GroupingCell { + /** + * Returns whether or not the cell is currently aggregated. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsAggregated: () => boolean + /** + * Returns whether or not the cell is currently grouped. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsGrouped: () => boolean + /** + * Returns whether or not the cell is currently a placeholder cell. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getIsPlaceholder: () => boolean +} + +export interface ColumnDefaultOptions { + enableGrouping: boolean + onGroupingChange: OnChangeFn +} + +interface GroupingOptionsBase { + /** + * Enables/disables grouping for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + enableGrouping?: boolean + /** + * Returns the row model after grouping has taken place, but no further. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupedRowModel?: (table: Table) => () => RowModel + /** + * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + groupedColumnMode?: false | 'reorder' | 'remove' + /** + * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + manualGrouping?: boolean + /** + * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + onGroupingChange?: OnChangeFn +} + +type ResolvedAggregationFns = keyof AggregationFns extends never + ? { + aggregationFns?: Record> + } + : { + aggregationFns: Record> + } + +export interface GroupingOptions + extends GroupingOptionsBase, + ResolvedAggregationFns {} + +export type GroupingColumnMode = false | 'reorder' | 'remove' + +export interface GroupingInstance { + _getGroupedRowModel?: () => RowModel + /** + * Returns the row model for the table after grouping has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getGroupedRowModel: () => RowModel + /** + * Returns the row model for the table before any grouping has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + getPreGroupedRowModel: () => RowModel + /** + * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + resetGrouping: (defaultState?: boolean) => void + /** + * Updates the grouping state of the table via an update function or value. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping) + */ + setGrouping: (updater: Updater) => void +} + +// + +export const ColumnGrouping: TableFeature = { + getDefaultColumnDef: (): GroupingColumnDef< + TData, + unknown + > => { + return { + aggregatedCell: props => (props.getValue() as any)?.toString?.() ?? null, + aggregationFn: 'auto', + } + }, + + getInitialState: (state): GroupingTableState => { + return { + grouping: [], + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): GroupingOptions => { + return { + onGroupingChange: makeStateUpdater('grouping', table), + groupedColumnMode: 'reorder', + } + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.toggleGrouping = () => { + table.setGrouping(old => { + // Find any existing grouping for this column + if (old?.includes(column.id)) { + return old.filter(d => d !== column.id) + } + + return [...(old ?? []), column.id] + }) + } + + column.getCanGroup = () => { + return ( + (column.columnDef.enableGrouping ?? true) && + (table.options.enableGrouping ?? true) && + (!!column.accessorFn || !!column.columnDef.getGroupingValue) + ) + } + + column.getIsGrouped = () => { + return table.getState().grouping?.includes(column.id) + } + + column.getGroupedIndex = () => table.getState().grouping?.indexOf(column.id) + + column.getToggleGroupingHandler = () => { + const canGroup = column.getCanGroup() + + return () => { + if (!canGroup) return + column.toggleGrouping() + } + } + column.getAutoAggregationFn = () => { + const firstRow = table.getCoreRowModel().flatRows[0] + + const value = firstRow?.getValue(column.id) + + if (typeof value === 'number') { + return aggregationFns.sum + } + + if (Object.prototype.toString.call(value) === '[object Date]') { + return aggregationFns.extent + } + } + column.getAggregationFn = () => { + if (!column) { + throw new Error() + } + + return isFunction(column.columnDef.aggregationFn) + ? column.columnDef.aggregationFn + : column.columnDef.aggregationFn === 'auto' + ? column.getAutoAggregationFn() + : table.options.aggregationFns?.[ + column.columnDef.aggregationFn as string + ] ?? + aggregationFns[ + column.columnDef.aggregationFn as BuiltInAggregationFn + ] + } + }, + + createTable: (table: Table): void => { + table.setGrouping = updater => table.options.onGroupingChange?.(updater) + + table.resetGrouping = defaultState => { + table.setGrouping(defaultState ? [] : table.initialState?.grouping ?? []) + } + + table.getPreGroupedRowModel = () => table.getFilteredRowModel() + table.getGroupedRowModel = () => { + if (!table._getGroupedRowModel && table.options.getGroupedRowModel) { + table._getGroupedRowModel = table.options.getGroupedRowModel(table) + } + + if (table.options.manualGrouping || !table._getGroupedRowModel) { + return table.getPreGroupedRowModel() + } + + return table._getGroupedRowModel() + } + }, + + createRow: ( + row: Row, + table: Table + ): void => { + row.getIsGrouped = () => !!row.groupingColumnId + row.getGroupingValue = columnId => { + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId] + } + + const column = table.getColumn(columnId) + + if (!column?.columnDef.getGroupingValue) { + return row.getValue(columnId) + } + + row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue( + row.original + ) + + return row._groupingValuesCache[columnId] + } + row._groupingValuesCache = {} + }, + + createCell: ( + cell: Cell, + column: Column, + row: Row, + table: Table + ): void => { + const getRenderValue = () => + cell.getValue() ?? table.options.renderFallbackValue + + cell.getIsGrouped = () => + column.getIsGrouped() && column.id === row.groupingColumnId + cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped() + cell.getIsAggregated = () => + !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!row.subRows?.length + }, +} + +export function orderColumns( + leafColumns: Column[], + grouping: string[], + groupedColumnMode?: GroupingColumnMode +) { + if (!grouping?.length || !groupedColumnMode) { + return leafColumns + } + + const nonGroupingColumns = leafColumns.filter( + col => !grouping.includes(col.id) + ) + + if (groupedColumnMode === 'remove') { + return nonGroupingColumns + } + + const groupingColumns = grouping + .map(g => leafColumns.find(col => col.id === g)!) + .filter(Boolean) + + return [...groupingColumns, ...nonGroupingColumns] +} diff --git a/node_modules/@tanstack/table-core/src/features/ColumnOrdering.ts b/node_modules/@tanstack/table-core/src/features/ColumnOrdering.ts new file mode 100644 index 00000000..c64370ef --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/ColumnOrdering.ts @@ -0,0 +1,161 @@ +import { getMemoOptions, makeStateUpdater, memo } from '../utils' + +import { + Column, + OnChangeFn, + RowData, + Table, + TableFeature, + Updater, +} from '../types' + +import { orderColumns } from './ColumnGrouping' +import { ColumnPinningPosition, _getVisibleLeafColumns } from '..' + +export interface ColumnOrderTableState { + columnOrder: ColumnOrderState +} + +export type ColumnOrderState = string[] + +export interface ColumnOrderOptions { + /** + * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + onColumnOrderChange?: OnChangeFn +} + +export interface ColumnOrderColumn { + /** + * Returns the index of the column in the order of the visible columns. Optionally pass a `position` parameter to get the index of the column in a sub-section of the table + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + getIndex: (position?: ColumnPinningPosition | 'center') => number + /** + * Returns `true` if the column is the first column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the first in a sub-section of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getisfirstcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + getIsFirstColumn: (position?: ColumnPinningPosition | 'center') => boolean + /** + * Returns `true` if the column is the last column in the order of the visible columns. Optionally pass a `position` parameter to check if the column is the last in a sub-section of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#getislastcolumn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + getIsLastColumn: (position?: ColumnPinningPosition | 'center') => boolean +} + +export interface ColumnOrderDefaultOptions { + onColumnOrderChange: OnChangeFn +} + +export interface ColumnOrderInstance { + _getOrderColumnsFn: () => ( + columns: Column[] + ) => Column[] + /** + * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + resetColumnOrder: (defaultState?: boolean) => void + /** + * Sets or updates the `state.columnOrder` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering) + */ + setColumnOrder: (updater: Updater) => void +} + +// + +export const ColumnOrdering: TableFeature = { + getInitialState: (state): ColumnOrderTableState => { + return { + columnOrder: [], + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): ColumnOrderDefaultOptions => { + return { + onColumnOrderChange: makeStateUpdater('columnOrder', table), + } + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.getIndex = memo( + position => [_getVisibleLeafColumns(table, position)], + columns => columns.findIndex(d => d.id === column.id), + getMemoOptions(table.options, 'debugColumns', 'getIndex') + ) + column.getIsFirstColumn = position => { + const columns = _getVisibleLeafColumns(table, position) + return columns[0]?.id === column.id + } + column.getIsLastColumn = position => { + const columns = _getVisibleLeafColumns(table, position) + return columns[columns.length - 1]?.id === column.id + } + }, + + createTable: (table: Table): void => { + table.setColumnOrder = updater => + table.options.onColumnOrderChange?.(updater) + table.resetColumnOrder = defaultState => { + table.setColumnOrder( + defaultState ? [] : table.initialState.columnOrder ?? [] + ) + } + table._getOrderColumnsFn = memo( + () => [ + table.getState().columnOrder, + table.getState().grouping, + table.options.groupedColumnMode, + ], + (columnOrder, grouping, groupedColumnMode) => + (columns: Column[]) => { + // Sort grouped columns to the start of the column list + // before the headers are built + let orderedColumns: Column[] = [] + + // If there is no order, return the normal columns + if (!columnOrder?.length) { + orderedColumns = columns + } else { + const columnOrderCopy = [...columnOrder] + + // If there is an order, make a copy of the columns + const columnsCopy = [...columns] + + // And make a new ordered array of the columns + + // Loop over the columns and place them in order into the new array + while (columnsCopy.length && columnOrderCopy.length) { + const targetColumnId = columnOrderCopy.shift() + const foundIndex = columnsCopy.findIndex( + d => d.id === targetColumnId + ) + if (foundIndex > -1) { + orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!) + } + } + + // If there are any columns left, add them to the end + orderedColumns = [...orderedColumns, ...columnsCopy] + } + + return orderColumns(orderedColumns, grouping, groupedColumnMode) + }, + getMemoOptions(table.options, 'debugTable', '_getOrderColumnsFn') + ) + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/ColumnPinning.ts b/node_modules/@tanstack/table-core/src/features/ColumnPinning.ts new file mode 100644 index 00000000..1c0ef707 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/ColumnPinning.ts @@ -0,0 +1,336 @@ +import { + OnChangeFn, + Updater, + Table, + Column, + Row, + Cell, + RowData, + TableFeature, +} from '../types' +import { getMemoOptions, makeStateUpdater, memo } from '../utils' + +export type ColumnPinningPosition = false | 'left' | 'right' + +export interface ColumnPinningState { + left?: string[] + right?: string[] +} + +export interface ColumnPinningTableState { + columnPinning: ColumnPinningState +} + +export interface ColumnPinningOptions { + /** + * Enables/disables column pinning for the table. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablecolumnpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + enableColumnPinning?: boolean + /** + * @deprecated Use `enableColumnPinning` or `enableRowPinning` instead. + * Enables/disables all pinning for the table. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + enablePinning?: boolean + /** + * If provided, this function will be called with an `updaterFn` when `state.columnPinning` changes. This overrides the default internal state management, so you will also need to supply `state.columnPinning` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#oncolumnpinningchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/oncolumnpinningchange) + */ + onColumnPinningChange?: OnChangeFn +} + +export interface ColumnPinningDefaultOptions { + onColumnPinningChange: OnChangeFn +} + +export interface ColumnPinningColumnDef { + /** + * Enables/disables column pinning for this column. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#enablepinning-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + enablePinning?: boolean +} + +export interface ColumnPinningColumn { + /** + * Returns whether or not the column can be pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcanpin) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getCanPin: () => boolean + /** + * Returns the pinned position of the column. (`'left'`, `'right'` or `false`) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getispinned) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getIsPinned: () => ColumnPinningPosition + /** + * Returns the numeric pinned index of the column within a pinned column group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getpinnedindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getPinnedIndex: () => number + /** + * Pins a column to the `'left'` or `'right'`, or unpins the column to the center if `false` is passed. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#pin) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + pin: (position: ColumnPinningPosition) => void +} + +export interface ColumnPinningRow { + /** + * Returns all center pinned (unpinned) leaf cells in the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcentervisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getCenterVisibleCells: () => Cell[] + /** + * Returns all left pinned leaf cells in the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftvisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getLeftVisibleCells: () => Cell[] + /** + * Returns all right pinned leaf cells in the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightvisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getRightVisibleCells: () => Cell[] +} + +export interface ColumnPinningInstance { + /** + * Returns all center pinned (unpinned) leaf columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getcenterleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getCenterLeafColumns: () => Column[] + /** + * Returns whether or not any columns are pinned. Optionally specify to only check for pinned columns in either the `left` or `right` position. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getissomecolumnspinned) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean + /** + * Returns all left pinned leaf columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getleftleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getLeftLeafColumns: () => Column[] + /** + * Returns all right pinned leaf columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#getrightleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + getRightLeafColumns: () => Column[] + /** + * Resets the **columnPinning** state to `initialState.columnPinning`, or `true` can be passed to force a default blank state reset to `{ left: [], right: [], }`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#resetcolumnpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + resetColumnPinning: (defaultState?: boolean) => void + /** + * Sets or updates the `state.columnPinning` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#setcolumnpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning) + */ + setColumnPinning: (updater: Updater) => void +} + +// + +const getDefaultColumnPinningState = (): ColumnPinningState => ({ + left: [], + right: [], +}) + +export const ColumnPinning: TableFeature = { + getInitialState: (state): ColumnPinningTableState => { + return { + columnPinning: getDefaultColumnPinningState(), + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): ColumnPinningDefaultOptions => { + return { + onColumnPinningChange: makeStateUpdater('columnPinning', table), + } + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.pin = position => { + const columnIds = column + .getLeafColumns() + .map(d => d.id) + .filter(Boolean) as string[] + + table.setColumnPinning(old => { + if (position === 'right') { + return { + left: (old?.left ?? []).filter(d => !columnIds?.includes(d)), + right: [ + ...(old?.right ?? []).filter(d => !columnIds?.includes(d)), + ...columnIds, + ], + } + } + + if (position === 'left') { + return { + left: [ + ...(old?.left ?? []).filter(d => !columnIds?.includes(d)), + ...columnIds, + ], + right: (old?.right ?? []).filter(d => !columnIds?.includes(d)), + } + } + + return { + left: (old?.left ?? []).filter(d => !columnIds?.includes(d)), + right: (old?.right ?? []).filter(d => !columnIds?.includes(d)), + } + }) + } + + column.getCanPin = () => { + const leafColumns = column.getLeafColumns() + + return leafColumns.some( + d => + (d.columnDef.enablePinning ?? true) && + (table.options.enableColumnPinning ?? + table.options.enablePinning ?? + true) + ) + } + + column.getIsPinned = () => { + const leafColumnIds = column.getLeafColumns().map(d => d.id) + + const { left, right } = table.getState().columnPinning + + const isLeft = leafColumnIds.some(d => left?.includes(d)) + const isRight = leafColumnIds.some(d => right?.includes(d)) + + return isLeft ? 'left' : isRight ? 'right' : false + } + + column.getPinnedIndex = () => { + const position = column.getIsPinned() + + return position + ? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1 + : 0 + } + }, + + createRow: ( + row: Row, + table: Table + ): void => { + row.getCenterVisibleCells = memo( + () => [ + row._getAllVisibleCells(), + table.getState().columnPinning.left, + table.getState().columnPinning.right, + ], + (allCells, left, right) => { + const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])] + + return allCells.filter(d => !leftAndRight.includes(d.column.id)) + }, + getMemoOptions(table.options, 'debugRows', 'getCenterVisibleCells') + ) + row.getLeftVisibleCells = memo( + () => [row._getAllVisibleCells(), table.getState().columnPinning.left], + (allCells, left) => { + const cells = (left ?? []) + .map(columnId => allCells.find(cell => cell.column.id === columnId)!) + .filter(Boolean) + .map(d => ({ ...d, position: 'left' }) as Cell) + + return cells + }, + getMemoOptions(table.options, 'debugRows', 'getLeftVisibleCells') + ) + row.getRightVisibleCells = memo( + () => [row._getAllVisibleCells(), table.getState().columnPinning.right], + (allCells, right) => { + const cells = (right ?? []) + .map(columnId => allCells.find(cell => cell.column.id === columnId)!) + .filter(Boolean) + .map(d => ({ ...d, position: 'right' }) as Cell) + + return cells + }, + getMemoOptions(table.options, 'debugRows', 'getRightVisibleCells') + ) + }, + + createTable: (table: Table): void => { + table.setColumnPinning = updater => + table.options.onColumnPinningChange?.(updater) + + table.resetColumnPinning = defaultState => + table.setColumnPinning( + defaultState + ? getDefaultColumnPinningState() + : table.initialState?.columnPinning ?? getDefaultColumnPinningState() + ) + + table.getIsSomeColumnsPinned = position => { + const pinningState = table.getState().columnPinning + + if (!position) { + return Boolean(pinningState.left?.length || pinningState.right?.length) + } + return Boolean(pinningState[position]?.length) + } + + table.getLeftLeafColumns = memo( + () => [table.getAllLeafColumns(), table.getState().columnPinning.left], + (allColumns, left) => { + return (left ?? []) + .map(columnId => allColumns.find(column => column.id === columnId)!) + .filter(Boolean) + }, + getMemoOptions(table.options, 'debugColumns', 'getLeftLeafColumns') + ) + + table.getRightLeafColumns = memo( + () => [table.getAllLeafColumns(), table.getState().columnPinning.right], + (allColumns, right) => { + return (right ?? []) + .map(columnId => allColumns.find(column => column.id === columnId)!) + .filter(Boolean) + }, + getMemoOptions(table.options, 'debugColumns', 'getRightLeafColumns') + ) + + table.getCenterLeafColumns = memo( + () => [ + table.getAllLeafColumns(), + table.getState().columnPinning.left, + table.getState().columnPinning.right, + ], + (allColumns, left, right) => { + const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])] + + return allColumns.filter(d => !leftAndRight.includes(d.id)) + }, + getMemoOptions(table.options, 'debugColumns', 'getCenterLeafColumns') + ) + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/ColumnSizing.ts b/node_modules/@tanstack/table-core/src/features/ColumnSizing.ts new file mode 100644 index 00000000..e6e66282 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/ColumnSizing.ts @@ -0,0 +1,579 @@ +import { _getVisibleLeafColumns } from '..' +import { + RowData, + Column, + Header, + OnChangeFn, + Table, + Updater, + TableFeature, +} from '../types' +import { getMemoOptions, makeStateUpdater, memo } from '../utils' +import { ColumnPinningPosition } from './ColumnPinning' +import { safelyAccessDocument } from '../utils/document' + +// + +export interface ColumnSizingTableState { + columnSizing: ColumnSizingState + columnSizingInfo: ColumnSizingInfoState +} + +export type ColumnSizingState = Record + +export interface ColumnSizingInfoState { + columnSizingStart: [string, number][] + deltaOffset: null | number + deltaPercentage: null | number + isResizingColumn: false | string + startOffset: null | number + startSize: null | number +} + +export type ColumnResizeMode = 'onChange' | 'onEnd' + +export type ColumnResizeDirection = 'ltr' | 'rtl' + +export interface ColumnSizingOptions { + /** + * Determines when the columnSizing state is updated. `onChange` updates the state when the user is dragging the resize handle. `onEnd` updates the state when the user releases the resize handle. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnresizemode) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + columnResizeMode?: ColumnResizeMode + /** + * Enables or disables column resizing for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enablecolumnresizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + enableColumnResizing?: boolean + /** + * Enables or disables right-to-left support for resizing the column. defaults to 'ltr'. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#columnResizeDirection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + columnResizeDirection?: ColumnResizeDirection + /** + * If provided, this function will be called with an `updaterFn` when `state.columnSizing` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizing` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizingchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + onColumnSizingChange?: OnChangeFn + /** + * If provided, this function will be called with an `updaterFn` when `state.columnSizingInfo` changes. This overrides the default internal state management, so you will also need to supply `state.columnSizingInfo` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#oncolumnsizinginfochange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + onColumnSizingInfoChange?: OnChangeFn +} + +export type ColumnSizingDefaultOptions = Pick< + ColumnSizingOptions, + | 'columnResizeMode' + | 'onColumnSizingChange' + | 'onColumnSizingInfoChange' + | 'columnResizeDirection' +> + +export interface ColumnSizingInstance { + /** + * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcentertotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getCenterTotalSize: () => number + /** + * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getlefttotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getLeftTotalSize: () => number + /** + * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getrighttotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getRightTotalSize: () => number + /** + * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#gettotalsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getTotalSize: () => number + /** + * Resets column sizing to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetcolumnsizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + resetColumnSizing: (defaultState?: boolean) => void + /** + * Resets column sizing info to its initial state. If `defaultState` is `true`, the default state for the table will be used instead of the initialValue provided to the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetheadersizeinfo) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + resetHeaderSizeInfo: (defaultState?: boolean) => void + /** + * Sets the column sizing state using an updater function or a value. This will trigger the underlying `onColumnSizingChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + setColumnSizing: (updater: Updater) => void + /** + * Sets the column sizing info state using an updater function or a value. This will trigger the underlying `onColumnSizingInfoChange` function if one is passed to the table options, otherwise the state will be managed automatically by the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#setcolumnsizinginfo) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + setColumnSizingInfo: (updater: Updater) => void +} + +export interface ColumnSizingColumnDef { + /** + * Enables or disables column resizing for the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#enableresizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + enableResizing?: boolean + /** + * The maximum allowed size for the column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#maxsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + maxSize?: number + /** + * The minimum allowed size for the column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#minsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + minSize?: number + /** + * The desired size for the column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#size) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + size?: number +} + +export interface ColumnSizingColumn { + /** + * Returns `true` if the column can be resized. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getcanresize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getCanResize: () => boolean + /** + * Returns `true` if the column is currently being resized. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getisresizing) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getIsResizing: () => boolean + /** + * Returns the current size of the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getSize: () => number + /** + * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getStart: (position?: ColumnPinningPosition | 'center') => number + /** + * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column. + */ + getAfter: (position?: ColumnPinningPosition | 'center') => number + /** + * Resets the column to its initial size. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#resetsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + resetSize: () => void +} + +export interface ColumnSizingHeader { + /** + * Returns an event handler function that can be used to resize the header. It can be used as an: + * - `onMouseDown` handler + * - `onTouchStart` handler + * + * The dragging and release events are automatically handled for you. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getresizehandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getResizeHandler: (context?: Document) => (event: unknown) => void + /** + * Returns the current size of the header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getsize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getSize: () => number + /** + * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding headers. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#getstart) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing) + */ + getStart: (position?: ColumnPinningPosition) => number +} + +// + +export const defaultColumnSizing = { + size: 150, + minSize: 20, + maxSize: Number.MAX_SAFE_INTEGER, +} + +const getDefaultColumnSizingInfoState = (): ColumnSizingInfoState => ({ + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + isResizingColumn: false, + columnSizingStart: [], +}) + +export const ColumnSizing: TableFeature = { + getDefaultColumnDef: (): ColumnSizingColumnDef => { + return defaultColumnSizing + }, + getInitialState: (state): ColumnSizingTableState => { + return { + columnSizing: {}, + columnSizingInfo: getDefaultColumnSizingInfoState(), + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): ColumnSizingDefaultOptions => { + return { + columnResizeMode: 'onEnd', + columnResizeDirection: 'ltr', + onColumnSizingChange: makeStateUpdater('columnSizing', table), + onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table), + } + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.getSize = () => { + const columnSize = table.getState().columnSizing[column.id] + + return Math.min( + Math.max( + column.columnDef.minSize ?? defaultColumnSizing.minSize, + columnSize ?? column.columnDef.size ?? defaultColumnSizing.size + ), + column.columnDef.maxSize ?? defaultColumnSizing.maxSize + ) + } + + column.getStart = memo( + position => [ + position, + _getVisibleLeafColumns(table, position), + table.getState().columnSizing, + ], + (position, columns) => + columns + .slice(0, column.getIndex(position)) + .reduce((sum, column) => sum + column.getSize(), 0), + getMemoOptions(table.options, 'debugColumns', 'getStart') + ) + + column.getAfter = memo( + position => [ + position, + _getVisibleLeafColumns(table, position), + table.getState().columnSizing, + ], + (position, columns) => + columns + .slice(column.getIndex(position) + 1) + .reduce((sum, column) => sum + column.getSize(), 0), + getMemoOptions(table.options, 'debugColumns', 'getAfter') + ) + + column.resetSize = () => { + table.setColumnSizing(({ [column.id]: _, ...rest }) => { + return rest + }) + } + column.getCanResize = () => { + return ( + (column.columnDef.enableResizing ?? true) && + (table.options.enableColumnResizing ?? true) + ) + } + column.getIsResizing = () => { + return table.getState().columnSizingInfo.isResizingColumn === column.id + } + }, + + createHeader: ( + header: Header, + table: Table + ): void => { + header.getSize = () => { + let sum = 0 + + const recurse = (header: Header) => { + if (header.subHeaders.length) { + header.subHeaders.forEach(recurse) + } else { + sum += header.column.getSize() ?? 0 + } + } + + recurse(header) + + return sum + } + header.getStart = () => { + if (header.index > 0) { + const prevSiblingHeader = header.headerGroup.headers[header.index - 1]! + return prevSiblingHeader.getStart() + prevSiblingHeader.getSize() + } + + return 0 + } + header.getResizeHandler = _contextDocument => { + const column = table.getColumn(header.column.id) + const canResize = column?.getCanResize() + + return (e: unknown) => { + if (!column || !canResize) { + return + } + + ;(e as any).persist?.() + + if (isTouchStartEvent(e)) { + // lets not respond to multiple touches (e.g. 2 or 3 fingers) + if (e.touches && e.touches.length > 1) { + return + } + } + + const startSize = header.getSize() + + const columnSizingStart: [string, number][] = header + ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) + : [[column.id, column.getSize()]] + + const clientX = isTouchStartEvent(e) + ? Math.round(e.touches[0]!.clientX) + : (e as MouseEvent).clientX + + const newColumnSizing: ColumnSizingState = {} + + const updateOffset = ( + eventType: 'move' | 'end', + clientXPos?: number + ) => { + if (typeof clientXPos !== 'number') { + return + } + + table.setColumnSizingInfo(old => { + const deltaDirection = + table.options.columnResizeDirection === 'rtl' ? -1 : 1 + const deltaOffset = + (clientXPos - (old?.startOffset ?? 0)) * deltaDirection + const deltaPercentage = Math.max( + deltaOffset / (old?.startSize ?? 0), + -0.999999 + ) + + old.columnSizingStart.forEach(([columnId, headerSize]) => { + newColumnSizing[columnId] = + Math.round( + Math.max(headerSize + headerSize * deltaPercentage, 0) * 100 + ) / 100 + }) + + return { + ...old, + deltaOffset, + deltaPercentage, + } + }) + + if ( + table.options.columnResizeMode === 'onChange' || + eventType === 'end' + ) { + table.setColumnSizing(old => ({ + ...old, + ...newColumnSizing, + })) + } + } + + const onMove = (clientXPos?: number) => updateOffset('move', clientXPos) + + const onEnd = (clientXPos?: number) => { + updateOffset('end', clientXPos) + + table.setColumnSizingInfo(old => ({ + ...old, + isResizingColumn: false, + startOffset: null, + startSize: null, + deltaOffset: null, + deltaPercentage: null, + columnSizingStart: [], + })) + } + + const contextDocument = safelyAccessDocument(_contextDocument) + + const mouseEvents = { + moveHandler: (e: MouseEvent) => onMove(e.clientX), + upHandler: (e: MouseEvent) => { + contextDocument?.removeEventListener( + 'mousemove', + mouseEvents.moveHandler + ) + contextDocument?.removeEventListener( + 'mouseup', + mouseEvents.upHandler + ) + onEnd(e.clientX) + }, + } + + const touchEvents = { + moveHandler: (e: TouchEvent) => { + if (e.cancelable) { + e.preventDefault() + e.stopPropagation() + } + onMove(e.touches[0]!.clientX) + return false + }, + upHandler: (e: TouchEvent) => { + contextDocument?.removeEventListener( + 'touchmove', + touchEvents.moveHandler + ) + contextDocument?.removeEventListener( + 'touchend', + touchEvents.upHandler + ) + if (e.cancelable) { + e.preventDefault() + e.stopPropagation() + } + onEnd(e.touches[0]?.clientX) + }, + } + + const passiveIfSupported = passiveEventSupported() + ? { passive: false } + : false + + if (isTouchStartEvent(e)) { + contextDocument?.addEventListener( + 'touchmove', + touchEvents.moveHandler, + passiveIfSupported + ) + contextDocument?.addEventListener( + 'touchend', + touchEvents.upHandler, + passiveIfSupported + ) + } else { + contextDocument?.addEventListener( + 'mousemove', + mouseEvents.moveHandler, + passiveIfSupported + ) + contextDocument?.addEventListener( + 'mouseup', + mouseEvents.upHandler, + passiveIfSupported + ) + } + + table.setColumnSizingInfo(old => ({ + ...old, + startOffset: clientX, + startSize, + deltaOffset: 0, + deltaPercentage: 0, + columnSizingStart, + isResizingColumn: column.id, + })) + } + } + }, + + createTable: (table: Table): void => { + table.setColumnSizing = updater => + table.options.onColumnSizingChange?.(updater) + table.setColumnSizingInfo = updater => + table.options.onColumnSizingInfoChange?.(updater) + table.resetColumnSizing = defaultState => { + table.setColumnSizing( + defaultState ? {} : table.initialState.columnSizing ?? {} + ) + } + table.resetHeaderSizeInfo = defaultState => { + table.setColumnSizingInfo( + defaultState + ? getDefaultColumnSizingInfoState() + : table.initialState.columnSizingInfo ?? + getDefaultColumnSizingInfoState() + ) + } + table.getTotalSize = () => + table.getHeaderGroups()[0]?.headers.reduce((sum, header) => { + return sum + header.getSize() + }, 0) ?? 0 + table.getLeftTotalSize = () => + table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => { + return sum + header.getSize() + }, 0) ?? 0 + table.getCenterTotalSize = () => + table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => { + return sum + header.getSize() + }, 0) ?? 0 + table.getRightTotalSize = () => + table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => { + return sum + header.getSize() + }, 0) ?? 0 + }, +} + +let passiveSupported: boolean | null = null +export function passiveEventSupported() { + if (typeof passiveSupported === 'boolean') return passiveSupported + + let supported = false + try { + const options = { + get passive() { + supported = true + return false + }, + } + + const noop = () => {} + + window.addEventListener('test', noop, options) + window.removeEventListener('test', noop) + } catch (err) { + supported = false + } + passiveSupported = supported + return passiveSupported +} + +function isTouchStartEvent(e: unknown): e is TouchEvent { + return (e as TouchEvent).type === 'touchstart' +} diff --git a/node_modules/@tanstack/table-core/src/features/ColumnVisibility.ts b/node_modules/@tanstack/table-core/src/features/ColumnVisibility.ts new file mode 100644 index 00000000..f37e57be --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/ColumnVisibility.ts @@ -0,0 +1,317 @@ +import { ColumnPinningPosition } from '..' +import { + Cell, + Column, + OnChangeFn, + Table, + Updater, + Row, + RowData, + TableFeature, +} from '../types' +import { getMemoOptions, makeStateUpdater, memo } from '../utils' + +export type VisibilityState = Record + +export interface VisibilityTableState { + columnVisibility: VisibilityState +} + +export interface VisibilityOptions { + /** + * Whether to enable column hiding. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#enablehiding) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + enableHiding?: boolean + /** + * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + onColumnVisibilityChange?: OnChangeFn +} + +export type VisibilityDefaultOptions = Pick< + VisibilityOptions, + 'onColumnVisibilityChange' +> + +export interface VisibilityInstance { + /** + * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getCenterVisibleLeafColumns: () => Column[] + /** + * Returns whether all columns are visible + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getIsAllColumnsVisible: () => boolean + /** + * Returns whether any columns are visible + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getIsSomeColumnsVisible: () => boolean + /** + * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getLeftVisibleLeafColumns: () => Column[] + /** + * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getRightVisibleLeafColumns: () => Column[] + /** + * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void + /** + * Returns a flat array of columns that are visible, including parent columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getVisibleFlatColumns: () => Column[] + /** + * Returns a flat array of leaf-node columns that are visible. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getVisibleLeafColumns: () => Column[] + /** + * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}` + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + resetColumnVisibility: (defaultState?: boolean) => void + /** + * Sets or updates the `state.columnVisibility` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + setColumnVisibility: (updater: Updater) => void + /** + * Toggles the visibility of all columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + toggleAllColumnsVisible: (value?: boolean) => void +} + +export interface VisibilityColumnDef { + enableHiding?: boolean +} + +export interface VisibilityRow { + _getAllVisibleCells: () => Cell[] + /** + * Returns an array of cells that account for column visibility for the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getVisibleCells: () => Cell[] +} + +export interface VisibilityColumn { + /** + * Returns whether the column can be hidden + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getCanHide: () => boolean + /** + * Returns whether the column is visible + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getIsVisible: () => boolean + /** + * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + getToggleVisibilityHandler: () => (event: unknown) => void + /** + * Toggles the visibility of the column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility) + */ + toggleVisibility: (value?: boolean) => void +} + +// + +export const ColumnVisibility: TableFeature = { + getInitialState: (state): VisibilityTableState => { + return { + columnVisibility: {}, + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): VisibilityDefaultOptions => { + return { + onColumnVisibilityChange: makeStateUpdater('columnVisibility', table), + } + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.toggleVisibility = value => { + if (column.getCanHide()) { + table.setColumnVisibility(old => ({ + ...old, + [column.id]: value ?? !column.getIsVisible(), + })) + } + } + column.getIsVisible = () => { + const childColumns = column.columns + return ( + (childColumns.length + ? childColumns.some(c => c.getIsVisible()) + : table.getState().columnVisibility?.[column.id]) ?? true + ) + } + + column.getCanHide = () => { + return ( + (column.columnDef.enableHiding ?? true) && + (table.options.enableHiding ?? true) + ) + } + column.getToggleVisibilityHandler = () => { + return (e: unknown) => { + column.toggleVisibility?.( + ((e as MouseEvent).target as HTMLInputElement).checked + ) + } + } + }, + + createRow: ( + row: Row, + table: Table + ): void => { + row._getAllVisibleCells = memo( + () => [row.getAllCells(), table.getState().columnVisibility], + cells => { + return cells.filter(cell => cell.column.getIsVisible()) + }, + getMemoOptions(table.options, 'debugRows', '_getAllVisibleCells') + ) + row.getVisibleCells = memo( + () => [ + row.getLeftVisibleCells(), + row.getCenterVisibleCells(), + row.getRightVisibleCells(), + ], + (left, center, right) => [...left, ...center, ...right], + getMemoOptions(table.options, 'debugRows', 'getVisibleCells') + ) + }, + + createTable: (table: Table): void => { + const makeVisibleColumnsMethod = ( + key: string, + getColumns: () => Column[] + ): (() => Column[]) => { + return memo( + () => [ + getColumns(), + getColumns() + .filter(d => d.getIsVisible()) + .map(d => d.id) + .join('_'), + ], + columns => { + return columns.filter(d => d.getIsVisible?.()) + }, + getMemoOptions(table.options, 'debugColumns', key) + ) + } + + table.getVisibleFlatColumns = makeVisibleColumnsMethod( + 'getVisibleFlatColumns', + () => table.getAllFlatColumns() + ) + table.getVisibleLeafColumns = makeVisibleColumnsMethod( + 'getVisibleLeafColumns', + () => table.getAllLeafColumns() + ) + table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod( + 'getLeftVisibleLeafColumns', + () => table.getLeftLeafColumns() + ) + table.getRightVisibleLeafColumns = makeVisibleColumnsMethod( + 'getRightVisibleLeafColumns', + () => table.getRightLeafColumns() + ) + table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod( + 'getCenterVisibleLeafColumns', + () => table.getCenterLeafColumns() + ) + + table.setColumnVisibility = updater => + table.options.onColumnVisibilityChange?.(updater) + + table.resetColumnVisibility = defaultState => { + table.setColumnVisibility( + defaultState ? {} : table.initialState.columnVisibility ?? {} + ) + } + + table.toggleAllColumnsVisible = value => { + value = value ?? !table.getIsAllColumnsVisible() + + table.setColumnVisibility( + table.getAllLeafColumns().reduce( + (obj, column) => ({ + ...obj, + [column.id]: !value ? !column.getCanHide?.() : value, + }), + {} + ) + ) + } + + table.getIsAllColumnsVisible = () => + !table.getAllLeafColumns().some(column => !column.getIsVisible?.()) + + table.getIsSomeColumnsVisible = () => + table.getAllLeafColumns().some(column => column.getIsVisible?.()) + + table.getToggleAllColumnsVisibilityHandler = () => { + return (e: unknown) => { + table.toggleAllColumnsVisible( + ((e as MouseEvent).target as HTMLInputElement)?.checked + ) + } + } + }, +} + +export function _getVisibleLeafColumns( + table: Table, + position?: ColumnPinningPosition | 'center' +) { + return !position + ? table.getVisibleLeafColumns() + : position === 'center' + ? table.getCenterVisibleLeafColumns() + : position === 'left' + ? table.getLeftVisibleLeafColumns() + : table.getRightVisibleLeafColumns() +} diff --git a/node_modules/@tanstack/table-core/src/features/GlobalFaceting.ts b/node_modules/@tanstack/table-core/src/features/GlobalFaceting.ts new file mode 100644 index 00000000..020b410f --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/GlobalFaceting.ts @@ -0,0 +1,66 @@ +import { RowModel } from '..' +import { Table, RowData, TableFeature } from '../types' + +export interface GlobalFacetingInstance { + _getGlobalFacetedMinMaxValues?: () => undefined | [number, number] + _getGlobalFacetedRowModel?: () => RowModel + _getGlobalFacetedUniqueValues?: () => Map + /** + * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalautofilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting) + */ + getGlobalFacetedMinMaxValues: () => undefined | [number, number] + /** + * Returns the row model for the table after **global** filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfacetedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting) + */ + getGlobalFacetedRowModel: () => RowModel + /** + * Returns the faceted unique values for the global filter. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-faceting#getglobalfaceteduniquevalues) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-faceting) + */ + getGlobalFacetedUniqueValues: () => Map +} + +// + +export const GlobalFaceting: TableFeature = { + createTable: (table: Table): void => { + table._getGlobalFacetedRowModel = + table.options.getFacetedRowModel && + table.options.getFacetedRowModel(table, '__global__') + + table.getGlobalFacetedRowModel = () => { + if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) { + return table.getPreFilteredRowModel() + } + + return table._getGlobalFacetedRowModel() + } + + table._getGlobalFacetedUniqueValues = + table.options.getFacetedUniqueValues && + table.options.getFacetedUniqueValues(table, '__global__') + table.getGlobalFacetedUniqueValues = () => { + if (!table._getGlobalFacetedUniqueValues) { + return new Map() + } + + return table._getGlobalFacetedUniqueValues() + } + + table._getGlobalFacetedMinMaxValues = + table.options.getFacetedMinMaxValues && + table.options.getFacetedMinMaxValues(table, '__global__') + table.getGlobalFacetedMinMaxValues = () => { + if (!table._getGlobalFacetedMinMaxValues) { + return + } + + return table._getGlobalFacetedMinMaxValues() + } + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/GlobalFiltering.ts b/node_modules/@tanstack/table-core/src/features/GlobalFiltering.ts new file mode 100644 index 00000000..ada28f1e --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/GlobalFiltering.ts @@ -0,0 +1,162 @@ +import { FilterFn, FilterFnOption } from '..' +import { BuiltInFilterFn, filterFns } from '../filterFns' +import { + Column, + OnChangeFn, + Table, + Updater, + RowData, + TableFeature, +} from '../types' +import { isFunction, makeStateUpdater } from '../utils' + +export interface GlobalFilterTableState { + globalFilter: any +} + +export interface GlobalFilterColumnDef { + /** + * Enables/disables the **global** filter for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + enableGlobalFilter?: boolean +} + +export interface GlobalFilterColumn { + /** + * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcanglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getCanGlobalFilter: () => boolean +} + +export interface GlobalFilterOptions { + /** + * Enables/disables **global** filtering for all columns. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#enableglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + enableGlobalFilter?: boolean + /** + * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering. + * + * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getcolumncanglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getColumnCanGlobalFilter?: (column: Column) => boolean + /** + * The filter function to use for global filtering. + * - A `string` referencing a built-in filter function + * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option + * - A custom filter function + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#globalfilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + globalFilterFn?: FilterFnOption + /** + * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#onglobalfilterchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + onGlobalFilterChange?: OnChangeFn +} + +export interface GlobalFilterInstance { + /** + * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalautofilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getGlobalAutoFilterFn: () => FilterFn | undefined + /** + * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#getglobalfilterfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + getGlobalFilterFn: () => FilterFn | undefined + /** + * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#resetglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + resetGlobalFilter: (defaultState?: boolean) => void + /** + * Sets or updates the `state.globalFilter` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#setglobalfilter) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering) + */ + setGlobalFilter: (updater: Updater) => void +} + +// + +export const GlobalFiltering: TableFeature = { + getInitialState: (state): GlobalFilterTableState => { + return { + globalFilter: undefined, + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): GlobalFilterOptions => { + return { + onGlobalFilterChange: makeStateUpdater('globalFilter', table), + globalFilterFn: 'auto', + getColumnCanGlobalFilter: column => { + const value = table + .getCoreRowModel() + .flatRows[0]?._getAllCellsByColumnId() + [column.id]?.getValue() + + return typeof value === 'string' || typeof value === 'number' + }, + } as GlobalFilterOptions + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.getCanGlobalFilter = () => { + return ( + (column.columnDef.enableGlobalFilter ?? true) && + (table.options.enableGlobalFilter ?? true) && + (table.options.enableFilters ?? true) && + (table.options.getColumnCanGlobalFilter?.(column) ?? true) && + !!column.accessorFn + ) + } + }, + + createTable: (table: Table): void => { + table.getGlobalAutoFilterFn = () => { + return filterFns.includesString + } + + table.getGlobalFilterFn = () => { + const { globalFilterFn: globalFilterFn } = table.options + + return isFunction(globalFilterFn) + ? globalFilterFn + : globalFilterFn === 'auto' + ? table.getGlobalAutoFilterFn() + : table.options.filterFns?.[globalFilterFn as string] ?? + filterFns[globalFilterFn as BuiltInFilterFn] + } + + table.setGlobalFilter = updater => { + table.options.onGlobalFilterChange?.(updater) + } + + table.resetGlobalFilter = defaultState => { + table.setGlobalFilter( + defaultState ? undefined : table.initialState.globalFilter + ) + } + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/RowExpanding.ts b/node_modules/@tanstack/table-core/src/features/RowExpanding.ts new file mode 100644 index 00000000..15da45e0 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/RowExpanding.ts @@ -0,0 +1,355 @@ +import { RowModel } from '..' +import { + OnChangeFn, + Table, + Row, + Updater, + RowData, + TableFeature, +} from '../types' +import { makeStateUpdater } from '../utils' + +export type ExpandedStateList = Record +export type ExpandedState = true | Record +export interface ExpandedTableState { + expanded: ExpandedState +} + +export interface ExpandedRow { + /** + * Returns whether the row can be expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcanexpand) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getCanExpand: () => boolean + /** + * Returns whether all parent rows of the row are expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallparentsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsAllParentsExpanded: () => boolean + /** + * Returns whether the row is expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsExpanded: () => boolean + /** + * Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleexpandedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getToggleExpandedHandler: () => () => void + /** + * Toggles the expanded state (or sets it if `expanded` is provided) for the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + toggleExpanded: (expanded?: boolean) => void +} + +export interface ExpandedOptions { + /** + * Enable this setting to automatically reset the expanded state of the table when expanding state changes. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#autoresetexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + autoResetExpanded?: boolean + /** + * Enable/disable expanding for all rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#enableexpanding) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + enableExpanding?: boolean + /** + * This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported `getExpandedRowModel` function to get the expanded row model or implement your own. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getExpandedRowModel?: (table: Table) => () => RowModel + /** + * If provided, allows you to override the default behavior of determining whether a row is currently expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisrowexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsRowExpanded?: (row: Row) => boolean + /** + * If provided, allows you to override the default behavior of determining whether a row can be expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getrowcanexpand) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getRowCanExpand?: (row: Row) => boolean + /** + * Enables manual row expansion. If this is set to `true`, `getExpandedRowModel` will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#manualexpanding) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + manualExpanding?: boolean + /** + * This function is called when the `expanded` table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the `tableOptions.state.expanded` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#onexpandedchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + onExpandedChange?: OnChangeFn + /** + * If `true` expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages). If `false` expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#paginateexpandedrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + paginateExpandedRows?: boolean +} + +export interface ExpandedInstance { + _autoResetExpanded: () => void + _getExpandedRowModel?: () => RowModel + /** + * Returns whether there are any rows that can be expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getcansomerowsexpand) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getCanSomeRowsExpand: () => boolean + /** + * Returns the maximum depth of the expanded rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandeddepth) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getExpandedDepth: () => number + /** + * Returns the row model after expansion has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getexpandedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getExpandedRowModel: () => RowModel + /** + * Returns whether all rows are currently expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getisallrowsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsAllRowsExpanded: () => boolean + /** + * Returns whether there are any rows that are currently expanded. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getissomerowsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getIsSomeRowsExpanded: () => boolean + /** + * Returns the row model before expansion has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#getpreexpandedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getPreExpandedRowModel: () => RowModel + /** + * Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an `input[type=checkbox]` element. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#gettoggleallrowsexpandedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + getToggleAllRowsExpandedHandler: () => (event: unknown) => void + /** + * Resets the expanded state of the table to the initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#resetexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + resetExpanded: (defaultState?: boolean) => void + /** + * Updates the expanded state of the table via an update function or value. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#setexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + setExpanded: (updater: Updater) => void + /** + * Toggles the expanded state for all rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#toggleallrowsexpanded) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding) + */ + toggleAllRowsExpanded: (expanded?: boolean) => void +} + +// + +export const RowExpanding: TableFeature = { + getInitialState: (state): ExpandedTableState => { + return { + expanded: {}, + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): ExpandedOptions => { + return { + onExpandedChange: makeStateUpdater('expanded', table), + paginateExpandedRows: true, + } + }, + + createTable: (table: Table): void => { + let registered = false + let queued = false + + table._autoResetExpanded = () => { + if (!registered) { + table._queue(() => { + registered = true + }) + return + } + + if ( + table.options.autoResetAll ?? + table.options.autoResetExpanded ?? + !table.options.manualExpanding + ) { + if (queued) return + queued = true + table._queue(() => { + table.resetExpanded() + queued = false + }) + } + } + table.setExpanded = updater => table.options.onExpandedChange?.(updater) + table.toggleAllRowsExpanded = expanded => { + if (expanded ?? !table.getIsAllRowsExpanded()) { + table.setExpanded(true) + } else { + table.setExpanded({}) + } + } + table.resetExpanded = defaultState => { + table.setExpanded(defaultState ? {} : table.initialState?.expanded ?? {}) + } + table.getCanSomeRowsExpand = () => { + return table + .getPrePaginationRowModel() + .flatRows.some(row => row.getCanExpand()) + } + table.getToggleAllRowsExpandedHandler = () => { + return (e: unknown) => { + ;(e as any).persist?.() + table.toggleAllRowsExpanded() + } + } + table.getIsSomeRowsExpanded = () => { + const expanded = table.getState().expanded + return expanded === true || Object.values(expanded).some(Boolean) + } + table.getIsAllRowsExpanded = () => { + const expanded = table.getState().expanded + + // If expanded is true, save some cycles and return true + if (typeof expanded === 'boolean') { + return expanded === true + } + + if (!Object.keys(expanded).length) { + return false + } + + // If any row is not expanded, return false + if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) { + return false + } + + // They must all be expanded :shrug: + return true + } + table.getExpandedDepth = () => { + let maxDepth = 0 + + const rowIds = + table.getState().expanded === true + ? Object.keys(table.getRowModel().rowsById) + : Object.keys(table.getState().expanded) + + rowIds.forEach(id => { + const splitId = id.split('.') + maxDepth = Math.max(maxDepth, splitId.length) + }) + + return maxDepth + } + table.getPreExpandedRowModel = () => table.getSortedRowModel() + table.getExpandedRowModel = () => { + if (!table._getExpandedRowModel && table.options.getExpandedRowModel) { + table._getExpandedRowModel = table.options.getExpandedRowModel(table) + } + + if (table.options.manualExpanding || !table._getExpandedRowModel) { + return table.getPreExpandedRowModel() + } + + return table._getExpandedRowModel() + } + }, + + createRow: ( + row: Row, + table: Table + ): void => { + row.toggleExpanded = expanded => { + table.setExpanded(old => { + const exists = old === true ? true : !!old?.[row.id] + + let oldExpanded: ExpandedStateList = {} + + if (old === true) { + Object.keys(table.getRowModel().rowsById).forEach(rowId => { + oldExpanded[rowId] = true + }) + } else { + oldExpanded = old + } + + expanded = expanded ?? !exists + + if (!exists && expanded) { + return { + ...oldExpanded, + [row.id]: true, + } + } + + if (exists && !expanded) { + const { [row.id]: _, ...rest } = oldExpanded + return rest + } + + return old + }) + } + row.getIsExpanded = () => { + const expanded = table.getState().expanded + + return !!( + table.options.getIsRowExpanded?.(row) ?? + (expanded === true || expanded?.[row.id]) + ) + } + row.getCanExpand = () => { + return ( + table.options.getRowCanExpand?.(row) ?? + ((table.options.enableExpanding ?? true) && !!row.subRows?.length) + ) + } + row.getIsAllParentsExpanded = () => { + let isFullyExpanded = true + let currentRow = row + + while (isFullyExpanded && currentRow.parentId) { + currentRow = table.getRow(currentRow.parentId, true) + isFullyExpanded = currentRow.getIsExpanded() + } + + return isFullyExpanded + } + row.getToggleExpandedHandler = () => { + const canExpand = row.getCanExpand() + + return () => { + if (!canExpand) return + row.toggleExpanded() + } + } + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/RowPagination.ts b/node_modules/@tanstack/table-core/src/features/RowPagination.ts new file mode 100644 index 00000000..83647067 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/RowPagination.ts @@ -0,0 +1,396 @@ +import { + OnChangeFn, + Table, + RowModel, + Updater, + RowData, + TableFeature, +} from '../types' +import { + functionalUpdate, + getMemoOptions, + makeStateUpdater, + memo, +} from '../utils' + +export interface PaginationState { + pageIndex: number + pageSize: number +} + +export interface PaginationTableState { + pagination: PaginationState +} + +export interface PaginationInitialTableState { + pagination?: Partial +} + +export interface PaginationOptions { + /** + * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + autoResetPageIndex?: boolean + /** + * Returns the row model after pagination has taken place, but no further. + * + * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPaginationRowModel?: (table: Table) => () => RowModel + /** + * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + manualPagination?: boolean + /** + * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + onPaginationChange?: OnChangeFn + /** + * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + pageCount?: number + /** + * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + rowCount?: number +} + +export interface PaginationDefaultOptions { + onPaginationChange: OnChangeFn +} + +export interface PaginationInstance { + _autoResetPageIndex: () => void + _getPaginationRowModel?: () => RowModel + /** + * Returns whether the table can go to the next page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getCanNextPage: () => boolean + /** + * Returns whether the table can go to the previous page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getCanPreviousPage: () => boolean + /** + * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPageCount: () => number + /** + * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getRowCount: () => number + /** + * Returns an array of page options (zero-index-based) for the current page size. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPageOptions: () => number[] + /** + * Returns the row model for the table after pagination has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPaginationRowModel: () => RowModel + /** + * Returns the row model for the table before any pagination has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + getPrePaginationRowModel: () => RowModel + /** + * Increments the page index by one, if possible. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + nextPage: () => void + /** + * Decrements the page index by one, if possible. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + previousPage: () => void + /** + * Sets the page index to `0`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + firstPage: () => void + /** + * Sets the page index to the last page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + lastPage: () => void + /** + * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + resetPageIndex: (defaultState?: boolean) => void + /** + * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + resetPageSize: (defaultState?: boolean) => void + /** + * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + resetPagination: (defaultState?: boolean) => void + /** + * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead. + */ + setPageCount: (updater: Updater) => void + /** + * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + setPageIndex: (updater: Updater) => void + /** + * Updates the page size using the provided function or value in the `state.pagination.pageSize` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + setPageSize: (updater: Updater) => void + /** + * Sets or updates the `state.pagination` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination) + */ + setPagination: (updater: Updater) => void +} + +// + +const defaultPageIndex = 0 +const defaultPageSize = 10 + +const getDefaultPaginationState = (): PaginationState => ({ + pageIndex: defaultPageIndex, + pageSize: defaultPageSize, +}) + +export const RowPagination: TableFeature = { + getInitialState: (state): PaginationTableState => { + return { + ...state, + pagination: { + ...getDefaultPaginationState(), + ...state?.pagination, + }, + } + }, + + getDefaultOptions: ( + table: Table + ): PaginationDefaultOptions => { + return { + onPaginationChange: makeStateUpdater('pagination', table), + } + }, + + createTable: (table: Table): void => { + let registered = false + let queued = false + + table._autoResetPageIndex = () => { + if (!registered) { + table._queue(() => { + registered = true + }) + return + } + + if ( + table.options.autoResetAll ?? + table.options.autoResetPageIndex ?? + !table.options.manualPagination + ) { + if (queued) return + queued = true + table._queue(() => { + table.resetPageIndex() + queued = false + }) + } + } + table.setPagination = updater => { + const safeUpdater: Updater = old => { + let newState = functionalUpdate(updater, old) + + return newState + } + + return table.options.onPaginationChange?.(safeUpdater) + } + table.resetPagination = defaultState => { + table.setPagination( + defaultState + ? getDefaultPaginationState() + : table.initialState.pagination ?? getDefaultPaginationState() + ) + } + table.setPageIndex = updater => { + table.setPagination(old => { + let pageIndex = functionalUpdate(updater, old.pageIndex) + + const maxPageIndex = + typeof table.options.pageCount === 'undefined' || + table.options.pageCount === -1 + ? Number.MAX_SAFE_INTEGER + : table.options.pageCount - 1 + + pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex)) + + return { + ...old, + pageIndex, + } + }) + } + table.resetPageIndex = defaultState => { + table.setPageIndex( + defaultState + ? defaultPageIndex + : table.initialState?.pagination?.pageIndex ?? defaultPageIndex + ) + } + table.resetPageSize = defaultState => { + table.setPageSize( + defaultState + ? defaultPageSize + : table.initialState?.pagination?.pageSize ?? defaultPageSize + ) + } + table.setPageSize = updater => { + table.setPagination(old => { + const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize)) + const topRowIndex = old.pageSize * old.pageIndex! + const pageIndex = Math.floor(topRowIndex / pageSize) + + return { + ...old, + pageIndex, + pageSize, + } + }) + } + //deprecated + table.setPageCount = updater => + table.setPagination(old => { + let newPageCount = functionalUpdate( + updater, + table.options.pageCount ?? -1 + ) + + if (typeof newPageCount === 'number') { + newPageCount = Math.max(-1, newPageCount) + } + + return { + ...old, + pageCount: newPageCount, + } + }) + + table.getPageOptions = memo( + () => [table.getPageCount()], + pageCount => { + let pageOptions: number[] = [] + if (pageCount && pageCount > 0) { + pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i) + } + return pageOptions + }, + getMemoOptions(table.options, 'debugTable', 'getPageOptions') + ) + + table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0 + + table.getCanNextPage = () => { + const { pageIndex } = table.getState().pagination + + const pageCount = table.getPageCount() + + if (pageCount === -1) { + return true + } + + if (pageCount === 0) { + return false + } + + return pageIndex < pageCount - 1 + } + + table.previousPage = () => { + return table.setPageIndex(old => old - 1) + } + + table.nextPage = () => { + return table.setPageIndex(old => { + return old + 1 + }) + } + + table.firstPage = () => { + return table.setPageIndex(0) + } + + table.lastPage = () => { + return table.setPageIndex(table.getPageCount() - 1) + } + + table.getPrePaginationRowModel = () => table.getExpandedRowModel() + table.getPaginationRowModel = () => { + if ( + !table._getPaginationRowModel && + table.options.getPaginationRowModel + ) { + table._getPaginationRowModel = + table.options.getPaginationRowModel(table) + } + + if (table.options.manualPagination || !table._getPaginationRowModel) { + return table.getPrePaginationRowModel() + } + + return table._getPaginationRowModel() + } + + table.getPageCount = () => { + return ( + table.options.pageCount ?? + Math.ceil(table.getRowCount() / table.getState().pagination.pageSize) + ) + } + + table.getRowCount = () => { + return ( + table.options.rowCount ?? table.getPrePaginationRowModel().rows.length + ) + } + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/RowPinning.ts b/node_modules/@tanstack/table-core/src/features/RowPinning.ts new file mode 100644 index 00000000..02288ab8 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/RowPinning.ts @@ -0,0 +1,277 @@ +import { + OnChangeFn, + Updater, + Table, + Row, + RowData, + TableFeature, +} from '../types' +import { getMemoOptions, makeStateUpdater, memo } from '../utils' + +export type RowPinningPosition = false | 'top' | 'bottom' + +export interface RowPinningState { + bottom?: string[] + top?: string[] +} + +export interface RowPinningTableState { + rowPinning: RowPinningState +} + +export interface RowPinningOptions { + /** + * Enables/disables row pinning for the table. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + enableRowPinning?: boolean | ((row: Row) => boolean) + /** + * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + keepPinnedRows?: boolean + /** + * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange) + */ + onRowPinningChange?: OnChangeFn +} + +export interface RowPinningDefaultOptions { + onRowPinningChange: OnChangeFn +} + +export interface RowPinningRow { + /** + * Returns whether or not the row can be pinned. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getCanPin: () => boolean + /** + * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getIsPinned: () => RowPinningPosition + /** + * Returns the numeric pinned index of the row within a pinned row group. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getPinnedIndex: () => number + /** + * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + pin: ( + position: RowPinningPosition, + includeLeafRows?: boolean, + includeParentRows?: boolean + ) => void +} + +export interface RowPinningInstance { + _getPinnedRows: ( + visiblePinnedRows: Array>, + pinnedRowIds: Array | undefined, + position: 'top' | 'bottom' + ) => Row[] + /** + * Returns all bottom pinned rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getBottomRows: () => Row[] + /** + * Returns all rows that are not pinned to the top or bottom. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getCenterRows: () => Row[] + /** + * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean + /** + * Returns all top pinned rows. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + getTopRows: () => Row[] + /** + * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + resetRowPinning: (defaultState?: boolean) => void + /** + * Sets or updates the `state.rowPinning` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning) + */ + setRowPinning: (updater: Updater) => void +} + +// + +const getDefaultRowPinningState = (): RowPinningState => ({ + top: [], + bottom: [], +}) + +export const RowPinning: TableFeature = { + getInitialState: (state): RowPinningTableState => { + return { + rowPinning: getDefaultRowPinningState(), + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): RowPinningDefaultOptions => { + return { + onRowPinningChange: makeStateUpdater('rowPinning', table), + } + }, + + createRow: ( + row: Row, + table: Table + ): void => { + row.pin = (position, includeLeafRows, includeParentRows) => { + const leafRowIds = includeLeafRows + ? row.getLeafRows().map(({ id }) => id) + : [] + const parentRowIds = includeParentRows + ? row.getParentRows().map(({ id }) => id) + : [] + const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]) + + table.setRowPinning(old => { + if (position === 'bottom') { + return { + top: (old?.top ?? []).filter(d => !rowIds?.has(d)), + bottom: [ + ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)), + ...Array.from(rowIds), + ], + } + } + + if (position === 'top') { + return { + top: [ + ...(old?.top ?? []).filter(d => !rowIds?.has(d)), + ...Array.from(rowIds), + ], + bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)), + } + } + + return { + top: (old?.top ?? []).filter(d => !rowIds?.has(d)), + bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)), + } + }) + } + row.getCanPin = () => { + const { enableRowPinning, enablePinning } = table.options + if (typeof enableRowPinning === 'function') { + return enableRowPinning(row) + } + return enableRowPinning ?? enablePinning ?? true + } + row.getIsPinned = () => { + const rowIds = [row.id] + + const { top, bottom } = table.getState().rowPinning + + const isTop = rowIds.some(d => top?.includes(d)) + const isBottom = rowIds.some(d => bottom?.includes(d)) + + return isTop ? 'top' : isBottom ? 'bottom' : false + } + row.getPinnedIndex = () => { + const position = row.getIsPinned() + if (!position) return -1 + + const visiblePinnedRowIds = ( + position === 'top' ? table.getTopRows() : table.getBottomRows() + )?.map(({ id }) => id) + + return visiblePinnedRowIds?.indexOf(row.id) ?? -1 + } + }, + + createTable: (table: Table): void => { + table.setRowPinning = updater => table.options.onRowPinningChange?.(updater) + + table.resetRowPinning = defaultState => + table.setRowPinning( + defaultState + ? getDefaultRowPinningState() + : table.initialState?.rowPinning ?? getDefaultRowPinningState() + ) + + table.getIsSomeRowsPinned = position => { + const pinningState = table.getState().rowPinning + + if (!position) { + return Boolean(pinningState.top?.length || pinningState.bottom?.length) + } + return Boolean(pinningState[position]?.length) + } + + table._getPinnedRows = (visibleRows, pinnedRowIds, position) => { + const rows = + table.options.keepPinnedRows ?? true + ? //get all rows that are pinned even if they would not be otherwise visible + //account for expanded parent rows, but not pagination or filtering + (pinnedRowIds ?? []).map(rowId => { + const row = table.getRow(rowId, true) + return row.getIsAllParentsExpanded() ? row : null + }) + : //else get only visible rows that are pinned + (pinnedRowIds ?? []).map( + rowId => visibleRows.find(row => row.id === rowId)! + ) + + return rows.filter(Boolean).map(d => ({ ...d, position })) as Row[] + } + + table.getTopRows = memo( + () => [table.getRowModel().rows, table.getState().rowPinning.top], + (allRows, topPinnedRowIds) => + table._getPinnedRows(allRows, topPinnedRowIds, 'top'), + getMemoOptions(table.options, 'debugRows', 'getTopRows') + ) + + table.getBottomRows = memo( + () => [table.getRowModel().rows, table.getState().rowPinning.bottom], + (allRows, bottomPinnedRowIds) => + table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), + getMemoOptions(table.options, 'debugRows', 'getBottomRows') + ) + + table.getCenterRows = memo( + () => [ + table.getRowModel().rows, + table.getState().rowPinning.top, + table.getState().rowPinning.bottom, + ], + (allRows, top, bottom) => { + const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])]) + return allRows.filter(d => !topAndBottom.has(d.id)) + }, + getMemoOptions(table.options, 'debugRows', 'getCenterRows') + ) + }, +} diff --git a/node_modules/@tanstack/table-core/src/features/RowSelection.ts b/node_modules/@tanstack/table-core/src/features/RowSelection.ts new file mode 100644 index 00000000..90166823 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/RowSelection.ts @@ -0,0 +1,668 @@ +import { + OnChangeFn, + Table, + Row, + RowModel, + Updater, + RowData, + TableFeature, +} from '../types' +import { getMemoOptions, makeStateUpdater, memo } from '../utils' + +export type RowSelectionState = Record + +export interface RowSelectionTableState { + rowSelection: RowSelectionState +} + +export interface RowSelectionOptions { + /** + * - Enables/disables multiple row selection for all rows in the table OR + * - A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablemultirowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + enableMultiRowSelection?: boolean | ((row: Row) => boolean) + /** + * - Enables/disables row selection for all rows in the table OR + * - A function that given a row, returns whether to enable/disable row selection for that row + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablerowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + enableRowSelection?: boolean | ((row: Row) => boolean) + /** + * Enables/disables automatic sub-row selection when a parent row is selected, or a function that enables/disables automatic sub-row selection for each row. + * (Use in combination with expanding or grouping features) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#enablesubrowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + enableSubRowSelection?: boolean | ((row: Row) => boolean) + /** + * If provided, this function will be called with an `updaterFn` when `state.rowSelection` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#onrowselectionchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + onRowSelectionChange?: OnChangeFn + // enableGroupingRowSelection?: + // | boolean + // | (( + // row: Row + // ) => boolean) + // isAdditiveSelectEvent?: (e: unknown) => boolean + // isInclusiveSelectEvent?: (e: unknown) => boolean + // selectRowsFn?: ( + // table: Table, + // rowModel: RowModel + // ) => RowModel +} + +export interface RowSelectionRow { + /** + * Returns whether or not the row can multi-select. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanmultiselect) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getCanMultiSelect: () => boolean + /** + * Returns whether or not the row can be selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselect) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getCanSelect: () => boolean + /** + * Returns whether or not the row can select sub rows automatically when the parent row is selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getcanselectsubrows) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getCanSelectSubRows: () => boolean + /** + * Returns whether or not all of the row's sub rows are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallsubrowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsAllSubRowsSelected: () => boolean + /** + * Returns whether or not the row is selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSelected: () => boolean + /** + * Returns whether or not some of the row's sub rows are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomeselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSomeSelected: () => boolean + /** + * Returns a handler that can be used to toggle the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleselectedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getToggleSelectedHandler: () => (event: unknown) => void + /** + * Selects/deselects the row. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + toggleSelected: (value?: boolean, opts?: { selectChildren?: boolean }) => void +} + +export interface RowSelectionInstance { + /** + * Returns the row model of all rows that are selected after filtering has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getfilteredselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getFilteredSelectedRowModel: () => RowModel + /** + * Returns the row model of all rows that are selected after grouping has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getgroupedselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getGroupedSelectedRowModel: () => RowModel + /** + * Returns whether or not all rows on the current page are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallpagerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsAllPageRowsSelected: () => boolean + /** + * Returns whether or not all rows in the table are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getisallrowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsAllRowsSelected: () => boolean + /** + * Returns whether or not any rows on the current page are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomepagerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSomePageRowsSelected: () => boolean + /** + * Returns whether or not any rows in the table are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getissomerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getIsSomeRowsSelected: () => boolean + /** + * Returns the core row model of all rows before row selection has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getpreselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getPreSelectedRowModel: () => RowModel + /** + * Returns the row model of all rows that are selected. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#getselectedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getSelectedRowModel: () => RowModel + /** + * Returns a handler that can be used to toggle all rows on the current page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallpagerowsselectedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void + /** + * Returns a handler that can be used to toggle all rows in the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#gettoggleallrowsselectedhandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + getToggleAllRowsSelectedHandler: () => (event: unknown) => void + /** + * Resets the **rowSelection** state to the `initialState.rowSelection`, or `true` can be passed to force a default blank state reset to `{}`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#resetrowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + resetRowSelection: (defaultState?: boolean) => void + /** + * Sets or updates the `state.rowSelection` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#setrowselection) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + setRowSelection: (updater: Updater) => void + /** + * Selects/deselects all rows on the current page. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallpagerowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + toggleAllPageRowsSelected: (value?: boolean) => void + /** + * Selects/deselects all rows in the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleallrowsselected) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection) + */ + toggleAllRowsSelected: (value?: boolean) => void +} + +// + +export const RowSelection: TableFeature = { + getInitialState: (state): RowSelectionTableState => { + return { + rowSelection: {}, + ...state, + } + }, + + getDefaultOptions: ( + table: Table + ): RowSelectionOptions => { + return { + onRowSelectionChange: makeStateUpdater('rowSelection', table), + enableRowSelection: true, + enableMultiRowSelection: true, + enableSubRowSelection: true, + // enableGroupingRowSelection: false, + // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey, + // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey, + } + }, + + createTable: (table: Table): void => { + table.setRowSelection = updater => + table.options.onRowSelectionChange?.(updater) + table.resetRowSelection = defaultState => + table.setRowSelection( + defaultState ? {} : table.initialState.rowSelection ?? {} + ) + table.toggleAllRowsSelected = value => { + table.setRowSelection(old => { + value = + typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected() + + const rowSelection = { ...old } + + const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows + + // We don't use `mutateRowIsSelected` here for performance reasons. + // All of the rows are flat already, so it wouldn't be worth it + if (value) { + preGroupedFlatRows.forEach(row => { + if (!row.getCanSelect()) { + return + } + rowSelection[row.id] = true + }) + } else { + preGroupedFlatRows.forEach(row => { + delete rowSelection[row.id] + }) + } + + return rowSelection + }) + } + table.toggleAllPageRowsSelected = value => + table.setRowSelection(old => { + const resolvedValue = + typeof value !== 'undefined' + ? value + : !table.getIsAllPageRowsSelected() + + const rowSelection: RowSelectionState = { ...old } + + table.getRowModel().rows.forEach(row => { + mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table) + }) + + return rowSelection + }) + + // addRowSelectionRange: rowId => { + // const { + // rows, + // rowsById, + // options: { selectGroupingRows, selectSubRows }, + // } = table + + // const findSelectedRow = (rows: Row[]) => { + // let found + // rows.find(d => { + // if (d.getIsSelected()) { + // found = d + // return true + // } + // const subFound = findSelectedRow(d.subRows || []) + // if (subFound) { + // found = subFound + // return true + // } + // return false + // }) + // return found + // } + + // const firstRow = findSelectedRow(rows) || rows[0] + // const lastRow = rowsById[rowId] + + // let include = false + // const selectedRowIds = {} + + // const addRow = (row: Row) => { + // mutateRowIsSelected(selectedRowIds, row.id, true, { + // rowsById, + // selectGroupingRows: selectGroupingRows!, + // selectSubRows: selectSubRows!, + // }) + // } + + // table.rows.forEach(row => { + // const isFirstRow = row.id === firstRow.id + // const isLastRow = row.id === lastRow.id + + // if (isFirstRow || isLastRow) { + // if (!include) { + // include = true + // } else if (include) { + // addRow(row) + // include = false + // } + // } + + // if (include) { + // addRow(row) + // } + // }) + + // table.setRowSelection(selectedRowIds) + // }, + table.getPreSelectedRowModel = () => table.getCoreRowModel() + table.getSelectedRowModel = memo( + () => [table.getState().rowSelection, table.getCoreRowModel()], + (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {}, + } + } + + return selectRowsFn(table, rowModel) + }, + getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel') + ) + + table.getFilteredSelectedRowModel = memo( + () => [table.getState().rowSelection, table.getFilteredRowModel()], + (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {}, + } + } + + return selectRowsFn(table, rowModel) + }, + getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel') + ) + + table.getGroupedSelectedRowModel = memo( + () => [table.getState().rowSelection, table.getSortedRowModel()], + (rowSelection, rowModel) => { + if (!Object.keys(rowSelection).length) { + return { + rows: [], + flatRows: [], + rowsById: {}, + } + } + + return selectRowsFn(table, rowModel) + }, + getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel') + ) + + /// + + // getGroupingRowCanSelect: rowId => { + // const row = table.getRow(rowId) + + // if (!row) { + // throw new Error() + // } + + // if (typeof table.options.enableGroupingRowSelection === 'function') { + // return table.options.enableGroupingRowSelection(row) + // } + + // return table.options.enableGroupingRowSelection ?? false + // }, + + table.getIsAllRowsSelected = () => { + const preGroupedFlatRows = table.getFilteredRowModel().flatRows + const { rowSelection } = table.getState() + + let isAllRowsSelected = Boolean( + preGroupedFlatRows.length && Object.keys(rowSelection).length + ) + + if (isAllRowsSelected) { + if ( + preGroupedFlatRows.some( + row => row.getCanSelect() && !rowSelection[row.id] + ) + ) { + isAllRowsSelected = false + } + } + + return isAllRowsSelected + } + + table.getIsAllPageRowsSelected = () => { + const paginationFlatRows = table + .getPaginationRowModel() + .flatRows.filter(row => row.getCanSelect()) + const { rowSelection } = table.getState() + + let isAllPageRowsSelected = !!paginationFlatRows.length + + if ( + isAllPageRowsSelected && + paginationFlatRows.some(row => !rowSelection[row.id]) + ) { + isAllPageRowsSelected = false + } + + return isAllPageRowsSelected + } + + table.getIsSomeRowsSelected = () => { + const totalSelected = Object.keys( + table.getState().rowSelection ?? {} + ).length + return ( + totalSelected > 0 && + totalSelected < table.getFilteredRowModel().flatRows.length + ) + } + + table.getIsSomePageRowsSelected = () => { + const paginationFlatRows = table.getPaginationRowModel().flatRows + return table.getIsAllPageRowsSelected() + ? false + : paginationFlatRows + .filter(row => row.getCanSelect()) + .some(d => d.getIsSelected() || d.getIsSomeSelected()) + } + + table.getToggleAllRowsSelectedHandler = () => { + return (e: unknown) => { + table.toggleAllRowsSelected( + ((e as MouseEvent).target as HTMLInputElement).checked + ) + } + } + + table.getToggleAllPageRowsSelectedHandler = () => { + return (e: unknown) => { + table.toggleAllPageRowsSelected( + ((e as MouseEvent).target as HTMLInputElement).checked + ) + } + } + }, + + createRow: ( + row: Row, + table: Table + ): void => { + row.toggleSelected = (value, opts) => { + const isSelected = row.getIsSelected() + + table.setRowSelection(old => { + value = typeof value !== 'undefined' ? value : !isSelected + + if (row.getCanSelect() && isSelected === value) { + return old + } + + const selectedRowIds = { ...old } + + mutateRowIsSelected( + selectedRowIds, + row.id, + value, + opts?.selectChildren ?? true, + table + ) + + return selectedRowIds + }) + } + row.getIsSelected = () => { + const { rowSelection } = table.getState() + return isRowSelected(row, rowSelection) + } + + row.getIsSomeSelected = () => { + const { rowSelection } = table.getState() + return isSubRowSelected(row, rowSelection, table) === 'some' + } + + row.getIsAllSubRowsSelected = () => { + const { rowSelection } = table.getState() + return isSubRowSelected(row, rowSelection, table) === 'all' + } + + row.getCanSelect = () => { + if (typeof table.options.enableRowSelection === 'function') { + return table.options.enableRowSelection(row) + } + + return table.options.enableRowSelection ?? true + } + + row.getCanSelectSubRows = () => { + if (typeof table.options.enableSubRowSelection === 'function') { + return table.options.enableSubRowSelection(row) + } + + return table.options.enableSubRowSelection ?? true + } + + row.getCanMultiSelect = () => { + if (typeof table.options.enableMultiRowSelection === 'function') { + return table.options.enableMultiRowSelection(row) + } + + return table.options.enableMultiRowSelection ?? true + } + row.getToggleSelectedHandler = () => { + const canSelect = row.getCanSelect() + + return (e: unknown) => { + if (!canSelect) return + row.toggleSelected( + ((e as MouseEvent).target as HTMLInputElement)?.checked + ) + } + } + }, +} + +const mutateRowIsSelected = ( + selectedRowIds: Record, + id: string, + value: boolean, + includeChildren: boolean, + table: Table +) => { + const row = table.getRow(id, true) + + // const isGrouped = row.getIsGrouped() + + // if ( // TODO: enforce grouping row selection rules + // !isGrouped || + // (isGrouped && table.options.enableGroupingRowSelection) + // ) { + if (value) { + if (!row.getCanMultiSelect()) { + Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]) + } + if (row.getCanSelect()) { + selectedRowIds[id] = true + } + } else { + delete selectedRowIds[id] + } + // } + + if (includeChildren && row.subRows?.length && row.getCanSelectSubRows()) { + row.subRows.forEach(row => + mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table) + ) + } +} + +export function selectRowsFn( + table: Table, + rowModel: RowModel +): RowModel { + const rowSelection = table.getState().rowSelection + + const newSelectedFlatRows: Row[] = [] + const newSelectedRowsById: Record> = {} + + // Filters top level and nested rows + const recurseRows = (rows: Row[], depth = 0): Row[] => { + return rows + .map(row => { + const isSelected = isRowSelected(row, rowSelection) + + if (isSelected) { + newSelectedFlatRows.push(row) + newSelectedRowsById[row.id] = row + } + + if (row.subRows?.length) { + row = { + ...row, + subRows: recurseRows(row.subRows, depth + 1), + } + } + + if (isSelected) { + return row + } + }) + .filter(Boolean) as Row[] + } + + return { + rows: recurseRows(rowModel.rows), + flatRows: newSelectedFlatRows, + rowsById: newSelectedRowsById, + } +} + +export function isRowSelected( + row: Row, + selection: Record +): boolean { + return selection[row.id] ?? false +} + +export function isSubRowSelected( + row: Row, + selection: Record, + table: Table +): boolean | 'some' | 'all' { + if (!row.subRows?.length) return false + + let allChildrenSelected = true + let someSelected = false + + row.subRows.forEach(subRow => { + // Bail out early if we know both of these + if (someSelected && !allChildrenSelected) { + return + } + + if (subRow.getCanSelect()) { + if (isRowSelected(subRow, selection)) { + someSelected = true + } else { + allChildrenSelected = false + } + } + + // Check row selection of nested subrows + if (subRow.subRows && subRow.subRows.length) { + const subRowChildrenSelected = isSubRowSelected(subRow, selection, table) + if (subRowChildrenSelected === 'all') { + someSelected = true + } else if (subRowChildrenSelected === 'some') { + someSelected = true + allChildrenSelected = false + } else { + allChildrenSelected = false + } + } + }) + + return allChildrenSelected ? 'all' : someSelected ? 'some' : false +} diff --git a/node_modules/@tanstack/table-core/src/features/RowSorting.ts b/node_modules/@tanstack/table-core/src/features/RowSorting.ts new file mode 100644 index 00000000..c2e7c32d --- /dev/null +++ b/node_modules/@tanstack/table-core/src/features/RowSorting.ts @@ -0,0 +1,542 @@ +import { RowModel } from '..' +import { + BuiltInSortingFn, + reSplitAlphaNumeric, + sortingFns, +} from '../sortingFns' + +import { + Column, + OnChangeFn, + Table, + Row, + Updater, + RowData, + SortingFns, + TableFeature, +} from '../types' + +import { isFunction, makeStateUpdater } from '../utils' + +export type SortDirection = 'asc' | 'desc' + +export interface ColumnSort { + desc: boolean + id: string +} + +export type SortingState = ColumnSort[] + +export interface SortingTableState { + sorting: SortingState +} + +export interface SortingFn { + (rowA: Row, rowB: Row, columnId: string): number +} + +export type CustomSortingFns = Record< + string, + SortingFn +> + +export type SortingFnOption = + | 'auto' + | keyof SortingFns + | BuiltInSortingFn + | SortingFn + +export interface SortingColumnDef { + /** + * Enables/Disables multi-sorting for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableMultiSort?: boolean + /** + * Enables/Disables sorting for this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableSorting?: boolean + /** + * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + invertSorting?: boolean + /** + * Set to `true` for sorting toggles on this column to start in the descending direction. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortDescFirst?: boolean + /** + * The sorting function to use with this column. + * - A `string` referencing a built-in sorting function + * - A custom sorting function + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortingFn?: SortingFnOption + /** + * The priority of undefined values when sorting this column. + * - `false` + * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies) + * - `-1` + * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list) + * - `1` + * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list) + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortundefined) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortUndefined?: false | -1 | 1 | 'first' | 'last' +} + +export interface SortingColumn { + /** + * Removes this column from the table's sorting state + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + clearSorting: () => void + /** + * Returns a sort direction automatically inferred based on the columns values. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getAutoSortDir: () => SortDirection + /** + * Returns a sorting function automatically inferred based on the columns values. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getAutoSortingFn: () => SortingFn + /** + * Returns whether this column can be multi-sorted. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getCanMultiSort: () => boolean + /** + * Returns whether this column can be sorted. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getCanSort: () => boolean + /** + * Returns the first direction that should be used when sorting this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getFirstSortDir: () => SortDirection + /** + * Returns the current sort direction of this column. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getIsSorted: () => false | SortDirection + /** + * Returns the next sorting order. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getNextSortingOrder: () => SortDirection | false + /** + * Returns the index position of this column's sorting within the sorting state + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortIndex: () => number + /** + * Returns the resolved sorting function to be used for this column + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortingFn: () => SortingFn + /** + * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getToggleSortingHandler: () => undefined | ((event: unknown) => void) + /** + * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted). + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + toggleSorting: (desc?: boolean, isMulti?: boolean) => void +} + +interface SortingOptionsBase { + /** + * Enables/disables the ability to remove multi-sorts + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableMultiRemove?: boolean + /** + * Enables/Disables multi-sorting for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableMultiSort?: boolean + /** + * Enables/Disables sorting for the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableSorting?: boolean + /** + * Enables/Disables the ability to remove sorting for the table. + * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ... + * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ... + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + enableSortingRemoval?: boolean + /** + * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortedRowModel?: (table: Table) => () => RowModel + /** + * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + isMultiSortEvent?: (e: unknown) => boolean + /** + * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + manualSorting?: boolean + /** + * Set a maximum number of columns that can be multi-sorted. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + maxMultiSortColCount?: number + /** + * If provided, this function will be called with an `updaterFn` when `state.sorting` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + onSortingChange?: OnChangeFn + /** + * If `true`, all sorts will default to descending as their first toggle state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + sortDescFirst?: boolean +} + +type ResolvedSortingFns = keyof SortingFns extends never + ? { + sortingFns?: Record> + } + : { + sortingFns: Record> + } + +export interface SortingOptions + extends SortingOptionsBase, + ResolvedSortingFns {} + +export interface SortingInstance { + _getSortedRowModel?: () => RowModel + /** + * Returns the row model for the table before any sorting has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getPreSortedRowModel: () => RowModel + /** + * Returns the row model for the table after sorting has been applied. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + getSortedRowModel: () => RowModel + /** + * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + resetSorting: (defaultState?: boolean) => void + /** + * Sets or updates the `state.sorting` state. + * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting) + * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting) + */ + setSorting: (updater: Updater) => void +} + +// + +export const RowSorting: TableFeature = { + getInitialState: (state): SortingTableState => { + return { + sorting: [], + ...state, + } + }, + + getDefaultColumnDef: (): SortingColumnDef => { + return { + sortingFn: 'auto', + sortUndefined: 1, + } + }, + + getDefaultOptions: ( + table: Table + ): SortingOptions => { + return { + onSortingChange: makeStateUpdater('sorting', table), + isMultiSortEvent: (e: unknown) => { + return (e as MouseEvent).shiftKey + }, + } + }, + + createColumn: ( + column: Column, + table: Table + ): void => { + column.getAutoSortingFn = () => { + const firstRows = table.getFilteredRowModel().flatRows.slice(10) + + let isString = false + + for (const row of firstRows) { + const value = row?.getValue(column.id) + + if (Object.prototype.toString.call(value) === '[object Date]') { + return sortingFns.datetime + } + + if (typeof value === 'string') { + isString = true + + if (value.split(reSplitAlphaNumeric).length > 1) { + return sortingFns.alphanumeric + } + } + } + + if (isString) { + return sortingFns.text + } + + return sortingFns.basic + } + column.getAutoSortDir = () => { + const firstRow = table.getFilteredRowModel().flatRows[0] + + const value = firstRow?.getValue(column.id) + + if (typeof value === 'string') { + return 'asc' + } + + return 'desc' + } + column.getSortingFn = () => { + if (!column) { + throw new Error() + } + + return isFunction(column.columnDef.sortingFn) + ? column.columnDef.sortingFn + : column.columnDef.sortingFn === 'auto' + ? column.getAutoSortingFn() + : table.options.sortingFns?.[column.columnDef.sortingFn as string] ?? + sortingFns[column.columnDef.sortingFn as BuiltInSortingFn] + } + column.toggleSorting = (desc, multi) => { + // if (column.columns.length) { + // column.columns.forEach((c, i) => { + // if (c.id) { + // table.toggleColumnSorting(c.id, undefined, multi || !!i) + // } + // }) + // return + // } + + // this needs to be outside of table.setSorting to be in sync with rerender + const nextSortingOrder = column.getNextSortingOrder() + const hasManualValue = typeof desc !== 'undefined' && desc !== null + + table.setSorting(old => { + // Find any existing sorting for this column + const existingSorting = old?.find(d => d.id === column.id) + const existingIndex = old?.findIndex(d => d.id === column.id) + + let newSorting: SortingState = [] + + // What should we do with this sort action? + let sortAction: 'add' | 'remove' | 'toggle' | 'replace' + let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc' + + // Multi-mode + if (old?.length && column.getCanMultiSort() && multi) { + if (existingSorting) { + sortAction = 'toggle' + } else { + sortAction = 'add' + } + } else { + // Normal mode + if (old?.length && existingIndex !== old.length - 1) { + sortAction = 'replace' + } else if (existingSorting) { + sortAction = 'toggle' + } else { + sortAction = 'replace' + } + } + + // Handle toggle states that will remove the sorting + if (sortAction === 'toggle') { + // If we are "actually" toggling (not a manual set value), should we remove the sorting? + if (!hasManualValue) { + // Is our intention to remove? + if (!nextSortingOrder) { + sortAction = 'remove' + } + } + } + + if (sortAction === 'add') { + newSorting = [ + ...old, + { + id: column.id, + desc: nextDesc, + }, + ] + // Take latest n columns + newSorting.splice( + 0, + newSorting.length - + (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER) + ) + } else if (sortAction === 'toggle') { + // This flips (or sets) the + newSorting = old.map(d => { + if (d.id === column.id) { + return { + ...d, + desc: nextDesc, + } + } + return d + }) + } else if (sortAction === 'remove') { + newSorting = old.filter(d => d.id !== column.id) + } else { + newSorting = [ + { + id: column.id, + desc: nextDesc, + }, + ] + } + + return newSorting + }) + } + + column.getFirstSortDir = () => { + const sortDescFirst = + column.columnDef.sortDescFirst ?? + table.options.sortDescFirst ?? + column.getAutoSortDir() === 'desc' + return sortDescFirst ? 'desc' : 'asc' + } + + column.getNextSortingOrder = (multi?: boolean) => { + const firstSortDirection = column.getFirstSortDir() + const isSorted = column.getIsSorted() + + if (!isSorted) { + return firstSortDirection + } + + if ( + isSorted !== firstSortDirection && + (table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general + (multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove)) + ) { + return false + } + return isSorted === 'desc' ? 'asc' : 'desc' + } + + column.getCanSort = () => { + return ( + (column.columnDef.enableSorting ?? true) && + (table.options.enableSorting ?? true) && + !!column.accessorFn + ) + } + + column.getCanMultiSort = () => { + return ( + column.columnDef.enableMultiSort ?? + table.options.enableMultiSort ?? + !!column.accessorFn + ) + } + + column.getIsSorted = () => { + const columnSort = table.getState().sorting?.find(d => d.id === column.id) + + return !columnSort ? false : columnSort.desc ? 'desc' : 'asc' + } + + column.getSortIndex = () => + table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1 + + column.clearSorting = () => { + //clear sorting for just 1 column + table.setSorting(old => + old?.length ? old.filter(d => d.id !== column.id) : [] + ) + } + + column.getToggleSortingHandler = () => { + const canSort = column.getCanSort() + + return (e: unknown) => { + if (!canSort) return + ;(e as any).persist?.() + column.toggleSorting?.( + undefined, + column.getCanMultiSort() ? table.options.isMultiSortEvent?.(e) : false + ) + } + } + }, + + createTable: (table: Table): void => { + table.setSorting = updater => table.options.onSortingChange?.(updater) + table.resetSorting = defaultState => { + table.setSorting(defaultState ? [] : table.initialState?.sorting ?? []) + } + table.getPreSortedRowModel = () => table.getGroupedRowModel() + table.getSortedRowModel = () => { + if (!table._getSortedRowModel && table.options.getSortedRowModel) { + table._getSortedRowModel = table.options.getSortedRowModel(table) + } + + if (table.options.manualSorting || !table._getSortedRowModel) { + return table.getPreSortedRowModel() + } + + return table._getSortedRowModel() + } + }, +} diff --git a/node_modules/@tanstack/table-core/src/filterFns.ts b/node_modules/@tanstack/table-core/src/filterFns.ts new file mode 100644 index 00000000..a7144829 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/filterFns.ts @@ -0,0 +1,150 @@ +import { FilterFn } from './features/ColumnFiltering' + +const includesString: FilterFn = ( + row, + columnId: string, + filterValue: string +) => { + const search = filterValue?.toString()?.toLowerCase() + return Boolean( + row + .getValue(columnId) + ?.toString() + ?.toLowerCase() + ?.includes(search) + ) +} + +includesString.autoRemove = (val: any) => testFalsey(val) + +const includesStringSensitive: FilterFn = ( + row, + columnId: string, + filterValue: string +) => { + return Boolean( + row.getValue(columnId)?.toString()?.includes(filterValue) + ) +} + +includesStringSensitive.autoRemove = (val: any) => testFalsey(val) + +const equalsString: FilterFn = ( + row, + columnId: string, + filterValue: string +) => { + return ( + row.getValue(columnId)?.toString()?.toLowerCase() === + filterValue?.toLowerCase() + ) +} + +equalsString.autoRemove = (val: any) => testFalsey(val) + +const arrIncludes: FilterFn = ( + row, + columnId: string, + filterValue: unknown +) => { + return row.getValue(columnId)?.includes(filterValue) +} + +arrIncludes.autoRemove = (val: any) => testFalsey(val) + +const arrIncludesAll: FilterFn = ( + row, + columnId: string, + filterValue: unknown[] +) => { + return !filterValue.some( + val => !row.getValue(columnId)?.includes(val) + ) +} + +arrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length + +const arrIncludesSome: FilterFn = ( + row, + columnId: string, + filterValue: unknown[] +) => { + return filterValue.some(val => + row.getValue(columnId)?.includes(val) + ) +} + +arrIncludesSome.autoRemove = (val: any) => testFalsey(val) || !val?.length + +const equals: FilterFn = (row, columnId: string, filterValue: unknown) => { + return row.getValue(columnId) === filterValue +} + +equals.autoRemove = (val: any) => testFalsey(val) + +const weakEquals: FilterFn = ( + row, + columnId: string, + filterValue: unknown +) => { + return row.getValue(columnId) == filterValue +} + +weakEquals.autoRemove = (val: any) => testFalsey(val) + +const inNumberRange: FilterFn = ( + row, + columnId: string, + filterValue: [number, number] +) => { + let [min, max] = filterValue + + const rowValue = row.getValue(columnId) + return rowValue >= min && rowValue <= max +} + +inNumberRange.resolveFilterValue = (val: [any, any]) => { + let [unsafeMin, unsafeMax] = val + + let parsedMin = + typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin + let parsedMax = + typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax + + let min = + unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin + let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax + + if (min > max) { + const temp = min + min = max + max = temp + } + + return [min, max] as const +} + +inNumberRange.autoRemove = (val: any) => + testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1])) + +// Export + +export const filterFns = { + includesString, + includesStringSensitive, + equalsString, + arrIncludes, + arrIncludesAll, + arrIncludesSome, + equals, + weakEquals, + inNumberRange, +} + +export type BuiltInFilterFn = keyof typeof filterFns + +// Utils + +function testFalsey(val: any) { + return val === undefined || val === null || val === '' +} diff --git a/node_modules/@tanstack/table-core/src/index.ts b/node_modules/@tanstack/table-core/src/index.ts new file mode 100644 index 00000000..1186d272 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/index.ts @@ -0,0 +1,43 @@ +//types +export * from './columnHelper' +export * from './types' + +//core +export * from './core/cell' +export * from './core/column' +export * from './core/headers' +export * from './core/row' +export * from './core/table' + +//features +export * from './features/ColumnFaceting' +export * from './features/ColumnFiltering' +export * from './features/ColumnGrouping' +export * from './features/ColumnOrdering' +export * from './features/ColumnPinning' +export * from './features/ColumnSizing' +export * from './features/ColumnVisibility' +export * from './features/GlobalFaceting' +export * from './features/GlobalFiltering' +export * from './features/RowExpanding' +export * from './features/RowPagination' +export * from './features/RowPinning' +export * from './features/RowSelection' +export * from './features/RowSorting' + +//utils +export * from './utils' +export * from './utils/getCoreRowModel' +export * from './utils/getExpandedRowModel' +export * from './utils/getFacetedMinMaxValues' +export * from './utils/getFacetedRowModel' +export * from './utils/getFacetedUniqueValues' +export * from './utils/getFilteredRowModel' +export * from './utils/getGroupedRowModel' +export * from './utils/getPaginationRowModel' +export * from './utils/getSortedRowModel' + +//fns +export * from './aggregationFns' +export * from './filterFns' +export * from './sortingFns' diff --git a/node_modules/@tanstack/table-core/src/sortingFns.ts b/node_modules/@tanstack/table-core/src/sortingFns.ts new file mode 100644 index 00000000..acb0c05f --- /dev/null +++ b/node_modules/@tanstack/table-core/src/sortingFns.ts @@ -0,0 +1,128 @@ +import { SortingFn } from './features/RowSorting' + +export const reSplitAlphaNumeric = /([0-9]+)/gm + +const alphanumeric: SortingFn = (rowA, rowB, columnId) => { + return compareAlphanumeric( + toString(rowA.getValue(columnId)).toLowerCase(), + toString(rowB.getValue(columnId)).toLowerCase() + ) +} + +const alphanumericCaseSensitive: SortingFn = (rowA, rowB, columnId) => { + return compareAlphanumeric( + toString(rowA.getValue(columnId)), + toString(rowB.getValue(columnId)) + ) +} + +// The text filter is more basic (less numeric support) +// but is much faster +const text: SortingFn = (rowA, rowB, columnId) => { + return compareBasic( + toString(rowA.getValue(columnId)).toLowerCase(), + toString(rowB.getValue(columnId)).toLowerCase() + ) +} + +// The text filter is more basic (less numeric support) +// but is much faster +const textCaseSensitive: SortingFn = (rowA, rowB, columnId) => { + return compareBasic( + toString(rowA.getValue(columnId)), + toString(rowB.getValue(columnId)) + ) +} + +const datetime: SortingFn = (rowA, rowB, columnId) => { + const a = rowA.getValue(columnId) + const b = rowB.getValue(columnId) + + // Can handle nullish values + // Use > and < because == (and ===) doesn't work with + // Date objects (would require calling getTime()). + return a > b ? 1 : a < b ? -1 : 0 +} + +const basic: SortingFn = (rowA, rowB, columnId) => { + return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)) +} + +// Utils + +function compareBasic(a: any, b: any) { + return a === b ? 0 : a > b ? 1 : -1 +} + +function toString(a: any) { + if (typeof a === 'number') { + if (isNaN(a) || a === Infinity || a === -Infinity) { + return '' + } + return String(a) + } + if (typeof a === 'string') { + return a + } + return '' +} + +// Mixed sorting is slow, but very inclusive of many edge cases. +// It handles numbers, mixed alphanumeric combinations, and even +// null, undefined, and Infinity +function compareAlphanumeric(aStr: string, bStr: string) { + // Split on number groups, but keep the delimiter + // Then remove falsey split values + const a = aStr.split(reSplitAlphaNumeric).filter(Boolean) + const b = bStr.split(reSplitAlphaNumeric).filter(Boolean) + + // While + while (a.length && b.length) { + const aa = a.shift()! + const bb = b.shift()! + + const an = parseInt(aa, 10) + const bn = parseInt(bb, 10) + + const combo = [an, bn].sort() + + // Both are string + if (isNaN(combo[0]!)) { + if (aa > bb) { + return 1 + } + if (bb > aa) { + return -1 + } + continue + } + + // One is a string, one is a number + if (isNaN(combo[1]!)) { + return isNaN(an) ? -1 : 1 + } + + // Both are numbers + if (an > bn) { + return 1 + } + if (bn > an) { + return -1 + } + } + + return a.length - b.length +} + +// Exports + +export const sortingFns = { + alphanumeric, + alphanumericCaseSensitive, + text, + textCaseSensitive, + datetime, + basic, +} + +export type BuiltInSortingFn = keyof typeof sortingFns diff --git a/node_modules/@tanstack/table-core/src/types.ts b/node_modules/@tanstack/table-core/src/types.ts new file mode 100644 index 00000000..26bf4793 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/types.ts @@ -0,0 +1,361 @@ +import { CoreOptions, CoreTableState, CoreInstance } from './core/table' +import { + VisibilityInstance, + VisibilityTableState, + VisibilityColumn as ColumnVisibilityColumn, + VisibilityOptions, + VisibilityColumnDef, + VisibilityRow, +} from './features/ColumnVisibility' +import { + ColumnOrderColumn, + ColumnOrderInstance, + ColumnOrderOptions, + ColumnOrderTableState, +} from './features/ColumnOrdering' +import { + ColumnPinningColumn, + ColumnPinningColumnDef, + ColumnPinningInstance, + ColumnPinningOptions, + ColumnPinningRow, + ColumnPinningTableState, +} from './features/ColumnPinning' +import { + RowPinningInstance, + RowPinningOptions, + RowPinningRow, + RowPinningTableState, +} from './features/RowPinning' +import { + CoreHeader, + CoreHeaderGroup, + HeaderContext, + HeadersInstance, +} from './core/headers' +import { FacetedColumn, FacetedOptions } from './features/ColumnFaceting' +import { GlobalFacetingInstance } from './features/GlobalFaceting' +import { + ColumnFiltersColumn, + ColumnFiltersColumnDef, + ColumnFiltersInstance, + ColumnFiltersOptions, + ColumnFiltersRow, + ColumnFiltersTableState, +} from './features/ColumnFiltering' +import { + GlobalFilterColumn, + GlobalFilterColumnDef, + GlobalFilterInstance, + GlobalFilterOptions, + GlobalFilterTableState, +} from './features/GlobalFiltering' +import { + SortingColumn, + SortingColumnDef, + SortingInstance, + SortingOptions, + SortingTableState, +} from './features/RowSorting' +import { + GroupingCell, + GroupingColumn, + GroupingColumnDef, + GroupingInstance, + GroupingOptions, + GroupingRow, + GroupingTableState, +} from './features/ColumnGrouping' +import { + ExpandedInstance, + ExpandedOptions, + ExpandedTableState, + ExpandedRow, +} from './features/RowExpanding' +import { + ColumnSizingColumn, + ColumnSizingColumnDef, + ColumnSizingHeader, + ColumnSizingInstance, + ColumnSizingOptions, + ColumnSizingTableState, +} from './features/ColumnSizing' +import { + PaginationInitialTableState, + PaginationInstance, + PaginationOptions, + PaginationTableState, +} from './features/RowPagination' +import { + RowSelectionInstance, + RowSelectionOptions, + RowSelectionRow, + RowSelectionTableState, +} from './features/RowSelection' +import { CoreRow } from './core/row' +import { PartialKeys, UnionToIntersection } from './utils' +import { CellContext, CoreCell } from './core/cell' +import { CoreColumn } from './core/column' + +export interface TableFeature { + createCell?: ( + cell: Cell, + column: Column, + row: Row, + table: Table + ) => void + createColumn?: (column: Column, table: Table) => void + createHeader?: (header: Header, table: Table) => void + createRow?: (row: Row, table: Table) => void + createTable?: (table: Table) => void + getDefaultColumnDef?: () => Partial> + getDefaultOptions?: ( + table: Table + ) => Partial> + getInitialState?: (initialState?: InitialTableState) => Partial +} + +export interface TableMeta {} + +export interface ColumnMeta {} + +export interface FilterMeta {} + +export interface FilterFns {} + +export interface SortingFns {} + +export interface AggregationFns {} + +export type Updater = T | ((old: T) => T) +export type OnChangeFn = (updaterOrValue: Updater) => void + +export type RowData = unknown | object | any[] + +export type AnyRender = (Comp: any, props: any) => any + +export interface Table + extends CoreInstance, + HeadersInstance, + VisibilityInstance, + ColumnOrderInstance, + ColumnPinningInstance, + RowPinningInstance, + ColumnFiltersInstance, + GlobalFilterInstance, + GlobalFacetingInstance, + SortingInstance, + GroupingInstance, + ColumnSizingInstance, + ExpandedInstance, + PaginationInstance, + RowSelectionInstance {} + +interface FeatureOptions + extends VisibilityOptions, + ColumnOrderOptions, + ColumnPinningOptions, + RowPinningOptions, + FacetedOptions, + ColumnFiltersOptions, + GlobalFilterOptions, + SortingOptions, + GroupingOptions, + ExpandedOptions, + ColumnSizingOptions, + PaginationOptions, + RowSelectionOptions {} + +export interface TableOptionsResolved + extends CoreOptions, + FeatureOptions {} + +export interface TableOptions + extends PartialKeys< + TableOptionsResolved, + 'state' | 'onStateChange' | 'renderFallbackValue' + > {} + +export interface TableState + extends CoreTableState, + VisibilityTableState, + ColumnOrderTableState, + ColumnPinningTableState, + RowPinningTableState, + ColumnFiltersTableState, + GlobalFilterTableState, + SortingTableState, + ExpandedTableState, + GroupingTableState, + ColumnSizingTableState, + PaginationTableState, + RowSelectionTableState {} + +interface CompleteInitialTableState + extends CoreTableState, + VisibilityTableState, + ColumnOrderTableState, + ColumnPinningTableState, + RowPinningTableState, + ColumnFiltersTableState, + GlobalFilterTableState, + SortingTableState, + ExpandedTableState, + GroupingTableState, + ColumnSizingTableState, + PaginationInitialTableState, + RowSelectionTableState {} + +export interface InitialTableState extends Partial {} + +export interface Row + extends CoreRow, + VisibilityRow, + ColumnPinningRow, + RowPinningRow, + ColumnFiltersRow, + GroupingRow, + RowSelectionRow, + ExpandedRow {} + +export interface RowModel { + rows: Row[] + flatRows: Row[] + rowsById: Record> +} + +export type AccessorFn = ( + originalRow: TData, + index: number +) => TValue + +export type ColumnDefTemplate = + | string + | ((props: TProps) => any) + +export type StringOrTemplateHeader = + | string + | ColumnDefTemplate> + +export interface StringHeaderIdentifier { + header: string + id?: string +} + +export interface IdIdentifier { + id: string + header?: StringOrTemplateHeader +} + +type ColumnIdentifiers = + | IdIdentifier + | StringHeaderIdentifier + +// + +interface ColumnDefExtensions + extends VisibilityColumnDef, + ColumnPinningColumnDef, + ColumnFiltersColumnDef, + GlobalFilterColumnDef, + SortingColumnDef, + GroupingColumnDef, + ColumnSizingColumnDef {} + +export interface ColumnDefBase + extends ColumnDefExtensions { + getUniqueValues?: AccessorFn + footer?: ColumnDefTemplate> + cell?: ColumnDefTemplate> + meta?: ColumnMeta +} + +// + +export interface IdentifiedColumnDef + extends ColumnDefBase { + id?: string + header?: StringOrTemplateHeader +} + +export type DisplayColumnDef< + TData extends RowData, + TValue = unknown, +> = ColumnDefBase & ColumnIdentifiers + +interface GroupColumnDefBase + extends ColumnDefBase { + columns?: ColumnDef[] +} + +export type GroupColumnDef< + TData extends RowData, + TValue = unknown, +> = GroupColumnDefBase & ColumnIdentifiers + +export interface AccessorFnColumnDefBase< + TData extends RowData, + TValue = unknown, +> extends ColumnDefBase { + accessorFn: AccessorFn +} + +export type AccessorFnColumnDef< + TData extends RowData, + TValue = unknown, +> = AccessorFnColumnDefBase & ColumnIdentifiers + +export interface AccessorKeyColumnDefBase< + TData extends RowData, + TValue = unknown, +> extends ColumnDefBase { + id?: string + accessorKey: (string & {}) | keyof TData +} + +export type AccessorKeyColumnDef< + TData extends RowData, + TValue = unknown, +> = AccessorKeyColumnDefBase & + Partial> + +export type AccessorColumnDef = + | AccessorKeyColumnDef + | AccessorFnColumnDef + +// + +export type ColumnDef = + | DisplayColumnDef + | GroupColumnDef + | AccessorColumnDef + +export type ColumnDefResolved< + TData extends RowData, + TValue = unknown, +> = Partial>> & { + accessorKey?: string +} + +export interface Column + extends CoreColumn, + ColumnVisibilityColumn, + ColumnPinningColumn, + FacetedColumn, + ColumnFiltersColumn, + GlobalFilterColumn, + SortingColumn, + GroupingColumn, + ColumnSizingColumn, + ColumnOrderColumn {} + +export interface Cell + extends CoreCell, + GroupingCell {} + +export interface Header + extends CoreHeader, + ColumnSizingHeader {} + +export interface HeaderGroup + extends CoreHeaderGroup {} diff --git a/node_modules/@tanstack/table-core/src/utils.ts b/node_modules/@tanstack/table-core/src/utils.ts new file mode 100644 index 00000000..77be57d7 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils.ts @@ -0,0 +1,219 @@ +import { TableOptionsResolved, TableState, Updater } from './types' + +export type PartialKeys = Omit & Partial> +export type RequiredKeys = Omit & + Required> +export type Overwrite = Omit< + T, + keyof U +> & + U + +export type UnionToIntersection = ( + T extends any ? (x: T) => any : never +) extends (x: infer R) => any + ? R + : never + +export type IsAny = 1 extends 0 & T ? Y : N +export type IsKnown = unknown extends T ? N : Y + +type ComputeRange< + N extends number, + Result extends Array = [], +> = Result['length'] extends N + ? Result + : ComputeRange +type Index40 = ComputeRange<40>[number] + +// Is this type a tuple? +type IsTuple = T extends readonly any[] & { length: infer Length } + ? Length extends Index40 + ? T + : never + : never + +// If this type is a tuple, what indices are allowed? +type AllowedIndexes< + Tuple extends ReadonlyArray, + Keys extends number = never, +> = Tuple extends readonly [] + ? Keys + : Tuple extends readonly [infer _, ...infer Tail] + ? AllowedIndexes + : Keys + +export type DeepKeys = TDepth['length'] extends 5 + ? never + : unknown extends T + ? string + : T extends readonly any[] & IsTuple + ? AllowedIndexes | DeepKeysPrefix, TDepth> + : T extends any[] + ? DeepKeys + : T extends Date + ? never + : T extends object + ? (keyof T & string) | DeepKeysPrefix + : never + +type DeepKeysPrefix< + T, + TPrefix, + TDepth extends any[], +> = TPrefix extends keyof T & (number | string) + ? `${TPrefix}.${DeepKeys & string}` + : never + +export type DeepValue = + T extends Record + ? TProp extends `${infer TBranch}.${infer TDeepProp}` + ? DeepValue + : T[TProp & string] + : never + +export type NoInfer = [T][T extends any ? 0 : never] + +export type Getter = () => NoInfer + +/// + +export function functionalUpdate(updater: Updater, input: T): T { + return typeof updater === 'function' + ? (updater as (input: T) => T)(input) + : updater +} + +export function noop() { + // +} + +export function makeStateUpdater( + key: K, + instance: unknown +) { + return (updater: Updater) => { + ;(instance as any).setState((old: TTableState) => { + return { + ...old, + [key]: functionalUpdate(updater, (old as any)[key]), + } + }) + } +} + +type AnyFunction = (...args: any) => any + +export function isFunction(d: any): d is T { + return d instanceof Function +} + +export function isNumberArray(d: any): d is number[] { + return Array.isArray(d) && d.every(val => typeof val === 'number') +} + +export function flattenBy( + arr: TNode[], + getChildren: (item: TNode) => TNode[] +) { + const flat: TNode[] = [] + + const recurse = (subArr: TNode[]) => { + subArr.forEach(item => { + flat.push(item) + const children = getChildren(item) + if (children?.length) { + recurse(children) + } + }) + } + + recurse(arr) + + return flat +} + +export function memo( + getDeps: (depArgs?: TDepArgs) => [...TDeps], + fn: (...args: NoInfer<[...TDeps]>) => TResult, + opts: { + key: any + debug?: () => any + onChange?: (result: TResult) => void + } +): (depArgs?: TDepArgs) => TResult { + let deps: any[] = [] + let result: TResult | undefined + + return depArgs => { + let depTime: number + if (opts.key && opts.debug) depTime = Date.now() + + const newDeps = getDeps(depArgs) + + const depsChanged = + newDeps.length !== deps.length || + newDeps.some((dep: any, index: number) => deps[index] !== dep) + + if (!depsChanged) { + return result! + } + + deps = newDeps + + let resultTime: number + if (opts.key && opts.debug) resultTime = Date.now() + + result = fn(...newDeps) + opts?.onChange?.(result) + + if (opts.key && opts.debug) { + if (opts?.debug()) { + const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100 + const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100 + const resultFpsPercentage = resultEndTime / 16 + + const pad = (str: number | string, num: number) => { + str = String(str) + while (str.length < num) { + str = ' ' + str + } + return str + } + + console.info( + `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, + ` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max( + 0, + Math.min(120 - 120 * resultFpsPercentage, 120) + )}deg 100% 31%);`, + opts?.key + ) + } + } + + return result! + } +} + +export function getMemoOptions( + tableOptions: Partial>, + debugLevel: + | 'debugAll' + | 'debugCells' + | 'debugTable' + | 'debugColumns' + | 'debugRows' + | 'debugHeaders', + key: string, + onChange?: (result: any) => void +) { + return { + debug: () => tableOptions?.debugAll ?? tableOptions[debugLevel], + key: process.env.NODE_ENV === 'development' && key, + onChange, + } +} diff --git a/node_modules/@tanstack/table-core/src/utils/document.ts b/node_modules/@tanstack/table-core/src/utils/document.ts new file mode 100644 index 00000000..3d46d95b --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/document.ts @@ -0,0 +1,12 @@ +export function safelyAccessDocument(_document?: Document): Document | null { + return _document || (typeof document !== 'undefined' ? document : null) +} + +export function safelyAccessDocumentEvent(event: Event): Document | null { + return !!event && + !!event.target && + typeof event.target === 'object' && + 'ownerDocument' in event.target + ? (event.target.ownerDocument as Document | null) + : null +} diff --git a/node_modules/@tanstack/table-core/src/utils/filterRowsUtils.ts b/node_modules/@tanstack/table-core/src/utils/filterRowsUtils.ts new file mode 100644 index 00000000..a27258f1 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/filterRowsUtils.ts @@ -0,0 +1,130 @@ +import { createRow } from '../core/row' +import { Row, RowModel, Table, RowData } from '../types' + +export function filterRows( + rows: Row[], + filterRowImpl: (row: Row) => any, + table: Table +) { + if (table.options.filterFromLeafRows) { + return filterRowModelFromLeafs(rows, filterRowImpl, table) + } + + return filterRowModelFromRoot(rows, filterRowImpl, table) +} + +function filterRowModelFromLeafs( + rowsToFilter: Row[], + filterRow: (row: Row) => Row[], + table: Table +): RowModel { + const newFilteredFlatRows: Row[] = [] + const newFilteredRowsById: Record> = {} + const maxDepth = table.options.maxLeafRowFilterDepth ?? 100 + + const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => { + const rows: Row[] = [] + + // Filter from children up first + for (let i = 0; i < rowsToFilter.length; i++) { + let row = rowsToFilter[i]! + + const newRow = createRow( + table, + row.id, + row.original, + row.index, + row.depth, + undefined, + row.parentId + ) + newRow.columnFilters = row.columnFilters + + if (row.subRows?.length && depth < maxDepth) { + newRow.subRows = recurseFilterRows(row.subRows, depth + 1) + row = newRow + + if (filterRow(row) && !newRow.subRows.length) { + rows.push(row) + newFilteredRowsById[row.id] = row + newFilteredFlatRows.push(row) + continue + } + + if (filterRow(row) || newRow.subRows.length) { + rows.push(row) + newFilteredRowsById[row.id] = row + newFilteredFlatRows.push(row) + continue + } + } else { + row = newRow + if (filterRow(row)) { + rows.push(row) + newFilteredRowsById[row.id] = row + newFilteredFlatRows.push(row) + } + } + } + + return rows + } + + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById, + } +} + +function filterRowModelFromRoot( + rowsToFilter: Row[], + filterRow: (row: Row) => any, + table: Table +): RowModel { + const newFilteredFlatRows: Row[] = [] + const newFilteredRowsById: Record> = {} + const maxDepth = table.options.maxLeafRowFilterDepth ?? 100 + + // Filters top level and nested rows + const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => { + // Filter from parents downward first + + const rows: Row[] = [] + + // Apply the filter to any subRows + for (let i = 0; i < rowsToFilter.length; i++) { + let row = rowsToFilter[i]! + + const pass = filterRow(row) + + if (pass) { + if (row.subRows?.length && depth < maxDepth) { + const newRow = createRow( + table, + row.id, + row.original, + row.index, + row.depth, + undefined, + row.parentId + ) + newRow.subRows = recurseFilterRows(row.subRows, depth + 1) + row = newRow + } + + rows.push(row) + newFilteredFlatRows.push(row) + newFilteredRowsById[row.id] = row + } + } + + return rows + } + + return { + rows: recurseFilterRows(rowsToFilter), + flatRows: newFilteredFlatRows, + rowsById: newFilteredRowsById, + } +} diff --git a/node_modules/@tanstack/table-core/src/utils/getCoreRowModel.ts b/node_modules/@tanstack/table-core/src/utils/getCoreRowModel.ts new file mode 100644 index 00000000..e6f7349a --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getCoreRowModel.ts @@ -0,0 +1,82 @@ +import { createRow } from '../core/row' +import { Table, Row, RowModel, RowData } from '../types' +import { getMemoOptions, memo } from '../utils' + +export function getCoreRowModel(): ( + table: Table +) => () => RowModel { + return table => + memo( + () => [table.options.data], + ( + data + ): { + rows: Row[] + flatRows: Row[] + rowsById: Record> + } => { + const rowModel: RowModel = { + rows: [], + flatRows: [], + rowsById: {}, + } + + const accessRows = ( + originalRows: TData[], + depth = 0, + parentRow?: Row + ): Row[] => { + const rows = [] as Row[] + + for (let i = 0; i < originalRows.length; i++) { + // This could be an expensive check at scale, so we should move it somewhere else, but where? + // if (!id) { + // if (process.env.NODE_ENV !== 'production') { + // throw new Error(`getRowId expected an ID, but got ${id}`) + // } + // } + + // Make the row + const row = createRow( + table, + table._getRowId(originalRows[i]!, i, parentRow), + originalRows[i]!, + i, + depth, + undefined, + parentRow?.id + ) + + // Keep track of every row in a flat array + rowModel.flatRows.push(row) + // Also keep track of every row by its ID + rowModel.rowsById[row.id] = row + // Push table row into parent + rows.push(row) + + // Get the original subrows + if (table.options.getSubRows) { + row.originalSubRows = table.options.getSubRows( + originalRows[i]!, + i + ) + + // Then recursively access them + if (row.originalSubRows?.length) { + row.subRows = accessRows(row.originalSubRows, depth + 1, row) + } + } + } + + return rows + } + + rowModel.rows = accessRows(data) + + return rowModel + }, + getMemoOptions(table.options, 'debugTable', 'getRowModel', () => + table._autoResetPageIndex() + ) + ) +} diff --git a/node_modules/@tanstack/table-core/src/utils/getExpandedRowModel.ts b/node_modules/@tanstack/table-core/src/utils/getExpandedRowModel.ts new file mode 100644 index 00000000..2890b6e7 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getExpandedRowModel.ts @@ -0,0 +1,51 @@ +import { Table, Row, RowModel, RowData } from '../types' +import { getMemoOptions, memo } from '../utils' + +export function getExpandedRowModel(): ( + table: Table +) => () => RowModel { + return table => + memo( + () => [ + table.getState().expanded, + table.getPreExpandedRowModel(), + table.options.paginateExpandedRows, + ], + (expanded, rowModel, paginateExpandedRows) => { + if ( + !rowModel.rows.length || + (expanded !== true && !Object.keys(expanded ?? {}).length) + ) { + return rowModel + } + + if (!paginateExpandedRows) { + // Only expand rows at this point if they are being paginated + return rowModel + } + + return expandRows(rowModel) + }, + getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel') + ) +} + +export function expandRows(rowModel: RowModel) { + const expandedRows: Row[] = [] + + const handleRow = (row: Row) => { + expandedRows.push(row) + + if (row.subRows?.length && row.getIsExpanded()) { + row.subRows.forEach(handleRow) + } + } + + rowModel.rows.forEach(handleRow) + + return { + rows: expandedRows, + flatRows: rowModel.flatRows, + rowsById: rowModel.rowsById, + } +} diff --git a/node_modules/@tanstack/table-core/src/utils/getFacetedMinMaxValues.ts b/node_modules/@tanstack/table-core/src/utils/getFacetedMinMaxValues.ts new file mode 100644 index 00000000..129ed4b4 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getFacetedMinMaxValues.ts @@ -0,0 +1,33 @@ +import { Table, RowData } from '../types' +import { getMemoOptions, memo } from '../utils' + +export function getFacetedMinMaxValues(): ( + table: Table, + columnId: string +) => () => undefined | [number, number] { + return (table, columnId) => + memo( + () => [table.getColumn(columnId)?.getFacetedRowModel()], + facetedRowModel => { + if (!facetedRowModel) return undefined + + const uniqueValues = facetedRowModel.flatRows + .flatMap(flatRow => flatRow.getUniqueValues(columnId) ?? []) + .map(Number) + .filter(value => !Number.isNaN(value)) + + if (!uniqueValues.length) return + + let facetedMinValue = uniqueValues[0]! + let facetedMaxValue = uniqueValues[uniqueValues.length - 1]! + + for (const value of uniqueValues) { + if (value < facetedMinValue) facetedMinValue = value + else if (value > facetedMaxValue) facetedMaxValue = value + } + + return [facetedMinValue, facetedMaxValue] + }, + getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues') + ) +} diff --git a/node_modules/@tanstack/table-core/src/utils/getFacetedRowModel.ts b/node_modules/@tanstack/table-core/src/utils/getFacetedRowModel.ts new file mode 100644 index 00000000..ab0110a4 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getFacetedRowModel.ts @@ -0,0 +1,44 @@ +import { Table, RowModel, Row, RowData } from '../types' +import { getMemoOptions, memo } from '../utils' +import { filterRows } from './filterRowsUtils' + +export function getFacetedRowModel(): ( + table: Table, + columnId: string +) => () => RowModel { + return (table, columnId) => + memo( + () => [ + table.getPreFilteredRowModel(), + table.getState().columnFilters, + table.getState().globalFilter, + table.getFilteredRowModel(), + ], + (preRowModel, columnFilters, globalFilter) => { + if ( + !preRowModel.rows.length || + (!columnFilters?.length && !globalFilter) + ) { + return preRowModel + } + + const filterableIds = [ + ...columnFilters.map(d => d.id).filter(d => d !== columnId), + globalFilter ? '__global__' : undefined, + ].filter(Boolean) as string[] + + const filterRowsImpl = (row: Row) => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]!] === false) { + return false + } + } + return true + } + + return filterRows(preRowModel.rows, filterRowsImpl, table) + }, + getMemoOptions(table.options, 'debugTable', 'getFacetedRowModel') + ) +} diff --git a/node_modules/@tanstack/table-core/src/utils/getFacetedUniqueValues.ts b/node_modules/@tanstack/table-core/src/utils/getFacetedUniqueValues.ts new file mode 100644 index 00000000..93f957f1 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getFacetedUniqueValues.ts @@ -0,0 +1,42 @@ +import { Table, RowData } from '../types' +import { getMemoOptions, memo } from '../utils' + +export function getFacetedUniqueValues(): ( + table: Table, + columnId: string +) => () => Map { + return (table, columnId) => + memo( + () => [table.getColumn(columnId)?.getFacetedRowModel()], + facetedRowModel => { + if (!facetedRowModel) return new Map() + + let facetedUniqueValues = new Map() + + for (let i = 0; i < facetedRowModel.flatRows.length; i++) { + const values = + facetedRowModel.flatRows[i]!.getUniqueValues(columnId) + + for (let j = 0; j < values.length; j++) { + const value = values[j]! + + if (facetedUniqueValues.has(value)) { + facetedUniqueValues.set( + value, + (facetedUniqueValues.get(value) ?? 0) + 1 + ) + } else { + facetedUniqueValues.set(value, 1) + } + } + } + + return facetedUniqueValues + }, + getMemoOptions( + table.options, + 'debugTable', + `getFacetedUniqueValues_${columnId}` + ) + ) +} diff --git a/node_modules/@tanstack/table-core/src/utils/getFilteredRowModel.ts b/node_modules/@tanstack/table-core/src/utils/getFilteredRowModel.ts new file mode 100644 index 00000000..c04341ad --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getFilteredRowModel.ts @@ -0,0 +1,151 @@ +import { ResolvedColumnFilter } from '../features/ColumnFiltering' +import { Table, RowModel, Row, RowData } from '../types' +import { getMemoOptions, memo } from '../utils' +import { filterRows } from './filterRowsUtils' + +export function getFilteredRowModel(): ( + table: Table +) => () => RowModel { + return table => + memo( + () => [ + table.getPreFilteredRowModel(), + table.getState().columnFilters, + table.getState().globalFilter, + ], + (rowModel, columnFilters, globalFilter) => { + if ( + !rowModel.rows.length || + (!columnFilters?.length && !globalFilter) + ) { + for (let i = 0; i < rowModel.flatRows.length; i++) { + rowModel.flatRows[i]!.columnFilters = {} + rowModel.flatRows[i]!.columnFiltersMeta = {} + } + return rowModel + } + + const resolvedColumnFilters: ResolvedColumnFilter[] = [] + const resolvedGlobalFilters: ResolvedColumnFilter[] = [] + + ;(columnFilters ?? []).forEach(d => { + const column = table.getColumn(d.id) + + if (!column) { + return + } + + const filterFn = column.getFilterFn() + + if (!filterFn) { + if (process.env.NODE_ENV !== 'production') { + console.warn( + `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.` + ) + } + return + } + + resolvedColumnFilters.push({ + id: d.id, + filterFn, + resolvedValue: filterFn.resolveFilterValue?.(d.value) ?? d.value, + }) + }) + + const filterableIds = (columnFilters ?? []).map(d => d.id) + + const globalFilterFn = table.getGlobalFilterFn() + + const globallyFilterableColumns = table + .getAllLeafColumns() + .filter(column => column.getCanGlobalFilter()) + + if ( + globalFilter && + globalFilterFn && + globallyFilterableColumns.length + ) { + filterableIds.push('__global__') + + globallyFilterableColumns.forEach(column => { + resolvedGlobalFilters.push({ + id: column.id, + filterFn: globalFilterFn, + resolvedValue: + globalFilterFn.resolveFilterValue?.(globalFilter) ?? + globalFilter, + }) + }) + } + + let currentColumnFilter + let currentGlobalFilter + + // Flag the prefiltered row model with each filter state + for (let j = 0; j < rowModel.flatRows.length; j++) { + const row = rowModel.flatRows[j]! + + row.columnFilters = {} + + if (resolvedColumnFilters.length) { + for (let i = 0; i < resolvedColumnFilters.length; i++) { + currentColumnFilter = resolvedColumnFilters[i]! + const id = currentColumnFilter.id + + // Tag the row with the column filter state + row.columnFilters[id] = currentColumnFilter.filterFn( + row, + id, + currentColumnFilter.resolvedValue, + filterMeta => { + row.columnFiltersMeta[id] = filterMeta + } + ) + } + } + + if (resolvedGlobalFilters.length) { + for (let i = 0; i < resolvedGlobalFilters.length; i++) { + currentGlobalFilter = resolvedGlobalFilters[i]! + const id = currentGlobalFilter.id + // Tag the row with the first truthy global filter state + if ( + currentGlobalFilter.filterFn( + row, + id, + currentGlobalFilter.resolvedValue, + filterMeta => { + row.columnFiltersMeta[id] = filterMeta + } + ) + ) { + row.columnFilters.__global__ = true + break + } + } + + if (row.columnFilters.__global__ !== true) { + row.columnFilters.__global__ = false + } + } + } + + const filterRowsImpl = (row: Row) => { + // Horizontally filter rows through each column + for (let i = 0; i < filterableIds.length; i++) { + if (row.columnFilters[filterableIds[i]!] === false) { + return false + } + } + return true + } + + // Filter final rows using all of the active filters + return filterRows(rowModel.rows, filterRowsImpl, table) + }, + getMemoOptions(table.options, 'debugTable', 'getFilteredRowModel', () => + table._autoResetPageIndex() + ) + ) +} diff --git a/node_modules/@tanstack/table-core/src/utils/getGroupedRowModel.ts b/node_modules/@tanstack/table-core/src/utils/getGroupedRowModel.ts new file mode 100644 index 00000000..da976319 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getGroupedRowModel.ts @@ -0,0 +1,190 @@ +import { createRow } from '../core/row' +import { Row, RowData, RowModel, Table } from '../types' +import { flattenBy, getMemoOptions, memo } from '../utils' +import { GroupingState } from '../features/ColumnGrouping' + +export function getGroupedRowModel(): ( + table: Table +) => () => RowModel { + return table => + memo( + () => [table.getState().grouping, table.getPreGroupedRowModel()], + (grouping, rowModel) => { + if (!rowModel.rows.length || !grouping.length) { + rowModel.rows.forEach(row => { + row.depth = 0 + row.parentId = undefined + }) + return rowModel + } + + // Filter the grouping list down to columns that exist + const existingGrouping = grouping.filter(columnId => + table.getColumn(columnId) + ) + + const groupedFlatRows: Row[] = [] + const groupedRowsById: Record> = {} + // const onlyGroupedFlatRows: Row[] = []; + // const onlyGroupedRowsById: Record = {}; + // const nonGroupedFlatRows: Row[] = []; + // const nonGroupedRowsById: Record = {}; + + // Recursively group the data + const groupUpRecursively = ( + rows: Row[], + depth = 0, + parentId?: string + ) => { + // Grouping depth has been been met + // Stop grouping and simply rewrite thd depth and row relationships + if (depth >= existingGrouping.length) { + return rows.map(row => { + row.depth = depth + + groupedFlatRows.push(row) + groupedRowsById[row.id] = row + + if (row.subRows) { + row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id) + } + + return row + }) + } + + const columnId: string = existingGrouping[depth]! + + // Group the rows together for this level + const rowGroupsMap = groupBy(rows, columnId) + + // Perform aggregations for each group + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map( + ([groupingValue, groupedRows], index) => { + let id = `${columnId}:${groupingValue}` + id = parentId ? `${parentId}>${id}` : id + + // First, Recurse to group sub rows before aggregation + const subRows = groupUpRecursively(groupedRows, depth + 1, id) + + subRows.forEach(subRow => { + subRow.parentId = id + }) + + // Flatten the leaf rows of the rows in this group + const leafRows = depth + ? flattenBy(groupedRows, row => row.subRows) + : groupedRows + + const row = createRow( + table, + id, + leafRows[0]!.original, + index, + depth, + undefined, + parentId + ) + + Object.assign(row, { + groupingColumnId: columnId, + groupingValue, + subRows, + leafRows, + getValue: (columnId: string) => { + // Don't aggregate columns that are in the grouping + if (existingGrouping.includes(columnId)) { + if (row._valuesCache.hasOwnProperty(columnId)) { + return row._valuesCache[columnId] + } + + if (groupedRows[0]) { + row._valuesCache[columnId] = + groupedRows[0].getValue(columnId) ?? undefined + } + + return row._valuesCache[columnId] + } + + if (row._groupingValuesCache.hasOwnProperty(columnId)) { + return row._groupingValuesCache[columnId] + } + + // Aggregate the values + const column = table.getColumn(columnId) + const aggregateFn = column?.getAggregationFn() + + if (aggregateFn) { + row._groupingValuesCache[columnId] = aggregateFn( + columnId, + leafRows, + groupedRows + ) + + return row._groupingValuesCache[columnId] + } + }, + }) + + subRows.forEach(subRow => { + groupedFlatRows.push(subRow) + groupedRowsById[subRow.id] = subRow + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }) + + return row + } + ) + + return aggregatedGroupedRows + } + + const groupedRows = groupUpRecursively(rowModel.rows, 0) + + groupedRows.forEach(subRow => { + groupedFlatRows.push(subRow) + groupedRowsById[subRow.id] = subRow + // if (subRow.getIsGrouped?.()) { + // onlyGroupedFlatRows.push(subRow); + // onlyGroupedRowsById[subRow.id] = subRow; + // } else { + // nonGroupedFlatRows.push(subRow); + // nonGroupedRowsById[subRow.id] = subRow; + // } + }) + + return { + rows: groupedRows, + flatRows: groupedFlatRows, + rowsById: groupedRowsById, + } + }, + getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => { + table._queue(() => { + table._autoResetExpanded() + table._autoResetPageIndex() + }) + }) + ) +} + +function groupBy(rows: Row[], columnId: string) { + const groupMap = new Map[]>() + + return rows.reduce((map, row) => { + const resKey = `${row.getGroupingValue(columnId)}` + const previous = map.get(resKey) + if (!previous) { + map.set(resKey, [row]) + } else { + previous.push(row) + } + return map + }, groupMap) +} diff --git a/node_modules/@tanstack/table-core/src/utils/getPaginationRowModel.ts b/node_modules/@tanstack/table-core/src/utils/getPaginationRowModel.ts new file mode 100644 index 00000000..9119a5dc --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getPaginationRowModel.ts @@ -0,0 +1,60 @@ +import { Table, RowModel, Row, RowData } from '../types' +import { getMemoOptions, memo } from '../utils' +import { expandRows } from './getExpandedRowModel' + +export function getPaginationRowModel(opts?: { + initialSync: boolean +}): (table: Table) => () => RowModel { + return table => + memo( + () => [ + table.getState().pagination, + table.getPrePaginationRowModel(), + table.options.paginateExpandedRows + ? undefined + : table.getState().expanded, + ], + (pagination, rowModel) => { + if (!rowModel.rows.length) { + return rowModel + } + + const { pageSize, pageIndex } = pagination + let { rows, flatRows, rowsById } = rowModel + const pageStart = pageSize * pageIndex + const pageEnd = pageStart + pageSize + + rows = rows.slice(pageStart, pageEnd) + + let paginatedRowModel: RowModel + + if (!table.options.paginateExpandedRows) { + paginatedRowModel = expandRows({ + rows, + flatRows, + rowsById, + }) + } else { + paginatedRowModel = { + rows, + flatRows, + rowsById, + } + } + + paginatedRowModel.flatRows = [] + + const handleRow = (row: Row) => { + paginatedRowModel.flatRows.push(row) + if (row.subRows.length) { + row.subRows.forEach(handleRow) + } + } + + paginatedRowModel.rows.forEach(handleRow) + + return paginatedRowModel + }, + getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel') + ) +} diff --git a/node_modules/@tanstack/table-core/src/utils/getSortedRowModel.ts b/node_modules/@tanstack/table-core/src/utils/getSortedRowModel.ts new file mode 100644 index 00000000..928c2644 --- /dev/null +++ b/node_modules/@tanstack/table-core/src/utils/getSortedRowModel.ts @@ -0,0 +1,121 @@ +import { Table, Row, RowModel, RowData } from '../types' +import { SortingFn } from '../features/RowSorting' +import { getMemoOptions, memo } from '../utils' + +export function getSortedRowModel(): ( + table: Table +) => () => RowModel { + return table => + memo( + () => [table.getState().sorting, table.getPreSortedRowModel()], + (sorting, rowModel) => { + if (!rowModel.rows.length || !sorting?.length) { + return rowModel + } + + const sortingState = table.getState().sorting + + const sortedFlatRows: Row[] = [] + + // Filter out sortings that correspond to non existing columns + const availableSorting = sortingState.filter(sort => + table.getColumn(sort.id)?.getCanSort() + ) + + const columnInfoById: Record< + string, + { + sortUndefined?: false | -1 | 1 | 'first' | 'last' + invertSorting?: boolean + sortingFn: SortingFn + } + > = {} + + availableSorting.forEach(sortEntry => { + const column = table.getColumn(sortEntry.id) + if (!column) return + + columnInfoById[sortEntry.id] = { + sortUndefined: column.columnDef.sortUndefined, + invertSorting: column.columnDef.invertSorting, + sortingFn: column.getSortingFn(), + } + }) + + const sortData = (rows: Row[]) => { + // This will also perform a stable sorting using the row index + // if needed. + const sortedData = rows.map(row => ({ ...row })) + + sortedData.sort((rowA, rowB) => { + for (let i = 0; i < availableSorting.length; i += 1) { + const sortEntry = availableSorting[i]! + const columnInfo = columnInfoById[sortEntry.id]! + const sortUndefined = columnInfo.sortUndefined + const isDesc = sortEntry?.desc ?? false + + let sortInt = 0 + + // All sorting ints should always return in ascending order + if (sortUndefined) { + const aValue = rowA.getValue(sortEntry.id) + const bValue = rowB.getValue(sortEntry.id) + + const aUndefined = aValue === undefined + const bUndefined = bValue === undefined + + if (aUndefined || bUndefined) { + if (sortUndefined === 'first') return aUndefined ? -1 : 1 + if (sortUndefined === 'last') return aUndefined ? 1 : -1 + sortInt = + aUndefined && bUndefined + ? 0 + : aUndefined + ? sortUndefined + : -sortUndefined + } + } + + if (sortInt === 0) { + sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id) + } + + // If sorting is non-zero, take care of desc and inversion + if (sortInt !== 0) { + if (isDesc) { + sortInt *= -1 + } + + if (columnInfo.invertSorting) { + sortInt *= -1 + } + + return sortInt + } + } + + return rowA.index - rowB.index + }) + + // If there are sub-rows, sort them + sortedData.forEach(row => { + sortedFlatRows.push(row) + if (row.subRows?.length) { + row.subRows = sortData(row.subRows) + } + }) + + return sortedData + } + + return { + rows: sortData(rowModel.rows), + flatRows: sortedFlatRows, + rowsById: rowModel.rowsById, + } + }, + getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () => + table._autoResetPageIndex() + ) + ) +} diff --git a/node_modules/react-dom/LICENSE b/node_modules/react-dom/LICENSE new file mode 100644 index 00000000..b93be905 --- /dev/null +++ b/node_modules/react-dom/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/react-dom/README.md b/node_modules/react-dom/README.md new file mode 100644 index 00000000..b078f194 --- /dev/null +++ b/node_modules/react-dom/README.md @@ -0,0 +1,60 @@ +# `react-dom` + +This package serves as the entry point to the DOM and server renderers for React. It is intended to be paired with the generic React package, which is shipped as `react` to npm. + +## Installation + +```sh +npm install react react-dom +``` + +## Usage + +### In the browser + +```js +import { createRoot } from 'react-dom/client'; + +function App() { + return

    ; +} + +const root = createRoot(document.getElementById('root')); +root.render(); +``` + +### On the server + +```js +import { renderToPipeableStream } from 'react-dom/server'; + +function App() { + return
    Hello World
    ; +} + +function handleRequest(res) { + // ... in your server handler ... + const stream = renderToPipeableStream(, { + onShellReady() { + res.statusCode = 200; + res.setHeader('Content-type', 'text/html'); + stream.pipe(res); + }, + // ... + }); +} +``` + +## API + +### `react-dom` + +See https://react.dev/reference/react-dom + +### `react-dom/client` + +See https://react.dev/reference/react-dom/client + +### `react-dom/server` + +See https://react.dev/reference/react-dom/server diff --git a/node_modules/react-dom/cjs/react-dom-client.development.js b/node_modules/react-dom/cjs/react-dom-client.development.js new file mode 100644 index 00000000..92b41f7e --- /dev/null +++ b/node_modules/react-dom/cjs/react-dom-client.development.js @@ -0,0 +1,24993 @@ +/** + * @license React + * react-dom-client.development.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* + Modernizr 3.0.0pre (Custom Build) | MIT +*/ +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function findHook(fiber, id) { + for (fiber = fiber.memoizedState; null !== fiber && 0 < id; ) + (fiber = fiber.next), id--; + return fiber; + } + function copyWithSetImpl(obj, path, index, value) { + if (index >= path.length) return value; + var key = path[index], + updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); + updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); + return updated; + } + function copyWithRename(obj, oldPath, newPath) { + if (oldPath.length !== newPath.length) + console.warn("copyWithRename() expects paths of the same length"); + else { + for (var i = 0; i < newPath.length - 1; i++) + if (oldPath[i] !== newPath[i]) { + console.warn( + "copyWithRename() expects paths to be the same except for the deepest key" + ); + return; + } + return copyWithRenameImpl(obj, oldPath, newPath, 0); + } + } + function copyWithRenameImpl(obj, oldPath, newPath, index) { + var oldKey = oldPath[index], + updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); + index + 1 === oldPath.length + ? ((updated[newPath[index]] = updated[oldKey]), + isArrayImpl(updated) + ? updated.splice(oldKey, 1) + : delete updated[oldKey]) + : (updated[oldKey] = copyWithRenameImpl( + obj[oldKey], + oldPath, + newPath, + index + 1 + )); + return updated; + } + function copyWithDeleteImpl(obj, path, index) { + var key = path[index], + updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); + if (index + 1 === path.length) + return ( + isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], + updated + ); + updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); + return updated; + } + function shouldSuspendImpl() { + return !1; + } + function shouldErrorImpl() { + return null; + } + function warnForMissingKey() {} + function warnInvalidHookAccess() { + console.error( + "Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks" + ); + } + function warnInvalidContextAccess() { + console.error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + } + function noop$2() {} + function setToSortedString(set) { + var array = []; + set.forEach(function (value) { + array.push(value); + }); + return array.sort().join(", "); + } + function createFiber(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); + } + function scheduleRoot(root, element) { + root.context === emptyContextObject && + (updateContainerImpl(root.current, 2, element, root, null, null), + flushSyncWork$1()); + } + function scheduleRefresh(root, update) { + if (null !== resolveFamily) { + var staleFamilies = update.staleFamilies; + update = update.updatedFamilies; + flushPendingEffects(); + scheduleFibersWithFamiliesRecursively( + root.current, + update, + staleFamilies + ); + flushSyncWork$1(); + } + } + function setRefreshHandler(handler) { + resolveFamily = handler; + } + function isValidContainer(node) { + return !( + !node || + (1 !== node.nodeType && 9 !== node.nodeType && 11 !== node.nodeType) + ); + } + function getNearestMountedFiber(fiber) { + var node = fiber, + nearestMounted = fiber; + if (fiber.alternate) for (; node.return; ) node = node.return; + else { + fiber = node; + do + (node = fiber), + 0 !== (node.flags & 4098) && (nearestMounted = node.return), + (fiber = node.return); + while (fiber); + } + return 3 === node.tag ? nearestMounted : null; + } + function getSuspenseInstanceFromFiber(fiber) { + if (13 === fiber.tag) { + var suspenseState = fiber.memoizedState; + null === suspenseState && + ((fiber = fiber.alternate), + null !== fiber && (suspenseState = fiber.memoizedState)); + if (null !== suspenseState) return suspenseState.dehydrated; + } + return null; + } + function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) + throw Error("Unable to find node on an unmounted component."); + } + function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + alternate = getNearestMountedFiber(fiber); + if (null === alternate) + throw Error("Unable to find node on an unmounted component."); + return alternate !== fiber ? null : fiber; + } + for (var a = fiber, b = alternate; ; ) { + var parentA = a.return; + if (null === parentA) break; + var parentB = parentA.alternate; + if (null === parentB) { + b = parentA.return; + if (null !== b) { + a = b; + continue; + } + break; + } + if (parentA.child === parentB.child) { + for (parentB = parentA.child; parentB; ) { + if (parentB === a) return assertIsMounted(parentA), fiber; + if (parentB === b) return assertIsMounted(parentA), alternate; + parentB = parentB.sibling; + } + throw Error("Unable to find node on an unmounted component."); + } + if (a.return !== b.return) (a = parentA), (b = parentB); + else { + for (var didFindChild = !1, _child = parentA.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + for (_child = parentB.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + if (!didFindChild) + throw Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ); + } + } + if (a.alternate !== b) + throw Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ); + } + if (3 !== a.tag) + throw Error("Unable to find node on an unmounted component."); + return a.stateNode.current === a ? fiber : alternate; + } + function findCurrentHostFiberImpl(node) { + var tag = node.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node; + for (node = node.child; null !== node; ) { + tag = findCurrentHostFiberImpl(node); + if (null !== tag) return tag; + node = node.sibling; + } + return null; + } + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) + return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + case REACT_ACTIVITY_TYPE: + return "Activity"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + console.error( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + function getComponentNameFromOwner(owner) { + return "number" === typeof owner.tag + ? getComponentNameFromFiber(owner) + : "string" === typeof owner.name + ? owner.name + : null; + } + function getComponentNameFromFiber(fiber) { + var type = fiber.type; + switch (fiber.tag) { + case 31: + return "Activity"; + case 24: + return "Cache"; + case 9: + return (type._context.displayName || "Context") + ".Consumer"; + case 10: + return (type.displayName || "Context") + ".Provider"; + case 18: + return "DehydratedFragment"; + case 11: + return ( + (fiber = type.render), + (fiber = fiber.displayName || fiber.name || ""), + type.displayName || + ("" !== fiber ? "ForwardRef(" + fiber + ")" : "ForwardRef") + ); + case 7: + return "Fragment"; + case 26: + case 27: + case 5: + return type; + case 4: + return "Portal"; + case 3: + return "Root"; + case 6: + return "Text"; + case 16: + return getComponentNameFromType(type); + case 8: + return type === REACT_STRICT_MODE_TYPE ? "StrictMode" : "Mode"; + case 22: + return "Offscreen"; + case 12: + return "Profiler"; + case 21: + return "Scope"; + case 13: + return "Suspense"; + case 19: + return "SuspenseList"; + case 25: + return "TracingMarker"; + case 1: + case 0: + case 14: + case 15: + if ("function" === typeof type) + return type.displayName || type.name || null; + if ("string" === typeof type) return type; + break; + case 29: + type = fiber._debugInfo; + if (null != type) + for (var i = type.length - 1; 0 <= i; i--) + if ("string" === typeof type[i].name) return type[i].name; + if (null !== fiber.return) + return getComponentNameFromFiber(fiber.return); + } + return null; + } + function createCursor(defaultValue) { + return { current: defaultValue }; + } + function pop(cursor, fiber) { + 0 > index$jscomp$0 + ? console.error("Unexpected pop.") + : (fiber !== fiberStack[index$jscomp$0] && + console.error("Unexpected Fiber popped."), + (cursor.current = valueStack[index$jscomp$0]), + (valueStack[index$jscomp$0] = null), + (fiberStack[index$jscomp$0] = null), + index$jscomp$0--); + } + function push(cursor, value, fiber) { + index$jscomp$0++; + valueStack[index$jscomp$0] = cursor.current; + fiberStack[index$jscomp$0] = fiber; + cursor.current = value; + } + function requiredContext(c) { + null === c && + console.error( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ); + return c; + } + function pushHostContainer(fiber, nextRootInstance) { + push(rootInstanceStackCursor, nextRootInstance, fiber); + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor, null, fiber); + var nextRootContext = nextRootInstance.nodeType; + switch (nextRootContext) { + case 9: + case 11: + nextRootContext = 9 === nextRootContext ? "#document" : "#fragment"; + nextRootInstance = (nextRootInstance = + nextRootInstance.documentElement) + ? (nextRootInstance = nextRootInstance.namespaceURI) + ? getOwnHostContext(nextRootInstance) + : HostContextNamespaceNone + : HostContextNamespaceNone; + break; + default: + if ( + ((nextRootContext = nextRootInstance.tagName), + (nextRootInstance = nextRootInstance.namespaceURI)) + ) + (nextRootInstance = getOwnHostContext(nextRootInstance)), + (nextRootInstance = getChildHostContextProd( + nextRootInstance, + nextRootContext + )); + else + switch (nextRootContext) { + case "svg": + nextRootInstance = HostContextNamespaceSvg; + break; + case "math": + nextRootInstance = HostContextNamespaceMath; + break; + default: + nextRootInstance = HostContextNamespaceNone; + } + } + nextRootContext = nextRootContext.toLowerCase(); + nextRootContext = updatedAncestorInfoDev(null, nextRootContext); + nextRootContext = { + context: nextRootInstance, + ancestorInfo: nextRootContext + }; + pop(contextStackCursor, fiber); + push(contextStackCursor, nextRootContext, fiber); + } + function popHostContainer(fiber) { + pop(contextStackCursor, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); + } + function getHostContext() { + return requiredContext(contextStackCursor.current); + } + function pushHostContext(fiber) { + null !== fiber.memoizedState && + push(hostTransitionProviderCursor, fiber, fiber); + var context = requiredContext(contextStackCursor.current); + var type = fiber.type; + var nextContext = getChildHostContextProd(context.context, type); + type = updatedAncestorInfoDev(context.ancestorInfo, type); + nextContext = { context: nextContext, ancestorInfo: type }; + context !== nextContext && + (push(contextFiberStackCursor, fiber, fiber), + push(contextStackCursor, nextContext, fiber)); + } + function popHostContext(fiber) { + contextFiberStackCursor.current === fiber && + (pop(contextStackCursor, fiber), pop(contextFiberStackCursor, fiber)); + hostTransitionProviderCursor.current === fiber && + (pop(hostTransitionProviderCursor, fiber), + (HostTransitionContext._currentValue = NotPendingTransition)); + } + function typeName(value) { + return ( + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object" + ); + } + function willCoercionThrow(value) { + try { + return testStringCoercion(value), !1; + } catch (e) { + return !0; + } + } + function testStringCoercion(value) { + return "" + value; + } + function checkAttributeStringCoercion(value, attributeName) { + if (willCoercionThrow(value)) + return ( + console.error( + "The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before using it here.", + attributeName, + typeName(value) + ), + testStringCoercion(value) + ); + } + function checkCSSPropertyStringCoercion(value, propName) { + if (willCoercionThrow(value)) + return ( + console.error( + "The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before using it here.", + propName, + typeName(value) + ), + testStringCoercion(value) + ); + } + function checkFormFieldValueStringCoercion(value) { + if (willCoercionThrow(value)) + return ( + console.error( + "Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before using it here.", + typeName(value) + ), + testStringCoercion(value) + ); + } + function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) return !0; + if (!hook.supportsFiber) + return ( + console.error( + "The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://react.dev/link/react-devtools" + ), + !0 + ); + try { + (rendererID = hook.inject(internals)), (injectedHook = hook); + } catch (err) { + console.error("React instrumentation encountered an error: %s.", err); + } + return hook.checkDCE ? !0 : !1; + } + function setIsStrictModeForDevtools(newIsStrictMode) { + "function" === typeof log$1 && + unstable_setDisableYieldValue(newIsStrictMode); + if (injectedHook && "function" === typeof injectedHook.setStrictMode) + try { + injectedHook.setStrictMode(rendererID, newIsStrictMode); + } catch (err) { + hasLoggedError || + ((hasLoggedError = !0), + console.error( + "React instrumentation encountered an error: %s", + err + )); + } + } + function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; + } + function markCommitStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStopped && + injectedProfilingHooks.markCommitStopped(); + } + function markComponentRenderStarted(fiber) { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentRenderStarted && + injectedProfilingHooks.markComponentRenderStarted(fiber); + } + function markComponentRenderStopped() { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentRenderStopped && + injectedProfilingHooks.markComponentRenderStopped(); + } + function markRenderStarted(lanes) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStarted && + injectedProfilingHooks.markRenderStarted(lanes); + } + function markRenderStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStopped && + injectedProfilingHooks.markRenderStopped(); + } + function markStateUpdateScheduled(fiber, lane) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markStateUpdateScheduled && + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); + } + function clz32Fallback(x) { + x >>>= 0; + return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; + } + function getLabelForLane(lane) { + if (lane & 1) return "SyncHydrationLane"; + if (lane & 2) return "Sync"; + if (lane & 4) return "InputContinuousHydration"; + if (lane & 8) return "InputContinuous"; + if (lane & 16) return "DefaultHydration"; + if (lane & 32) return "Default"; + if (lane & 128) return "TransitionHydration"; + if (lane & 4194048) return "Transition"; + if (lane & 62914560) return "Retry"; + if (lane & 67108864) return "SelectiveHydration"; + if (lane & 134217728) return "IdleHydration"; + if (lane & 268435456) return "Idle"; + if (lane & 536870912) return "Offscreen"; + if (lane & 1073741824) return "Deferred"; + } + function getHighestPriorityLanes(lanes) { + var pendingSyncLanes = lanes & 42; + if (0 !== pendingSyncLanes) return pendingSyncLanes; + switch (lanes & -lanes) { + case 1: + return 1; + case 2: + return 2; + case 4: + return 4; + case 8: + return 8; + case 16: + return 16; + case 32: + return 32; + case 64: + return 64; + case 128: + return 128; + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + return lanes & 4194048; + case 4194304: + case 8388608: + case 16777216: + case 33554432: + return lanes & 62914560; + case 67108864: + return 67108864; + case 134217728: + return 134217728; + case 268435456: + return 268435456; + case 536870912: + return 536870912; + case 1073741824: + return 0; + default: + return ( + console.error( + "Should have found matching lanes. This is a bug in React." + ), + lanes + ); + } + } + function getNextLanes(root, wipLanes, rootHasPendingCommit) { + var pendingLanes = root.pendingLanes; + if (0 === pendingLanes) return 0; + var nextLanes = 0, + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes; + root = root.warmLanes; + var nonIdlePendingLanes = pendingLanes & 134217727; + 0 !== nonIdlePendingLanes + ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), + 0 !== pendingLanes + ? (nextLanes = getHighestPriorityLanes(pendingLanes)) + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : rootHasPendingCommit || + ((rootHasPendingCommit = nonIdlePendingLanes & ~root), + 0 !== rootHasPendingCommit && + (nextLanes = + getHighestPriorityLanes(rootHasPendingCommit))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : rootHasPendingCommit || + ((rootHasPendingCommit = pendingLanes & ~root), + 0 !== rootHasPendingCommit && + (nextLanes = getHighestPriorityLanes(rootHasPendingCommit)))); + return 0 === nextLanes + ? 0 + : 0 !== wipLanes && + wipLanes !== nextLanes && + 0 === (wipLanes & suspendedLanes) && + ((suspendedLanes = nextLanes & -nextLanes), + (rootHasPendingCommit = wipLanes & -wipLanes), + suspendedLanes >= rootHasPendingCommit || + (32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048))) + ? wipLanes + : nextLanes; + } + function checkIfRootIsPrerendering(root, renderLanes) { + return ( + 0 === + (root.pendingLanes & + ~(root.suspendedLanes & ~root.pingedLanes) & + renderLanes) + ); + } + function computeExpirationTime(lane, currentTime) { + switch (lane) { + case 1: + case 2: + case 4: + case 8: + case 64: + return currentTime + 250; + case 16: + case 32: + case 128: + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + return currentTime + 5e3; + case 4194304: + case 8388608: + case 16777216: + case 33554432: + return -1; + case 67108864: + case 134217728: + case 268435456: + case 536870912: + case 1073741824: + return -1; + default: + return ( + console.error( + "Should have found matching lanes. This is a bug in React." + ), + -1 + ); + } + } + function claimNextTransitionLane() { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194048) && (nextTransitionLane = 256); + return lane; + } + function claimNextRetryLane() { + var lane = nextRetryLane; + nextRetryLane <<= 1; + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); + return lane; + } + function createLaneMap(initial) { + for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); + return laneMap; + } + function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), + (root.pingedLanes = 0), + (root.warmLanes = 0)); + } + function markRootFinished( + root, + finishedLanes, + remainingLanes, + spawnedLane, + updatedLanes, + suspendedRetryLanes + ) { + var previouslyPendingLanes = root.pendingLanes; + root.pendingLanes = remainingLanes; + root.suspendedLanes = 0; + root.pingedLanes = 0; + root.warmLanes = 0; + root.expiredLanes &= remainingLanes; + root.entangledLanes &= remainingLanes; + root.errorRecoveryDisabledLanes &= remainingLanes; + root.shellSuspendCounter = 0; + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + for ( + remainingLanes = previouslyPendingLanes & ~remainingLanes; + 0 < remainingLanes; + + ) { + var index = 31 - clz32(remainingLanes), + lane = 1 << index; + entanglements[index] = 0; + expirationTimes[index] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index]; + if (null !== hiddenUpdatesForLane) + for ( + hiddenUpdates[index] = null, index = 0; + index < hiddenUpdatesForLane.length; + index++ + ) { + var update = hiddenUpdatesForLane[index]; + null !== update && (update.lane &= -536870913); + } + remainingLanes &= ~lane; + } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); + } + function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | + 1073741824 | + (entangledLanes & 4194090); + } + function markRootEntangled(root, entangledLanes) { + var rootEntangledLanes = (root.entangledLanes |= entangledLanes); + for (root = root.entanglements; rootEntangledLanes; ) { + var index = 31 - clz32(rootEntangledLanes), + lane = 1 << index; + (lane & entangledLanes) | (root[index] & entangledLanes) && + (root[index] |= entangledLanes); + rootEntangledLanes &= ~lane; + } + } + function getBumpedLaneForHydrationByLane(lane) { + switch (lane) { + case 2: + lane = 1; + break; + case 8: + lane = 4; + break; + case 32: + lane = 16; + break; + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + case 4194304: + case 8388608: + case 16777216: + case 33554432: + lane = 128; + break; + case 268435456: + lane = 134217728; + break; + default: + lane = 0; + } + return lane; + } + function addFiberToLanesMap(root, fiber, lanes) { + if (isDevToolsPresent) + for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { + var index = 31 - clz32(lanes), + lane = 1 << index; + root[index].add(fiber); + lanes &= ~lane; + } + } + function movePendingFibersToMemoized(root, lanes) { + if (isDevToolsPresent) + for ( + var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap, + memoizedUpdaters = root.memoizedUpdaters; + 0 < lanes; + + ) { + var index = 31 - clz32(lanes); + root = 1 << index; + index = pendingUpdatersLaneMap[index]; + 0 < index.size && + (index.forEach(function (fiber) { + var alternate = fiber.alternate; + (null !== alternate && memoizedUpdaters.has(alternate)) || + memoizedUpdaters.add(fiber); + }), + index.clear()); + lanes &= ~root; + } + } + function lanesToEventPriority(lanes) { + lanes &= -lanes; + return 0 !== DiscreteEventPriority && DiscreteEventPriority < lanes + ? 0 !== ContinuousEventPriority && ContinuousEventPriority < lanes + ? 0 !== (lanes & 134217727) + ? DefaultEventPriority + : IdleEventPriority + : ContinuousEventPriority + : DiscreteEventPriority; + } + function resolveUpdatePriority() { + var updatePriority = ReactDOMSharedInternals.p; + if (0 !== updatePriority) return updatePriority; + updatePriority = window.event; + return void 0 === updatePriority + ? DefaultEventPriority + : getEventPriority(updatePriority.type); + } + function runWithPriority(priority, fn) { + var previousPriority = ReactDOMSharedInternals.p; + try { + return (ReactDOMSharedInternals.p = priority), fn(); + } finally { + ReactDOMSharedInternals.p = previousPriority; + } + } + function detachDeletedInstance(node) { + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; + } + function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + if (targetInst) return targetInst; + for (var parentNode = targetNode.parentNode; parentNode; ) { + if ( + (targetInst = + parentNode[internalContainerInstanceKey] || + parentNode[internalInstanceKey]) + ) { + parentNode = targetInst.alternate; + if ( + null !== targetInst.child || + (null !== parentNode && null !== parentNode.child) + ) + for ( + targetNode = getParentSuspenseInstance(targetNode); + null !== targetNode; + + ) { + if ((parentNode = targetNode[internalInstanceKey])) + return parentNode; + targetNode = getParentSuspenseInstance(targetNode); + } + return targetInst; + } + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + return null; + } + function getInstanceFromNode(node) { + if ( + (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) + ) { + var tag = node.tag; + if ( + 5 === tag || + 6 === tag || + 13 === tag || + 26 === tag || + 27 === tag || + 3 === tag + ) + return node; + } + return null; + } + function getNodeFromInstance(inst) { + var tag = inst.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) + return inst.stateNode; + throw Error("getNodeFromInstance: Invalid argument."); + } + function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + resources || + (resources = root[internalRootNodeResourcesKey] = + { hoistableStyles: new Map(), hoistableScripts: new Map() }); + return resources; + } + function markNodeAsHoistable(node) { + node[internalHoistableMarker] = !0; + } + function registerTwoPhaseEvent(registrationName, dependencies) { + registerDirectEvent(registrationName, dependencies); + registerDirectEvent(registrationName + "Capture", dependencies); + } + function registerDirectEvent(registrationName, dependencies) { + registrationNameDependencies[registrationName] && + console.error( + "EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.", + registrationName + ); + registrationNameDependencies[registrationName] = dependencies; + var lowerCasedName = registrationName.toLowerCase(); + possibleRegistrationNames[lowerCasedName] = registrationName; + "onDoubleClick" === registrationName && + (possibleRegistrationNames.ondblclick = registrationName); + for ( + registrationName = 0; + registrationName < dependencies.length; + registrationName++ + ) + allNativeEvents.add(dependencies[registrationName]); + } + function checkControlledValueProps(tagName, props) { + hasReadOnlyValue[props.type] || + props.onChange || + props.onInput || + props.readOnly || + props.disabled || + null == props.value || + ("select" === tagName + ? console.error( + "You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set `onChange`." + ) + : console.error( + "You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`." + )); + props.onChange || + props.readOnly || + props.disabled || + null == props.checked || + console.error( + "You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`." + ); + } + function isAttributeNameSafe(attributeName) { + if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) + return !0; + if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) + return !1; + if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) + return (validatedAttributeNameCache[attributeName] = !0); + illegalAttributeNameCache[attributeName] = !0; + console.error("Invalid attribute name: `%s`", attributeName); + return !1; + } + function getValueForAttributeOnCustomComponent(node, name, expected) { + if (isAttributeNameSafe(name)) { + if (!node.hasAttribute(name)) { + switch (typeof expected) { + case "symbol": + case "object": + return expected; + case "function": + return expected; + case "boolean": + if (!1 === expected) return expected; + } + return void 0 === expected ? void 0 : null; + } + node = node.getAttribute(name); + if ("" === node && !0 === expected) return !0; + checkAttributeStringCoercion(expected, name); + return node === "" + expected ? expected : node; + } + } + function setValueForAttribute(node, name, value) { + if (isAttributeNameSafe(name)) + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + node.removeAttribute(name); + return; + case "boolean": + var prefix = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix && "aria-" !== prefix) { + node.removeAttribute(name); + return; + } + } + checkAttributeStringCoercion(value, name); + node.setAttribute(name, "" + value); + } + } + function setValueForKnownAttribute(node, name, value) { + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + case "boolean": + node.removeAttribute(name); + return; + } + checkAttributeStringCoercion(value, name); + node.setAttribute(name, "" + value); + } + } + function setValueForNamespacedAttribute(node, namespace, name, value) { + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + case "boolean": + node.removeAttribute(name); + return; + } + checkAttributeStringCoercion(value, name); + node.setAttributeNS(namespace, name, "" + value); + } + } + function disabledLog() {} + function disableLogs() { + if (0 === disabledDepth) { + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; + var props = { + configurable: !0, + enumerable: !0, + value: disabledLog, + writable: !0 + }; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + } + disabledDepth++; + } + function reenableLogs() { + disabledDepth--; + if (0 === disabledDepth) { + var props = { configurable: !0, enumerable: !0, writable: !0 }; + Object.defineProperties(console, { + log: assign({}, props, { value: prevLog }), + info: assign({}, props, { value: prevInfo }), + warn: assign({}, props, { value: prevWarn }), + error: assign({}, props, { value: prevError }), + group: assign({}, props, { value: prevGroup }), + groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), + groupEnd: assign({}, props, { value: prevGroupEnd }) + }); + } + 0 > disabledDepth && + console.error( + "disabledDepth fell below zero. This is a bug in React. Please file an issue." + ); + } + function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + suffix = + -1 < x.stack.indexOf("\n at") + ? " ()" + : -1 < x.stack.indexOf("@") + ? "@unknown:0:0" + : ""; + } + return "\n" + prefix + name + suffix; + } + function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + var frame = componentFrameCache.get(fn); + if (void 0 !== frame) return frame; + reentry = !0; + frame = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + var previousDispatcher = null; + previousDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = null; + disableLogs(); + try { + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + try { + if (construct) { + var Fake = function () { + throw Error(); + }; + Object.defineProperty(Fake.prototype, "props", { + set: function () { + throw Error(); + } + }); + if ("object" === typeof Reflect && Reflect.construct) { + try { + Reflect.construct(Fake, []); + } catch (x) { + var control = x; + } + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x$0) { + control = x$0; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$1) { + control = x$1; + } + (Fake = fn()) && + "function" === typeof Fake.catch && + Fake.catch(function () {}); + } + } catch (sample) { + if (sample && control && "string" === typeof sample.stack) + return [sample.stack, control.stack]; + } + return [null, null]; + } + }; + RunInRootFrame.DetermineComponentFrameRoot.displayName = + "DetermineComponentFrameRoot"; + var namePropDescriptor = Object.getOwnPropertyDescriptor( + RunInRootFrame.DetermineComponentFrameRoot, + "name" + ); + namePropDescriptor && + namePropDescriptor.configurable && + Object.defineProperty( + RunInRootFrame.DetermineComponentFrameRoot, + "name", + { value: "DetermineComponentFrameRoot" } + ); + var _RunInRootFrame$Deter = + RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; + if (sampleStack && controlStack) { + var sampleLines = sampleStack.split("\n"), + controlLines = controlStack.split("\n"); + for ( + _RunInRootFrame$Deter = namePropDescriptor = 0; + namePropDescriptor < sampleLines.length && + !sampleLines[namePropDescriptor].includes( + "DetermineComponentFrameRoot" + ); + + ) + namePropDescriptor++; + for ( + ; + _RunInRootFrame$Deter < controlLines.length && + !controlLines[_RunInRootFrame$Deter].includes( + "DetermineComponentFrameRoot" + ); + + ) + _RunInRootFrame$Deter++; + if ( + namePropDescriptor === sampleLines.length || + _RunInRootFrame$Deter === controlLines.length + ) + for ( + namePropDescriptor = sampleLines.length - 1, + _RunInRootFrame$Deter = controlLines.length - 1; + 1 <= namePropDescriptor && + 0 <= _RunInRootFrame$Deter && + sampleLines[namePropDescriptor] !== + controlLines[_RunInRootFrame$Deter]; + + ) + _RunInRootFrame$Deter--; + for ( + ; + 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter; + namePropDescriptor--, _RunInRootFrame$Deter-- + ) + if ( + sampleLines[namePropDescriptor] !== + controlLines[_RunInRootFrame$Deter] + ) { + if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) { + do + if ( + (namePropDescriptor--, + _RunInRootFrame$Deter--, + 0 > _RunInRootFrame$Deter || + sampleLines[namePropDescriptor] !== + controlLines[_RunInRootFrame$Deter]) + ) { + var _frame = + "\n" + + sampleLines[namePropDescriptor].replace( + " at new ", + " at " + ); + fn.displayName && + _frame.includes("") && + (_frame = _frame.replace("", fn.displayName)); + "function" === typeof fn && + componentFrameCache.set(fn, _frame); + return _frame; + } + while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter); + } + break; + } + } + } finally { + (reentry = !1), + (ReactSharedInternals.H = previousDispatcher), + reenableLogs(), + (Error.prepareStackTrace = frame); + } + sampleLines = (sampleLines = fn ? fn.displayName || fn.name : "") + ? describeBuiltInComponentFrame(sampleLines) + : ""; + "function" === typeof fn && componentFrameCache.set(fn, sampleLines); + return sampleLines; + } + function formatOwnerStack(error) { + var prevPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + error = error.stack; + Error.prepareStackTrace = prevPrepareStackTrace; + error.startsWith("Error: react-stack-top-frame\n") && + (error = error.slice(29)); + prevPrepareStackTrace = error.indexOf("\n"); + -1 !== prevPrepareStackTrace && + (error = error.slice(prevPrepareStackTrace + 1)); + prevPrepareStackTrace = error.indexOf("react_stack_bottom_frame"); + -1 !== prevPrepareStackTrace && + (prevPrepareStackTrace = error.lastIndexOf( + "\n", + prevPrepareStackTrace + )); + if (-1 !== prevPrepareStackTrace) + error = error.slice(0, prevPrepareStackTrace); + else return ""; + return error; + } + function describeFiber(fiber) { + switch (fiber.tag) { + case 26: + case 27: + case 5: + return describeBuiltInComponentFrame(fiber.type); + case 16: + return describeBuiltInComponentFrame("Lazy"); + case 13: + return describeBuiltInComponentFrame("Suspense"); + case 19: + return describeBuiltInComponentFrame("SuspenseList"); + case 0: + case 15: + return describeNativeComponentFrame(fiber.type, !1); + case 11: + return describeNativeComponentFrame(fiber.type.render, !1); + case 1: + return describeNativeComponentFrame(fiber.type, !0); + case 31: + return describeBuiltInComponentFrame("Activity"); + default: + return ""; + } + } + function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ""; + do { + info += describeFiber(workInProgress); + var debugInfo = workInProgress._debugInfo; + if (debugInfo) + for (var i = debugInfo.length - 1; 0 <= i; i--) { + var entry = debugInfo[i]; + if ("string" === typeof entry.name) { + var JSCompiler_temp_const = info, + env = entry.env; + var JSCompiler_inline_result = describeBuiltInComponentFrame( + entry.name + (env ? " [" + env + "]" : "") + ); + info = JSCompiler_temp_const + JSCompiler_inline_result; + } + } + workInProgress = workInProgress.return; + } while (workInProgress); + return info; + } catch (x) { + return "\nError generating stack: " + x.message + "\n" + x.stack; + } + } + function describeFunctionComponentFrameWithoutLineNumber(fn) { + return (fn = fn ? fn.displayName || fn.name : "") + ? describeBuiltInComponentFrame(fn) + : ""; + } + function getCurrentFiberOwnerNameInDevOrNull() { + if (null === current) return null; + var owner = current._debugOwner; + return null != owner ? getComponentNameFromOwner(owner) : null; + } + function getCurrentFiberStackInDev() { + if (null === current) return ""; + var workInProgress = current; + try { + var info = ""; + 6 === workInProgress.tag && (workInProgress = workInProgress.return); + switch (workInProgress.tag) { + case 26: + case 27: + case 5: + info += describeBuiltInComponentFrame(workInProgress.type); + break; + case 13: + info += describeBuiltInComponentFrame("Suspense"); + break; + case 19: + info += describeBuiltInComponentFrame("SuspenseList"); + break; + case 31: + info += describeBuiltInComponentFrame("Activity"); + break; + case 30: + case 0: + case 15: + case 1: + workInProgress._debugOwner || + "" !== info || + (info += describeFunctionComponentFrameWithoutLineNumber( + workInProgress.type + )); + break; + case 11: + workInProgress._debugOwner || + "" !== info || + (info += describeFunctionComponentFrameWithoutLineNumber( + workInProgress.type.render + )); + } + for (; workInProgress; ) + if ("number" === typeof workInProgress.tag) { + var fiber = workInProgress; + workInProgress = fiber._debugOwner; + var debugStack = fiber._debugStack; + workInProgress && + debugStack && + ("string" !== typeof debugStack && + (fiber._debugStack = debugStack = formatOwnerStack(debugStack)), + "" !== debugStack && (info += "\n" + debugStack)); + } else if (null != workInProgress.debugStack) { + var ownerStack = workInProgress.debugStack; + (workInProgress = workInProgress.owner) && + ownerStack && + (info += "\n" + formatOwnerStack(ownerStack)); + } else break; + var JSCompiler_inline_result = info; + } catch (x) { + JSCompiler_inline_result = + "\nError generating stack: " + x.message + "\n" + x.stack; + } + return JSCompiler_inline_result; + } + function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) { + var previousFiber = current; + setCurrentFiber(fiber); + try { + return null !== fiber && fiber._debugTask + ? fiber._debugTask.run( + callback.bind(null, arg0, arg1, arg2, arg3, arg4) + ) + : callback(arg0, arg1, arg2, arg3, arg4); + } finally { + setCurrentFiber(previousFiber); + } + throw Error( + "runWithFiberInDEV should never be called in production. This is a bug in React." + ); + } + function setCurrentFiber(fiber) { + ReactSharedInternals.getCurrentStack = + null === fiber ? null : getCurrentFiberStackInDev; + isRendering = !1; + current = fiber; + } + function getToStringValue(value) { + switch (typeof value) { + case "bigint": + case "boolean": + case "number": + case "string": + case "undefined": + return value; + case "object": + return checkFormFieldValueStringCoercion(value), value; + default: + return ""; + } + } + function isCheckable(elem) { + var type = elem.type; + return ( + (elem = elem.nodeName) && + "input" === elem.toLowerCase() && + ("checkbox" === type || "radio" === type) + ); + } + function trackValueOnNode(node) { + var valueField = isCheckable(node) ? "checked" : "value", + descriptor = Object.getOwnPropertyDescriptor( + node.constructor.prototype, + valueField + ); + checkFormFieldValueStringCoercion(node[valueField]); + var currentValue = "" + node[valueField]; + if ( + !node.hasOwnProperty(valueField) && + "undefined" !== typeof descriptor && + "function" === typeof descriptor.get && + "function" === typeof descriptor.set + ) { + var get = descriptor.get, + set = descriptor.set; + Object.defineProperty(node, valueField, { + configurable: !0, + get: function () { + return get.call(this); + }, + set: function (value) { + checkFormFieldValueStringCoercion(value); + currentValue = "" + value; + set.call(this, value); + } + }); + Object.defineProperty(node, valueField, { + enumerable: descriptor.enumerable + }); + return { + getValue: function () { + return currentValue; + }, + setValue: function (value) { + checkFormFieldValueStringCoercion(value); + currentValue = "" + value; + }, + stopTracking: function () { + node._valueTracker = null; + delete node[valueField]; + } + }; + } + } + function track(node) { + node._valueTracker || (node._valueTracker = trackValueOnNode(node)); + } + function updateValueIfChanged(node) { + if (!node) return !1; + var tracker = node._valueTracker; + if (!tracker) return !0; + var lastValue = tracker.getValue(); + var value = ""; + node && + (value = isCheckable(node) + ? node.checked + ? "true" + : "false" + : node.value); + node = value; + return node !== lastValue ? (tracker.setValue(node), !0) : !1; + } + function getActiveElement(doc) { + doc = doc || ("undefined" !== typeof document ? document : void 0); + if ("undefined" === typeof doc) return null; + try { + return doc.activeElement || doc.body; + } catch (e) { + return doc.body; + } + } + function escapeSelectorAttributeValueInsideDoubleQuotes(value) { + return value.replace( + escapeSelectorAttributeValueInsideDoubleQuotesRegex, + function (ch) { + return "\\" + ch.charCodeAt(0).toString(16) + " "; + } + ); + } + function validateInputProps(element, props) { + void 0 === props.checked || + void 0 === props.defaultChecked || + didWarnCheckedDefaultChecked || + (console.error( + "%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://react.dev/link/controlled-components", + getCurrentFiberOwnerNameInDevOrNull() || "A component", + props.type + ), + (didWarnCheckedDefaultChecked = !0)); + void 0 === props.value || + void 0 === props.defaultValue || + didWarnValueDefaultValue$1 || + (console.error( + "%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://react.dev/link/controlled-components", + getCurrentFiberOwnerNameInDevOrNull() || "A component", + props.type + ), + (didWarnValueDefaultValue$1 = !0)); + } + function updateInput( + element, + value, + defaultValue, + lastDefaultValue, + checked, + defaultChecked, + type, + name + ) { + element.name = ""; + null != type && + "function" !== typeof type && + "symbol" !== typeof type && + "boolean" !== typeof type + ? (checkAttributeStringCoercion(type, "type"), (element.type = type)) + : element.removeAttribute("type"); + if (null != value) + if ("number" === type) { + if ((0 === value && "" === element.value) || element.value != value) + element.value = "" + getToStringValue(value); + } else + element.value !== "" + getToStringValue(value) && + (element.value = "" + getToStringValue(value)); + else + ("submit" !== type && "reset" !== type) || + element.removeAttribute("value"); + null != value + ? setDefaultValue(element, type, getToStringValue(value)) + : null != defaultValue + ? setDefaultValue(element, type, getToStringValue(defaultValue)) + : null != lastDefaultValue && element.removeAttribute("value"); + null == checked && + null != defaultChecked && + (element.defaultChecked = !!defaultChecked); + null != checked && + (element.checked = + checked && + "function" !== typeof checked && + "symbol" !== typeof checked); + null != name && + "function" !== typeof name && + "symbol" !== typeof name && + "boolean" !== typeof name + ? (checkAttributeStringCoercion(name, "name"), + (element.name = "" + getToStringValue(name))) + : element.removeAttribute("name"); + } + function initInput( + element, + value, + defaultValue, + checked, + defaultChecked, + type, + name, + isHydrating + ) { + null != type && + "function" !== typeof type && + "symbol" !== typeof type && + "boolean" !== typeof type && + (checkAttributeStringCoercion(type, "type"), (element.type = type)); + if (null != value || null != defaultValue) { + if ( + !( + ("submit" !== type && "reset" !== type) || + (void 0 !== value && null !== value) + ) + ) + return; + defaultValue = + null != defaultValue ? "" + getToStringValue(defaultValue) : ""; + value = null != value ? "" + getToStringValue(value) : defaultValue; + isHydrating || value === element.value || (element.value = value); + element.defaultValue = value; + } + checked = null != checked ? checked : defaultChecked; + checked = + "function" !== typeof checked && + "symbol" !== typeof checked && + !!checked; + element.checked = isHydrating ? element.checked : !!checked; + element.defaultChecked = !!checked; + null != name && + "function" !== typeof name && + "symbol" !== typeof name && + "boolean" !== typeof name && + (checkAttributeStringCoercion(name, "name"), (element.name = name)); + } + function setDefaultValue(node, type, value) { + ("number" === type && getActiveElement(node.ownerDocument) === node) || + node.defaultValue === "" + value || + (node.defaultValue = "" + value); + } + function validateOptionProps(element, props) { + null == props.value && + ("object" === typeof props.children && null !== props.children + ? React.Children.forEach(props.children, function (child) { + null == child || + "string" === typeof child || + "number" === typeof child || + "bigint" === typeof child || + didWarnInvalidChild || + ((didWarnInvalidChild = !0), + console.error( + "Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to