Skip to content

Commit a6f7654

Browse files
Copilothotlong
andcommitted
feat: enhance List View and Form View protocols with detailed configuration schemas
- Add ListColumnSchema with field, label, width, align, hidden, sortable, resizable, wrap, type - Add SelectionConfigSchema for row selection (none/single/multiple) - Add PaginationConfigSchema with pageSize and pageSizeOptions - Update ListViewSchema to support both string[] (legacy) and ListColumnSchema[] columns - Add resizable, striped, bordered features to ListViewSchema - Add FormFieldSchema with field, label, placeholder, helpText, readonly, required, hidden, colSpan - Add widget, dependsOn, visibleOn to FormFieldSchema for custom components and conditional logic - Update FormSectionSchema to support mixed field types (string | FormFieldSchema) - Add comprehensive test coverage for all new schemas - Generate JSON schemas and TypeScript type definitions Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b982da1 commit a6f7654

17 files changed

Lines changed: 1533 additions & 25 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: FormField
3+
description: FormField Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **field** | `string` || Field name (snake_case) |
11+
| **label** | `string` | optional | Display label override |
12+
| **placeholder** | `string` | optional | Placeholder text |
13+
| **helpText** | `string` | optional | Help/hint text |
14+
| **readonly** | `boolean` | optional | Read-only override |
15+
| **required** | `boolean` | optional | Required override |
16+
| **hidden** | `boolean` | optional | Hidden override |
17+
| **colSpan** | `number` | optional | Column span in grid layout (1-4) |
18+
| **widget** | `string` | optional | Custom widget/component name |
19+
| **dependsOn** | `string` | optional | Parent field name for cascading |
20+
| **visibleOn** | `string` | optional | Visibility condition expression |

content/docs/references/ui/view/FormSection.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ description: FormSection Schema Reference
1111
| **collapsible** | `boolean` | optional | |
1212
| **collapsed** | `boolean` | optional | |
1313
| **columns** | `Enum<'1' \| '2' \| '3' \| '4'>` | optional | |
14-
| **fields** | `string[]` || |
14+
| **fields** | `string \| object[]` || |
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: ListColumn
3+
description: ListColumn Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **field** | `string` || Field name (snake_case) |
11+
| **label** | `string` | optional | Display label override |
12+
| **width** | `number` | optional | Column width in pixels |
13+
| **align** | `Enum<'left' \| 'center' \| 'right'>` | optional | Text alignment |
14+
| **hidden** | `boolean` | optional | Hide column by default |
15+
| **sortable** | `boolean` | optional | Allow sorting by this column |
16+
| **resizable** | `boolean` | optional | Allow resizing this column |
17+
| **wrap** | `boolean` | optional | Allow text wrapping |
18+
| **type** | `string` | optional | Renderer type override (e.g., "currency", "date") |

content/docs/references/ui/view/ListView.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ description: ListView Schema Reference
1010
| **name** | `string` | optional | |
1111
| **label** | `string` | optional | |
1212
| **type** | `Enum<'grid' \| 'kanban' \| 'calendar' \| 'gantt' \| 'map'>` | optional | |
13-
| **columns** | `string[]` || Fields to display as columns |
13+
| **columns** | `string[] \| object[]` || Fields to display as columns |
1414
| **filter** | `any[]` | optional | Filter criteria (JSON Rules) |
1515
| **sort** | `string \| object[]` | optional | |
1616
| **searchableFields** | `string[]` | optional | Fields enabled for search |
17+
| **resizable** | `boolean` | optional | Enable column resizing |
18+
| **striped** | `boolean` | optional | Striped row styling |
19+
| **bordered** | `boolean` | optional | Show borders |
20+
| **selection** | `object` | optional | Row selection configuration |
21+
| **pagination** | `object` | optional | Pagination configuration |
1722
| **kanban** | `object` | optional | |
1823
| **calendar** | `object` | optional | |
1924
| **gantt** | `object` | optional | |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: PaginationConfig
3+
description: PaginationConfig Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **pageSize** | `number` | optional | Number of records per page |
11+
| **pageSizeOptions** | `number[]` | optional | Available page size options |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: SelectionConfig
3+
description: SelectionConfig Schema Reference
4+
---
5+
6+
## Properties
7+
8+
| Property | Type | Required | Description |
9+
| :--- | :--- | :--- | :--- |
10+
| **type** | `Enum<'none' \| 'single' \| 'multiple'>` | optional | Selection mode |
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$ref": "#/definitions/FormField",
3+
"definitions": {
4+
"FormField": {
5+
"type": "object",
6+
"properties": {
7+
"field": {
8+
"type": "string",
9+
"description": "Field name (snake_case)"
10+
},
11+
"label": {
12+
"type": "string",
13+
"description": "Display label override"
14+
},
15+
"placeholder": {
16+
"type": "string",
17+
"description": "Placeholder text"
18+
},
19+
"helpText": {
20+
"type": "string",
21+
"description": "Help/hint text"
22+
},
23+
"readonly": {
24+
"type": "boolean",
25+
"description": "Read-only override"
26+
},
27+
"required": {
28+
"type": "boolean",
29+
"description": "Required override"
30+
},
31+
"hidden": {
32+
"type": "boolean",
33+
"description": "Hidden override"
34+
},
35+
"colSpan": {
36+
"type": "number",
37+
"description": "Column span in grid layout (1-4)"
38+
},
39+
"widget": {
40+
"type": "string",
41+
"description": "Custom widget/component name"
42+
},
43+
"dependsOn": {
44+
"type": "string",
45+
"description": "Parent field name for cascading"
46+
},
47+
"visibleOn": {
48+
"type": "string",
49+
"description": "Visibility condition expression"
50+
}
51+
},
52+
"required": [
53+
"field"
54+
],
55+
"additionalProperties": false
56+
}
57+
},
58+
"$schema": "http://json-schema.org/draft-07/schema#"
59+
}

