@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.
Files changed (93) hide show
  1. package/README-npm.md +49 -0
  2. package/README.md +86 -0
  3. package/package.json +79 -0
  4. package/public/rjbuild/component-doc/chartjs/components.yaml +252 -0
  5. package/public/rjbuild/component-doc/chartjs/overview.yaml +51 -0
  6. package/public/rjbuild/component-doc/core/action/HashChangeListener.md +90 -0
  7. package/public/rjbuild/component-doc/core/action/HashChangeListener.yaml +124 -0
  8. package/public/rjbuild/component-doc/core/action/Hide.md +22 -0
  9. package/public/rjbuild/component-doc/core/action/Hide.yaml +60 -0
  10. package/public/rjbuild/component-doc/core/action/MessageListener.md +93 -0
  11. package/public/rjbuild/component-doc/core/action/MessageListener.yaml +153 -0
  12. package/public/rjbuild/component-doc/core/action/Popover.md +26 -0
  13. package/public/rjbuild/component-doc/core/action/Popover.yaml +100 -0
  14. package/public/rjbuild/component-doc/core/action/ReactOnEvent.md +81 -0
  15. package/public/rjbuild/component-doc/core/action/ReactOnEvent.yaml +133 -0
  16. package/public/rjbuild/component-doc/core/action/Redirect.md +20 -0
  17. package/public/rjbuild/component-doc/core/action/Redirect.yaml +68 -0
  18. package/public/rjbuild/component-doc/core/action/Tooltip.md +22 -0
  19. package/public/rjbuild/component-doc/core/action/Tooltip.yaml +90 -0
  20. package/public/rjbuild/component-doc/core/action/VisuallyHide.md +21 -0
  21. package/public/rjbuild/component-doc/core/action/VisuallyHide.yaml +62 -0
  22. package/public/rjbuild/component-doc/core/action/index.md +214 -0
  23. package/public/rjbuild/component-doc/core/action/index.yaml +278 -0
  24. package/public/rjbuild/component-doc/core/element/form/CheckBoxField.md +276 -0
  25. package/public/rjbuild/component-doc/core/element/form/CheckBoxField.yaml +338 -0
  26. package/public/rjbuild/component-doc/core/element/form/DateField.md +189 -0
  27. package/public/rjbuild/component-doc/core/element/form/DateField.yaml +264 -0
  28. package/public/rjbuild/component-doc/core/element/form/NumberField.md +136 -0
  29. package/public/rjbuild/component-doc/core/element/form/NumberField.yaml +103 -0
  30. package/public/rjbuild/component-doc/core/element/form/SelectField.md +304 -0
  31. package/public/rjbuild/component-doc/core/element/form/SelectField.yaml +360 -0
  32. package/public/rjbuild/component-doc/core/element/form/TextAreaField.md +134 -0
  33. package/public/rjbuild/component-doc/core/element/form/TextAreaField.yaml +146 -0
  34. package/public/rjbuild/component-doc/core/element/form/TextField.md +129 -0
  35. package/public/rjbuild/component-doc/core/element/form/TextField.yaml +147 -0
  36. package/public/rjbuild/component-doc/core/element/form/formElementsCommon.md +106 -0
  37. package/public/rjbuild/component-doc/core/element/form/index.md +50 -0
  38. package/public/rjbuild/component-doc/core/element/form/index.yaml +96 -0
  39. package/public/rjbuild/component-doc/core/element/html/AccordionItem.yaml +47 -0
  40. package/public/rjbuild/component-doc/core/element/html/FolderSortableTree.yaml +81 -0
  41. package/public/rjbuild/component-doc/core/element/html/FormatNumeral.yaml +58 -0
  42. package/public/rjbuild/component-doc/core/element/html/Html.yaml +67 -0
  43. package/public/rjbuild/component-doc/core/element/html/LabelFromValue.yaml +54 -0
  44. package/public/rjbuild/component-doc/core/element/html/Modal.yaml +93 -0
  45. package/public/rjbuild/component-doc/core/element/html/PreformattedMarkup.yaml +37 -0
  46. package/public/rjbuild/component-doc/core/element/html/SortableTreeItemCollapseButton.yaml +92 -0
  47. package/public/rjbuild/component-doc/core/element/html/Tabs.yaml +57 -0
  48. package/public/rjbuild/component-doc/core/element/special/BootstrapElement.md +17 -0
  49. package/public/rjbuild/component-doc/core/element/special/BootstrapElement.yaml +18 -0
  50. package/public/rjbuild/component-doc/core/element/special/Count.md +37 -0
  51. package/public/rjbuild/component-doc/core/element/special/Count.yaml +325 -0
  52. package/public/rjbuild/component-doc/core/element/special/DataFilter.md +149 -0
  53. package/public/rjbuild/component-doc/core/element/special/DataFilter.yaml +315 -0
  54. package/public/rjbuild/component-doc/core/element/special/DelayedActions.md +51 -0
  55. package/public/rjbuild/component-doc/core/element/special/DelayedActions.yaml +55 -0
  56. package/public/rjbuild/component-doc/core/element/special/PageControls.md +126 -0
  57. package/public/rjbuild/component-doc/core/element/special/PageControls.yaml +133 -0
  58. package/public/rjbuild/component-doc/core/element/special/Phantom.md +31 -0
  59. package/public/rjbuild/component-doc/core/element/special/Phantom.yaml +34 -0
  60. package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.md +27 -0
  61. package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.yaml +51 -0
  62. package/public/rjbuild/component-doc/core/element/special/Switch.md +262 -0
  63. package/public/rjbuild/component-doc/core/element/special/Switch.yaml +348 -0
  64. package/public/rjbuild/component-doc/core/example/accordion.md +96 -0
  65. package/public/rjbuild/component-doc/core/example/accordion.yaml +64 -0
  66. package/public/rjbuild/component-doc/core/example/dynamic-content.md +197 -0
  67. package/public/rjbuild/component-doc/core/example/dynamic-content.yaml +237 -0
  68. package/public/rjbuild/component-doc/core/example/html.md +66 -0
  69. package/public/rjbuild/component-doc/core/example/html.yaml +83 -0
  70. package/public/rjbuild/component-doc/core/example/website.yaml +1663 -0
  71. package/public/rjbuild/component-doc/core/reaction/addData.md +96 -0
  72. package/public/rjbuild/component-doc/core/reaction/addData.yaml +133 -0
  73. package/public/rjbuild/component-doc/core/reaction/fetchData.md +60 -0
  74. package/public/rjbuild/component-doc/core/reaction/fetchData.yaml +156 -0
  75. package/public/rjbuild/component-doc/core/reaction/index.md +236 -0
  76. package/public/rjbuild/component-doc/core/reaction/index.yaml +254 -0
  77. package/public/rjbuild/component-doc/core/reaction/moveData.md +68 -0
  78. package/public/rjbuild/component-doc/core/reaction/moveData.yaml +71 -0
  79. package/public/rjbuild/component-doc/core/reaction/postMessage.md +63 -0
  80. package/public/rjbuild/component-doc/core/reaction/postMessage.yaml +68 -0
  81. package/public/rjbuild/component-doc/core/reaction/redirectNow.md +37 -0
  82. package/public/rjbuild/component-doc/core/reaction/redirectNow.yaml +37 -0
  83. package/public/rjbuild/component-doc/core/reaction/removeData.md +78 -0
  84. package/public/rjbuild/component-doc/core/reaction/removeData.yaml +56 -0
  85. package/public/rjbuild/component-doc/core/reaction/setClipboardData.md +44 -0
  86. package/public/rjbuild/component-doc/core/reaction/setClipboardData.yaml +41 -0
  87. package/public/rjbuild/component-doc/core/reaction/setData.md +93 -0
  88. package/public/rjbuild/component-doc/core/reaction/setData.yaml +85 -0
  89. package/public/rjbuild/component-doc/core/reaction/submitData.md +138 -0
  90. package/public/rjbuild/component-doc/core/reaction/submitData.yaml +141 -0
  91. package/public/rjbuild/component-doc/core/reaction/triggerEvent.md +59 -0
  92. package/public/rjbuild/component-doc/core/reaction/triggerEvent.yaml +59 -0
  93. package/public/rjbuild/component-doc/index.yaml +13 -0
@@ -0,0 +1,57 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # Tabs
5
+
6
+ The `Tabs` component provides a tabbed interface using React-Bootstrap. Each tab must have a unique `eventKey` and a `title` in its attributes, and can contain any valid Reactive-JSON view content.
7
+
8
+ ## Properties
9
+ - `tabs` (array, required): Static array of tab objects. This array is not evaluated by the template system and must be defined statically in the schema.
10
+ - Each tab object must have:
11
+ - `attributes` (object, required):
12
+ - `title` (string, required): The label of the tab
13
+ - `eventKey` (string, required): A unique identifier for the tab
14
+ - Other attributes are passed to the React-Bootstrap Tab component
15
+ - `content` (array/object, required): The content to display in the tab. Can be any valid Reactive-JSON view (components, arrays, templates, etc.)
16
+
17
+ - type: RjBuildDescriber
18
+ title: "Interactive Example: Editable tabs"
19
+ description:
20
+ - type: Markdown
21
+ content: |
22
+ Edit the content of each tab and switch between them to see the result.
23
+ toDescribe:
24
+ renderView:
25
+ - type: Tabs
26
+ tabs:
27
+ - attributes:
28
+ eventKey: simple
29
+ title: "First tab"
30
+ content: "This tab has the value directly set."
31
+ - attributes:
32
+ eventKey: templateLoaded
33
+ title: "Template loaded tab"
34
+ content:
35
+ load: tabTemplate
36
+ - attributes:
37
+ eventKey: components
38
+ title: "Components"
39
+ content:
40
+ type: p
41
+ content: "You can put any component or template in the tab content."
42
+
43
+ templates:
44
+ tabTemplate:
45
+ text: "This tab content is from a template."
46
+
47
+ - type: Markdown
48
+ content: |
49
+ ## Limitations
50
+ - The `tabs` array must be static in the schema (no dynamic generation or template evaluation)
51
+ - Each tab must have a unique `eventKey` in its attributes
52
+ - The `title` attribute is required for each tab
53
+ - No support for dynamic addition/removal of tabs at runtime
54
+ - No built-in support for icons in tab headers
55
+ - No animation customization beyond what react-bootstrap provides
56
+ - All tab content is rendered at once (not lazy-loaded)
57
+ - Tab selection state is not persisted between renders
@@ -0,0 +1,17 @@
1
+ # BootstrapElement
2
+
3
+ ## Introduction
4
+
5
+ The `BootstrapElement` component is an internal wrapper used by Reactive-JSON to integrate React-Bootstrap components into the template system.
6
+
7
+ **You should not use this component directly in your rjbuild.**
8
+
9
+ It is automatically used by higher-level components (such as BsAccordion, BsAlert, etc.) to provide Bootstrap features in a declarative way.
10
+
11
+ ## Properties
12
+ - `attributes` (object, optional): Attributes passed to the underlying Bootstrap component
13
+ - `content` (object/array, optional): Content to render inside the Bootstrap component
14
+
15
+ ## Limitations
16
+ - Not intended for direct use in rjbuild templates
17
+ - Used internally by the system for Bootstrap integration
@@ -0,0 +1,18 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # BootstrapElement
5
+
6
+ The `BootstrapElement` component is an internal wrapper used by Reactive-JSON to integrate React-Bootstrap components into the template system.
7
+
8
+ **You should not use this component directly in your rjbuild.**
9
+
10
+ It is automatically used by higher-level components (such as BsAccordion, BsAlert, etc.) to provide Bootstrap features in a declarative way.
11
+
12
+ ## Properties
13
+ - `attributes` (object, optional): Attributes passed to the underlying Bootstrap component
14
+ - `content` (object/array, optional): Content to render inside the Bootstrap component
15
+
16
+ ## Limitations
17
+ - Not intended for direct use in rjbuild templates
18
+ - Used internally by the system for Bootstrap integration
@@ -0,0 +1,37 @@
1
+ # Count
2
+
3
+ ## Introduction
4
+
5
+ The `Count` component returns the number of items matching a JSONPath pattern in the data context. It is useful for displaying counts of elements, such as the number of items in a list, matching a filter, or present in a subtree.
6
+
7
+ ## Properties
8
+ - `jsonPathPattern` (string, required): The JSONPath pattern to evaluate for counting
9
+ - `context` (string, optional): The context to use for evaluation (`global`, `template`, or `root`). Default is `global`.
10
+
11
+ ## Behavior
12
+ - Evaluates the given JSONPath pattern on the selected data context
13
+ - Returns the number of matches found
14
+ - If `context` is `global`, uses the global data context; if `template`, uses the template context; if `root`, uses the root context
15
+ - If `jsonPathPattern` is not provided, renders nothing
16
+
17
+ ## Example
18
+ ```yaml
19
+ renderView:
20
+ - type: div
21
+ content:
22
+ - type: strong
23
+ content: "Number of users: "
24
+ - type: Count
25
+ jsonPathPattern: "$.users[*]"
26
+
27
+ data:
28
+ users:
29
+ - name: "Alice"
30
+ - name: "Bob"
31
+ - name: "Charlie"
32
+ ```
33
+
34
+ ## Limitations
35
+ - Only supports JSONPath patterns
36
+ - Returns 0 if no match or if the pattern is invalid
37
+ - Does not support advanced filtering or custom functions in JSONPath
@@ -0,0 +1,325 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # Count
5
+
6
+ The `Count` component returns the number of items matching a JSONPath pattern in the data context. It is useful for displaying counts of elements, such as the number of items in a list, matching a filter, or present in a subtree.
7
+
8
+ ## Properties
9
+ - `jsonPathPattern` (string, required): The JSONPath pattern to evaluate for counting
10
+ - `context` (string, optional): The context to use for evaluation (`global`, `template`, or `root`). Default is `global`.
11
+
12
+ ## Behavior
13
+ - Evaluates the given JSONPath pattern on the selected data context
14
+ - Returns the number of matches found
15
+ - If `context` is `global`, uses the global data context; if `template`, uses the template context; if `root`, uses the root context
16
+ - If `jsonPathPattern` is not provided, renders nothing
17
+
18
+ - type: RjBuildDescriber
19
+ title: "Example"
20
+ toDescribe:
21
+ renderView:
22
+ - type: div
23
+ content:
24
+ - type: strong
25
+ content: "Number of users: "
26
+ - type: Count
27
+ jsonPathPattern: "$.users[*]"
28
+
29
+ data:
30
+ users:
31
+ - name: "Alice"
32
+ - name: "Bob"
33
+ - name: "Charlie"
34
+
35
+ - type: RjBuildDescriber
36
+ title: "Interactive Example: Dynamic Count with User Management"
37
+ description:
38
+ - type: Markdown
39
+ content: |
40
+ This example demonstrates the Count component with different JSONPath patterns. Add or remove users and change their status to see how the counts update in real-time.
41
+ toDescribe:
42
+ renderView:
43
+ - type: div
44
+ attributes:
45
+ class: "container-fluid"
46
+ content:
47
+ - type: div
48
+ attributes:
49
+ class: "row mb-4"
50
+ content:
51
+ - type: div
52
+ attributes:
53
+ class: "col-md-6"
54
+ content:
55
+ - type: div
56
+ attributes:
57
+ class: "card"
58
+ content:
59
+ - type: div
60
+ attributes:
61
+ class: "card-header bg-primary text-white"
62
+ content:
63
+ - type: h5
64
+ attributes:
65
+ class: "card-title mb-0"
66
+ content: "📊 Count Statistics"
67
+ - type: div
68
+ attributes:
69
+ class: "card-body"
70
+ content:
71
+ - type: div
72
+ attributes:
73
+ class: "d-flex justify-content-between mb-2"
74
+ content:
75
+ - type: span
76
+ content: "Total users:"
77
+ - type: span
78
+ attributes:
79
+ class: "badge bg-secondary"
80
+ content:
81
+ type: Count
82
+ jsonPathPattern: "$.users[*]"
83
+ - type: div
84
+ attributes:
85
+ class: "d-flex justify-content-between mb-2"
86
+ content:
87
+ - type: span
88
+ content: "Active users:"
89
+ - type: span
90
+ attributes:
91
+ class: "badge bg-success"
92
+ content:
93
+ type: Count
94
+ jsonPathPattern: "$.users[?(@.status == 'active')]"
95
+ - type: div
96
+ attributes:
97
+ class: "d-flex justify-content-between mb-2"
98
+ content:
99
+ - type: span
100
+ content: "Inactive users:"
101
+ - type: span
102
+ attributes:
103
+ class: "badge bg-warning"
104
+ content:
105
+ type: Count
106
+ jsonPathPattern: "$.users[?(@.status == 'inactive')]"
107
+ - type: div
108
+ attributes:
109
+ class: "d-flex justify-content-between mb-2"
110
+ content:
111
+ - type: span
112
+ content: "Admins:"
113
+ - type: span
114
+ attributes:
115
+ class: "badge bg-danger"
116
+ content:
117
+ type: Count
118
+ jsonPathPattern: "$.users[?(@.role == 'admin')]"
119
+ - type: div
120
+ attributes:
121
+ class: "col-md-6"
122
+ content:
123
+ - type: div
124
+ attributes:
125
+ class: "card"
126
+ content:
127
+ - type: div
128
+ attributes:
129
+ class: "card-header bg-info text-white"
130
+ content:
131
+ - type: h5
132
+ attributes:
133
+ class: "card-title mb-0"
134
+ content: "➕ Add New User"
135
+ - type: div
136
+ attributes:
137
+ class: "card-body"
138
+ content:
139
+ - type: div
140
+ attributes:
141
+ class: "mb-3"
142
+ content:
143
+ - type: TextField
144
+ label: "Name:"
145
+ dataLocation: ~.newUser.name
146
+ placeholder: "Enter user name"
147
+ - type: div
148
+ attributes:
149
+ class: "mb-3"
150
+ content:
151
+ - type: SelectField
152
+ label: "Status:"
153
+ dataLocation: ~.newUser.status
154
+ options:
155
+ - label: "Active"
156
+ value: "active"
157
+ - label: "Inactive"
158
+ value: "inactive"
159
+ - type: div
160
+ attributes:
161
+ class: "mb-3"
162
+ content:
163
+ - type: SelectField
164
+ label: "Role:"
165
+ dataLocation: ~.newUser.role
166
+ options:
167
+ - label: "User"
168
+ value: "user"
169
+ - label: "Admin"
170
+ value: "admin"
171
+ - type: button
172
+ attributes:
173
+ class: "btn btn-primary"
174
+ content: "Add User"
175
+ actions:
176
+ - what: addData
177
+ on: click
178
+ path: ~.users
179
+ value:
180
+ name: ~.newUser.name
181
+ status: ~.newUser.status
182
+ role: ~.newUser.role
183
+ when: ~.newUser.name
184
+ isEmpty: not
185
+ - what: setData
186
+ on: click
187
+ path: ~.newUser
188
+ value:
189
+ name: ""
190
+ status: "active"
191
+ role: "user"
192
+ when: ~.newUser.name
193
+ isEmpty: not
194
+ - type: div
195
+ attributes:
196
+ class: "row"
197
+ content:
198
+ - type: div
199
+ attributes:
200
+ class: "col-12"
201
+ content:
202
+ - type: div
203
+ attributes:
204
+ class: "card"
205
+ content:
206
+ - type: div
207
+ attributes:
208
+ class: "card-header bg-secondary text-white"
209
+ content:
210
+ - type: h5
211
+ attributes:
212
+ class: "card-title mb-0"
213
+ content: "👥 User List"
214
+ - type: div
215
+ attributes:
216
+ class: "card-body"
217
+ content:
218
+ - type: Switch
219
+ content: ~.users
220
+ singleOption:
221
+ load: userItem
222
+
223
+ templates:
224
+ userItem:
225
+ type: div
226
+ attributes:
227
+ class: "list-group-item d-flex justify-content-between align-items-center mb-2 border rounded"
228
+ content:
229
+ - type: div
230
+ content:
231
+ - type: strong
232
+ content: ~.name
233
+ - type: span
234
+ attributes:
235
+ class: "ms-2 badge rounded-pill"
236
+ style:
237
+ backgroundColor: "#198754"
238
+ color: "white"
239
+ content: ~.status
240
+ actions:
241
+ - what: hide
242
+ when: ~.status
243
+ isNot: "active"
244
+ - type: span
245
+ attributes:
246
+ class: "ms-2 badge rounded-pill"
247
+ style:
248
+ backgroundColor: "#ffc107"
249
+ color: "black"
250
+ content: ~.status
251
+ actions:
252
+ - what: hide
253
+ when: ~.status
254
+ isNot: "inactive"
255
+ - type: span
256
+ attributes:
257
+ class: "ms-2 badge rounded-pill bg-danger"
258
+ content: ~.role
259
+ actions:
260
+ - what: hide
261
+ when: ~.role
262
+ isNot: "admin"
263
+ - type: div
264
+ content:
265
+ - type: button
266
+ attributes:
267
+ class: "btn btn-sm btn-outline-primary me-2"
268
+ content: "Toggle Status"
269
+ actions:
270
+ - what: setData
271
+ on: click
272
+ path: ~.status
273
+ value: "inactive"
274
+ when: ~.status
275
+ is: "active"
276
+ - what: setData
277
+ on: click
278
+ path: ~.status
279
+ value: "active"
280
+ when: ~.status
281
+ is: "inactive"
282
+ - type: button
283
+ attributes:
284
+ class: "btn btn-sm btn-outline-danger"
285
+ content: "Remove"
286
+ actions:
287
+ - what: removeData
288
+ on: click
289
+ target: currentTemplateData
290
+ parentLevel: 0
291
+
292
+ data:
293
+ newUser:
294
+ name: ""
295
+ status: "active"
296
+ role: "user"
297
+ users:
298
+ - name: "Alice Johnson"
299
+ status: "active"
300
+ role: "admin"
301
+ - name: "Bob Smith"
302
+ status: "active"
303
+ role: "user"
304
+ - name: "Charlie Brown"
305
+ status: "inactive"
306
+ role: "user"
307
+ - name: "Diana Prince"
308
+ status: "active"
309
+ role: "admin"
310
+
311
+ - type: Markdown
312
+ content: |
313
+ ## Common JSONPath Patterns for Count
314
+
315
+ - `$.users[*]` - Count all users
316
+ - `$.users[?(@.status == 'active')]` - Count users with specific status
317
+ - `$.users[?(@.role == 'admin')]` - Count users with specific role
318
+ - `$.users[?(@.age > 25)]` - Count users older than 25
319
+ - `$.categories[*].items[*]` - Count all items across all categories
320
+ - `$..products` - Count all products at any level (recursive)
321
+
322
+ ## Limitations
323
+ - Only supports JSONPath patterns
324
+ - Returns 0 if no match or if the pattern is invalid
325
+ - Does not support advanced filtering or custom functions in JSONPath
@@ -0,0 +1,149 @@
1
+ # DataFilter
2
+
3
+ ## Introduction
4
+
5
+ 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.
6
+
7
+ ## Properties
8
+ - `filters` (array, required): Array of filter objects, each specifying properties and conditions to check
9
+ - `subjectsWithProperty` (string): Property to check in the data, acts as namespace
10
+ - `andConditions` (array): List of conditions that must all be true
11
+ - `orConditions` (array): List of conditions where at least one must be true
12
+ - Available conditions:
13
+ - `when`: Checks a condition on a value
14
+ - `is`: Compares exact equality
15
+ - `isNot`: Checks inequality
16
+ - `isEmpty`: Checks if a value is empty
17
+ - `contains`: Checks if a value contains a substring
18
+ - `>=`, `<=`, `>`, `<`: Numeric comparisons
19
+ - `compareAsDates`: Boolean to compare values as dates
20
+ - `whenFilterableData`: Specifies the data path to filter, must include the namespace
21
+ - `context` (string, optional): Context to filter (`global` or `template`). Default: `global`
22
+ - `content` (object/array, required): Content to render after filtering
23
+
24
+ ## Behavior
25
+ - Applies all filters to the selected context before content rendering
26
+ - Supports complex filtering conditions with `andConditions` and `orConditions`
27
+ - Allows recursive filtering while preserving data structure
28
+ - Can be combined with other components to create interactive filtering interfaces
29
+ - Supports dynamic filtering based on application state
30
+
31
+ ## Filterable Data Structure
32
+
33
+ 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.
34
+
35
+ ### Namespace Pattern
36
+
37
+ 1. **In the data structure**:
38
+ ```yaml
39
+ data:
40
+ filteredItems:
41
+ - item: # <- Identification key (namespace)
42
+ id: 1
43
+ title: "..."
44
+ - item: # <- Same key for each item
45
+ id: 2
46
+ title: "..."
47
+ ```
48
+
49
+ 2. **In filtering conditions**:
50
+ ```yaml
51
+ type: DataFilter
52
+ context: global
53
+ filters:
54
+ - subjectsWithProperty: item # <- Declares the namespace
55
+ andConditions:
56
+ - orConditions:
57
+ - whenFilterableData: item.title # <- Uses the namespace
58
+ contains: "..."
59
+ ```
60
+
61
+ The identification key (here "item"):
62
+ - Can have any name (`itemXyz`, `element`, etc.)
63
+ - Must be consistent between data structure and conditions
64
+ - Serves as a namespace for accessing properties in `whenFilterableData`
65
+ - Is required for DataFilter to correctly identify filterable elements
66
+
67
+ ## Example
68
+
69
+ ```yaml
70
+ renderView:
71
+ - type: DataFilter
72
+ context: global
73
+ filters:
74
+ - subjectsWithProperty: item
75
+ andConditions:
76
+ # Text search filter
77
+ - orConditions:
78
+ - when: ~~._filters.search
79
+ isEmpty:
80
+ - whenFilterableData: item.searchableContent
81
+ contains: ~~._filters.search
82
+
83
+ # Date filter
84
+ - orConditions:
85
+ - when: ~~._filters.since
86
+ isEmpty:
87
+ - whenFilterableData: item.creationDate
88
+ ">=": ~~._filters.since
89
+ compareAsDates: true
90
+
91
+ # Status filter
92
+ - orConditions:
93
+ - when: ~~._filters.status
94
+ isNot: active_only
95
+ - whenFilterableData: item.status
96
+ is: active
97
+
98
+ content:
99
+ - type: Switch
100
+ content: ~~.filteredItems
101
+ singleOption:
102
+ - type: div
103
+ content:
104
+ - type: span
105
+ content: ~.item.searchableContent
106
+ - type: span
107
+ attributes:
108
+ class: "badge"
109
+ content: ~.item.status
110
+
111
+ data:
112
+ _filters:
113
+ search: ""
114
+ since: ""
115
+ status: "all"
116
+ filteredItems:
117
+ - item:
118
+ id: 1
119
+ searchableContent: "First item"
120
+ status: "active"
121
+ creationDate: "2024-03-20"
122
+ - item:
123
+ id: 2
124
+ searchableContent: "Second item"
125
+ status: "inactive"
126
+ creationDate: "2024-03-19"
127
+ ```
128
+
129
+ ## Advanced Use Cases
130
+ - Multi-criteria filtering with combined conditions
131
+ - Real-time search interface
132
+ - Hierarchical data filtering (trees, sub-elements)
133
+ - Complex state management (conflicts, modifications, new elements)
134
+ - Integration with pagination components
135
+ - Date-based filtering and numeric comparisons
136
+
137
+ ## Best Practices
138
+ - Organize filters by logical category
139
+ - Use comments to document complex conditions
140
+ - Combine with UI components for interactive experience
141
+ - Consider performance with large datasets
142
+ - Use reusable templates for common filters
143
+ - Use consistent namespace patterns across your application
144
+
145
+ ## Limitations
146
+ - Filtering is based on simple comparisons
147
+ - Performance may be impacted with very large datasets
148
+ - Does not support custom filtering functions
149
+ - Filtering is applied recursively on the entire structure