@ea-lab/reactive-json-docs 2.1.0 → 2.2.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
CHANGED
|
@@ -266,12 +266,48 @@ additionalDataSource:
|
|
|
266
266
|
```
|
|
267
267
|
|
|
268
268
|
### Properties
|
|
269
|
-
- **`src`** (required): URL of the data source
|
|
269
|
+
- **`src`** (required): URL of the data source. Can be a **string** (used as-is) or an **array of segments** that are resolved and concatenated (see [Dynamic URLs](#dynamic-urls-with-src-as-array) below)
|
|
270
270
|
- **`path`** (optional): Path where to place the data (template syntax)
|
|
271
271
|
- **`method`** (optional): HTTP method (GET, POST, etc.)
|
|
272
272
|
- **`dataMapping`** (optional): Configure selective data dispatch using mapping processors
|
|
273
273
|
- **`blocking`** (optional): If `true`, waits for loading before displaying
|
|
274
274
|
|
|
275
|
+
### Dynamic URLs with `src` as Array
|
|
276
|
+
|
|
277
|
+
When `src` is an array, each segment is resolved individually and then concatenated into the final URL. Segments starting with `~~.` are treated as references to the store data and are replaced with their resolved values.
|
|
278
|
+
|
|
279
|
+
This is particularly useful when an RjBuild is loaded inside a `ReactiveJsonSubroot` with `dataOverride`, where dynamic values (like entity IDs) are injected by the parent.
|
|
280
|
+
|
|
281
|
+
```yaml
|
|
282
|
+
# Parent RjBuild passes taskId via dataOverride
|
|
283
|
+
- type: ReactiveJsonSubroot
|
|
284
|
+
rjOptions:
|
|
285
|
+
rjBuildUrl: "/components/TimeLogManager.yaml"
|
|
286
|
+
dataOverride:
|
|
287
|
+
taskId: ~.task.id
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
```yaml
|
|
291
|
+
# TimeLogManager.yaml — uses taskId in additionalDataSource
|
|
292
|
+
additionalDataSource:
|
|
293
|
+
- src:
|
|
294
|
+
- "/api/time-logs?filter[task]="
|
|
295
|
+
- ~~.taskId
|
|
296
|
+
path: ~~.timeLogs
|
|
297
|
+
blocking: true
|
|
298
|
+
|
|
299
|
+
data:
|
|
300
|
+
taskId: "" # Will be overridden by dataOverride
|
|
301
|
+
timeLogs: []
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
In this example, if `taskId` is `"42"`, the resolved URL will be `/api/time-logs?filter[task]=42`.
|
|
305
|
+
|
|
306
|
+
**Rules:**
|
|
307
|
+
- Only `~~.` (global/root data) references are supported in `src` segments — `~.` (local template context) is not available during initialization
|
|
308
|
+
- If a `~~.` reference resolves to `null` or `undefined`, it is replaced with an empty string and a warning is logged
|
|
309
|
+
- When `src` is a plain string, it behaves exactly as before (full backward compatibility)
|
|
310
|
+
|
|
275
311
|
### Loading Modes
|
|
276
312
|
|
|
277
313
|
#### Blocking loading
|
|
@@ -305,12 +305,55 @@ renderView:
|
|
|
305
305
|
content: |
|
|
306
306
|
|
|
307
307
|
### Properties
|
|
308
|
-
- **`src`** (required): URL of the data source
|
|
308
|
+
- **`src`** (required): URL of the data source. Can be a **string** (used as-is) or an **array of segments** that are resolved and concatenated (see [Dynamic URLs](#dynamic-urls-with-src-as-array) below)
|
|
309
309
|
- **`path`** (optional): Path where to place the data (template syntax)
|
|
310
310
|
- **`method`** (optional): HTTP method (GET, POST, etc.)
|
|
311
311
|
- **`dataMapping`** (optional): Configure selective data dispatch using mapping processors
|
|
312
312
|
- **`blocking`** (optional): If `true`, waits for loading before displaying
|
|
313
313
|
|
|
314
|
+
### Dynamic URLs with `src` as Array
|
|
315
|
+
|
|
316
|
+
When `src` is an array, each segment is resolved individually and then concatenated into the final URL. Segments starting with `~~.` are treated as references to the store data and are replaced with their resolved values.
|
|
317
|
+
|
|
318
|
+
This is particularly useful when an RjBuild is loaded inside a `ReactiveJsonSubroot` with `dataOverride`, where dynamic values (like entity IDs) are injected by the parent.
|
|
319
|
+
|
|
320
|
+
- type: TabbedSerializer
|
|
321
|
+
yamlSerializedContent: |
|
|
322
|
+
# Parent RjBuild passes taskId via dataOverride
|
|
323
|
+
renderView:
|
|
324
|
+
- type: ReactiveJsonSubroot
|
|
325
|
+
rjOptions:
|
|
326
|
+
rjBuildUrl: "/components/TimeLogManager.yaml"
|
|
327
|
+
dataOverride:
|
|
328
|
+
taskId: ~.task.id
|
|
329
|
+
|
|
330
|
+
- type: Markdown
|
|
331
|
+
content: |
|
|
332
|
+
|
|
333
|
+
- type: TabbedSerializer
|
|
334
|
+
yamlSerializedContent: |
|
|
335
|
+
# TimeLogManager.yaml — uses taskId in additionalDataSource
|
|
336
|
+
additionalDataSource:
|
|
337
|
+
- src:
|
|
338
|
+
- "/api/time-logs?filter[task]="
|
|
339
|
+
- ~~.taskId
|
|
340
|
+
path: ~~.timeLogs
|
|
341
|
+
blocking: true
|
|
342
|
+
|
|
343
|
+
data:
|
|
344
|
+
taskId: "" # Will be overridden by dataOverride
|
|
345
|
+
timeLogs: []
|
|
346
|
+
|
|
347
|
+
- type: Markdown
|
|
348
|
+
content: |
|
|
349
|
+
|
|
350
|
+
In this example, if `taskId` is `"42"`, the resolved URL will be `/api/time-logs?filter[task]=42`.
|
|
351
|
+
|
|
352
|
+
**Rules:**
|
|
353
|
+
- Only `~~.` (global/root data) references are supported in `src` segments — `~.` (local template context) is not available during initialization
|
|
354
|
+
- If a `~~.` reference resolves to `null` or `undefined`, it is replaced with an empty string and a warning is logged
|
|
355
|
+
- When `src` is a plain string, it behaves exactly as before (full backward compatibility)
|
|
356
|
+
|
|
314
357
|
### Loading Modes
|
|
315
358
|
|
|
316
359
|
#### Blocking loading
|