|
| 1 | +# ObjectUI Integration |
| 2 | + |
| 3 | +This document describes the @object-ui integration in ObjectOS console application. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +ObjectOS now integrates with @object-ui packages to provide metadata-driven UI components. This enables developers to build data-centric interfaces without writing repetitive UI code. |
| 8 | + |
| 9 | +## Installed Packages |
| 10 | + |
| 11 | +The following @object-ui packages have been installed: |
| 12 | + |
| 13 | +- **@object-ui/core@2.0.0** - Core logic, types, and validation (zero React dependencies) |
| 14 | +- **@object-ui/react@2.0.0** - React bindings and SchemaRenderer component |
| 15 | +- **@object-ui/components@2.0.0** - Standard UI component library (Shadcn-based) |
| 16 | +- **@object-ui/layout@2.0.0** - Application shell components |
| 17 | +- **@object-ui/fields@2.0.0** - Field renderers and registry |
| 18 | +- **@object-ui/data-objectstack@2.0.0** - ObjectStack data adapter |
| 19 | + |
| 20 | +## Integration Points |
| 21 | + |
| 22 | +### 1. ObjectStack Data Adapter |
| 23 | + |
| 24 | +Location: `apps/web/src/lib/object-ui-adapter.ts` |
| 25 | + |
| 26 | +This adapter bridges ObjectUI components with the ObjectStack backend API: |
| 27 | + |
| 28 | +```typescript |
| 29 | +import { createObjectStackAdapter } from '@object-ui/data-objectstack'; |
| 30 | + |
| 31 | +export const objectUIAdapter = createObjectStackAdapter({ |
| 32 | + baseUrl: '/api/v1', |
| 33 | +}); |
| 34 | +``` |
| 35 | + |
| 36 | +### 2. Example Component |
| 37 | + |
| 38 | +Location: `apps/web/src/components/objectui/ObjectUIExample.tsx` |
| 39 | + |
| 40 | +Demonstrates how to use the SchemaRenderer: |
| 41 | + |
| 42 | +```typescript |
| 43 | +import { SchemaRenderer } from '@object-ui/react'; |
| 44 | +import { objectUIAdapter } from '@/lib/object-ui-adapter'; |
| 45 | + |
| 46 | +<SchemaRenderer |
| 47 | + adapter={objectUIAdapter} |
| 48 | + objectName="contacts" |
| 49 | + view="grid" |
| 50 | +/> |
| 51 | +``` |
| 52 | + |
| 53 | +### 3. Demo Page |
| 54 | + |
| 55 | +Location: `apps/web/src/pages/settings/objectui-demo.tsx` |
| 56 | + |
| 57 | +Interactive demonstration page accessible at `/settings/objectui-demo` showing: |
| 58 | +- Package installation status |
| 59 | +- Interactive object/view selector |
| 60 | +- Usage examples and documentation |
| 61 | + |
| 62 | +## Usage |
| 63 | + |
| 64 | +### Basic Grid View |
| 65 | + |
| 66 | +```typescript |
| 67 | +import { SchemaRenderer } from '@object-ui/react'; |
| 68 | +import { objectUIAdapter } from '@/lib/object-ui-adapter'; |
| 69 | + |
| 70 | +function ContactsGrid() { |
| 71 | + return ( |
| 72 | + <SchemaRenderer |
| 73 | + adapter={objectUIAdapter} |
| 74 | + objectName="contacts" |
| 75 | + view="grid" |
| 76 | + /> |
| 77 | + ); |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +### Form View |
| 82 | + |
| 83 | +```typescript |
| 84 | +<SchemaRenderer |
| 85 | + adapter={objectUIAdapter} |
| 86 | + objectName="contacts" |
| 87 | + view="form" |
| 88 | + recordId="123" // For editing existing record |
| 89 | +/> |
| 90 | +``` |
| 91 | + |
| 92 | +### Kanban View |
| 93 | + |
| 94 | +```typescript |
| 95 | +<SchemaRenderer |
| 96 | + adapter={objectUIAdapter} |
| 97 | + objectName="opportunities" |
| 98 | + view="kanban" |
| 99 | +/> |
| 100 | +``` |
| 101 | + |
| 102 | +## Development |
| 103 | + |
| 104 | +### Running the Demo |
| 105 | + |
| 106 | +1. Start the ObjectStack server: |
| 107 | + ```bash |
| 108 | + npm run objectstack:serve |
| 109 | + ``` |
| 110 | + |
| 111 | +2. In a separate terminal, start the web app: |
| 112 | + ```bash |
| 113 | + npm run web:dev |
| 114 | + ``` |
| 115 | + |
| 116 | +3. Navigate to http://localhost:5321/settings/objectui-demo |
| 117 | + |
| 118 | +### Adding New Views |
| 119 | + |
| 120 | +ObjectUI supports multiple view types: |
| 121 | +- `grid` - Data table with sorting, filtering, pagination |
| 122 | +- `form` - Create/edit forms with validation |
| 123 | +- `detail` - Read-only detail view |
| 124 | +- `kanban` - Kanban board (requires status field) |
| 125 | +- `calendar` - Calendar view (requires date field) |
| 126 | +- `timeline` - Timeline view |
| 127 | +- `chart` - Chart visualization |
| 128 | + |
| 129 | +## Architecture |
| 130 | + |
| 131 | +``` |
| 132 | +┌─────────────────────────────────────────┐ |
| 133 | +│ apps/web (React SPA) │ |
| 134 | +│ ┌───────────────────────────────────┐ │ |
| 135 | +│ │ @object-ui/react │ │ |
| 136 | +│ │ SchemaRenderer Component │ │ |
| 137 | +│ └───────────┬───────────────────────┘ │ |
| 138 | +│ │ │ |
| 139 | +│ ┌───────────▼───────────────────────┐ │ |
| 140 | +│ │ @object-ui/data-objectstack │ │ |
| 141 | +│ │ ObjectStack Data Adapter │ │ |
| 142 | +│ └───────────┬───────────────────────┘ │ |
| 143 | +└──────────────┼───────────────────────────┘ |
| 144 | + │ |
| 145 | + │ HTTP (REST/GraphQL) |
| 146 | + │ |
| 147 | +┌──────────────▼───────────────────────────┐ |
| 148 | +│ ObjectStack Server (Hono) │ |
| 149 | +│ - ObjectQL (Data Layer) │ |
| 150 | +│ - Auth, Permissions, Workflow │ |
| 151 | +│ - Plugins: CRM, HRM, etc. │ |
| 152 | +└──────────────────────────────────────────┘ |
| 153 | +``` |
| 154 | + |
| 155 | +## Next Steps |
| 156 | + |
| 157 | +1. **Implement Custom Plugins** - Create @object-ui plugins for specialized views |
| 158 | +2. **Add Field Renderers** - Custom field types and renderers |
| 159 | +3. **Layout Customization** - Customize app shell and navigation |
| 160 | +4. **Offline Sync** - Integrate with @objectos/browser for offline support |
| 161 | +5. **Module Federation** - Load plugin UIs dynamically |
| 162 | + |
| 163 | +## References |
| 164 | + |
| 165 | +- ObjectUI Repository: https://github.com/objectstack-ai/objectui |
| 166 | +- ObjectUI Documentation: https://www.objectui.org |
| 167 | +- ObjectStack Spec: https://github.com/objectstack-ai/spec |
| 168 | + |
| 169 | +## Upgrade Notes |
| 170 | + |
| 171 | +### ObjectStack 2.0.6 → 2.0.7 |
| 172 | + |
| 173 | +All @objectstack packages have been upgraded to version 2.0.7: |
| 174 | +- @objectstack/cli |
| 175 | +- @objectstack/runtime |
| 176 | +- @objectstack/spec |
| 177 | +- @objectstack/plugin-auth |
| 178 | +- @objectstack/driver-memory |
| 179 | +- @objectstack/objectql |
| 180 | +- @objectstack/plugin-hono-server |
| 181 | +- @objectstack/client |
| 182 | + |
| 183 | +No breaking changes detected. All packages continue to use spec protocol 2.0.x. |
0 commit comments