@doenet/assignment-viewer 0.1.0-alpha2 → 0.1.0-alpha4
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/index.js +45 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3130,7 +3130,7 @@ function isExportedActivityState(obj) {
|
|
|
3130
3130
|
const typedObj = obj;
|
|
3131
3131
|
return (
|
|
3132
3132
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
3133
|
-
typedObj !== null && typeof typedObj === "object" && isActivityStateNoSource(typedObj.state) && typeof typedObj.sourceHash === "string"
|
|
3133
|
+
typedObj !== null && typeof typedObj === "object" && isActivityStateNoSource(typedObj.state) && typeof typedObj.sourceHash === "string" && (typedObj.onSubmission === void 0 || typeof typedObj.onSubmission === "boolean")
|
|
3134
3134
|
);
|
|
3135
3135
|
}
|
|
3136
3136
|
function initializeActivityState({
|
|
@@ -3400,7 +3400,7 @@ function gatherDocumentStructure(source) {
|
|
|
3400
3400
|
return {
|
|
3401
3401
|
numActivityVariants: { [source.id]: source.numVariants ?? 1 },
|
|
3402
3402
|
questionCounts: {
|
|
3403
|
-
[source.id]: source.
|
|
3403
|
+
[source.id]: source.baseComponentCounts ? (source.baseComponentCounts.question ?? 0) + (source.baseComponentCounts.problem ?? 0) + (source.baseComponentCounts.exercise ?? 0) : 1
|
|
3404
3404
|
}
|
|
3405
3405
|
};
|
|
3406
3406
|
} else {
|
|
@@ -53670,13 +53670,19 @@ function activityStateReducer(state, action) {
|
|
|
53670
53670
|
if (action.allowSaveState) {
|
|
53671
53671
|
const scoreByItem = extractActivityItemCredit(newActivityState);
|
|
53672
53672
|
const sourceHash = hash(newActivityState.source);
|
|
53673
|
+
let onSubmission = false;
|
|
53674
|
+
const doenetState = action.doenetState;
|
|
53675
|
+
if (typeof doenetState === "object" && doenetState !== null && "onSubmission" in doenetState && typeof doenetState.onSubmission === "boolean") {
|
|
53676
|
+
onSubmission = doenetState.onSubmission;
|
|
53677
|
+
}
|
|
53673
53678
|
window.postMessage({
|
|
53674
53679
|
state: {
|
|
53675
53680
|
state: pruneActivityStateForSave(
|
|
53676
53681
|
newActivityState,
|
|
53677
53682
|
false
|
|
53678
53683
|
),
|
|
53679
|
-
sourceHash
|
|
53684
|
+
sourceHash,
|
|
53685
|
+
onSubmission
|
|
53680
53686
|
},
|
|
53681
53687
|
score: newActivityState.creditAchieved,
|
|
53682
53688
|
scoreByItem,
|
|
@@ -54074,40 +54080,42 @@ function Viewer({
|
|
|
54074
54080
|
}
|
|
54075
54081
|
return /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { children: [
|
|
54076
54082
|
showTitle ? /* @__PURE__ */ jsxRuntimeExports$1.jsx("h2", { style: { marginLeft: "20px" }, children: source.title }) : null,
|
|
54077
|
-
/* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { style: { marginTop: "5px" }, children: /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", {
|
|
54078
|
-
/* @__PURE__ */ jsxRuntimeExports$1.
|
|
54079
|
-
|
|
54080
|
-
|
|
54081
|
-
|
|
54082
|
-
|
|
54083
|
-
|
|
54084
|
-
|
|
54085
|
-
|
|
54086
|
-
|
|
54087
|
-
|
|
54088
|
-
|
|
54089
|
-
|
|
54090
|
-
|
|
54091
|
-
|
|
54092
|
-
|
|
54093
|
-
|
|
54094
|
-
|
|
54095
|
-
|
|
54096
|
-
|
|
54097
|
-
|
|
54098
|
-
|
|
54099
|
-
|
|
54100
|
-
|
|
54101
|
-
|
|
54102
|
-
|
|
54103
|
-
|
|
54104
|
-
|
|
54105
|
-
|
|
54106
|
-
|
|
54107
|
-
|
|
54108
|
-
|
|
54109
|
-
|
|
54110
|
-
|
|
54083
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { style: { marginTop: "5px" }, children: /* @__PURE__ */ jsxRuntimeExports$1.jsxs("div", { children: [
|
|
54084
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsxs("span", { hidden: !paginate, children: [
|
|
54085
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(
|
|
54086
|
+
"button",
|
|
54087
|
+
{
|
|
54088
|
+
onClick: clickPrevious,
|
|
54089
|
+
style: {
|
|
54090
|
+
marginLeft: "20px",
|
|
54091
|
+
marginRight: "10px",
|
|
54092
|
+
backgroundColor: "lightgray",
|
|
54093
|
+
borderRadius: "10px",
|
|
54094
|
+
padding: "5px 20px"
|
|
54095
|
+
},
|
|
54096
|
+
disabled: currentItemIdx <= 0,
|
|
54097
|
+
children: "Previous"
|
|
54098
|
+
}
|
|
54099
|
+
),
|
|
54100
|
+
"Page ",
|
|
54101
|
+
currentItemIdx + 1,
|
|
54102
|
+
" of ",
|
|
54103
|
+
numItems,
|
|
54104
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(
|
|
54105
|
+
"button",
|
|
54106
|
+
{
|
|
54107
|
+
onClick: clickNext,
|
|
54108
|
+
style: {
|
|
54109
|
+
marginLeft: "10px",
|
|
54110
|
+
backgroundColor: "lightgray",
|
|
54111
|
+
borderRadius: "10px",
|
|
54112
|
+
padding: "5px 20px"
|
|
54113
|
+
},
|
|
54114
|
+
disabled: currentItemIdx >= numItems - 1,
|
|
54115
|
+
children: "Next"
|
|
54116
|
+
}
|
|
54117
|
+
)
|
|
54118
|
+
] }),
|
|
54111
54119
|
activityLevelAttempts ? /* @__PURE__ */ jsxRuntimeExports$1.jsx(
|
|
54112
54120
|
"button",
|
|
54113
54121
|
{
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@doenet/assignment-viewer",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "View assignments from questions written in DoenetML",
|
|
5
|
-
"version": "0.1.0-
|
|
5
|
+
"version": "0.1.0-alpha4",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
7
7
|
"homepage": "https://github.com/Doenet/assignment-viewer#readme",
|
|
8
8
|
"type": "module",
|