@pie-element/match-list 7.1.2-next.0 → 7.1.2-next.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/dist/browser/controller/index.js +16 -16
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +3542 -4575
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{isEmpty-Eo-n7WSl.js → dist-BT3FUErB.js} +55 -168
- package/dist/browser/dist-BT3FUErB.js.map +1 -0
- package/dist/controller/index.js +24 -24
- package/dist/delivery/answer-area.js +35 -37
- package/dist/delivery/answer.js +67 -67
- package/dist/delivery/choices-list.js +21 -23
- package/dist/delivery/main.js +71 -73
- package/dist/index.iife.js +27 -27
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +9 -5
- package/dist/browser/isEmpty-Eo-n7WSl.js.map +0 -1
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayReduce.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindIndex.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindKey.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js +0 -26
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseReduce.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createFind.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js +0 -18
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/find.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findIndex.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findKey.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/get.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/property.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/reduce.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js +0 -9
package/dist/delivery/answer.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "debug";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { PlaceHolder as r } from "@pie-lib/drag";
|
|
5
|
+
import { useDraggable as i, useDroppable as a } from "@dnd-kit/core";
|
|
6
|
+
import { color as o } from "@pie-lib/render-ui";
|
|
7
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
+
import { styled as c } from "@mui/material/styles";
|
|
9
|
+
import { isEmpty as l } from "@pie-element/shared-lodash";
|
|
10
10
|
//#region src/delivery/answer.tsx
|
|
11
|
-
var u =
|
|
11
|
+
var u = t("pie-elements:match-title:answer"), d = c("div")(({ theme: e }) => ({
|
|
12
12
|
width: "100%",
|
|
13
13
|
fontSize: "18px",
|
|
14
14
|
textAlign: "center",
|
|
15
15
|
color: `rgba(${e.palette.common.black}, 0.6)`
|
|
16
|
-
})), f = ({ index: e, isOver: t, disabled: n, type:
|
|
16
|
+
})), f = ({ index: e, isOver: t, disabled: n, type: i }) => /* @__PURE__ */ s(r, {
|
|
17
17
|
extraStyles: {
|
|
18
18
|
display: "flex",
|
|
19
19
|
padding: "0",
|
|
@@ -23,19 +23,19 @@ var u = n("pie-elements:match-title:answer"), d = l("div")(({ theme: e }) => ({
|
|
|
23
23
|
},
|
|
24
24
|
disabled: n,
|
|
25
25
|
isOver: t,
|
|
26
|
-
type:
|
|
27
|
-
children: e !== void 0 && /* @__PURE__ */
|
|
26
|
+
type: i,
|
|
27
|
+
children: e !== void 0 && /* @__PURE__ */ s(d, { children: e })
|
|
28
28
|
});
|
|
29
29
|
f.propTypes = {
|
|
30
|
-
index:
|
|
31
|
-
isOver:
|
|
32
|
-
disabled:
|
|
33
|
-
type:
|
|
30
|
+
index: n.number,
|
|
31
|
+
isOver: n.bool,
|
|
32
|
+
disabled: n.bool,
|
|
33
|
+
type: n.string
|
|
34
34
|
};
|
|
35
|
-
var p =
|
|
36
|
-
color:
|
|
37
|
-
backgroundColor:
|
|
38
|
-
border: `1px solid ${i === "correct" ?
|
|
35
|
+
var p = c("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i }) => ({
|
|
36
|
+
color: o.text(),
|
|
37
|
+
backgroundColor: o.white(),
|
|
38
|
+
border: `1px solid ${i === "correct" ? o.correct() : i === "incorrect" ? o.incorrect() : e.palette.grey[400]}`,
|
|
39
39
|
cursor: r ? "not-allowed" : "pointer",
|
|
40
40
|
width: "100%",
|
|
41
41
|
padding: "10px",
|
|
@@ -46,20 +46,20 @@ var p = l("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i
|
|
|
46
46
|
opacity: t && !r ? .5 : n && !r ? .2 : 1,
|
|
47
47
|
touchAction: "none"
|
|
48
48
|
})), m = (e) => {
|
|
49
|
-
let { isDragging: t, isOver: n, title: r, disabled: i, empty: a, outcome: o, guideIndex:
|
|
50
|
-
return a ? /* @__PURE__ */
|
|
51
|
-
index:
|
|
49
|
+
let { isDragging: t, isOver: n, title: r, disabled: i, empty: a, outcome: o, guideIndex: c, type: l } = e;
|
|
50
|
+
return a ? /* @__PURE__ */ s(f, {
|
|
51
|
+
index: c,
|
|
52
52
|
isOver: n,
|
|
53
53
|
disabled: i,
|
|
54
54
|
type: l
|
|
55
|
-
}) : /* @__PURE__ */
|
|
55
|
+
}) : /* @__PURE__ */ s(p, {
|
|
56
56
|
isDragging: t,
|
|
57
57
|
isOver: n,
|
|
58
58
|
disabled: i,
|
|
59
59
|
outcome: o,
|
|
60
60
|
dangerouslySetInnerHTML: { __html: r }
|
|
61
61
|
});
|
|
62
|
-
}, h =
|
|
62
|
+
}, h = c("div")(({ correct: e, theme: t }) => ({
|
|
63
63
|
boxSizing: "border-box",
|
|
64
64
|
minHeight: 40,
|
|
65
65
|
minWidth: "200px",
|
|
@@ -68,18 +68,18 @@ var p = l("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i
|
|
|
68
68
|
padding: "0px",
|
|
69
69
|
textAlign: "center",
|
|
70
70
|
height: "initial",
|
|
71
|
-
border: e === !0 ? `1px solid var(--feedback-correct-bg-color, ${
|
|
72
|
-
})), g = class extends
|
|
71
|
+
border: e === !0 ? `1px solid var(--feedback-correct-bg-color, ${o.correct()})` : e === !1 ? `1px solid var(--feedback-incorrect-bg-color, ${o.incorrect()})` : "none"
|
|
72
|
+
})), g = class extends e.Component {
|
|
73
73
|
static propTypes = {
|
|
74
|
-
className:
|
|
75
|
-
isDragging:
|
|
76
|
-
id:
|
|
77
|
-
title:
|
|
78
|
-
isOver:
|
|
79
|
-
empty:
|
|
80
|
-
type:
|
|
81
|
-
disabled:
|
|
82
|
-
correct:
|
|
74
|
+
className: n.string,
|
|
75
|
+
isDragging: n.bool,
|
|
76
|
+
id: n.any,
|
|
77
|
+
title: n.string,
|
|
78
|
+
isOver: n.bool,
|
|
79
|
+
empty: n.bool,
|
|
80
|
+
type: n.string,
|
|
81
|
+
disabled: n.bool,
|
|
82
|
+
correct: n.bool
|
|
83
83
|
};
|
|
84
84
|
componentDidMount() {
|
|
85
85
|
this.ref && this.ref.addEventListener("touchstart", this.handleTouchStart, { passive: !0 });
|
|
@@ -89,25 +89,25 @@ var p = l("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i
|
|
|
89
89
|
}
|
|
90
90
|
handleTouchStart = (e) => {};
|
|
91
91
|
render() {
|
|
92
|
-
let { id:
|
|
93
|
-
return u("[render], props: ", this.props), /* @__PURE__ */
|
|
94
|
-
correct:
|
|
95
|
-
className:
|
|
92
|
+
let { id: e, title: t, isDragging: n = !1, className: r, disabled: i, isOver: a = !1, type: o, correct: c } = this.props;
|
|
93
|
+
return u("[render], props: ", this.props), /* @__PURE__ */ s(h, {
|
|
94
|
+
correct: c,
|
|
95
|
+
className: r,
|
|
96
96
|
ref: (e) => this.ref = e,
|
|
97
|
-
children: /* @__PURE__ */
|
|
98
|
-
title:
|
|
99
|
-
id:
|
|
100
|
-
isOver:
|
|
101
|
-
empty:
|
|
102
|
-
isDragging:
|
|
103
|
-
disabled:
|
|
104
|
-
type:
|
|
97
|
+
children: /* @__PURE__ */ s(m, {
|
|
98
|
+
title: t,
|
|
99
|
+
id: e,
|
|
100
|
+
isOver: a,
|
|
101
|
+
empty: l(t),
|
|
102
|
+
isDragging: n,
|
|
103
|
+
disabled: i,
|
|
104
|
+
type: o
|
|
105
105
|
})
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
function _(e) {
|
|
110
|
-
let { id: t, instanceId: n, promptId: r, draggable:
|
|
110
|
+
let { id: t, instanceId: n, promptId: r, draggable: o = !0, disabled: c = !1, type: l } = e, u = `${l || "answer"}-${t}`, d = r == null ? void 0 : `drop-${r}`, { attributes: f, listeners: p, setNodeRef: m, transform: h, transition: _, isDragging: v } = i({
|
|
111
111
|
id: u,
|
|
112
112
|
data: {
|
|
113
113
|
type: l || "answer",
|
|
@@ -116,17 +116,17 @@ function _(e) {
|
|
|
116
116
|
value: e.title,
|
|
117
117
|
promptId: r
|
|
118
118
|
},
|
|
119
|
-
disabled: !
|
|
120
|
-
}), y =
|
|
119
|
+
disabled: !o || c
|
|
120
|
+
}), y = a({
|
|
121
121
|
id: d,
|
|
122
122
|
data: d ? {
|
|
123
123
|
type: "drop-zone",
|
|
124
124
|
promptId: r,
|
|
125
125
|
instanceId: n
|
|
126
126
|
} : void 0,
|
|
127
|
-
disabled:
|
|
127
|
+
disabled: c || !d
|
|
128
128
|
}), b = y.setNodeRef, x = y.isOver, S = h ? `translate3d(${h.x}px, ${h.y}px, 0)` : void 0;
|
|
129
|
-
return d ? /* @__PURE__ */
|
|
129
|
+
return d ? /* @__PURE__ */ s("div", {
|
|
130
130
|
ref: b,
|
|
131
131
|
style: {
|
|
132
132
|
flex: 1,
|
|
@@ -135,28 +135,28 @@ function _(e) {
|
|
|
135
135
|
opacity: v ? .5 : 1,
|
|
136
136
|
backgroundColor: x ? "rgba(0,0,0,0.05)" : "transparent"
|
|
137
137
|
},
|
|
138
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ s("div", {
|
|
139
139
|
ref: m,
|
|
140
140
|
...p,
|
|
141
141
|
...f,
|
|
142
|
-
children: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ s(g, {
|
|
143
143
|
...e,
|
|
144
144
|
isDragging: v,
|
|
145
145
|
isOver: x
|
|
146
146
|
})
|
|
147
147
|
})
|
|
148
|
-
}) : /* @__PURE__ */
|
|
148
|
+
}) : /* @__PURE__ */ s("div", {
|
|
149
149
|
ref: m,
|
|
150
150
|
...p,
|
|
151
151
|
...f,
|
|
152
152
|
style: {
|
|
153
153
|
transform: S,
|
|
154
154
|
transition: _,
|
|
155
|
-
cursor:
|
|
155
|
+
cursor: c ? "not-allowed" : "grab",
|
|
156
156
|
opacity: v ? .5 : 1,
|
|
157
|
-
touchAction:
|
|
157
|
+
touchAction: o && !c ? "none" : "auto"
|
|
158
158
|
},
|
|
159
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ s(g, {
|
|
160
160
|
...e,
|
|
161
161
|
isDragging: v,
|
|
162
162
|
isOver: !1
|
|
@@ -164,13 +164,13 @@ function _(e) {
|
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
166
|
_.propTypes = {
|
|
167
|
-
id:
|
|
168
|
-
instanceId:
|
|
169
|
-
promptId:
|
|
170
|
-
title:
|
|
171
|
-
draggable:
|
|
172
|
-
disabled:
|
|
173
|
-
type:
|
|
167
|
+
id: n.any,
|
|
168
|
+
instanceId: n.string,
|
|
169
|
+
promptId: n.any,
|
|
170
|
+
title: n.string,
|
|
171
|
+
draggable: n.bool,
|
|
172
|
+
disabled: n.bool,
|
|
173
|
+
type: n.string
|
|
174
174
|
};
|
|
175
175
|
//#endregion
|
|
176
176
|
export { g as Answer, _ as default };
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "
|
|
7
|
-
import o from "
|
|
8
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
9
|
-
import { styled as c } from "@mui/material/styles";
|
|
1
|
+
import e from "./answer.js";
|
|
2
|
+
import t from "./droppable-placeholder.js";
|
|
3
|
+
import n from "react";
|
|
4
|
+
import r from "prop-types";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { styled as a } from "@mui/material/styles";
|
|
7
|
+
import { find as o, isEmpty as s, isUndefined as c } from "@pie-element/shared-lodash";
|
|
10
8
|
//#region src/delivery/choices-list.tsx
|
|
11
|
-
var l =
|
|
9
|
+
var l = a("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), u = class extends n.Component {
|
|
12
10
|
static propTypes = {
|
|
13
|
-
session:
|
|
14
|
-
instanceId:
|
|
15
|
-
model:
|
|
16
|
-
disabled:
|
|
17
|
-
onRemoveAnswer:
|
|
11
|
+
session: r.object.isRequired,
|
|
12
|
+
instanceId: r.string.isRequired,
|
|
13
|
+
model: r.object.isRequired,
|
|
14
|
+
disabled: r.bool.isRequired,
|
|
15
|
+
onRemoveAnswer: r.func
|
|
18
16
|
};
|
|
19
17
|
render() {
|
|
20
|
-
let { model:
|
|
21
|
-
return /* @__PURE__ */
|
|
18
|
+
let { model: n, disabled: r, session: a, instanceId: u, onRemoveAnswer: d } = this.props, { config: f } = n, { duplicates: p } = f;
|
|
19
|
+
return /* @__PURE__ */ i(l, { children: /* @__PURE__ */ i(t, {
|
|
22
20
|
id: "choices-pool",
|
|
23
|
-
disabled:
|
|
21
|
+
disabled: r,
|
|
24
22
|
onRemoveAnswer: d,
|
|
25
|
-
children: f.answers.filter((
|
|
23
|
+
children: f.answers.filter((e) => p || s(a) || !a.value || c(o(a.value, (t) => t === e.id))).map((t) => /* @__PURE__ */ i(e, {
|
|
26
24
|
instanceId: u,
|
|
27
25
|
draggable: !0,
|
|
28
|
-
disabled:
|
|
29
|
-
session:
|
|
26
|
+
disabled: r,
|
|
27
|
+
session: a,
|
|
30
28
|
type: "choice",
|
|
31
|
-
...
|
|
32
|
-
},
|
|
29
|
+
...t
|
|
30
|
+
}, t.id))
|
|
33
31
|
}) });
|
|
34
32
|
}
|
|
35
33
|
};
|
package/dist/delivery/main.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "
|
|
7
|
-
import o from "
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
16
|
-
import { styled as y } from "@mui/material/styles";
|
|
1
|
+
import { Answer as e } from "./answer.js";
|
|
2
|
+
import t from "./answer-area.js";
|
|
3
|
+
import n from "./choices-list.js";
|
|
4
|
+
import r from "react";
|
|
5
|
+
import i from "prop-types";
|
|
6
|
+
import { swap as a } from "@pie-lib/drag";
|
|
7
|
+
import { DndContext as o, DragOverlay as s } from "@dnd-kit/core";
|
|
8
|
+
import { restrictToFirstScrollableAncestor as c } from "@dnd-kit/modifiers";
|
|
9
|
+
import l from "@pie-lib/correct-answer-toggle";
|
|
10
|
+
import * as u from "@pie-lib/render-ui";
|
|
11
|
+
import { Feedback as d, PreviewPrompt as f, color as p } from "@pie-lib/render-ui";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
|
+
import { styled as g } from "@mui/material/styles";
|
|
14
|
+
import { findKey as _, isUndefined as v, uniqueId as y } from "@pie-element/shared-lodash";
|
|
17
15
|
//#region src/delivery/main.tsx
|
|
18
16
|
function b(e) {
|
|
19
17
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
@@ -21,21 +19,21 @@ function b(e) {
|
|
|
21
19
|
function x(e, t) {
|
|
22
20
|
return !e || b(e) ? e : b(e.default) ? e.default : t && b(e[t]) ? e[t] : t && b(e[t]?.default) ? e[t].default : e;
|
|
23
21
|
}
|
|
24
|
-
var S = x(
|
|
22
|
+
var S = x(f, "PreviewPrompt") || x(E.PreviewPrompt, "PreviewPrompt"), C = x(d, "Feedback") || x(E.Feedback, "Feedback"), w = u, T = w.default, E = T && typeof T == "object" ? T : w, D = g("div")({
|
|
25
23
|
display: "flex",
|
|
26
24
|
flexDirection: "column",
|
|
27
25
|
justifyContent: "center",
|
|
28
|
-
color:
|
|
29
|
-
backgroundColor:
|
|
30
|
-
}), O = class extends
|
|
26
|
+
color: p.text(),
|
|
27
|
+
backgroundColor: p.background()
|
|
28
|
+
}), O = class extends r.Component {
|
|
31
29
|
static propTypes = {
|
|
32
|
-
session:
|
|
33
|
-
onSessionChange:
|
|
34
|
-
model:
|
|
35
|
-
prompt:
|
|
30
|
+
session: i.object.isRequired,
|
|
31
|
+
onSessionChange: i.func,
|
|
32
|
+
model: i.object.isRequired,
|
|
33
|
+
prompt: i.string
|
|
36
34
|
};
|
|
37
35
|
constructor(e) {
|
|
38
|
-
super(e), this.instanceId =
|
|
36
|
+
super(e), this.instanceId = y(), this.state = {
|
|
39
37
|
showCorrectAnswer: !1,
|
|
40
38
|
draggingElement: null
|
|
41
39
|
};
|
|
@@ -61,87 +59,87 @@ var S = x(h, "PreviewPrompt") || x(E.PreviewPrompt, "PreviewPrompt"), C = x(m, "
|
|
|
61
59
|
} });
|
|
62
60
|
}
|
|
63
61
|
};
|
|
64
|
-
onPlaceAnswer = (
|
|
62
|
+
onPlaceAnswer = (e) => {
|
|
65
63
|
this.setState({ draggingElement: null });
|
|
66
|
-
let { active:
|
|
64
|
+
let { active: t, over: n } = e;
|
|
65
|
+
if (!t) return;
|
|
66
|
+
let r = t.data.current, i = n?.data.current;
|
|
67
67
|
if (!r) return;
|
|
68
|
-
let
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
if (t(s.value) && (s.value = {}), o.type === "choices-pool" && a.promptId !== void 0) {
|
|
72
|
-
s.value[a.promptId] = void 0, l(s);
|
|
68
|
+
let { session: o, onSessionChange: s, model: c } = this.props, { config: { duplicates: l } } = c;
|
|
69
|
+
if (v(o.value) && (o.value = {}), i.type === "choices-pool" && r.promptId !== void 0) {
|
|
70
|
+
o.value[r.promptId] = void 0, s(o);
|
|
73
71
|
return;
|
|
74
72
|
}
|
|
75
|
-
let
|
|
76
|
-
if (
|
|
77
|
-
let
|
|
78
|
-
if (
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
} else if (
|
|
82
|
-
let
|
|
83
|
-
if (
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
} else
|
|
73
|
+
let u = r.id, d = r.promptId;
|
|
74
|
+
if (i && i.type === "drop-zone" && i.promptId != null) {
|
|
75
|
+
let e = i.promptId;
|
|
76
|
+
if (r.type === "choice" && i.type === "drop-zone" && e !== void 0) {
|
|
77
|
+
let t = _(o.value, (e) => e === u);
|
|
78
|
+
t && !l ? o.value = a(o.value, t, e) : o.value[e] = u;
|
|
79
|
+
} else if (r.type === "target" && d != null && d !== e) {
|
|
80
|
+
let t = o.value[e] != null;
|
|
81
|
+
if (t && !l) {
|
|
82
|
+
let t = o.value[e];
|
|
83
|
+
o.value[e] = u, o.value[d] = t;
|
|
84
|
+
} else t || (o.value[e] = u, delete o.value[d]);
|
|
87
85
|
}
|
|
88
|
-
|
|
86
|
+
s(o);
|
|
89
87
|
}
|
|
90
88
|
};
|
|
91
89
|
toggleShowCorrect = () => {
|
|
92
90
|
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
93
91
|
};
|
|
94
92
|
renderDragOverlay = () => {
|
|
95
|
-
let { draggingElement:
|
|
96
|
-
return
|
|
97
|
-
id:
|
|
98
|
-
title:
|
|
93
|
+
let { draggingElement: t } = this.state;
|
|
94
|
+
return t ? /* @__PURE__ */ m(e, {
|
|
95
|
+
id: t.id,
|
|
96
|
+
title: t.value,
|
|
99
97
|
disabled: !1,
|
|
100
98
|
isDragging: !1,
|
|
101
|
-
style:
|
|
102
|
-
width:
|
|
103
|
-
height:
|
|
99
|
+
style: t.rect ? {
|
|
100
|
+
width: t.rect.width,
|
|
101
|
+
height: t.rect.height,
|
|
104
102
|
boxSizing: "border-box"
|
|
105
103
|
} : {}
|
|
106
104
|
}) : null;
|
|
107
105
|
};
|
|
108
106
|
render() {
|
|
109
|
-
let { showCorrectAnswer: e } = this.state, { model:
|
|
110
|
-
return /* @__PURE__ */
|
|
107
|
+
let { showCorrectAnswer: e } = this.state, { model: r, session: i } = this.props, { config: a, mode: u } = r, { prompt: d, language: f } = a;
|
|
108
|
+
return /* @__PURE__ */ h(o, {
|
|
111
109
|
onDragStart: this.onDragStart,
|
|
112
110
|
onDragEnd: this.onPlaceAnswer,
|
|
113
|
-
modifiers: [
|
|
114
|
-
children: [/* @__PURE__ */
|
|
115
|
-
/* @__PURE__ */
|
|
111
|
+
modifiers: [c],
|
|
112
|
+
children: [/* @__PURE__ */ h(D, { children: [
|
|
113
|
+
/* @__PURE__ */ m(S, {
|
|
116
114
|
className: "prompt",
|
|
117
|
-
prompt:
|
|
115
|
+
prompt: d
|
|
118
116
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
show:
|
|
117
|
+
/* @__PURE__ */ m(l, {
|
|
118
|
+
show: u === "evaluate",
|
|
121
119
|
toggled: e,
|
|
122
120
|
onToggle: this.toggleShowCorrect,
|
|
123
|
-
language:
|
|
121
|
+
language: f
|
|
124
122
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ m(t, {
|
|
126
124
|
instanceId: this.instanceId,
|
|
127
|
-
model:
|
|
128
|
-
session:
|
|
125
|
+
model: r,
|
|
126
|
+
session: i,
|
|
129
127
|
onRemoveAnswer: (e) => this.onRemoveAnswer(e),
|
|
130
|
-
disabled:
|
|
128
|
+
disabled: u !== "gather",
|
|
131
129
|
showCorrect: e
|
|
132
130
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ m(n, {
|
|
134
132
|
instanceId: this.instanceId,
|
|
135
|
-
model:
|
|
136
|
-
session:
|
|
137
|
-
disabled:
|
|
133
|
+
model: r,
|
|
134
|
+
session: i,
|
|
135
|
+
disabled: u !== "gather",
|
|
138
136
|
onRemoveAnswer: (e) => this.onRemoveAnswer(e)
|
|
139
137
|
}),
|
|
140
|
-
|
|
141
|
-
correctness:
|
|
142
|
-
feedback:
|
|
138
|
+
r.correctness && r.feedback && !e && /* @__PURE__ */ m(C, {
|
|
139
|
+
correctness: r.correctness.correctness,
|
|
140
|
+
feedback: r.feedback
|
|
143
141
|
})
|
|
144
|
-
] }), /* @__PURE__ */
|
|
142
|
+
] }), /* @__PURE__ */ m(s, { children: this.renderDragOverlay() })]
|
|
145
143
|
});
|
|
146
144
|
}
|
|
147
145
|
};
|