@citolab/qti-components 7.0.6-beta.2 → 7.0.6-beta.4
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/cdn/chunks/{chunk-MJMONWKB.js → chunk-4ILXLVT5.js} +8 -2
- package/cdn/chunks/chunk-4PEUIMDK.js +8 -0
- package/cdn/chunks/chunk-H2V2RXUW.js +11 -0
- package/cdn/chunks/chunk-IQZ7AOCQ.js +8 -0
- package/cdn/chunks/chunk-J3JSSCM6.js +5 -0
- package/cdn/chunks/chunk-LARBLB7K.js +8 -0
- package/cdn/chunks/chunk-PPWEIKLT.js +1 -0
- package/cdn/chunks/{chunk-4WXQYE2P.js → chunk-PT523RSK.js} +2 -2
- package/cdn/chunks/chunk-QTK4CPHP.js +8 -0
- package/cdn/chunks/{chunk-7XYBFL7U.js → chunk-SXM25YH3.js} +89 -89
- package/cdn/chunks/chunk-UJP4TGD3.js +1 -0
- package/cdn/chunks/{chunk-6S4CDN3T.js → chunk-YHWMZAZD.js} +2 -2
- package/cdn/chunks/{chunk-TQBDBMWL.js → chunk-YWH4TGMA.js} +1 -1
- package/cdn/exports/interaction.js +1 -1
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-item/core/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-component.abstract.js +1 -1
- package/cdn/qti-test/components/test-end-attempt.js +1 -0
- package/cdn/qti-test/components/test-item-link.js +1 -1
- package/cdn/qti-test/components/test-next.js +1 -1
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
- package/cdn/qti-test/components/test-prev.js +1 -1
- package/cdn/qti-test/components/test-show-correct-response.js +1 -0
- package/cdn/qti-test/components/test-view.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/{chunk-GSWZT6N2.js → chunk-4MQV5IRV.js} +12 -3
- package/dist/chunks/chunk-4MQV5IRV.js.map +1 -0
- package/dist/chunks/{chunk-6JXR63MH.js → chunk-5RTLOB3Q.js} +12 -3
- package/dist/chunks/chunk-5RTLOB3Q.js.map +1 -0
- package/dist/chunks/{chunk-UFYWCLXF.js → chunk-AUWATZ65.js} +1 -1
- package/dist/chunks/{chunk-UFYWCLXF.js.map → chunk-AUWATZ65.js.map} +1 -1
- package/dist/chunks/{chunk-7QMCKYDR.js → chunk-CEXAR7BF.js} +13 -4
- package/dist/chunks/chunk-CEXAR7BF.js.map +1 -0
- package/dist/chunks/chunk-DNHDFXTV.js +59 -0
- package/dist/chunks/chunk-DNHDFXTV.js.map +1 -0
- package/dist/chunks/chunk-GQ5P3NWC.js +46 -0
- package/dist/chunks/chunk-GQ5P3NWC.js.map +1 -0
- package/dist/chunks/chunk-HOTNM5DT.js +1 -0
- package/dist/chunks/{chunk-K6ATVWMP.js → chunk-MEQM6M67.js} +96 -124
- package/dist/chunks/chunk-MEQM6M67.js.map +1 -0
- package/dist/chunks/{chunk-3EU75IUF.js → chunk-MLT7V47R.js} +3 -21
- package/dist/chunks/chunk-MLT7V47R.js.map +1 -0
- package/dist/chunks/chunk-NHA53UTY.js +52 -0
- package/dist/chunks/chunk-NHA53UTY.js.map +1 -0
- package/dist/chunks/{chunk-J2SHENRN.js → chunk-NZQKGIJP.js} +9 -3
- package/dist/chunks/{chunk-J2SHENRN.js.map → chunk-NZQKGIJP.js.map} +1 -1
- package/dist/chunks/{chunk-ZPNJ2HP5.js → chunk-OIRWOI3E.js} +2 -1
- package/dist/chunks/chunk-OIRWOI3E.js.map +1 -0
- package/dist/chunks/chunk-RX3BRYYI.js +59 -0
- package/dist/chunks/chunk-RX3BRYYI.js.map +1 -0
- package/dist/chunks/chunk-VAPB5TN4.js +46 -0
- package/dist/chunks/chunk-VAPB5TN4.js.map +1 -0
- package/dist/chunks/chunk-W4272Q5U.js +46 -0
- package/dist/chunks/chunk-W4272Q5U.js.map +1 -0
- package/dist/chunks/{chunk-A24F75DB.js → chunk-WWN5AD6V.js} +11 -2
- package/dist/chunks/chunk-WWN5AD6V.js.map +1 -0
- package/dist/chunks/{chunk-HHVRU3AJ.js → chunk-XCHS3RTZ.js} +2 -2
- package/dist/chunks/{chunk-KYAIMBP5.js → chunk-YQB6YLNW.js} +3 -3
- package/dist/chunks/chunk-YQB6YLNW.js.map +1 -0
- package/dist/chunks/chunk-Z5THRO6Z.js +46 -0
- package/dist/chunks/chunk-Z5THRO6Z.js.map +1 -0
- package/dist/chunks/{chunk-4GNVYCBN.js → chunk-ZQXZ6PK7.js} +92 -70
- package/dist/chunks/chunk-ZQXZ6PK7.js.map +1 -0
- package/dist/exports/interaction.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +21 -13
- package/dist/item.css +8 -2
- package/dist/qti-components/index.d.ts +2 -2
- package/dist/qti-components/index.js +2 -2
- package/dist/qti-components-jsx.d.ts +62 -46
- package/dist/qti-item/core/index.js +2 -2
- package/dist/qti-loader/index.d.ts +1 -1
- package/dist/{qti-response-declaration-DAeBp8HH.d.ts → qti-response-declaration-Di9CsqiJ.d.ts} +4 -0
- package/dist/qti-test/components/index.d.ts +4 -2
- package/dist/qti-test/components/index.js +16 -8
- package/dist/qti-test/components/test-component.abstract.d.ts +2 -4
- package/dist/qti-test/components/test-component.abstract.js +2 -2
- package/dist/qti-test/components/test-end-attempt.d.ts +26 -0
- package/dist/qti-test/components/test-end-attempt.js +13 -0
- package/dist/qti-test/components/test-end-attempt.js.map +1 -0
- package/dist/qti-test/components/test-item-link.d.ts +3 -2
- package/dist/qti-test/components/test-item-link.js +3 -3
- package/dist/qti-test/components/test-next.d.ts +3 -2
- package/dist/qti-test/components/test-next.js +3 -3
- package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +2 -2
- package/dist/qti-test/components/test-paging-buttons-stamp.js +3 -3
- package/dist/qti-test/components/test-prev.d.ts +3 -2
- package/dist/qti-test/components/test-prev.js +3 -3
- package/dist/qti-test/components/test-show-correct-response.d.ts +26 -0
- package/dist/qti-test/components/test-show-correct-response.js +13 -0
- package/dist/qti-test/components/test-show-correct-response.js.map +1 -0
- package/dist/qti-test/components/test-view.d.ts +3 -2
- package/dist/qti-test/components/test-view.js +3 -3
- package/dist/qti-test/core/index.d.ts +6 -6
- package/dist/qti-test/core/index.js +3 -3
- package/dist/{test.context-CaENAJNk.d.ts → test.context-CmsDQ8k2.d.ts} +3 -5
- package/dist/vscode.html-custom-data.json +36 -17
- package/package.json +1 -1
- package/cdn/chunks/chunk-3V6LA7B3.js +0 -8
- package/cdn/chunks/chunk-5P7CTN7Q.js +0 -11
- package/cdn/chunks/chunk-DZCKF45D.js +0 -5
- package/cdn/chunks/chunk-IMJOPCFR.js +0 -1
- package/cdn/chunks/chunk-N5OHGRGG.js +0 -8
- package/cdn/chunks/chunk-NDHSIO2G.js +0 -8
- package/cdn/chunks/chunk-PKT2SJQD.js +0 -8
- package/cdn/chunks/chunk-QV6I5NVQ.js +0 -8
- package/cdn/chunks/chunk-R33OODNX.js +0 -1
- package/dist/chunks/chunk-3EU75IUF.js.map +0 -1
- package/dist/chunks/chunk-4GNVYCBN.js.map +0 -1
- package/dist/chunks/chunk-6JXR63MH.js.map +0 -1
- package/dist/chunks/chunk-7QMCKYDR.js.map +0 -1
- package/dist/chunks/chunk-A24F75DB.js.map +0 -1
- package/dist/chunks/chunk-GSWZT6N2.js.map +0 -1
- package/dist/chunks/chunk-K6ATVWMP.js.map +0 -1
- package/dist/chunks/chunk-KYAIMBP5.js.map +0 -1
- package/dist/chunks/chunk-UN2IFSGC.js +0 -1
- package/dist/chunks/chunk-ZPNJ2HP5.js.map +0 -1
- /package/cdn/chunks/{chunk-3GO57DNP.js → chunk-6PW2L463.js} +0 -0
- /package/dist/chunks/{chunk-UN2IFSGC.js.map → chunk-HOTNM5DT.js.map} +0 -0
- /package/dist/chunks/{chunk-HHVRU3AJ.js.map → chunk-XCHS3RTZ.js.map} +0 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-ELDMXTUQ.js";
|
|
10
10
|
import {
|
|
11
11
|
Interaction
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OIRWOI3E.js";
|
|
13
13
|
import {
|
|
14
14
|
itemContextVariables
|
|
15
15
|
} from "./chunk-DLUJN2FW.js";
|
|
@@ -61,13 +61,13 @@ var QtiAssessmentItem = class extends LitElement {
|
|
|
61
61
|
feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
this.addEventListener(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this._interactionElements.push(
|
|
64
|
+
this.addEventListener(
|
|
65
|
+
"qti-register-interaction",
|
|
66
|
+
(e) => {
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
this._interactionElements.push(e.detail.interactionElement);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
);
|
|
71
71
|
this.addEventListener("end-attempt", (e) => {
|
|
72
72
|
const { responseIdentifier, countAttempt } = e.detail;
|
|
73
73
|
this.validate();
|
|
@@ -145,22 +145,23 @@ var QtiAssessmentItem = class extends LitElement {
|
|
|
145
145
|
render() {
|
|
146
146
|
return html`<slot></slot>`;
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Toggles the display of correct responses for interactions.
|
|
150
|
+
* @param show - A boolean indicating whether to show or hide correct responses.
|
|
151
|
+
*/
|
|
148
152
|
showCorrectResponse(show) {
|
|
149
|
-
const
|
|
150
|
-
(
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
for (const response of responses) {
|
|
153
|
+
const responses = this._context.variables.filter(
|
|
154
|
+
(variable) => "correctResponse" in variable && variable.correctResponse
|
|
155
|
+
).map((variable) => ({
|
|
156
|
+
responseIdentifier: variable.identifier,
|
|
157
|
+
response: variable.correctResponse || ""
|
|
158
|
+
}));
|
|
159
|
+
for (const { responseIdentifier, response } of responses) {
|
|
159
160
|
const interaction = this._interactionElements.find(
|
|
160
|
-
(
|
|
161
|
+
(element) => element.getAttribute("response-identifier") === responseIdentifier
|
|
161
162
|
);
|
|
162
163
|
if (interaction) {
|
|
163
|
-
interaction.correctResponse = show ? response
|
|
164
|
+
interaction.correctResponse = show ? response : "";
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
}
|
|
@@ -744,7 +745,7 @@ var FlippablesMixin = (superClass, _droppablesSel, _draggablesSel) => {
|
|
|
744
745
|
|
|
745
746
|
// src/lib/qti-components/qti-interaction/internal/drag-drop/drag-drop-interaction-mixin.ts
|
|
746
747
|
import { property as property4 } from "lit/decorators.js";
|
|
747
|
-
var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector
|
|
748
|
+
var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector) => {
|
|
748
749
|
class DragDropInteractionElement extends FlippablesMixin(
|
|
749
750
|
superClass,
|
|
750
751
|
droppablesSelector,
|
|
@@ -771,14 +772,10 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
771
772
|
// Offset for positioning the drag clone
|
|
772
773
|
this.isDragging = false;
|
|
773
774
|
// Whether a drag operation is ongoing
|
|
774
|
-
this.rootNode = null;
|
|
775
|
-
// Root node for boundary calculations
|
|
776
775
|
this.allDropzones = [];
|
|
777
776
|
// All dropzones for keyboard navigation
|
|
778
777
|
this.lastTarget = null;
|
|
779
778
|
// Last touch target
|
|
780
|
-
this.dropzoneOriginalParent = null;
|
|
781
|
-
// Original parent of the drag clone
|
|
782
779
|
this.currentDropTarget = null;
|
|
783
780
|
// Current droppable element
|
|
784
781
|
this.MIN_DRAG_DISTANCE = 5;
|
|
@@ -1051,10 +1048,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1051
1048
|
}
|
|
1052
1049
|
handleTouchEnd(e) {
|
|
1053
1050
|
if (this.isDragging) {
|
|
1054
|
-
if (this.currentDropTarget) {
|
|
1055
|
-
const draggable = this.dragClone;
|
|
1056
|
-
this.moveDraggableToDroppable(draggable, this.currentDropTarget);
|
|
1057
|
-
}
|
|
1058
1051
|
this.resetDragState();
|
|
1059
1052
|
}
|
|
1060
1053
|
this._internals.states.delete("--dragzone-active");
|
|
@@ -1063,7 +1056,9 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1063
1056
|
this._internals.states.delete("--dragzone-active");
|
|
1064
1057
|
this.deactivateDragLocation();
|
|
1065
1058
|
this.deactivateDroppables();
|
|
1066
|
-
this.
|
|
1059
|
+
this.draggables.forEach((d) => {
|
|
1060
|
+
d.removeAttribute("dragging");
|
|
1061
|
+
});
|
|
1067
1062
|
e.preventDefault();
|
|
1068
1063
|
}
|
|
1069
1064
|
handleTouchCancel(_e) {
|
|
@@ -1109,21 +1104,20 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1109
1104
|
if (this.dragClone) {
|
|
1110
1105
|
const isDropped = this.currentDropTarget !== null;
|
|
1111
1106
|
const droppedInDragContainer = !isDropped || this.dragContainers.includes(this.currentDropTarget);
|
|
1112
|
-
if (!droppedInDragContainer) {
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
this.dragClone.style.display = "block";
|
|
1120
|
-
this.dragClone.style.pointerEvents = "auto";
|
|
1121
|
-
} else {
|
|
1107
|
+
if (isDropped && this.currentDropTarget && !droppedInDragContainer) {
|
|
1108
|
+
const cleanClone = this.dragSource.cloneNode(true);
|
|
1109
|
+
cleanClone.removeAttribute("style");
|
|
1110
|
+
this.currentDropTarget.appendChild(cleanClone);
|
|
1111
|
+
this.draggablesModified([cleanClone], []);
|
|
1112
|
+
}
|
|
1113
|
+
if (droppedInDragContainer) {
|
|
1122
1114
|
this.dragSource.style.opacity = "1.0";
|
|
1123
1115
|
this.dragSource.style.display = "block";
|
|
1116
|
+
this.dragSource.style.position = "static";
|
|
1124
1117
|
this.dragSource.style.pointerEvents = "auto";
|
|
1125
|
-
this.dragClone.remove();
|
|
1126
1118
|
}
|
|
1119
|
+
this.dragClone.remove();
|
|
1120
|
+
this.draggablesModified([], [this.dragClone]);
|
|
1127
1121
|
}
|
|
1128
1122
|
this.isDragging = false;
|
|
1129
1123
|
this.isDraggable = false;
|
|
@@ -1132,6 +1126,7 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1132
1126
|
this.touchStartPoint = null;
|
|
1133
1127
|
this.currentDropTarget = null;
|
|
1134
1128
|
this.lastTarget = null;
|
|
1129
|
+
this.deactivateDroppables();
|
|
1135
1130
|
}
|
|
1136
1131
|
checkAllMaxAssociations() {
|
|
1137
1132
|
this.droppables.forEach((d) => {
|
|
@@ -1199,7 +1194,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1199
1194
|
return this.droppables.filter((d) => d.childElementCount > 0).length;
|
|
1200
1195
|
}
|
|
1201
1196
|
saveResponse() {
|
|
1202
|
-
this.validate();
|
|
1203
1197
|
const response = this.collectResponseData();
|
|
1204
1198
|
this.dispatchEvent(
|
|
1205
1199
|
new CustomEvent("qti-interaction-response", {
|
|
@@ -1228,10 +1222,23 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1228
1222
|
if (!this.isDragging || !this.dragClone) return;
|
|
1229
1223
|
const newLeft = touch.clientX - this.cloneOffset.x;
|
|
1230
1224
|
const newTop = touch.clientY - this.cloneOffset.y;
|
|
1231
|
-
const { newLeft: boundedLeft, newTop: boundedTop } = this.
|
|
1225
|
+
const { newLeft: boundedLeft, newTop: boundedTop } = this.applyInteractionBoundaries(
|
|
1226
|
+
newLeft,
|
|
1227
|
+
newTop,
|
|
1228
|
+
this.dragClone
|
|
1229
|
+
);
|
|
1232
1230
|
this.dragClone.style.left = `${boundedLeft}px`;
|
|
1233
1231
|
this.dragClone.style.top = `${boundedTop}px`;
|
|
1234
1232
|
}
|
|
1233
|
+
applyInteractionBoundaries(newLeft, newTop, element) {
|
|
1234
|
+
const interactionRect = this.getBoundingClientRect();
|
|
1235
|
+
const elementRect = element.getBoundingClientRect();
|
|
1236
|
+
const elementWidth = elementRect.width;
|
|
1237
|
+
const elementHeight = elementRect.height;
|
|
1238
|
+
const boundedLeft = Math.max(interactionRect.left, Math.min(newLeft, interactionRect.right - elementWidth));
|
|
1239
|
+
const boundedTop = Math.max(interactionRect.top, Math.min(newTop, interactionRect.bottom - elementHeight));
|
|
1240
|
+
return { newLeft: boundedLeft, newTop: boundedTop };
|
|
1241
|
+
}
|
|
1235
1242
|
getEventCoordinates(event, page = false) {
|
|
1236
1243
|
const touch = event.touches ? event.touches[0] : event;
|
|
1237
1244
|
return {
|
|
@@ -1244,20 +1251,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1244
1251
|
const yDist = Math.abs(touch.clientY - this.touchStartPoint.y);
|
|
1245
1252
|
return xDist + yDist;
|
|
1246
1253
|
}
|
|
1247
|
-
applyBoundaries(newLeft, newTop, element) {
|
|
1248
|
-
let boundaryRect = new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
1249
|
-
if (this.rootNode instanceof ShadowRoot) {
|
|
1250
|
-
boundaryRect = this.rootNode.host.getBoundingClientRect();
|
|
1251
|
-
} else if (this.rootNode instanceof Document) {
|
|
1252
|
-
boundaryRect = document.documentElement.getBoundingClientRect();
|
|
1253
|
-
}
|
|
1254
|
-
const elementRect = element.getBoundingClientRect();
|
|
1255
|
-
const elementWidth = elementRect.width;
|
|
1256
|
-
const elementHeight = elementRect.height;
|
|
1257
|
-
const boundedLeft = Math.max(boundaryRect.left, Math.min(newLeft, boundaryRect.right - elementWidth));
|
|
1258
|
-
const boundedTop = Math.max(boundaryRect.top, Math.min(newTop, boundaryRect.bottom - elementHeight));
|
|
1259
|
-
return { newLeft: boundedLeft, newTop: boundedTop };
|
|
1260
|
-
}
|
|
1261
1254
|
findClosestDropzone() {
|
|
1262
1255
|
const allActiveDropzones = this.allDropzones.filter((d) => !d.hasAttribute("disabled"));
|
|
1263
1256
|
if (!this.dragClone || allActiveDropzones.length === 0) return null;
|
|
@@ -1299,82 +1292,61 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1299
1292
|
element.dispatchEvent(event);
|
|
1300
1293
|
}
|
|
1301
1294
|
appendClone() {
|
|
1302
|
-
|
|
1303
|
-
if (appendClone == "default") {
|
|
1304
|
-
if (interaction) {
|
|
1305
|
-
interaction.appendChild(this.dragClone);
|
|
1306
|
-
} else if (this.rootNode instanceof ShadowRoot) {
|
|
1307
|
-
this.rootNode.host.appendChild(this.dragClone);
|
|
1308
|
-
} else if (this.rootNode instanceof Document) {
|
|
1309
|
-
document.body.appendChild(this.dragClone);
|
|
1310
|
-
}
|
|
1311
|
-
} else if (appendClone == "interaction") {
|
|
1312
|
-
if (interaction) {
|
|
1313
|
-
interaction.appendChild(this.dragClone);
|
|
1314
|
-
} else {
|
|
1315
|
-
console.error("No interaction found to append the drag clone");
|
|
1316
|
-
}
|
|
1317
|
-
} else if (appendClone == "host") {
|
|
1318
|
-
if (this.rootNode instanceof ShadowRoot) {
|
|
1319
|
-
this.rootNode.host.appendChild(this.dragClone);
|
|
1320
|
-
} else {
|
|
1321
|
-
console.error("No host found to append the drag clone");
|
|
1322
|
-
}
|
|
1323
|
-
} else if (appendClone == "body") {
|
|
1324
|
-
document.body.appendChild(this.dragClone);
|
|
1325
|
-
}
|
|
1295
|
+
document.body.appendChild(this.dragClone);
|
|
1326
1296
|
}
|
|
1327
1297
|
handleTouchStart(e) {
|
|
1298
|
+
if (this.isDragging) {
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1328
1301
|
const { x, y } = this.getEventCoordinates(e);
|
|
1329
|
-
this.dropzoneOriginalParent = e.currentTarget.parentElement;
|
|
1330
1302
|
this.touchStartPoint = { x, y };
|
|
1331
1303
|
this.dragSource = e.currentTarget;
|
|
1332
1304
|
this.isDraggable = true;
|
|
1333
|
-
this.rootNode = this.dragSource.getRootNode();
|
|
1334
1305
|
this._internals.states.add("--dragzone-enabled");
|
|
1335
1306
|
this._internals.states.add("--dragzone-active");
|
|
1336
|
-
this.dragSource.setAttribute("dragging", "");
|
|
1337
1307
|
this.activateDragLocation();
|
|
1338
1308
|
this.activateDroppables(this.dragSource);
|
|
1339
1309
|
const draggableInDragContainer = this.findDraggableInDraggableContainer(
|
|
1340
1310
|
this.dragSource.getAttribute("identifier")
|
|
1341
1311
|
);
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
this.
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1312
|
+
const draggedFromDropzone = this.droppables.some(
|
|
1313
|
+
(d) => Array.from(d.children).some((child) => child === this.dragSource)
|
|
1314
|
+
);
|
|
1315
|
+
const rect = this.dragSource.getBoundingClientRect();
|
|
1316
|
+
if (draggedFromDropzone) {
|
|
1317
|
+
this.dragSource.remove();
|
|
1318
|
+
this.draggablesModified([], [this.dragSource]);
|
|
1319
|
+
this.dragSource = draggableInDragContainer;
|
|
1320
|
+
}
|
|
1321
|
+
this.cloneOffset.x = x - rect.left;
|
|
1322
|
+
this.cloneOffset.y = y - rect.top;
|
|
1323
|
+
this.dragClone = draggableInDragContainer.cloneNode(true);
|
|
1324
|
+
const computedStyles = window.getComputedStyle(draggableInDragContainer);
|
|
1325
|
+
for (let i = 0; i < computedStyles.length; i++) {
|
|
1326
|
+
const key = computedStyles[i];
|
|
1327
|
+
this.dragClone.style.setProperty(key, computedStyles.getPropertyValue(key));
|
|
1328
|
+
}
|
|
1329
|
+
const rectOrg = draggableInDragContainer.getBoundingClientRect();
|
|
1330
|
+
this.dragClone.style.width = `${rectOrg.width}px`;
|
|
1331
|
+
this.dragClone.style.height = `${rectOrg.height}px`;
|
|
1332
|
+
if (rect) {
|
|
1333
|
+
this.setDragCloneStyles(rect);
|
|
1334
|
+
}
|
|
1335
|
+
this.dragClone.style.display = "block";
|
|
1336
|
+
this.dragClone.style.opacity = "1";
|
|
1337
|
+
this.appendClone();
|
|
1338
|
+
const matchMax = this.getMatchMaxValue(this.dragSource);
|
|
1339
|
+
const currentDraggables = this.draggables.filter(
|
|
1340
|
+
(d) => d.getAttribute("identifier") === this.dragSource.getAttribute("identifier")
|
|
1341
|
+
);
|
|
1342
|
+
if (matchMax !== 0 && currentDraggables.length >= matchMax) {
|
|
1343
|
+
draggableInDragContainer.style.opacity = "0.0";
|
|
1344
|
+
draggableInDragContainer.style.pointerEvents = "none";
|
|
1368
1345
|
} else {
|
|
1369
|
-
|
|
1370
|
-
this.dragClone = this.dragSource;
|
|
1371
|
-
this.dragSource = this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier"));
|
|
1372
|
-
const rect = this.dragClone.getBoundingClientRect();
|
|
1373
|
-
this.appendClone();
|
|
1374
|
-
if (rect) {
|
|
1375
|
-
this.setDragCloneStyles(rect);
|
|
1376
|
-
}
|
|
1346
|
+
draggableInDragContainer.style.opacity = "1.0";
|
|
1377
1347
|
}
|
|
1348
|
+
e.preventDefault();
|
|
1349
|
+
this.dragClone.setAttribute("dragging", "");
|
|
1378
1350
|
}
|
|
1379
1351
|
findParentInteractionElement(element) {
|
|
1380
1352
|
let parent = element.parentElement;
|
|
@@ -1406,8 +1378,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
|
|
|
1406
1378
|
this.dragClone.style.position = "fixed";
|
|
1407
1379
|
this.dragClone.style.top = `${rect.top}px`;
|
|
1408
1380
|
this.dragClone.style.left = `${rect.left}px`;
|
|
1409
|
-
this.dragClone.style.width = `${rect.width}px`;
|
|
1410
|
-
this.dragClone.style.height = `${rect.height}px`;
|
|
1411
1381
|
this.dragClone.style.setProperty("box-sizing", "border-box", "important");
|
|
1412
1382
|
this.dragClone.style.zIndex = "9999";
|
|
1413
1383
|
this.dragClone.style.pointerEvents = "none";
|
|
@@ -3346,8 +3316,7 @@ var QtiMatchInteraction = class extends DragDropInteractionMixin(
|
|
|
3346
3316
|
Interaction,
|
|
3347
3317
|
"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice",
|
|
3348
3318
|
"qti-simple-match-set:last-of-type > qti-simple-associable-choice",
|
|
3349
|
-
"qti-simple-match-set:first-of-type"
|
|
3350
|
-
"body"
|
|
3319
|
+
"qti-simple-match-set:first-of-type"
|
|
3351
3320
|
) {
|
|
3352
3321
|
constructor() {
|
|
3353
3322
|
super(...arguments);
|
|
@@ -3423,6 +3392,9 @@ var QtiMatchInteraction = class extends DragDropInteractionMixin(
|
|
|
3423
3392
|
return;
|
|
3424
3393
|
} else if (Array.isArray(responseValue)) {
|
|
3425
3394
|
this.correctOptions = responseValue;
|
|
3395
|
+
if (!this.class.split(" ").includes("qti-match-tabular")) {
|
|
3396
|
+
this.value = responseValue;
|
|
3397
|
+
}
|
|
3426
3398
|
}
|
|
3427
3399
|
}
|
|
3428
3400
|
render() {
|
|
@@ -5962,12 +5934,12 @@ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
|
|
|
5962
5934
|
if (correctResponse) {
|
|
5963
5935
|
const values = correctResponse.querySelectorAll("qti-value");
|
|
5964
5936
|
if (this.cardinality === "single" && values.length > 0) {
|
|
5965
|
-
result = values[0].textContent;
|
|
5937
|
+
result = values[0].textContent.trim();
|
|
5966
5938
|
values[0].remove();
|
|
5967
5939
|
} else if (this.cardinality !== "single") {
|
|
5968
5940
|
result = [];
|
|
5969
5941
|
for (let i = 0; i < values.length; i++) {
|
|
5970
|
-
result.push(values[i].textContent);
|
|
5942
|
+
result.push(values[i].textContent.trim());
|
|
5971
5943
|
values[i].remove();
|
|
5972
5944
|
}
|
|
5973
5945
|
}
|
|
@@ -6088,4 +6060,4 @@ export {
|
|
|
6088
6060
|
QtiOutcomeDeclaration,
|
|
6089
6061
|
QtiResponseDeclaration
|
|
6090
6062
|
};
|
|
6091
|
-
//# sourceMappingURL=chunk-
|
|
6063
|
+
//# sourceMappingURL=chunk-MEQM6M67.js.map
|