@ea-lab/reactive-json-docs 0.1.2
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/README-npm.md +49 -0
- package/README.md +86 -0
- package/package.json +79 -0
- package/public/rjbuild/component-doc/chartjs/components.yaml +252 -0
- package/public/rjbuild/component-doc/chartjs/overview.yaml +51 -0
- package/public/rjbuild/component-doc/core/action/HashChangeListener.md +90 -0
- package/public/rjbuild/component-doc/core/action/HashChangeListener.yaml +124 -0
- package/public/rjbuild/component-doc/core/action/Hide.md +22 -0
- package/public/rjbuild/component-doc/core/action/Hide.yaml +60 -0
- package/public/rjbuild/component-doc/core/action/MessageListener.md +93 -0
- package/public/rjbuild/component-doc/core/action/MessageListener.yaml +153 -0
- package/public/rjbuild/component-doc/core/action/Popover.md +26 -0
- package/public/rjbuild/component-doc/core/action/Popover.yaml +100 -0
- package/public/rjbuild/component-doc/core/action/ReactOnEvent.md +81 -0
- package/public/rjbuild/component-doc/core/action/ReactOnEvent.yaml +133 -0
- package/public/rjbuild/component-doc/core/action/Redirect.md +20 -0
- package/public/rjbuild/component-doc/core/action/Redirect.yaml +68 -0
- package/public/rjbuild/component-doc/core/action/Tooltip.md +22 -0
- package/public/rjbuild/component-doc/core/action/Tooltip.yaml +90 -0
- package/public/rjbuild/component-doc/core/action/VisuallyHide.md +21 -0
- package/public/rjbuild/component-doc/core/action/VisuallyHide.yaml +62 -0
- package/public/rjbuild/component-doc/core/action/index.md +214 -0
- package/public/rjbuild/component-doc/core/action/index.yaml +278 -0
- package/public/rjbuild/component-doc/core/element/form/CheckBoxField.md +276 -0
- package/public/rjbuild/component-doc/core/element/form/CheckBoxField.yaml +338 -0
- package/public/rjbuild/component-doc/core/element/form/DateField.md +189 -0
- package/public/rjbuild/component-doc/core/element/form/DateField.yaml +264 -0
- package/public/rjbuild/component-doc/core/element/form/NumberField.md +136 -0
- package/public/rjbuild/component-doc/core/element/form/NumberField.yaml +103 -0
- package/public/rjbuild/component-doc/core/element/form/SelectField.md +304 -0
- package/public/rjbuild/component-doc/core/element/form/SelectField.yaml +360 -0
- package/public/rjbuild/component-doc/core/element/form/TextAreaField.md +134 -0
- package/public/rjbuild/component-doc/core/element/form/TextAreaField.yaml +146 -0
- package/public/rjbuild/component-doc/core/element/form/TextField.md +129 -0
- package/public/rjbuild/component-doc/core/element/form/TextField.yaml +147 -0
- package/public/rjbuild/component-doc/core/element/form/formElementsCommon.md +106 -0
- package/public/rjbuild/component-doc/core/element/form/index.md +50 -0
- package/public/rjbuild/component-doc/core/element/form/index.yaml +96 -0
- package/public/rjbuild/component-doc/core/element/html/AccordionItem.yaml +47 -0
- package/public/rjbuild/component-doc/core/element/html/FolderSortableTree.yaml +81 -0
- package/public/rjbuild/component-doc/core/element/html/FormatNumeral.yaml +58 -0
- package/public/rjbuild/component-doc/core/element/html/Html.yaml +67 -0
- package/public/rjbuild/component-doc/core/element/html/LabelFromValue.yaml +54 -0
- package/public/rjbuild/component-doc/core/element/html/Modal.yaml +93 -0
- package/public/rjbuild/component-doc/core/element/html/PreformattedMarkup.yaml +37 -0
- package/public/rjbuild/component-doc/core/element/html/SortableTreeItemCollapseButton.yaml +92 -0
- package/public/rjbuild/component-doc/core/element/html/Tabs.yaml +57 -0
- package/public/rjbuild/component-doc/core/element/special/BootstrapElement.md +17 -0
- package/public/rjbuild/component-doc/core/element/special/BootstrapElement.yaml +18 -0
- package/public/rjbuild/component-doc/core/element/special/Count.md +37 -0
- package/public/rjbuild/component-doc/core/element/special/Count.yaml +325 -0
- package/public/rjbuild/component-doc/core/element/special/DataFilter.md +149 -0
- package/public/rjbuild/component-doc/core/element/special/DataFilter.yaml +315 -0
- package/public/rjbuild/component-doc/core/element/special/DelayedActions.md +51 -0
- package/public/rjbuild/component-doc/core/element/special/DelayedActions.yaml +55 -0
- package/public/rjbuild/component-doc/core/element/special/PageControls.md +126 -0
- package/public/rjbuild/component-doc/core/element/special/PageControls.yaml +133 -0
- package/public/rjbuild/component-doc/core/element/special/Phantom.md +31 -0
- package/public/rjbuild/component-doc/core/element/special/Phantom.yaml +34 -0
- package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.md +27 -0
- package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.yaml +51 -0
- package/public/rjbuild/component-doc/core/element/special/Switch.md +262 -0
- package/public/rjbuild/component-doc/core/element/special/Switch.yaml +348 -0
- package/public/rjbuild/component-doc/core/example/accordion.md +96 -0
- package/public/rjbuild/component-doc/core/example/accordion.yaml +64 -0
- package/public/rjbuild/component-doc/core/example/dynamic-content.md +197 -0
- package/public/rjbuild/component-doc/core/example/dynamic-content.yaml +237 -0
- package/public/rjbuild/component-doc/core/example/html.md +66 -0
- package/public/rjbuild/component-doc/core/example/html.yaml +83 -0
- package/public/rjbuild/component-doc/core/example/website.yaml +1663 -0
- package/public/rjbuild/component-doc/core/reaction/addData.md +96 -0
- package/public/rjbuild/component-doc/core/reaction/addData.yaml +133 -0
- package/public/rjbuild/component-doc/core/reaction/fetchData.md +60 -0
- package/public/rjbuild/component-doc/core/reaction/fetchData.yaml +156 -0
- package/public/rjbuild/component-doc/core/reaction/index.md +236 -0
- package/public/rjbuild/component-doc/core/reaction/index.yaml +254 -0
- package/public/rjbuild/component-doc/core/reaction/moveData.md +68 -0
- package/public/rjbuild/component-doc/core/reaction/moveData.yaml +71 -0
- package/public/rjbuild/component-doc/core/reaction/postMessage.md +63 -0
- package/public/rjbuild/component-doc/core/reaction/postMessage.yaml +68 -0
- package/public/rjbuild/component-doc/core/reaction/redirectNow.md +37 -0
- package/public/rjbuild/component-doc/core/reaction/redirectNow.yaml +37 -0
- package/public/rjbuild/component-doc/core/reaction/removeData.md +78 -0
- package/public/rjbuild/component-doc/core/reaction/removeData.yaml +56 -0
- package/public/rjbuild/component-doc/core/reaction/setClipboardData.md +44 -0
- package/public/rjbuild/component-doc/core/reaction/setClipboardData.yaml +41 -0
- package/public/rjbuild/component-doc/core/reaction/setData.md +93 -0
- package/public/rjbuild/component-doc/core/reaction/setData.yaml +85 -0
- package/public/rjbuild/component-doc/core/reaction/submitData.md +138 -0
- package/public/rjbuild/component-doc/core/reaction/submitData.yaml +141 -0
- package/public/rjbuild/component-doc/core/reaction/triggerEvent.md +59 -0
- package/public/rjbuild/component-doc/core/reaction/triggerEvent.yaml +59 -0
- package/public/rjbuild/component-doc/index.yaml +13 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# Switch
|
|
5
|
+
|
|
6
|
+
The `Switch` component allows you to render a list or collection of items using a template, with support for dynamic data, options, and pagination. It is useful for displaying arrays, lists, or collections where each item can be rendered with a specific template or configuration.
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
- `content` (object/array/string, required): The data or path to the data to iterate over
|
|
10
|
+
- `options` (object, optional): Mapping of keys to templates for rendering each item (used for object/array of objects)
|
|
11
|
+
- `singleOption` (object, optional): Template to use for each item when all items share the same structure
|
|
12
|
+
- `cardinality` (number, optional): Maximum number of items to render (default: unlimited)
|
|
13
|
+
- `paginated` (boolean, optional): Whether to enable pagination (default: false)
|
|
14
|
+
- `paginationProps` (object, optional): Pagination configuration (page size, etc.)
|
|
15
|
+
- `before` (object, optional): Content to render before the list
|
|
16
|
+
- `after` (object, optional): Content to render after the list
|
|
17
|
+
- `contentWrapper` (object, optional): HTML element configuration to wrap the main content (items only, not before/after)
|
|
18
|
+
- `tag` (string, optional): HTML tag name (default: "div")
|
|
19
|
+
- `attributes` (object, optional): HTML attributes to apply to the wrapper element (supports template evaluation)
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
- Iterates over the provided data and renders each item using the specified template(s)
|
|
23
|
+
- If `options` is provided, uses the corresponding template for each key
|
|
24
|
+
- If `singleOption` is provided, uses the same template for all items
|
|
25
|
+
- Supports limiting the number of items with `cardinality`
|
|
26
|
+
- Supports pagination if `paginated` is true
|
|
27
|
+
- Renders optional `before` and `after` content
|
|
28
|
+
- Can wrap the main content (items) with a custom HTML element using `contentWrapper`
|
|
29
|
+
|
|
30
|
+
## Content Wrapper Feature
|
|
31
|
+
|
|
32
|
+
The `contentWrapper` property allows you to wrap the rendered items in a custom HTML element without affecting the `before` and `after` content. This is particularly useful for applying CSS layouts like Grid or Flexbox to the items.
|
|
33
|
+
|
|
34
|
+
**Note**: The `attributes` property of `contentWrapper` supports template evaluation, allowing you to create dynamic wrapper configurations based on your data.
|
|
35
|
+
|
|
36
|
+
### Structure
|
|
37
|
+
```
|
|
38
|
+
before (optional)
|
|
39
|
+
└── contentWrapper (optional)
|
|
40
|
+
└── rendered items
|
|
41
|
+
after (optional)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The wrapper only affects the main content items and does not interfere with pagination or other Switch features.
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
```yaml
|
|
48
|
+
renderView:
|
|
49
|
+
- type: Switch
|
|
50
|
+
content: ~.users
|
|
51
|
+
singleOption:
|
|
52
|
+
load: opt
|
|
53
|
+
paginated: true
|
|
54
|
+
paginationProps:
|
|
55
|
+
pageMaxItemCount: 2
|
|
56
|
+
templates:
|
|
57
|
+
opt:
|
|
58
|
+
type: div
|
|
59
|
+
content: ~.name
|
|
60
|
+
data:
|
|
61
|
+
users:
|
|
62
|
+
- name: "Alice"
|
|
63
|
+
- name: "Bob"
|
|
64
|
+
- name: "Charlie"
|
|
65
|
+
- name: "Diana"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Limitations
|
|
69
|
+
- The data must be an array or object; strings and numbers are not supported
|
|
70
|
+
- If both `options` and `singleOption` are provided, `singleOption` takes precedence
|
|
71
|
+
- No built-in support for filtering or sorting (use DataFilter or custom logic)
|
|
72
|
+
- Pagination requires the `paginated` property to be set to true
|
|
73
|
+
|
|
74
|
+
### Data Structure Requirements
|
|
75
|
+
Switch requires each item in the data to be an object, not a primitive value:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
# ❌ This will NOT work:
|
|
79
|
+
data:
|
|
80
|
+
items: ["string1", "string2", "string3"]
|
|
81
|
+
|
|
82
|
+
# ✅ This will work:
|
|
83
|
+
data:
|
|
84
|
+
items:
|
|
85
|
+
- name: "string1"
|
|
86
|
+
- name: "string2"
|
|
87
|
+
- name: "string3"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- type: RjBuildDescriber
|
|
91
|
+
title: "1. Simple usage with `singleOption` (no pagination)"
|
|
92
|
+
description: |
|
|
93
|
+
This example shows a basic Switch rendering a list of users with a single template.
|
|
94
|
+
toDescribe:
|
|
95
|
+
renderView:
|
|
96
|
+
- type: Switch
|
|
97
|
+
content: ~.users
|
|
98
|
+
singleOption:
|
|
99
|
+
load: opt
|
|
100
|
+
templates:
|
|
101
|
+
opt:
|
|
102
|
+
type: div
|
|
103
|
+
content: ~.name
|
|
104
|
+
data:
|
|
105
|
+
users:
|
|
106
|
+
- name: "Alice"
|
|
107
|
+
- name: "Bob"
|
|
108
|
+
- name: "Charlie"
|
|
109
|
+
|
|
110
|
+
- type: RjBuildDescriber
|
|
111
|
+
title: "2. Usage with `options` (different templates per key)"
|
|
112
|
+
description: |
|
|
113
|
+
This example shows how to use different templates for each key in the data.
|
|
114
|
+
toDescribe:
|
|
115
|
+
renderView:
|
|
116
|
+
- type: Switch
|
|
117
|
+
content: ~.items
|
|
118
|
+
options:
|
|
119
|
+
name:
|
|
120
|
+
load: name
|
|
121
|
+
age:
|
|
122
|
+
load: age
|
|
123
|
+
templates:
|
|
124
|
+
name:
|
|
125
|
+
type: div
|
|
126
|
+
content: [ "Name: ", ~.value ]
|
|
127
|
+
age:
|
|
128
|
+
type: div
|
|
129
|
+
content: [ "Age: ", ~.value ]
|
|
130
|
+
data:
|
|
131
|
+
items:
|
|
132
|
+
- name:
|
|
133
|
+
value: "Alice"
|
|
134
|
+
- age:
|
|
135
|
+
value: 30
|
|
136
|
+
- name:
|
|
137
|
+
value: "Bob"
|
|
138
|
+
- age:
|
|
139
|
+
value: 25
|
|
140
|
+
|
|
141
|
+
- type: RjBuildDescriber
|
|
142
|
+
title: "3. Usage with `singleOption` and pagination (4 per page, 10 items)"
|
|
143
|
+
description: |
|
|
144
|
+
This example demonstrates pagination with 4 items per page and 10 items in total. PageControls is added to the end of the list.
|
|
145
|
+
toDescribe:
|
|
146
|
+
renderView:
|
|
147
|
+
- type: Switch
|
|
148
|
+
content: ~.numbers
|
|
149
|
+
singleOption: { load: opt }
|
|
150
|
+
paginated: true
|
|
151
|
+
paginationProps:
|
|
152
|
+
pageMaxItemCount: 4
|
|
153
|
+
before:
|
|
154
|
+
type: div
|
|
155
|
+
content: "User list:"
|
|
156
|
+
after:
|
|
157
|
+
type: PageControls
|
|
158
|
+
templates:
|
|
159
|
+
opt:
|
|
160
|
+
type: div
|
|
161
|
+
content: [ "Number: ", ~.value ]
|
|
162
|
+
data:
|
|
163
|
+
numbers:
|
|
164
|
+
- value: 1
|
|
165
|
+
- value: 2
|
|
166
|
+
- value: 3
|
|
167
|
+
- value: 4
|
|
168
|
+
- value: 5
|
|
169
|
+
- value: 6
|
|
170
|
+
- value: 7
|
|
171
|
+
- value: 8
|
|
172
|
+
- value: 9
|
|
173
|
+
- value: 10
|
|
174
|
+
|
|
175
|
+
- type: RjBuildDescriber
|
|
176
|
+
title: "4. Usage with `contentWrapper` for CSS Grid Layout"
|
|
177
|
+
description: |
|
|
178
|
+
This example demonstrates how to use contentWrapper to apply a CSS Grid layout to the Switch items.
|
|
179
|
+
toDescribe:
|
|
180
|
+
renderView:
|
|
181
|
+
- type: Switch
|
|
182
|
+
content: ~.products
|
|
183
|
+
singleOption:
|
|
184
|
+
load: productCard
|
|
185
|
+
contentWrapper:
|
|
186
|
+
tag: div
|
|
187
|
+
attributes:
|
|
188
|
+
style:
|
|
189
|
+
display: grid
|
|
190
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))"
|
|
191
|
+
gap: 1rem
|
|
192
|
+
padding: 1rem
|
|
193
|
+
backgroundColor: "#f8f9fa"
|
|
194
|
+
borderRadius: 8px
|
|
195
|
+
before:
|
|
196
|
+
type: h3
|
|
197
|
+
content: "Our Products"
|
|
198
|
+
after:
|
|
199
|
+
type: div
|
|
200
|
+
attributes:
|
|
201
|
+
style:
|
|
202
|
+
textAlign: center
|
|
203
|
+
marginTop: 1rem
|
|
204
|
+
color: "#666"
|
|
205
|
+
content: "End of product list"
|
|
206
|
+
templates:
|
|
207
|
+
productCard:
|
|
208
|
+
type: div
|
|
209
|
+
attributes:
|
|
210
|
+
style:
|
|
211
|
+
border: "1px solid #ddd"
|
|
212
|
+
borderRadius: 8px
|
|
213
|
+
padding: 1rem
|
|
214
|
+
backgroundColor: white
|
|
215
|
+
textAlign: center
|
|
216
|
+
content:
|
|
217
|
+
- type: h4
|
|
218
|
+
attributes:
|
|
219
|
+
style:
|
|
220
|
+
margin: "0 0 0.5rem 0"
|
|
221
|
+
color: "#333"
|
|
222
|
+
content: ~.name
|
|
223
|
+
- type: p
|
|
224
|
+
attributes:
|
|
225
|
+
style:
|
|
226
|
+
margin: 0
|
|
227
|
+
color: "#666"
|
|
228
|
+
fontSize: "0.9rem"
|
|
229
|
+
content: ~.description
|
|
230
|
+
data:
|
|
231
|
+
products:
|
|
232
|
+
- name: "Product A"
|
|
233
|
+
description: "High-quality product A"
|
|
234
|
+
- name: "Product B"
|
|
235
|
+
description: "Reliable product B"
|
|
236
|
+
- name: "Product C"
|
|
237
|
+
description: "Premium product C"
|
|
238
|
+
- name: "Product D"
|
|
239
|
+
description: "Affordable product D"
|
|
240
|
+
|
|
241
|
+
- type: RjBuildDescriber
|
|
242
|
+
title: "5. Usage with `contentWrapper` and Pagination"
|
|
243
|
+
description: |
|
|
244
|
+
This example shows how contentWrapper works seamlessly with pagination.
|
|
245
|
+
toDescribe:
|
|
246
|
+
renderView:
|
|
247
|
+
- type: Switch
|
|
248
|
+
content: ~.cards
|
|
249
|
+
singleOption:
|
|
250
|
+
load: card
|
|
251
|
+
paginated: true
|
|
252
|
+
paginationProps:
|
|
253
|
+
pageMaxItemCount: 3
|
|
254
|
+
contentWrapper:
|
|
255
|
+
tag: section
|
|
256
|
+
attributes:
|
|
257
|
+
class: "card-grid"
|
|
258
|
+
style:
|
|
259
|
+
display: flex
|
|
260
|
+
flexWrap: wrap
|
|
261
|
+
gap: 1rem
|
|
262
|
+
justifyContent: center
|
|
263
|
+
padding: 1rem
|
|
264
|
+
border: "2px dashed #ccc"
|
|
265
|
+
borderRadius: 8px
|
|
266
|
+
after:
|
|
267
|
+
type: PageControls
|
|
268
|
+
templates:
|
|
269
|
+
card:
|
|
270
|
+
type: div
|
|
271
|
+
attributes:
|
|
272
|
+
style:
|
|
273
|
+
flex: "0 1 150px"
|
|
274
|
+
padding: 1rem
|
|
275
|
+
backgroundColor: "#e3f2fd"
|
|
276
|
+
borderRadius: 8px
|
|
277
|
+
textAlign: center
|
|
278
|
+
border: "1px solid #90caf9"
|
|
279
|
+
content: ~.title
|
|
280
|
+
data:
|
|
281
|
+
cards:
|
|
282
|
+
- title: "Card 1"
|
|
283
|
+
- title: "Card 2"
|
|
284
|
+
- title: "Card 3"
|
|
285
|
+
- title: "Card 4"
|
|
286
|
+
- title: "Card 5"
|
|
287
|
+
- title: "Card 6"
|
|
288
|
+
- title: "Card 7"
|
|
289
|
+
|
|
290
|
+
- type: RjBuildDescriber
|
|
291
|
+
title: "6. Dynamic `contentWrapper` with Template Evaluation"
|
|
292
|
+
description: |
|
|
293
|
+
This example demonstrates how contentWrapper attributes can use template evaluation to create dynamic layouts.
|
|
294
|
+
toDescribe:
|
|
295
|
+
renderView:
|
|
296
|
+
- type: Switch
|
|
297
|
+
content: ~.items
|
|
298
|
+
singleOption:
|
|
299
|
+
load: dynamicCard
|
|
300
|
+
contentWrapper:
|
|
301
|
+
tag: section
|
|
302
|
+
attributes:
|
|
303
|
+
class: ~.wrapperConfig.cssClass
|
|
304
|
+
style:
|
|
305
|
+
display: grid
|
|
306
|
+
gridTemplateColumns: ~.wrapperConfig.columns
|
|
307
|
+
gap: ~.wrapperConfig.spacing
|
|
308
|
+
padding: ~.wrapperConfig.padding
|
|
309
|
+
backgroundColor: ~.theme.background
|
|
310
|
+
border: ~.theme.border
|
|
311
|
+
borderRadius: ~.theme.borderRadius
|
|
312
|
+
before:
|
|
313
|
+
type: h3
|
|
314
|
+
attributes:
|
|
315
|
+
style:
|
|
316
|
+
color: ~.theme.titleColor
|
|
317
|
+
textAlign: center
|
|
318
|
+
content: ~.title
|
|
319
|
+
templates:
|
|
320
|
+
dynamicCard:
|
|
321
|
+
type: div
|
|
322
|
+
attributes:
|
|
323
|
+
style:
|
|
324
|
+
padding: 1rem
|
|
325
|
+
backgroundColor: ~.theme.cardBackground
|
|
326
|
+
borderRadius: 6px
|
|
327
|
+
textAlign: center
|
|
328
|
+
color: ~.theme.textColor
|
|
329
|
+
content: ~.name
|
|
330
|
+
data:
|
|
331
|
+
title: "Dynamic Gallery"
|
|
332
|
+
wrapperConfig:
|
|
333
|
+
cssClass: "dynamic-gallery"
|
|
334
|
+
columns: "repeat(auto-fit, minmax(150px, 1fr))"
|
|
335
|
+
spacing: "1.5rem"
|
|
336
|
+
padding: "2rem"
|
|
337
|
+
theme:
|
|
338
|
+
background: "#e8f4fd"
|
|
339
|
+
border: "2px solid #2196f3"
|
|
340
|
+
borderRadius: "12px"
|
|
341
|
+
titleColor: "#1976d2"
|
|
342
|
+
cardBackground: "#ffffff"
|
|
343
|
+
textColor: "#333333"
|
|
344
|
+
items:
|
|
345
|
+
- name: "Element A"
|
|
346
|
+
- name: "Element B"
|
|
347
|
+
- name: "Element C"
|
|
348
|
+
- name: "Element D"
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Accordion Component Examples
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Accordion component in Reactive-JSON is powered by Bootstrap and provides a collapsible content interface. This component is perfect for organizing content in an expandable/collapsible format.
|
|
6
|
+
|
|
7
|
+
## Basic Usage
|
|
8
|
+
|
|
9
|
+
The basic structure consists of a `BsAccordion` container with `AccordionItem` components inside. Each accordion item has a header and a body section.
|
|
10
|
+
|
|
11
|
+
### Simple Accordion Example
|
|
12
|
+
```yaml
|
|
13
|
+
renderView:
|
|
14
|
+
- type: BsAccordion
|
|
15
|
+
attributes:
|
|
16
|
+
defaultActiveKey: [ 0 ]
|
|
17
|
+
content:
|
|
18
|
+
- type: AccordionItem
|
|
19
|
+
header:
|
|
20
|
+
type: div
|
|
21
|
+
content: First accordion item
|
|
22
|
+
body:
|
|
23
|
+
type: div
|
|
24
|
+
content: Content of the first accordion item.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Advanced Features
|
|
28
|
+
|
|
29
|
+
### Multiple Items with Complex Content
|
|
30
|
+
```yaml
|
|
31
|
+
renderView:
|
|
32
|
+
- type: BsAccordion
|
|
33
|
+
attributes:
|
|
34
|
+
defaultActiveKey: [ 0 ]
|
|
35
|
+
content:
|
|
36
|
+
- type: AccordionItem
|
|
37
|
+
header:
|
|
38
|
+
type: div
|
|
39
|
+
content: First accordion item
|
|
40
|
+
body:
|
|
41
|
+
type: div
|
|
42
|
+
content: Content of the first accordion item.
|
|
43
|
+
- type: AccordionItem
|
|
44
|
+
header:
|
|
45
|
+
type: div
|
|
46
|
+
content: Second accordion item
|
|
47
|
+
body:
|
|
48
|
+
- type: div
|
|
49
|
+
attributes:
|
|
50
|
+
class: p-2 text-center
|
|
51
|
+
content: Content of the second accordion item.
|
|
52
|
+
- type: div
|
|
53
|
+
attributes:
|
|
54
|
+
class: row
|
|
55
|
+
content:
|
|
56
|
+
- type: div
|
|
57
|
+
attributes:
|
|
58
|
+
class: col
|
|
59
|
+
content: Of course, you can put any component you want in it. This is a column...
|
|
60
|
+
- type: div
|
|
61
|
+
attributes:
|
|
62
|
+
class: col
|
|
63
|
+
content: ...and this is another column, made with bootstrap's columns.
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Custom Header Formatting
|
|
67
|
+
```yaml
|
|
68
|
+
renderView:
|
|
69
|
+
- type: AccordionItem
|
|
70
|
+
header:
|
|
71
|
+
type: div
|
|
72
|
+
content:
|
|
73
|
+
- "Third "
|
|
74
|
+
- type: span
|
|
75
|
+
attributes:
|
|
76
|
+
class: fw-bold
|
|
77
|
+
content: accordion
|
|
78
|
+
- " item "
|
|
79
|
+
body:
|
|
80
|
+
type: div
|
|
81
|
+
content: Demonstrates that you can customize in the accordion item heading.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Key Features
|
|
85
|
+
|
|
86
|
+
1. **Bootstrap Integration**: The accordion component uses Bootstrap's styling and functionality
|
|
87
|
+
2. **Flexible Content**: Both headers and bodies can contain any valid Reactive-JSON components
|
|
88
|
+
3. **Custom Styling**: Compatible with Bootstrap classes and custom CSS
|
|
89
|
+
4. **Default Active Item**: Can specify which item should be open by default using `defaultActiveKey`
|
|
90
|
+
5. **Nested Components**: Support for complex layouts within accordion items
|
|
91
|
+
|
|
92
|
+
## Notes
|
|
93
|
+
|
|
94
|
+
- The accordion component is compatible with any CSS system, although it's built on Bootstrap
|
|
95
|
+
- Headers and bodies can contain any combination of components and styling
|
|
96
|
+
- Use Bootstrap classes for additional styling and layout options
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: RjBuildDescriber
|
|
3
|
+
title: HTML
|
|
4
|
+
description:
|
|
5
|
+
- type: div
|
|
6
|
+
content: Accordions are managed by Bootstrap.
|
|
7
|
+
toDescribe:
|
|
8
|
+
renderView:
|
|
9
|
+
- type: BsAccordion
|
|
10
|
+
attributes:
|
|
11
|
+
defaultActiveKey: [ 0 ]
|
|
12
|
+
content:
|
|
13
|
+
- type: AccordionItem
|
|
14
|
+
header:
|
|
15
|
+
type: div
|
|
16
|
+
content: First accordion item
|
|
17
|
+
body:
|
|
18
|
+
type: div
|
|
19
|
+
content: Content of the first accordion item.
|
|
20
|
+
- type: AccordionItem
|
|
21
|
+
header:
|
|
22
|
+
type: div
|
|
23
|
+
content: Second accordion item
|
|
24
|
+
body:
|
|
25
|
+
- type: div
|
|
26
|
+
attributes:
|
|
27
|
+
class: p-2 text-center
|
|
28
|
+
content: Content of the second accordion item.
|
|
29
|
+
- type: div
|
|
30
|
+
attributes:
|
|
31
|
+
class: row
|
|
32
|
+
content:
|
|
33
|
+
- type: div
|
|
34
|
+
attributes:
|
|
35
|
+
class: col
|
|
36
|
+
content: Of course, you can put any component you want in it. This is a column...
|
|
37
|
+
- type: div
|
|
38
|
+
attributes:
|
|
39
|
+
class: col
|
|
40
|
+
content:
|
|
41
|
+
...and this is another column, made with bootstrap's columns. Please note we have the bootstrap CSS
|
|
42
|
+
used here, but our tool is compatible with any CSS system.
|
|
43
|
+
- type: AccordionItem
|
|
44
|
+
header:
|
|
45
|
+
type: div
|
|
46
|
+
content:
|
|
47
|
+
- "Third "
|
|
48
|
+
- type: span
|
|
49
|
+
attributes:
|
|
50
|
+
class: fw-bold
|
|
51
|
+
content: accordion
|
|
52
|
+
- " item "
|
|
53
|
+
body:
|
|
54
|
+
type: div
|
|
55
|
+
content: Demonstrates that you can customize in the accordion item heading, as you could in any other place.
|
|
56
|
+
|
|
57
|
+
templates:
|
|
58
|
+
|
|
59
|
+
data: { }
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
templates:
|
|
63
|
+
|
|
64
|
+
data: {}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Dynamic Content Example
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This example demonstrates how to create a dynamic table interface with the following features:
|
|
6
|
+
- Search functionality
|
|
7
|
+
- Bulk selection/deselection
|
|
8
|
+
- Bulk deletion
|
|
9
|
+
- Pagination
|
|
10
|
+
- Row editing via modal dialogs
|
|
11
|
+
|
|
12
|
+
## Components Used
|
|
13
|
+
|
|
14
|
+
1. `DataFilter` - For search functionality
|
|
15
|
+
2. `TextField` - For search input
|
|
16
|
+
3. `BsButton` - For various actions
|
|
17
|
+
4. `Switch` - For dynamic content rendering
|
|
18
|
+
5. `PageControls` - For pagination
|
|
19
|
+
6. `Modal` - For edit dialogs
|
|
20
|
+
7. `CheckBoxField` - For row selection
|
|
21
|
+
|
|
22
|
+
## Example Structure
|
|
23
|
+
|
|
24
|
+
### Search and Bulk Actions
|
|
25
|
+
```yaml
|
|
26
|
+
renderView:
|
|
27
|
+
- type: DataFilter
|
|
28
|
+
context: global
|
|
29
|
+
filters:
|
|
30
|
+
- subjectsWithProperty: dynamicContentRow
|
|
31
|
+
andConditions:
|
|
32
|
+
- orConditions:
|
|
33
|
+
- when: ~~._search
|
|
34
|
+
isEmpty:
|
|
35
|
+
- whenFilterableData: dynamicContentRow.title
|
|
36
|
+
contains: ~~._search
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Search Input
|
|
40
|
+
```yaml
|
|
41
|
+
- type: TextField
|
|
42
|
+
placeholder: Insert some text to search here...
|
|
43
|
+
dataLocation: ~~._search
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Bulk Action Buttons
|
|
47
|
+
```yaml
|
|
48
|
+
- type: BsButton
|
|
49
|
+
attributes:
|
|
50
|
+
class: btn btn-link
|
|
51
|
+
content: Select All
|
|
52
|
+
actions:
|
|
53
|
+
- what: postMessage
|
|
54
|
+
on: click
|
|
55
|
+
message:
|
|
56
|
+
actor: select_all
|
|
57
|
+
|
|
58
|
+
- type: BsButton
|
|
59
|
+
attributes:
|
|
60
|
+
class: btn btn-link
|
|
61
|
+
content: Unselect All
|
|
62
|
+
actions:
|
|
63
|
+
- what: postMessage
|
|
64
|
+
on: click
|
|
65
|
+
message:
|
|
66
|
+
actor: unselect_all
|
|
67
|
+
|
|
68
|
+
- type: BsButton
|
|
69
|
+
content: Bulk delete
|
|
70
|
+
actions:
|
|
71
|
+
- what: hide
|
|
72
|
+
whenDataCountOf: $.rows[*][?(@.selected == true)]
|
|
73
|
+
inContext: global
|
|
74
|
+
is: 0
|
|
75
|
+
- what: postMessage
|
|
76
|
+
on: click
|
|
77
|
+
message:
|
|
78
|
+
actor: bulk_delete_selected
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Dynamic Table with Pagination
|
|
82
|
+
```yaml
|
|
83
|
+
- type: table
|
|
84
|
+
attributes:
|
|
85
|
+
class: table
|
|
86
|
+
content:
|
|
87
|
+
type: tbody
|
|
88
|
+
content:
|
|
89
|
+
- type: Switch
|
|
90
|
+
content: ~~.rows
|
|
91
|
+
paginated: true
|
|
92
|
+
paginationProps:
|
|
93
|
+
maxPageButtonsCount: 5
|
|
94
|
+
pageMaxItemCount: 7
|
|
95
|
+
options:
|
|
96
|
+
dynamicContentRow:
|
|
97
|
+
load: dynamicContentRow
|
|
98
|
+
after:
|
|
99
|
+
type: tr
|
|
100
|
+
content:
|
|
101
|
+
type: td
|
|
102
|
+
attributes:
|
|
103
|
+
colSpan: 3
|
|
104
|
+
content:
|
|
105
|
+
type: PageControls
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Row Template
|
|
109
|
+
```yaml
|
|
110
|
+
dynamicContentRow:
|
|
111
|
+
type: tr
|
|
112
|
+
actions:
|
|
113
|
+
- what: removeData
|
|
114
|
+
on: message
|
|
115
|
+
whenMessageIs:
|
|
116
|
+
actor: bulk_delete_selected
|
|
117
|
+
when: ~.selected
|
|
118
|
+
is: true
|
|
119
|
+
target: currentTemplateData
|
|
120
|
+
parentLevel: 1
|
|
121
|
+
content:
|
|
122
|
+
select:
|
|
123
|
+
type: td
|
|
124
|
+
content:
|
|
125
|
+
type: CheckBoxField
|
|
126
|
+
dataLocation: ~.selected
|
|
127
|
+
options:
|
|
128
|
+
- value: true
|
|
129
|
+
actions:
|
|
130
|
+
- what: setData
|
|
131
|
+
path: ~.selected
|
|
132
|
+
value: true
|
|
133
|
+
on: message
|
|
134
|
+
whenMessageIs:
|
|
135
|
+
actor: select_all
|
|
136
|
+
- what: setData
|
|
137
|
+
path: ~.selected
|
|
138
|
+
value: false
|
|
139
|
+
on: message
|
|
140
|
+
whenMessageIs:
|
|
141
|
+
actor: unselect_all
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Edit Modal
|
|
145
|
+
```yaml
|
|
146
|
+
- type: Modal
|
|
147
|
+
showBoolPath: ~._openEditModal
|
|
148
|
+
headerTitle:
|
|
149
|
+
- "Edit the content "
|
|
150
|
+
- type: em
|
|
151
|
+
content: ~.title
|
|
152
|
+
body:
|
|
153
|
+
- type: TextField
|
|
154
|
+
dataLocation: ~.title
|
|
155
|
+
label: Content title
|
|
156
|
+
- type: BsButton
|
|
157
|
+
content: OK
|
|
158
|
+
actions:
|
|
159
|
+
- what: setData
|
|
160
|
+
on: click
|
|
161
|
+
path: ~._openEditModal
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Key Features
|
|
165
|
+
|
|
166
|
+
1. **Search Functionality**
|
|
167
|
+
- Real-time filtering of rows based on title
|
|
168
|
+
- Empty search shows all rows
|
|
169
|
+
|
|
170
|
+
2. **Bulk Operations**
|
|
171
|
+
- Select all rows
|
|
172
|
+
- Unselect all rows
|
|
173
|
+
- Delete selected rows
|
|
174
|
+
- Bulk delete button visibility based on selection
|
|
175
|
+
|
|
176
|
+
3. **Pagination**
|
|
177
|
+
- Configurable items per page
|
|
178
|
+
- Maximum page buttons display
|
|
179
|
+
- Navigation controls
|
|
180
|
+
|
|
181
|
+
4. **Row Operations**
|
|
182
|
+
- Individual row selection
|
|
183
|
+
- Edit modal for each row
|
|
184
|
+
- Dynamic update of row content
|
|
185
|
+
|
|
186
|
+
5. **Data Management**
|
|
187
|
+
- Global data context
|
|
188
|
+
- Template-based row rendering
|
|
189
|
+
- Dynamic data updates
|
|
190
|
+
|
|
191
|
+
## Implementation Notes
|
|
192
|
+
|
|
193
|
+
1. The example uses Bootstrap classes for styling
|
|
194
|
+
2. Messages are used for inter-component communication
|
|
195
|
+
3. Data paths use both global (~~) and local (~) contexts
|
|
196
|
+
4. Templates are used for reusable components
|
|
197
|
+
5. Modals are controlled via boolean data paths
|