@pie-element/match-list 7.1.1-next.11 → 7.1.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controller.js +1 -0
- package/dist/browser/controller/index.js +201 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +14088 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/isEmpty-Eo-n7WSl.js +387 -0
- package/dist/browser/isEmpty-Eo-n7WSl.js.map +1 -0
- package/dist/controller/defaults.d.ts +17 -0
- package/dist/controller/defaults.js +9 -0
- package/dist/controller/index.d.ts +38 -0
- package/dist/controller/index.js +105 -0
- package/dist/delivery/answer-area.d.ts +27 -0
- package/dist/delivery/answer-area.js +94 -0
- package/dist/delivery/answer.d.ts +40 -0
- package/dist/delivery/answer.js +176 -0
- package/dist/delivery/arrow.d.ts +17 -0
- package/dist/delivery/arrow.js +35 -0
- package/dist/delivery/choices-list.d.ts +21 -0
- package/dist/delivery/choices-list.js +37 -0
- package/dist/delivery/droppable-placeholder.d.ts +24 -0
- package/dist/delivery/droppable-placeholder.js +42 -0
- package/dist/delivery/index.d.ts +21 -0
- package/dist/delivery/index.js +49 -0
- package/dist/delivery/main.d.ts +26 -0
- package/dist/delivery/main.js +149 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +152 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayReduce.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindIndex.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindKey.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js +26 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseReduce.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createFind.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js +18 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/find.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findIndex.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findKey.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/property.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/reduce.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js +9 -0
- package/package.json +65 -21
- package/CHANGELOG.json +0 -572
- package/CHANGELOG.md +0 -1485
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/controller/CHANGELOG.json +0 -242
- package/controller/CHANGELOG.md +0 -1043
- package/controller/lib/defaults.js +0 -15
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -246
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -25
- package/docs/config-schema.json +0 -70
- package/docs/config-schema.json.md +0 -55
- package/docs/demo/config.js +0 -34
- package/docs/demo/generate.js +0 -54
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -6
- package/docs/pie-schema.json +0 -170
- package/docs/pie-schema.json.md +0 -104
- package/lib/answer-area.js +0 -168
- package/lib/answer-area.js.map +0 -1
- package/lib/answer.js +0 -267
- package/lib/answer.js.map +0 -1
- package/lib/arrow.js +0 -57
- package/lib/arrow.js.map +0 -1
- package/lib/choices-list.js +0 -60
- package/lib/choices-list.js.map +0 -1
- package/lib/droppable-placeholder.js +0 -60
- package/lib/droppable-placeholder.js.map +0 -1
- package/lib/index.js +0 -86
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -220
- package/lib/main.js.map +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
|
|
2
|
+
import t from "./defaults.js";
|
|
3
|
+
import n from "debug";
|
|
4
|
+
import { getFeedbackForCorrectness as r } from "@pie-element/shared-feedback";
|
|
5
|
+
import { getShuffledChoices as i, lockChoices as a, partialScoring as o } from "@pie-element/shared-controller-utils";
|
|
6
|
+
//#region src/controller/index.ts
|
|
7
|
+
var s = n("@pie-element:match-list:controller"), c = (e, t, n) => {
|
|
8
|
+
let r = o.enabled(e, n), i = e.prompts;
|
|
9
|
+
if (!t || Object.keys(t).length === 0) return "unanswered";
|
|
10
|
+
let a = d(e), s = u(i, t);
|
|
11
|
+
return a === s ? "correct" : s === 0 ? "incorrect" : r ? "partial" : "incorrect";
|
|
12
|
+
}, l = (e, t, n) => {
|
|
13
|
+
if (t.mode === "evaluate") return c(e, n, t);
|
|
14
|
+
}, u = (e = [], t) => {
|
|
15
|
+
let n = 0;
|
|
16
|
+
return e.forEach((e) => {
|
|
17
|
+
e.relatedAnswer === t[e.id] && (n += 1);
|
|
18
|
+
}), n;
|
|
19
|
+
}, d = (e) => e && e.prompts ? e.prompts.length : 0, f = (e, t) => {
|
|
20
|
+
let n = u(e && e.prompts, t), r = d(e);
|
|
21
|
+
return parseFloat((n / r).toFixed(2));
|
|
22
|
+
}, p = (e, t, n) => {
|
|
23
|
+
let r = l(e, t, n);
|
|
24
|
+
return r === "correct" ? 1 : r === "partial" ? f(e, n) : 0;
|
|
25
|
+
}, m = (e, t, n) => {
|
|
26
|
+
let r = [], i = e?.prompts || [], a = t?.value || {};
|
|
27
|
+
if (!a || Object.keys(a).length === 0) return r.push("Student did not provide any answer."), r;
|
|
28
|
+
let s = i.length;
|
|
29
|
+
r.push(`Match-list item contains ${s} question(s).`);
|
|
30
|
+
let c = 0, l = 0;
|
|
31
|
+
i.forEach((e) => {
|
|
32
|
+
let t = e.relatedAnswer, n = a[e.id];
|
|
33
|
+
n === void 0 ? r.push(`Question ${e.id}: no answer provided.`) : (l += 1, n === t ? (c += 1, r.push(`Question ${e.id}: correctly matched.`)) : r.push(`Question ${e.id}: incorrectly matched (selected '${n}', expected '${t}').`));
|
|
34
|
+
}), r.push(`Student correctly matched ${c} out of ${s} question(s).`);
|
|
35
|
+
let u = o.enabled(e, n);
|
|
36
|
+
u ? (r.push("Score calculated using partial scoring."), r.push("Score is the number of correct matches divided by the total number of questions.")) : (r.push("Score calculated using all-or-nothing scoring."), r.push("Student must match all questions correctly to receive full credit."));
|
|
37
|
+
let d = p(e, n, a), f = u ? d : +(d === 1);
|
|
38
|
+
return r.push(`Final score: ${f}.`), r;
|
|
39
|
+
}, h = (t, n, r) => new Promise((i) => {
|
|
40
|
+
r.mode === "evaluate" ? !n || e(n) ? i({
|
|
41
|
+
score: 0,
|
|
42
|
+
empty: !0,
|
|
43
|
+
logTrace: ["Student did not provide any answer."]
|
|
44
|
+
}) : i({
|
|
45
|
+
score: p(t, r, n.value),
|
|
46
|
+
empty: !1,
|
|
47
|
+
logTrace: m(t, n, r)
|
|
48
|
+
}) : i({
|
|
49
|
+
score: void 0,
|
|
50
|
+
completed: void 0,
|
|
51
|
+
logTrace: []
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
function g(e = {}) {
|
|
55
|
+
return new Promise((n) => {
|
|
56
|
+
n({
|
|
57
|
+
...t,
|
|
58
|
+
...e
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
var _ = (e) => ({
|
|
63
|
+
...t,
|
|
64
|
+
...e
|
|
65
|
+
});
|
|
66
|
+
async function v(t, n, o, c) {
|
|
67
|
+
t = _(t);
|
|
68
|
+
let u = l(t, o, n && n.value), d = {}, f = {
|
|
69
|
+
score: `${p(t, o, n && n.value) * 100}%`,
|
|
70
|
+
correctness: u
|
|
71
|
+
}, m = {}, h = t.prompts, g = t.answers, v = (e) => (t, n, r) => new Promise((t) => {
|
|
72
|
+
m[e] = r.shuffledValues, t();
|
|
73
|
+
});
|
|
74
|
+
a(t, n, o) || (h = await i(h, { shuffledValues: (n && n.shuffledValues || {}).prompts }, v("prompts"), "id"), g = await i(g, { shuffledValues: (n && n.shuffledValues || {}).answers }, v("answers"), "id")), e(m) || c && typeof c == "function" && c(n.id, n.element, { shuffledValues: m }).catch((e) => {
|
|
75
|
+
console.error("update session failed", e);
|
|
76
|
+
}), t && h && h.forEach((e) => {
|
|
77
|
+
d[e.id] = e.relatedAnswer;
|
|
78
|
+
});
|
|
79
|
+
let y = o.mode === "evaluate" ? await r(f.correctness, t.feedback) : void 0, b = {
|
|
80
|
+
config: {
|
|
81
|
+
...t,
|
|
82
|
+
prompts: h,
|
|
83
|
+
answers: g
|
|
84
|
+
},
|
|
85
|
+
correctness: f,
|
|
86
|
+
feedback: y,
|
|
87
|
+
mode: o.mode
|
|
88
|
+
};
|
|
89
|
+
o.role === "instructor" && (o.mode === "view" || o.mode === "evaluate") ? b.rationale = t.rationale : b.rationale = null;
|
|
90
|
+
let x = Object.assign(b, { correctResponse: d });
|
|
91
|
+
return s("out: ", x), x;
|
|
92
|
+
}
|
|
93
|
+
var y = (e, t) => new Promise((n) => {
|
|
94
|
+
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
95
|
+
let { prompts: t, answers: r } = e, i = {};
|
|
96
|
+
t.forEach((e) => {
|
|
97
|
+
r.filter((t) => t.id === e.relatedAnswer).length && (i[e.id] = e.relatedAnswer);
|
|
98
|
+
}), n({
|
|
99
|
+
value: i,
|
|
100
|
+
id: "1"
|
|
101
|
+
});
|
|
102
|
+
} else n(null);
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
export { y as createCorrectResponseSession, g as createDefaultModel, m as getLogTrace, v as model, _ as normalize, h as outcome };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/match-list/src/answer-area.jsx
|
|
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
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class AnswerArea extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
session: PropTypes.Validator<object>;
|
|
14
|
+
showCorrect: PropTypes.Validator<boolean>;
|
|
15
|
+
disabled: PropTypes.Validator<boolean>;
|
|
16
|
+
onSessionChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
onRemoveAnswer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
instanceId: PropTypes.Validator<string>;
|
|
19
|
+
model: PropTypes.Validator<object>;
|
|
20
|
+
prompt: PropTypes.Requireable<string>;
|
|
21
|
+
};
|
|
22
|
+
getAnswerFromSession: any;
|
|
23
|
+
getCorrectOrIncorrectMap: any;
|
|
24
|
+
buildRows: any;
|
|
25
|
+
render(): React.JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export default AnswerArea;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
|
|
2
|
+
import t from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js";
|
|
3
|
+
import n from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/reduce.js";
|
|
4
|
+
import r from "./arrow.js";
|
|
5
|
+
import i from "./answer.js";
|
|
6
|
+
import a from "react";
|
|
7
|
+
import o from "prop-types";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
+
import { styled as l } from "@mui/material/styles";
|
|
10
|
+
//#region src/delivery/answer-area.tsx
|
|
11
|
+
var u = l("div")({
|
|
12
|
+
alignItems: "normal",
|
|
13
|
+
display: "flex",
|
|
14
|
+
height: 40,
|
|
15
|
+
margin: "10px 20px"
|
|
16
|
+
}), d = l("div")(({ theme: e }) => ({
|
|
17
|
+
alignItems: "flex-start",
|
|
18
|
+
display: "flex",
|
|
19
|
+
flex: 1,
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
justifyContent: "space-between",
|
|
22
|
+
marginTop: e.spacing(2),
|
|
23
|
+
marginBottom: e.spacing(2)
|
|
24
|
+
})), f = l("div")(({ theme: e }) => ({
|
|
25
|
+
border: `1px solid ${e.palette.grey[400]}`,
|
|
26
|
+
boxSizing: "border-box",
|
|
27
|
+
flex: 1,
|
|
28
|
+
margin: "10px 0",
|
|
29
|
+
minHeight: 40,
|
|
30
|
+
overflow: "hidden",
|
|
31
|
+
padding: 10,
|
|
32
|
+
textAlign: "center",
|
|
33
|
+
width: "100%",
|
|
34
|
+
wordBreak: "break-word"
|
|
35
|
+
})), p = l("div")({
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
display: "flex",
|
|
38
|
+
justifyContent: "space-between",
|
|
39
|
+
width: "100%"
|
|
40
|
+
}), m = class extends a.Component {
|
|
41
|
+
static propTypes = {
|
|
42
|
+
session: o.object.isRequired,
|
|
43
|
+
showCorrect: o.bool.isRequired,
|
|
44
|
+
disabled: o.bool.isRequired,
|
|
45
|
+
onSessionChange: o.func,
|
|
46
|
+
onRemoveAnswer: o.func,
|
|
47
|
+
instanceId: o.string.isRequired,
|
|
48
|
+
model: o.object.isRequired,
|
|
49
|
+
prompt: o.string
|
|
50
|
+
};
|
|
51
|
+
getAnswerFromSession = (e) => {
|
|
52
|
+
let { model: t, session: n, showCorrect: r } = this.props, { config: i } = t, a = r ? i.prompts.find((t) => t.id === e).relatedAnswer : n.value && n.value[e];
|
|
53
|
+
return i.answers.find((e) => e.id === a) || {};
|
|
54
|
+
};
|
|
55
|
+
getCorrectOrIncorrectMap = () => {
|
|
56
|
+
let { model: e, session: r, showCorrect: i } = this.props, { config: a } = e, o = r.value || a.prompts.reduce((e, t) => (e[t.id] = void 0, e), {});
|
|
57
|
+
if (e.mode !== "evaluate") return {};
|
|
58
|
+
if (i) return a.prompts.reduce((e, t) => (e[t.id] = !0, e), {});
|
|
59
|
+
let s = a.prompts.reduce((e, n) => (t(n.relatedAnswer) || (e[n.id] = n.relatedAnswer), e), {});
|
|
60
|
+
return n(o, (e, t, n) => (e[n] = s[n] === o[n], e), {});
|
|
61
|
+
};
|
|
62
|
+
buildRows = () => {
|
|
63
|
+
let { model: e } = this.props, { config: t } = e;
|
|
64
|
+
return (t.prompts || []).map((e) => {
|
|
65
|
+
let t = this.getAnswerFromSession(e.id);
|
|
66
|
+
return {
|
|
67
|
+
...e,
|
|
68
|
+
sessionAnswer: t
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
render() {
|
|
73
|
+
let { disabled: t, instanceId: n, onRemoveAnswer: a } = this.props, o = this.buildRows(), l = this.getCorrectOrIncorrectMap();
|
|
74
|
+
return /* @__PURE__ */ s(d, { children: o.map(({ sessionAnswer: o, title: d, id: m }, h) => /* @__PURE__ */ c(p, { children: [
|
|
75
|
+
/* @__PURE__ */ s(f, { dangerouslySetInnerHTML: { __html: d } }),
|
|
76
|
+
/* @__PURE__ */ c(u, { children: [/* @__PURE__ */ s(r, { direction: "left" }), /* @__PURE__ */ s(r, {})] }),
|
|
77
|
+
/* @__PURE__ */ s(i, {
|
|
78
|
+
className: "answer",
|
|
79
|
+
index: h,
|
|
80
|
+
promptId: m,
|
|
81
|
+
correct: l[m],
|
|
82
|
+
draggable: !e(o),
|
|
83
|
+
disabled: t,
|
|
84
|
+
instanceId: n,
|
|
85
|
+
id: o.id,
|
|
86
|
+
title: o.title,
|
|
87
|
+
type: "target",
|
|
88
|
+
onRemoveChoice: () => a(m)
|
|
89
|
+
}, h)
|
|
90
|
+
] }, h)) });
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { m as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/match-list/src/answer.jsx
|
|
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
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export declare class Answer extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
className: PropTypes.Requireable<string>;
|
|
14
|
+
isDragging: PropTypes.Requireable<boolean>;
|
|
15
|
+
id: PropTypes.Requireable<any>;
|
|
16
|
+
title: PropTypes.Requireable<string>;
|
|
17
|
+
isOver: PropTypes.Requireable<boolean>;
|
|
18
|
+
empty: PropTypes.Requireable<boolean>;
|
|
19
|
+
type: PropTypes.Requireable<string>;
|
|
20
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
21
|
+
correct: PropTypes.Requireable<boolean>;
|
|
22
|
+
};
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentWillUnmount(): void;
|
|
25
|
+
handleTouchStart: any;
|
|
26
|
+
render(): React.JSX.Element;
|
|
27
|
+
}
|
|
28
|
+
declare function DragAndDropAnswer(props: any): React.JSX.Element;
|
|
29
|
+
declare namespace DragAndDropAnswer {
|
|
30
|
+
var propTypes: {
|
|
31
|
+
id: PropTypes.Requireable<any>;
|
|
32
|
+
instanceId: PropTypes.Requireable<string>;
|
|
33
|
+
promptId: PropTypes.Requireable<any>;
|
|
34
|
+
title: PropTypes.Requireable<string>;
|
|
35
|
+
draggable: PropTypes.Requireable<boolean>;
|
|
36
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
37
|
+
type: PropTypes.Requireable<string>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export default DragAndDropAnswer;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "debug";
|
|
4
|
+
import r from "prop-types";
|
|
5
|
+
import { PlaceHolder as i } from "@pie-lib/drag";
|
|
6
|
+
import { useDraggable as a, useDroppable as o } from "@dnd-kit/core";
|
|
7
|
+
import { color as s } from "@pie-lib/render-ui";
|
|
8
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
9
|
+
import { styled as l } from "@mui/material/styles";
|
|
10
|
+
//#region src/delivery/answer.tsx
|
|
11
|
+
var u = n("pie-elements:match-title:answer"), d = l("div")(({ theme: e }) => ({
|
|
12
|
+
width: "100%",
|
|
13
|
+
fontSize: "18px",
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
color: `rgba(${e.palette.common.black}, 0.6)`
|
|
16
|
+
})), f = ({ index: e, isOver: t, disabled: n, type: r }) => /* @__PURE__ */ c(i, {
|
|
17
|
+
extraStyles: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
padding: "0",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
height: "40px"
|
|
23
|
+
},
|
|
24
|
+
disabled: n,
|
|
25
|
+
isOver: t,
|
|
26
|
+
type: r,
|
|
27
|
+
children: e !== void 0 && /* @__PURE__ */ c(d, { children: e })
|
|
28
|
+
});
|
|
29
|
+
f.propTypes = {
|
|
30
|
+
index: r.number,
|
|
31
|
+
isOver: r.bool,
|
|
32
|
+
disabled: r.bool,
|
|
33
|
+
type: r.string
|
|
34
|
+
};
|
|
35
|
+
var p = l("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i }) => ({
|
|
36
|
+
color: s.text(),
|
|
37
|
+
backgroundColor: s.white(),
|
|
38
|
+
border: `1px solid ${i === "correct" ? s.correct() : i === "incorrect" ? s.incorrect() : e.palette.grey[400]}`,
|
|
39
|
+
cursor: r ? "not-allowed" : "pointer",
|
|
40
|
+
width: "100%",
|
|
41
|
+
padding: "10px",
|
|
42
|
+
boxSizing: "border-box",
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
transition: "opacity 200ms linear",
|
|
45
|
+
wordBreak: "break-word",
|
|
46
|
+
opacity: t && !r ? .5 : n && !r ? .2 : 1,
|
|
47
|
+
touchAction: "none"
|
|
48
|
+
})), m = (e) => {
|
|
49
|
+
let { isDragging: t, isOver: n, title: r, disabled: i, empty: a, outcome: o, guideIndex: s, type: l } = e;
|
|
50
|
+
return a ? /* @__PURE__ */ c(f, {
|
|
51
|
+
index: s,
|
|
52
|
+
isOver: n,
|
|
53
|
+
disabled: i,
|
|
54
|
+
type: l
|
|
55
|
+
}) : /* @__PURE__ */ c(p, {
|
|
56
|
+
isDragging: t,
|
|
57
|
+
isOver: n,
|
|
58
|
+
disabled: i,
|
|
59
|
+
outcome: o,
|
|
60
|
+
dangerouslySetInnerHTML: { __html: r }
|
|
61
|
+
});
|
|
62
|
+
}, h = l("div")(({ correct: e, theme: t }) => ({
|
|
63
|
+
boxSizing: "border-box",
|
|
64
|
+
minHeight: 40,
|
|
65
|
+
minWidth: "200px",
|
|
66
|
+
overflow: "hidden",
|
|
67
|
+
margin: t.spacing(.5),
|
|
68
|
+
padding: "0px",
|
|
69
|
+
textAlign: "center",
|
|
70
|
+
height: "initial",
|
|
71
|
+
border: e === !0 ? `1px solid var(--feedback-correct-bg-color, ${s.correct()})` : e === !1 ? `1px solid var(--feedback-incorrect-bg-color, ${s.incorrect()})` : "none"
|
|
72
|
+
})), g = class extends t.Component {
|
|
73
|
+
static propTypes = {
|
|
74
|
+
className: r.string,
|
|
75
|
+
isDragging: r.bool,
|
|
76
|
+
id: r.any,
|
|
77
|
+
title: r.string,
|
|
78
|
+
isOver: r.bool,
|
|
79
|
+
empty: r.bool,
|
|
80
|
+
type: r.string,
|
|
81
|
+
disabled: r.bool,
|
|
82
|
+
correct: r.bool
|
|
83
|
+
};
|
|
84
|
+
componentDidMount() {
|
|
85
|
+
this.ref && this.ref.addEventListener("touchstart", this.handleTouchStart, { passive: !0 });
|
|
86
|
+
}
|
|
87
|
+
componentWillUnmount() {
|
|
88
|
+
this.ref && this.ref.removeEventListener("touchstart", this.handleTouchStart);
|
|
89
|
+
}
|
|
90
|
+
handleTouchStart = (e) => {};
|
|
91
|
+
render() {
|
|
92
|
+
let { id: t, title: n, isDragging: r = !1, className: i, disabled: a, isOver: o = !1, type: s, correct: l } = this.props;
|
|
93
|
+
return u("[render], props: ", this.props), /* @__PURE__ */ c(h, {
|
|
94
|
+
correct: l,
|
|
95
|
+
className: i,
|
|
96
|
+
ref: (e) => this.ref = e,
|
|
97
|
+
children: /* @__PURE__ */ c(m, {
|
|
98
|
+
title: n,
|
|
99
|
+
id: t,
|
|
100
|
+
isOver: o,
|
|
101
|
+
empty: e(n),
|
|
102
|
+
isDragging: r,
|
|
103
|
+
disabled: a,
|
|
104
|
+
type: s
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function _(e) {
|
|
110
|
+
let { id: t, instanceId: n, promptId: r, draggable: i = !0, disabled: s = !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 } = a({
|
|
111
|
+
id: u,
|
|
112
|
+
data: {
|
|
113
|
+
type: l || "answer",
|
|
114
|
+
id: t,
|
|
115
|
+
instanceId: n,
|
|
116
|
+
value: e.title,
|
|
117
|
+
promptId: r
|
|
118
|
+
},
|
|
119
|
+
disabled: !i || s
|
|
120
|
+
}), y = o({
|
|
121
|
+
id: d,
|
|
122
|
+
data: d ? {
|
|
123
|
+
type: "drop-zone",
|
|
124
|
+
promptId: r,
|
|
125
|
+
instanceId: n
|
|
126
|
+
} : void 0,
|
|
127
|
+
disabled: s || !d
|
|
128
|
+
}), b = y.setNodeRef, x = y.isOver, S = h ? `translate3d(${h.x}px, ${h.y}px, 0)` : void 0;
|
|
129
|
+
return d ? /* @__PURE__ */ c("div", {
|
|
130
|
+
ref: b,
|
|
131
|
+
style: {
|
|
132
|
+
flex: 1,
|
|
133
|
+
transform: S,
|
|
134
|
+
transition: _,
|
|
135
|
+
opacity: v ? .5 : 1,
|
|
136
|
+
backgroundColor: x ? "rgba(0,0,0,0.05)" : "transparent"
|
|
137
|
+
},
|
|
138
|
+
children: /* @__PURE__ */ c("div", {
|
|
139
|
+
ref: m,
|
|
140
|
+
...p,
|
|
141
|
+
...f,
|
|
142
|
+
children: /* @__PURE__ */ c(g, {
|
|
143
|
+
...e,
|
|
144
|
+
isDragging: v,
|
|
145
|
+
isOver: x
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
}) : /* @__PURE__ */ c("div", {
|
|
149
|
+
ref: m,
|
|
150
|
+
...p,
|
|
151
|
+
...f,
|
|
152
|
+
style: {
|
|
153
|
+
transform: S,
|
|
154
|
+
transition: _,
|
|
155
|
+
cursor: s ? "not-allowed" : "grab",
|
|
156
|
+
opacity: v ? .5 : 1,
|
|
157
|
+
touchAction: i && !s ? "none" : "auto"
|
|
158
|
+
},
|
|
159
|
+
children: /* @__PURE__ */ c(g, {
|
|
160
|
+
...e,
|
|
161
|
+
isDragging: v,
|
|
162
|
+
isOver: !1
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
_.propTypes = {
|
|
167
|
+
id: r.any,
|
|
168
|
+
instanceId: r.string,
|
|
169
|
+
promptId: r.any,
|
|
170
|
+
title: r.string,
|
|
171
|
+
draggable: r.bool,
|
|
172
|
+
disabled: r.bool,
|
|
173
|
+
type: r.string
|
|
174
|
+
};
|
|
175
|
+
//#endregion
|
|
176
|
+
export { g as Answer, _ as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/match-list/src/arrow.jsx
|
|
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
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class Arrow extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
direction: PropTypes.Requireable<string>;
|
|
14
|
+
};
|
|
15
|
+
render(): React.JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
export default Arrow;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { styled as i } from "@mui/material/styles";
|
|
5
|
+
import a from "@mui/icons-material/ArrowDropDown";
|
|
6
|
+
//#region src/delivery/arrow.tsx
|
|
7
|
+
var o = i("div")({
|
|
8
|
+
display: "inline-block",
|
|
9
|
+
position: "relative",
|
|
10
|
+
width: "100%"
|
|
11
|
+
}), s = i("span")(({ theme: e, isRight: t }) => ({
|
|
12
|
+
backgroundColor: e.palette.grey[500],
|
|
13
|
+
bottom: t ? 20 : 19,
|
|
14
|
+
content: "\"\"",
|
|
15
|
+
display: "block",
|
|
16
|
+
height: 1,
|
|
17
|
+
left: 20,
|
|
18
|
+
position: "absolute",
|
|
19
|
+
width: "100%"
|
|
20
|
+
})), c = class extends e.Component {
|
|
21
|
+
static propTypes = { direction: t.string };
|
|
22
|
+
render() {
|
|
23
|
+
let { direction: e } = this.props;
|
|
24
|
+
return /* @__PURE__ */ r(o, {
|
|
25
|
+
style: e === "left" ? {} : { transform: "rotate(180deg)" },
|
|
26
|
+
children: [/* @__PURE__ */ n(a, { style: {
|
|
27
|
+
transform: "rotate(90deg)",
|
|
28
|
+
color: "#979797",
|
|
29
|
+
fontSize: 40
|
|
30
|
+
} }), /* @__PURE__ */ n(s, { isRight: e !== "left" })]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { c as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/match-list/src/choices-list.jsx
|
|
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
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class ChoicesList extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
session: PropTypes.Validator<object>;
|
|
14
|
+
instanceId: PropTypes.Validator<string>;
|
|
15
|
+
model: PropTypes.Validator<object>;
|
|
16
|
+
disabled: PropTypes.Validator<boolean>;
|
|
17
|
+
onRemoveAnswer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
};
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default ChoicesList;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/find.js";
|
|
2
|
+
import t from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
|
|
3
|
+
import n from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js";
|
|
4
|
+
import r from "./answer.js";
|
|
5
|
+
import i from "./droppable-placeholder.js";
|
|
6
|
+
import a from "react";
|
|
7
|
+
import o from "prop-types";
|
|
8
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
9
|
+
import { styled as c } from "@mui/material/styles";
|
|
10
|
+
//#region src/delivery/choices-list.tsx
|
|
11
|
+
var l = c("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), u = class extends a.Component {
|
|
12
|
+
static propTypes = {
|
|
13
|
+
session: o.object.isRequired,
|
|
14
|
+
instanceId: o.string.isRequired,
|
|
15
|
+
model: o.object.isRequired,
|
|
16
|
+
disabled: o.bool.isRequired,
|
|
17
|
+
onRemoveAnswer: o.func
|
|
18
|
+
};
|
|
19
|
+
render() {
|
|
20
|
+
let { model: a, disabled: o, session: c, instanceId: u, onRemoveAnswer: d } = this.props, { config: f } = a, { duplicates: p } = f;
|
|
21
|
+
return /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(i, {
|
|
22
|
+
id: "choices-pool",
|
|
23
|
+
disabled: o,
|
|
24
|
+
onRemoveAnswer: d,
|
|
25
|
+
children: f.answers.filter((r) => p || t(c) || !c.value || n(e(c.value, (e) => e === r.id))).map((e) => /* @__PURE__ */ s(r, {
|
|
26
|
+
instanceId: u,
|
|
27
|
+
draggable: !0,
|
|
28
|
+
disabled: o,
|
|
29
|
+
session: c,
|
|
30
|
+
type: "choice",
|
|
31
|
+
...e
|
|
32
|
+
}, e.id))
|
|
33
|
+
}) });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { u as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/match-list/src/droppable-placeholder.jsx
|
|
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
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare function DroppablePlaceholder({ id, disabled, children, ...rest }: {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
id: any;
|
|
14
|
+
disabled: any;
|
|
15
|
+
children: any;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
export declare namespace DroppablePlaceholder {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
20
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
21
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default DroppablePlaceholder;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { MatchDroppablePlaceholder as t } from "@pie-lib/drag";
|
|
4
|
+
import { useDroppable as n } from "@dnd-kit/core";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import { styled as i } from "@mui/material/styles";
|
|
7
|
+
//#region src/delivery/droppable-placeholder.tsx
|
|
8
|
+
var a = i("div")(({ theme: e }) => ({
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "row",
|
|
12
|
+
flexWrap: "wrap",
|
|
13
|
+
justifyContent: "space-between",
|
|
14
|
+
marginTop: e.spacing(1),
|
|
15
|
+
marginBottom: e.spacing(1),
|
|
16
|
+
minHeight: 50,
|
|
17
|
+
transition: "background-color 200ms ease"
|
|
18
|
+
}));
|
|
19
|
+
function o({ id: e, disabled: i, children: o, ...s }) {
|
|
20
|
+
let { setNodeRef: c, isOver: l } = n({
|
|
21
|
+
id: e || "choices-pool",
|
|
22
|
+
data: { type: "choices-pool" },
|
|
23
|
+
disabled: i
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ r(a, {
|
|
26
|
+
ref: c,
|
|
27
|
+
style: { backgroundColor: l ? "rgba(0,0,0,0.05)" : "transparent" },
|
|
28
|
+
...s,
|
|
29
|
+
children: /* @__PURE__ */ r(t, {
|
|
30
|
+
id: e,
|
|
31
|
+
disabled: i,
|
|
32
|
+
children: o
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
o.propTypes = {
|
|
37
|
+
id: e.oneOfType([e.string, e.number]),
|
|
38
|
+
disabled: e.bool,
|
|
39
|
+
children: e.node
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { o as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/match-list/src/index.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
|
+
import Main from './main.js';
|
|
10
|
+
export { Main as Component };
|
|
11
|
+
export declare const isComplete: (session: any, model: any) => boolean;
|
|
12
|
+
export default class MatchList extends HTMLElement {
|
|
13
|
+
constructor();
|
|
14
|
+
set model(m: any);
|
|
15
|
+
set session(s: any);
|
|
16
|
+
get session(): any;
|
|
17
|
+
sessionChanged(s: any): void;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
_render(): void;
|
|
20
|
+
disconnectedCallback(): void;
|
|
21
|
+
}
|