@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,138 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# unsetAttribute
|
|
5
|
+
|
|
6
|
+
> **Alternative**: For post-render DOM modification, see the [UnsetAttribute action](../action/Attribute/UnsetAttribute).
|
|
7
|
+
|
|
8
|
+
Completely removes an HTML attribute from an element.
|
|
9
|
+
|
|
10
|
+
## Basic Syntax
|
|
11
|
+
|
|
12
|
+
- type: TabbedSerializer
|
|
13
|
+
yamlSerializedContent: |
|
|
14
|
+
attributeTransforms:
|
|
15
|
+
# Remove entire attribute
|
|
16
|
+
- what: unsetAttribute
|
|
17
|
+
name: "class"
|
|
18
|
+
|
|
19
|
+
# Conditional removal
|
|
20
|
+
- what: unsetAttribute
|
|
21
|
+
name: "style"
|
|
22
|
+
when: ~.useDefaultStyling
|
|
23
|
+
is: true
|
|
24
|
+
|
|
25
|
+
- type: Markdown
|
|
26
|
+
content: |
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
- type: DefinitionList
|
|
30
|
+
content:
|
|
31
|
+
- term:
|
|
32
|
+
code: name
|
|
33
|
+
after: "(string, required)"
|
|
34
|
+
details: The name of the attribute to remove completely.
|
|
35
|
+
|
|
36
|
+
- type: Markdown
|
|
37
|
+
content: |
|
|
38
|
+
|
|
39
|
+
## Behavior
|
|
40
|
+
|
|
41
|
+
- **Complete removal**: Removes the entire attribute and all its values from the DOM element.
|
|
42
|
+
- **Attribute deletion**: The attribute is completely deleted, not just emptied.
|
|
43
|
+
- **Irreversible**: Once removed, the attribute must be explicitly set again to restore it.
|
|
44
|
+
|
|
45
|
+
## Common Use Cases
|
|
46
|
+
|
|
47
|
+
- **Conditional attribute presence**: Removing attributes entirely based on conditions.
|
|
48
|
+
- **Accessibility cleanup**: Removing ARIA attributes when not needed.
|
|
49
|
+
- **Data attribute management**: Completely removing data-* attributes.
|
|
50
|
+
- **Style reset**: Removing inline style attributes to fall back to CSS.
|
|
51
|
+
|
|
52
|
+
- type: RjBuildDescriber
|
|
53
|
+
title: "UnsetAttribute Action Examples"
|
|
54
|
+
description:
|
|
55
|
+
- type: Markdown
|
|
56
|
+
content: |
|
|
57
|
+
This example demonstrates how to completely remove HTML attributes using the `UnsetAttribute` action.
|
|
58
|
+
|
|
59
|
+
**Expected behavior:**
|
|
60
|
+
- Initially, the input field is read-only (you cannot type in it) and has visual styling
|
|
61
|
+
- Click "Remove readonly attribute" to remove the entire readonly attribute - the input becomes editable
|
|
62
|
+
- Click "Reset" to restore the readonly attribute - the input becomes read-only again
|
|
63
|
+
- The action completely removes the entire attribute, not just its value
|
|
64
|
+
|
|
65
|
+
Try interacting with the buttons to see how the readonly attribute is completely removed/restored.
|
|
66
|
+
|
|
67
|
+
toDescribe:
|
|
68
|
+
renderView:
|
|
69
|
+
- type: button
|
|
70
|
+
content: "Remove readonly attribute"
|
|
71
|
+
actions:
|
|
72
|
+
- what: setData
|
|
73
|
+
on: click
|
|
74
|
+
path: ~.makeEditable
|
|
75
|
+
value: true
|
|
76
|
+
stopPropagation: true
|
|
77
|
+
|
|
78
|
+
- type: button
|
|
79
|
+
content: "Reset"
|
|
80
|
+
actions:
|
|
81
|
+
- what: setData
|
|
82
|
+
on: click
|
|
83
|
+
path: ~.makeEditable
|
|
84
|
+
value: false
|
|
85
|
+
stopPropagation: true
|
|
86
|
+
|
|
87
|
+
- type: input
|
|
88
|
+
attributes:
|
|
89
|
+
type: "text"
|
|
90
|
+
value: ~.input_value
|
|
91
|
+
placeholder: "Try typing here when readonly is removed..."
|
|
92
|
+
class: "ua-demo-input"
|
|
93
|
+
readonly: "readonly"
|
|
94
|
+
style:
|
|
95
|
+
padding: "10px"
|
|
96
|
+
border: "2px solid #007bff"
|
|
97
|
+
borderRadius: "4px"
|
|
98
|
+
fontSize: "16px"
|
|
99
|
+
margin: "10px 0"
|
|
100
|
+
width: "300px"
|
|
101
|
+
display: "block"
|
|
102
|
+
attributeTransforms:
|
|
103
|
+
- what: unsetAttribute
|
|
104
|
+
name: "readonly"
|
|
105
|
+
when: ~.makeEditable
|
|
106
|
+
is: true
|
|
107
|
+
actions:
|
|
108
|
+
- what: setData
|
|
109
|
+
on: change
|
|
110
|
+
path: ~.input_value
|
|
111
|
+
value: <reactive-json:event-new-value>
|
|
112
|
+
|
|
113
|
+
- type: style
|
|
114
|
+
content: |
|
|
115
|
+
.ua-demo-input[readonly] {
|
|
116
|
+
cursor: not-allowed !important;
|
|
117
|
+
opacity: 0.7 !important;
|
|
118
|
+
border-color: #6c757d !important;
|
|
119
|
+
}
|
|
120
|
+
.ua-demo-input:not([readonly]) {
|
|
121
|
+
border-color: #28a745 !important;
|
|
122
|
+
outline: 2px solid #28a745 !important;
|
|
123
|
+
outline-offset: 2px !important;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
data:
|
|
127
|
+
makeEditable: false
|
|
128
|
+
input_value: ""
|
|
129
|
+
|
|
130
|
+
- type: Markdown
|
|
131
|
+
content: |
|
|
132
|
+
## Notes
|
|
133
|
+
|
|
134
|
+
- This action **completely removes the entire attribute**, not just specific values.
|
|
135
|
+
- Use `UnsetAttributeValue` if you only want to remove specific values.
|
|
136
|
+
- The attribute can be restored using `SetAttributeValue` if needed.
|
|
137
|
+
- **Important**: To set an empty attribute (not remove it), use `SetAttributeValue` with an empty string value.
|
|
138
|
+
- Useful for conditional attribute presence rather than conditional values.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# unsetAttributeValue
|
|
2
|
+
|
|
3
|
+
> **Alternative**: For post-render DOM modification, see the [UnsetAttributeValue action](../action/Attribute/UnsetAttributeValue.md).
|
|
4
|
+
|
|
5
|
+
Removes a specific value from an HTML attribute while preserving other values. This attribute transformer allows you to conditionally remove specific values from space-separated attributes before rendering.
|
|
6
|
+
|
|
7
|
+
## Basic Syntax
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
attributeTransforms:
|
|
11
|
+
# Remove CSS class
|
|
12
|
+
- what: unsetAttributeValue
|
|
13
|
+
name: "class"
|
|
14
|
+
value: "highlighted"
|
|
15
|
+
|
|
16
|
+
# Remove with template
|
|
17
|
+
- what: unsetAttributeValue
|
|
18
|
+
name: "data-tags"
|
|
19
|
+
value: ~.tagToRemove
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Properties
|
|
23
|
+
|
|
24
|
+
- **name** *(string, required)*: The name of the attribute to modify.
|
|
25
|
+
- **separator** *(string, optional)*: The separator used between values. Default: `" "` (space).
|
|
26
|
+
- **unsetAllOccurrences** *(boolean, optional)*: When `true` (default), removes all occurrences of the value from the attribute. When `false`, removes the number of elements defined by `unsetCount`.
|
|
27
|
+
- **unsetCount** *(number, optional)*: Specifies the number of objects to remove. Supports template evaluation and is cast to integer. When `0`, removes nothing. When `1` or more, removes the specified number of elements starting from the beginning of the string. When `-1` or less, removes the specified number of elements starting from the end of the string. When undefined or invalid, defaults to removing all occurrences (equivalent to `unsetAllOccurrences: true`).
|
|
28
|
+
- **value** *(string, required)*: The value to remove from the attribute. Supports template evaluation (e.g., `~.dynamicValue`, `~~.globalValue`). Automatically converted to string if not already.
|
|
29
|
+
|
|
30
|
+
## Behavior
|
|
31
|
+
|
|
32
|
+
- **Selective removal**: Removes only the specified value from the attribute.
|
|
33
|
+
- **Occurrence control**: Removes all occurrences by default, or only the first when configured.
|
|
34
|
+
- **Count control**: When `unsetCount` is specified, controls the exact number of elements to remove and the direction (from beginning or end).
|
|
35
|
+
- **Preservation**: Other values in the attribute remain intact.
|
|
36
|
+
|
|
37
|
+
## Logic Reference
|
|
38
|
+
|
|
39
|
+
### Behavior Matrix
|
|
40
|
+
|
|
41
|
+
| `unsetAllOccurrences` | `unsetCount` | Behavior | Notes |
|
|
42
|
+
|:---------------------:|:------------:|:---------|:------|
|
|
43
|
+
| `true` | *ignored* | **Removes ALL occurrences** | `unsetCount` is completely ignored |
|
|
44
|
+
| `false` | `1` | Removes **1 occurrence** from beginning | Default behavior when `unsetCount` is valid |
|
|
45
|
+
| `false` | `2` | Removes **2 occurrences** from beginning | |
|
|
46
|
+
| `false` | `-1` | Removes **1 occurrence** from end | |
|
|
47
|
+
| `false` | `-2` | Removes **2 occurrences** from end | |
|
|
48
|
+
| `false` | `0` | **Removes nothing** | |
|
|
49
|
+
| `false` | `undefined` | **Removes ALL occurrences** | Fallback to "all" behavior |
|
|
50
|
+
| `false` | `null` | **Removes ALL occurrences** | Fallback to "all" behavior |
|
|
51
|
+
| `false` | `"invalid"` | **Removes ALL occurrences** | Fallback to "all" behavior |
|
|
52
|
+
| `undefined` | `1` | Removes **1 occurrence** from beginning | `unsetAllOccurrences` defaults to `true`, but valid `unsetCount` applies |
|
|
53
|
+
| `undefined` | `-1` | Removes **1 occurrence** from end | |
|
|
54
|
+
| `undefined` | `0` | **Removes nothing** | |
|
|
55
|
+
| `undefined` | `undefined` | **Removes ALL occurrences** | Complete default behavior |
|
|
56
|
+
|
|
57
|
+
### Logic Summary
|
|
58
|
+
|
|
59
|
+
1. **If `unsetAllOccurrences: true`** → removes ALL, ignores `unsetCount`
|
|
60
|
+
2. **If `unsetAllOccurrences: false` AND `unsetCount` valid** → uses `unsetCount`
|
|
61
|
+
3. **If `unsetCount` invalid/undefined** → fallback to "remove ALL" even if `unsetAllOccurrences: false`
|
|
62
|
+
4. **If nothing is defined** → default behavior = "remove ALL"
|
|
63
|
+
|
|
64
|
+
This logic ensures there is always a defined behavior, with an intelligent fallback to "remove all" when parameters are invalid.
|
|
65
|
+
|
|
66
|
+
## Common Use Cases
|
|
67
|
+
|
|
68
|
+
- **CSS class removal**: Removing specific CSS classes while keeping others.
|
|
69
|
+
- **Data attribute cleanup**: Removing specific values from space-separated data attributes.
|
|
70
|
+
- **Conditional styling**: Removing styling classes based on state changes.
|
|
71
|
+
|
|
72
|
+
## Example
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
renderView:
|
|
76
|
+
- type: button
|
|
77
|
+
content: "Remove 'highlighted' class"
|
|
78
|
+
actions:
|
|
79
|
+
- what: setData
|
|
80
|
+
on: click
|
|
81
|
+
path: ~.removeHighlight
|
|
82
|
+
value: true
|
|
83
|
+
stopPropagation: true
|
|
84
|
+
|
|
85
|
+
- type: button
|
|
86
|
+
content: "Reset"
|
|
87
|
+
actions:
|
|
88
|
+
- what: setData
|
|
89
|
+
on: click
|
|
90
|
+
path: ~.removeHighlight
|
|
91
|
+
value: false
|
|
92
|
+
stopPropagation: true
|
|
93
|
+
|
|
94
|
+
- type: input
|
|
95
|
+
attributes:
|
|
96
|
+
type: "text"
|
|
97
|
+
value: "This input has multiple classes..."
|
|
98
|
+
class: "uav-readonly uav-highlighted"
|
|
99
|
+
readonly: "readonly"
|
|
100
|
+
style:
|
|
101
|
+
padding: "10px"
|
|
102
|
+
border: "2px solid #007bff"
|
|
103
|
+
borderRadius: "4px"
|
|
104
|
+
fontSize: "16px"
|
|
105
|
+
margin: "10px 0"
|
|
106
|
+
width: "300px"
|
|
107
|
+
display: "block"
|
|
108
|
+
attributeTransforms:
|
|
109
|
+
- what: unsetAttributeValue
|
|
110
|
+
name: "class"
|
|
111
|
+
value: "uav-highlighted"
|
|
112
|
+
when: ~.removeHighlight
|
|
113
|
+
is: true
|
|
114
|
+
|
|
115
|
+
- type: style
|
|
116
|
+
content: |
|
|
117
|
+
.uav-readonly {
|
|
118
|
+
cursor: not-allowed !important;
|
|
119
|
+
opacity: 0.7 !important;
|
|
120
|
+
}
|
|
121
|
+
.uav-highlighted {
|
|
122
|
+
border-color: #ffc107 !important;
|
|
123
|
+
outline: 2px solid #ffc107 !important;
|
|
124
|
+
outline-offset: 2px !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
data:
|
|
128
|
+
removeHighlight: false
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Notes
|
|
132
|
+
|
|
133
|
+
- **Pre-render execution**: This transformer removes attribute values before the component renders, ensuring child components receive the transformed attributes.
|
|
134
|
+
- **Selective removal**: Only removes exact matches of the specified value.
|
|
135
|
+
- **Value preservation**: Maintains the integrity of other attribute values.
|
|
136
|
+
- **Separator support**: Works with any space-separated attribute values.
|
|
137
|
+
- **Safe operation**: Safe to use even if the value doesn't exist in the attribute.
|
|
138
|
+
- **Template evaluation**: The value property supports full template evaluation including `~.localData`, `~~.globalData`, `~>nearestKey`, and `~~>globalKey` patterns.
|
|
139
|
+
- **Count control**: Advanced removal patterns with `unsetCount` and `unsetAllOccurrences` for precise control.
|
|
140
|
+
- **Conditional execution**: Supports the same condition system as actions (`when`, `is`, `isEmpty`, `isNotEmpty`, etc.).
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# unsetAttributeValue
|
|
5
|
+
|
|
6
|
+
> **Alternative**: For post-render DOM modification, see the [UnsetAttributeValue action](../action/Attribute/UnsetAttributeValue).
|
|
7
|
+
|
|
8
|
+
Removes a specific value from an HTML attribute while preserving other values.
|
|
9
|
+
|
|
10
|
+
## Basic Syntax
|
|
11
|
+
|
|
12
|
+
- type: TabbedSerializer
|
|
13
|
+
yamlSerializedContent: |
|
|
14
|
+
attributeTransforms:
|
|
15
|
+
# Remove CSS class
|
|
16
|
+
- what: unsetAttributeValue
|
|
17
|
+
name: "class"
|
|
18
|
+
value: "highlighted"
|
|
19
|
+
|
|
20
|
+
# Remove with template
|
|
21
|
+
- what: unsetAttributeValue
|
|
22
|
+
name: "data-tags"
|
|
23
|
+
value: ~.tagToRemove
|
|
24
|
+
|
|
25
|
+
- type: Markdown
|
|
26
|
+
content: |
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
- type: DefinitionList
|
|
30
|
+
content:
|
|
31
|
+
- term:
|
|
32
|
+
code: name
|
|
33
|
+
after: "(string, required)"
|
|
34
|
+
details: The name of the attribute to modify.
|
|
35
|
+
- term:
|
|
36
|
+
code: separator
|
|
37
|
+
after: "(string, optional)"
|
|
38
|
+
details:
|
|
39
|
+
type: Markdown
|
|
40
|
+
content: |
|
|
41
|
+
The separator used between values. Default: `" "` (space).
|
|
42
|
+
- term:
|
|
43
|
+
code: unsetAllOccurrences
|
|
44
|
+
after: "(boolean, optional)"
|
|
45
|
+
details:
|
|
46
|
+
type: Markdown
|
|
47
|
+
content: |
|
|
48
|
+
When `true` (default), removes all occurrences of the value from the attribute. When `false`, removes the number of elements defined by `unsetCount`.
|
|
49
|
+
- term:
|
|
50
|
+
code: unsetCount
|
|
51
|
+
after: "(number, optional)"
|
|
52
|
+
details:
|
|
53
|
+
type: Markdown
|
|
54
|
+
content: |
|
|
55
|
+
Specifies the number of objects to remove. Supports template evaluation and is cast to integer. When `0`, removes nothing. When `1` or more, removes the specified number of elements starting from the beginning of the string. When `-1` or less, removes the specified number of elements starting from the end of the string. When undefined or invalid, defaults to removing all occurrences (equivalent to `unsetAllOccurrences: true`).
|
|
56
|
+
- term:
|
|
57
|
+
code: value
|
|
58
|
+
after: "(string, required)"
|
|
59
|
+
details:
|
|
60
|
+
type: Markdown
|
|
61
|
+
content: |
|
|
62
|
+
The value to remove from the attribute. Supports template evaluation (e.g., `~.dynamicValue`, `~~.globalValue`). Automatically converted to string if not already.
|
|
63
|
+
|
|
64
|
+
- type: Markdown
|
|
65
|
+
content: |
|
|
66
|
+
## Behavior
|
|
67
|
+
|
|
68
|
+
- **Selective removal**: Removes only the specified value from the attribute.
|
|
69
|
+
- **Occurrence control**: Removes all occurrences by default, or only the first when configured.
|
|
70
|
+
- **Count control**: When `unsetCount` is specified, controls the exact number of elements to remove and the direction (from beginning or end).
|
|
71
|
+
- **Preservation**: Other values in the attribute remain intact.
|
|
72
|
+
|
|
73
|
+
## Logic Reference
|
|
74
|
+
|
|
75
|
+
### Behavior Matrix
|
|
76
|
+
|
|
77
|
+
| `unsetAllOccurrences` | `unsetCount` | Behavior | Notes |
|
|
78
|
+
|:---------------------:|:------------:|:---------|:------|
|
|
79
|
+
| `true` | *ignored* | **Removes ALL occurrences** | `unsetCount` is completely ignored |
|
|
80
|
+
| `false` | `1` | Removes **1 occurrence** from beginning | Default behavior when `unsetCount` is valid |
|
|
81
|
+
| `false` | `2` | Removes **2 occurrences** from beginning | |
|
|
82
|
+
| `false` | `-1` | Removes **1 occurrence** from end | |
|
|
83
|
+
| `false` | `-2` | Removes **2 occurrences** from end | |
|
|
84
|
+
| `false` | `0` | **Removes nothing** | |
|
|
85
|
+
| `false` | `undefined` | **Removes ALL occurrences** | Fallback to "all" behavior |
|
|
86
|
+
| `false` | `null` | **Removes ALL occurrences** | Fallback to "all" behavior |
|
|
87
|
+
| `false` | `"invalid"` | **Removes ALL occurrences** | Fallback to "all" behavior |
|
|
88
|
+
| `undefined` | `1` | Removes **1 occurrence** from beginning | `unsetAllOccurrences` defaults to `true`, but valid `unsetCount` applies |
|
|
89
|
+
| `undefined` | `-1` | Removes **1 occurrence** from end | |
|
|
90
|
+
| `undefined` | `0` | **Removes nothing** | |
|
|
91
|
+
| `undefined` | `undefined` | **Removes ALL occurrences** | Complete default behavior |
|
|
92
|
+
|
|
93
|
+
### Logic Summary
|
|
94
|
+
|
|
95
|
+
1. **If `unsetAllOccurrences: true`** → removes ALL, ignores `unsetCount`
|
|
96
|
+
2. **If `unsetAllOccurrences: false` AND `unsetCount` valid** → uses `unsetCount`
|
|
97
|
+
3. **If `unsetCount` invalid/undefined** → fallback to "remove ALL" even if `unsetAllOccurrences: false`
|
|
98
|
+
4. **If nothing is defined** → default behavior = "remove ALL"
|
|
99
|
+
|
|
100
|
+
This logic ensures there is always a defined behavior, with an intelligent fallback to "remove all" when parameters are invalid.
|
|
101
|
+
|
|
102
|
+
## Common Use Cases
|
|
103
|
+
|
|
104
|
+
- **CSS class removal**: Removing specific CSS classes while keeping others.
|
|
105
|
+
- **Data attribute cleanup**: Removing specific values from space-separated data attributes.
|
|
106
|
+
- **Conditional styling**: Removing styling classes based on state changes.
|
|
107
|
+
|
|
108
|
+
- type: RjBuildDescriber
|
|
109
|
+
title: "UnsetAttributeValue Action Examples"
|
|
110
|
+
description:
|
|
111
|
+
- type: Markdown
|
|
112
|
+
content: |
|
|
113
|
+
This example demonstrates how to selectively remove specific CSS classes using the `UnsetAttributeValue` action.
|
|
114
|
+
|
|
115
|
+
**Expected behavior:**
|
|
116
|
+
- Initially, the input field has both 'readonly' and 'highlighted' classes (readonly + visual styling)
|
|
117
|
+
- Click "Remove 'highlighted' class" to remove only the 'highlighted' class (removing visual styling but keeping readonly)
|
|
118
|
+
- Click "Reset" to restore the original classes
|
|
119
|
+
- Notice how only the specified value is removed while other classes remain intact
|
|
120
|
+
|
|
121
|
+
Try interacting with the buttons to see how specific classes are selectively removed.
|
|
122
|
+
|
|
123
|
+
toDescribe:
|
|
124
|
+
renderView:
|
|
125
|
+
- type: button
|
|
126
|
+
content: "Remove 'highlighted' class"
|
|
127
|
+
actions:
|
|
128
|
+
- what: setData
|
|
129
|
+
on: click
|
|
130
|
+
path: ~.removeHighlight
|
|
131
|
+
value: true
|
|
132
|
+
stopPropagation: true
|
|
133
|
+
|
|
134
|
+
- type: button
|
|
135
|
+
content: "Reset"
|
|
136
|
+
actions:
|
|
137
|
+
- what: setData
|
|
138
|
+
on: click
|
|
139
|
+
path: ~.removeHighlight
|
|
140
|
+
value: false
|
|
141
|
+
stopPropagation: true
|
|
142
|
+
|
|
143
|
+
- type: input
|
|
144
|
+
attributes:
|
|
145
|
+
type: "text"
|
|
146
|
+
value: "This input has multiple classes..."
|
|
147
|
+
class: "uav-readonly uav-highlighted"
|
|
148
|
+
readonly: "readonly"
|
|
149
|
+
style:
|
|
150
|
+
padding: "10px"
|
|
151
|
+
border: "2px solid #007bff"
|
|
152
|
+
borderRadius: "4px"
|
|
153
|
+
fontSize: "16px"
|
|
154
|
+
margin: "10px 0"
|
|
155
|
+
width: "300px"
|
|
156
|
+
display: "block"
|
|
157
|
+
attributeTransforms:
|
|
158
|
+
- what: unsetAttributeValue
|
|
159
|
+
name: "class"
|
|
160
|
+
value: "uav-highlighted"
|
|
161
|
+
when: ~.removeHighlight
|
|
162
|
+
is: true
|
|
163
|
+
|
|
164
|
+
- type: style
|
|
165
|
+
content: |
|
|
166
|
+
.uav-readonly {
|
|
167
|
+
cursor: not-allowed !important;
|
|
168
|
+
opacity: 0.7 !important;
|
|
169
|
+
}
|
|
170
|
+
.uav-highlighted {
|
|
171
|
+
border-color: #ffc107 !important;
|
|
172
|
+
outline: 2px solid #ffc107 !important;
|
|
173
|
+
outline-offset: 2px !important;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
data:
|
|
177
|
+
removeHighlight: false
|
|
178
|
+
|
|
179
|
+
- type: Markdown
|
|
180
|
+
content: |
|
|
181
|
+
## Notes
|
|
182
|
+
|
|
183
|
+
- Only removes exact matches of the specified value.
|
|
184
|
+
- Maintains the integrity of other attribute values.
|
|
185
|
+
- Works with any space-separated attribute values.
|
|
186
|
+
- Safe to use even if the value doesn't exist in the attribute.
|
|
187
|
+
- The value property supports full template evaluation including `~.localData`, `~~.globalData`, `~>nearestKey`, and `~~>globalKey` patterns.
|
|
@@ -134,10 +134,15 @@ renderView:
|
|
|
134
134
|
version: "v1.2.3"
|
|
135
135
|
status: "success"
|
|
136
136
|
|
|
137
|
-
- type:
|
|
137
|
+
- type: button
|
|
138
138
|
content: "Simulate API Call with Data Mapping"
|
|
139
139
|
attributes:
|
|
140
|
-
|
|
140
|
+
style:
|
|
141
|
+
padding: "8px 16px"
|
|
142
|
+
margin: "8px 0"
|
|
143
|
+
border: "1px solid #007bff"
|
|
144
|
+
borderRadius: "4px"
|
|
145
|
+
cursor: "pointer"
|
|
141
146
|
actions:
|
|
142
147
|
- what: fetchData
|
|
143
148
|
on: click
|
|
@@ -250,10 +255,15 @@ renderView:
|
|
|
250
255
|
|
|
251
256
|
The mapping below tries to extract `user.name` and `user.email` which don't exist in this response, triggering the `onErrorMap` fallback values.
|
|
252
257
|
|
|
253
|
-
- type:
|
|
258
|
+
- type: button
|
|
254
259
|
content: "Test Missing Data Handling"
|
|
255
260
|
attributes:
|
|
256
|
-
|
|
261
|
+
style:
|
|
262
|
+
padding: "8px 16px"
|
|
263
|
+
margin: "8px 0"
|
|
264
|
+
border: "1px solid #ffc107"
|
|
265
|
+
borderRadius: "4px"
|
|
266
|
+
cursor: "pointer"
|
|
257
267
|
actions:
|
|
258
268
|
- what: fetchData
|
|
259
269
|
on: click
|