robobyte-front-builder 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INTEGRATION.md +6 -0
- package/LICENSE +65 -0
- package/README.md +166 -21
- package/docs/ReportViewer.md +581 -0
- package/docs/fetchReportData.md +379 -0
- package/docs/printLayout.md +405 -0
- package/package.json +29 -1
- package/src/lib/index.js +14 -0
- package/src/lib/muiTheme.js +655 -0
- package/src/lib/providers/RoboByteFrontBuilderProvider.jsx +45 -1
- package/src/pages/_app.js +1 -0
- package/src/pages/printBuilder/index.jsx +26 -19
- package/src/pages/viewBuilder/index.jsx +29 -19
- package/training/00-index.md +168 -0
- package/training/01-input.md +144 -0
- package/training/02-checkbox.md +107 -0
- package/training/03-dropdown.md +135 -0
- package/training/04-datepicker.md +139 -0
- package/training/05-radio.md +123 -0
- package/training/06-number.md +133 -0
- package/training/07-textarea.md +114 -0
- package/training/08-richtext.md +112 -0
- package/training/09-tag.md +110 -0
- package/training/10-time.md +107 -0
- package/training/11-toggle.md +108 -0
- package/training/12-signature.md +107 -0
- package/training/13-autocomplete.md +134 -0
- package/training/14-button.md +168 -0
- package/training/15-label.md +138 -0
- package/training/16-header.md +128 -0
- package/training/17-divider.md +96 -0
- package/training/18-image.md +105 -0
- package/training/19-link.md +108 -0
- package/training/20-banner.md +122 -0
- package/training/21-progress-circle.md +101 -0
- package/training/22-progress-line.md +93 -0
- package/training/23-menu.md +139 -0
- package/training/24-popover.md +114 -0
- package/training/25-layout.md +116 -0
- package/training/26-layout-cell.md +143 -0
- package/training/27-card.md +87 -0
- package/training/28-wizard.md +126 -0
- package/training/29-wizard-step.md +92 -0
- package/training/30-repeater.md +123 -0
- package/training/31-dialog.md +131 -0
- package/training/32-breadcrumb.md +121 -0
- package/training/33-dataGrid.md +129 -0
- package/training/34-dataTableViewer.md +115 -0
- package/training/35-reportViewer.md +673 -0
- package/training/36-viewRenderer.md +110 -0
- package/training/37-treeView.md +170 -0
- package/training/38-kpi-metric.md +148 -0
- package/training/39-kpi-trend.md +105 -0
- package/training/40-kpi-badge.md +112 -0
- package/training/41-kpi-statusDot.md +118 -0
- package/training/42-kpi-iconBox.md +114 -0
- package/training/43-kpi-gauge.md +143 -0
- package/training/44-kpi-bulletChart.md +126 -0
- package/training/45-kpi-colorScale.md +143 -0
- package/training/46-kpi-rating.md +125 -0
- package/training/47-kpi-countdown.md +151 -0
- package/training/48-fetchReportData.md +276 -0
- package/training/49-printLayout.md +215 -0
- package/training/examples/01-login-form.json +176 -0
- package/training/examples/02-contact-form.json +141 -0
- package/training/examples/03-kpi-cards-row.json +123 -0
- package/training/examples/04-settings-toggles.json +153 -0
- package/training/examples/05-user-profile-card.json +136 -0
- package/training/examples/06-date-range-filter.json +108 -0
- package/training/examples/07-search-bar-results.json +130 -0
- package/training/examples/08-notification-settings.json +131 -0
- package/training/examples/09-employee-profile-form.json +259 -0
- package/training/examples/10-invoice-form.json +241 -0
- package/training/examples/11-dashboard-overview.json +251 -0
- package/training/examples/12-registration-wizard.json +154 -0
- package/training/examples/13-product-catalog.json +168 -0
- package/training/examples/14-data-table-with-filters.json +180 -0
- package/training/examples/15-tabbed-profile.json +92 -0
- package/training/examples/16-kpi-full-row.json +203 -0
- package/training/examples/17-tree-detail-view.json +139 -0
- package/training/examples/18-employee-management.json +233 -0
- package/training/examples/19-sales-dashboard.json +272 -0
- package/training/examples/20-checkout-wizard.json +225 -0
- package/training/examples/21-analytics-page.json +222 -0
- package/training/examples/22-hr-onboarding.json +222 -0
- package/training/examples/23-document-browser.json +241 -0
- package/training/examples/24-order-management.json +290 -0
- package/training/examples/25-crm-contact-page.json +272 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Component: dropdown
|
|
2
|
+
|
|
3
|
+
A select input letting users choose one or multiple options from a list. Options can be static or data-driven.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Props — Main Tab
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Options / Notes |
|
|
10
|
+
|------|------|-----------------|
|
|
11
|
+
| `key` | expression | Unique identifier. Selected value(s) stored in `data[key]` and `form[key]`. |
|
|
12
|
+
| `label` | expression | Label text. |
|
|
13
|
+
| `labelPosition` | select | `top` · `left` · `right` · `none` |
|
|
14
|
+
| `required` | boolean | Marks field required. |
|
|
15
|
+
| `value` | expression | Controlled value. For multiple, pass an array. |
|
|
16
|
+
| `placeholder` | text | Greyed hint text when nothing is selected. |
|
|
17
|
+
| `size` | select | `small` · `medium` · `large` |
|
|
18
|
+
| `disabled` | boolean | Disables the dropdown. |
|
|
19
|
+
| `enabled` | boolean | Enable/disable from an expression. |
|
|
20
|
+
| `fullWidth` | boolean | Stretches the dropdown to fill its container. |
|
|
21
|
+
| `options` | options-editor | Static list of `{ label, value }` pairs. Can also be bound to `data.someArray`. |
|
|
22
|
+
| `multiple` | boolean | Allows selecting multiple items (value becomes an array). |
|
|
23
|
+
| `native` | boolean | Renders as a native HTML `<select>` element instead of MUI. |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Props — Style Tab
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Options / Notes |
|
|
30
|
+
|------|------|-----------------|
|
|
31
|
+
| `color` | select | `default` · `primary` · `secondary` · `error` · `warning` · `info` · `success` |
|
|
32
|
+
| `display` | expression | CSS display. |
|
|
33
|
+
| `width` | expression | e.g. `"100%"` or `"280px"`. |
|
|
34
|
+
| `height` | expression | Height override. |
|
|
35
|
+
| `margin` | expression | Outer spacing. |
|
|
36
|
+
| `padding` | expression | Inner padding override. |
|
|
37
|
+
| `flexDirection` | select | `row` · `column` · `row-reverse` · `column-reverse` |
|
|
38
|
+
| `justifyContent` | select | `flex-start` · `center` · `flex-end` · `space-between` · `space-around` · `space-evenly` |
|
|
39
|
+
| `alignItems` | select | `flex-start` · `center` · `flex-end` · `stretch` · `baseline` |
|
|
40
|
+
| `gap` | expression | Gap between elements. |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Props — Actions Tab
|
|
45
|
+
|
|
46
|
+
| Event | Type | Notes |
|
|
47
|
+
|-------|------|-------|
|
|
48
|
+
| `onChange` | action (custom) | Fires when selection changes. New value is in `form[key]`. |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Use Cases
|
|
53
|
+
|
|
54
|
+
**When to use:**
|
|
55
|
+
- Choosing from a fixed list (countries, categories, statuses).
|
|
56
|
+
- Filtering data by a field when bound to data array.
|
|
57
|
+
- Multi-select: `multiple: true` for tag-like selection with a list.
|
|
58
|
+
|
|
59
|
+
**When NOT to use:**
|
|
60
|
+
- Only 2–4 choices visible at once → use `radio`.
|
|
61
|
+
- Freeform text with suggestions → use `autocomplete`.
|
|
62
|
+
- Boolean on/off → use `checkbox` or `toggle`.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Schema Examples
|
|
67
|
+
|
|
68
|
+
### Static options
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"type": "dropdown",
|
|
72
|
+
"props": {
|
|
73
|
+
"key": "status",
|
|
74
|
+
"label": "Status",
|
|
75
|
+
"required": true,
|
|
76
|
+
"placeholder": "Select status",
|
|
77
|
+
"options": [
|
|
78
|
+
{ "label": "Active", "value": "active" },
|
|
79
|
+
{ "label": "Inactive", "value": "inactive" },
|
|
80
|
+
{ "label": "Pending", "value": "pending" }
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"style": { "width": "100%", "color": "primary" }
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Dynamic options from data
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"type": "dropdown",
|
|
91
|
+
"props": {
|
|
92
|
+
"key": "departmentId",
|
|
93
|
+
"label": "Department",
|
|
94
|
+
"value": "data.employee.departmentId",
|
|
95
|
+
"options": "data.departments",
|
|
96
|
+
"fullWidth": true
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Multiple select
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"type": "dropdown",
|
|
105
|
+
"props": {
|
|
106
|
+
"key": "roles",
|
|
107
|
+
"label": "Roles",
|
|
108
|
+
"multiple": true,
|
|
109
|
+
"options": [
|
|
110
|
+
{ "label": "Admin", "value": "admin" },
|
|
111
|
+
{ "label": "Editor", "value": "editor" },
|
|
112
|
+
{ "label": "Viewer", "value": "viewer" }
|
|
113
|
+
],
|
|
114
|
+
"fullWidth": true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### With onChange to cascade another field
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"type": "dropdown",
|
|
123
|
+
"props": {
|
|
124
|
+
"key": "countryId",
|
|
125
|
+
"label": "Country",
|
|
126
|
+
"options": "data.countries"
|
|
127
|
+
},
|
|
128
|
+
"actions": {
|
|
129
|
+
"onChange": {
|
|
130
|
+
"type": "custom",
|
|
131
|
+
"code": "setData({ cities: [], selectedCity: null }); fetchCities(form.countryId)"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Component: datepicker
|
|
2
|
+
|
|
3
|
+
A date selection field with a calendar popup. Supports date formats, range restrictions, and view modes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Props — Main Tab
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Options / Notes |
|
|
10
|
+
|------|------|-----------------|
|
|
11
|
+
| `key` | expression | Unique identifier. Selected date string stored in `data[key]`. |
|
|
12
|
+
| `label` | expression | Label text. |
|
|
13
|
+
| `labelPosition` | select | `top` · `left` · `right` · `none` |
|
|
14
|
+
| `required` | boolean | Marks field required. |
|
|
15
|
+
| `value` | expression | Controlled value. Pass a date string or `data.someDate`. |
|
|
16
|
+
| `placeholder` | text | Hint text, e.g. `"YYYY-MM-DD"`. |
|
|
17
|
+
| `size` | select | `small` · `medium` · `large` |
|
|
18
|
+
| `disabled` | boolean | Disables the field. |
|
|
19
|
+
| `enabled` | boolean | Enable/disable from an expression. |
|
|
20
|
+
| `format` | text | Output format string, e.g. `"YYYY-MM-DD"`, `"DD/MM/YYYY"`, `"MM-DD-YYYY"`. |
|
|
21
|
+
| `views` | select | Which calendar panel to show: `day` · `month` · `year` |
|
|
22
|
+
| `openTo` | select | Which view opens first: `day` · `month` · `year` |
|
|
23
|
+
| `minDate` | expression | Earliest selectable date, e.g. `"2020-01-01"` or `data.contractStart`. |
|
|
24
|
+
| `maxDate` | expression | Latest selectable date, e.g. `new Date().toISOString()`. |
|
|
25
|
+
| `disableFuture` | boolean | Prevents selecting dates after today. |
|
|
26
|
+
| `disablePast` | boolean | Prevents selecting dates before today. |
|
|
27
|
+
| `readOnly` | boolean | Shows value but prevents editing. |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Props — Style Tab
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Options / Notes |
|
|
34
|
+
|------|------|-----------------|
|
|
35
|
+
| `color` | select | `default` · `primary` · `secondary` · `error` · `warning` · `info` · `success` |
|
|
36
|
+
| `display` | expression | CSS display. |
|
|
37
|
+
| `width` | expression | Field width. |
|
|
38
|
+
| `height` | expression | Height override. |
|
|
39
|
+
| `margin` | expression | Outer spacing. |
|
|
40
|
+
| `padding` | expression | Inner padding. |
|
|
41
|
+
| `flexDirection` | select | `row` · `column` · `row-reverse` · `column-reverse` |
|
|
42
|
+
| `justifyContent` | select | `flex-start` · `center` · `flex-end` · `space-between` · `space-around` · `space-evenly` |
|
|
43
|
+
| `alignItems` | select | `flex-start` · `center` · `flex-end` · `stretch` · `baseline` |
|
|
44
|
+
| `gap` | expression | Gap between elements. |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Props — Actions Tab
|
|
49
|
+
|
|
50
|
+
| Event | Type | Notes |
|
|
51
|
+
|-------|------|-------|
|
|
52
|
+
| `onChange` | action (custom) | Fires when the user selects a date. New value in `form[key]`. |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Use Cases
|
|
57
|
+
|
|
58
|
+
**When to use:**
|
|
59
|
+
- Date-of-birth, start date, end date, due date fields.
|
|
60
|
+
- Booking/scheduling forms.
|
|
61
|
+
- Filtering data by date range (use two datepickers with `minDate`/`maxDate` cross-linked).
|
|
62
|
+
- Year-only or month-only selection via `views: year` or `views: month`.
|
|
63
|
+
|
|
64
|
+
**When NOT to use:**
|
|
65
|
+
- Time-only input → use `time`.
|
|
66
|
+
- Date + time → combine `datepicker` + `time` or use a datetime field.
|
|
67
|
+
- Read-only date display → use `label`.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Schema Examples
|
|
72
|
+
|
|
73
|
+
### Simple date field
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"type": "datepicker",
|
|
77
|
+
"props": {
|
|
78
|
+
"key": "birthDate",
|
|
79
|
+
"label": "Date of Birth",
|
|
80
|
+
"format": "DD/MM/YYYY",
|
|
81
|
+
"disableFuture": true,
|
|
82
|
+
"required": true
|
|
83
|
+
},
|
|
84
|
+
"style": { "width": "100%" }
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Date range (start / end)
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"type": "datepicker",
|
|
92
|
+
"props": {
|
|
93
|
+
"key": "startDate",
|
|
94
|
+
"label": "Start Date",
|
|
95
|
+
"format": "YYYY-MM-DD",
|
|
96
|
+
"maxDate": "data.endDate"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"type": "datepicker",
|
|
103
|
+
"props": {
|
|
104
|
+
"key": "endDate",
|
|
105
|
+
"label": "End Date",
|
|
106
|
+
"format": "YYYY-MM-DD",
|
|
107
|
+
"minDate": "data.startDate",
|
|
108
|
+
"disablePast": true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Month/year picker only
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"type": "datepicker",
|
|
117
|
+
"props": {
|
|
118
|
+
"key": "reportMonth",
|
|
119
|
+
"label": "Report Month",
|
|
120
|
+
"views": "month",
|
|
121
|
+
"openTo": "month",
|
|
122
|
+
"format": "MM/YYYY"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Read-only display
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"type": "datepicker",
|
|
131
|
+
"props": {
|
|
132
|
+
"key": "createdAt",
|
|
133
|
+
"label": "Created",
|
|
134
|
+
"value": "data.record.createdAt",
|
|
135
|
+
"readOnly": true,
|
|
136
|
+
"format": "DD MMM YYYY"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Component: radio
|
|
2
|
+
|
|
3
|
+
A group of radio buttons for mutually exclusive selection. Ideal for 2–6 options visible at once.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Props — Main Tab
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Options / Notes |
|
|
10
|
+
|------|------|-----------------|
|
|
11
|
+
| `key` | expression | Unique identifier. Selected value stored in `data[key]` and `form[key]`. |
|
|
12
|
+
| `label` | expression | Group label shown above/beside the buttons. |
|
|
13
|
+
| `labelPosition` | select | `top` · `left` · `right` · `none` |
|
|
14
|
+
| `required` | boolean | Marks the group required. |
|
|
15
|
+
| `value` | expression | Controlled selected value, e.g. `data.gender`. |
|
|
16
|
+
| `size` | select | `small` · `medium` · `large` |
|
|
17
|
+
| `disabled` | boolean | Disables all radio buttons. |
|
|
18
|
+
| `enabled` | boolean | Enable/disable from an expression. |
|
|
19
|
+
| `options` | options-editor | List of `{ label, value }` pairs defining the choices. |
|
|
20
|
+
| `row` | boolean | `true` renders buttons horizontally (inline). Default is vertical stack. |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Props — Style Tab
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Options / Notes |
|
|
27
|
+
|------|------|-----------------|
|
|
28
|
+
| `color` | select | `default` · `primary` · `secondary` · `error` · `warning` · `info` · `success` |
|
|
29
|
+
| `display` | expression | CSS display. |
|
|
30
|
+
| `width` | expression | Wrapper width. |
|
|
31
|
+
| `height` | expression | Wrapper height. |
|
|
32
|
+
| `margin` | expression | Outer margin. |
|
|
33
|
+
| `padding` | expression | Inner padding. |
|
|
34
|
+
| `flexDirection` | select | `row` · `column` · `row-reverse` · `column-reverse` |
|
|
35
|
+
| `justifyContent` | select | `flex-start` · `center` · `flex-end` · `space-between` · `space-around` · `space-evenly` |
|
|
36
|
+
| `alignItems` | select | `flex-start` · `center` · `flex-end` · `stretch` · `baseline` |
|
|
37
|
+
| `gap` | expression | Gap between options. |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Props — Actions Tab
|
|
42
|
+
|
|
43
|
+
| Event | Type | Notes |
|
|
44
|
+
|-------|------|-------|
|
|
45
|
+
| `onChange` | action (custom) | Fires when the user selects a different option. New value in `form[key]`. |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Use Cases
|
|
50
|
+
|
|
51
|
+
**When to use:**
|
|
52
|
+
- Mutually exclusive options where all choices should be visible: gender, payment method, priority level.
|
|
53
|
+
- Small option sets (2–5 items). Larger sets → use `dropdown`.
|
|
54
|
+
- Survey-style questions.
|
|
55
|
+
|
|
56
|
+
**When NOT to use:**
|
|
57
|
+
- More than 5–6 options → use `dropdown`.
|
|
58
|
+
- Boolean yes/no that looks like a switch → use `toggle`.
|
|
59
|
+
- Multi-selection → use `checkbox` group or `dropdown multiple`.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Schema Examples
|
|
64
|
+
|
|
65
|
+
### Horizontal radio group
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"type": "radio",
|
|
69
|
+
"props": {
|
|
70
|
+
"key": "gender",
|
|
71
|
+
"label": "Gender",
|
|
72
|
+
"required": true,
|
|
73
|
+
"row": true,
|
|
74
|
+
"options": [
|
|
75
|
+
{ "label": "Male", "value": "male" },
|
|
76
|
+
{ "label": "Female", "value": "female" },
|
|
77
|
+
{ "label": "Other", "value": "other" }
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Vertical with controlled value
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"type": "radio",
|
|
87
|
+
"props": {
|
|
88
|
+
"key": "priority",
|
|
89
|
+
"label": "Priority",
|
|
90
|
+
"value": "data.task.priority",
|
|
91
|
+
"color": "primary",
|
|
92
|
+
"options": [
|
|
93
|
+
{ "label": "Low", "value": "low" },
|
|
94
|
+
{ "label": "Medium", "value": "medium" },
|
|
95
|
+
{ "label": "High", "value": "high" },
|
|
96
|
+
{ "label": "Critical", "value": "critical" }
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### With onChange
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"type": "radio",
|
|
106
|
+
"props": {
|
|
107
|
+
"key": "paymentMethod",
|
|
108
|
+
"label": "Payment Method",
|
|
109
|
+
"row": true,
|
|
110
|
+
"options": [
|
|
111
|
+
{ "label": "Credit Card", "value": "card" },
|
|
112
|
+
{ "label": "Bank Transfer", "value": "bank" },
|
|
113
|
+
{ "label": "Cash", "value": "cash" }
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"actions": {
|
|
117
|
+
"onChange": {
|
|
118
|
+
"type": "custom",
|
|
119
|
+
"code": "setData({ showCardForm: form.paymentMethod === 'card' })"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Component: number
|
|
2
|
+
|
|
3
|
+
A numeric input field with built-in formatting: currency, percentage, decimal, or custom mask patterns.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Props — Main Tab
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Options / Notes |
|
|
10
|
+
|------|------|-----------------|
|
|
11
|
+
| `key` | expression | Unique identifier. Value stored as a number in `data[key]` and `form[key]`. |
|
|
12
|
+
| `label` | expression | Label text. |
|
|
13
|
+
| `labelPosition` | select | `top` · `left` · `right` · `none` |
|
|
14
|
+
| `required` | boolean | Marks field required. |
|
|
15
|
+
| `value` | expression | Controlled value, e.g. `data.price`. |
|
|
16
|
+
| `placeholder` | text | Hint text shown when empty. |
|
|
17
|
+
| `size` | select | `small` · `medium` · `large` |
|
|
18
|
+
| `disabled` | boolean | Disables the field. |
|
|
19
|
+
| `enabled` | boolean | Enable/disable from an expression. |
|
|
20
|
+
| `formatType` | select | `decimal` · `currency` · `percentage` · `custom` — Controls how the number is formatted/displayed. |
|
|
21
|
+
| `decimalScale` | expression | Number of decimal places, e.g. `2`. |
|
|
22
|
+
| `fixedDecimalScale` | boolean | Always shows the decimal places (e.g. `10.00` instead of `10`). |
|
|
23
|
+
| `thousandSeparator` | boolean | Adds comma separators every 3 digits (e.g. `1,000,000`). |
|
|
24
|
+
| `currencySymbol` | text | Symbol shown when `formatType: currency`, e.g. `"$"`, `"€"`, `"AED"`. |
|
|
25
|
+
| `prefix` | text | Text prefix before the number, e.g. `"$"` or `"+"`. |
|
|
26
|
+
| `suffix` | text | Text suffix after the number, e.g. `"%"` or `" kg"`. |
|
|
27
|
+
| `allowNegative` | boolean | Permits entering negative values. Default: `true`. |
|
|
28
|
+
| `format` | text | Custom mask pattern, e.g. `"#### #### #### ####"` for credit card numbers. |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Props — Style Tab
|
|
33
|
+
|
|
34
|
+
| Prop | Type | Options / Notes |
|
|
35
|
+
|------|------|-----------------|
|
|
36
|
+
| `color` | select | `default` · `primary` · `secondary` · `error` · `warning` · `info` · `success` |
|
|
37
|
+
| `display` | expression | CSS display. |
|
|
38
|
+
| `width` | expression | Field width. |
|
|
39
|
+
| `height` | expression | Height override. |
|
|
40
|
+
| `margin` | expression | Outer spacing. |
|
|
41
|
+
| `padding` | expression | Inner padding. |
|
|
42
|
+
| `flexDirection` | select | `row` · `column` · `row-reverse` · `column-reverse` |
|
|
43
|
+
| `justifyContent` | select | `flex-start` · `center` · `flex-end` · `space-between` · `space-around` · `space-evenly` |
|
|
44
|
+
| `alignItems` | select | `flex-start` · `center` · `flex-end` · `stretch` · `baseline` |
|
|
45
|
+
| `gap` | expression | Gap between elements. |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Props — Actions Tab
|
|
50
|
+
|
|
51
|
+
| Event | Type | Notes |
|
|
52
|
+
|-------|------|-------|
|
|
53
|
+
| `onChange` | action (custom) | Fires when the numeric value changes. New value in `form[key]`. |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Use Cases
|
|
58
|
+
|
|
59
|
+
**When to use:**
|
|
60
|
+
- Price, salary, quantity, or any numeric form field.
|
|
61
|
+
- Currency amounts needing `$` prefix and thousands separator.
|
|
62
|
+
- Percentage inputs with `%` suffix.
|
|
63
|
+
- Masked formats like phone numbers, credit card numbers.
|
|
64
|
+
|
|
65
|
+
**When NOT to use:**
|
|
66
|
+
- Plain unformatted integer → a regular `input` may suffice.
|
|
67
|
+
- Date/time values → use `datepicker` / `time`.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Schema Examples
|
|
72
|
+
|
|
73
|
+
### Currency field
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"type": "number",
|
|
77
|
+
"props": {
|
|
78
|
+
"key": "price",
|
|
79
|
+
"label": "Price",
|
|
80
|
+
"formatType": "currency",
|
|
81
|
+
"currencySymbol": "$",
|
|
82
|
+
"decimalScale": 2,
|
|
83
|
+
"fixedDecimalScale": true,
|
|
84
|
+
"thousandSeparator": true,
|
|
85
|
+
"required": true
|
|
86
|
+
},
|
|
87
|
+
"style": { "width": "100%" }
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Percentage
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"type": "number",
|
|
95
|
+
"props": {
|
|
96
|
+
"key": "taxRate",
|
|
97
|
+
"label": "Tax Rate",
|
|
98
|
+
"formatType": "percentage",
|
|
99
|
+
"suffix": "%",
|
|
100
|
+
"decimalScale": 2,
|
|
101
|
+
"allowNegative": false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Credit card mask
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"type": "number",
|
|
110
|
+
"props": {
|
|
111
|
+
"key": "cardNumber",
|
|
112
|
+
"label": "Card Number",
|
|
113
|
+
"formatType": "custom",
|
|
114
|
+
"format": "#### #### #### ####",
|
|
115
|
+
"placeholder": "0000 0000 0000 0000"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Plain integer with separator
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"type": "number",
|
|
124
|
+
"props": {
|
|
125
|
+
"key": "quantity",
|
|
126
|
+
"label": "Quantity",
|
|
127
|
+
"formatType": "decimal",
|
|
128
|
+
"decimalScale": 0,
|
|
129
|
+
"thousandSeparator": true,
|
|
130
|
+
"allowNegative": false
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Component: textarea
|
|
2
|
+
|
|
3
|
+
A multi-line text input field. Auto-grows from a minimum row count up to `maxRows`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Props — Main Tab
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Options / Notes |
|
|
10
|
+
|------|------|-----------------|
|
|
11
|
+
| `key` | expression | Unique identifier. Value stored in `data[key]` and `form[key]`. |
|
|
12
|
+
| `label` | expression | Label text. |
|
|
13
|
+
| `labelPosition` | select | `top` · `left` · `right` · `none` |
|
|
14
|
+
| `required` | boolean | Marks field required. |
|
|
15
|
+
| `value` | expression | Controlled value, e.g. `data.notes`. |
|
|
16
|
+
| `placeholder` | text | Greyed hint text when empty. |
|
|
17
|
+
| `rows` | number | Minimum visible rows (default: `4`). |
|
|
18
|
+
| `maxRows` | number | Maximum rows before scrolling begins. Leave blank for unlimited growth. |
|
|
19
|
+
| `size` | select | `small` · `medium` · `large` |
|
|
20
|
+
| `disabled` | boolean | Disables the field. |
|
|
21
|
+
| `enabled` | boolean | Enable/disable from an expression. |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Props — Style Tab
|
|
26
|
+
|
|
27
|
+
| Prop | Type | Options / Notes |
|
|
28
|
+
|------|------|-----------------|
|
|
29
|
+
| `color` | select | `default` · `primary` · `secondary` · `error` · `warning` · `info` · `success` |
|
|
30
|
+
| `display` | expression | CSS display. |
|
|
31
|
+
| `width` | expression | Field width. |
|
|
32
|
+
| `height` | expression | Height override. |
|
|
33
|
+
| `margin` | expression | Outer spacing. |
|
|
34
|
+
| `padding` | expression | Inner padding. |
|
|
35
|
+
| `flexDirection` | select | `row` · `column` · `row-reverse` · `column-reverse` |
|
|
36
|
+
| `justifyContent` | select | `flex-start` · `center` · `flex-end` · `space-between` · `space-around` · `space-evenly` |
|
|
37
|
+
| `alignItems` | select | `flex-start` · `center` · `flex-end` · `stretch` · `baseline` |
|
|
38
|
+
| `gap` | expression | Gap between elements. |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Props — Actions Tab
|
|
43
|
+
|
|
44
|
+
| Event | Type | Notes |
|
|
45
|
+
|-------|------|-------|
|
|
46
|
+
| `onChange` | action (custom) | Fires when content changes. |
|
|
47
|
+
| `onBlur` | action (custom) | Fires when the field loses focus (useful for save-on-leave). |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Use Cases
|
|
52
|
+
|
|
53
|
+
**When to use:**
|
|
54
|
+
- Comments, notes, descriptions, addresses, bio fields.
|
|
55
|
+
- Any multi-line plain text that does NOT need formatting.
|
|
56
|
+
- Large text entries in forms.
|
|
57
|
+
|
|
58
|
+
**When NOT to use:**
|
|
59
|
+
- Rich text with bold/italic/lists → use `richtext`.
|
|
60
|
+
- Single-line input → use `input`.
|
|
61
|
+
- Code/JSON entry → use `input` or a code field.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Schema Examples
|
|
66
|
+
|
|
67
|
+
### Notes field
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"type": "textarea",
|
|
71
|
+
"props": {
|
|
72
|
+
"key": "notes",
|
|
73
|
+
"label": "Notes",
|
|
74
|
+
"placeholder": "Enter any additional notes...",
|
|
75
|
+
"rows": 4,
|
|
76
|
+
"maxRows": 10
|
|
77
|
+
},
|
|
78
|
+
"style": { "width": "100%" }
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Description with limits
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"type": "textarea",
|
|
86
|
+
"props": {
|
|
87
|
+
"key": "description",
|
|
88
|
+
"label": "Description",
|
|
89
|
+
"required": true,
|
|
90
|
+
"rows": 3,
|
|
91
|
+
"maxRows": 6,
|
|
92
|
+
"placeholder": "Describe the issue in detail"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### With onBlur auto-save
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"type": "textarea",
|
|
101
|
+
"props": {
|
|
102
|
+
"key": "memo",
|
|
103
|
+
"label": "Memo",
|
|
104
|
+
"rows": 5,
|
|
105
|
+
"value": "data.record.memo"
|
|
106
|
+
},
|
|
107
|
+
"actions": {
|
|
108
|
+
"onBlur": {
|
|
109
|
+
"type": "custom",
|
|
110
|
+
"code": "saveMemo({ id: data.record.id, memo: form.memo })"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|