@ea-lab/reactive-json-docs 0.7.0 → 1.0.0-alpha.0
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/package.json +7 -5
- package/public/rjbuild/docs/advanced-concepts/data-processors.md +2 -2
- package/public/rjbuild/docs/advanced-concepts/plugins/component-development-guide-llm.md +14 -14
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.md +47 -1
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.yaml +53 -1
- package/public/rjbuild/docs/core/action/HashChangeListener.md +1 -1
- package/public/rjbuild/docs/core/action/HashChangeListener.yaml +24 -6
- package/public/rjbuild/docs/core/action/Hide.md +2 -2
- package/public/rjbuild/docs/core/action/Hide.yaml +4 -3
- package/public/rjbuild/docs/core/action/MessageListener.md +4 -4
- package/public/rjbuild/docs/core/action/MessageListener.yaml +18 -6
- package/public/rjbuild/docs/core/action/ReactOnEvent.md +4 -4
- package/public/rjbuild/docs/core/action/ReactOnEvent.yaml +4 -4
- package/public/rjbuild/docs/core/action/Redirect.md +2 -2
- package/public/rjbuild/docs/core/action/Redirect.yaml +8 -2
- package/public/rjbuild/docs/core/action/VisuallyHide.md +2 -2
- package/public/rjbuild/docs/core/action/VisuallyHide.yaml +2 -2
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.md +5 -5
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +90 -60
- package/public/rjbuild/docs/core/element/debug/VariablesDebug.md +59 -0
- package/public/rjbuild/docs/core/element/debug/VariablesDebug.yaml +71 -0
- package/public/rjbuild/docs/core/element/form/Input.md +307 -0
- package/public/rjbuild/docs/core/element/form/Input.yaml +572 -0
- package/public/rjbuild/docs/core/element/html/FolderSortableTree.yaml +40 -12
- package/public/rjbuild/docs/core/element/html/FormatNumeral.yaml +21 -7
- package/public/rjbuild/docs/core/element/html/Html.yaml +26 -9
- package/public/rjbuild/docs/core/element/html/LabelFromValue.yaml +25 -8
- package/public/rjbuild/docs/core/element/html/PreformattedMarkup.yaml +23 -7
- package/public/rjbuild/docs/core/element/html/SortableTreeItemCollapseButton.yaml +7 -6
- package/public/rjbuild/docs/core/element/html/SyntaxHighlighter.yaml +56 -20
- package/public/rjbuild/docs/core/element/special/Count.md +8 -10
- package/public/rjbuild/docs/core/element/special/Count.yaml +121 -40
- package/public/rjbuild/docs/core/element/special/DataFilter.md +40 -41
- package/public/rjbuild/docs/core/element/special/DataFilter.yaml +197 -81
- package/public/rjbuild/docs/core/element/special/DelayedActions.md +13 -15
- package/public/rjbuild/docs/core/element/special/DelayedActions.yaml +32 -13
- package/public/rjbuild/docs/core/element/special/PageControls.md +8 -10
- package/public/rjbuild/docs/core/element/special/PageControls.yaml +9 -8
- package/public/rjbuild/docs/core/element/special/Phantom.md +9 -11
- package/public/rjbuild/docs/core/element/special/Phantom.yaml +22 -9
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +7 -9
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +167 -49
- package/public/rjbuild/docs/core/element/special/Switch.md +36 -38
- package/public/rjbuild/docs/core/element/special/Switch.yaml +68 -40
- package/public/rjbuild/docs/core/example/html.md +2 -2
- package/public/rjbuild/docs/core/example/html.yaml +2 -3
- package/public/rjbuild/docs/core/example/native-html-forms.md +245 -0
- package/public/rjbuild/docs/core/example/native-html-forms.yaml +393 -0
- package/public/rjbuild/docs/core/reaction/addData.md +17 -5
- package/public/rjbuild/docs/core/reaction/addData.yaml +70 -11
- package/public/rjbuild/docs/core/reaction/fetchData.md +1 -2
- package/public/rjbuild/docs/core/reaction/fetchData.yaml +84 -19
- package/public/rjbuild/docs/core/reaction/moveData.md +0 -4
- package/public/rjbuild/docs/core/reaction/moveData.yaml +28 -6
- package/public/rjbuild/docs/core/reaction/postMessage.md +0 -4
- package/public/rjbuild/docs/core/reaction/postMessage.yaml +29 -6
- package/public/rjbuild/docs/core/reaction/redirectNow.md +0 -4
- package/public/rjbuild/docs/core/reaction/redirectNow.yaml +10 -3
- package/public/rjbuild/docs/core/reaction/removeData.md +2 -6
- package/public/rjbuild/docs/core/reaction/removeData.yaml +40 -2
- package/public/rjbuild/docs/core/reaction/setClipboardData.md +0 -4
- package/public/rjbuild/docs/core/reaction/setClipboardData.yaml +10 -3
- package/public/rjbuild/docs/core/reaction/setData.md +18 -8
- package/public/rjbuild/docs/core/reaction/setData.yaml +43 -11
- package/public/rjbuild/docs/core/reaction/submitData.md +2 -3
- package/public/rjbuild/docs/core/reaction/submitData.yaml +43 -7
- package/public/rjbuild/docs/core/reaction/triggerEvent.md +0 -4
- package/public/rjbuild/docs/core/reaction/triggerEvent.yaml +25 -11
- package/public/rjbuild/docs/docs-components/Mermaid.md +254 -0
- package/public/rjbuild/docs/docs-components/Mermaid.yaml +339 -0
- package/public/rjbuild/docs/docs-components/index.yaml +1 -0
- package/public/rjbuild/docs/getting-started/actions.md +1 -1
- package/public/rjbuild/docs/index.yaml +2 -1
- package/public/rjbuild/docs/install.md +26 -29
- package/public/rjbuild/docs/install.yaml +4 -10
- package/public/rjbuild/docs/integration/bootstrap/action/Popover.md +26 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Popover.yaml +28 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.md +4 -4
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.yaml +16 -3
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.yaml +40 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.md +5 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.yaml +27 -5
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.md +7 -7
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.yaml +32 -7
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.md +9 -9
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.yaml +46 -9
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.yaml +36 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.md +8 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.yaml +38 -8
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/formElementsCommon.md +2 -4
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.md +0 -2
- package/public/rjbuild/docs/integration/bootstrap/element/html/AccordionItem.md +69 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/AccordionItem.yaml +19 -7
- package/public/rjbuild/docs/integration/bootstrap/element/html/Modal.md +127 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Modal.yaml +35 -12
- package/public/rjbuild/docs/integration/bootstrap/element/html/Tabs.md +150 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Tabs.yaml +24 -15
- package/public/rjbuild/docs/integration/bootstrap/element/html/index.md +13 -0
- package/public/rjbuild/docs/{core → integration/bootstrap}/element/special/BootstrapElement.md +4 -6
- package/public/rjbuild/docs/integration/bootstrap/element/special/BootstrapElement.yaml +29 -0
- package/public/rjbuild/docs/integration/bootstrap/element/special/index.md +19 -0
- package/public/rjbuild/docs/integration/bootstrap/example/website.md +41 -0
- package/public/rjbuild/docs/integration/bootstrap/overview.md +69 -0
- package/public/rjbuild/docs/integration/bootstrap/overview.yaml +87 -0
- package/public/rjbuild/docs/core/action/Popover.md +0 -26
- package/public/rjbuild/docs/core/element/special/BootstrapElement.yaml +0 -18
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/accordion.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/dynamic-content.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/example/website.yaml +0 -0
- /package/public/rjbuild/docs/{chartjs → integration/chartjs}/components.yaml +0 -0
- /package/public/rjbuild/docs/{chartjs → integration/chartjs}/overview.yaml +0 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Native HTML Forms with Reactive-JSON
|
|
5
|
+
|
|
6
|
+
This guide explains how to use native HTML form elements (`input`, `select`, `textarea`) with Reactive-JSON's reaction system to create interactive forms with proper data synchronization.
|
|
7
|
+
|
|
8
|
+
## Core Concept: Reactions for Data Synchronization
|
|
9
|
+
|
|
10
|
+
Native HTML elements require explicit **reactions** to synchronize user input with your data. This is done using the `setData` reaction triggered by user events.
|
|
11
|
+
|
|
12
|
+
- type: SyntaxHighlighter
|
|
13
|
+
language: yaml
|
|
14
|
+
title: "Basic Structure"
|
|
15
|
+
content: |
|
|
16
|
+
- type: input
|
|
17
|
+
attributes:
|
|
18
|
+
type: "text"
|
|
19
|
+
value: ~.fieldName # Display current data value
|
|
20
|
+
actions:
|
|
21
|
+
- what: setData # Reaction to update data
|
|
22
|
+
on: input # Event that triggers the reaction
|
|
23
|
+
path: ~.fieldName # Data path to update
|
|
24
|
+
value: "<reactive-json:event-new-value>" # Value from the event
|
|
25
|
+
|
|
26
|
+
- type: Markdown
|
|
27
|
+
content: |
|
|
28
|
+
## Event Value Patterns
|
|
29
|
+
|
|
30
|
+
### Forward Update Pattern (Recommended)
|
|
31
|
+
|
|
32
|
+
Use `<reactive-json:event-new-value>` for automatic value detection:
|
|
33
|
+
|
|
34
|
+
- **Auto-detects the correct property**: `event.target.value` for inputs, `event.target.checked` for checkboxes
|
|
35
|
+
- **Simplifies configuration**: No need to specify which property to access
|
|
36
|
+
- **Works for all form elements**: text, number, checkbox, select, textarea, etc.
|
|
37
|
+
|
|
38
|
+
### Alternative Explicit Syntax
|
|
39
|
+
|
|
40
|
+
For specific control, you can explicitly access event properties:
|
|
41
|
+
|
|
42
|
+
- `<reactive-json:event>.target.value` - Direct access to input value
|
|
43
|
+
- `<reactive-json:event>.target.checked` - Direct access to checkbox state
|
|
44
|
+
- `<reactive-json:event>.target.selectedIndex` - Access to select index
|
|
45
|
+
|
|
46
|
+
## Event Types for Different Use Cases
|
|
47
|
+
|
|
48
|
+
- **`on: input`** - Real-time updates as user types (immediate feedback)
|
|
49
|
+
- **`on: change`** - Updates when user commits the change (varies by element type):
|
|
50
|
+
- Text inputs: when value changes AND field loses focus
|
|
51
|
+
- Checkboxes/Radio: immediately when checked/unchecked
|
|
52
|
+
- Select: immediately when option is selected
|
|
53
|
+
- **`on: blur`** - Updates when user leaves the field (regardless of value change)
|
|
54
|
+
- **`on: focus`** - Triggered when user enters the field
|
|
55
|
+
|
|
56
|
+
- type: RjBuildDescriber
|
|
57
|
+
title: "Text Input Example"
|
|
58
|
+
description: |
|
|
59
|
+
Basic text input with real-time data synchronization using the setData reaction.
|
|
60
|
+
toDescribe:
|
|
61
|
+
renderView:
|
|
62
|
+
- type: label
|
|
63
|
+
content: "Name:"
|
|
64
|
+
- type: input
|
|
65
|
+
attributes:
|
|
66
|
+
type: "text"
|
|
67
|
+
value: ~.name
|
|
68
|
+
placeholder: "Enter your name"
|
|
69
|
+
actions:
|
|
70
|
+
- what: setData
|
|
71
|
+
on: input
|
|
72
|
+
path: ~.name
|
|
73
|
+
value: "<reactive-json:event-new-value>"
|
|
74
|
+
- type: div
|
|
75
|
+
content: ["Current value: ", ~.name]
|
|
76
|
+
data:
|
|
77
|
+
name: ""
|
|
78
|
+
|
|
79
|
+
- type: RjBuildDescriber
|
|
80
|
+
title: "Checkbox Example"
|
|
81
|
+
description: |
|
|
82
|
+
Checkbox with data synchronization using the change event for boolean values.
|
|
83
|
+
toDescribe:
|
|
84
|
+
renderView:
|
|
85
|
+
- type: label
|
|
86
|
+
content:
|
|
87
|
+
- type: input
|
|
88
|
+
attributes:
|
|
89
|
+
type: "checkbox"
|
|
90
|
+
checked: ~.isSelected
|
|
91
|
+
actions:
|
|
92
|
+
- what: setData
|
|
93
|
+
on: change
|
|
94
|
+
path: ~.isSelected
|
|
95
|
+
value: "<reactive-json:event-new-value>"
|
|
96
|
+
- " Accept terms and conditions"
|
|
97
|
+
- type: div
|
|
98
|
+
content:
|
|
99
|
+
- "Status: "
|
|
100
|
+
- type: LabelFromValue
|
|
101
|
+
dataLocation: ~.isSelected
|
|
102
|
+
options:
|
|
103
|
+
- label: "Accepté"
|
|
104
|
+
value: true
|
|
105
|
+
- label: "Non accepté"
|
|
106
|
+
value: false
|
|
107
|
+
data:
|
|
108
|
+
isSelected: false
|
|
109
|
+
|
|
110
|
+
- type: RjBuildDescriber
|
|
111
|
+
title: "Select Dropdown Example"
|
|
112
|
+
description: |
|
|
113
|
+
Select dropdown with options and change event handling.
|
|
114
|
+
toDescribe:
|
|
115
|
+
renderView:
|
|
116
|
+
- type: label
|
|
117
|
+
content: "Choose option:"
|
|
118
|
+
- type: select
|
|
119
|
+
attributes:
|
|
120
|
+
value: ~.selectedOption
|
|
121
|
+
content:
|
|
122
|
+
- type: option
|
|
123
|
+
attributes:
|
|
124
|
+
value: ""
|
|
125
|
+
content: "Select an option..."
|
|
126
|
+
- type: option
|
|
127
|
+
attributes:
|
|
128
|
+
value: "option1"
|
|
129
|
+
content: "Option 1"
|
|
130
|
+
- type: option
|
|
131
|
+
attributes:
|
|
132
|
+
value: "option2"
|
|
133
|
+
content: "Option 2"
|
|
134
|
+
- type: option
|
|
135
|
+
attributes:
|
|
136
|
+
value: "option3"
|
|
137
|
+
content: "Option 3"
|
|
138
|
+
actions:
|
|
139
|
+
- what: setData
|
|
140
|
+
on: change
|
|
141
|
+
path: ~.selectedOption
|
|
142
|
+
value: "<reactive-json:event-new-value>"
|
|
143
|
+
- type: div
|
|
144
|
+
content: ["Selected: ", ~.selectedOption]
|
|
145
|
+
data:
|
|
146
|
+
selectedOption: ""
|
|
147
|
+
|
|
148
|
+
- type: RjBuildDescriber
|
|
149
|
+
title: "Textarea Example"
|
|
150
|
+
description: |
|
|
151
|
+
Multi-line text input with real-time updates.
|
|
152
|
+
toDescribe:
|
|
153
|
+
renderView:
|
|
154
|
+
- type: label
|
|
155
|
+
content: "Description:"
|
|
156
|
+
- type: textarea
|
|
157
|
+
attributes:
|
|
158
|
+
value: ~.description
|
|
159
|
+
placeholder: "Enter description..."
|
|
160
|
+
rows: 4
|
|
161
|
+
actions:
|
|
162
|
+
- what: setData
|
|
163
|
+
on: input
|
|
164
|
+
path: ~.description
|
|
165
|
+
value: "<reactive-json:event-new-value>"
|
|
166
|
+
- type: div
|
|
167
|
+
content: ["Current text: ", ~.description]
|
|
168
|
+
data:
|
|
169
|
+
description: ""
|
|
170
|
+
|
|
171
|
+
- type: RjBuildDescriber
|
|
172
|
+
title: "Range Input Example"
|
|
173
|
+
description: |
|
|
174
|
+
Range input with min/max constraints and validation.
|
|
175
|
+
toDescribe:
|
|
176
|
+
renderView:
|
|
177
|
+
- type: label
|
|
178
|
+
content: "Quantity (0-100):"
|
|
179
|
+
- type: input
|
|
180
|
+
attributes:
|
|
181
|
+
type: "range"
|
|
182
|
+
value: ~.quantity
|
|
183
|
+
min: 0
|
|
184
|
+
max: 100
|
|
185
|
+
actions:
|
|
186
|
+
- what: setData
|
|
187
|
+
on: input
|
|
188
|
+
path: ~.quantity
|
|
189
|
+
value: "<reactive-json:event-new-value>"
|
|
190
|
+
- type: div
|
|
191
|
+
content: ["Current quantity: ", ~.quantity]
|
|
192
|
+
data:
|
|
193
|
+
quantity: "20"
|
|
194
|
+
|
|
195
|
+
- type: RjBuildDescriber
|
|
196
|
+
title: "Radio Buttons Example"
|
|
197
|
+
description: |
|
|
198
|
+
Radio button group with exclusive selection.
|
|
199
|
+
toDescribe:
|
|
200
|
+
renderView:
|
|
201
|
+
- type: VariablesDebug
|
|
202
|
+
- type: div
|
|
203
|
+
content: "Choose size:"
|
|
204
|
+
- type: label
|
|
205
|
+
content:
|
|
206
|
+
- type: input
|
|
207
|
+
attributes:
|
|
208
|
+
type: "radio"
|
|
209
|
+
name: "size"
|
|
210
|
+
value: "small"
|
|
211
|
+
checked: ~.sizeState.small
|
|
212
|
+
actions:
|
|
213
|
+
- what: SetAttributeValue
|
|
214
|
+
name: checked
|
|
215
|
+
value: "checked"
|
|
216
|
+
when: ~.selectedSize
|
|
217
|
+
is: "small"
|
|
218
|
+
- what: setData
|
|
219
|
+
on: change
|
|
220
|
+
path: ~.selectedSize
|
|
221
|
+
value: "small"
|
|
222
|
+
- what: setData
|
|
223
|
+
on: change
|
|
224
|
+
path: ~.sizeState.small
|
|
225
|
+
value: true
|
|
226
|
+
- what: setData
|
|
227
|
+
on: change
|
|
228
|
+
path: ~.sizeState.medium
|
|
229
|
+
value: false
|
|
230
|
+
- what: setData
|
|
231
|
+
on: change
|
|
232
|
+
path: ~.sizeState.large
|
|
233
|
+
value: false
|
|
234
|
+
- " Small"
|
|
235
|
+
- type: label
|
|
236
|
+
content:
|
|
237
|
+
- type: input
|
|
238
|
+
attributes:
|
|
239
|
+
type: "radio"
|
|
240
|
+
name: "size"
|
|
241
|
+
value: "medium"
|
|
242
|
+
checked: ~.sizeState.medium
|
|
243
|
+
actions:
|
|
244
|
+
- what: SetAttributeValue
|
|
245
|
+
name: checked
|
|
246
|
+
value: "checked"
|
|
247
|
+
when: ~.selectedSize
|
|
248
|
+
is: "medium"
|
|
249
|
+
- what: setData
|
|
250
|
+
on: change
|
|
251
|
+
path: ~.selectedSize
|
|
252
|
+
value: "medium"
|
|
253
|
+
- what: setData
|
|
254
|
+
on: change
|
|
255
|
+
path: ~.sizeState.small
|
|
256
|
+
value: false
|
|
257
|
+
- what: setData
|
|
258
|
+
on: change
|
|
259
|
+
path: ~.sizeState.medium
|
|
260
|
+
value: true
|
|
261
|
+
- what: setData
|
|
262
|
+
on: change
|
|
263
|
+
path: ~.sizeState.large
|
|
264
|
+
value: false
|
|
265
|
+
- " Medium"
|
|
266
|
+
- type: label
|
|
267
|
+
content:
|
|
268
|
+
- type: input
|
|
269
|
+
attributes:
|
|
270
|
+
type: "radio"
|
|
271
|
+
name: "size"
|
|
272
|
+
value: "large"
|
|
273
|
+
checked: ~.sizeState.large
|
|
274
|
+
actions:
|
|
275
|
+
- what: SetAttributeValue
|
|
276
|
+
name: checked
|
|
277
|
+
value: "checked"
|
|
278
|
+
when: ~.selectedSize
|
|
279
|
+
is: "large"
|
|
280
|
+
- what: setData
|
|
281
|
+
on: change
|
|
282
|
+
path: ~.selectedSize
|
|
283
|
+
value: "large"
|
|
284
|
+
- what: setData
|
|
285
|
+
on: change
|
|
286
|
+
path: ~.sizeState.small
|
|
287
|
+
value: false
|
|
288
|
+
- what: setData
|
|
289
|
+
on: change
|
|
290
|
+
path: ~.sizeState.medium
|
|
291
|
+
value: false
|
|
292
|
+
- what: setData
|
|
293
|
+
on: change
|
|
294
|
+
path: ~.sizeState.large
|
|
295
|
+
value: true
|
|
296
|
+
- " Large"
|
|
297
|
+
- type: div
|
|
298
|
+
content: ["Selected size: ", ~.selectedSize]
|
|
299
|
+
data:
|
|
300
|
+
selectedSize: "medium"
|
|
301
|
+
sizeState:
|
|
302
|
+
small: false
|
|
303
|
+
medium: true
|
|
304
|
+
large: false
|
|
305
|
+
|
|
306
|
+
- type: Markdown
|
|
307
|
+
content: |
|
|
308
|
+
## Advanced Patterns
|
|
309
|
+
|
|
310
|
+
- type: SyntaxHighlighter
|
|
311
|
+
language: yaml
|
|
312
|
+
title: "Form Validation with Conditional Actions"
|
|
313
|
+
content: |
|
|
314
|
+
- type: input
|
|
315
|
+
attributes:
|
|
316
|
+
type: "email"
|
|
317
|
+
value: ~.email
|
|
318
|
+
actions:
|
|
319
|
+
- what: setData
|
|
320
|
+
on: input
|
|
321
|
+
path: ~.email
|
|
322
|
+
value: "<reactive-json:event-new-value>"
|
|
323
|
+
- what: setData
|
|
324
|
+
on: blur
|
|
325
|
+
path: ~.emailValid
|
|
326
|
+
value: "<reactive-json:event>.target.validity.valid"
|
|
327
|
+
|
|
328
|
+
- type: SyntaxHighlighter
|
|
329
|
+
language: yaml
|
|
330
|
+
title: "Multiple Field Updates"
|
|
331
|
+
content: |
|
|
332
|
+
- type: input
|
|
333
|
+
attributes:
|
|
334
|
+
type: "text"
|
|
335
|
+
value: ~.firstName
|
|
336
|
+
actions:
|
|
337
|
+
- what: setData
|
|
338
|
+
on: input
|
|
339
|
+
path: ~.firstName
|
|
340
|
+
value: "<reactive-json:event-new-value>"
|
|
341
|
+
- what: setData
|
|
342
|
+
on: input
|
|
343
|
+
path: ~.fullName
|
|
344
|
+
value: ["<reactive-json:event-new-value>", " ", ~.lastName]
|
|
345
|
+
|
|
346
|
+
- type: Markdown
|
|
347
|
+
content: |
|
|
348
|
+
## Simplification Alternatives
|
|
349
|
+
|
|
350
|
+
For simpler configuration and built-in styling, consider using pre-built form components:
|
|
351
|
+
|
|
352
|
+
- **Reactive-JSON Bootstrap**: `TextField`, `SelectField`, `CheckBoxField`, etc. with automatic data synchronization
|
|
353
|
+
- **Custom component libraries**: Create your own reusable form components with embedded reactions
|
|
354
|
+
|
|
355
|
+
- type: SyntaxHighlighter
|
|
356
|
+
language: yaml
|
|
357
|
+
title: "Comparison: Bootstrap vs Native"
|
|
358
|
+
content: |
|
|
359
|
+
# Simpler alternative using reactive-json-bootstrap
|
|
360
|
+
- type: TextField
|
|
361
|
+
label: "Username:"
|
|
362
|
+
dataLocation: ~.username # Automatic synchronization
|
|
363
|
+
|
|
364
|
+
# Equivalent native implementation
|
|
365
|
+
- type: label
|
|
366
|
+
content: "Username:"
|
|
367
|
+
- type: input
|
|
368
|
+
attributes:
|
|
369
|
+
type: "text"
|
|
370
|
+
value: ~.username
|
|
371
|
+
actions:
|
|
372
|
+
- what: setData
|
|
373
|
+
on: input
|
|
374
|
+
path: ~.username
|
|
375
|
+
value: "<reactive-json:event-new-value>"
|
|
376
|
+
|
|
377
|
+
- type: Markdown
|
|
378
|
+
content: |
|
|
379
|
+
## Best Practices
|
|
380
|
+
|
|
381
|
+
1. **Always include `setData` reactions** for interactive elements
|
|
382
|
+
2. **Choose appropriate events**: `input` for real-time updates, `change` for committed changes
|
|
383
|
+
3. **Use `<reactive-json:event-new-value>`** for automatic value detection
|
|
384
|
+
4. **Consider pre-built components** for complex forms to reduce configuration
|
|
385
|
+
5. **Test data flow** to ensure changes are properly synchronized
|
|
386
|
+
|
|
387
|
+
## Key Takeaways
|
|
388
|
+
|
|
389
|
+
- Native HTML elements provide full control but require explicit reactions
|
|
390
|
+
- The `setData` reaction is essential for data synchronization
|
|
391
|
+
- Use `<reactive-json:event-new-value>` for automatic value detection
|
|
392
|
+
- Different events (`input`, `change`, `blur`) serve different use cases
|
|
393
|
+
- Pre-built components can simplify complex forms while maintaining flexibility
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# addData
|
|
2
2
|
|
|
3
|
-
## Introduction
|
|
4
|
-
|
|
5
3
|
`addData` is a reaction that allows adding data at a specified path in the application's data context. It's particularly useful for appending new items to arrays or adding new properties to objects.
|
|
6
4
|
|
|
7
5
|
## Properties
|
|
@@ -71,9 +69,23 @@ data:
|
|
|
71
69
|
### Adding with Dynamic Values
|
|
72
70
|
```yaml
|
|
73
71
|
renderView:
|
|
74
|
-
- type:
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
- type: label
|
|
73
|
+
content: "New Item:"
|
|
74
|
+
- type: input
|
|
75
|
+
attributes:
|
|
76
|
+
type: "text"
|
|
77
|
+
value: ~.new_item
|
|
78
|
+
style:
|
|
79
|
+
padding: "8px"
|
|
80
|
+
margin: "8px 0"
|
|
81
|
+
border: "1px solid #ccc"
|
|
82
|
+
borderRadius: "4px"
|
|
83
|
+
width: "200px"
|
|
84
|
+
actions:
|
|
85
|
+
- what: setData
|
|
86
|
+
on: input
|
|
87
|
+
path: ~.new_item
|
|
88
|
+
value: "<reactive-json:event-new-value>"
|
|
77
89
|
- type: button
|
|
78
90
|
content: Add
|
|
79
91
|
actions:
|
|
@@ -6,9 +6,24 @@ renderView:
|
|
|
6
6
|
`addData` is a reaction that allows adding data at a specified path in the application's data context. It's particularly useful for appending new items to arrays or adding new properties to objects.
|
|
7
7
|
|
|
8
8
|
## Properties
|
|
9
|
-
- `path` (string, required): The location where the data should be added (using template path syntax with `~` or `~~`). If the path does not exist, it will be created automatically.
|
|
10
|
-
- `value` (any, optional): The data to add. Can be any valid JSON value (string, number, object, array).
|
|
11
9
|
|
|
10
|
+
- type: DefinitionList
|
|
11
|
+
content:
|
|
12
|
+
- term:
|
|
13
|
+
code: path
|
|
14
|
+
after: "(string, required)"
|
|
15
|
+
details:
|
|
16
|
+
type: Markdown
|
|
17
|
+
content: "The location where the data should be added (using template path syntax with `~` or `~~`). If the path does not exist, it will be created automatically"
|
|
18
|
+
- term:
|
|
19
|
+
code: value
|
|
20
|
+
after: "(any, optional)"
|
|
21
|
+
details:
|
|
22
|
+
type: Markdown
|
|
23
|
+
content: "The data to add. Can be any valid JSON value (string, number, object, array)"
|
|
24
|
+
|
|
25
|
+
- type: Markdown
|
|
26
|
+
content: |
|
|
12
27
|
## Behavior
|
|
13
28
|
- If the path doesn't exist, it will be created automatically
|
|
14
29
|
- For arrays, the value is appended to the end
|
|
@@ -72,9 +87,23 @@ renderView:
|
|
|
72
87
|
### Adding with Dynamic Values
|
|
73
88
|
```yaml
|
|
74
89
|
renderView:
|
|
75
|
-
- type:
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
- type: label
|
|
91
|
+
content: "New Item:"
|
|
92
|
+
- type: input
|
|
93
|
+
attributes:
|
|
94
|
+
type: "text"
|
|
95
|
+
value: ~.new_item
|
|
96
|
+
style:
|
|
97
|
+
padding: "8px"
|
|
98
|
+
margin: "8px 0"
|
|
99
|
+
border: "1px solid #ccc"
|
|
100
|
+
borderRadius: "4px"
|
|
101
|
+
width: "200px"
|
|
102
|
+
actions:
|
|
103
|
+
- what: setData
|
|
104
|
+
on: input
|
|
105
|
+
path: ~.new_item
|
|
106
|
+
value: "<reactive-json:event-new-value>"
|
|
78
107
|
- type: button
|
|
79
108
|
content: Add
|
|
80
109
|
actions:
|
|
@@ -113,12 +142,42 @@ renderView:
|
|
|
113
142
|
load: user_form
|
|
114
143
|
templates:
|
|
115
144
|
user_form:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
145
|
+
type: div
|
|
146
|
+
content:
|
|
147
|
+
- type: label
|
|
148
|
+
content: "Name:"
|
|
149
|
+
- type: input
|
|
150
|
+
attributes:
|
|
151
|
+
type: "text"
|
|
152
|
+
value: ~.name
|
|
153
|
+
style:
|
|
154
|
+
padding: "8px"
|
|
155
|
+
margin: "8px 0"
|
|
156
|
+
border: "1px solid #ccc"
|
|
157
|
+
borderRadius: "4px"
|
|
158
|
+
width: "200px"
|
|
159
|
+
actions:
|
|
160
|
+
- what: setData
|
|
161
|
+
on: input
|
|
162
|
+
path: ~.name
|
|
163
|
+
value: "<reactive-json:event-new-value>"
|
|
164
|
+
- type: label
|
|
165
|
+
content: "Email:"
|
|
166
|
+
- type: input
|
|
167
|
+
attributes:
|
|
168
|
+
type: "email"
|
|
169
|
+
value: ~.email
|
|
170
|
+
style:
|
|
171
|
+
padding: "8px"
|
|
172
|
+
margin: "8px 0"
|
|
173
|
+
border: "1px solid #ccc"
|
|
174
|
+
borderRadius: "4px"
|
|
175
|
+
width: "200px"
|
|
176
|
+
actions:
|
|
177
|
+
- what: setData
|
|
178
|
+
on: input
|
|
179
|
+
path: ~.email
|
|
180
|
+
value: "<reactive-json:event-new-value>"
|
|
122
181
|
data:
|
|
123
182
|
users:
|
|
124
183
|
- name: "John"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Reactive-JSON fetchData Documentation
|
|
2
2
|
|
|
3
|
-
## Introduction
|
|
4
3
|
`fetchData` is a reaction that allows making HTTP requests to a server. It operates in multiple modes, depending on configuration values.
|
|
5
4
|
|
|
6
5
|
- Supports configurable HTTP methods (GET by default for backward compatibility)
|
|
@@ -9,11 +8,11 @@
|
|
|
9
8
|
- The response can refresh the app (default) or be ignored
|
|
10
9
|
|
|
11
10
|
## Properties
|
|
12
|
-
- `url` (string, required): The URL to call (must be a static string, dynamic URLs are not supported)
|
|
13
11
|
- `httpMethod` (string, optional): The HTTP method to use (default: "get"). Supports: get, post, put, patch, delete, etc.
|
|
14
12
|
- `refreshAppOnResponse` (boolean, optional): If true (default), the response will update the application. If false, the response is ignored (webhook mode).
|
|
15
13
|
- `updateOnlyData` (boolean, optional): When true and `refreshAppOnResponse` is true, only updates the data section instead of replacing the entire RjBuild. Preserves templates and renderView. Default: false.
|
|
16
14
|
- `updateDataAtLocation` (string, optional): When `updateOnlyData` is true, specifies where to place the response data using template path syntax (e.g., "~~.userProfile", "~.config.settings"). If not specified, replaces the entire data object.
|
|
15
|
+
- `url` (string, required): The URL to call (must be a static string, dynamic URLs are not supported)
|
|
17
16
|
|
|
18
17
|
## Behavior
|
|
19
18
|
- Supports configurable HTTP methods (GET by default for backward compatibility)
|