Skip to content

Commit 20148ae

Browse files
Copilothotlong
andcommitted
feat: add tests and documentation for RecordPickerDialog and LookupField upgrade
- Add 15 comprehensive tests for RecordPickerDialog and LookupField two-level interaction - Update CHANGELOG.md with new features - Update ROADMAP.md with Record Picker milestone - Update lookup.mdx documentation with Record Picker section and new schema fields Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 6f59880 commit 20148ae

4 files changed

Lines changed: 493 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- **RecordPickerDialog Component** (`@object-ui/fields`): New enterprise-grade record selection dialog with multi-column table display, pagination, search, loading/error/empty states, and single/multi-select support. Provides the foundation for Salesforce-style Lookup experience.
13+
- **LookupField Two-Level Interaction** (`@object-ui/fields`): LookupField now supports a "Show All Results" button in the quick-select dialog that opens the full RecordPickerDialog with table view, pagination, and multi-column display.
14+
- **LookupFieldMetadata Schema Enhancement** (`@object-ui/types`): Added `lookup_columns`, `description_field`, `lookup_page_size` properties to `LookupFieldMetadata` for configuring the Record Picker display. New `LookupColumnDef` interface for typed column definitions.
15+
1016
### Changed
1117

1218
- **@objectstack v3.2.6 Upgrade**: Upgraded all `@objectstack/*` packages from `^3.2.5` to `^3.2.6` across 13 package.json files (43 references)

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ ObjectUI is a universal Server-Driven UI (SDUI) engine built on React + Tailwind
134134
- [x] Lookup field dynamic DataSource loading — popup fetches records via `DataSource.find()` with `$search` debounce, loading/error/empty states
135135
- [x] Lookup field context DataSource — reads DataSource from SchemaRendererContext so forms work without explicit prop
136136
- [x] Lookup field UX polish — arrow key navigation, description field display, quick-create entry, ARIA listbox roles
137+
- [x] Enterprise Record Picker — `RecordPickerDialog` component with multi-column table, pagination, search; LookupField two-level interaction (quick-select + "Show All Results" → full picker); `lookup_columns` / `lookup_page_size` schema config
137138
- [ ] Form conditional logic with branching
138139
- [ ] Multi-page forms with progress indicator
139140

content/docs/fields/lookup.mdx

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ interface LookupFieldSchema {
7373
7474
// Quick-create callback (shown when no results found)
7575
onCreateNew?: (searchQuery: string) => void;
76+
77+
// === Record Picker Configuration (Enterprise) ===
78+
79+
// Columns to show in the Record Picker dialog table.
80+
// Accepts field names or { field, label, width } objects.
81+
// When omitted, auto-infers from reference_field.
82+
lookup_columns?: Array<string | { field: string; label?: string; width?: string }>;
83+
84+
// Custom page size for the Record Picker dialog (default: 10)
85+
lookup_page_size?: number;
7686
}
7787
7888
interface LookupOption {
@@ -106,6 +116,38 @@ The popup will:
106116
2. Send `$search` queries with 300ms debounce as the user types
107117
3. Show loading spinner, error state with retry, and empty state
108118
4. Display "Showing X of Y" when more records exist than the page size
119+
5. Show a **"Show All Results"** button to open the full Record Picker dialog
120+
121+
## Record Picker Dialog (Enterprise)
122+
123+
When more results are available than displayed in the quick-select popup, a **"Show All Results"** button opens the full **RecordPickerDialog** — an enterprise-grade record selection experience.
124+
125+
```plaintext
126+
// Configure the Record Picker with lookup_columns
127+
{
128+
type: 'lookup',
129+
name: 'order',
130+
label: 'Order',
131+
reference_to: 'orders',
132+
reference_field: 'order_number',
133+
description_field: 'customer_name',
134+
lookup_columns: [
135+
{ field: 'order_number', label: 'Order #' },
136+
{ field: 'customer_name', label: 'Customer' },
137+
{ field: 'total_amount', label: 'Amount' },
138+
{ field: 'status', label: 'Status' },
139+
],
140+
lookup_page_size: 15,
141+
}
142+
```
143+
144+
The Record Picker dialog provides:
145+
- **Multi-column table** with configurable columns via `lookup_columns`
146+
- **Search** with debounced server-side querying
147+
- **Pagination** with page-by-page navigation
148+
- **Single/Multi-select** with visual check indicators
149+
- **Loading, error, and empty states**
150+
- Auto-inferred columns from `reference_field` when `lookup_columns` is not set
109151

110152
## Lookup vs Master-Detail
111153

@@ -133,12 +175,15 @@ import { LookupCellRenderer } from '@object-ui/fields';
133175

134176
## Features
135177

178+
- **Two-Level Interaction**: Quick-select popup + full Record Picker dialog
179+
- **Record Picker Dialog**: Enterprise-grade table with multi-column, pagination, search
136180
- **Dynamic DataSource Loading**: Automatically fetches records from referenced objects
137181
- **Search**: Debounced type-ahead search with `$search` parameter
138182
- **Multi-Select**: Support for multiple references
139183
- **Keyboard Navigation**: Arrow keys to navigate, Enter to select
140184
- **Loading/Error/Empty States**: Friendly feedback for all states
141185
- **Secondary Field Display**: Show description/subtitle per option
142186
- **Quick-Create Entry**: Optional "Create new" button when no results
143-
- **Pagination Hint**: Shows total count when more results available
187+
- **Configurable Columns**: `lookup_columns` for multi-column picker display
188+
- **Pagination**: Page-by-page navigation in Record Picker dialog
144189
- **Backward Compatible**: Falls back to static options when no DataSource

0 commit comments

Comments
 (0)