Skip to content

Add AG Grid plugin with lazy loading and peer dependency architecture#172

Merged
hotlong merged 4 commits intomainfrom
copilot/add-aggrid-plugin
Jan 24, 2026
Merged

Add AG Grid plugin with lazy loading and peer dependency architecture#172
hotlong merged 4 commits intomainfrom
copilot/add-aggrid-plugin

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 23, 2026

Implements @object-ui/plugin-aggrid package integrating AG Grid Community Edition into the ObjectUI component ecosystem.

Implementation

  • Lazy Loading Architecture: Split into AgGridImpl.tsx (heavy imports) and index.tsx (lightweight wrapper with React.Suspense), ensuring AG Grid libraries load only when grid component renders
  • Peer Dependencies: Externalized ag-grid-community and ag-grid-react to prevent version conflicts and reduce bundle size (10.28 KB vs 894 KB if bundled)
  • Component Registration: Auto-registers aggrid type with ComponentRegistry on import
  • Theme Support: Quartz, Alpine, Balham, Material themes with CSS imports in implementation module
  • TypeScript: Exported AgGridSchema and SimpleColumnDef interfaces for type safety

Usage

import '@object-ui/plugin-aggrid';

const schema = {
  type: 'aggrid',
  rowData: [
    { make: 'Tesla', model: 'Model Y', price: 64950, electric: true },
    { make: 'Ford', model: 'F-Series', price: 33850, electric: false }
  ],
  columnDefs: [
    { field: 'make', sortable: true, filter: true },
    { field: 'price', sortable: true, filter: 'number',
      valueFormatter: (params) => params.value != null ? '$' + params.value.toLocaleString() : '' }
  ],
  pagination: true,
  paginationPageSize: 10,
  theme: 'quartz'
};

Package Structure

packages/plugin-aggrid/
├── src/
│   ├── AgGridImpl.tsx    # Lazy-loaded AG Grid implementation
│   ├── index.tsx         # Entry point with Suspense wrapper
│   ├── types.ts          # TypeScript interfaces
│   └── index.test.ts     # Component registry tests
├── package.json          # ag-grid-* as peerDependencies
└── vite.config.ts        # Externalizes ag-grid-* in build

Follows established plugin pattern from plugin-charts and plugin-kanban.

Original prompt

新增AgGrid插件基于aggrid社区版


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 23, 2026

Deployment failed with the following error:

Resource is limited - try again in 9 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/xuyushun441-sys-projects?upgradeToPro=build-rate-limit

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
objectui-site Ready Ready Preview, Comment Jan 23, 2026 6:37pm

Request Review

