8000 docs(BTable): complete documentation for table items provider by dwgray · Pull Request #2662 · bootstrap-vue-next/bootstrap-vue-next · GitHub
[go: up one dir, main page]

Skip to content

docs(BTable): complete documentation for table items provider #2662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2025

Conversation

dwgray
Copy link
Member
@dwgray dwgray commented Apr 14, 2025

Describe the PR

  • Add the pagination section
  • Bring the items provider section up to parity with BSV
  • Update the migration guide
  • Add types to types.md
  • Export MaybePromise as it's useful in the documentation and examples

Small replication

N/A

PR checklist

What kind of change does this PR introduce? (check at least one)

  • Bugfix 🐛 - fix(...)
  • Feature - feat(...)
  • ARIA accessibility - fix(...)
  • Documentation update - docs(...)
  • Other (please describe)

The PR fulfills these requirements:

  • Pull request title and all commits follow the Conventional Commits convention or has an override in this pull request body This is very important, as the CHANGELOG is generated from these messages, and determines the next version type. Pull requests that do not follow conventional commits or do not have an override will be denied

Summary by CodeRabbit

  • Documentation
    • Expanded and clarified documentation for table provider functions, pagination, and usage of the provider prop in tables.
    • Added a detailed migration guide section for items provider functions, highlighting differences from previous versions and deprecations.
    • Introduced a new documentation section describing TypeScript types relat 8000 ed to table data providers, including context and function signatures.

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@dwgray dwgray requested a review from Copilot April 14, 2025 22:51
Copy link
pkg-pr-new bot commented Apr 14, 2025

bsvn-vite-ts

npm i https://pkg.pr.new/bootstrap-vue-next/bootstrap-vue-next@2662
npm i https://pkg.pr.new/bootstrap-vue-next/bootstrap-vue-next/@bootstrap-vue-next/nuxt@2662

commit: 43fcdfc

@VividLemon
Copy link
Member

Woohoo! I'll do the directives soon

Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@dwgray
Copy link
Member Author
dwgray commented Apr 14, 2025

Woohoo! I'll do the directives soon

Cool! I still have to do the full parity verification of the table components, but hopefully that won't turn up too much...

Co-authored-by: Issayah <github.private.imcvv@slmail.me>
Copy link
coderabbitai bot commented Apr 16, 2025

Walkthrough

This update introduces and documents new TypeScript types for a table data provider system, specifically for use with a Bootstrap Vue Next table component. It defines types for the provider context and function signature, supporting both synchronous and asynchronous data provision with sorting, filtering, and pagination. The documentation for the table component is expanded to explain pagination, provider functions, and migration details. These changes clarify how to use provider functions, update migration guidance, and add comprehensive type documentation, but do not alter any underlying logic or exported entities.

Changes

File(s) Change Summary
apps/docs/src/docs/components/demo/TableProvider.ts
apps/docs/src/docs/types.md
Introduced new TypeScript type definitions for table data providers: MaybePromise<T>, BTableProviderContext<T>, and BTableProvider<T>. These types define the contract for providing table data, including context properties for sorting, filtering, and pagination.
apps/docs/src/docs/components/table.md Expanded and clarified documentation for the BTable component. Added full sections on pagination and provider functions, including usage, function signatures, and example references. Clarified the precedence of the provider prop over items and detailed the context object passed to provider functions.
apps/docs/src/docs/migration-guide.md Added a migration section for items provider functions. Explained differences from BootstrapVue, including the requirement to use the provider prop, changes to the context parameter, deprecation of api-url/apiUrl, and the removal of callback-based asynchronous patterns in favor of promises.
packages/bootstrap-vue-next/src/types/index.ts Added export of the MaybePromise type from the ./MaybePromise module.

Sequence Diagram(s)

