@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
|
@@ -5,62 +5,6 @@ renderView:
|
|
|
5
5
|
|
|
6
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
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
8
|
## Basic Syntax
|
|
65
9
|
|
|
66
10
|
- type: TabbedSerializer
|
|
@@ -77,6 +21,82 @@ renderView:
|
|
|
77
21
|
"~~.error.path":
|
|
78
22
|
value: "Error message or ~~.template.reference"
|
|
79
23
|
|
|
24
|
+
- type: Markdown
|
|
25
|
+
content: |
|
|
26
|
+
## Properties
|
|
27
|
+
|
|
28
|
+
- type: DefinitionList
|
|
29
|
+
content:
|
|
30
|
+
- term:
|
|
31
|
+
code: stringMap
|
|
32
|
+
after: " (object, required)"
|
|
33
|
+
details:
|
|
34
|
+
- type: Markdown
|
|
35
|
+
content: |
|
|
36
|
+
The `stringMap` configuration is used to map source paths in the HTTP response to specific locations in your application state.
|
|
37
|
+
|
|
38
|
+
Each key in the `stringMap` object represents a destination path in your application state, e.g. `~~.profile.displayName`.
|
|
39
|
+
|
|
40
|
+
The value associated with each key is an object that defines how to map the source data to that destination.
|
|
41
|
+
Here is the list of properties that can be used in the value object:
|
|
42
|
+
|
|
43
|
+
- type: DefinitionList
|
|
44
|
+
content:
|
|
45
|
+
- term:
|
|
46
|
+
code: value
|
|
47
|
+
after: " (required)"
|
|
48
|
+
details:
|
|
49
|
+
type: Markdown
|
|
50
|
+
content: |
|
|
51
|
+
Source path in the HTTP response (e.g., `user.firstName`).
|
|
52
|
+
- term:
|
|
53
|
+
code: required
|
|
54
|
+
after: " (optional, default: true)"
|
|
55
|
+
details:
|
|
56
|
+
type: Markdown
|
|
57
|
+
content: |
|
|
58
|
+
Whether the source value must exist.
|
|
59
|
+
- term:
|
|
60
|
+
code: defaultValue
|
|
61
|
+
after: " (optional)"
|
|
62
|
+
details:
|
|
63
|
+
type: Markdown
|
|
64
|
+
content: |
|
|
65
|
+
Fallback value when source is missing and not required.
|
|
66
|
+
- term:
|
|
67
|
+
code: updateMode
|
|
68
|
+
after: " (optional, default: \"replace\")"
|
|
69
|
+
details:
|
|
70
|
+
type: Markdown
|
|
71
|
+
content: |
|
|
72
|
+
How to apply the value (`"replace"`, `"add"`, `"move"`, `"remove"`).
|
|
73
|
+
|
|
74
|
+
- type: DefinitionList
|
|
75
|
+
content:
|
|
76
|
+
- term:
|
|
77
|
+
code: onErrorMap
|
|
78
|
+
after: " (object, optional)"
|
|
79
|
+
details:
|
|
80
|
+
- type: Markdown
|
|
81
|
+
content: |
|
|
82
|
+
The `onErrorMap` works like `stringMap`, but provides fallback values when main mappings fail.
|
|
83
|
+
|
|
84
|
+
Same key-value structure as `stringMap` (destination → configuration).
|
|
85
|
+
|
|
86
|
+
Applied only when corresponding `stringMap` entries fail and are marked as `required: true`.
|
|
87
|
+
|
|
88
|
+
Here is the list of properties that can be used in the value object:
|
|
89
|
+
|
|
90
|
+
- type: DefinitionList
|
|
91
|
+
content:
|
|
92
|
+
- term:
|
|
93
|
+
code: value
|
|
94
|
+
after: " (required)"
|
|
95
|
+
details:
|
|
96
|
+
type: Markdown
|
|
97
|
+
content: |
|
|
98
|
+
Can be either static values (e.g., `Error occurred`) or template references (e.g., `~~.errorTimestamp`).
|
|
99
|
+
|
|
80
100
|
- type: Markdown
|
|
81
101
|
content: |
|
|
82
102
|
## Live Example
|
|
@@ -114,10 +134,15 @@ renderView:
|
|
|
114
134
|
version: "v1.2.3"
|
|
115
135
|
status: "success"
|
|
116
136
|
|
|
117
|
-
- type:
|
|
137
|
+
- type: button
|
|
118
138
|
content: "Simulate API Call with Data Mapping"
|
|
119
139
|
attributes:
|
|
120
|
-
|
|
140
|
+
style:
|
|
141
|
+
padding: "8px 16px"
|
|
142
|
+
margin: "8px 0"
|
|
143
|
+
border: "1px solid #007bff"
|
|
144
|
+
borderRadius: "4px"
|
|
145
|
+
cursor: "pointer"
|
|
121
146
|
actions:
|
|
122
147
|
- what: fetchData
|
|
123
148
|
on: click
|
|
@@ -230,10 +255,15 @@ renderView:
|
|
|
230
255
|
|
|
231
256
|
The mapping below tries to extract `user.name` and `user.email` which don't exist in this response, triggering the `onErrorMap` fallback values.
|
|
232
257
|
|
|
233
|
-
- type:
|
|
258
|
+
- type: button
|
|
234
259
|
content: "Test Missing Data Handling"
|
|
235
260
|
attributes:
|
|
236
|
-
|
|
261
|
+
style:
|
|
262
|
+
padding: "8px 16px"
|
|
263
|
+
margin: "8px 0"
|
|
264
|
+
border: "1px solid #ffc107"
|
|
265
|
+
borderRadius: "4px"
|
|
266
|
+
cursor: "pointer"
|
|
237
267
|
actions:
|
|
238
268
|
- what: fetchData
|
|
239
269
|
on: click
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# VariablesDebug
|
|
2
|
+
|
|
3
|
+
The `VariablesDebug` component renders a floating debug panel that lets you inspect the current template data at runtime. It is intended for development and debugging purposes to quickly see the values available in the active template context.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
None
|
|
7
|
+
|
|
8
|
+
## Behavior
|
|
9
|
+
- Renders a floating panel that can be expanded/collapsed.
|
|
10
|
+
- Displays the current template path.
|
|
11
|
+
- Switches between two modes: a flattened key/value list or a formatted JSON view.
|
|
12
|
+
- Copies the current view to the clipboard (list or JSON).
|
|
13
|
+
- Uses a portal (`#rj-debug-root`) injected into `document.body`.
|
|
14
|
+
- Returns `null` when `document` is not available (e.g., SSR).
|
|
15
|
+
- Multiple `VariablesDebug` components can be used in the same page.
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
This example shows how to use the `VariablesDebug` component to display the current template data.
|
|
19
|
+
|
|
20
|
+
Click the button to open the debug panel.
|
|
21
|
+
|
|
22
|
+
As the `VariablesDebug` declaration is located at the RjBuild root, it will show the global data assigned to the root.
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
renderView:
|
|
26
|
+
- type: VariablesDebug
|
|
27
|
+
actions:
|
|
28
|
+
- what: hide
|
|
29
|
+
when: ~.openDebug
|
|
30
|
+
isEmpty:
|
|
31
|
+
|
|
32
|
+
- type: button
|
|
33
|
+
content: Open/close the debug panel
|
|
34
|
+
actions:
|
|
35
|
+
- what: setData
|
|
36
|
+
on: click
|
|
37
|
+
path: ~.openDebug
|
|
38
|
+
value: true
|
|
39
|
+
when: ~.openDebug
|
|
40
|
+
isNot: true
|
|
41
|
+
stopPropagation: true
|
|
42
|
+
- what: setData
|
|
43
|
+
on: click
|
|
44
|
+
path: ~.openDebug
|
|
45
|
+
value: false
|
|
46
|
+
when: ~.openDebug
|
|
47
|
+
isNot: false
|
|
48
|
+
stopPropagation: true
|
|
49
|
+
|
|
50
|
+
data:
|
|
51
|
+
user:
|
|
52
|
+
name: "Alice"
|
|
53
|
+
email: "alice@example.com"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Notes
|
|
57
|
+
- Best used only in development environments. You should not ship it in production UIs.
|
|
58
|
+
- Clipboard access depends on browser permissions/policies.
|
|
59
|
+
- Do not include too many `VariablesDebug` components in the same page; otherwise, the vertical space available will be too small to be useful.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# VariablesDebug
|
|
5
|
+
|
|
6
|
+
The `VariablesDebug` component renders a floating debug panel that lets you inspect the
|
|
7
|
+
current template data at runtime. It is intended for development and debugging purposes
|
|
8
|
+
to quickly see the values available in the active template context.
|
|
9
|
+
|
|
10
|
+
## Properties
|
|
11
|
+
|
|
12
|
+
None.
|
|
13
|
+
|
|
14
|
+
## Behavior
|
|
15
|
+
- Renders a floating panel that can be expanded/collapsed.
|
|
16
|
+
- Displays the current template path.
|
|
17
|
+
- Switches between two modes: a flattened key/value list or a formatted JSON view.
|
|
18
|
+
- Copies the current view to the clipboard (list or JSON).
|
|
19
|
+
- Uses a portal (`#rj-debug-root`) injected into `document.body`.
|
|
20
|
+
- Returns `null` when `document` is not available (e.g., SSR).
|
|
21
|
+
- Multiple `VariablesDebug` components can be used in the same page.
|
|
22
|
+
|
|
23
|
+
- type: RjBuildDescriber
|
|
24
|
+
title: "Example"
|
|
25
|
+
description:
|
|
26
|
+
type: Markdown
|
|
27
|
+
content: |
|
|
28
|
+
This example shows how to use the `VariablesDebug` component to display the current template data.
|
|
29
|
+
|
|
30
|
+
Click the button to open the debug panel.
|
|
31
|
+
|
|
32
|
+
As the `VariablesDebug` declaration is located at the RjBuild root, it will show the global data assigned to the root.
|
|
33
|
+
|
|
34
|
+
toDescribe:
|
|
35
|
+
renderView:
|
|
36
|
+
- type: VariablesDebug
|
|
37
|
+
actions:
|
|
38
|
+
- what: hide
|
|
39
|
+
when: ~.openDebug
|
|
40
|
+
isEmpty:
|
|
41
|
+
|
|
42
|
+
- type: button
|
|
43
|
+
content: Open/close the debug panel
|
|
44
|
+
actions:
|
|
45
|
+
- what: setData
|
|
46
|
+
on: click
|
|
47
|
+
path: ~.openDebug
|
|
48
|
+
value: true
|
|
49
|
+
when: ~.openDebug
|
|
50
|
+
isNot: true
|
|
51
|
+
stopPropagation: true
|
|
52
|
+
- what: setData
|
|
53
|
+
on: click
|
|
54
|
+
path: ~.openDebug
|
|
55
|
+
value: false
|
|
56
|
+
when: ~.openDebug
|
|
57
|
+
isNot: false
|
|
58
|
+
stopPropagation: true
|
|
59
|
+
|
|
60
|
+
data:
|
|
61
|
+
user:
|
|
62
|
+
name: "Alice"
|
|
63
|
+
email: "alice@example.com"
|
|
64
|
+
|
|
65
|
+
- type: Markdown
|
|
66
|
+
content: |
|
|
67
|
+
## Notes
|
|
68
|
+
- Best used only in development environments. You should not ship it in production UIs.
|
|
69
|
+
- Clipboard access depends on browser permissions/policies.
|
|
70
|
+
- Do not include too many `VariablesDebug` components in the same page; otherwise,
|
|
71
|
+
the vertical space available will be too small to be useful.
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
The `Input` component provides a native HTML input field with automatic data synchronization, combining the simplicity of native HTML with the convenience of automatic data binding.
|
|
4
|
+
|
|
5
|
+
> **About specialized input components**
|
|
6
|
+
>
|
|
7
|
+
> For common input types, you can use specialized wrapper components that pre-set the `inputType`:
|
|
8
|
+
>
|
|
9
|
+
> - `TextField` (text), `EmailField` (email), `PasswordField` (password)
|
|
10
|
+
> - `UrlField` (url), `SearchField` (search), `TelField` (tel)
|
|
11
|
+
> - `NumberField` (number), `RangeField` (range)
|
|
12
|
+
> - `DateField` (date), `TimeField` (time), `DateTimeField` (datetime-local)
|
|
13
|
+
> - `MonthField` (month), `WeekField` (week)
|
|
14
|
+
> - `ColorField` (color), `FileField` (file), `HiddenField` (hidden)
|
|
15
|
+
>
|
|
16
|
+
> All these components use the same properties as `Input` but with a predefined input type.
|
|
17
|
+
>
|
|
18
|
+
> Using convenience components makes it easier to override specific component types through reactive-json's [plugin system](/docs/advanced-concepts/plugins/plugin-system). For example, you can replace all `EmailField` components with a custom implementation while leaving other input types unchanged.
|
|
19
|
+
|
|
20
|
+
## Basic Syntax
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
- type: Input
|
|
24
|
+
dataLocation: ~.fieldName
|
|
25
|
+
label: "Field Label:"
|
|
26
|
+
placeholder: "Enter value..."
|
|
27
|
+
inputType: "text"
|
|
28
|
+
inputAttributes:
|
|
29
|
+
required: true
|
|
30
|
+
attributes:
|
|
31
|
+
style:
|
|
32
|
+
marginBottom: "10px"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Properties
|
|
36
|
+
|
|
37
|
+
- `dataLocation` (string, optional): Path to bind the field value in the data context.
|
|
38
|
+
- `defaultFieldValue` (string, optional): Default value when no data is present.
|
|
39
|
+
- `label` (string, optional): Field label text (supports template evaluation).
|
|
40
|
+
- `placeholder` (string, optional): Placeholder text (supports template evaluation).
|
|
41
|
+
- `inputType` (string, optional): HTML input type (default: "text", supports template evaluation).
|
|
42
|
+
- `attributes` (object, optional): Attributes applied to the container div (or merged with inputAttributes if no wrapper).
|
|
43
|
+
- `inputAttributes` (object, optional): Attributes applied directly to the input element.
|
|
44
|
+
- `labelAttributes` (object, optional): Attributes applied to the label (htmlFor is automatically managed).
|
|
45
|
+
- `forceWrapper` (boolean, optional): Forces the presence (true) or absence (false) of the wrapper div. If omitted, wrapper is automatic only if label is present.
|
|
46
|
+
- `actions` (array, optional): Actions to execute based on field state.
|
|
47
|
+
|
|
48
|
+
## Data Management
|
|
49
|
+
|
|
50
|
+
The component automatically synchronizes its value with the global data context. When `dataLocation` is used, the value is stored at the specified path. Without `dataLocation`, the value is stored in the template context using the component's `datafield`.
|
|
51
|
+
|
|
52
|
+
## Input Types
|
|
53
|
+
|
|
54
|
+
The `inputType` property supports all HTML5 input types:
|
|
55
|
+
- `text` (default): Standard text input
|
|
56
|
+
- `email`: Email validation
|
|
57
|
+
- `password`: Masked password input
|
|
58
|
+
- `url`: URL validation
|
|
59
|
+
- `tel`: Telephone number input
|
|
60
|
+
- `search`: Search input with clear button
|
|
61
|
+
- `number`: Numeric input
|
|
62
|
+
- `date`: Date picker
|
|
63
|
+
- And all other HTML5 types
|
|
64
|
+
|
|
65
|
+
## Wrapper Control
|
|
66
|
+
|
|
67
|
+
The component uses a flexible wrapper system that adapts based on the presence of a label and the `forceWrapper` property.
|
|
68
|
+
|
|
69
|
+
### Default Behavior
|
|
70
|
+
When no `forceWrapper` is specified, the component automatically determines whether to use a wrapper div. If a label is present, the component wraps both the label and input in a div container. If no label is present, the input is rendered directly without a wrapper.
|
|
71
|
+
|
|
72
|
+
### Explicit Control with `forceWrapper`
|
|
73
|
+
You can override the default behavior using the `forceWrapper` property. Setting `forceWrapper: true` will always create a wrapper div, even without a label. Setting `forceWrapper: false` will never create a wrapper, even when a label is present.
|
|
74
|
+
|
|
75
|
+
### HTML Output Examples
|
|
76
|
+
|
|
77
|
+
**With label (automatic wrapper):**
|
|
78
|
+
```html
|
|
79
|
+
<div>
|
|
80
|
+
<label htmlFor="input-abc123">Field Label:</label>
|
|
81
|
+
<input id="input-abc123" type="text" value="" />
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Without label (no wrapper):**
|
|
86
|
+
```html
|
|
87
|
+
<input id="input-xyz789" type="text" value="" />
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Force wrapper without label:**
|
|
91
|
+
```html
|
|
92
|
+
<div>
|
|
93
|
+
<input id="input-def456" type="text" value="" />
|
|
94
|
+
</div>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Attribute Merging
|
|
98
|
+
When a wrapper is present, the `attributes` are applied to the div container and `inputAttributes` are applied to the input element. When no wrapper is present, both `attributes` and `inputAttributes` are merged and applied to the input element.
|
|
99
|
+
|
|
100
|
+
## Integrated vs Separated Labels
|
|
101
|
+
|
|
102
|
+
### Integrated Label (convenience)
|
|
103
|
+
```yaml
|
|
104
|
+
- type: Input
|
|
105
|
+
label: "My field:"
|
|
106
|
+
dataLocation: ~.value
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Advantages**: Simple, automatic accessibility (htmlFor)
|
|
110
|
+
**Limitations**: No conditional actions, limited styling
|
|
111
|
+
|
|
112
|
+
### Separated Label (full control)
|
|
113
|
+
```yaml
|
|
114
|
+
- type: label
|
|
115
|
+
content: "My field:"
|
|
116
|
+
attributes:
|
|
117
|
+
htmlFor: "my-input-id"
|
|
118
|
+
actions:
|
|
119
|
+
- what: setAttributeValue
|
|
120
|
+
when: ~.hasError
|
|
121
|
+
is: true
|
|
122
|
+
attribute: style.color
|
|
123
|
+
value: "red"
|
|
124
|
+
- type: Input
|
|
125
|
+
dataLocation: ~.value
|
|
126
|
+
forceWrapper: false
|
|
127
|
+
inputAttributes:
|
|
128
|
+
id: "my-input-id"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Advantages**: Conditional actions, advanced styling, full control
|
|
132
|
+
**Disadvantages**: More verbose, manual accessibility management
|
|
133
|
+
|
|
134
|
+
**Recommendation**: Use the integrated label for most cases. Opt for separated label only if you need conditional actions or advanced styling.
|
|
135
|
+
|
|
136
|
+
## Examples
|
|
137
|
+
|
|
138
|
+
### Basic Example
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
renderView:
|
|
142
|
+
- type: Input
|
|
143
|
+
dataLocation: ~.username
|
|
144
|
+
label: "Username:"
|
|
145
|
+
placeholder: "Enter your username"
|
|
146
|
+
|
|
147
|
+
data:
|
|
148
|
+
username: ""
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Different Input Types
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
renderView:
|
|
155
|
+
- type: Input
|
|
156
|
+
dataLocation: ~.email
|
|
157
|
+
label: "Email:"
|
|
158
|
+
placeholder: "user@example.com"
|
|
159
|
+
inputType: "email"
|
|
160
|
+
- type: Input
|
|
161
|
+
dataLocation: ~.password
|
|
162
|
+
label: "Password:"
|
|
163
|
+
placeholder: "Enter password"
|
|
164
|
+
inputType: "password"
|
|
165
|
+
- type: Input
|
|
166
|
+
dataLocation: ~.website
|
|
167
|
+
label: "Website:"
|
|
168
|
+
placeholder: "https://example.com"
|
|
169
|
+
inputType: "url"
|
|
170
|
+
- type: Input
|
|
171
|
+
dataLocation: ~.age
|
|
172
|
+
label: "Age:"
|
|
173
|
+
inputType: "number"
|
|
174
|
+
inputAttributes:
|
|
175
|
+
min: 0
|
|
176
|
+
max: 120
|
|
177
|
+
|
|
178
|
+
data:
|
|
179
|
+
email: ""
|
|
180
|
+
password: ""
|
|
181
|
+
website: ""
|
|
182
|
+
age: ""
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Custom Attributes
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
renderView:
|
|
189
|
+
- type: Input
|
|
190
|
+
dataLocation: ~.productCode
|
|
191
|
+
label: "Product Code:"
|
|
192
|
+
placeholder: "ABC-123"
|
|
193
|
+
inputAttributes:
|
|
194
|
+
pattern: "[A-Z]{3}-[0-9]{3}"
|
|
195
|
+
title: "Format: ABC-123 (3 letters, dash, 3 numbers)"
|
|
196
|
+
maxLength: 7
|
|
197
|
+
style:
|
|
198
|
+
textTransform: "uppercase"
|
|
199
|
+
attributes:
|
|
200
|
+
style:
|
|
201
|
+
marginBottom: "10px"
|
|
202
|
+
|
|
203
|
+
data:
|
|
204
|
+
productCode: ""
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Wrapper Control
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
renderView:
|
|
211
|
+
# No label → no wrapper automatically
|
|
212
|
+
- type: Input
|
|
213
|
+
dataLocation: ~.noWrapper
|
|
214
|
+
placeholder: "Input without wrapper"
|
|
215
|
+
|
|
216
|
+
# With label → automatic wrapper
|
|
217
|
+
- type: Input
|
|
218
|
+
dataLocation: ~.autoWrapper
|
|
219
|
+
label: "With automatic wrapper:"
|
|
220
|
+
placeholder: "Input with wrapper"
|
|
221
|
+
|
|
222
|
+
# Force wrapper even without label
|
|
223
|
+
- type: Input
|
|
224
|
+
dataLocation: ~.forceWrapper
|
|
225
|
+
placeholder: "Forced wrapper"
|
|
226
|
+
forceWrapper: true
|
|
227
|
+
attributes:
|
|
228
|
+
style:
|
|
229
|
+
border: "2px solid blue"
|
|
230
|
+
padding: "10px"
|
|
231
|
+
|
|
232
|
+
# No wrapper even with label
|
|
233
|
+
- type: Input
|
|
234
|
+
dataLocation: ~.noWrapperForced
|
|
235
|
+
label: "Label without wrapper:"
|
|
236
|
+
placeholder: "Input without forced wrapper"
|
|
237
|
+
forceWrapper: false
|
|
238
|
+
# attributes merged with inputAttributes
|
|
239
|
+
attributes:
|
|
240
|
+
style:
|
|
241
|
+
border: "2px solid red"
|
|
242
|
+
|
|
243
|
+
data:
|
|
244
|
+
noWrapper: ""
|
|
245
|
+
autoWrapper: ""
|
|
246
|
+
forceWrapper: ""
|
|
247
|
+
noWrapperForced: ""
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Custom Label Attributes
|
|
251
|
+
|
|
252
|
+
```yaml
|
|
253
|
+
renderView:
|
|
254
|
+
- type: Input
|
|
255
|
+
dataLocation: ~.customLabel
|
|
256
|
+
label: "Custom label:"
|
|
257
|
+
placeholder: "Input with styled label"
|
|
258
|
+
labelAttributes:
|
|
259
|
+
style:
|
|
260
|
+
color: "blue"
|
|
261
|
+
fontWeight: "bold"
|
|
262
|
+
fontSize: "14px"
|
|
263
|
+
className: "custom-label"
|
|
264
|
+
|
|
265
|
+
data:
|
|
266
|
+
customLabel: ""
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### With Actions
|
|
270
|
+
|
|
271
|
+
```yaml
|
|
272
|
+
renderView:
|
|
273
|
+
- type: Input
|
|
274
|
+
dataLocation: ~.searchTerm
|
|
275
|
+
label: "Search:"
|
|
276
|
+
placeholder: "Type to search..."
|
|
277
|
+
inputType: "search"
|
|
278
|
+
actions:
|
|
279
|
+
- what: setData
|
|
280
|
+
when: ~.searchTerm
|
|
281
|
+
hasLength: ">0"
|
|
282
|
+
path: ~.isSearching
|
|
283
|
+
value: true
|
|
284
|
+
|
|
285
|
+
data:
|
|
286
|
+
searchTerm: ""
|
|
287
|
+
isSearching: false
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Advantages
|
|
291
|
+
|
|
292
|
+
- **No external dependencies**: Works without any CSS framework
|
|
293
|
+
- **Full control**: Custom styling and behavior
|
|
294
|
+
- **Performance**: Lighter than component libraries
|
|
295
|
+
- **Accessibility**: Direct control over ARIA attributes, automatic htmlFor
|
|
296
|
+
- **Automatic synchronization**: Unlike raw HTML elements that require manual setData actions
|
|
297
|
+
- **Flexible wrapper**: Avoids unnecessary HTML when not needed
|
|
298
|
+
- **Flexibility**: Integrated label for convenience, separated for advanced control
|
|
299
|
+
|
|
300
|
+
## Limitations
|
|
301
|
+
|
|
302
|
+
- No built-in validation beyond HTML5 input type validation
|
|
303
|
+
- No support for input masking or formatting
|
|
304
|
+
- No built-in error message display
|
|
305
|
+
- Styling must be provided via external CSS or style attributes
|
|
306
|
+
- Template evaluation for `inputType` should return valid HTML input types
|
|
307
|
+
- Integrated label is limited: for conditional actions, prefer separated label
|