@pie-element/placement-ordering 14.1.2-next.5 → 14.1.2-next.6
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/author/choice-editor.js +2 -2
- package/dist/author/choice-tile.js +3 -2
- package/dist/author/design.js +1 -1
- package/dist/author/index.d.ts +1 -0
- package/dist/author/index.js +5 -2
- package/dist/browser/author/index.js +22660 -25834
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{browser-DHPggtaA.js → browser-Bd36Xf5z.js} +2 -2
- package/dist/browser/browser-Bd36Xf5z.js.map +1 -0
- package/dist/browser/controller/index.js +3 -3
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +436 -307
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{dist-D9ARZhQk.js → dist-DiGNNRzu.js} +2 -2
- package/dist/browser/{dist-D9ARZhQk.js.map → dist-DiGNNRzu.js.map} +1 -1
- package/dist/browser/{drag-provider-C1slTlsc.js → drag-provider-BdfhGCEU.js} +2474 -2529
- package/dist/browser/drag-provider-BdfhGCEU.js.map +1 -0
- package/dist/controller/scoring.js +1 -1
- package/dist/delivery/index.js +2 -2
- package/dist/delivery/keyboard-coordinates.d.ts +35 -0
- package/dist/delivery/keyboard-coordinates.js +48 -0
- package/dist/delivery/main.js +1 -1
- package/dist/delivery/ordering.js +1 -1
- package/dist/delivery/placement-ordering.d.ts +11 -0
- package/dist/delivery/placement-ordering.js +147 -79
- package/dist/delivery/tile.d.ts +3 -0
- package/dist/delivery/tile.js +66 -57
- package/dist/delivery/tiler.d.ts +6 -0
- package/dist/delivery/tiler.js +6 -3
- package/dist/index.iife.js +35 -35
- package/package.json +14 -8
- package/dist/browser/browser-DHPggtaA.js.map +0 -1
- package/dist/browser/drag-provider-C1slTlsc.js.map +0 -1
|
@@ -27,4 +27,4 @@ var a = r("pie-elements:placement-ordering:controller"), o = (e) => /* @__PURE__
|
|
|
27
27
|
}), a;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
30
|
-
export { c as flattenCorrect, l as getAllCorrectResponses, u as score };
|
|
30
|
+
export { c as flattenCorrect, l as getAllCorrectResponses, o as illegalArgumentError, s as pairwiseCombinationScore, u as score };
|
package/dist/delivery/index.js
CHANGED
|
@@ -60,10 +60,10 @@ var s = i("pie-elements:placement-ordering"), c = ({ model: e, session: t }) =>
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
connectedCallback() {
|
|
63
|
-
this._initMathObserver();
|
|
63
|
+
this._initMathObserver(), this.render();
|
|
64
64
|
}
|
|
65
65
|
disconnectedCallback() {
|
|
66
|
-
this._disconnectMathObserver(), this._root
|
|
66
|
+
this._disconnectMathObserver(), this._root &&= (this._root.unmount(), null);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/placement-ordering/src/keyboard-coordinates.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Custom keyboard coordinate getter for placement-ordering's Tab-based placement mode
|
|
11
|
+
* (enabled only when the item is configured with `placementArea` / `includeTargets`).
|
|
12
|
+
*
|
|
13
|
+
* Tab/Shift+Tab cycle the dragged choice directly onto the next/previous enabled
|
|
14
|
+
* droppable (a placement/target tile, or an empty gap left behind in the choices row),
|
|
15
|
+
* in real on-screen position order, placing the dragged item's own top-left corner at
|
|
16
|
+
* the target's center-left point.
|
|
17
|
+
*
|
|
18
|
+
* Arrow keys are delegated to dnd-kit's own `defaultKeyboardCoordinateGetter` so the
|
|
19
|
+
* pre-existing free-form arrow-key dragging behavior is left completely unchanged.
|
|
20
|
+
*
|
|
21
|
+
* The tile currently being dragged already disables its own droppable
|
|
22
|
+
* (see `useDroppable({ disabled: isDragging })` in tile.jsx), so it's naturally
|
|
23
|
+
* excluded from the candidate list here without any extra bookkeeping.
|
|
24
|
+
*
|
|
25
|
+
* When picking up a choice from the choices row, the other not-yet-placed choice
|
|
26
|
+
* tiles are also registered droppables (tile.jsx disables a droppable only while it's
|
|
27
|
+
* the one being dragged), but dropping a choice onto another choice is a no-op in the
|
|
28
|
+
* reducer (ordering.js's updateResponse has no `choice -> choice` case) — so they're
|
|
29
|
+
* excluded from the Tab/Shift+Tab cycle, leaving only the real placement targets.
|
|
30
|
+
*/
|
|
31
|
+
export declare const closestDroppableKeyboardCoordinates: (event: any, { active, context, currentCoordinates }: {
|
|
32
|
+
active: any;
|
|
33
|
+
context: any;
|
|
34
|
+
currentCoordinates: any;
|
|
35
|
+
}) => any;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { KeyboardCode as e, defaultKeyboardCoordinateGetter as t } from "@dnd-kit/core";
|
|
2
|
+
//#region src/delivery/keyboard-coordinates.ts
|
|
3
|
+
var n = (n, { active: i, context: a, currentCoordinates: o }) => {
|
|
4
|
+
let { code: s } = n, c = s === "Tab", l = s === e.Down || s === e.Up || s === e.Left || s === e.Right;
|
|
5
|
+
if (!c && !l) return;
|
|
6
|
+
if (l) return t(n, {
|
|
7
|
+
context: a,
|
|
8
|
+
currentCoordinates: o
|
|
9
|
+
});
|
|
10
|
+
n.preventDefault();
|
|
11
|
+
let { droppableRects: u, droppableContainers: d, collisionRect: f } = a;
|
|
12
|
+
if (!u || u.size === 0) return o;
|
|
13
|
+
let p = {
|
|
14
|
+
x: (f?.width || 0) / 2,
|
|
15
|
+
y: (f?.height || 0) / 2
|
|
16
|
+
}, m = {
|
|
17
|
+
x: o.x + p.x,
|
|
18
|
+
y: o.y + p.y
|
|
19
|
+
}, h = i?.data?.current?.type === "choice", g = [];
|
|
20
|
+
for (let [e, t] of d) {
|
|
21
|
+
if (t?.disabled || h && t?.data?.current?.type === "choice") continue;
|
|
22
|
+
let n = u.get(e);
|
|
23
|
+
if (!n) continue;
|
|
24
|
+
let r = {
|
|
25
|
+
x: n.left + n.width / 2,
|
|
26
|
+
y: n.top + n.height / 2
|
|
27
|
+
}, i = {
|
|
28
|
+
x: n.left,
|
|
29
|
+
y: n.top + n.height / 2
|
|
30
|
+
};
|
|
31
|
+
g.push({
|
|
32
|
+
id: e,
|
|
33
|
+
dropPosition: i,
|
|
34
|
+
center: r
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (g.length === 0) return o;
|
|
38
|
+
let _ = n.shiftKey;
|
|
39
|
+
g.sort((e, t) => Math.abs(e.center.y - t.center.y) > 10 ? e.center.y - t.center.y : e.center.x - t.center.x);
|
|
40
|
+
let v = 0, y = Infinity;
|
|
41
|
+
for (let e = 0; e < g.length; e++) {
|
|
42
|
+
let t = r(m, g[e].center);
|
|
43
|
+
t < y && (y = t, v = e);
|
|
44
|
+
}
|
|
45
|
+
return g[_ ? (v - 1 + g.length) % g.length : (v + 1) % g.length].dropPosition;
|
|
46
|
+
}, r = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
47
|
+
//#endregion
|
|
48
|
+
export { n as closestDroppableKeyboardCoordinates };
|
package/dist/delivery/main.js
CHANGED
|
@@ -23,6 +23,17 @@ export declare class PlacementOrdering extends React.Component {
|
|
|
23
23
|
onRemoveChoice: any;
|
|
24
24
|
createOrdering: any;
|
|
25
25
|
onDragEnd: any;
|
|
26
|
+
onDragStart: any;
|
|
27
|
+
onDragCancel: any;
|
|
28
|
+
isSameChoice: (a: any, b: any) => boolean;
|
|
29
|
+
selectChoice: any;
|
|
30
|
+
toggleChoiceSelection: any;
|
|
31
|
+
cancelSelection: any;
|
|
32
|
+
endAnyLiveKeyboardDrag: any;
|
|
33
|
+
placeSelectedChoice: any;
|
|
34
|
+
isClickSoonAfterDragEnd: () => boolean;
|
|
35
|
+
onChoiceClick: any;
|
|
36
|
+
onPlacementClick: any;
|
|
26
37
|
render(): React.JSX.Element;
|
|
27
38
|
}
|
|
28
39
|
export default PlacementOrdering;
|
|
@@ -1,62 +1,84 @@
|
|
|
1
1
|
import { HorizontalTiler as e, VerticalTiler as t } from "./tiler.js";
|
|
2
2
|
import { buildState as n, reducer as r } from "./ordering.js";
|
|
3
3
|
import { haveSameValuesButDifferentOrder as i } from "./utils.js";
|
|
4
|
-
import a from "
|
|
5
|
-
import
|
|
6
|
-
import l from "
|
|
7
|
-
import
|
|
8
|
-
import d from "
|
|
9
|
-
import f from "
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import E from "
|
|
17
|
-
import
|
|
4
|
+
import { closestDroppableKeyboardCoordinates as a } from "./keyboard-coordinates.js";
|
|
5
|
+
import o from "react";
|
|
6
|
+
import { difference as s, isEqual as c, uniqueId as l } from "@pie-element/shared-lodash";
|
|
7
|
+
import u from "debug";
|
|
8
|
+
import { renderMath as d } from "@pie-element/shared-math-rendering-mathjax";
|
|
9
|
+
import f from "prop-types";
|
|
10
|
+
import p from "react-dom";
|
|
11
|
+
import { styled as m } from "@mui/material/styles";
|
|
12
|
+
import { rectIntersection as h } from "@dnd-kit/core";
|
|
13
|
+
import { restrictToParentElement as g } from "@dnd-kit/modifiers";
|
|
14
|
+
import * as _ from "@pie-lib/render-ui";
|
|
15
|
+
import { Collapsible as v, Feedback as y, PreviewPrompt as b, UiLayout as x, color as S, hasMedia as C, hasText as w } from "@pie-lib/render-ui";
|
|
16
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
17
|
+
import D from "@pie-lib/translator";
|
|
18
|
+
import O from "@pie-lib/correct-answer-toggle";
|
|
19
|
+
import { DragProvider as k } from "@pie-lib/drag";
|
|
18
20
|
//#region src/delivery/placement-ordering.tsx
|
|
19
|
-
function
|
|
21
|
+
function A(e) {
|
|
20
22
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
21
23
|
}
|
|
22
|
-
function
|
|
23
|
-
return !e ||
|
|
24
|
+
function j(e, t) {
|
|
25
|
+
return !e || A(e) ? e : A(e.default) ? e.default : t && A(e[t]) ? e[t] : t && A(e[t]?.default) ? e[t].default : e;
|
|
24
26
|
}
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
var M = j(x, "UiLayout") || j(R.UiLayout, "UiLayout"), N = j(b, "PreviewPrompt") || j(R.PreviewPrompt, "PreviewPrompt"), P = j(y, "Feedback") || j(R.Feedback, "Feedback"), F = j(v, "Collapsible") || j(R.Collapsible, "Collapsible"), I = _, L = I.default, R = L && typeof L == "object" ? L : I, z = 250, B = (e) => e ? {
|
|
28
|
+
keyboardCoordinateGetter: a,
|
|
29
|
+
keyboardCodes: {
|
|
30
|
+
start: ["Space", "Enter"],
|
|
31
|
+
cancel: ["Escape"],
|
|
32
|
+
end: ["Space", "Enter"]
|
|
33
|
+
},
|
|
34
|
+
accessibility: { screenReaderInstructions: { draggable: "Press Space or Enter to pick up this answer choice. Once picked up, use Tab or Shift+Tab to cycle through response areas, or use arrow keys to move it freely. Press Space or Enter to drop, or Escape to cancel." } }
|
|
35
|
+
} : {}, { translator: V } = D, H = u("pie-elements:placement-ordering"), U = m("div")({
|
|
36
|
+
color: S.text(),
|
|
37
|
+
backgroundColor: S.background(),
|
|
28
38
|
display: "flex",
|
|
29
39
|
flexDirection: "column",
|
|
30
40
|
alignItems: "center",
|
|
31
41
|
boxSizing: "border-box"
|
|
32
|
-
}),
|
|
42
|
+
}), W = m("div")({
|
|
43
|
+
alignSelf: "stretch",
|
|
44
|
+
maxWidth: "100%",
|
|
45
|
+
overflowX: "auto",
|
|
46
|
+
overflowY: "hidden"
|
|
47
|
+
}), G = m("div")({
|
|
48
|
+
display: "flex",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
minWidth: "min-content"
|
|
51
|
+
}), K = m("div")(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), q = m("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), J = m(O)(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), Y = m(F)(({ theme: e }) => ({
|
|
33
52
|
marginBottom: e.spacing(2),
|
|
34
53
|
alignSelf: "flex-start"
|
|
35
|
-
})),
|
|
54
|
+
})), X = (e) => {
|
|
36
55
|
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
37
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ T(t, {
|
|
38
57
|
...a,
|
|
39
58
|
tiles: n.tiles,
|
|
40
59
|
onDropChoice: (e, t) => r(e, t, n),
|
|
41
60
|
onRemoveChoice: (e) => i(e, n)
|
|
42
61
|
});
|
|
43
62
|
};
|
|
44
|
-
|
|
45
|
-
tiler:
|
|
46
|
-
ordering:
|
|
47
|
-
onDropChoice:
|
|
48
|
-
onRemoveChoice:
|
|
63
|
+
X.propTypes = {
|
|
64
|
+
tiler: f.func,
|
|
65
|
+
ordering: f.any,
|
|
66
|
+
onDropChoice: f.func,
|
|
67
|
+
onRemoveChoice: f.func
|
|
49
68
|
};
|
|
50
|
-
var
|
|
69
|
+
var Z = class extends o.Component {
|
|
51
70
|
static propTypes = {
|
|
52
|
-
onSessionChange:
|
|
53
|
-
model:
|
|
54
|
-
session:
|
|
71
|
+
onSessionChange: f.func.isRequired,
|
|
72
|
+
model: f.object.isRequired,
|
|
73
|
+
session: f.oneOfType([f.array.isRequired, f.object.isRequired])
|
|
55
74
|
};
|
|
56
75
|
constructor(e) {
|
|
57
|
-
super(e), this.instanceId =
|
|
76
|
+
super(e), this.instanceId = l();
|
|
58
77
|
let { value: t, needsReset: n } = this.validateSession(e);
|
|
59
|
-
this.state = {
|
|
78
|
+
this.state = {
|
|
79
|
+
showingCorrect: !1,
|
|
80
|
+
selectedChoice: null
|
|
81
|
+
}, this.lastDragEndAt = 0;
|
|
60
82
|
let { model: r } = e || {}, { env: i } = r || {}, { mode: a } = i || {};
|
|
61
83
|
n && a === "gather" && this.props.onSessionChange({
|
|
62
84
|
...e.session,
|
|
@@ -65,18 +87,18 @@ var G = class extends a.Component {
|
|
|
65
87
|
}
|
|
66
88
|
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
67
89
|
componentDidUpdate() {
|
|
68
|
-
|
|
90
|
+
d(p.findDOMNode(this));
|
|
69
91
|
}
|
|
70
92
|
validateSession = ({ model: e, session: t }, n = !1) => {
|
|
71
|
-
let { config: r, choices: i } = e || {}, { includeTargets: a } = r || {},
|
|
72
|
-
if (a) l && l.length !==
|
|
93
|
+
let { config: r, choices: i } = e || {}, { includeTargets: a } = r || {}, o = i.map((e) => e.id), { value: l } = t || {}, u;
|
|
94
|
+
if (a) l && l.length !== o.length && (u = !0, l = l.length < o.length ? l.concat(Array(o.length - l.length)) : l.filter((e) => o.includes(e)));
|
|
73
95
|
else {
|
|
74
|
-
if (!l || !l.length || n) l =
|
|
96
|
+
if (!l || !l.length || n) l = o;
|
|
75
97
|
else {
|
|
76
|
-
let e = o
|
|
77
|
-
(e.length || t.length) && (l =
|
|
98
|
+
let e = s(o, l), t = s(l, o);
|
|
99
|
+
(e.length || t.length) && (l = o);
|
|
78
100
|
}
|
|
79
|
-
u = !
|
|
101
|
+
u = !c(t.value, l);
|
|
80
102
|
}
|
|
81
103
|
return u && console.warn("This session is not valid anymore. It will be reset."), {
|
|
82
104
|
value: l,
|
|
@@ -84,8 +106,8 @@ var G = class extends a.Component {
|
|
|
84
106
|
};
|
|
85
107
|
};
|
|
86
108
|
UNSAFE_componentWillReceiveProps(e) {
|
|
87
|
-
let { model: t = {} } = e || {}, { model: n = {} } = this.props || {}, { correctResponse: r, config: a, choices: o = [], env: s } = t, { includeTargets: c } = a || {}, l = {}, u = n.language && n.language !== t.language, d = n.note && n.note ===
|
|
88
|
-
u && d && (n.note =
|
|
109
|
+
let { model: t = {} } = e || {}, { model: n = {} } = this.props || {}, { correctResponse: r, config: a, choices: o = [], env: s } = t, { includeTargets: c } = a || {}, l = {}, u = n.language && n.language !== t.language, d = n.note && n.note === V.t("common:commonCorrectAnswerWithAlternates", { lng: n.language });
|
|
110
|
+
u && d && (n.note = V.t("common:commonCorrectAnswerWithAlternates", { lng: t.language })), r || (l.showingCorrect = !1);
|
|
89
111
|
let f = i(o, n.choices), { value: p, needsReset: m } = this.validateSession(e, f), h = {
|
|
90
112
|
...e.session,
|
|
91
113
|
value: p
|
|
@@ -97,7 +119,7 @@ var G = class extends a.Component {
|
|
|
97
119
|
}
|
|
98
120
|
onDropChoice = (e, t, n) => {
|
|
99
121
|
let { onSessionChange: i, session: a } = this.props, o = n.tiles.find((e) => e.id === t.id && e.type === t.type && e.index === t.index), s = e;
|
|
100
|
-
|
|
122
|
+
H("[onDropChoice] ", o, s);
|
|
101
123
|
let c = r({
|
|
102
124
|
type: "move",
|
|
103
125
|
from: o,
|
|
@@ -107,7 +129,7 @@ var G = class extends a.Component {
|
|
|
107
129
|
};
|
|
108
130
|
onRemoveChoice = (e, t) => {
|
|
109
131
|
let { onSessionChange: n, session: i } = this.props;
|
|
110
|
-
|
|
132
|
+
H("[onRemoveChoice]", e);
|
|
111
133
|
let a = r({
|
|
112
134
|
type: "remove",
|
|
113
135
|
target: e
|
|
@@ -132,7 +154,7 @@ var G = class extends a.Component {
|
|
|
132
154
|
};
|
|
133
155
|
onDragEnd = (e) => {
|
|
134
156
|
let { over: t, active: n } = e, r = this.createOrdering();
|
|
135
|
-
if (t && n) {
|
|
157
|
+
if (this.cancelSelection(), this.lastDragEndAt = Date.now(), t && n) {
|
|
136
158
|
let e = n.data.current, i = t.data.current;
|
|
137
159
|
if (e && i && i.type === "target") {
|
|
138
160
|
this.onDropChoice(i, e, r);
|
|
@@ -144,63 +166,109 @@ var G = class extends a.Component {
|
|
|
144
166
|
e && e.type === "target" && this.onRemoveChoice(e, r);
|
|
145
167
|
}
|
|
146
168
|
};
|
|
169
|
+
onDragStart = (e) => {
|
|
170
|
+
let { active: t } = e;
|
|
171
|
+
t?.data?.current && this.selectChoice(t.data.current);
|
|
172
|
+
};
|
|
173
|
+
onDragCancel = () => {
|
|
174
|
+
this.cancelSelection(), this.lastDragEndAt = Date.now();
|
|
175
|
+
};
|
|
176
|
+
isSameChoice = (e, t) => !!e && !!t && e.type === t.type && e.id === t.id && e.index === t.index;
|
|
177
|
+
selectChoice = (e) => {
|
|
178
|
+
this.setState({ selectedChoice: e });
|
|
179
|
+
};
|
|
180
|
+
toggleChoiceSelection = (e) => {
|
|
181
|
+
this.setState((t) => ({ selectedChoice: this.isSameChoice(t.selectedChoice, e) ? null : e }));
|
|
182
|
+
};
|
|
183
|
+
cancelSelection = () => {
|
|
184
|
+
this.setState({ selectedChoice: null });
|
|
185
|
+
};
|
|
186
|
+
endAnyLiveKeyboardDrag = () => {
|
|
187
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
188
|
+
code: "Escape",
|
|
189
|
+
bubbles: !0,
|
|
190
|
+
cancelable: !0
|
|
191
|
+
}));
|
|
192
|
+
};
|
|
193
|
+
placeSelectedChoice = (e) => {
|
|
194
|
+
let { selectedChoice: t } = this.state;
|
|
195
|
+
if (!t) return;
|
|
196
|
+
let n = this.createOrdering();
|
|
197
|
+
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now();
|
|
198
|
+
};
|
|
199
|
+
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < z;
|
|
200
|
+
onChoiceClick = (e) => {
|
|
201
|
+
this.isClickSoonAfterDragEnd() || this.toggleChoiceSelection(e);
|
|
202
|
+
};
|
|
203
|
+
onPlacementClick = (e) => {
|
|
204
|
+
this.isClickSoonAfterDragEnd() || this.placeSelectedChoice(e);
|
|
205
|
+
};
|
|
147
206
|
render() {
|
|
148
|
-
let { model: n } = this.props, { correctResponse: r, correctness: i, extraCSSRules: a, prompt: o, rationale: s, feedback: c, config: l, note: u, showNote: d, env: f, disabled: p, teacherInstructions:
|
|
207
|
+
let { model: n } = this.props, { correctResponse: r, correctness: i, extraCSSRules: a, prompt: o, rationale: s, feedback: c, config: l, note: u, showNote: d, env: f, disabled: p, teacherInstructions: m, language: _ } = n, v = r && r.length > 0, { showingCorrect: y } = this.state, b = l || {
|
|
149
208
|
orientation: "vertical",
|
|
150
209
|
includeTargets: !0
|
|
151
|
-
}, { orientation:
|
|
152
|
-
color:
|
|
153
|
-
backgroundColor:
|
|
210
|
+
}, { orientation: x, includeTargets: D } = b, O = x === "vertical", A = this.createOrdering(), { mode: j, role: F } = f || {}, I = O ? t : e, L = (y || j === "view" && F === "instructor") && d && u, R = s && (w(s) || C(s)), z = m && (w(m) || C(m)), V = {
|
|
211
|
+
color: S.text(),
|
|
212
|
+
backgroundColor: S.background(),
|
|
154
213
|
display: "flex",
|
|
155
214
|
flexDirection: "column",
|
|
156
215
|
alignItems: "center",
|
|
157
|
-
boxSizing: "border-box"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
216
|
+
boxSizing: "border-box",
|
|
217
|
+
width: "100%"
|
|
218
|
+
}, H = D ? {
|
|
219
|
+
selectedChoice: this.state.selectedChoice,
|
|
220
|
+
onChoiceClick: this.onChoiceClick,
|
|
221
|
+
onPlacementClick: this.onPlacementClick
|
|
222
|
+
} : {};
|
|
223
|
+
return /* @__PURE__ */ T(k, {
|
|
224
|
+
onDragStart: this.onDragStart,
|
|
161
225
|
onDragEnd: this.onDragEnd,
|
|
162
|
-
|
|
163
|
-
|
|
226
|
+
onDragCancel: this.onDragCancel,
|
|
227
|
+
collisionDetection: h,
|
|
228
|
+
modifiers: [g],
|
|
229
|
+
...B(D),
|
|
230
|
+
children: /* @__PURE__ */ T(U, { children: /* @__PURE__ */ E(M, {
|
|
164
231
|
extraCSSRules: a,
|
|
165
|
-
style:
|
|
232
|
+
style: V,
|
|
166
233
|
children: [
|
|
167
|
-
|
|
234
|
+
z && /* @__PURE__ */ T(Y, {
|
|
168
235
|
labels: {
|
|
169
236
|
hidden: "Show Teacher Instructions",
|
|
170
237
|
visible: "Hide Teacher Instructions"
|
|
171
238
|
},
|
|
172
239
|
className: "collapsible",
|
|
173
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ T(N, { prompt: m })
|
|
174
241
|
}),
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
show:
|
|
178
|
-
toggled:
|
|
242
|
+
/* @__PURE__ */ T(K, { children: /* @__PURE__ */ T(N, { prompt: o }) }),
|
|
243
|
+
/* @__PURE__ */ T(J, {
|
|
244
|
+
show: v,
|
|
245
|
+
toggled: y,
|
|
179
246
|
onToggle: this.toggleCorrect,
|
|
180
|
-
language:
|
|
247
|
+
language: _
|
|
181
248
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ T(W, { children: /* @__PURE__ */ T(G, { children: /* @__PURE__ */ T(X, {
|
|
183
250
|
instanceId: this.instanceId,
|
|
184
|
-
choiceLabel:
|
|
185
|
-
targetLabel:
|
|
186
|
-
ordering:
|
|
187
|
-
tiler:
|
|
251
|
+
choiceLabel: b.choiceLabel,
|
|
252
|
+
targetLabel: b.targetLabel,
|
|
253
|
+
ordering: A,
|
|
254
|
+
tiler: I,
|
|
188
255
|
disabled: p,
|
|
189
|
-
addGuide:
|
|
190
|
-
tileSize:
|
|
191
|
-
includeTargets:
|
|
192
|
-
choiceLabelEnabled: n.config && n.config.choiceLabelEnabled
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
L && /* @__PURE__ */
|
|
256
|
+
addGuide: b.showOrdering,
|
|
257
|
+
tileSize: b.tileSize,
|
|
258
|
+
includeTargets: D,
|
|
259
|
+
choiceLabelEnabled: n.config && n.config.choiceLabelEnabled,
|
|
260
|
+
...H
|
|
261
|
+
}) }) }),
|
|
262
|
+
L && /* @__PURE__ */ T(q, { dangerouslySetInnerHTML: { __html: u } }),
|
|
263
|
+
R && /* @__PURE__ */ T(Y, {
|
|
196
264
|
labels: {
|
|
197
265
|
hidden: "Show Rationale",
|
|
198
266
|
visible: "Hide Rationale"
|
|
199
267
|
},
|
|
200
268
|
className: "collapsible",
|
|
201
|
-
children: /* @__PURE__ */
|
|
269
|
+
children: /* @__PURE__ */ T(N, { prompt: s })
|
|
202
270
|
}),
|
|
203
|
-
!
|
|
271
|
+
!y && /* @__PURE__ */ T(P, {
|
|
204
272
|
correctness: i,
|
|
205
273
|
feedback: c
|
|
206
274
|
})
|
|
@@ -210,4 +278,4 @@ var G = class extends a.Component {
|
|
|
210
278
|
}
|
|
211
279
|
};
|
|
212
280
|
//#endregion
|
|
213
|
-
export {
|
|
281
|
+
export { Z as PlacementOrdering, Z as default };
|
package/dist/delivery/tile.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ export declare const Tile: {
|
|
|
23
23
|
instanceId: PropTypes.Requireable<any>;
|
|
24
24
|
draggable: PropTypes.Requireable<boolean>;
|
|
25
25
|
tileIndex: PropTypes.Requireable<number>;
|
|
26
|
+
selectedChoice: PropTypes.Requireable<object>;
|
|
27
|
+
onChoiceClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
29
|
};
|
|
27
30
|
};
|
|
28
31
|
export default Tile;
|