sequenceDiagram
    participant BTable
    participant ProviderFunction
    participant DataSource

    BTable->>ProviderFunction: Call with BTableProviderContext (sortBy, filter, currentPage, perPage)
    alt Synchronous
        ProviderFunction-->>BTable: Return items array
    else Asynchronous
        ProviderFunction-->>BTable: Return Promise<items array>
    end
    Note over BTable: BTable renders with provided items
Loading

Poem

🐇
Types and docs in tidy rows,
Provider functions now compose.
Pagination clear and neat,
Async, sync—both complete!
Migration paths now plainly shown,
In table fields, new seeds are sown.

—A rabbit, hopping through the code

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2c5f4d and 43fcdfc.

📒 Files selected for processing (4)
  • apps/docs/src/docs/components/demo/TableProvider.ts (1 hunks)
  • apps/docs/src/docs/migration-guide.md (1 hunks)
  • apps/docs/src/docs/types.md (2 hunks)
  • packages/bootstrap-vue-next/src/types/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/bootstrap-vue-next/src/types/index.ts
  • apps/docs/src/docs/components/demo/TableProvider.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/docs/src/docs/migration-guide.md
  • apps/docs/src/docs/types.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/docs/src/docs/migration-guide.md (1)

662-663: Adopt more concise phrasing for callback deprecation.

Consider using the more direct suggestion from a previous review:

"The item provider no longer includes an optional callback parameter, use the async method of calling instead."

This improves clarity and matches the style of the rest of the migration guide.

🧹 Nitpick comments (3)
apps/docs/src/docs/components/demo/TableProvider.ts (1)

3-3: Consider importing MaybePromise from the main codebase for consistency.

You define type MaybePromise<T> = Promise<T> | T locally, but this type already exists in the main codebase (packages/bootstrap-vue-next/src/types/MaybePromise.ts). For consistency and to avoid duplication, consider importing it instead:

-import type {BTableSortBy} from 'bootstrap-vue-next'
-type MaybePromise<T> = Promise<T> | T
+import type {BTableSortBy} from 'bootstrap-vue-next'
+import type {MaybePromise} from 'bootstrap-vue-next'

This is optional for a documentation/demo file, but helps keep types in sync.

apps/docs/src/docs/migration-guide.md (1)

650-655: Consider rewording for conciseness.

The phrase "In order to use an items provider, set the provider prop..." can be shortened to "To use an items provider, set the provider prop..." for clarity and brevity.