Copilot AI and others added 2 commits January 23, 2026 18:30
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add AgGrid plugin based on community edition Add AG Grid plugin with lazy loading and peer dependency architecture Jan 23, 2026
Copilot AI requested a review from hotlong January 23, 2026 18:35
@hotlong hotlong marked this pull request as ready for review January 24, 2026 01:29
Copilot AI review requested due to automatic review settings January 24, 2026 01:29
@github-actions github-actions bot added documentation Improvements or additions to documentation dependencies plugin tests labels Jan 24, 2026
@hotlong hotlong merged commit c0edcae into main Jan 24, 2026
16 of 18 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1588.71KB 373.06KB
core (index.js) 0.53KB 0.28KB
plugin-aggrid (AgGridImpl-BAWSVte3.js) 1.18KB 0.63KB
plugin-aggrid (index-DffoL-lC.js) 13.29KB 4.01KB
plugin-aggrid (index.js) 0.18KB 0.15KB
plugin-charts (AdvancedChartImpl-DazADGz5.js) 74.89KB 15.82KB
plugin-charts (BarChart-CRc8MAtI.js) 551.60KB 127.51KB
plugin-charts (ChartImpl-DVw_7KEd.js) 3.17KB 1.10KB
plugin-charts (index-CdgY2AuM.js) 12.39KB 3.83KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-B7ZgZJJG.js) 18.15KB 5.59KB
plugin-editor (index-Dl3HAAqu.js) 10.07KB 3.31KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-CUWM-JC-.js) 76.50KB 20.46KB
plugin-kanban (index-BV3FWhCb.js) 11.86KB 3.67KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-BRkYjVWf.js) 256.79KB 64.50KB
plugin-markdown (index-D_CdfEXQ.js) 9.59KB 3.16KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.44KB 0.73KB
react (index.js) 0.32KB 0.23KB
react (index.test.js) 0.34KB 0.26KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 0.20KB 0.18KB
types (base.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data.js) 0.20KB 0.18KB
types (disclosure.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (index.js) 0.34KB 0.25KB
types (layout.js) 0.20KB 0.18KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (registry.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@github-actions
Copy link
Copy Markdown
Contributor

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

Copy link
Copy Markdown
Contributor

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.

Pull request overview

This PR adds a new AG Grid plugin package (@object-ui/plugin-aggrid) that integrates AG Grid Community Edition into the ObjectUI component ecosystem using a lazy-loading architecture with peer dependencies.

Changes:

  • Implements lazy-loaded AG Grid component with React.Suspense for optimal bundle splitting
  • Configures AG Grid libraries as peer dependencies to prevent version conflicts
  • Adds comprehensive test coverage for component registry metadata
  • Provides extensive documentation including usage examples and API reference

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/plugin-aggrid/package.json Package configuration with peer dependencies and build scripts
packages/plugin-aggrid/vite.config.ts Build configuration externalizing AG Grid libraries
packages/plugin-aggrid/tsconfig.json TypeScript configuration following plugin conventions
packages/plugin-aggrid/src/types.ts TypeScript interfaces for AgGridSchema and column definitions
packages/plugin-aggrid/src/index.tsx Entry point with lazy loading wrapper and component registration
packages/plugin-aggrid/src/AgGridImpl.tsx Heavy implementation with AG Grid imports and theme support
packages/plugin-aggrid/src/index.test.ts Unit tests for component registry metadata
packages/plugin-aggrid/README.md Comprehensive documentation with usage examples
packages/plugin-aggrid/CHANGELOG.md Initial release changelog
pnpm-lock.yaml Dependency lock file updates with AG Grid packages
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

},
"devDependencies": {
"@types/react": "^19.0.6",
"@types/react-dom": "^19.0.3",
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The @types/react-dom version is set to 19.0.3, which is inconsistent with other plugin packages (plugin-charts and plugin-kanban use ^18.3.1). While React 19 is supported in peerDependencies, the devDependencies should align with the established pattern for consistency. Consider using ^18.3.1 or updating all plugins consistently to use React 19 types.

Copilot uses AI. Check for mistakes.
Comment on lines 457 to +462
react:
specifier: 19.2.3
version: 19.2.3
react-dom:
specifier: 19.2.3
version: 19.2.3(react@19.2.3)
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

react and react-dom are listed in the dependencies section of pnpm-lock.yaml, which is inconsistent with the peer dependency architecture used by other plugins. This occurs because package.json incorrectly lists them in dependencies. These should only appear in peerDependencies to avoid bundling React twice and causing version conflicts.

Copilot uses AI. Check for mistakes.
Comment on lines +178 to +183

## Advanced Usage

### With GridOptions

```typescript
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The valueFormatter example uses an arrow function, which cannot be serialized to JSON. This contradicts ObjectUI's JSON-first Schema-Driven UI principle where all component configurations should be representable as pure JSON. While AG Grid supports functions in columnDefs, in a truly schema-driven architecture, formatters should be referenced by string identifiers or use expression syntax instead of inline functions. Consider documenting how valueFormatter should be handled in a JSON schema context, or note this as a limitation that requires programmatic configuration.

Copilot uses AI. Check for mistakes.
Comment on lines +175 to +191
columnDefs: [
{ field: 'make', headerName: 'Make', sortable: true, filter: true },
{ field: 'model', headerName: 'Model', sortable: true, filter: true },
{
field: 'price',
headerName: 'Price',
sortable: true,
filter: 'number',
valueFormatter: (params: any) => params.value != null ? '$' + params.value.toLocaleString() : ''
},
{
field: 'electric',
headerName: 'Electric',
sortable: true,
filter: true,
cellRenderer: (params: any) => params.value === true ? '⚡ Yes' : 'No'
}
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The defaultProps include arrow functions in valueFormatter and cellRenderer fields (lines 183 and 190), which violates ObjectUI's JSON-first principle. Arrow functions cannot be serialized to JSON, making these defaults unusable in a true schema-driven context. According to the coding guidelines (Rule #3: The Action System), all behaviors should be defined as data, not functions. Consider either: (1) removing these function-based defaults and documenting that formatters must be added programmatically, or (2) implementing a string-based renderer/formatter system that can be referenced by name in JSON.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +33 to +38
"dependencies": {
"@object-ui/components": "workspace:*",
"@object-ui/core": "workspace:*",
"@object-ui/react": "workspace:*",
"@object-ui/types": "workspace:*"
},
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

react and react-dom should not be listed in dependencies when they are already declared as peerDependencies. This creates bundling issues and version conflicts. Following the established pattern in plugin-charts and plugin-kanban, these packages should only be in peerDependencies, not in dependencies. Remove them from the dependencies section.

Copilot uses AI. Check for mistakes.
"ag-grid-react": "^32.0.0"
},
"devDependencies": {
"@types/react": "^19.0.6",
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The @types/react version is set to 19.0.6, which is inconsistent with other plugin packages (plugin-charts and plugin-kanban use ^18.3.12). While React 19 is in the peerDependencies as an option (^18.0.0 || ^19.0.0), the devDependencies should align with the established pattern for consistency. Consider using ^18.3.12 or updating all plugins consistently to use React 19 types.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies documentation Improvements or additions to documentation plugin tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants