@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,315 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# DataFilter
|
|
5
|
+
|
|
6
|
+
The `DataFilter` component allows you to filter data from the global or template context before rendering its content. It is particularly useful for conditional display of elements based on dynamic complex criteria, such as filtering lists, trees, or data subsets.
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
- `filters` (array, required): Array of filter objects, each specifying properties and conditions to check
|
|
10
|
+
- `subjectsWithProperty` (string): Property to check in the data, acts as namespace
|
|
11
|
+
- `andConditions` (array): List of conditions that must all be true
|
|
12
|
+
- `orConditions` (array): List of conditions where at least one must be true
|
|
13
|
+
- Available conditions:
|
|
14
|
+
- `when`: Checks a condition on a value
|
|
15
|
+
- `is`: Compares exact equality
|
|
16
|
+
- `isNot`: Checks inequality
|
|
17
|
+
- `isEmpty`: Checks if a value is empty
|
|
18
|
+
- `contains`: Checks if a value contains a substring
|
|
19
|
+
- `>=`, `<=`, `>`, `<`: Numeric comparisons
|
|
20
|
+
- `compareAsDates`: Boolean to compare values as dates
|
|
21
|
+
- `whenFilterableData`: Specifies the data path to filter, must include the namespace
|
|
22
|
+
- `context` (string, optional): Context to filter (`global` or `template`). Default: `global`
|
|
23
|
+
- `content` (object/array, required): Content to render after filtering
|
|
24
|
+
|
|
25
|
+
## Behavior
|
|
26
|
+
- Applies all filters to the selected context before content rendering
|
|
27
|
+
- Supports complex filtering conditions with `andConditions` and `orConditions`
|
|
28
|
+
- Allows recursive filtering while preserving data structure
|
|
29
|
+
- Can be combined with other components to create interactive filtering interfaces
|
|
30
|
+
- Supports dynamic filtering based on application state
|
|
31
|
+
|
|
32
|
+
## Filterable Data Structure
|
|
33
|
+
|
|
34
|
+
DataFilter uses a specific pattern to identify and filter data. This pattern relies on an identification key (namespace) that must be consistent between the data structure and filtering conditions.
|
|
35
|
+
|
|
36
|
+
### Namespace Pattern
|
|
37
|
+
|
|
38
|
+
1. **In the data structure**:
|
|
39
|
+
```yaml
|
|
40
|
+
data:
|
|
41
|
+
filteredItems:
|
|
42
|
+
- item: # <- Identification key (namespace)
|
|
43
|
+
id: 1
|
|
44
|
+
title: "..."
|
|
45
|
+
- item: # <- Same key for each item
|
|
46
|
+
id: 2
|
|
47
|
+
title: "..."
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. **In filtering conditions**:
|
|
51
|
+
```yaml
|
|
52
|
+
type: DataFilter
|
|
53
|
+
context: global
|
|
54
|
+
filters:
|
|
55
|
+
- subjectsWithProperty: item # <- Declares the namespace
|
|
56
|
+
andConditions:
|
|
57
|
+
- orConditions:
|
|
58
|
+
- whenFilterableData: item.title # <- Uses the namespace
|
|
59
|
+
contains: "..."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The identification key (here "item"):
|
|
63
|
+
- Can have any name (`itemXyz`, `element`, etc.)
|
|
64
|
+
- Must be consistent between data structure and conditions
|
|
65
|
+
- Serves as a namespace for accessing properties in `whenFilterableData`
|
|
66
|
+
- Is required for DataFilter to correctly identify filterable elements
|
|
67
|
+
|
|
68
|
+
- type: RjBuildDescriber
|
|
69
|
+
title: Advanced Example
|
|
70
|
+
toDescribe:
|
|
71
|
+
renderView:
|
|
72
|
+
- type: div
|
|
73
|
+
attributes:
|
|
74
|
+
class: "container-fluid"
|
|
75
|
+
content:
|
|
76
|
+
- type: div
|
|
77
|
+
attributes:
|
|
78
|
+
class: "row mb-4"
|
|
79
|
+
content:
|
|
80
|
+
- type: div
|
|
81
|
+
attributes:
|
|
82
|
+
class: "col-md-6"
|
|
83
|
+
content:
|
|
84
|
+
- type: div
|
|
85
|
+
attributes:
|
|
86
|
+
class: "card h-100"
|
|
87
|
+
content:
|
|
88
|
+
- type: div
|
|
89
|
+
attributes:
|
|
90
|
+
class: "card-header bg-secondary text-white"
|
|
91
|
+
content:
|
|
92
|
+
- type: h5
|
|
93
|
+
attributes:
|
|
94
|
+
class: "card-title mb-0"
|
|
95
|
+
content: "📋 All Items (Unfiltered)"
|
|
96
|
+
- type: div
|
|
97
|
+
attributes:
|
|
98
|
+
class: "card-body"
|
|
99
|
+
content:
|
|
100
|
+
- type: div
|
|
101
|
+
attributes:
|
|
102
|
+
class: "list-group list-group-flush"
|
|
103
|
+
content:
|
|
104
|
+
type: Switch
|
|
105
|
+
content: ~.filteredItems
|
|
106
|
+
singleOption:
|
|
107
|
+
load: item
|
|
108
|
+
- type: div
|
|
109
|
+
attributes:
|
|
110
|
+
class: "col-md-6"
|
|
111
|
+
content:
|
|
112
|
+
- type: div
|
|
113
|
+
attributes:
|
|
114
|
+
class: "card h-100"
|
|
115
|
+
content:
|
|
116
|
+
- type: div
|
|
117
|
+
attributes:
|
|
118
|
+
class: "card-header bg-primary text-white"
|
|
119
|
+
content:
|
|
120
|
+
- type: h5
|
|
121
|
+
attributes:
|
|
122
|
+
class: "card-title mb-0"
|
|
123
|
+
content: "🔍 Filtered Results"
|
|
124
|
+
- type: div
|
|
125
|
+
attributes:
|
|
126
|
+
class: "card-body"
|
|
127
|
+
content:
|
|
128
|
+
- type: DataFilter
|
|
129
|
+
context: global
|
|
130
|
+
filters:
|
|
131
|
+
- subjectsWithProperty: item
|
|
132
|
+
andConditions:
|
|
133
|
+
# Text search filter
|
|
134
|
+
- orConditions:
|
|
135
|
+
- when: ~~._filters.search
|
|
136
|
+
isEmpty:
|
|
137
|
+
- whenFilterableData: item.searchableContent
|
|
138
|
+
contains: ~~._filters.search
|
|
139
|
+
|
|
140
|
+
# Date filter
|
|
141
|
+
- orConditions:
|
|
142
|
+
- when: ~~._filters.since
|
|
143
|
+
isEmpty:
|
|
144
|
+
- whenFilterableData: item.creationDate
|
|
145
|
+
">=": ~~._filters.since
|
|
146
|
+
compareAsDates: true
|
|
147
|
+
|
|
148
|
+
# Status filter
|
|
149
|
+
- orConditions:
|
|
150
|
+
- when: ~~._filters.status
|
|
151
|
+
isNot: active_only
|
|
152
|
+
- whenFilterableData: item.status
|
|
153
|
+
is: active
|
|
154
|
+
|
|
155
|
+
content:
|
|
156
|
+
- type: div
|
|
157
|
+
attributes:
|
|
158
|
+
class: "list-group list-group-flush"
|
|
159
|
+
content:
|
|
160
|
+
type: Switch
|
|
161
|
+
content: ~~.filteredItems
|
|
162
|
+
singleOption:
|
|
163
|
+
load: item
|
|
164
|
+
- type: div
|
|
165
|
+
attributes:
|
|
166
|
+
class: "row mt-4"
|
|
167
|
+
content:
|
|
168
|
+
- type: div
|
|
169
|
+
attributes:
|
|
170
|
+
class: "col-12"
|
|
171
|
+
content:
|
|
172
|
+
- type: div
|
|
173
|
+
attributes:
|
|
174
|
+
class: "card"
|
|
175
|
+
content:
|
|
176
|
+
- type: div
|
|
177
|
+
attributes:
|
|
178
|
+
class: "card-header bg-info text-white"
|
|
179
|
+
content:
|
|
180
|
+
- type: h5
|
|
181
|
+
attributes:
|
|
182
|
+
class: "card-title mb-0"
|
|
183
|
+
content: "⚙️ Filter Controls"
|
|
184
|
+
- type: div
|
|
185
|
+
attributes:
|
|
186
|
+
class: "card-body"
|
|
187
|
+
content:
|
|
188
|
+
# Filtering interface
|
|
189
|
+
- type: div
|
|
190
|
+
attributes:
|
|
191
|
+
class: "row g-3"
|
|
192
|
+
content:
|
|
193
|
+
- type: div
|
|
194
|
+
attributes:
|
|
195
|
+
class: "col-md-4"
|
|
196
|
+
content:
|
|
197
|
+
- type: TextField
|
|
198
|
+
placeholder: "Search..."
|
|
199
|
+
dataLocation: ~~._filters.search
|
|
200
|
+
- type: div
|
|
201
|
+
attributes:
|
|
202
|
+
class: "col-md-4"
|
|
203
|
+
content:
|
|
204
|
+
- # TODO: replace this by the DateField when DateField will support type="date".
|
|
205
|
+
type: TextField
|
|
206
|
+
inputType: date
|
|
207
|
+
dataLocation: ~~._filters.since
|
|
208
|
+
- type: div
|
|
209
|
+
attributes:
|
|
210
|
+
class: "col-md-4"
|
|
211
|
+
content:
|
|
212
|
+
- type: SelectField
|
|
213
|
+
dataLocation: ~~._filters.status
|
|
214
|
+
options:
|
|
215
|
+
- label: "All"
|
|
216
|
+
value: all
|
|
217
|
+
- label: "Active only"
|
|
218
|
+
value: active_only
|
|
219
|
+
|
|
220
|
+
templates:
|
|
221
|
+
item:
|
|
222
|
+
type: div
|
|
223
|
+
attributes:
|
|
224
|
+
class: "list-group-item d-flex justify-content-between align-items-center border-start-0 border-end-0 py-3"
|
|
225
|
+
content:
|
|
226
|
+
- type: div
|
|
227
|
+
attributes:
|
|
228
|
+
class: "d-flex align-items-center gap-3"
|
|
229
|
+
content:
|
|
230
|
+
- type: CheckBoxField
|
|
231
|
+
attributes:
|
|
232
|
+
class: "form-check"
|
|
233
|
+
options:
|
|
234
|
+
- value: true
|
|
235
|
+
label: ""
|
|
236
|
+
dataLocation: ~.item.isSelected
|
|
237
|
+
- type: div
|
|
238
|
+
attributes:
|
|
239
|
+
class: "d-flex flex-column"
|
|
240
|
+
content:
|
|
241
|
+
- type: div
|
|
242
|
+
attributes:
|
|
243
|
+
class: "fw-bold mb-1"
|
|
244
|
+
content: ~.item.searchableContent
|
|
245
|
+
- type: div
|
|
246
|
+
attributes:
|
|
247
|
+
class: "text-muted small"
|
|
248
|
+
content: ~.item.creationDate
|
|
249
|
+
- type: div
|
|
250
|
+
attributes:
|
|
251
|
+
class: "d-flex gap-2"
|
|
252
|
+
content:
|
|
253
|
+
- type: span
|
|
254
|
+
attributes:
|
|
255
|
+
class: "badge rounded-pill"
|
|
256
|
+
style:
|
|
257
|
+
backgroundColor: "#198754"
|
|
258
|
+
color: "white"
|
|
259
|
+
content: ~.item.status
|
|
260
|
+
actions:
|
|
261
|
+
- what: hide
|
|
262
|
+
when: ~.item.status
|
|
263
|
+
isNot: active
|
|
264
|
+
- type: span
|
|
265
|
+
attributes:
|
|
266
|
+
class: "badge rounded-pill"
|
|
267
|
+
style:
|
|
268
|
+
backgroundColor: "#dc3545"
|
|
269
|
+
color: "white"
|
|
270
|
+
content: ~.item.status
|
|
271
|
+
actions:
|
|
272
|
+
- what: hide
|
|
273
|
+
when: ~.item.status
|
|
274
|
+
is: active
|
|
275
|
+
data:
|
|
276
|
+
_filters:
|
|
277
|
+
search: ""
|
|
278
|
+
since: ""
|
|
279
|
+
status: "all"
|
|
280
|
+
filteredItems:
|
|
281
|
+
- item:
|
|
282
|
+
id: 1
|
|
283
|
+
searchableContent: "First item"
|
|
284
|
+
status: "active"
|
|
285
|
+
creationDate: "2024-03-20"
|
|
286
|
+
isSelected: true
|
|
287
|
+
- item:
|
|
288
|
+
id: 2
|
|
289
|
+
searchableContent: "Second item"
|
|
290
|
+
status: "inactive"
|
|
291
|
+
creationDate: "2024-03-19"
|
|
292
|
+
isSelected: false
|
|
293
|
+
|
|
294
|
+
- type: Markdown
|
|
295
|
+
content: |
|
|
296
|
+
## Advanced Use Cases
|
|
297
|
+
- Multi-criteria filtering with combined conditions
|
|
298
|
+
- Real-time search interface
|
|
299
|
+
- Hierarchical data filtering (trees, sub-elements)
|
|
300
|
+
- Complex state management (conflicts, modifications, new elements)
|
|
301
|
+
- Integration with pagination components
|
|
302
|
+
- Date-based filtering and numeric comparisons
|
|
303
|
+
|
|
304
|
+
## Best Practices
|
|
305
|
+
- Organize filters by logical category
|
|
306
|
+
- Use comments to document complex conditions
|
|
307
|
+
- Combine with UI components for interactive experience
|
|
308
|
+
- Consider performance with large datasets
|
|
309
|
+
- Use reusable templates for common filters
|
|
310
|
+
|
|
311
|
+
## Limitations
|
|
312
|
+
- Filtering is based on simple comparisons
|
|
313
|
+
- Performance may be impacted with very large datasets
|
|
314
|
+
- Does not support custom filtering functions
|
|
315
|
+
- Filtering is applied recursively on the entire structure
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# DelayedActions
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The `DelayedActions` component allows you to execute one or more actions after a delay or at regular intervals. It is useful for implementing polling, periodic updates, or delayed reactions in your Reactive-JSON applications.
|
|
6
|
+
|
|
7
|
+
## Properties
|
|
8
|
+
- `delayedActions` (array, required): Array of action objects to execute after the delay or at each interval
|
|
9
|
+
- `interval` (number, required): The delay or interval in milliseconds between executions
|
|
10
|
+
- `once` (boolean, optional): If true, actions are executed only once after the delay; if false (default), actions repeat at each interval
|
|
11
|
+
- `content` (object/array, optional): Content to render inside the component
|
|
12
|
+
|
|
13
|
+
## Behavior
|
|
14
|
+
- Executes all actions in `delayedActions` after the specified delay or at each interval
|
|
15
|
+
- If `once` is true, actions are executed only once; otherwise, they repeat at each interval
|
|
16
|
+
- Actions are executed without requiring a user event (time is the trigger)
|
|
17
|
+
- The component can render content, but the main purpose is to trigger actions
|
|
18
|
+
- If `interval` is not provided, no actions are executed
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
```yaml
|
|
22
|
+
renderView:
|
|
23
|
+
- type: Phantom
|
|
24
|
+
actions:
|
|
25
|
+
- # This will prevent infinite add.
|
|
26
|
+
what: hide
|
|
27
|
+
andConditions:
|
|
28
|
+
- whenDataCountOf: $.tick[*]
|
|
29
|
+
">": 1000
|
|
30
|
+
content:
|
|
31
|
+
- type: DelayedActions
|
|
32
|
+
interval: 2000
|
|
33
|
+
delayedActions:
|
|
34
|
+
- what: addData
|
|
35
|
+
path: ~~.tick
|
|
36
|
+
value: "Ticked!"
|
|
37
|
+
content:
|
|
38
|
+
- type: p
|
|
39
|
+
content:
|
|
40
|
+
- "Tick count: "
|
|
41
|
+
- type: Count
|
|
42
|
+
jsonPathPattern: "$.tick[*]"
|
|
43
|
+
|
|
44
|
+
data: {}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Limitations
|
|
48
|
+
- Only supports time-based triggering (no event-based delay)
|
|
49
|
+
- All actions are executed in the order provided
|
|
50
|
+
- No built-in error handling for action execution
|
|
51
|
+
- If `interval` is missing or invalid, nothing happens
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# DelayedActions
|
|
5
|
+
|
|
6
|
+
The `DelayedActions` component allows you to execute one or more actions after a delay or at regular intervals. It is useful for implementing polling, periodic updates, or delayed reactions in your Reactive-JSON applications.
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
- `delayedActions` (array, required): Array of action objects to execute after the delay or at each interval
|
|
10
|
+
- `interval` (number, required): The delay or interval in milliseconds between executions
|
|
11
|
+
- `once` (boolean, optional): If true, actions are executed only once after the delay; if false (default), actions repeat at each interval
|
|
12
|
+
- `content` (object/array, optional): Content to render inside the component
|
|
13
|
+
|
|
14
|
+
## Behavior
|
|
15
|
+
- Executes all actions in `delayedActions` after the specified delay or at each interval
|
|
16
|
+
- If `once` is true, actions are executed only once; otherwise, they repeat at each interval
|
|
17
|
+
- Actions are executed without requiring a user event (time is the trigger)
|
|
18
|
+
- The component can render content, but the main purpose is to trigger actions
|
|
19
|
+
- If `interval` is not provided, no actions are executed
|
|
20
|
+
|
|
21
|
+
- type: RjBuildDescriber
|
|
22
|
+
title: Example
|
|
23
|
+
description: This example adds an item in a data array every 2 seconds, and shows the item count.
|
|
24
|
+
toDescribe:
|
|
25
|
+
renderView:
|
|
26
|
+
- type: Phantom
|
|
27
|
+
actions:
|
|
28
|
+
- # This will prevent infinite add.
|
|
29
|
+
what: hide
|
|
30
|
+
andConditions:
|
|
31
|
+
- whenDataCountOf: $.tick[*]
|
|
32
|
+
">": 1000
|
|
33
|
+
content:
|
|
34
|
+
- type: DelayedActions
|
|
35
|
+
interval: 2000
|
|
36
|
+
delayedActions:
|
|
37
|
+
- what: addData
|
|
38
|
+
path: ~~.tick
|
|
39
|
+
value: "Ticked!"
|
|
40
|
+
content:
|
|
41
|
+
- type: p
|
|
42
|
+
content:
|
|
43
|
+
- "Tick count: "
|
|
44
|
+
- type: Count
|
|
45
|
+
jsonPathPattern: "$.tick[*]"
|
|
46
|
+
|
|
47
|
+
data: {}
|
|
48
|
+
|
|
49
|
+
- type: Markdown
|
|
50
|
+
content: |
|
|
51
|
+
## Limitations
|
|
52
|
+
- Only supports time-based triggering (no event-based delay)
|
|
53
|
+
- All actions are executed in the order provided
|
|
54
|
+
- No built-in error handling for action execution
|
|
55
|
+
- If `interval` is missing or invalid, nothing happens
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# PageControls
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The `PageControls` component displays the pagination controls provided by the current `PaginationContext`. It is useful for rendering navigation controls (such as next/previous buttons or page numbers) in paginated lists or tables.
|
|
6
|
+
|
|
7
|
+
## Properties
|
|
8
|
+
- (none)
|
|
9
|
+
|
|
10
|
+
## Behavior
|
|
11
|
+
- Renders the pagination controls from the current `PaginationContext` if available
|
|
12
|
+
- If no pagination controls are present in the context, renders nothing
|
|
13
|
+
- Intended to be used inside paginated views or lists
|
|
14
|
+
|
|
15
|
+
## Pagination Context
|
|
16
|
+
The pagination context is provided by components like `Switch` when the `paginated` property is set to `true`.
|
|
17
|
+
|
|
18
|
+
## Interactive Example with Switch
|
|
19
|
+
|
|
20
|
+
This example shows how PageControls works with a paginated Switch component to display a list of users.
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
renderView:
|
|
24
|
+
- type: div
|
|
25
|
+
attributes:
|
|
26
|
+
class: container-fluid p-3
|
|
27
|
+
content:
|
|
28
|
+
- type: h3
|
|
29
|
+
content: Paginated User List
|
|
30
|
+
|
|
31
|
+
- type: div
|
|
32
|
+
attributes:
|
|
33
|
+
class: mb-3
|
|
34
|
+
content:
|
|
35
|
+
- type: strong
|
|
36
|
+
content: "Total number of users: "
|
|
37
|
+
- type: Count
|
|
38
|
+
context: global
|
|
39
|
+
count: ~.users
|
|
40
|
+
|
|
41
|
+
- type: Switch
|
|
42
|
+
content: ~.users
|
|
43
|
+
singleOption:
|
|
44
|
+
load: userItem
|
|
45
|
+
paginated: true
|
|
46
|
+
paginationProps:
|
|
47
|
+
pageMaxItemCount: 3
|
|
48
|
+
maxPageButtonsCount: 5
|
|
49
|
+
before:
|
|
50
|
+
type: div
|
|
51
|
+
attributes:
|
|
52
|
+
class: alert alert-info
|
|
53
|
+
content: "Here are the users (3 per page):"
|
|
54
|
+
after:
|
|
55
|
+
- type: div
|
|
56
|
+
attributes:
|
|
57
|
+
class: d-flex justify-content-center mt-3
|
|
58
|
+
content:
|
|
59
|
+
type: PageControls
|
|
60
|
+
- type: div
|
|
61
|
+
attributes:
|
|
62
|
+
class: text-center mt-2 text-muted
|
|
63
|
+
content: "Use the controls above to navigate between pages"
|
|
64
|
+
|
|
65
|
+
templates:
|
|
66
|
+
userItem:
|
|
67
|
+
type: div
|
|
68
|
+
attributes:
|
|
69
|
+
class: card mb-2
|
|
70
|
+
content:
|
|
71
|
+
type: div
|
|
72
|
+
attributes:
|
|
73
|
+
class: card-body
|
|
74
|
+
content:
|
|
75
|
+
- type: h5
|
|
76
|
+
attributes:
|
|
77
|
+
class: card-title
|
|
78
|
+
content: ~.name
|
|
79
|
+
- type: div
|
|
80
|
+
attributes:
|
|
81
|
+
class: card-text
|
|
82
|
+
content:
|
|
83
|
+
- type: div
|
|
84
|
+
content: ["Email: ", ~.email]
|
|
85
|
+
- type: div
|
|
86
|
+
content: ["Department: ", ~.department]
|
|
87
|
+
|
|
88
|
+
data:
|
|
89
|
+
users:
|
|
90
|
+
- name: "Alice Martin"
|
|
91
|
+
email: "alice.martin@example.com"
|
|
92
|
+
department: "Development"
|
|
93
|
+
- name: "Bob Dupont"
|
|
94
|
+
email: "bob.dupont@example.com"
|
|
95
|
+
department: "Design"
|
|
96
|
+
- name: "Claire Bernard"
|
|
97
|
+
email: "claire.bernard@example.com"
|
|
98
|
+
department: "Marketing"
|
|
99
|
+
- name: "David Rousseau"
|
|
100
|
+
email: "david.rousseau@example.com"
|
|
101
|
+
department: "Development"
|
|
102
|
+
- name: "Emma Leroy"
|
|
103
|
+
email: "emma.leroy@example.com"
|
|
104
|
+
department: "Support"
|
|
105
|
+
- name: "François Moreau"
|
|
106
|
+
email: "francois.moreau@example.com"
|
|
107
|
+
department: "Design"
|
|
108
|
+
- name: "Gabrielle Petit"
|
|
109
|
+
email: "gabrielle.petit@example.com"
|
|
110
|
+
department: "Marketing"
|
|
111
|
+
- name: "Henri Blanc"
|
|
112
|
+
email: "henri.blanc@example.com"
|
|
113
|
+
department: "Development"
|
|
114
|
+
- name: "Isabelle Roux"
|
|
115
|
+
email: "isabelle.roux@example.com"
|
|
116
|
+
department: "Support"
|
|
117
|
+
- name: "Julien Vincent"
|
|
118
|
+
email: "julien.vincent@example.com"
|
|
119
|
+
department: "Design"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Limitations
|
|
123
|
+
- Only works if a `PaginationContext` is present and provides controls
|
|
124
|
+
- Does not manage pagination state itself; only renders controls from the context
|
|
125
|
+
- No customization of the controls via props
|
|
126
|
+
- Entirely depends on the parent component (like Switch) for pagination logic
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
renderView:
|
|
2
|
+
- type: Markdown
|
|
3
|
+
content: |
|
|
4
|
+
# PageControls
|
|
5
|
+
|
|
6
|
+
The `PageControls` component displays the pagination controls provided by the current `PaginationContext`. It is useful for rendering navigation controls (such as next/previous buttons or page numbers) in paginated lists or tables.
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
- (none)
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
- Renders the pagination controls from the current `PaginationContext` if available
|
|
13
|
+
- If no pagination controls are present in the context, renders nothing
|
|
14
|
+
- Intended to be used inside paginated views or lists
|
|
15
|
+
|
|
16
|
+
## Pagination Context
|
|
17
|
+
The pagination context is provided by components like `Switch` when the `paginated` property is set to `true`.
|
|
18
|
+
|
|
19
|
+
- type: RjBuildDescriber
|
|
20
|
+
title: Interactive Example with Switch
|
|
21
|
+
description:
|
|
22
|
+
- type: div
|
|
23
|
+
content: This example shows how PageControls works with a paginated Switch component to display a list of users.
|
|
24
|
+
toDescribe:
|
|
25
|
+
renderView:
|
|
26
|
+
- type: div
|
|
27
|
+
attributes:
|
|
28
|
+
class: container-fluid p-3
|
|
29
|
+
content:
|
|
30
|
+
- type: h3
|
|
31
|
+
content: Paginated User List
|
|
32
|
+
|
|
33
|
+
- type: div
|
|
34
|
+
attributes:
|
|
35
|
+
class: mb-3
|
|
36
|
+
content:
|
|
37
|
+
- type: strong
|
|
38
|
+
content: "Total number of users: "
|
|
39
|
+
- type: Count
|
|
40
|
+
context: global
|
|
41
|
+
count: ~.users
|
|
42
|
+
|
|
43
|
+
- type: Switch
|
|
44
|
+
content: ~.users
|
|
45
|
+
singleOption:
|
|
46
|
+
load: userItem
|
|
47
|
+
paginated: true
|
|
48
|
+
paginationProps:
|
|
49
|
+
pageMaxItemCount: 3
|
|
50
|
+
maxPageButtonsCount: 5
|
|
51
|
+
before:
|
|
52
|
+
type: div
|
|
53
|
+
attributes:
|
|
54
|
+
class: alert alert-info
|
|
55
|
+
content: "Here are the users (3 per page):"
|
|
56
|
+
after:
|
|
57
|
+
- type: div
|
|
58
|
+
attributes:
|
|
59
|
+
class: d-flex justify-content-center mt-3
|
|
60
|
+
content:
|
|
61
|
+
type: PageControls
|
|
62
|
+
- type: div
|
|
63
|
+
attributes:
|
|
64
|
+
class: text-center mt-2 text-muted
|
|
65
|
+
content: "Use the controls above to navigate between pages"
|
|
66
|
+
|
|
67
|
+
templates:
|
|
68
|
+
userItem:
|
|
69
|
+
type: div
|
|
70
|
+
attributes:
|
|
71
|
+
class: card mb-2
|
|
72
|
+
content:
|
|
73
|
+
type: div
|
|
74
|
+
attributes:
|
|
75
|
+
class: card-body
|
|
76
|
+
content:
|
|
77
|
+
- type: h5
|
|
78
|
+
attributes:
|
|
79
|
+
class: card-title
|
|
80
|
+
content: ~.name
|
|
81
|
+
- type: div
|
|
82
|
+
attributes:
|
|
83
|
+
class: card-text
|
|
84
|
+
content:
|
|
85
|
+
- type: div
|
|
86
|
+
content: ["Email: ", ~.email]
|
|
87
|
+
- type: div
|
|
88
|
+
content: ["Department: ", ~.department]
|
|
89
|
+
|
|
90
|
+
data:
|
|
91
|
+
users:
|
|
92
|
+
- name: "Alice Martin"
|
|
93
|
+
email: "alice.martin@example.com"
|
|
94
|
+
department: "Development"
|
|
95
|
+
- name: "Bob Dupont"
|
|
96
|
+
email: "bob.dupont@example.com"
|
|
97
|
+
department: "Design"
|
|
98
|
+
- name: "Claire Bernard"
|
|
99
|
+
email: "claire.bernard@example.com"
|
|
100
|
+
department: "Marketing"
|
|
101
|
+
- name: "David Rousseau"
|
|
102
|
+
email: "david.rousseau@example.com"
|
|
103
|
+
department: "Development"
|
|
104
|
+
- name: "Emma Leroy"
|
|
105
|
+
email: "emma.leroy@example.com"
|
|
106
|
+
department: "Support"
|
|
107
|
+
- name: "François Moreau"
|
|
108
|
+
email: "francois.moreau@example.com"
|
|
109
|
+
department: "Design"
|
|
110
|
+
- name: "Gabrielle Petit"
|
|
111
|
+
email: "gabrielle.petit@example.com"
|
|
112
|
+
department: "Marketing"
|
|
113
|
+
- name: "Henri Blanc"
|
|
114
|
+
email: "henri.blanc@example.com"
|
|
115
|
+
department: "Development"
|
|
116
|
+
- name: "Isabelle Roux"
|
|
117
|
+
email: "isabelle.roux@example.com"
|
|
118
|
+
department: "Support"
|
|
119
|
+
- name: "Julien Vincent"
|
|
120
|
+
email: "julien.vincent@example.com"
|
|
121
|
+
department: "Design"
|
|
122
|
+
|
|
123
|
+
- type: Markdown
|
|
124
|
+
content: |
|
|
125
|
+
## Limitations
|
|
126
|
+
- Only works if a `PaginationContext` is present and provides controls
|
|
127
|
+
- Does not manage pagination state itself; only renders controls from the context
|
|
128
|
+
- No customization of the controls via props
|
|
129
|
+
- Entirely depends on the parent component (like Switch) for pagination logic
|
|
130
|
+
|
|
131
|
+
templates:
|
|
132
|
+
|
|
133
|
+
data: {}
|