Skip to content

Commit c007ecb

Browse files
Update README with documentation for all new view components
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 35f9da7 commit c007ecb

1 file changed

Lines changed: 182 additions & 7 deletions

File tree

packages/views/README.md

Lines changed: 182 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ Core Object UI views package, providing seamless integration with ObjectStack ba
44

55
## Features
66

7-
- **ObjectTable**: A specialized table component that automatically fetches and displays data from ObjectStack objects
7+
- **ObjectGrid**: A specialized grid/table component with CRUD operations, search, filters, and pagination
88
- **ObjectForm**: A smart form component that generates forms from ObjectStack object schemas
9-
- **ObjectView**: A complete object management interface combining table and form components
9+
- **ObjectView**: A complete object management interface combining grid and form components
10+
- **ObjectKanban**: A kanban board view with drag-and-drop support for organizing data by status
11+
- **ObjectCalendar**: A calendar view for displaying time-based records as events
12+
- **ObjectGantt**: A Gantt chart view for project timeline visualization with progress tracking
13+
- **ObjectMap**: A geographic map view for location-based data visualization
1014

1115
## Installation
1216

@@ -16,10 +20,12 @@ npm install @object-ui/views @object-ui/core
1620

1721
## Usage
1822

19-
### ObjectTable
23+
### ObjectGrid
24+
25+
Display data in a table/grid format with sorting, filtering, and pagination.
2026

