@adriansteffan/reactive 0.1.0 → 0.1.1
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.md +10 -0
- package/dist/{mod-D9lwPIrH.js → mod-Beb0Bz3s.js} +921 -919
- package/dist/mod.d.ts +2 -0
- package/dist/reactive.es.js +31 -30
- package/dist/reactive.umd.js +30 -30
- package/dist/{web-DXP3LAJm.js → web-DOXm98lr.js} +1 -1
- package/dist/{web-DUIQX1PV.js → web-aMUVS_EB.js} +1 -1
- package/package.json +1 -1
- package/src/components/canvasblock.tsx +2 -8
- package/src/mod.tsx +1 -1
- package/src/utils/upload.ts +10 -0
package/package.json
CHANGED
|
@@ -15,15 +15,9 @@ import {
|
|
|
15
15
|
} from '../utils/bytecode';
|
|
16
16
|
import { BaseComponentProps, isFullscreen, now } from '../utils/common';
|
|
17
17
|
import { registerSimulation, ParticipantState } from '../utils/simulation';
|
|
18
|
-
import { registerFlattener } from '../utils/upload';
|
|
18
|
+
import { registerFlattener, arrayFlattener } from '../utils/upload';
|
|
19
19
|
|
|
20
|
-
registerFlattener('CanvasBlock', 'canvas',
|
|
21
|
-
const responseData = item.responseData;
|
|
22
|
-
if (Array.isArray(responseData)) {
|
|
23
|
-
return responseData.map((i) => ({ block: item.name, ...i }));
|
|
24
|
-
}
|
|
25
|
-
return [];
|
|
26
|
-
});
|
|
20
|
+
registerFlattener('CanvasBlock', 'canvas', arrayFlattener);
|
|
27
21
|
|
|
28
22
|
export type SlideSimulatorResult = {
|
|
29
23
|
key: string | null;
|
package/src/mod.tsx
CHANGED
|
@@ -5,7 +5,7 @@ export type { BaseComponentProps, ExperimentConfig };
|
|
|
5
5
|
export * from './utils/array';
|
|
6
6
|
export * from './utils/common';
|
|
7
7
|
export * from './utils/simulation';
|
|
8
|
-
export { registerFlattener } from './utils/upload';
|
|
8
|
+
export { registerFlattener, arrayFlattener } from './utils/upload';
|
|
9
9
|
export * from './components';
|
|
10
10
|
|
|
11
11
|
export * from 'react-toastify';
|
package/src/utils/upload.ts
CHANGED
|
@@ -21,6 +21,16 @@ export function registerFlattener(
|
|
|
21
21
|
flattenerRegistry[type].push({ csv, flatten });
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// Reusable flattener for components whose responseData is an array of objects.
|
|
25
|
+
// Each array element becomes a CSV row. Non-array responseData produces an empty result.
|
|
26
|
+
export function arrayFlattener(item: TrialData): any[] {
|
|
27
|
+
const responseData = item.responseData;
|
|
28
|
+
if (Array.isArray(responseData)) {
|
|
29
|
+
return responseData.map((i) => ({ block: item.name, ...i }));
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
export function escapeCsvValue(value: any): string {
|
|
25
35
|
if (value === null || value === undefined) {
|
|
26
36
|
return '';
|