@enspiredigital/xlms-headless 0.0.10 → 0.0.11
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/dist/components/DragDrop.d.ts +4 -0
- package/dist/components/DragDrop.d.ts.map +1 -0
- package/dist/components/Labeling.d.ts +4 -0
- package/dist/components/Labeling.d.ts.map +1 -0
- package/dist/components/Ordering.d.ts +4 -0
- package/dist/components/Ordering.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useDragDrop.d.ts +25 -0
- package/dist/hooks/useDragDrop.d.ts.map +1 -0
- package/dist/hooks/useFillInBlank.d.ts +1 -1
- package/dist/hooks/useFillInBlank.d.ts.map +1 -1
- package/dist/hooks/useGrouping.d.ts +8 -0
- package/dist/hooks/useGrouping.d.ts.map +1 -1
- package/dist/hooks/useLabeling.d.ts +27 -0
- package/dist/hooks/useLabeling.d.ts.map +1 -0
- package/dist/hooks/useOrdering.d.ts +24 -0
- package/dist/hooks/useOrdering.d.ts.map +1 -0
- package/dist/index.js +538 -254
- package/dist/types/dragDrop.d.ts +27 -0
- package/dist/types/dragDrop.d.ts.map +1 -0
- package/dist/types/fillInBlank.d.ts +1 -1
- package/dist/types/fillInBlank.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/labeling.d.ts +30 -0
- package/dist/types/labeling.d.ts.map +1 -0
- package/dist/types/ordering.d.ts +16 -0
- package/dist/types/ordering.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DragDropQuestionType, PropsComponent } from '../types';
|
|
2
|
+
import { useDragDrop } from '../hooks';
|
|
3
|
+
export declare function DragDropQuestion({ getData, children, }: PropsComponent<DragDropQuestionType, ReturnType<typeof useDragDrop>>): import('react').ReactNode;
|
|
4
|
+
//# sourceMappingURL=DragDrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDrop.d.ts","sourceRoot":"","sources":["../../src/components/DragDrop.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CACf,oBAAoB,EACpB,UAAU,CAAC,OAAO,WAAW,CAAC,CAC/B,6BAGA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LabelingQuestionType, PropsComponent } from '../types';
|
|
2
|
+
import { useLabeling } from '../hooks';
|
|
3
|
+
export declare function LabelingQuestion({ getData, children, }: PropsComponent<LabelingQuestionType, ReturnType<typeof useLabeling>>): import('react').ReactNode;
|
|
4
|
+
//# sourceMappingURL=Labeling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Labeling.d.ts","sourceRoot":"","sources":["../../src/components/Labeling.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CACf,oBAAoB,EACpB,UAAU,CAAC,OAAO,WAAW,CAAC,CAC/B,6BAGA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OrderingQuestionType, PropsComponent } from '../types';
|
|
2
|
+
import { useOrdering } from '../hooks';
|
|
3
|
+
export declare function OrderingQuestion({ getData, children, }: PropsComponent<OrderingQuestionType, ReturnType<typeof useOrdering>>): import('react').ReactNode;
|
|
4
|
+
//# sourceMappingURL=Ordering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ordering.d.ts","sourceRoot":"","sources":["../../src/components/Ordering.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CACf,oBAAoB,EACpB,UAAU,CAAC,OAAO,WAAW,CAAC,CAC/B,6BAGA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './MultipleChoices';
|
|
2
2
|
export * from './Matching';
|
|
3
3
|
export * from './Video';
|
|
4
|
+
export * from './DragDrop';
|
|
5
|
+
export * from './Ordering';
|
|
6
|
+
export * from './Labeling';
|
|
4
7
|
export * from './FillInBlank';
|
|
5
8
|
export * from './Grouping';
|
|
6
9
|
export * from './Powerpoint';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export * from './useMultipleChoices';
|
|
|
2
2
|
export * from './useBaseQuestion';
|
|
3
3
|
export * from './useMatching';
|
|
4
4
|
export * from './useVideo';
|
|
5
|
+
export * from './useDragDrop';
|
|
6
|
+
export * from './useOrdering';
|
|
7
|
+
export * from './useLabeling';
|
|
5
8
|
export * from './useFillInBlank';
|
|
6
9
|
export * from './useGrouping';
|
|
7
10
|
export * from './usePowerpoint';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DragDropQuestionType, DragDropAnswer, DragDropItem } from '../types';
|
|
2
|
+
export declare function useDragDrop(question: DragDropQuestionType): {
|
|
3
|
+
items: DragDropItem[];
|
|
4
|
+
dropZones: import('..').DragDropZone[];
|
|
5
|
+
answers: DragDropAnswer[];
|
|
6
|
+
availableItems: DragDropItem[];
|
|
7
|
+
question: DragDropQuestionType;
|
|
8
|
+
draggingItemId: string | null;
|
|
9
|
+
submitted: boolean | null;
|
|
10
|
+
isCorrect: boolean | null;
|
|
11
|
+
attempts: number;
|
|
12
|
+
canAnswer: boolean;
|
|
13
|
+
dropItem: (itemId: string, zoneId: string) => void;
|
|
14
|
+
removeItem: (itemId: string) => void;
|
|
15
|
+
moveItem: (itemId: string, newZoneId: string) => void;
|
|
16
|
+
getItemsInZone: (zoneId: string) => DragDropItem[];
|
|
17
|
+
setDraggingItemId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
|
18
|
+
submit: () => {
|
|
19
|
+
isCorrect: boolean;
|
|
20
|
+
score: number;
|
|
21
|
+
maxScore: number;
|
|
22
|
+
};
|
|
23
|
+
reset: () => void;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useDragDrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDragDrop.d.ts","sourceRoot":"","sources":["../../src/hooks/useDragDrop.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;uBAwB9B,MAAM,UAAU,MAAM;yBAwBpB,MAAM;uBAKR,MAAM,aAAa,MAAM;6BAKnB,MAAM,KAAG,YAAY,EAAE;;;;;;;;EAsFxD"}
|
|
@@ -7,7 +7,7 @@ export declare function useFillInBlank(question: FillInBlankQuestionType): {
|
|
|
7
7
|
isCorrect: boolean | null;
|
|
8
8
|
attempts: number;
|
|
9
9
|
canAnswer: boolean;
|
|
10
|
-
answer: (
|
|
10
|
+
answer: (blankId: string, value: string) => void;
|
|
11
11
|
submit: () => {
|
|
12
12
|
isCorrect: boolean;
|
|
13
13
|
score: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFillInBlank.d.ts","sourceRoot":"","sources":["../../src/hooks/useFillInBlank.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,uBAAuB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useFillInBlank.d.ts","sourceRoot":"","sources":["../../src/hooks/useFillInBlank.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,uBAAuB;;;;;;;;sBAYrC,MAAM,SAAS,MAAM;;;;;;;EA8E/C"}
|
|
@@ -3,6 +3,14 @@ export declare function useGrouping(question: GroupingQuestionType): {
|
|
|
3
3
|
categories: import('..').GroupingCategory[];
|
|
4
4
|
allItems: import('..').GroupingItem[];
|
|
5
5
|
question: GroupingQuestionType;
|
|
6
|
+
categoriesWithItems: {
|
|
7
|
+
items: {
|
|
8
|
+
item: import('..').GroupingItem | undefined;
|
|
9
|
+
}[];
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
media?: import('..').Media;
|
|
13
|
+
}[];
|
|
6
14
|
answers: GroupingAnswer[];
|
|
7
15
|
unassignedItems: import('..').GroupingItem[];
|
|
8
16
|
submitted: boolean | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGrouping.d.ts","sourceRoot":"","sources":["../../src/hooks/useGrouping.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB
|
|
1
|
+
{"version":3,"file":"useGrouping.d.ts","sourceRoot":"","sources":["../../src/hooks/useGrouping.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;mBAYlC,MAAM,cAAc,MAAM;qBAYxB,MAAM;;;;;;;EAqG/B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LabelingQuestionType, LabelingAnswer, LabelingLabel } from '../types';
|
|
2
|
+
export declare function useLabeling(question: LabelingQuestionType): {
|
|
3
|
+
image: import('..').Media;
|
|
4
|
+
labels: LabelingLabel[];
|
|
5
|
+
points: import('..').LabelingPoint[];
|
|
6
|
+
answers: LabelingAnswer[];
|
|
7
|
+
availableLabels: LabelingLabel[];
|
|
8
|
+
question: LabelingQuestionType;
|
|
9
|
+
draggingLabelId: string | null;
|
|
10
|
+
submitted: boolean | null;
|
|
11
|
+
isCorrect: boolean | null;
|
|
12
|
+
attempts: number;
|
|
13
|
+
canAnswer: boolean;
|
|
14
|
+
attachLabel: (labelId: string, pointId: string, x?: number, y?: number) => void;
|
|
15
|
+
removeLabel: (labelId: string) => void;
|
|
16
|
+
moveLabel: (labelId: string, newPointId: string, x?: number, y?: number) => void;
|
|
17
|
+
getLabelAtPoint: (pointId: string) => LabelingLabel | null;
|
|
18
|
+
getPointForLabel: (labelId: string) => string | null;
|
|
19
|
+
setDraggingLabelId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
|
20
|
+
submit: () => {
|
|
21
|
+
isCorrect: boolean;
|
|
22
|
+
score: number;
|
|
23
|
+
maxScore: number;
|
|
24
|
+
};
|
|
25
|
+
reset: () => void;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=useLabeling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLabeling.d.ts","sourceRoot":"","sources":["../../src/hooks/useLabeling.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;;2BA0B1B,MAAM,WAAW,MAAM,MAAM,MAAM,MAAM,MAAM;2BAqB/C,MAAM;yBAKR,MAAM,cAAc,MAAM,MAAM,MAAM,MAAM,MAAM;+BAK5C,MAAM,KAAG,aAAa,GAAG,IAAI;gCAW5B,MAAM,KAAG,MAAM,GAAG,IAAI;;;;;;;;EAyE1D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OrderingQuestionType, OrderingItem } from '../types';
|
|
2
|
+
export declare function useOrdering(question: OrderingQuestionType): {
|
|
3
|
+
items: OrderingItem[];
|
|
4
|
+
orderedItems: OrderingItem[];
|
|
5
|
+
orderedItemIds: string[];
|
|
6
|
+
question: OrderingQuestionType;
|
|
7
|
+
draggingItemId: string | null;
|
|
8
|
+
submitted: boolean | null;
|
|
9
|
+
isCorrect: boolean | null;
|
|
10
|
+
attempts: number;
|
|
11
|
+
canAnswer: boolean;
|
|
12
|
+
moveItem: (fromIndex: number, toIndex: number) => void;
|
|
13
|
+
moveUp: (itemId: string) => void;
|
|
14
|
+
moveDown: (itemId: string) => void;
|
|
15
|
+
moveToPosition: (itemId: string, newPosition: number) => void;
|
|
16
|
+
setDraggingItemId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
|
17
|
+
submit: () => {
|
|
18
|
+
isCorrect: boolean;
|
|
19
|
+
score: number;
|
|
20
|
+
maxScore: number;
|
|
21
|
+
};
|
|
22
|
+
reset: () => void;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=useOrdering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOrdering.d.ts","sourceRoot":"","sources":["../../src/hooks/useOrdering.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE9D,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;0BA0B3B,MAAM,WAAW,MAAM;qBAU5B,MAAM;uBAQJ,MAAM;6BAQA,MAAM,eAAe,MAAM;;;;;;;;EAuE5D"}
|
package/dist/index.js
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
function
|
|
3
|
-
const [t,
|
|
4
|
-
function
|
|
5
|
-
|
|
1
|
+
import { useState as S, useEffect as y, useMemo as B } from "react";
|
|
2
|
+
function M() {
|
|
3
|
+
const [t, c] = S(null), [u, g] = S(null), [w, h] = S(0);
|
|
4
|
+
function Q(d) {
|
|
5
|
+
c(!0), g(d), h((v) => v + 1);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function n() {
|
|
8
|
+
c(!1), g(null);
|
|
9
9
|
}
|
|
10
10
|
return {
|
|
11
11
|
// state
|
|
12
12
|
submitted: t,
|
|
13
|
-
isCorrect:
|
|
14
|
-
attempts:
|
|
13
|
+
isCorrect: u,
|
|
14
|
+
attempts: w,
|
|
15
15
|
// derived
|
|
16
16
|
canAnswer: !t,
|
|
17
17
|
// actions
|
|
18
|
-
submitQuestion:
|
|
19
|
-
resetQuestion:
|
|
18
|
+
submitQuestion: Q,
|
|
19
|
+
resetQuestion: n
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
if (t.length !==
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
for (const
|
|
27
|
-
if (!
|
|
22
|
+
function k(t, c) {
|
|
23
|
+
if (t.length !== c.length) return !1;
|
|
24
|
+
const u = new Set(t), g = new Set(c);
|
|
25
|
+
if (u.size !== g.size) return !1;
|
|
26
|
+
for (const w of u)
|
|
27
|
+
if (!g.has(w)) return !1;
|
|
28
28
|
return !0;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function V(t) {
|
|
31
31
|
const {
|
|
32
|
-
canAnswer:
|
|
33
|
-
submitted:
|
|
34
|
-
isCorrect:
|
|
35
|
-
attempts:
|
|
36
|
-
resetQuestion:
|
|
37
|
-
submitQuestion:
|
|
38
|
-
} =
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
function
|
|
43
|
-
if (
|
|
32
|
+
canAnswer: c,
|
|
33
|
+
submitted: u,
|
|
34
|
+
isCorrect: g,
|
|
35
|
+
attempts: w,
|
|
36
|
+
resetQuestion: h,
|
|
37
|
+
submitQuestion: Q
|
|
38
|
+
} = M(), [n, d] = S([]);
|
|
39
|
+
function v(C) {
|
|
40
|
+
d((p) => t.options.allowMultipleAnswers ? p.includes(C) ? p.filter((I) => I !== C) : [...p, C] : [C]);
|
|
41
|
+
}
|
|
42
|
+
function O() {
|
|
43
|
+
if (n.length === 0) return;
|
|
44
44
|
const C = t.options.answers.reduce(
|
|
45
|
-
(
|
|
45
|
+
(I, A) => (A.is_correct && I.push(A.id), I),
|
|
46
46
|
[]
|
|
47
|
-
),
|
|
48
|
-
|
|
47
|
+
), p = k(n, C);
|
|
48
|
+
Q(p);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
50
|
+
function L() {
|
|
51
|
+
d([]), h();
|
|
52
52
|
}
|
|
53
53
|
return {
|
|
54
54
|
// data
|
|
55
55
|
question: t,
|
|
56
|
-
selectedIds:
|
|
56
|
+
selectedIds: n,
|
|
57
57
|
// actions
|
|
58
|
-
select:
|
|
59
|
-
submit:
|
|
60
|
-
reset:
|
|
58
|
+
select: v,
|
|
59
|
+
submit: O,
|
|
60
|
+
reset: L,
|
|
61
61
|
// base
|
|
62
|
-
submitted:
|
|
63
|
-
isCorrect:
|
|
64
|
-
attempts:
|
|
65
|
-
canAnswer:
|
|
62
|
+
submitted: u,
|
|
63
|
+
isCorrect: g,
|
|
64
|
+
attempts: w,
|
|
65
|
+
canAnswer: c
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function z(t) {
|
|
69
69
|
const {
|
|
70
|
-
canAnswer:
|
|
71
|
-
submitted:
|
|
72
|
-
isCorrect:
|
|
73
|
-
attempts:
|
|
74
|
-
submitQuestion:
|
|
75
|
-
resetQuestion:
|
|
76
|
-
} =
|
|
70
|
+
canAnswer: c,
|
|
71
|
+
submitted: u,
|
|
72
|
+
isCorrect: g,
|
|
73
|
+
attempts: w,
|
|
74
|
+
submitQuestion: h,
|
|
75
|
+
resetQuestion: Q
|
|
76
|
+
} = M(), [n, d] = S([]), [v, O] = S(
|
|
77
77
|
[]
|
|
78
|
-
), [
|
|
78
|
+
), [L, C] = S(
|
|
79
79
|
[]
|
|
80
80
|
);
|
|
81
|
-
function l
|
|
82
|
-
|
|
83
|
-
...
|
|
84
|
-
(
|
|
81
|
+
function p(l, r) {
|
|
82
|
+
d((s) => [
|
|
83
|
+
...s.filter(
|
|
84
|
+
(o) => o.targetId !== l && o.sourceId !== r
|
|
85
85
|
),
|
|
86
|
-
{ targetId:
|
|
86
|
+
{ targetId: l, sourceId: r }
|
|
87
87
|
]);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
(
|
|
89
|
+
function I(l, r) {
|
|
90
|
+
d(
|
|
91
|
+
(s) => s.filter((o) => o.targetId !== l || o.sourceId !== r)
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
let
|
|
96
|
-
return t.options.targets.forEach((
|
|
97
|
-
const
|
|
98
|
-
|
|
94
|
+
function A() {
|
|
95
|
+
let l = 0, r = !0;
|
|
96
|
+
return t.options.targets.forEach((s) => {
|
|
97
|
+
const o = n.find((i) => i.targetId === s.id), e = t.options.sources[s.content.correct_position - 1];
|
|
98
|
+
o && e && o.sourceId === e.id ? l += s.content.point : r = !1;
|
|
99
99
|
}), {
|
|
100
|
-
isCorrect:
|
|
101
|
-
score:
|
|
100
|
+
isCorrect: r,
|
|
101
|
+
score: l,
|
|
102
102
|
maxScore: t.options.targets.reduce(
|
|
103
|
-
(
|
|
103
|
+
(s, o) => s + o.content.point,
|
|
104
104
|
0
|
|
105
105
|
)
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function m() {
|
|
109
|
-
const o = n();
|
|
110
|
-
return w(o.isCorrect), o;
|
|
111
|
-
}
|
|
112
108
|
function a() {
|
|
113
|
-
|
|
109
|
+
const l = A();
|
|
110
|
+
return h(l.isCorrect), l;
|
|
111
|
+
}
|
|
112
|
+
function m() {
|
|
113
|
+
d([]), Q();
|
|
114
114
|
}
|
|
115
|
-
return
|
|
116
|
-
const
|
|
117
|
-
(
|
|
115
|
+
return y(() => {
|
|
116
|
+
const l = t.options.sources.filter(
|
|
117
|
+
(r) => !n.some((s) => s.sourceId === r.id)
|
|
118
118
|
);
|
|
119
|
-
|
|
120
|
-
}, [
|
|
121
|
-
const
|
|
122
|
-
(
|
|
119
|
+
O(l);
|
|
120
|
+
}, [n, t.options.sources]), y(() => {
|
|
121
|
+
const l = t.options.targets.filter(
|
|
122
|
+
(r) => !n.some((s) => s.targetId === r.id)
|
|
123
123
|
);
|
|
124
|
-
C(
|
|
125
|
-
}, [
|
|
124
|
+
C(l);
|
|
125
|
+
}, [n, t.options.targets]), {
|
|
126
126
|
// data
|
|
127
127
|
sources: t.options.sources,
|
|
128
128
|
targets: t.options.targets,
|
|
129
|
-
answers:
|
|
129
|
+
answers: n,
|
|
130
130
|
question: t,
|
|
131
|
-
availableSources:
|
|
132
|
-
availableTargets:
|
|
131
|
+
availableSources: v,
|
|
132
|
+
availableTargets: L,
|
|
133
133
|
// base
|
|
134
|
-
submitted:
|
|
135
|
-
isCorrect:
|
|
136
|
-
attempts:
|
|
137
|
-
canAnswer:
|
|
134
|
+
submitted: u,
|
|
135
|
+
isCorrect: g,
|
|
136
|
+
attempts: w,
|
|
137
|
+
canAnswer: c,
|
|
138
138
|
// actions
|
|
139
|
-
select:
|
|
140
|
-
remove:
|
|
141
|
-
submit:
|
|
142
|
-
reset:
|
|
139
|
+
select: p,
|
|
140
|
+
remove: I,
|
|
141
|
+
submit: a,
|
|
142
|
+
reset: m
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function P(t) {
|
|
146
146
|
const {
|
|
147
|
-
canAnswer:
|
|
148
|
-
submitted:
|
|
149
|
-
isCorrect:
|
|
150
|
-
attempts:
|
|
151
|
-
resetQuestion:
|
|
152
|
-
submitQuestion:
|
|
153
|
-
} =
|
|
154
|
-
function
|
|
155
|
-
|
|
147
|
+
canAnswer: c,
|
|
148
|
+
submitted: u,
|
|
149
|
+
isCorrect: g,
|
|
150
|
+
attempts: w,
|
|
151
|
+
resetQuestion: h,
|
|
152
|
+
submitQuestion: Q
|
|
153
|
+
} = M();
|
|
154
|
+
function n() {
|
|
155
|
+
Q(!0);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
157
|
+
function d() {
|
|
158
|
+
h();
|
|
159
159
|
}
|
|
160
160
|
return {
|
|
161
161
|
// data
|
|
@@ -163,156 +163,413 @@ function T(t) {
|
|
|
163
163
|
url: t.options.url,
|
|
164
164
|
type: t.options.urlType,
|
|
165
165
|
// actions
|
|
166
|
+
submit: n,
|
|
167
|
+
reset: d,
|
|
168
|
+
// base
|
|
169
|
+
submitted: u,
|
|
170
|
+
isCorrect: g,
|
|
171
|
+
attempts: w,
|
|
172
|
+
canAnswer: c
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function T(t) {
|
|
176
|
+
const {
|
|
177
|
+
canAnswer: c,
|
|
178
|
+
submitted: u,
|
|
179
|
+
isCorrect: g,
|
|
180
|
+
attempts: w,
|
|
181
|
+
submitQuestion: h,
|
|
182
|
+
resetQuestion: Q
|
|
183
|
+
} = M(), [n, d] = S([]), [v, O] = S(null), L = () => {
|
|
184
|
+
const o = new Set(n.map((e) => e.itemId));
|
|
185
|
+
return t.options.items.filter((e) => !o.has(e.id));
|
|
186
|
+
}, [C, p] = S(
|
|
187
|
+
L()
|
|
188
|
+
);
|
|
189
|
+
function I(o, e) {
|
|
190
|
+
if (!t.options.dropZones.find((b) => b.id === e)) return;
|
|
191
|
+
const x = n.filter((b) => b.zoneId === e).length;
|
|
192
|
+
d((b) => [
|
|
193
|
+
...b.filter((Z) => Z.itemId !== o),
|
|
194
|
+
{
|
|
195
|
+
itemId: o,
|
|
196
|
+
zoneId: e,
|
|
197
|
+
position: x
|
|
198
|
+
}
|
|
199
|
+
]);
|
|
200
|
+
}
|
|
201
|
+
function A(o) {
|
|
202
|
+
d((e) => e.filter((i) => i.itemId !== o));
|
|
203
|
+
}
|
|
204
|
+
function a(o, e) {
|
|
205
|
+
I(o, e);
|
|
206
|
+
}
|
|
207
|
+
function m(o) {
|
|
208
|
+
return n.filter((e) => e.zoneId === o).sort((e, i) => e.position - i.position).map((e) => t.options.items.find(
|
|
209
|
+
(f) => f.id === e.itemId
|
|
210
|
+
)).filter(Boolean);
|
|
211
|
+
}
|
|
212
|
+
function l() {
|
|
213
|
+
let o = 0, e = !0;
|
|
214
|
+
return t.options.items.forEach((i) => {
|
|
215
|
+
const f = n.find((b) => b.itemId === i.id), x = t.options.dropZones.find(
|
|
216
|
+
(b) => b.position === i.correctPosition
|
|
217
|
+
);
|
|
218
|
+
f && x && f.zoneId === x.id ? o += i.point : e = !1;
|
|
219
|
+
}), {
|
|
220
|
+
isCorrect: e,
|
|
221
|
+
score: o,
|
|
222
|
+
maxScore: t.options.items.reduce(
|
|
223
|
+
(i, f) => i + f.point,
|
|
224
|
+
0
|
|
225
|
+
)
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function r() {
|
|
229
|
+
const o = l();
|
|
230
|
+
return h(o.isCorrect), o;
|
|
231
|
+
}
|
|
232
|
+
function s() {
|
|
233
|
+
d([]), Q();
|
|
234
|
+
}
|
|
235
|
+
return y(() => {
|
|
236
|
+
p(L());
|
|
237
|
+
}, [n]), {
|
|
238
|
+
// data
|
|
239
|
+
items: t.options.items,
|
|
240
|
+
dropZones: t.options.dropZones,
|
|
241
|
+
answers: n,
|
|
242
|
+
availableItems: C,
|
|
243
|
+
question: t,
|
|
244
|
+
draggingItemId: v,
|
|
245
|
+
// base
|
|
246
|
+
submitted: u,
|
|
247
|
+
isCorrect: g,
|
|
248
|
+
attempts: w,
|
|
249
|
+
canAnswer: c,
|
|
250
|
+
// actions
|
|
251
|
+
dropItem: I,
|
|
252
|
+
removeItem: A,
|
|
253
|
+
moveItem: a,
|
|
254
|
+
getItemsInZone: m,
|
|
255
|
+
setDraggingItemId: O,
|
|
166
256
|
submit: r,
|
|
167
|
-
reset:
|
|
257
|
+
reset: s
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function _(t) {
|
|
261
|
+
const {
|
|
262
|
+
canAnswer: c,
|
|
263
|
+
submitted: u,
|
|
264
|
+
isCorrect: g,
|
|
265
|
+
attempts: w,
|
|
266
|
+
submitQuestion: h,
|
|
267
|
+
resetQuestion: Q
|
|
268
|
+
} = M(), [n, d] = S(() => t.options.items.map((r) => r.id)), [v, O] = S(null);
|
|
269
|
+
function L() {
|
|
270
|
+
return n.map((r) => t.options.items.find((s) => s.id === r)).filter((r) => r !== void 0);
|
|
271
|
+
}
|
|
272
|
+
function C(r, s) {
|
|
273
|
+
d((o) => {
|
|
274
|
+
const e = [...o], [i] = e.splice(r, 1);
|
|
275
|
+
return e.splice(s, 0, i), e;
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function p(r) {
|
|
279
|
+
const s = n.indexOf(r);
|
|
280
|
+
s > 0 && C(s, s - 1);
|
|
281
|
+
}
|
|
282
|
+
function I(r) {
|
|
283
|
+
const s = n.indexOf(r);
|
|
284
|
+
s < n.length - 1 && C(s, s + 1);
|
|
285
|
+
}
|
|
286
|
+
function A(r, s) {
|
|
287
|
+
const o = n.indexOf(r);
|
|
288
|
+
o !== -1 && s >= 0 && s < n.length && C(o, s);
|
|
289
|
+
}
|
|
290
|
+
function a() {
|
|
291
|
+
let r = 0, s = !0;
|
|
292
|
+
return n.forEach((o, e) => {
|
|
293
|
+
const i = t.options.items.find((f) => f.id === o);
|
|
294
|
+
i && (e === i.correctOrder ? r += i.point : s = !1);
|
|
295
|
+
}), {
|
|
296
|
+
isCorrect: s,
|
|
297
|
+
score: r,
|
|
298
|
+
maxScore: t.options.items.reduce(
|
|
299
|
+
(o, e) => o + e.point,
|
|
300
|
+
0
|
|
301
|
+
)
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function m() {
|
|
305
|
+
const r = a();
|
|
306
|
+
return h(r.isCorrect), r;
|
|
307
|
+
}
|
|
308
|
+
function l() {
|
|
309
|
+
d(t.options.items.map((r) => r.id)), Q();
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
// data
|
|
313
|
+
items: t.options.items,
|
|
314
|
+
orderedItems: L(),
|
|
315
|
+
orderedItemIds: n,
|
|
316
|
+
question: t,
|
|
317
|
+
draggingItemId: v,
|
|
318
|
+
// base
|
|
319
|
+
submitted: u,
|
|
320
|
+
isCorrect: g,
|
|
321
|
+
attempts: w,
|
|
322
|
+
canAnswer: c,
|
|
323
|
+
// actions
|
|
324
|
+
moveItem: C,
|
|
325
|
+
moveUp: p,
|
|
326
|
+
moveDown: I,
|
|
327
|
+
moveToPosition: A,
|
|
328
|
+
setDraggingItemId: O,
|
|
329
|
+
submit: m,
|
|
330
|
+
reset: l
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function j(t) {
|
|
334
|
+
const {
|
|
335
|
+
canAnswer: c,
|
|
336
|
+
submitted: u,
|
|
337
|
+
isCorrect: g,
|
|
338
|
+
attempts: w,
|
|
339
|
+
submitQuestion: h,
|
|
340
|
+
resetQuestion: Q
|
|
341
|
+
} = M(), [n, d] = S([]), [v, O] = S(null), L = () => {
|
|
342
|
+
const e = new Set(n.map((i) => i.labelId));
|
|
343
|
+
return t.options.labels.filter(
|
|
344
|
+
(i) => !e.has(i.id)
|
|
345
|
+
);
|
|
346
|
+
}, [C, p] = S(
|
|
347
|
+
L()
|
|
348
|
+
);
|
|
349
|
+
function I(e, i, f, x) {
|
|
350
|
+
const b = t.options.points.find((D) => D.id === i);
|
|
351
|
+
b && d((D) => [
|
|
352
|
+
...D.filter((E) => E.labelId !== e),
|
|
353
|
+
{
|
|
354
|
+
labelId: e,
|
|
355
|
+
pointId: i,
|
|
356
|
+
x: f ?? b.x,
|
|
357
|
+
y: x ?? b.y
|
|
358
|
+
}
|
|
359
|
+
]);
|
|
360
|
+
}
|
|
361
|
+
function A(e) {
|
|
362
|
+
d((i) => i.filter((f) => f.labelId !== e));
|
|
363
|
+
}
|
|
364
|
+
function a(e, i, f, x) {
|
|
365
|
+
I(e, i, f, x);
|
|
366
|
+
}
|
|
367
|
+
function m(e) {
|
|
368
|
+
const i = n.find((f) => f.pointId === e);
|
|
369
|
+
return i && t.options.labels.find((f) => f.id === i.labelId) || null;
|
|
370
|
+
}
|
|
371
|
+
function l(e) {
|
|
372
|
+
const i = n.find((f) => f.labelId === e);
|
|
373
|
+
return i ? i.pointId : null;
|
|
374
|
+
}
|
|
375
|
+
function r() {
|
|
376
|
+
let e = 0, i = !0;
|
|
377
|
+
return t.options.labels.forEach((f) => {
|
|
378
|
+
const x = n.find((b) => b.labelId === f.id);
|
|
379
|
+
x && x.pointId === f.correctPointId ? e += f.point : i = !1;
|
|
380
|
+
}), {
|
|
381
|
+
isCorrect: i,
|
|
382
|
+
score: e,
|
|
383
|
+
maxScore: t.options.labels.reduce(
|
|
384
|
+
(f, x) => f + x.point,
|
|
385
|
+
0
|
|
386
|
+
)
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function s() {
|
|
390
|
+
const e = r();
|
|
391
|
+
return h(e.isCorrect), e;
|
|
392
|
+
}
|
|
393
|
+
function o() {
|
|
394
|
+
d([]), Q();
|
|
395
|
+
}
|
|
396
|
+
return y(() => {
|
|
397
|
+
p(L());
|
|
398
|
+
}, [n]), {
|
|
399
|
+
// data
|
|
400
|
+
image: t.options.image,
|
|
401
|
+
labels: t.options.labels,
|
|
402
|
+
points: t.options.points,
|
|
403
|
+
answers: n,
|
|
404
|
+
availableLabels: C,
|
|
405
|
+
question: t,
|
|
406
|
+
draggingLabelId: v,
|
|
168
407
|
// base
|
|
169
|
-
submitted:
|
|
170
|
-
isCorrect:
|
|
171
|
-
attempts:
|
|
172
|
-
canAnswer:
|
|
408
|
+
submitted: u,
|
|
409
|
+
isCorrect: g,
|
|
410
|
+
attempts: w,
|
|
411
|
+
canAnswer: c,
|
|
412
|
+
// actions
|
|
413
|
+
attachLabel: I,
|
|
414
|
+
removeLabel: A,
|
|
415
|
+
moveLabel: a,
|
|
416
|
+
getLabelAtPoint: m,
|
|
417
|
+
getPointForLabel: l,
|
|
418
|
+
setDraggingLabelId: O,
|
|
419
|
+
submit: s,
|
|
420
|
+
reset: o
|
|
173
421
|
};
|
|
174
422
|
}
|
|
175
|
-
function
|
|
423
|
+
function F(t) {
|
|
176
424
|
const {
|
|
177
|
-
canAnswer:
|
|
178
|
-
submitted:
|
|
179
|
-
isCorrect:
|
|
180
|
-
attempts:
|
|
181
|
-
submitQuestion:
|
|
182
|
-
resetQuestion:
|
|
183
|
-
} =
|
|
184
|
-
function
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
const
|
|
189
|
-
return a
|
|
425
|
+
canAnswer: c,
|
|
426
|
+
submitted: u,
|
|
427
|
+
isCorrect: g,
|
|
428
|
+
attempts: w,
|
|
429
|
+
submitQuestion: h,
|
|
430
|
+
resetQuestion: Q
|
|
431
|
+
} = M(), [n, d] = S([]);
|
|
432
|
+
function v(p, I) {
|
|
433
|
+
d((A) => {
|
|
434
|
+
const a = A.findIndex((m) => m.blankId === p);
|
|
435
|
+
if (a >= 0) {
|
|
436
|
+
const m = [...A];
|
|
437
|
+
return m[a] = { blankId: p, value: I }, m;
|
|
190
438
|
}
|
|
191
|
-
return [...
|
|
439
|
+
return [...A, { blankId: p, value: I }];
|
|
192
440
|
});
|
|
193
441
|
}
|
|
194
|
-
function
|
|
195
|
-
let
|
|
196
|
-
const
|
|
197
|
-
Object.entries(
|
|
198
|
-
const
|
|
199
|
-
(
|
|
200
|
-
),
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
(
|
|
442
|
+
function O() {
|
|
443
|
+
let p = 0, I = 0, A = 0;
|
|
444
|
+
const a = t.correct_answers.list || {}, m = Object.keys(a).length;
|
|
445
|
+
Object.entries(a).forEach(([r, s]) => {
|
|
446
|
+
const o = String(s).trim().toLowerCase(), e = t.options.answers.find(
|
|
447
|
+
(b) => b.correct_position === Number(r)
|
|
448
|
+
), i = e && e.point || 1;
|
|
449
|
+
A += i;
|
|
450
|
+
const f = n.find((b) => b.blankId === r);
|
|
451
|
+
(f ? String(f.value).trim().toLowerCase() : "") === o && (p += i, I++);
|
|
204
452
|
});
|
|
205
|
-
const
|
|
206
|
-
return
|
|
207
|
-
isCorrect:
|
|
208
|
-
score: Math.round(
|
|
209
|
-
maxScore: Math.round(
|
|
453
|
+
const l = I === m && m > 0;
|
|
454
|
+
return A === 0 && m > 0 && (A = m), {
|
|
455
|
+
isCorrect: l,
|
|
456
|
+
score: Math.round(p * 100) / 100,
|
|
457
|
+
maxScore: Math.round(A * 100) / 100
|
|
210
458
|
};
|
|
211
459
|
}
|
|
212
|
-
function
|
|
213
|
-
const
|
|
214
|
-
return
|
|
460
|
+
function L() {
|
|
461
|
+
const p = O();
|
|
462
|
+
return h(p.isCorrect), p;
|
|
215
463
|
}
|
|
216
464
|
function C() {
|
|
217
|
-
|
|
465
|
+
d([]), Q();
|
|
218
466
|
}
|
|
219
467
|
return {
|
|
220
468
|
// data
|
|
221
469
|
groups: t.options.groups,
|
|
222
|
-
answers:
|
|
470
|
+
answers: n,
|
|
223
471
|
question: t,
|
|
224
472
|
// base
|
|
225
|
-
submitted:
|
|
226
|
-
isCorrect:
|
|
227
|
-
attempts:
|
|
228
|
-
canAnswer:
|
|
473
|
+
submitted: u,
|
|
474
|
+
isCorrect: g,
|
|
475
|
+
attempts: w,
|
|
476
|
+
canAnswer: c,
|
|
229
477
|
// actions
|
|
230
|
-
answer:
|
|
231
|
-
submit:
|
|
478
|
+
answer: v,
|
|
479
|
+
submit: L,
|
|
232
480
|
reset: C
|
|
233
481
|
};
|
|
234
482
|
}
|
|
235
|
-
function
|
|
483
|
+
function G(t) {
|
|
236
484
|
const {
|
|
237
|
-
canAnswer:
|
|
238
|
-
submitted:
|
|
239
|
-
isCorrect:
|
|
240
|
-
attempts:
|
|
241
|
-
submitQuestion:
|
|
242
|
-
resetQuestion:
|
|
243
|
-
} =
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
return
|
|
485
|
+
canAnswer: c,
|
|
486
|
+
submitted: u,
|
|
487
|
+
isCorrect: g,
|
|
488
|
+
attempts: w,
|
|
489
|
+
submitQuestion: h,
|
|
490
|
+
resetQuestion: Q
|
|
491
|
+
} = M(), [n, d] = S([]);
|
|
492
|
+
function v(a, m) {
|
|
493
|
+
d((l) => {
|
|
494
|
+
const r = l.findIndex((s) => s.itemId === a);
|
|
495
|
+
if (r >= 0) {
|
|
496
|
+
const s = [...l];
|
|
497
|
+
return s[r] = { itemId: a, categoryId: m }, s;
|
|
250
498
|
}
|
|
251
|
-
return [...
|
|
499
|
+
return [...l, { itemId: a, categoryId: m }];
|
|
252
500
|
});
|
|
253
501
|
}
|
|
254
|
-
function
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
function
|
|
258
|
-
let
|
|
259
|
-
const
|
|
260
|
-
let
|
|
261
|
-
return Object.entries(
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
}),
|
|
267
|
-
isCorrect: m ===
|
|
268
|
-
score:
|
|
269
|
-
maxScore:
|
|
502
|
+
function O(a) {
|
|
503
|
+
d((m) => m.filter((l) => l.itemId !== a));
|
|
504
|
+
}
|
|
505
|
+
function L() {
|
|
506
|
+
let a = 0, m = 0;
|
|
507
|
+
const r = t.correct_answers.list || {}, s = Object.keys(r).length;
|
|
508
|
+
let o = 0;
|
|
509
|
+
return Object.entries(r).forEach(([i, f]) => {
|
|
510
|
+
const x = t.options.items.find((Z) => Z.id === i), b = x ? x.point : 0;
|
|
511
|
+
o += b;
|
|
512
|
+
const D = n.find((Z) => Z.itemId === i);
|
|
513
|
+
D && D.categoryId === f && (a += b, m++);
|
|
514
|
+
}), a = Math.round(a * 100) / 100, o = Math.round(o * 100) / 100, {
|
|
515
|
+
isCorrect: m === s && s > 0,
|
|
516
|
+
score: a,
|
|
517
|
+
maxScore: o
|
|
270
518
|
};
|
|
271
519
|
}
|
|
272
520
|
function C() {
|
|
273
|
-
const
|
|
274
|
-
return
|
|
521
|
+
const a = L();
|
|
522
|
+
return h(a.isCorrect), a;
|
|
275
523
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
524
|
+
function p() {
|
|
525
|
+
d([]), Q();
|
|
278
526
|
}
|
|
279
|
-
const
|
|
280
|
-
(
|
|
281
|
-
), [t.options.items,
|
|
527
|
+
const I = B(() => t.options.items.filter(
|
|
528
|
+
(a) => !n.some((m) => m.itemId === a.id)
|
|
529
|
+
), [t.options.items, n]), A = B(() => t.options.categories.map((a) => {
|
|
530
|
+
const m = n.filter((l) => l.categoryId === a.id).map((l) => ({
|
|
531
|
+
item: t.options.items.find((s) => s.id === l.itemId)
|
|
532
|
+
}));
|
|
533
|
+
return {
|
|
534
|
+
...a,
|
|
535
|
+
items: m
|
|
536
|
+
};
|
|
537
|
+
}), [t.options.categories, t.options.items, n]);
|
|
282
538
|
return {
|
|
283
539
|
// data
|
|
284
540
|
categories: t.options.categories,
|
|
285
541
|
allItems: t.options.items,
|
|
286
542
|
question: t,
|
|
543
|
+
categoriesWithItems: A,
|
|
287
544
|
// state
|
|
288
|
-
answers:
|
|
289
|
-
unassignedItems:
|
|
545
|
+
answers: n,
|
|
546
|
+
unassignedItems: I,
|
|
290
547
|
// base
|
|
291
|
-
submitted:
|
|
292
|
-
isCorrect:
|
|
293
|
-
attempts:
|
|
294
|
-
canAnswer:
|
|
548
|
+
submitted: u,
|
|
549
|
+
isCorrect: g,
|
|
550
|
+
attempts: w,
|
|
551
|
+
canAnswer: c,
|
|
295
552
|
// actions
|
|
296
|
-
move:
|
|
297
|
-
remove:
|
|
553
|
+
move: v,
|
|
554
|
+
remove: O,
|
|
298
555
|
submit: C,
|
|
299
|
-
reset:
|
|
556
|
+
reset: p
|
|
300
557
|
};
|
|
301
558
|
}
|
|
302
|
-
function
|
|
559
|
+
function N(t) {
|
|
303
560
|
const {
|
|
304
|
-
canAnswer:
|
|
305
|
-
submitted:
|
|
306
|
-
isCorrect:
|
|
307
|
-
attempts:
|
|
308
|
-
resetQuestion:
|
|
309
|
-
submitQuestion:
|
|
310
|
-
} =
|
|
311
|
-
function
|
|
312
|
-
|
|
561
|
+
canAnswer: c,
|
|
562
|
+
submitted: u,
|
|
563
|
+
isCorrect: g,
|
|
564
|
+
attempts: w,
|
|
565
|
+
resetQuestion: h,
|
|
566
|
+
submitQuestion: Q
|
|
567
|
+
} = M();
|
|
568
|
+
function n() {
|
|
569
|
+
u || Q(!0);
|
|
313
570
|
}
|
|
314
|
-
function
|
|
315
|
-
|
|
571
|
+
function d() {
|
|
572
|
+
h();
|
|
316
573
|
}
|
|
317
574
|
return {
|
|
318
575
|
// data
|
|
@@ -320,70 +577,97 @@ function F(t) {
|
|
|
320
577
|
url: t.options.url,
|
|
321
578
|
type: t.options.urlType,
|
|
322
579
|
// actions
|
|
323
|
-
submit:
|
|
324
|
-
reset:
|
|
580
|
+
submit: n,
|
|
581
|
+
reset: d,
|
|
325
582
|
// base
|
|
326
|
-
submitted:
|
|
327
|
-
isCorrect:
|
|
328
|
-
attempts:
|
|
329
|
-
canAnswer:
|
|
583
|
+
submitted: u,
|
|
584
|
+
isCorrect: g,
|
|
585
|
+
attempts: w,
|
|
586
|
+
canAnswer: c
|
|
330
587
|
};
|
|
331
588
|
}
|
|
332
|
-
function
|
|
589
|
+
function W({
|
|
333
590
|
getData: t,
|
|
334
|
-
children:
|
|
591
|
+
children: c
|
|
335
592
|
}) {
|
|
336
|
-
const
|
|
337
|
-
return
|
|
593
|
+
const u = V(t());
|
|
594
|
+
return c(u);
|
|
338
595
|
}
|
|
339
|
-
function
|
|
596
|
+
function H({
|
|
340
597
|
getData: t,
|
|
341
|
-
children:
|
|
598
|
+
children: c
|
|
342
599
|
}) {
|
|
343
|
-
const
|
|
344
|
-
return
|
|
600
|
+
const u = z(t());
|
|
601
|
+
return c(u);
|
|
345
602
|
}
|
|
346
|
-
function
|
|
603
|
+
function J({
|
|
347
604
|
getData: t,
|
|
348
|
-
children:
|
|
605
|
+
children: c
|
|
349
606
|
}) {
|
|
350
|
-
const
|
|
351
|
-
return
|
|
607
|
+
const u = P(t());
|
|
608
|
+
return c(u);
|
|
352
609
|
}
|
|
353
|
-
function
|
|
610
|
+
function R({
|
|
354
611
|
getData: t,
|
|
355
|
-
children:
|
|
612
|
+
children: c
|
|
356
613
|
}) {
|
|
357
|
-
const
|
|
358
|
-
return
|
|
614
|
+
const u = T(t());
|
|
615
|
+
return c(u);
|
|
359
616
|
}
|
|
360
|
-
function
|
|
617
|
+
function X({
|
|
361
618
|
getData: t,
|
|
362
|
-
children:
|
|
619
|
+
children: c
|
|
363
620
|
}) {
|
|
364
|
-
const
|
|
365
|
-
return
|
|
621
|
+
const u = _(t());
|
|
622
|
+
return c(u);
|
|
366
623
|
}
|
|
367
|
-
function
|
|
624
|
+
function Y({
|
|
625
|
+
getData: t,
|
|
626
|
+
children: c
|
|
627
|
+
}) {
|
|
628
|
+
const u = j(t());
|
|
629
|
+
return c(u);
|
|
630
|
+
}
|
|
631
|
+
function $({
|
|
632
|
+
getData: t,
|
|
633
|
+
children: c
|
|
634
|
+
}) {
|
|
635
|
+
const u = F(t());
|
|
636
|
+
return c(u);
|
|
637
|
+
}
|
|
638
|
+
function K({
|
|
639
|
+
getData: t,
|
|
640
|
+
children: c
|
|
641
|
+
}) {
|
|
642
|
+
const u = G(t());
|
|
643
|
+
return c(u);
|
|
644
|
+
}
|
|
645
|
+
function q({
|
|
368
646
|
getData: t,
|
|
369
|
-
children:
|
|
647
|
+
children: c
|
|
370
648
|
}) {
|
|
371
|
-
const
|
|
372
|
-
return
|
|
649
|
+
const u = N(t());
|
|
650
|
+
return c(u);
|
|
373
651
|
}
|
|
374
652
|
export {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
F as
|
|
388
|
-
|
|
653
|
+
R as DragDropQuestion,
|
|
654
|
+
$ as FillInBlankQuestion,
|
|
655
|
+
K as GroupingQuestion,
|
|
656
|
+
Y as LabelingQuestion,
|
|
657
|
+
H as MatchingQuestion,
|
|
658
|
+
W as MultipleChoicesQuestion,
|
|
659
|
+
X as OrderingQuestion,
|
|
660
|
+
q as PowerpointQuestion,
|
|
661
|
+
J as VideoQuestion,
|
|
662
|
+
k as isSameSet,
|
|
663
|
+
M as useBaseQuestion,
|
|
664
|
+
T as useDragDrop,
|
|
665
|
+
F as useFillInBlank,
|
|
666
|
+
G as useGrouping,
|
|
667
|
+
j as useLabeling,
|
|
668
|
+
z as useMatching,
|
|
669
|
+
V as useMultipleChoice,
|
|
670
|
+
_ as useOrdering,
|
|
671
|
+
N as usePowerpoint,
|
|
672
|
+
P as useVideo
|
|
389
673
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseQuestion, Media } from './common';
|
|
2
|
+
export interface DragDropQuestionType extends BaseQuestion {
|
|
3
|
+
options: {
|
|
4
|
+
items: DragDropItem[];
|
|
5
|
+
dropZones: DragDropZone[];
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface DragDropItem {
|
|
9
|
+
id: string;
|
|
10
|
+
content: {
|
|
11
|
+
text: string;
|
|
12
|
+
media?: Media;
|
|
13
|
+
};
|
|
14
|
+
correctPosition: number;
|
|
15
|
+
point: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DragDropZone {
|
|
18
|
+
id: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
position: number;
|
|
21
|
+
}
|
|
22
|
+
export interface DragDropAnswer {
|
|
23
|
+
itemId: string;
|
|
24
|
+
zoneId: string;
|
|
25
|
+
position: number;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=dragDrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dragDrop.d.ts","sourceRoot":"","sources":["../../src/types/dragDrop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE;QACP,KAAK,EAAE,YAAY,EAAE,CAAC;QACtB,SAAS,EAAE,YAAY,EAAE,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fillInBlank.d.ts","sourceRoot":"","sources":["../../src/types/fillInBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE;QACP,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;KAC5B,CAAC;IACF,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,
|
|
1
|
+
{"version":3,"file":"fillInBlank.d.ts","sourceRoot":"","sources":["../../src/types/fillInBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE;QACP,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;KAC5B,CAAC;IACF,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export * from './multipleChoices';
|
|
|
2
2
|
export * from './common';
|
|
3
3
|
export * from './matching';
|
|
4
4
|
export * from './url';
|
|
5
|
+
export * from './dragDrop';
|
|
6
|
+
export * from './ordering';
|
|
7
|
+
export * from './labeling';
|
|
5
8
|
export * from './fillInBlank';
|
|
6
9
|
export * from './grouping';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseQuestion, Media } from './common';
|
|
2
|
+
export interface LabelingQuestionType extends BaseQuestion {
|
|
3
|
+
options: {
|
|
4
|
+
image: Media;
|
|
5
|
+
labels: LabelingLabel[];
|
|
6
|
+
points: LabelingPoint[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface LabelingLabel {
|
|
10
|
+
id: string;
|
|
11
|
+
content: {
|
|
12
|
+
text: string;
|
|
13
|
+
media?: Media;
|
|
14
|
+
};
|
|
15
|
+
correctPointId: string;
|
|
16
|
+
point: number;
|
|
17
|
+
}
|
|
18
|
+
export interface LabelingPoint {
|
|
19
|
+
id: string;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
label?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface LabelingAnswer {
|
|
25
|
+
labelId: string;
|
|
26
|
+
pointId: string;
|
|
27
|
+
x?: number;
|
|
28
|
+
y?: number;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=labeling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labeling.d.ts","sourceRoot":"","sources":["../../src/types/labeling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE;QACP,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,EAAE,aAAa,EAAE,CAAC;QACxB,MAAM,EAAE,aAAa,EAAE,CAAC;KACzB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IACF,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseQuestion, Media } from './common';
|
|
2
|
+
export interface OrderingQuestionType extends BaseQuestion {
|
|
3
|
+
options: {
|
|
4
|
+
items: OrderingItem[];
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface OrderingItem {
|
|
8
|
+
id: string;
|
|
9
|
+
content: {
|
|
10
|
+
text: string;
|
|
11
|
+
media?: Media;
|
|
12
|
+
};
|
|
13
|
+
correctOrder: number;
|
|
14
|
+
point: number;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ordering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordering.d.ts","sourceRoot":"","sources":["../../src/types/ordering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE;QACP,KAAK,EAAE,YAAY,EAAE,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/package.json
CHANGED