Skip to content

Commit ce1079b

Browse files
Copilothuangyiirene
andcommitted
Fix code review issues: update import paths, add JSDoc, improve layout documentation
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent 0cac5af commit ce1079b

3 files changed

Lines changed: 34 additions & 5 deletions

File tree

packages/plugin-object/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ npm install @object-ui/plugin-object @object-ui/data-objectql
1818
### ObjectTable
1919

2020
```tsx
21-
import { ObjectTable } from '@object-ui/data-object';
21+
import { ObjectTable } from '@object-ui/plugin-object';
2222
import { ObjectQLDataSource } from '@object-ui/data-objectql';
2323

2424
const dataSource = new ObjectQLDataSource({
@@ -42,7 +42,7 @@ function UsersTable() {
4242
### ObjectForm
4343

4444
```tsx
45-
import { ObjectForm } from '@object-ui/data-object';
45+
import { ObjectForm } from '@object-ui/plugin-object';
4646
import { ObjectQLDataSource } from '@object-ui/data-objectql';
4747

4848
const dataSource = new ObjectQLDataSource({

packages/plugin-object/src/ObjectForm.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,18 @@ export const ObjectForm: React.FC<ObjectFormProps> = ({
237237
};
238238

239239
/**
240-
* Map ObjectQL field type to form field type
240+
* Maps an ObjectQL field type to the corresponding form field component type.
241+
*
242+
* This helper provides the translation layer between backend/ObjectQL field
243+
* definitions (e.g. `text`, `date`, `lookup`) and the generic form field
244+
* types understood by the schema renderer (e.g. `input`, `date-picker`,
245+
* `select`). If a field type is not explicitly mapped, the function falls
246+
* back to the generic `"input"` type.
247+
*
248+
* @param fieldType - The ObjectQL field type identifier to convert
249+
* (for example: `"text"`, `"number"`, `"date"`, `"lookup"`).
250+
* @returns The normalized form field type string used in the form schema
251+
* (for example: `"input"`, `"textarea"`, `"date-picker"`, `"select"`).
241252
*/
242253
function mapFieldTypeToFormType(fieldType: string): string {
243254
const typeMap: Record<string, string> = {

packages/types/src/objectql.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,31 @@ export interface ObjectFormSchema extends BaseSchema {
204204
}>;
205205

206206
/**
207-
* Form layout
207+
* Form layout.
208+
*
209+
* Supported layouts:
210+
* - `vertical` – label above field (default)
211+
* - `horizontal` – label and field in a row
212+
* - `inline` – compact inline layout, typically used in toolbars
213+
* - `grid` – **experimental** grid layout
214+
*
215+
* Note: As of the current implementation, the underlying form renderer does not yet
216+
* support a native `grid` layout and will internally treat `layout: "grid"` as
217+
* `layout: "vertical"`. This value is exposed in the schema for forward compatibility,
218+
* and behavior may change once grid support is implemented.
219+
*
208220
* @default 'vertical'
209221
*/
210222
layout?: 'vertical' | 'horizontal' | 'inline' | 'grid';
211223

212224
/**
213-
* Grid columns (for grid layout)
225+
* Grid columns (for grid layout).
226+
*
227+
* Intended number of columns when using a `grid` layout. Current renderers that do
228+
* not implement true grid support may ignore this value and fall back to a vertical
229+
* layout. When grid layout is supported, this value should control how many form
230+
* fields are placed per row.
231+
*
214232
* @default 2
215233
*/
216234
columns?: number;

0 commit comments

Comments
 (0)