packages/spec/json-schema/ui/FormSection.json

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,64 @@
2828
"fields": {
2929
"type": "array",
3030
"items": {
31-
"type": "string"
31+
"anyOf": [
32+
{
33+
"type": "string"
34+
},
35+
{
36+
"type": "object",
37+
"properties": {
38+
"field": {
39+
"type": "string",
40+
"description": "Field name (snake_case)"
41+
},
42+
"label": {
43+
"type": "string",
44+
"description": "Display label override"
45+
},
46+
"placeholder": {
47+
"type": "string",
48+
"description": "Placeholder text"
49+
},
50+
"helpText": {
51+
"type": "string",
52+
"description": "Help/hint text"
53+
},
54+
"readonly": {
55+
"type": "boolean",
56+
"description": "Read-only override"
57+
},
58+
"required": {
59+
"type": "boolean",
60+
"description": "Required override"
61+
},
62+
"hidden": {
63+
"type": "boolean",
64+
"description": "Hidden override"
65+
},
66+
"colSpan": {
67+
"type": "number",
68+
"description": "Column span in grid layout (1-4)"
69+
},
70+
"widget": {
71+
"type": "string",
72+
"description": "Custom widget/component name"
73+
},
74+
"dependsOn": {
75+
"type": "string",
76+
"description": "Parent field name for cascading"
77+
},
78+
"visibleOn": {
79+
"type": "string",
80+
"description": "Visibility condition expression"
81+
}
82+
},
83+
"required": [
84+
"field"
85+
],
86+
"additionalProperties": false
87+
}
88+
]
3289
}
3390
}
3491
},

packages/spec/json-schema/ui/FormView.json

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,64 @@
4242
"fields": {
4343
"type": "array",
4444
"items": {
45-
"type": "string"
45+
"anyOf": [
46+
{
47+
"type": "string"
48+
},
49+
{
50+
"type": "object",
51+
"properties": {
52+
"field": {
53+
"type": "string",
54+
"description": "Field name (snake_case)"
55+
},
56+
"label": {
57+
"type": "string",
58+
"description": "Display label override"
59+
},
60+
"placeholder": {
61+
"type": "string",
62+
"description": "Placeholder text"
63+
},
64+
"helpText": {
65+
"type": "string",
66+
"description": "Help/hint text"
67+
},
68+
"readonly": {
69+
"type": "boolean",
70+
"description": "Read-only override"
71+
},
72+
"required": {
73+
"type": "boolean",
74+
"description": "Required override"
75+
},
76+
"hidden": {
77+
"type": "boolean",
78+
"description": "Hidden override"
79+
},
80+
"colSpan": {
81+
"type": "number",
82+
"description": "Column span in grid layout (1-4)"
83+
},
84+
"widget": {
85+
"type": "string",
86+
"description": "Custom widget/component name"
87+
},
88+
"dependsOn": {
89+
"type": "string",
90+
"description": "Parent field name for cascading"
91+
},
92+
"visibleOn": {
93+
"type": "string",
94+
"description": "Visibility condition expression"
95+
}
96+
},
97+
"required": [
98+
"field"
99+
],
100+
"additionalProperties": false
101+
}
102+
]
46103
}
47104
}
48105
},
@@ -81,7 +138,64 @@
81138
"fields": {
82139
"type": "array",
83140
"items": {
84-
"type": "string"
141+
"anyOf": [
142+
{
143+
"type": "string"
144+
},
145+
{
146+
"type": "object",
147+
"properties": {
148+
"field": {
149+
"type": "string",
150+
"description": "Field name (snake_case)"
151+
},
152+
"label": {
153+
"type": "string",
154+
"description": "Display label override"
155+
},
156+
"placeholder": {
157+
"type": "string",
158+
"description": "Placeholder text"
159+
},
160+
"helpText": {
161+
"type": "string",
162+
"description": "Help/hint text"
163+
},
164+
"readonly": {
165+
"type": "boolean",
166+
"description": "Read-only override"
167+
},
168+
"required": {
169+
"type": "boolean",
170+
"description": "Required override"
171+
},
172+
"hidden": {
173+
"type": "boolean",
174+
"description": "Hidden override"
175+
},
176+
"colSpan": {
177+
"type": "number",
178+
"description": "Column span in grid layout (1-4)"
179+
},
180+
"widget": {
181+
"type": "string",
182+
"description": "Custom widget/component name"
183+
},
184+
"dependsOn": {
185+
"type": "string",
186+
"description": "Parent field name for cascading"
187+
},
188+
"visibleOn": {
189+
"type": "string",
190+
"description": "Visibility condition expression"
191+
}
192+
},
193+
"required": [
194+
"field"
195+
],
196+
"additionalProperties": false
197+
}
198+
]
85199
}
86200
}
87201
},

0 commit comments

Comments
 (0)