@ea-lab/reactive-json-docs 0.8.0 → 1.0.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/attribute-transformers.md +168 -0
- package/public/rjbuild/docs/advanced-concepts/attribute-transformers.yaml +151 -0
- package/public/rjbuild/docs/advanced-concepts/data-mapping.md +6 -6
- package/public/rjbuild/docs/advanced-concepts/data-mapping.yaml +7 -7
- package/public/rjbuild/docs/advanced-concepts/data-processors.md +7 -7
- package/public/rjbuild/docs/advanced-concepts/data-processors.yaml +7 -7
- package/public/rjbuild/docs/advanced-concepts/forward-update.md +2 -2
- package/public/rjbuild/docs/advanced-concepts/forward-update.yaml +2 -2
- package/public/rjbuild/docs/advanced-concepts/index.md +1 -0
- package/public/rjbuild/docs/advanced-concepts/index.yaml +1 -0
- package/public/rjbuild/docs/advanced-concepts/plugins/component-development.md +1 -1
- package/public/rjbuild/docs/advanced-concepts/plugins/component-development.yaml +1 -1
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.md +48 -2
- package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.yaml +54 -2
- package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.md +2 -0
- package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.yaml +2 -0
- package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.md +2 -0
- package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.yaml +2 -0
- package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.md +2 -0
- package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.yaml +2 -0
- package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.md +2 -0
- package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.yaml +2 -0
- package/public/rjbuild/docs/core/action/Attribute/index.md +121 -0
- package/public/rjbuild/docs/core/action/Attribute/index.yaml +77 -0
- package/public/rjbuild/docs/core/attributeTransformer/index.md +17 -0
- package/public/rjbuild/docs/core/attributeTransformer/index.yaml +24 -0
- package/public/rjbuild/docs/core/attributeTransformer/setAttributeValue.md +101 -0
- package/public/rjbuild/docs/core/attributeTransformer/setAttributeValue.yaml +144 -0
- package/public/rjbuild/docs/core/attributeTransformer/toggleAttributeValue.md +269 -0
- package/public/rjbuild/docs/core/attributeTransformer/toggleAttributeValue.yaml +247 -0
- package/public/rjbuild/docs/core/attributeTransformer/unsetAttribute.md +114 -0
- package/public/rjbuild/docs/core/attributeTransformer/unsetAttribute.yaml +138 -0
- package/public/rjbuild/docs/core/attributeTransformer/unsetAttributeValue.md +140 -0
- package/public/rjbuild/docs/core/attributeTransformer/unsetAttributeValue.yaml +187 -0
- package/public/rjbuild/docs/core/dataMapping/simpleMapping.yaml +14 -4
- 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/special/Count.yaml +99 -31
- package/public/rjbuild/docs/core/element/special/DataFilter.yaml +118 -38
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +154 -34
- package/public/rjbuild/docs/core/element/special/Switch.md +5 -5
- package/public/rjbuild/docs/core/element/special/Switch.yaml +9 -18
- 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/hook/index.md +38 -0
- package/public/rjbuild/docs/core/hook/index.yaml +44 -0
- package/public/rjbuild/docs/core/hook/usePagination.md +286 -0
- package/public/rjbuild/docs/core/hook/usePagination.yaml +319 -0
- package/public/rjbuild/docs/core/hook/useTransformedAttributes.md +130 -0
- package/public/rjbuild/docs/core/hook/useTransformedAttributes.yaml +164 -0
- package/public/rjbuild/docs/core/reaction/addData.md +17 -3
- package/public/rjbuild/docs/core/reaction/addData.yaml +53 -9
- package/public/rjbuild/docs/core/reaction/fetchData.yaml +44 -8
- package/public/rjbuild/docs/core/reaction/setData.md +18 -4
- package/public/rjbuild/docs/core/reaction/setData.yaml +18 -4
- 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 +2 -5
- package/public/rjbuild/docs/install.yaml +4 -10
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Popover.md +1 -1
- package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.md +1 -1
- package/public/rjbuild/docs/integration/bootstrap/element/html/AccordionItem.md +69 -0
- package/public/rjbuild/docs/integration/bootstrap/element/html/Modal.md +127 -0
- package/public/rjbuild/docs/integration/bootstrap/element/html/Tabs.md +150 -0
- package/public/rjbuild/docs/integration/bootstrap/element/html/index.md +13 -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 → integration/bootstrap}/action/Popover.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/action/Tooltip.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/CheckBoxField.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/DateField.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/NumberField.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/SelectField.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextAreaField.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/TextField.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/formElementsCommon.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/form/index.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/AccordionItem.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Modal.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/html/Tabs.yaml +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/special/BootstrapElement.md +0 -0
- /package/public/rjbuild/docs/{core → integration/bootstrap}/element/special/BootstrapElement.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,130 @@
|
|
|
1
|
+
# useTransformedAttributes
|
|
2
|
+
|
|
3
|
+
Applies attribute transformations based on configured transformers in plugins. This hook allows conditional modification of component attributes by applying a series of defined transformations.
|
|
4
|
+
|
|
5
|
+
## Hook Signature
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
const transformedAttributes = useTransformedAttributes(attrsToTransform, transformProps)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
- `attrsToTransform` (object): Raw attributes to transform
|
|
14
|
+
- `transformProps` (array, optional): Array of transformation definitions to apply
|
|
15
|
+
|
|
16
|
+
## Return Value
|
|
17
|
+
|
|
18
|
+
- `transformedAttributes` (object): Final attributes after applying transformations (spread on target element/component)
|
|
19
|
+
|
|
20
|
+
## How It Works
|
|
21
|
+
|
|
22
|
+
The hook follows this logic:
|
|
23
|
+
|
|
24
|
+
1. **Validation Check**: If `transformProps` is `undefined`, returns original attributes
|
|
25
|
+
2. **Transformer Retrieval**: Accesses transformers via `globalDataContext.plugins.attributeTransformer`
|
|
26
|
+
3. **Sequential Application**: Applies each transformation in defined order
|
|
27
|
+
4. **Conditional Validation**: Each transformation is validated before application via `isValid()`
|
|
28
|
+
5. **Accumulation**: Transformations are applied cumulatively
|
|
29
|
+
|
|
30
|
+
## Supported Transformer Types
|
|
31
|
+
|
|
32
|
+
The following transformers are available in the system:
|
|
33
|
+
|
|
34
|
+
### setAttributeValue
|
|
35
|
+
Sets an attribute value conditionally.
|
|
36
|
+
|
|
37
|
+
### toggleAttributeValue
|
|
38
|
+
Toggles between two values for an attribute.
|
|
39
|
+
|
|
40
|
+
### unsetAttribute
|
|
41
|
+
Completely removes an attribute.
|
|
42
|
+
|
|
43
|
+
### unsetAttributeValue
|
|
44
|
+
Removes an attribute value (sets to `undefined`).
|
|
45
|
+
|
|
46
|
+
## Example Usage
|
|
47
|
+
|
|
48
|
+
```jsx
|
|
49
|
+
import { useTransformedAttributes } from '@ea-lab/reactive-json';
|
|
50
|
+
|
|
51
|
+
const MyComponent = ({ props }) => {
|
|
52
|
+
const baseAttributes = {
|
|
53
|
+
className: "btn btn-primary",
|
|
54
|
+
disabled: false,
|
|
55
|
+
title: "Click me"
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const transformedAttributes = useTransformedAttributes(
|
|
59
|
+
baseAttributes,
|
|
60
|
+
props.attributeTransforms
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return <button {...transformedAttributes}>Submit</button>;
|
|
64
|
+
};
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Transformation Configuration
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
# Example configuration in RjBuild
|
|
71
|
+
- type: MyComponent
|
|
72
|
+
attributeTransforms:
|
|
73
|
+
- what: setAttributeValue
|
|
74
|
+
when: ~~.form.isSubmitting
|
|
75
|
+
is: true
|
|
76
|
+
attributeName: disabled
|
|
77
|
+
value: true
|
|
78
|
+
|
|
79
|
+
- what: toggleAttributeValue
|
|
80
|
+
when: ~~.theme
|
|
81
|
+
is: "dark"
|
|
82
|
+
attributeName: className
|
|
83
|
+
value1: "btn btn-primary"
|
|
84
|
+
value2: "btn btn-primary btn-dark"
|
|
85
|
+
|
|
86
|
+
- what: unsetAttribute
|
|
87
|
+
when: ~~.user.role
|
|
88
|
+
is: "guest"
|
|
89
|
+
attributeName: title
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Context Integration
|
|
93
|
+
|
|
94
|
+
The hook automatically uses:
|
|
95
|
+
|
|
96
|
+
- **GlobalDataContext**: For accessing plugins and global data
|
|
97
|
+
- **TemplateContext**: For condition evaluation in templates
|
|
98
|
+
|
|
99
|
+
## Transformation Validation
|
|
100
|
+
|
|
101
|
+
Each transformation is validated via the `isValid()` function which checks:
|
|
102
|
+
|
|
103
|
+
- The `when` condition against the `is` value
|
|
104
|
+
- Supported comparison operators
|
|
105
|
+
- Data availability in contexts
|
|
106
|
+
|
|
107
|
+
## Error Handling
|
|
108
|
+
|
|
109
|
+
The hook is designed to be resilient:
|
|
110
|
+
|
|
111
|
+
- **Missing Transformer**: Silently ignores the transformation
|
|
112
|
+
- **Failed Validation**: Ignores invalid transformation
|
|
113
|
+
- **Missing Plugins**: Returns original attributes
|
|
114
|
+
- **Missing Data**: Ignores transformations that cannot be evaluated
|
|
115
|
+
|
|
116
|
+
## Performance
|
|
117
|
+
|
|
118
|
+
- **Sequential Application**: Transformations applied in order with accumulation
|
|
119
|
+
- **Optimized Validation**: Invalid transformations ignored quickly
|
|
120
|
+
- **Reusability**: Hook can be called multiple times without performance impact
|
|
121
|
+
|
|
122
|
+
## Relationship with Transformers
|
|
123
|
+
|
|
124
|
+
This hook is closely related to the attributeTransformer system:
|
|
125
|
+
|
|
126
|
+
- Uses transformers registered in plugins
|
|
127
|
+
- Respects transformer syntax (`what`, `when`, `is` properties)
|
|
128
|
+
- Integrates with global validation system
|
|
129
|
+
|
|
130
|
+
For details on individual transformers, see [attributeTransformer documentation](../attributeTransformer/index.md).
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# useTransformedAttributes
|
|
5
|
+
|
|
6
|
+
Applies attribute transformations based on configured transformers in plugins. This hook allows conditional modification of component attributes by applying a series of defined transformations.
|
|
7
|
+
|
|
8
|
+
## Hook Signature
|
|
9
|
+
|
|
10
|
+
- type: SyntaxHighlighter
|
|
11
|
+
language: "javascript"
|
|
12
|
+
content: |
|
|
13
|
+
const transformedAttributes = useTransformedAttributes(attrsToTransform, transformProps)
|
|
14
|
+
|
|
15
|
+
- type: Markdown
|
|
16
|
+
content: |
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
- type: DefinitionList
|
|
20
|
+
content:
|
|
21
|
+
- term:
|
|
22
|
+
code: attrsToTransform
|
|
23
|
+
after: "(object)"
|
|
24
|
+
details: "Raw attributes to transform"
|
|
25
|
+
- term:
|
|
26
|
+
code: transformProps
|
|
27
|
+
after: "(array, optional)"
|
|
28
|
+
details: "Array of transformation definitions to apply"
|
|
29
|
+
|
|
30
|
+
- type: Markdown
|
|
31
|
+
content: |
|
|
32
|
+
## Return Value
|
|
33
|
+
|
|
34
|
+
- type: DefinitionList
|
|
35
|
+
content:
|
|
36
|
+
- term:
|
|
37
|
+
code: transformedAttributes
|
|
38
|
+
after: "(object)"
|
|
39
|
+
details: "Final attributes after applying transformations (spread on target element/component)"
|
|
40
|
+
|
|
41
|
+
- type: Markdown
|
|
42
|
+
content: |
|
|
43
|
+
## How It Works
|
|
44
|
+
|
|
45
|
+
The hook follows this logic:
|
|
46
|
+
|
|
47
|
+
1. **Validation Check**: If `transformProps` is `undefined`, returns original attributes
|
|
48
|
+
2. **Transformer Retrieval**: Accesses transformers via `globalDataContext.plugins.attributeTransformer`
|
|
49
|
+
3. **Sequential Application**: Applies each transformation in defined order
|
|
50
|
+
4. **Conditional Validation**: Each transformation is validated before application via `isValid()`
|
|
51
|
+
5. **Accumulation**: Transformations are applied cumulatively
|
|
52
|
+
|
|
53
|
+
## Supported Transformer Types
|
|
54
|
+
|
|
55
|
+
The following transformers are available in the system:
|
|
56
|
+
|
|
57
|
+
### setAttributeValue
|
|
58
|
+
Sets an attribute value conditionally.
|
|
59
|
+
|
|
60
|
+
### toggleAttributeValue
|
|
61
|
+
Toggles between two values for an attribute.
|
|
62
|
+
|
|
63
|
+
### unsetAttribute
|
|
64
|
+
Completely removes an attribute.
|
|
65
|
+
|
|
66
|
+
### unsetAttributeValue
|
|
67
|
+
Removes an attribute value (sets to `undefined`).
|
|
68
|
+
|
|
69
|
+
- type: Markdown
|
|
70
|
+
content: |
|
|
71
|
+
## Example Usage
|
|
72
|
+
|
|
73
|
+
- type: SyntaxHighlighter
|
|
74
|
+
language: "jsx"
|
|
75
|
+
content: |
|
|
76
|
+
import { useTransformedAttributes } from '@ea-lab/reactive-json';
|
|
77
|
+
|
|
78
|
+
const MyComponent = ({ props }) => {
|
|
79
|
+
const baseAttributes = {
|
|
80
|
+
className: "btn btn-primary",
|
|
81
|
+
disabled: false,
|
|
82
|
+
title: "Click me"
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const transformedAttributes = useTransformedAttributes(
|
|
86
|
+
baseAttributes,
|
|
87
|
+
props.attributeTransforms
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return <button {...transformedAttributes}>Submit</button>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
- type: Markdown
|
|
94
|
+
content: |
|
|
95
|
+
## Transformation Configuration
|
|
96
|
+
|
|
97
|
+
- type: SyntaxHighlighter
|
|
98
|
+
language: "yaml"
|
|
99
|
+
content: |
|
|
100
|
+
# Example configuration in RjBuild
|
|
101
|
+
- type: MyComponent
|
|
102
|
+
attributeTransforms:
|
|
103
|
+
- what: setAttributeValue
|
|
104
|
+
when: ~~.form.isSubmitting
|
|
105
|
+
is: true
|
|
106
|
+
attributeName: disabled
|
|
107
|
+
value: true
|
|
108
|
+
|
|
109
|
+
- what: toggleAttributeValue
|
|
110
|
+
when: ~~.theme
|
|
111
|
+
is: "dark"
|
|
112
|
+
attributeName: className
|
|
113
|
+
value1: "btn btn-primary"
|
|
114
|
+
value2: "btn btn-primary btn-dark"
|
|
115
|
+
|
|
116
|
+
- what: unsetAttribute
|
|
117
|
+
when: ~~.user.role
|
|
118
|
+
is: "guest"
|
|
119
|
+
attributeName: title
|
|
120
|
+
|
|
121
|
+
- type: Markdown
|
|
122
|
+
content: |
|
|
123
|
+
## Context Integration
|
|
124
|
+
|
|
125
|
+
The hook automatically uses:
|
|
126
|
+
|
|
127
|
+
- **GlobalDataContext**: For accessing plugins and global data
|
|
128
|
+
- **TemplateContext**: For condition evaluation in templates
|
|
129
|
+
|
|
130
|
+
## Transformation Validation
|
|
131
|
+
|
|
132
|
+
Each transformation is validated via the `isValid()` function which checks:
|
|
133
|
+
|
|
134
|
+
- The `when` condition against the `is` value
|
|
135
|
+
- Supported comparison operators
|
|
136
|
+
- Data availability in contexts
|
|
137
|
+
|
|
138
|
+
## Error Handling
|
|
139
|
+
|
|
140
|
+
The hook is designed to be resilient:
|
|
141
|
+
|
|
142
|
+
- **Missing Transformer**: Silently ignores the transformation
|
|
143
|
+
- **Failed Validation**: Ignores invalid transformation
|
|
144
|
+
- **Missing Plugins**: Returns original attributes
|
|
145
|
+
- **Missing Data**: Ignores transformations that cannot be evaluated
|
|
146
|
+
|
|
147
|
+
## Performance
|
|
148
|
+
|
|
149
|
+
- **Sequential Application**: Transformations applied in order with accumulation
|
|
150
|
+
- **Optimized Validation**: Invalid transformations ignored quickly
|
|
151
|
+
- **Reusability**: Hook can be called multiple times without performance impact
|
|
152
|
+
|
|
153
|
+
## Relationship with Transformers
|
|
154
|
+
|
|
155
|
+
This hook is closely related to the attributeTransformer system:
|
|
156
|
+
|
|
157
|
+
- Uses transformers registered in plugins
|
|
158
|
+
- Respects transformer syntax (`what`, `when`, `is` properties)
|
|
159
|
+
- Integrates with global validation system
|
|
160
|
+
|
|
161
|
+
For details on individual transformers, see [attributeTransformer documentation](../attributeTransformer/index).
|
|
162
|
+
|
|
163
|
+
templates: {}
|
|
164
|
+
data: {}
|
|
@@ -69,9 +69,23 @@ data:
|
|
|
69
69
|
### Adding with Dynamic Values
|
|
70
70
|
```yaml
|
|
71
71
|
renderView:
|
|
72
|
-
- type:
|
|
73
|
-
|
|
74
|
-
|
|
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>"
|
|
75
89
|
- type: button
|
|
76
90
|
content: Add
|
|
77
91
|
actions:
|
|
@@ -87,9 +87,23 @@ renderView:
|
|
|
87
87
|
### Adding with Dynamic Values
|
|
88
88
|
```yaml
|
|
89
89
|
renderView:
|
|
90
|
-
- type:
|
|
91
|
-
|
|
92
|
-
|
|
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>"
|
|
93
107
|
- type: button
|
|
94
108
|
content: Add
|
|
95
109
|
actions:
|
|
@@ -128,12 +142,42 @@ renderView:
|
|
|
128
142
|
load: user_form
|
|
129
143
|
templates:
|
|
130
144
|
user_form:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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>"
|
|
137
181
|
data:
|
|
138
182
|
users:
|
|
139
183
|
- name: "John"
|
|
@@ -205,12 +205,22 @@ renderView:
|
|
|
205
205
|
content:
|
|
206
206
|
- type: div
|
|
207
207
|
attributes:
|
|
208
|
-
|
|
208
|
+
style:
|
|
209
|
+
width: "48%"
|
|
210
|
+
display: "inline-block"
|
|
211
|
+
verticalAlign: "top"
|
|
212
|
+
marginRight: "2%"
|
|
209
213
|
content:
|
|
210
214
|
- type: BsButton
|
|
211
215
|
content: "Complete Data Replacement"
|
|
212
216
|
attributes:
|
|
213
|
-
|
|
217
|
+
style:
|
|
218
|
+
padding: "8px 16px"
|
|
219
|
+
margin: "8px 0"
|
|
220
|
+
border: "1px solid #007bff"
|
|
221
|
+
borderRadius: "4px"
|
|
222
|
+
cursor: "pointer"
|
|
223
|
+
width: "100%"
|
|
214
224
|
actions:
|
|
215
225
|
- what: fetchData
|
|
216
226
|
on: click
|
|
@@ -226,12 +236,22 @@ renderView:
|
|
|
226
236
|
|
|
227
237
|
- type: div
|
|
228
238
|
attributes:
|
|
229
|
-
|
|
239
|
+
style:
|
|
240
|
+
width: "48%"
|
|
241
|
+
display: "inline-block"
|
|
242
|
+
verticalAlign: "top"
|
|
243
|
+
marginRight: "2%"
|
|
230
244
|
content:
|
|
231
245
|
- type: BsButton
|
|
232
246
|
content: "Targeted Data Update"
|
|
233
247
|
attributes:
|
|
234
|
-
|
|
248
|
+
style:
|
|
249
|
+
padding: "8px 16px"
|
|
250
|
+
margin: "8px 0"
|
|
251
|
+
border: "1px solid #6c757d"
|
|
252
|
+
borderRadius: "4px"
|
|
253
|
+
cursor: "pointer"
|
|
254
|
+
width: "100%"
|
|
235
255
|
actions:
|
|
236
256
|
- what: fetchData
|
|
237
257
|
on: click
|
|
@@ -253,7 +273,11 @@ renderView:
|
|
|
253
273
|
- type: BsButton
|
|
254
274
|
content: "🔄 Reset to Initial Data"
|
|
255
275
|
attributes:
|
|
256
|
-
|
|
276
|
+
style:
|
|
277
|
+
padding: "8px 16px"
|
|
278
|
+
border: "1px solid #6c757d"
|
|
279
|
+
borderRadius: "4px"
|
|
280
|
+
cursor: "pointer"
|
|
257
281
|
actions:
|
|
258
282
|
- what: fetchData
|
|
259
283
|
on: click
|
|
@@ -269,7 +293,11 @@ renderView:
|
|
|
269
293
|
content:
|
|
270
294
|
- type: div
|
|
271
295
|
attributes:
|
|
272
|
-
|
|
296
|
+
style:
|
|
297
|
+
width: "32%"
|
|
298
|
+
display: "inline-block"
|
|
299
|
+
verticalAlign: "top"
|
|
300
|
+
marginRight: "1%"
|
|
273
301
|
content:
|
|
274
302
|
- type: h6
|
|
275
303
|
content: "👤 User Profile"
|
|
@@ -295,7 +323,11 @@ renderView:
|
|
|
295
323
|
|
|
296
324
|
- type: div
|
|
297
325
|
attributes:
|
|
298
|
-
|
|
326
|
+
style:
|
|
327
|
+
width: "32%"
|
|
328
|
+
display: "inline-block"
|
|
329
|
+
verticalAlign: "top"
|
|
330
|
+
marginRight: "1%"
|
|
299
331
|
content:
|
|
300
332
|
- type: h6
|
|
301
333
|
content: "⚙️ Settings"
|
|
@@ -321,7 +353,11 @@ renderView:
|
|
|
321
353
|
|
|
322
354
|
- type: div
|
|
323
355
|
attributes:
|
|
324
|
-
|
|
356
|
+
style:
|
|
357
|
+
width: "32%"
|
|
358
|
+
display: "inline-block"
|
|
359
|
+
verticalAlign: "top"
|
|
360
|
+
marginRight: "1%"
|
|
325
361
|
content:
|
|
326
362
|
- type: h6
|
|
327
363
|
content: "📊 Status"
|
|
@@ -52,10 +52,24 @@ This example shows how to use conditions with `setData` to only execute when cer
|
|
|
52
52
|
|
|
53
53
|
```yaml
|
|
54
54
|
renderView:
|
|
55
|
-
- type:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
- type: label
|
|
56
|
+
content: "Username:"
|
|
57
|
+
- type: input
|
|
58
|
+
attributes:
|
|
59
|
+
type: "text"
|
|
60
|
+
value: ~.username
|
|
61
|
+
placeholder: "Enter username"
|
|
62
|
+
style:
|
|
63
|
+
padding: "8px"
|
|
64
|
+
margin: "8px 0"
|
|
65
|
+
border: "1px solid #ccc"
|
|
66
|
+
borderRadius: "4px"
|
|
67
|
+
width: "200px"
|
|
68
|
+
actions:
|
|
69
|
+
- what: setData
|
|
70
|
+
on: input
|
|
71
|
+
path: ~.username
|
|
72
|
+
value: "<reactive-json:event-new-value>"
|
|
59
73
|
- type: button
|
|
60
74
|
content: "Set Welcome Message"
|
|
61
75
|
actions:
|
|
@@ -73,10 +73,24 @@ renderView:
|
|
|
73
73
|
description: "This example shows how to use conditions with `setData` to only execute when certain criteria are met."
|
|
74
74
|
toDescribe:
|
|
75
75
|
renderView:
|
|
76
|
-
- type:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
- type: label
|
|
77
|
+
content: "Username:"
|
|
78
|
+
- type: input
|
|
79
|
+
attributes:
|
|
80
|
+
type: "text"
|
|
81
|
+
value: ~.username
|
|
82
|
+
placeholder: "Enter username"
|
|
83
|
+
style:
|
|
84
|
+
padding: "8px"
|
|
85
|
+
margin: "8px 0"
|
|
86
|
+
border: "1px solid #ccc"
|
|
87
|
+
borderRadius: "4px"
|
|
88
|
+
width: "200px"
|
|
89
|
+
actions:
|
|
90
|
+
- what: setData
|
|
91
|
+
on: input
|
|
92
|
+
path: ~.username
|
|
93
|
+
value: "<reactive-json:event-new-value>"
|
|
80
94
|
- type: button
|
|
81
95
|
content: "Set Welcome Message"
|
|
82
96
|
actions:
|