@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
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# ReactiveJsonSubroot
|
|
2
2
|
|
|
3
|
-
## Introduction
|
|
4
|
-
|
|
5
3
|
The `ReactiveJsonSubroot` component allows you to render a new Reactive-JSON root inside an existing application. It is useful for embedding a sub-application, isolating a part of the data tree, or rendering a separate rjbuild with its own options.
|
|
6
4
|
|
|
7
5
|
With the `sharedUpdates` feature, the component can also propagate data changes back to the parent, enabling seamless communication between parent and subroot when working with shared data references.
|
|
@@ -60,15 +58,15 @@ When `sharedUpdates: true` is enabled, the component automatically detects templ
|
|
|
60
58
|
|
|
61
59
|
### Supported vs Unsupported Cases
|
|
62
60
|
|
|
63
|
-
####
|
|
61
|
+
#### Supported cases
|
|
64
62
|
|
|
65
|
-
#####
|
|
63
|
+
##### Direct reference
|
|
66
64
|
```yaml
|
|
67
65
|
dataOverride: ~~.user
|
|
68
66
|
# Modifications in the subroot propagate to "user" in the parent
|
|
69
67
|
```
|
|
70
68
|
|
|
71
|
-
#####
|
|
69
|
+
##### Object mapping with references
|
|
72
70
|
```yaml
|
|
73
71
|
dataOverride:
|
|
74
72
|
userInfo: ~~.user
|
|
@@ -77,19 +75,19 @@ dataOverride:
|
|
|
77
75
|
# Modifications to "settings" propagate to "config" in the parent
|
|
78
76
|
```
|
|
79
77
|
|
|
80
|
-
#####
|
|
78
|
+
##### Local references
|
|
81
79
|
```yaml
|
|
82
80
|
dataOverride: ~.localData
|
|
83
81
|
# Modifications propagate to the local template context
|
|
84
82
|
```
|
|
85
83
|
|
|
86
|
-
#####
|
|
84
|
+
##### Hierarchical references
|
|
87
85
|
```yaml
|
|
88
86
|
dataOverride: ~>key.someData
|
|
89
87
|
# Modifications propagate up the template hierarchy
|
|
90
88
|
```
|
|
91
89
|
|
|
92
|
-
#####
|
|
90
|
+
##### Arrays in dataOverride
|
|
93
91
|
```yaml
|
|
94
92
|
dataOverride:
|
|
95
93
|
- ~~.firstItem
|
|
@@ -97,7 +95,7 @@ dataOverride:
|
|
|
97
95
|
# Array items with template references are properly handled
|
|
98
96
|
```
|
|
99
97
|
|
|
100
|
-
####
|
|
98
|
+
#### Unsupported cases
|
|
101
99
|
|
|
102
100
|
##### Nested references in data
|
|
103
101
|
```yaml
|
|
@@ -145,19 +145,19 @@ renderView:
|
|
|
145
145
|
1. **Automatic synchronization**: Data remains consistent between parent and subroot
|
|
146
146
|
2. **Simplicity**: No need to manually manage update callbacks
|
|
147
147
|
3. **Performance**: Avoids unnecessary re-renders by propagating directly to the right level
|
|
148
|
-
|
|
148
|
+
4. **Flexibility**: Supports different referencing patterns (~~., ~., ~>) and arrays containing references
|
|
149
149
|
|
|
150
150
|
### Supported vs Unsupported Cases
|
|
151
151
|
|
|
152
|
-
####
|
|
152
|
+
#### Supported cases
|
|
153
153
|
|
|
154
|
-
#####
|
|
154
|
+
##### Direct reference
|
|
155
155
|
```yaml
|
|
156
156
|
dataOverride: ~~.user
|
|
157
157
|
# Modifications in the subroot propagate to "user" in the parent
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
#####
|
|
160
|
+
##### Object mapping with references
|
|
161
161
|
```yaml
|
|
162
162
|
dataOverride:
|
|
163
163
|
userInfo: ~~.user
|
|
@@ -166,19 +166,19 @@ renderView:
|
|
|
166
166
|
# Modifications to "settings" propagate to "config" in the parent
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
#####
|
|
169
|
+
##### Local references
|
|
170
170
|
```yaml
|
|
171
171
|
dataOverride: ~.localData
|
|
172
172
|
# Modifications propagate to the local template context
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
#####
|
|
175
|
+
##### Hierarchical references
|
|
176
176
|
```yaml
|
|
177
177
|
dataOverride: ~>key.someData
|
|
178
178
|
# Modifications propagate up the template hierarchy
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
#####
|
|
181
|
+
##### Arrays in dataOverride
|
|
182
182
|
```yaml
|
|
183
183
|
dataOverride:
|
|
184
184
|
- ~~.firstItem
|
|
@@ -186,7 +186,7 @@ renderView:
|
|
|
186
186
|
# Array items with template references are properly handled
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
####
|
|
189
|
+
#### Unsupported cases
|
|
190
190
|
|
|
191
191
|
##### Nested references in data
|
|
192
192
|
```yaml
|
|
@@ -212,7 +212,7 @@ renderView:
|
|
|
212
212
|
renderView:
|
|
213
213
|
- type: ReactiveJsonSubroot
|
|
214
214
|
rjOptions:
|
|
215
|
-
maybeRawAppRjBuild: '{"data":{"userName":"Alice","messageCount":3},"renderView":[{"type":"div","attributes":{"style":{"padding":"1rem","border":"1px solid #ddd","borderRadius":"8px"
|
|
215
|
+
maybeRawAppRjBuild: '{"data":{"userName":"Alice","messageCount":3},"renderView":[{"type":"div","attributes":{"style":{"padding":"1rem","border":"1px solid #ddd","borderRadius":"8px"}},"content":[{"type":"h3","content":"~~.userName"},{"type":"p","content":["You have ","~~.messageCount"," new messages."]},{"type":"button","content":"Mark as read","attributes":{"style":{"border":"1px solid #007bff","padding":"0.5rem 1rem","borderRadius":"4px"}}}]}]}'
|
|
216
216
|
|
|
217
217
|
- type: hr
|
|
218
218
|
|
|
@@ -240,7 +240,7 @@ renderView:
|
|
|
240
240
|
padding: "1rem"
|
|
241
241
|
border: "2px solid #007bff"
|
|
242
242
|
borderRadius: "8px"
|
|
243
|
-
|
|
243
|
+
|
|
244
244
|
marginBottom: "1rem"
|
|
245
245
|
content:
|
|
246
246
|
- type: h4
|
|
@@ -262,16 +262,34 @@ renderView:
|
|
|
262
262
|
padding: "1rem"
|
|
263
263
|
border: "2px solid #28a745"
|
|
264
264
|
borderRadius: "8px"
|
|
265
|
-
|
|
265
|
+
|
|
266
266
|
content:
|
|
267
267
|
- type: h4
|
|
268
268
|
content: "Subroot Editor (with sharedUpdates)"
|
|
269
|
-
- type:
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
269
|
+
- type: label
|
|
270
|
+
content: "Name"
|
|
271
|
+
- type: input
|
|
272
|
+
attributes:
|
|
273
|
+
type: text
|
|
274
|
+
value: ~.name
|
|
275
|
+
placeholder: "Name"
|
|
276
|
+
actions:
|
|
277
|
+
- what: setData
|
|
278
|
+
on: change
|
|
279
|
+
path: ~.name
|
|
280
|
+
value: "<reactive-json:event-new-value>"
|
|
281
|
+
- type: label
|
|
282
|
+
content: "Email"
|
|
283
|
+
- type: input
|
|
284
|
+
attributes:
|
|
285
|
+
type: email
|
|
286
|
+
value: ~.email
|
|
287
|
+
placeholder: "Email"
|
|
288
|
+
actions:
|
|
289
|
+
- what: setData
|
|
290
|
+
on: change
|
|
291
|
+
path: ~.email
|
|
292
|
+
value: "<reactive-json:event-new-value>"
|
|
275
293
|
- type: p
|
|
276
294
|
attributes:
|
|
277
295
|
style:
|
|
@@ -306,7 +324,7 @@ renderView:
|
|
|
306
324
|
padding: "1rem"
|
|
307
325
|
border: "1px solid #ddd"
|
|
308
326
|
borderRadius: "4px"
|
|
309
|
-
|
|
327
|
+
|
|
310
328
|
content:
|
|
311
329
|
- type: h5
|
|
312
330
|
content: "Profile Data"
|
|
@@ -320,7 +338,7 @@ renderView:
|
|
|
320
338
|
padding: "1rem"
|
|
321
339
|
border: "1px solid #ddd"
|
|
322
340
|
borderRadius: "4px"
|
|
323
|
-
|
|
341
|
+
|
|
324
342
|
content:
|
|
325
343
|
- type: h5
|
|
326
344
|
content: "Settings Data"
|
|
@@ -346,28 +364,64 @@ renderView:
|
|
|
346
364
|
padding: "1rem"
|
|
347
365
|
border: "2px solid #17a2b8"
|
|
348
366
|
borderRadius: "8px"
|
|
349
|
-
|
|
367
|
+
|
|
350
368
|
content:
|
|
351
369
|
- type: div
|
|
352
370
|
content:
|
|
353
371
|
- type: h5
|
|
354
372
|
content: "Edit Profile"
|
|
355
|
-
- type:
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
373
|
+
- type: label
|
|
374
|
+
content: "Name"
|
|
375
|
+
- type: input
|
|
376
|
+
attributes:
|
|
377
|
+
type: text
|
|
378
|
+
value: ~.userProfile.name
|
|
379
|
+
placeholder: "Name"
|
|
380
|
+
actions:
|
|
381
|
+
- what: setData
|
|
382
|
+
on: change
|
|
383
|
+
path: ~.userProfile.name
|
|
384
|
+
value: "<reactive-json:event-new-value>"
|
|
385
|
+
- type: label
|
|
386
|
+
content: "Age"
|
|
387
|
+
- type: input
|
|
388
|
+
attributes:
|
|
389
|
+
type: number
|
|
390
|
+
value: ~.userProfile.age
|
|
391
|
+
placeholder: "Age"
|
|
392
|
+
actions:
|
|
393
|
+
- what: setData
|
|
394
|
+
on: change
|
|
395
|
+
path: ~.userProfile.age
|
|
396
|
+
value: "<reactive-json:event-new-value>"
|
|
361
397
|
- type: div
|
|
362
398
|
content:
|
|
363
399
|
- type: h5
|
|
364
400
|
content: "Edit Settings"
|
|
365
|
-
- type:
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
401
|
+
- type: label
|
|
402
|
+
content: "Theme"
|
|
403
|
+
- type: input
|
|
404
|
+
attributes:
|
|
405
|
+
type: text
|
|
406
|
+
value: ~.userSettings.theme
|
|
407
|
+
placeholder: "Theme"
|
|
408
|
+
actions:
|
|
409
|
+
- what: setData
|
|
410
|
+
on: change
|
|
411
|
+
path: ~.userSettings.theme
|
|
412
|
+
value: "<reactive-json:event-new-value>"
|
|
413
|
+
- type: label
|
|
414
|
+
content: "Language"
|
|
415
|
+
- type: input
|
|
416
|
+
attributes:
|
|
417
|
+
type: text
|
|
418
|
+
value: ~.userSettings.language
|
|
419
|
+
placeholder: "Language"
|
|
420
|
+
actions:
|
|
421
|
+
- what: setData
|
|
422
|
+
on: change
|
|
423
|
+
path: ~.userSettings.language
|
|
424
|
+
value: "<reactive-json:event-new-value>"
|
|
371
425
|
|
|
372
426
|
- type: RjBuildDescriber
|
|
373
427
|
title: Example with Array References
|
|
@@ -386,15 +440,46 @@ renderView:
|
|
|
386
440
|
padding: "1rem"
|
|
387
441
|
border: "1px solid #ddd"
|
|
388
442
|
borderRadius: "4px"
|
|
389
|
-
backgroundColor: "#f9f9f9"
|
|
390
443
|
marginBottom: "1rem"
|
|
391
444
|
content:
|
|
392
445
|
- type: h4
|
|
393
446
|
content: "Parent Items Display"
|
|
394
447
|
- type: p
|
|
395
|
-
content:
|
|
396
|
-
|
|
397
|
-
|
|
448
|
+
content:
|
|
449
|
+
- "Item 1: "
|
|
450
|
+
- ~~.items.0.title
|
|
451
|
+
- " (completed: "
|
|
452
|
+
- type: span
|
|
453
|
+
content: "Yes"
|
|
454
|
+
actions:
|
|
455
|
+
- what: hide
|
|
456
|
+
when: ~~.items.0.completed
|
|
457
|
+
is: false
|
|
458
|
+
- type: span
|
|
459
|
+
content: "No"
|
|
460
|
+
actions:
|
|
461
|
+
- what: hide
|
|
462
|
+
when: ~~.items.0.completed
|
|
463
|
+
is: true
|
|
464
|
+
- ")"
|
|
465
|
+
- type: p
|
|
466
|
+
content:
|
|
467
|
+
- "Item 2: "
|
|
468
|
+
- ~~.items.1.title
|
|
469
|
+
- " (completed: "
|
|
470
|
+
- type: span
|
|
471
|
+
content: "Yes"
|
|
472
|
+
actions:
|
|
473
|
+
- what: hide
|
|
474
|
+
when: ~~.items.1.completed
|
|
475
|
+
is: false
|
|
476
|
+
- type: span
|
|
477
|
+
content: "No"
|
|
478
|
+
actions:
|
|
479
|
+
- what: hide
|
|
480
|
+
when: ~~.items.1.completed
|
|
481
|
+
is: true
|
|
482
|
+
- ")"
|
|
398
483
|
|
|
399
484
|
- type: ReactiveJsonSubroot
|
|
400
485
|
sharedUpdates: true
|
|
@@ -410,7 +495,6 @@ renderView:
|
|
|
410
495
|
padding: "1rem"
|
|
411
496
|
border: "2px solid #ffc107"
|
|
412
497
|
borderRadius: "8px"
|
|
413
|
-
backgroundColor: "#fff3cd"
|
|
414
498
|
content:
|
|
415
499
|
- type: h4
|
|
416
500
|
content: "Array Items Editor"
|
|
@@ -418,22 +502,56 @@ renderView:
|
|
|
418
502
|
content:
|
|
419
503
|
- type: h5
|
|
420
504
|
content: "First Item"
|
|
421
|
-
- type:
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
505
|
+
- type: label
|
|
506
|
+
content: "Title"
|
|
507
|
+
- type: input
|
|
508
|
+
attributes:
|
|
509
|
+
type: text
|
|
510
|
+
value: ~.0.title
|
|
511
|
+
placeholder: "Title"
|
|
512
|
+
actions:
|
|
513
|
+
- what: setData
|
|
514
|
+
on: change
|
|
515
|
+
path: ~.0.title
|
|
516
|
+
value: "<reactive-json:event-new-value>"
|
|
517
|
+
- type: label
|
|
518
|
+
content: "Completed"
|
|
519
|
+
- type: input
|
|
520
|
+
attributes:
|
|
521
|
+
type: checkbox
|
|
522
|
+
checked: ~.0.completed
|
|
523
|
+
actions:
|
|
524
|
+
- what: setData
|
|
525
|
+
on: change
|
|
526
|
+
path: ~.0.completed
|
|
527
|
+
value: "<reactive-json:event-new-value>"
|
|
427
528
|
- type: div
|
|
428
529
|
content:
|
|
429
530
|
- type: h5
|
|
430
531
|
content: "Second Item"
|
|
431
|
-
- type:
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
532
|
+
- type: label
|
|
533
|
+
content: "Title"
|
|
534
|
+
- type: input
|
|
535
|
+
attributes:
|
|
536
|
+
type: text
|
|
537
|
+
value: ~.1.title
|
|
538
|
+
placeholder: "Title"
|
|
539
|
+
actions:
|
|
540
|
+
- what: setData
|
|
541
|
+
on: change
|
|
542
|
+
path: ~.1.title
|
|
543
|
+
value: "<reactive-json:event-new-value>"
|
|
544
|
+
- type: label
|
|
545
|
+
content: "Completed"
|
|
546
|
+
- type: input
|
|
547
|
+
attributes:
|
|
548
|
+
type: checkbox
|
|
549
|
+
checked: ~.1.completed
|
|
550
|
+
actions:
|
|
551
|
+
- what: setData
|
|
552
|
+
on: change
|
|
553
|
+
path: ~.1.completed
|
|
554
|
+
value: "<reactive-json:event-new-value>"
|
|
437
555
|
|
|
438
556
|
- type: Markdown
|
|
439
557
|
content: |
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
# Switch
|
|
2
2
|
|
|
3
|
-
## Introduction
|
|
4
|
-
|
|
5
3
|
The `Switch` component allows you to render a list or collection of items using a template, with support for dynamic data, options, and pagination. It is useful for displaying arrays, lists, or collections where each item can be rendered with a specific template or configuration.
|
|
6
4
|
|
|
7
5
|
## Properties
|
|
8
|
-
- `content` (array/object, required): The data or path to the data to iterate over
|
|
9
|
-
- `options` (object, optional): Mapping of keys to templates for rendering each item (referenced by `load`)
|
|
10
|
-
- `singleOption` (object, optional): Template to use for each item when all items share the same structure (referenced by `load`)
|
|
11
|
-
- `cardinality` (number, optional): Maximum number of items to render (default: unlimited)
|
|
12
|
-
- `paginated` (boolean, optional): Whether to enable pagination (default: false)
|
|
13
|
-
- `paginationProps` (object, optional): Pagination configuration (page size, etc.)
|
|
14
|
-
- `before` (object, optional): Content to render before the list
|
|
15
|
-
- `after` (object, optional): Content to render after the list
|
|
16
|
-
- `contentWrapper` (object, optional): HTML element configuration to wrap the main content (items only, not before/after)
|
|
17
|
-
- `tag` (string, optional): HTML tag name (default: "div")
|
|
18
|
-
- `attributes` (object, optional): HTML attributes to apply to the wrapper element (supports template evaluation)
|
|
19
|
-
- `templates` (object, optional): Named templates referenced by `load` in `singleOption` or `options
|
|
6
|
+
- `content` (array/object, required): The data or path to the data to iterate over.
|
|
7
|
+
- `options` (object, optional): Mapping of keys to templates for rendering each item (referenced by `load`).
|
|
8
|
+
- `singleOption` (object, optional): Template to use for each item when all items share the same structure (referenced by `load`).
|
|
9
|
+
- `cardinality` (number, optional): Maximum number of items to render (default: unlimited).
|
|
10
|
+
- `paginated` (boolean, optional): Whether to enable pagination (default: false).
|
|
11
|
+
- `paginationProps` (object, optional): Pagination configuration (page size, etc.).
|
|
12
|
+
- `before` (object, optional): Content to render before the list.
|
|
13
|
+
- `after` (object, optional): Content to render after the list.
|
|
14
|
+
- `contentWrapper` (object, optional): HTML element configuration to wrap the main content (items only, not before/after).
|
|
15
|
+
- `tag` (string, optional): HTML tag name (default: "div").
|
|
16
|
+
- `attributes` (object, optional): HTML attributes to apply to the wrapper element (supports template evaluation).
|
|
17
|
+
- `templates` (object, optional): Named templates referenced by `load` in `singleOption` or `options`.
|
|
20
18
|
|
|
21
19
|
## Behavior
|
|
22
|
-
- Iterates over the provided data and renders each item using the specified template(s)
|
|
23
|
-
- If `options` is provided, uses the corresponding template for each key (with `load`)
|
|
24
|
-
- If `singleOption` is provided, uses the template referenced by `load` for all items
|
|
25
|
-
- Supports limiting the number of items with `cardinality
|
|
26
|
-
- Supports pagination if `paginated` is true
|
|
27
|
-
- Renders optional `before` and `after` content
|
|
28
|
-
- Can wrap the main content (items) with a custom HTML element using `contentWrapper
|
|
29
|
-
- Templates are defined in the `templates` object and referenced by name
|
|
20
|
+
- Iterates over the provided data and renders each item using the specified template(s).
|
|
21
|
+
- If `options` is provided, uses the corresponding template for each key (with `load`).
|
|
22
|
+
- If `singleOption` is provided, uses the template referenced by `load` for all items.
|
|
23
|
+
- Supports limiting the number of items with `cardinality`.
|
|
24
|
+
- Supports pagination if `paginated` is true.
|
|
25
|
+
- Renders optional `before` and `after` content.
|
|
26
|
+
- Can wrap the main content (items) with a custom HTML element using `contentWrapper`.
|
|
27
|
+
- Templates are defined in the `templates` object and referenced by name.
|
|
30
28
|
|
|
31
29
|
## Content Wrapper Feature
|
|
32
30
|
|
|
@@ -46,7 +44,7 @@ The wrapper only affects the main content items and does not interfere with pagi
|
|
|
46
44
|
|
|
47
45
|
## Examples
|
|
48
46
|
|
|
49
|
-
###
|
|
47
|
+
### Simple usage with `singleOption` (no pagination)
|
|
50
48
|
```yaml
|
|
51
49
|
renderView:
|
|
52
50
|
- type: Switch
|
|
@@ -65,7 +63,7 @@ data:
|
|
|
65
63
|
- name: "Charlie"
|
|
66
64
|
```
|
|
67
65
|
|
|
68
|
-
###
|
|
66
|
+
### Usage with `options` (different templates per key)
|
|
69
67
|
```yaml
|
|
70
68
|
renderView:
|
|
71
69
|
- type: Switch
|
|
@@ -94,7 +92,7 @@ data:
|
|
|
94
92
|
value: 25
|
|
95
93
|
```
|
|
96
94
|
|
|
97
|
-
###
|
|
95
|
+
### Usage with `singleOption`, pagination, before/after, and PageControls
|
|
98
96
|
```yaml
|
|
99
97
|
renderView:
|
|
100
98
|
- type: Switch
|
|
@@ -127,7 +125,7 @@ data:
|
|
|
127
125
|
- value: 10
|
|
128
126
|
```
|
|
129
127
|
|
|
130
|
-
###
|
|
128
|
+
### Usage with `contentWrapper` for CSS Grid Layout
|
|
131
129
|
```yaml
|
|
132
130
|
renderView:
|
|
133
131
|
- type: Switch
|
|
@@ -150,7 +148,7 @@ renderView:
|
|
|
150
148
|
type: div
|
|
151
149
|
attributes:
|
|
152
150
|
style:
|
|
153
|
-
border: "1px solid
|
|
151
|
+
border: "1px solid currentColor"
|
|
154
152
|
borderRadius: 8px
|
|
155
153
|
padding: 1rem
|
|
156
154
|
content:
|
|
@@ -168,7 +166,7 @@ data:
|
|
|
168
166
|
description: "Description of product C"
|
|
169
167
|
```
|
|
170
168
|
|
|
171
|
-
###
|
|
169
|
+
### Usage with `contentWrapper` for Flexbox Layout
|
|
172
170
|
```yaml
|
|
173
171
|
renderView:
|
|
174
172
|
- type: Switch
|
|
@@ -192,7 +190,7 @@ renderView:
|
|
|
192
190
|
flex: "1 1 200px"
|
|
193
191
|
margin: 0.5rem
|
|
194
192
|
padding: 1rem
|
|
195
|
-
|
|
193
|
+
border: "1px solid currentColor"
|
|
196
194
|
content: ~.text
|
|
197
195
|
data:
|
|
198
196
|
items:
|
|
@@ -201,7 +199,7 @@ data:
|
|
|
201
199
|
- text: "Item 3"
|
|
202
200
|
```
|
|
203
201
|
|
|
204
|
-
###
|
|
202
|
+
### Dynamic `contentWrapper` with Template Evaluation
|
|
205
203
|
```yaml
|
|
206
204
|
renderView:
|
|
207
205
|
- type: Switch
|
|
@@ -216,21 +214,21 @@ renderView:
|
|
|
216
214
|
display: grid
|
|
217
215
|
gridTemplateColumns: ~.gridColumns
|
|
218
216
|
gap: ~.spacing
|
|
219
|
-
|
|
217
|
+
border: ~.theme.border
|
|
220
218
|
templates:
|
|
221
219
|
imageItem:
|
|
222
220
|
type: div
|
|
223
221
|
attributes:
|
|
224
222
|
style:
|
|
225
223
|
padding: 1rem
|
|
226
|
-
border: "1px solid
|
|
224
|
+
border: "1px solid currentColor"
|
|
227
225
|
content: ~.title
|
|
228
226
|
data:
|
|
229
227
|
layoutClass: "photo-gallery"
|
|
230
228
|
gridColumns: "repeat(3, 1fr)"
|
|
231
229
|
spacing: "2rem"
|
|
232
230
|
theme:
|
|
233
|
-
|
|
231
|
+
border: "1px solid currentColor"
|
|
234
232
|
galleries:
|
|
235
233
|
- title: "Photo 1"
|
|
236
234
|
- title: "Photo 2"
|
|
@@ -238,11 +236,11 @@ data:
|
|
|
238
236
|
```
|
|
239
237
|
|
|
240
238
|
## Limitations
|
|
241
|
-
- The data must be an array or object; strings and numbers are not supported
|
|
242
|
-
- If both `options` and `singleOption` are provided, `singleOption` takes precedence
|
|
243
|
-
- No built-in support for filtering or sorting (use DataFilter or custom logic)
|
|
244
|
-
- Pagination requires the `paginated` property to be set to true
|
|
245
|
-
- Templates must be defined in the `templates` object and referenced by `load
|
|
239
|
+
- The data must be an array or object; strings and numbers are not supported.
|
|
240
|
+
- If both `options` and `singleOption` are provided, `singleOption` takes precedence.
|
|
241
|
+
- No built-in support for filtering or sorting (use DataFilter or custom logic).
|
|
242
|
+
- Pagination requires the `paginated` property to be set to true.
|
|
243
|
+
- Templates must be defined in the `templates` object and referenced by `load`.
|
|
246
244
|
|
|
247
245
|
### Data Structure Requirements
|
|
248
246
|
Switch requires each item in the data to be an object, not a primitive value:
|