-In order to use an items provider, set the `provider` prop to a provider function and leave the
-`items` prop undefined (unlike in BootstrapVue, where the `items` prop was overloaded). See
-our [documentation](/docs/components/table#using-items-provider-functions) for details.
+To use an items provider, set the `provider` prop to a provider function and leave the
+`items` prop undefined (unlike in BootstrapVue, where the `items` prop was overloaded). See
+our [documentation](/docs/components/table#using-items-provider-functions) for details.
🧰 Tools
🪛 LanguageTool

[style] ~651-~651: Consider a shorter alternative to avoid wordiness.
Context: ...sibility ### Items Provider Functions In order to use an items provider, set the `provide...

(IN_ORDER_TO_PREMIUM)

apps/docs/src/docs/types.md (1)

501-513: Consider referencing the canonical MaybePromise type for consistency.

You define type MaybePromise<T> = Promise<T> | T locally, but this type already exists in the main codebase. For consistency, consider referencing or importing the canonical type in documentation and code examples.

This is optional for documentation, but helps keep types in sync.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6a89ef and f2c5f4d.

📒 Files selected for processing (4)
  • apps/docs/src/docs/components/demo/TableProvider.ts (1 hunks)
  • apps/docs/src/docs/components/table.md (2 hunks)
  • apps/docs/src/docs/migration-guide.md (1 hunks)
  • apps/docs/src/docs/types.md (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/docs/src/docs/components/demo/TableProvider.ts (1)
packages/bootstrap-vue-next/src/types/MaybePromise.ts (1)
  • MaybePromise (1-1)
🪛 LanguageTool
apps/docs/src/docs/migration-guide.md

[style] ~651-~651: Consider a shorter alternative to avoid wordiness.
Context: ...sibility ### Items Provider Functions In order to use an items provider, set the `provide...

(IN_ORDER_TO_PREMIUM)

🔇 Additional comments (6)
apps/docs/src/docs/components/demo/TableProvider.ts (1)

5-15: Type definitions are clear and correct.

The type definitions for BTableProviderContext and BTableProvider are accurate, generic, and match the documentation and migration guide. No issues found.

apps/docs/src/docs/migration-guide.md (1)

650-663: Migration guidance is accurate and helpful.

The new section clearly explains the changes to the items provider API, context object, and deprecations. No technical issues found.

🧰 Tools
🪛 LanguageTool

[style] ~651-~651: Consider a shorter alternative to avoid wordiness.
Context: ...sibility ### Items Provider Functions In order to use an items provider, set the `provide...

(IN_ORDER_TO_PREMIUM)

apps/docs/src/docs/types.md (1)

503-513: Type definitions are accurate and match the API.

The BTableProviderContext and BTableProvider types are correct, generic, and align with the documented API. No issues found.

apps/docs/src/docs/components/table.md (3)

56-57: Provider function documentation is clear and accurate.

The updated explanation for using a provider function is concise and correctly references the new section for details. No issues found.


832-839: Pagination documentation is clear and correct.

The new pagination section accurately describes how to use per-page, current-page, and <BPagination>. No issues found.


842-876: Provider function usage and context documentation is excellent.

The section on using items provider functions is thorough, accurate, and matches the new API and types. The context object and example usage are well explained.

@VividLemon VividLemon merged commit 716054c into bootstrap-vue-next:main Apr 22, 2025
5 checks passed
@dwgray dwgray deleted the table-provider-docs branch April 22, 2025 16:44
xvaara added a commit to xvaara/bootstrap-vue-next that referenced this pull request Apr 28, 2025
* upstream/main: (184 commits)
  fix(BDropdown): don't calulcate the position when dropdown is not shown.
  docs(BTable): complete documentation for table items provider (bootstrap-vue-next#2662)
  fix(BPagination): right/left/up/down arrow keys now operating better after new page chosen (bootstrap-vue-next#2665)
  add the check to hide as well
  fix(useShowHide): don't run show if component already unmounted (ie. BPopover)
  fix(BAccordionItem): fix initial modelValue
  feat(BModal)!: remove autofocus and autofocusButton props and add more versitile focus prop feat(BOffcanvas)!: remove nofocus prop and add more versitile focus prop feat(BModal): return focus to previous element on close feat(BOffcanvas): return focus to previous element on close fix(BModal): set focus only once
  chore: release main (bootstrap-vue-next#2659)
  bth and btd scope attribute updates and bpagination li element needs presentation role (bootstrap-vue-next#2646)
  feat(BBreadcrumb): allow it to use individual breadcrumb trails with useBreadcrumb by passing prop id to component and id param to composable fixes bootstrap-vue-next#2630
  Revert "fix(BButton): Consume useColorVariantClasses (bootstrap-vue-next#2640)" (bootstrap-vue-next#2654)
  chore: release main fixes bootstrap-vue-next#2643
  feat(BTable): Expose additional functions and document them (bootstrap-vue-next#2632)
  fix(BButton): Consume useColorVariantClasses (bootstrap-vue-next#2640)
  docs(BButton): Outline variant example (bootstrap-vue-next#2639)
  fix(BTab): error in recursion (bootstrap-vue-next#2624)
  fix(BTable): correct multi-sort to not update sortby in place (bootstrap-vue-next#2644)
  Update BDropdownForm.vue (bootstrap-vue-next#2635)
  doc(BTable): Fill out light-weight, helper component and accessibility sections (bootstrap-vue-next#2629)
  chore: release main (bootstrap-vue-next#2626)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0