@ea-lab/reactive-json-docs 0.3.0 → 0.5.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 +2 -2
- package/public/rjbuild/docs/advanced-concepts/data-mapping.md +76 -0
- package/public/rjbuild/docs/advanced-concepts/data-mapping.yaml +140 -0
- package/public/rjbuild/docs/advanced-concepts/data-processors.md +373 -0
- package/public/rjbuild/docs/advanced-concepts/data-processors.yaml +309 -0
- package/public/rjbuild/docs/advanced-concepts/index.md +10 -0
- package/public/rjbuild/docs/advanced-concepts/index.yaml +16 -0
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development-guide-llm.md +2 -0
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.md +1 -1
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/component-development.yaml +1 -1
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/plugin-system.md +2 -0
- package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/plugin-system.yaml +2 -0
- package/public/rjbuild/docs/core/action/Hide.md +1 -1
- package/public/rjbuild/docs/core/action/Hide.yaml +10 -10
- package/public/rjbuild/docs/core/action/ReactOnEvent.md +12 -12
- package/public/rjbuild/docs/core/action/ReactOnEvent.yaml +61 -101
- package/public/rjbuild/docs/core/action/Redirect.md +10 -2
- package/public/rjbuild/docs/core/action/Redirect.yaml +18 -51
- package/public/rjbuild/docs/core/action/VisuallyHide.yaml +10 -12
- package/public/rjbuild/docs/core/action/index.md +19 -204
- package/public/rjbuild/docs/core/action/index.yaml +19 -264
- package/public/rjbuild/docs/core/dataMapping/index.md +31 -0
- package/public/rjbuild/docs/core/dataMapping/index.yaml +24 -0
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.md +131 -0
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +376 -0
- package/public/rjbuild/docs/core/element/form/DateField.md +1 -1
- package/public/rjbuild/docs/core/element/form/DateField.yaml +4 -4
- package/public/rjbuild/docs/core/element/form/SelectField.yaml +2 -2
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +4 -3
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +114 -6
- package/public/rjbuild/docs/core/example/website.yaml +10 -10
- package/public/rjbuild/docs/core/reaction/index.md +17 -229
- package/public/rjbuild/docs/core/reaction/index.yaml +14 -242
- package/public/rjbuild/docs/core/reaction/setData.md +1 -1
- package/public/rjbuild/docs/core/reaction/setData.yaml +1 -1
- package/public/rjbuild/docs/docs-components/index.md +0 -2
- package/public/rjbuild/docs/docs-components/index.yaml +0 -2
- package/public/rjbuild/docs/getting-started/actions.md +294 -0
- package/public/rjbuild/docs/getting-started/actions.yaml +403 -0
- package/public/rjbuild/docs/{getting-started.md → getting-started/index.md} +30 -6
- package/public/rjbuild/docs/{getting-started.yaml → getting-started/index.yaml} +22 -6
- package/public/rjbuild/docs/getting-started/reactions.md +301 -0
- package/public/rjbuild/docs/getting-started/reactions.yaml +300 -0
- package/public/rjbuild/docs/getting-started/rjbuild-structure.md +358 -0
- package/public/rjbuild/docs/getting-started/rjbuild-structure.yaml +421 -0
- package/public/rjbuild/docs/{template.md → getting-started/template-contexts-data-binding.md} +16 -12
- package/public/rjbuild/docs/{template.yaml → getting-started/template-contexts-data-binding.yaml} +28 -14
- package/public/rjbuild/docs/install.yaml +682 -681
- /package/public/rjbuild/docs/{core/reaction → advanced-concepts}/forward-update.md +0 -0
- /package/public/rjbuild/docs/{core/reaction → advanced-concepts}/forward-update.yaml +0 -0
- /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.md +0 -0
- /package/public/rjbuild/docs/{extend → advanced-concepts/plugins}/index.yaml +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Data Mapping Components
|
|
2
|
+
|
|
3
|
+
Data mapping components process and transform HTTP response data to specific locations in your application state. These components work with `fetchData`, `submitData` reactions, and `additionalDataSources`.
|
|
4
|
+
|
|
5
|
+
## Core Data Mappers
|
|
6
|
+
|
|
7
|
+
### SimpleMapping
|
|
8
|
+
The foundational data mapper that provides string-based mappings for selective data dispatch.
|
|
9
|
+
|
|
10
|
+
- **Purpose**: Map HTTP response fields to application data paths
|
|
11
|
+
- **Configuration**: YAML-based string mappings with destination templates
|
|
12
|
+
- **Features**: Required fields, default values, error handling, update modes
|
|
13
|
+
- **Use Cases**: User profiles, settings, API data transformation
|
|
14
|
+
- **Documentation**: [SimpleMapping Guide](simpleMapping.md) | [Interactive Examples](simpleMapping)
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
Data mapping processes HTTP response data to selectively dispatch it to application state:
|
|
19
|
+
|
|
20
|
+
1. **HTTP Request** → Server responds with data
|
|
21
|
+
2. **Data Mapping** → Selectively dispatch response data to application state
|
|
22
|
+
3. **Application State** → Updated with mapped data
|
|
23
|
+
|
|
24
|
+
## Creating Custom Data Mappers
|
|
25
|
+
|
|
26
|
+
For information about creating custom data mappers and the broader Data Mapping system architecture, see the [Data Mapping Documentation](../../advanced-concepts/data-mapping).
|
|
27
|
+
|
|
28
|
+
## Related
|
|
29
|
+
|
|
30
|
+
- [Data Mapping System](../../advanced-concepts/data-mapping) - System overview and custom mappers
|
|
31
|
+
- [Plugin System](../../advanced-concepts/plugins/plugin-system) - Component architecture
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Data Mapping Components
|
|
5
|
+
|
|
6
|
+
Data mapping components process and transform HTTP response data to specific locations in your application state. These components work with `fetchData`, `submitData` reactions, and `additionalDataSources`.
|
|
7
|
+
|
|
8
|
+
## Core Data Mappers
|
|
9
|
+
|
|
10
|
+
### [SimpleMapping](simpleMapping)
|
|
11
|
+
The foundational data mapper that provides string-based mappings for selective data dispatch.
|
|
12
|
+
|
|
13
|
+
- **Purpose**: Map HTTP response fields to application data paths
|
|
14
|
+
- **Configuration**: YAML-based string mappings with destination templates
|
|
15
|
+
- **Features**: Required fields, default values, error handling, update modes
|
|
16
|
+
- **Use Cases**: User profiles, settings, API data transformation
|
|
17
|
+
|
|
18
|
+
## Creating Custom Data Mappers
|
|
19
|
+
|
|
20
|
+
For information about creating custom data mappers and the broader Data Mapping system architecture, see the **[Data Mapping Documentation](../../advanced-concepts/data-mapping)**.
|
|
21
|
+
|
|
22
|
+
templates:
|
|
23
|
+
|
|
24
|
+
data:
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# SimpleMapping
|
|
2
|
+
|
|
3
|
+
SimpleMapping is the core data mapping processor in Reactive-JSON that enables selective dispatch and transformation of HTTP response data to specific locations in your application state. It provides a straightforward, configuration-driven approach to map response fields to application data paths.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### stringMap Configuration
|
|
8
|
+
|
|
9
|
+
- `value` (string, required): Source path in the HTTP response (e.g., `user.firstName`)
|
|
10
|
+
- `required` (boolean, optional, default: true): Whether the source value must exist
|
|
11
|
+
- `defaultValue` (any, optional): Fallback value when source is missing and not required
|
|
12
|
+
- `updateMode` (string, optional, default: "replace"): How to apply the value (`replace`, `add`, `move`, `remove`)
|
|
13
|
+
|
|
14
|
+
### onErrorMap Configuration
|
|
15
|
+
|
|
16
|
+
- `value` (string, required): Can be either static values (e.g., `Error occurred`) or template references (e.g., `~~.errorTimestamp`)
|
|
17
|
+
|
|
18
|
+
## Configuration Structure
|
|
19
|
+
|
|
20
|
+
The `onErrorMap` works like `stringMap`, but provides fallback values when main mappings fail. Same key-value structure as `stringMap` (destination → configuration). Applied only when corresponding `stringMap` entries fail and are marked as `required: true`.
|
|
21
|
+
|
|
22
|
+
## Basic Example
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
- what: fetchData
|
|
26
|
+
url: "/api/user-profile"
|
|
27
|
+
updateOnlyData: true
|
|
28
|
+
dataMapping:
|
|
29
|
+
simpleMapping:
|
|
30
|
+
stringMap:
|
|
31
|
+
"~~.currentUser.name":
|
|
32
|
+
value: "user.firstName"
|
|
33
|
+
"~~.currentUser.email":
|
|
34
|
+
value: "user.email"
|
|
35
|
+
"~~.settings.theme":
|
|
36
|
+
value: "user.preferences.theme"
|
|
37
|
+
required: false
|
|
38
|
+
defaultValue: "light"
|
|
39
|
+
|
|
40
|
+
data:
|
|
41
|
+
currentUser: {}
|
|
42
|
+
settings: {}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Error Handling Example
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
- what: fetchData
|
|
49
|
+
url: "/api/incomplete-data"
|
|
50
|
+
updateOnlyData: true
|
|
51
|
+
dataMapping:
|
|
52
|
+
simpleMapping:
|
|
53
|
+
stringMap:
|
|
54
|
+
"~~.profile.name":
|
|
55
|
+
value: "user.name"
|
|
56
|
+
required: true
|
|
57
|
+
"~~.profile.email":
|
|
58
|
+
value: "user.email"
|
|
59
|
+
required: true
|
|
60
|
+
onErrorMap:
|
|
61
|
+
"~~.profile.status":
|
|
62
|
+
value: "Error loading profile"
|
|
63
|
+
"~~.profile.name":
|
|
64
|
+
value: "Unknown User"
|
|
65
|
+
"~~.profile.email":
|
|
66
|
+
value: "unknown@example.com"
|
|
67
|
+
"~~.profile.loadedAt":
|
|
68
|
+
value: "~~.currentTimestamp"
|
|
69
|
+
|
|
70
|
+
data:
|
|
71
|
+
profile: {}
|
|
72
|
+
currentTimestamp: "2024-01-15T10:30:00Z"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Advanced Configuration
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
dataMapping:
|
|
79
|
+
simpleMapping:
|
|
80
|
+
stringMap:
|
|
81
|
+
"~~.order.id":
|
|
82
|
+
value: "order.id"
|
|
83
|
+
"~~.order.customerName":
|
|
84
|
+
value: "order.customer.name"
|
|
85
|
+
"~~.order.customerEmail":
|
|
86
|
+
value: "order.customer.contact.email"
|
|
87
|
+
"~~.order.total":
|
|
88
|
+
value: "order.billing.total"
|
|
89
|
+
"~~.order.currency":
|
|
90
|
+
value: "order.billing.currency"
|
|
91
|
+
required: false
|
|
92
|
+
defaultValue: "USD"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Integration with additionalDataSources
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
additionalDataSource:
|
|
99
|
+
- src: "/api/user-profile"
|
|
100
|
+
blocking: true
|
|
101
|
+
dataMapping:
|
|
102
|
+
simpleMapping:
|
|
103
|
+
stringMap:
|
|
104
|
+
"~~.profile.displayName":
|
|
105
|
+
value: "user.name"
|
|
106
|
+
"~~.profile.email":
|
|
107
|
+
value: "user.email"
|
|
108
|
+
"~~.settings.theme":
|
|
109
|
+
value: "user.preferences.theme"
|
|
110
|
+
required: false
|
|
111
|
+
defaultValue: "light"
|
|
112
|
+
|
|
113
|
+
data:
|
|
114
|
+
profile: {}
|
|
115
|
+
settings: {}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Usage Context
|
|
119
|
+
|
|
120
|
+
SimpleMapping is automatically available as part of the core Reactive-JSON plugins and can be used in:
|
|
121
|
+
|
|
122
|
+
- **fetchData reactions**: Process API responses selectively
|
|
123
|
+
- **submitData reactions**: Handle server responses after form submissions
|
|
124
|
+
- **additionalDataSources**: Map initial data loading responses
|
|
125
|
+
|
|
126
|
+
## Related
|
|
127
|
+
|
|
128
|
+
- [Data Mapping System Overview](../../advanced-concepts/data-mapping) - Complete system architecture and custom mappers
|
|
129
|
+
- [FetchData Reaction](../reaction/fetchData) - HTTP request handling with data mapping
|
|
130
|
+
- [SubmitData Reaction](../reaction/submitData) - Form submission with data mapping
|
|
131
|
+
- [Plugin System](../../advanced-concepts/plugins/plugin-system) - Component architecture
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# SimpleMapping Data Mapper
|
|
5
|
+
|
|
6
|
+
SimpleMapping is the core data mapping processor in Reactive-JSON that enables selective dispatch and transformation of HTTP response data to specific locations in your application state.
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
### stringMap Configuration
|
|
11
|
+
|
|
12
|
+
- type: DefinitionList
|
|
13
|
+
content:
|
|
14
|
+
- term:
|
|
15
|
+
code: value
|
|
16
|
+
after: " (required)"
|
|
17
|
+
details:
|
|
18
|
+
type: Markdown
|
|
19
|
+
content: |
|
|
20
|
+
Source path in the HTTP response (e.g., `user.firstName`)
|
|
21
|
+
- term:
|
|
22
|
+
code: required
|
|
23
|
+
after: " (optional, default: true)"
|
|
24
|
+
details:
|
|
25
|
+
type: Markdown
|
|
26
|
+
content: |
|
|
27
|
+
Whether the source value must exist
|
|
28
|
+
- term:
|
|
29
|
+
code: defaultValue
|
|
30
|
+
after: " (optional)"
|
|
31
|
+
details:
|
|
32
|
+
type: Markdown
|
|
33
|
+
content: |
|
|
34
|
+
Fallback value when source is missing and not required
|
|
35
|
+
- term:
|
|
36
|
+
code: updateMode
|
|
37
|
+
after: " (optional, default: \"replace\")"
|
|
38
|
+
details:
|
|
39
|
+
type: Markdown
|
|
40
|
+
content: |
|
|
41
|
+
How to apply the value (`"replace"`, `"add"`, `"move"`, `"remove"`)
|
|
42
|
+
|
|
43
|
+
- type: Markdown
|
|
44
|
+
content: |
|
|
45
|
+
### onErrorMap Configuration
|
|
46
|
+
|
|
47
|
+
The `onErrorMap` works like `stringMap`, but provides fallback values when main mappings fail.
|
|
48
|
+
|
|
49
|
+
Same key-value structure as `stringMap` (destination → configuration)
|
|
50
|
+
Applied only when corresponding `stringMap` entries fail and are marked as `required: true`.
|
|
51
|
+
|
|
52
|
+
- type: DefinitionList
|
|
53
|
+
content:
|
|
54
|
+
- term:
|
|
55
|
+
code: value
|
|
56
|
+
after: " (required)"
|
|
57
|
+
details:
|
|
58
|
+
type: Markdown
|
|
59
|
+
content: |
|
|
60
|
+
Can be either static values (e.g., `Error occurred`) or template references (e.g., `~~.errorTimestamp`)
|
|
61
|
+
|
|
62
|
+
- type: Markdown
|
|
63
|
+
content: |
|
|
64
|
+
## Basic Syntax
|
|
65
|
+
|
|
66
|
+
- type: TabbedSerializer
|
|
67
|
+
yamlSerializedContent: |
|
|
68
|
+
dataMapping:
|
|
69
|
+
simpleMapping:
|
|
70
|
+
stringMap:
|
|
71
|
+
"~~.app.data.path":
|
|
72
|
+
value: "response.data.path"
|
|
73
|
+
required: true
|
|
74
|
+
defaultValue: "fallback"
|
|
75
|
+
updateMode: "replace"
|
|
76
|
+
onErrorMap:
|
|
77
|
+
"~~.error.path":
|
|
78
|
+
value: "Error message or ~~.template.reference"
|
|
79
|
+
|
|
80
|
+
- type: Markdown
|
|
81
|
+
content: |
|
|
82
|
+
## Live Example
|
|
83
|
+
|
|
84
|
+
- type: RjBuildDescriber
|
|
85
|
+
title: "Basic Data Mapping Example"
|
|
86
|
+
description:
|
|
87
|
+
- type: Markdown
|
|
88
|
+
content: |
|
|
89
|
+
This example demonstrates how to map API response fields to specific locations in your application state using the simpleMapping processor.
|
|
90
|
+
toDescribe:
|
|
91
|
+
renderView:
|
|
92
|
+
- type: div
|
|
93
|
+
attributes:
|
|
94
|
+
class: "mb-4"
|
|
95
|
+
content:
|
|
96
|
+
- type: Markdown
|
|
97
|
+
content: "**Simulated API Response:**"
|
|
98
|
+
- type: TabbedSerializer
|
|
99
|
+
yamlSerializedContent: |
|
|
100
|
+
user:
|
|
101
|
+
firstName: "John"
|
|
102
|
+
lastName: "Doe"
|
|
103
|
+
email: "john@example.com"
|
|
104
|
+
preferences:
|
|
105
|
+
theme: "dark"
|
|
106
|
+
language: "en"
|
|
107
|
+
notifications: true
|
|
108
|
+
profile:
|
|
109
|
+
avatar: "/images/john-avatar.png"
|
|
110
|
+
bio: "Software developer passionate about React and data processing"
|
|
111
|
+
metadata:
|
|
112
|
+
requestId: "req_12345"
|
|
113
|
+
timestamp: "2024-01-15T10:30:00Z"
|
|
114
|
+
version: "v1.2.3"
|
|
115
|
+
status: "success"
|
|
116
|
+
|
|
117
|
+
- type: BsButton
|
|
118
|
+
content: "Simulate API Call with Data Mapping"
|
|
119
|
+
attributes:
|
|
120
|
+
class: "btn btn-primary mb-3"
|
|
121
|
+
actions:
|
|
122
|
+
- what: fetchData
|
|
123
|
+
on: click
|
|
124
|
+
url: "/mockup-api/fetchData/data-mapping-example.json"
|
|
125
|
+
updateOnlyData: true
|
|
126
|
+
dataMapping:
|
|
127
|
+
simpleMapping:
|
|
128
|
+
stringMap:
|
|
129
|
+
"~~.profile.displayName":
|
|
130
|
+
value: "user.firstName"
|
|
131
|
+
"~~.profile.email":
|
|
132
|
+
value: "user.email"
|
|
133
|
+
"~~.settings.theme":
|
|
134
|
+
value: "user.preferences.theme"
|
|
135
|
+
required: false
|
|
136
|
+
defaultValue: "light"
|
|
137
|
+
"~~.settings.language":
|
|
138
|
+
value: "user.preferences.language"
|
|
139
|
+
required: false
|
|
140
|
+
defaultValue: "en"
|
|
141
|
+
"~~.profile.fullName":
|
|
142
|
+
value: "user.fullName"
|
|
143
|
+
required: false
|
|
144
|
+
defaultValue: "Anonymous User"
|
|
145
|
+
|
|
146
|
+
- type: Markdown
|
|
147
|
+
content: |
|
|
148
|
+
**Current Application State (after mapping):**
|
|
149
|
+
|
|
150
|
+
- type: div
|
|
151
|
+
attributes:
|
|
152
|
+
class: "card mb-3"
|
|
153
|
+
content:
|
|
154
|
+
- type: div
|
|
155
|
+
attributes:
|
|
156
|
+
class: "card-header"
|
|
157
|
+
content: "Profile Data"
|
|
158
|
+
- type: div
|
|
159
|
+
attributes:
|
|
160
|
+
class: "card-body"
|
|
161
|
+
content:
|
|
162
|
+
- type: p
|
|
163
|
+
content:
|
|
164
|
+
- "Display Name: "
|
|
165
|
+
- type: strong
|
|
166
|
+
content: ~~.profile.displayName
|
|
167
|
+
- type: p
|
|
168
|
+
content:
|
|
169
|
+
- "Email: "
|
|
170
|
+
- type: strong
|
|
171
|
+
content: ~~.profile.email
|
|
172
|
+
- type: p
|
|
173
|
+
content:
|
|
174
|
+
- "Full Name: "
|
|
175
|
+
- type: strong
|
|
176
|
+
content: ~~.profile.fullName
|
|
177
|
+
|
|
178
|
+
- type: div
|
|
179
|
+
attributes:
|
|
180
|
+
class: "card"
|
|
181
|
+
content:
|
|
182
|
+
- type: div
|
|
183
|
+
attributes:
|
|
184
|
+
class: "card-header"
|
|
185
|
+
content: "Settings Data"
|
|
186
|
+
- type: div
|
|
187
|
+
attributes:
|
|
188
|
+
class: "card-body"
|
|
189
|
+
content:
|
|
190
|
+
- type: p
|
|
191
|
+
content:
|
|
192
|
+
- "Theme: "
|
|
193
|
+
- type: span
|
|
194
|
+
attributes:
|
|
195
|
+
class: "badge bg-primary"
|
|
196
|
+
content: ~~.settings.theme
|
|
197
|
+
- type: p
|
|
198
|
+
content:
|
|
199
|
+
- "Language: "
|
|
200
|
+
- type: span
|
|
201
|
+
attributes:
|
|
202
|
+
class: "badge bg-secondary"
|
|
203
|
+
content: ~~.settings.language
|
|
204
|
+
|
|
205
|
+
data:
|
|
206
|
+
profile: {}
|
|
207
|
+
settings: {}
|
|
208
|
+
|
|
209
|
+
- type: RjBuildDescriber
|
|
210
|
+
title: "Error Handling with onErrorMap"
|
|
211
|
+
description:
|
|
212
|
+
- type: Markdown
|
|
213
|
+
content: |
|
|
214
|
+
This example shows how to provide fallback values when required data fields are missing from the API response, demonstrating graceful error handling.
|
|
215
|
+
toDescribe:
|
|
216
|
+
renderView:
|
|
217
|
+
- type: div
|
|
218
|
+
attributes:
|
|
219
|
+
class: "mb-3"
|
|
220
|
+
content:
|
|
221
|
+
- type: Markdown
|
|
222
|
+
content: |
|
|
223
|
+
**API Response (missing user data):**
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"status": "ok",
|
|
227
|
+
"timestamp": "2024-06-01T12:00:00Z"
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The mapping below tries to extract `user.name` and `user.email` which don't exist in this response, triggering the `onErrorMap` fallback values.
|
|
232
|
+
|
|
233
|
+
- type: BsButton
|
|
234
|
+
content: "Test Missing Data Handling"
|
|
235
|
+
attributes:
|
|
236
|
+
class: "btn btn-warning mb-3"
|
|
237
|
+
actions:
|
|
238
|
+
- what: fetchData
|
|
239
|
+
on: click
|
|
240
|
+
url: "/mockup-api/fetchData/status.json"
|
|
241
|
+
updateOnlyData: true
|
|
242
|
+
dataMapping:
|
|
243
|
+
simpleMapping:
|
|
244
|
+
stringMap:
|
|
245
|
+
"~~.profile.name":
|
|
246
|
+
value: "user.name"
|
|
247
|
+
required: true
|
|
248
|
+
"~~.profile.email":
|
|
249
|
+
value: "user.email"
|
|
250
|
+
required: true
|
|
251
|
+
"~~.profile.department":
|
|
252
|
+
value: "user.department"
|
|
253
|
+
required: false
|
|
254
|
+
defaultValue: "No department"
|
|
255
|
+
onErrorMap:
|
|
256
|
+
"~~.profile.status":
|
|
257
|
+
value: "Error loading profile"
|
|
258
|
+
"~~.profile.name":
|
|
259
|
+
value: "Unknown User"
|
|
260
|
+
"~~.profile.email":
|
|
261
|
+
value: "unknown@example.com"
|
|
262
|
+
"~~.profile.loadedAt":
|
|
263
|
+
value: "~~.currentTimestamp"
|
|
264
|
+
|
|
265
|
+
- type: Markdown
|
|
266
|
+
content: |
|
|
267
|
+
**Profile State (after error handling):**
|
|
268
|
+
|
|
269
|
+
- type: div
|
|
270
|
+
attributes:
|
|
271
|
+
class: "card"
|
|
272
|
+
content:
|
|
273
|
+
- type: div
|
|
274
|
+
attributes:
|
|
275
|
+
class: "card-header"
|
|
276
|
+
content: "Profile Data"
|
|
277
|
+
- type: div
|
|
278
|
+
attributes:
|
|
279
|
+
class: "card-body"
|
|
280
|
+
content:
|
|
281
|
+
- type: p
|
|
282
|
+
content:
|
|
283
|
+
- "Status: "
|
|
284
|
+
- type: span
|
|
285
|
+
attributes:
|
|
286
|
+
class: "badge bg-warning"
|
|
287
|
+
content: ~~.profile.status
|
|
288
|
+
- type: p
|
|
289
|
+
content:
|
|
290
|
+
- "Name: "
|
|
291
|
+
- type: strong
|
|
292
|
+
content: ~~.profile.name
|
|
293
|
+
- type: p
|
|
294
|
+
content:
|
|
295
|
+
- "Email: "
|
|
296
|
+
- type: strong
|
|
297
|
+
content: ~~.profile.email
|
|
298
|
+
- type: p
|
|
299
|
+
content:
|
|
300
|
+
- "Loaded At: "
|
|
301
|
+
- type: em
|
|
302
|
+
content: ~~.profile.loadedAt
|
|
303
|
+
|
|
304
|
+
data:
|
|
305
|
+
profile: {}
|
|
306
|
+
currentTimestamp: "2024-01-15T10:30:00Z"
|
|
307
|
+
|
|
308
|
+
- type: Markdown
|
|
309
|
+
content: |
|
|
310
|
+
## Advanced Configuration Examples
|
|
311
|
+
|
|
312
|
+
### Complex Data Structure Mapping
|
|
313
|
+
|
|
314
|
+
- type: TabbedSerializer
|
|
315
|
+
yamlSerializedContent: |
|
|
316
|
+
dataMapping:
|
|
317
|
+
simpleMapping:
|
|
318
|
+
stringMap:
|
|
319
|
+
"~~.currentOrder.id":
|
|
320
|
+
value: "order.id"
|
|
321
|
+
"~~.currentOrder.customerName":
|
|
322
|
+
value: "order.customer.name"
|
|
323
|
+
"~~.currentOrder.customerEmail":
|
|
324
|
+
value: "order.customer.contact.email"
|
|
325
|
+
"~~.currentOrder.total":
|
|
326
|
+
value: "order.billing.total"
|
|
327
|
+
"~~.currentOrder.currency":
|
|
328
|
+
value: "order.billing.currency"
|
|
329
|
+
required: false
|
|
330
|
+
defaultValue: "USD"
|
|
331
|
+
|
|
332
|
+
- type: Markdown
|
|
333
|
+
content: |
|
|
334
|
+
### Integration with additionalDataSources
|
|
335
|
+
|
|
336
|
+
- type: TabbedSerializer
|
|
337
|
+
yamlSerializedContent: |
|
|
338
|
+
additionalDataSource:
|
|
339
|
+
- src: "/api/user-profile"
|
|
340
|
+
blocking: true
|
|
341
|
+
dataMapping:
|
|
342
|
+
simpleMapping:
|
|
343
|
+
stringMap:
|
|
344
|
+
"~~.profile.displayName": { value: "user.name" }
|
|
345
|
+
"~~.profile.email": { value: "user.email" }
|
|
346
|
+
"~~.settings.theme":
|
|
347
|
+
value: "user.preferences.theme"
|
|
348
|
+
required: false
|
|
349
|
+
defaultValue: "light"
|
|
350
|
+
|
|
351
|
+
- type: Markdown
|
|
352
|
+
content: |
|
|
353
|
+
### Integration with Template Context
|
|
354
|
+
|
|
355
|
+
- type: TabbedSerializer
|
|
356
|
+
yamlSerializedContent: |
|
|
357
|
+
dataMapping:
|
|
358
|
+
simpleMapping:
|
|
359
|
+
stringMap:
|
|
360
|
+
"~~.pagination.currentPage":
|
|
361
|
+
value: "meta.page"
|
|
362
|
+
required: false
|
|
363
|
+
defaultValue: "~~.pagination.page" # Use current page as default
|
|
364
|
+
|
|
365
|
+
- type: Markdown
|
|
366
|
+
content: |
|
|
367
|
+
## About the Data Mapping System
|
|
368
|
+
|
|
369
|
+
For information about the broader Data Mapping system and how to create custom mappers, see the **[Data Mapping Overview](../../advanced-concepts/data-mapping)**.
|
|
370
|
+
|
|
371
|
+
templates:
|
|
372
|
+
|
|
373
|
+
data:
|
|
374
|
+
profile: {}
|
|
375
|
+
settings: {}
|
|
376
|
+
currentTimestamp: "2024-01-15T10:30:00Z"
|
|
@@ -124,13 +124,13 @@ renderView:
|
|
|
124
124
|
actions:
|
|
125
125
|
- what: hide
|
|
126
126
|
when: ~.startDate
|
|
127
|
-
|
|
127
|
+
isNotEmpty:
|
|
128
128
|
- what: hide
|
|
129
129
|
when: ~.endDate
|
|
130
|
-
|
|
130
|
+
isNotEmpty:
|
|
131
131
|
- what: hide
|
|
132
132
|
when: ~.reminderDate
|
|
133
|
-
|
|
133
|
+
isNotEmpty:
|
|
134
134
|
data:
|
|
135
135
|
startDate: null
|
|
136
136
|
endDate: null
|
|
@@ -176,7 +176,7 @@ renderView:
|
|
|
176
176
|
path: ~.message
|
|
177
177
|
value: "✓ Meeting date is set!"
|
|
178
178
|
when: ~.meetingDate
|
|
179
|
-
|
|
179
|
+
isNotEmpty:
|
|
180
180
|
- what: setData
|
|
181
181
|
on: click
|
|
182
182
|
path: ~.message
|
|
@@ -275,7 +275,7 @@ renderView:
|
|
|
275
275
|
actions:
|
|
276
276
|
- what: hide
|
|
277
277
|
when: ~.category
|
|
278
|
-
|
|
278
|
+
isNotEmpty:
|
|
279
279
|
- type: span
|
|
280
280
|
content: "✗ not empty"
|
|
281
281
|
attributes:
|
|
@@ -311,7 +311,7 @@ renderView:
|
|
|
311
311
|
actions:
|
|
312
312
|
- what: hide
|
|
313
313
|
when: ~.description
|
|
314
|
-
|
|
314
|
+
isNotEmpty:
|
|
315
315
|
- ")"
|
|
316
316
|
data:
|
|
317
317
|
category: ""
|
|
@@ -18,9 +18,10 @@ With the `sharedUpdates` feature, the component can also propagate data changes
|
|
|
18
18
|
- `data`: Initial data.
|
|
19
19
|
- `debugMode`: Enable debug mode and related wrapper components.
|
|
20
20
|
- `sharedUpdates` (boolean, optional): Enable upstream data propagation to parent (default: false).
|
|
21
|
-
- `dataOverrideEvaluationDepth` (number, optional): Special evaluation depth for dataOverride property.
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
- `dataOverrideEvaluationDepth` (number, optional): Special evaluation depth for dataOverride property (default: 10).
|
|
22
|
+
|
|
23
|
+
### Standard properties
|
|
24
|
+
- `actions` (array, optional): Actions to attach to the subroot.
|
|
24
25
|
|
|
25
26
|
## Behavior
|
|
26
27
|
- Renders a new `ReactiveJsonRoot` with the provided options.
|