2127
```tsx
22-
import { ObjectTable } from '@object-ui/views';
28+
import { ObjectGrid } from '@object-ui/views';
2329
import { createObjectStackAdapter } from '@object-ui/core';
2430

2531
const dataSource = createObjectStackAdapter({
@@ -29,10 +35,13 @@ const dataSource = createObjectStackAdapter({
2935

3036
function UsersTable() {
3137
return (
32-
<ObjectTable
38+
<ObjectGrid
3339
schema={{
3440
type: 'object-grid',
35-
objectName: 'users'
41+
objectName: 'users',
42+
columns: ['name', 'email', 'status'],
43+
searchableFields: ['name', 'email'],
44+
pagination: { pageSize: 25 }
3645
}}
3746
dataSource={dataSource}
3847
/>
@@ -42,6 +51,8 @@ function UsersTable() {
4251

4352
### ObjectForm
4453

54+
Create or edit records with auto-generated forms.
55+
4556
```tsx
4657
import { ObjectForm } from '@object-ui/views';
4758
import { createObjectStackAdapter } from '@object-ui/core';
@@ -58,6 +69,7 @@ function UserForm() {
5869
type: 'object-form',
5970
objectName: 'users',
6071
mode: 'create',
72+
fields: ['name', 'email', 'role'],
6173
onSuccess: (data) => console.log('Created:', data)
6274
}}
6375
dataSource={dataSource}
@@ -68,6 +80,8 @@ function UserForm() {
6880

6981
### ObjectView
7082

83+
Complete CRUD interface with grid and form integration.
84+
7185
```tsx
7286
import { ObjectView } from '@object-ui/views';
7387
import { createObjectStackAdapter } from '@object-ui/core';
@@ -84,14 +98,175 @@ function UsersView() {
8498
type: 'object-view',
8599
objectName: 'users',
86100
showSearch: true,
87-
showFilters: true
101+
showFilters: true,
102+
layout: 'drawer'
103+
}}
104+
dataSource={dataSource}
105+
/>
106+
);
107+
}
108+
```
109+
110+
### ObjectKanban
111+
112+
Display data as a kanban board grouped by a status field.
113+
114+
```tsx
115+
import { ObjectKanban } from '@object-ui/views';
116+
117+
function TasksKanban() {
118+
return (
119+
<ObjectKanban
120+
schema={{
121+
type: 'object-grid',
122+
objectName: 'tasks',
123+
data: { provider: 'object', object: 'tasks' },
124+
filter: {
125+
kanban: {
126+
groupByField: 'status',
127+
columns: ['title', 'priority', 'assignee'],
128+
summarizeField: 'estimated_hours'
129+
}
130+
}
131+
}}
132+
dataSource={dataSource}
133+
onCardMove={(cardId, fromColumn, toColumn) => {
134+
console.log(`Moved ${cardId} from ${fromColumn} to ${toColumn}`);
135+
}}
136+
/>
137+
);
138+
}
139+
```
140+
141+
### ObjectCalendar
142+
143+
Display time-based records as calendar events.
144+
145+
```tsx
146+
import { ObjectCalendar } from '@object-ui/views';
147+
148+
function EventsCalendar() {
149+
return (
150+
<ObjectCalendar
151+
schema={{
152+
type: 'object-grid',
153+
objectName: 'events',
154+
data: { provider: 'object', object: 'events' },
155+
filter: {
156+
calendar: {
157+
startDateField: 'start_date',
158+
endDateField: 'end_date',
159+
titleField: 'title',
160+
colorField: 'category'
161+
}
162+
}
163+
}}
164+
dataSource={dataSource}
165+
onEventClick={(event) => console.log('Event clicked:', event)}
166+
/>
167+
);
168+
}
169+
```
170+
171+
### ObjectGantt
172+
173+
Visualize project tasks with a Gantt chart timeline.
174+
175+
```tsx
176+
import { ObjectGantt } from '@object-ui/views';
177+
178+
function ProjectGantt() {
179+
return (
180+
<ObjectGantt
181+
schema={{
182+
type: 'object-grid',
183+
objectName: 'tasks',
184+
data: { provider: 'object', object: 'tasks' },
185+
filter: {
186+
gantt: {
187+
startDateField: 'start_date',
188+
endDateField: 'end_date',
189+
titleField: 'title',
190+
progressField: 'progress',
191+
dependenciesField: 'dependencies'
192+
}
193+
}
88194
}}
89195
dataSource={dataSource}
196+
onTaskClick={(task) => console.log('Task clicked:', task)}
90197
/>
91198
);
92199
}
93200
```
94201

202+
### ObjectMap
203+
204+
Display location-based data on a map.
205+
206+
```tsx
207+
import { ObjectMap } from '@object-ui/views';
208+
209+
function LocationsMap() {
210+
return (
211+
<ObjectMap
212+
schema={{
213+
type: 'object-grid',
214+
objectName: 'locations',
215+
data: { provider: 'object', object: 'locations' },
216+
filter: {
217+
map: {
218+
latitudeField: 'latitude',
219+
longitudeField: 'longitude',
220+
titleField: 'name',
221+
descriptionField: 'address'
222+
}
223+
}
224+
}}
225+
dataSource={dataSource}
226+
onMarkerClick={(location) => console.log('Location clicked:', location)}
227+
/>
228+
);
229+
}
230+
```
231+
232+
## Data Providers
233+
234+
All view components support three data provider types:
235+
236+
### 1. Object Provider (ObjectStack)
237+
Automatically connects to ObjectStack Metadata and Data APIs.
238+
239+
```tsx
240+
data: {
241+
provider: 'object',
242+
object: 'users'
243+
}
244+
```
245+
246+
### 2. API Provider (Custom REST API)
247+
Use your own REST endpoints.
248+
249+
```tsx
250+
data: {
251+
provider: 'api',
252+
read: { url: '/api/users', method: 'GET' },
253+
write: { url: '/api/users', method: 'POST' }
254+
}
255+
```
256+
257+
### 3. Value Provider (Static Data)
258+
Use hardcoded data arrays for demos or testing.
259+
260+
```tsx
261+
data: {
262+
provider: 'value',
263+
items: [
264+
{ id: 1, name: 'John', email: 'john@example.com' },
265+
{ id: 2, name: 'Jane', email: 'jane@example.com' }
266+
]
267+
}
268+
```
269+
95270
## Schema Integration
96271

97272
All components automatically integrate with ObjectStack's schema system to:

0 commit comments

Comments
 (0)