@digabi/exam-engine-core 23.2.0 → 23.2.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  2. package/dist/components/exam/AllDNDOptions.d.ts.map +1 -1
  3. package/dist/components/exam/AllDNDOptions.js +2 -2
  4. package/dist/components/exam/AllDNDOptions.js.map +1 -1
  5. package/dist/components/exam/DNDAnswer.d.ts.map +1 -1
  6. package/dist/components/exam/DNDAnswer.js +1 -1
  7. package/dist/components/exam/DNDAnswer.js.map +1 -1
  8. package/dist/components/exam/DNDAnswerContainer.d.ts.map +1 -1
  9. package/dist/components/exam/DNDAnswerContainer.js +17 -19
  10. package/dist/components/exam/DNDAnswerContainer.js.map +1 -1
  11. package/dist/components/exam/DNDAnswerOption.d.ts +1 -1
  12. package/dist/components/exam/DNDAnswerOption.d.ts.map +1 -1
  13. package/dist/components/exam/DNDAnswerOption.js +1 -1
  14. package/dist/components/exam/DNDAnswerOption.js.map +1 -1
  15. package/dist/components/exam/DNDAnswerTitleCommon.d.ts +4 -0
  16. package/dist/components/exam/DNDAnswerTitleCommon.d.ts.map +1 -0
  17. package/dist/components/exam/DNDAnswerTitleCommon.js +14 -0
  18. package/dist/components/exam/DNDAnswerTitleCommon.js.map +1 -0
  19. package/dist/components/exam/DragAndDrop.d.ts +3 -0
  20. package/dist/components/exam/DragAndDrop.d.ts.map +1 -0
  21. package/dist/components/exam/DragAndDrop.js +7 -0
  22. package/dist/components/exam/DragAndDrop.js.map +1 -0
  23. package/dist/components/exam/NativeDND.d.ts +3 -0
  24. package/dist/components/exam/NativeDND.d.ts.map +1 -0
  25. package/dist/components/exam/NativeDND.js +75 -0
  26. package/dist/components/exam/NativeDND.js.map +1 -0
  27. package/dist/components/exam/getter.d.ts +3 -0
  28. package/dist/components/exam/getter.d.ts.map +1 -0
  29. package/dist/components/exam/getter.js +86 -0
  30. package/dist/components/exam/getter.js.map +1 -0
  31. package/dist/components/grading/AnnotatableGradingAnswer.d.ts +4 -0
  32. package/dist/components/grading/AnnotatableGradingAnswer.d.ts.map +1 -0
  33. package/dist/components/grading/AnnotatableGradingAnswer.js +24 -0
  34. package/dist/components/grading/AnnotatableGradingAnswer.js.map +1 -0
  35. package/dist/components/results/CorrectDNDAnswer.d.ts +4 -0
  36. package/dist/components/results/CorrectDNDAnswer.d.ts.map +1 -0
  37. package/dist/components/results/CorrectDNDAnswer.js +22 -0
  38. package/dist/components/results/CorrectDNDAnswer.js.map +1 -0
  39. package/dist/components/results/DNDAnswer.d.ts.map +1 -1
  40. package/dist/components/results/DNDAnswer.js +11 -9
  41. package/dist/components/results/DNDAnswer.js.map +1 -1
  42. package/dist/components/results/DNDAnswerOptionResults.d.ts +4 -0
  43. package/dist/components/results/DNDAnswerOptionResults.d.ts.map +1 -0
  44. package/dist/components/results/DNDAnswerOptionResults.js +4 -0
  45. package/dist/components/results/DNDAnswerOptionResults.js.map +1 -0
  46. package/dist/components/shared/AnnotationWrapper.d.ts +5 -0
  47. package/dist/components/shared/AnnotationWrapper.d.ts.map +1 -0
  48. package/dist/components/shared/AnnotationWrapper.js +24 -0
  49. package/dist/components/shared/AnnotationWrapper.js.map +1 -0
  50. package/dist/components/shared/DNDAnswerCommon.d.ts +1 -2
  51. package/dist/components/shared/DNDAnswerCommon.d.ts.map +1 -1
  52. package/dist/components/shared/DNDAnswerCommon.js +5 -2
  53. package/dist/components/shared/DNDAnswerCommon.js.map +1 -1
  54. package/dist/components/shared/DNDAnswerDroppable.d.ts +2 -3
  55. package/dist/components/shared/DNDAnswerDroppable.d.ts.map +1 -1
  56. package/dist/components/shared/DNDAnswerDroppable.js +7 -8
  57. package/dist/components/shared/DNDAnswerDroppable.js.map +1 -1
  58. package/dist/components/shared/DNDAnswerDroppableCommon.d.ts +13 -0
  59. package/dist/components/shared/DNDAnswerDroppableCommon.d.ts.map +1 -0
  60. package/dist/components/shared/DNDAnswerDroppableCommon.js +30 -0
  61. package/dist/components/shared/DNDAnswerDroppableCommon.js.map +1 -0
  62. package/dist/components/shared/DNDAnswerOption.d.ts +7 -0
  63. package/dist/components/shared/DNDAnswerOption.d.ts.map +1 -0
  64. package/dist/components/shared/DNDAnswerOption.js +14 -0
  65. package/dist/components/shared/DNDAnswerOption.js.map +1 -0
  66. package/dist/components/shared/DNDAnswerOptionCommon.d.ts +1 -1
  67. package/dist/components/shared/DNDAnswerOptionCommon.d.ts.map +1 -1
  68. package/dist/components/shared/DNDAnswerOptionCommon.js +1 -1
  69. package/dist/components/shared/DNDAnswerOptionCommon.js.map +1 -1
  70. package/dist/components/shared/DNDAnswerTitleCommon.d.ts +4 -0
  71. package/dist/components/shared/DNDAnswerTitleCommon.d.ts.map +1 -0
  72. package/dist/components/shared/DNDAnswerTitleCommon.js +14 -0
  73. package/dist/components/shared/DNDAnswerTitleCommon.js.map +1 -0
  74. package/dist/components/shared/DNDTitleAndAnswer.d.ts +12 -0
  75. package/dist/components/shared/DNDTitleAndAnswer.d.ts.map +1 -0
  76. package/dist/components/shared/DNDTitleAndAnswer.js +48 -0
  77. package/dist/components/shared/DNDTitleAndAnswer.js.map +1 -0
  78. package/dist/components/shared/DNDTitleAndAnswerCommon.d.ts +3 -4
  79. package/dist/components/shared/DNDTitleAndAnswerCommon.d.ts.map +1 -1
  80. package/dist/components/shared/DNDTitleAndAnswerCommon.js +30 -9
  81. package/dist/components/shared/DNDTitleAndAnswerCommon.js.map +1 -1
  82. package/dist/components/shared/Mark.d.ts +9 -0
  83. package/dist/components/shared/Mark.d.ts.map +1 -0
  84. package/dist/components/shared/Mark.js +14 -0
  85. package/dist/components/shared/Mark.js.map +1 -0
  86. package/dist/components/shared/internal/RestrictedAudioPlayerCommon.d.ts +12 -0
  87. package/dist/components/shared/internal/RestrictedAudioPlayerCommon.d.ts.map +1 -0
  88. package/dist/components/shared/internal/RestrictedAudioPlayerCommon.js +29 -0
  89. package/dist/components/shared/internal/RestrictedAudioPlayerCommon.js.map +1 -0
  90. package/dist/components/shared/internal/RestrictedAudioPlayerExam.d.ts +13 -0
  91. package/dist/components/shared/internal/RestrictedAudioPlayerExam.d.ts.map +1 -0
  92. package/dist/components/shared/internal/RestrictedAudioPlayerExam.js +33 -0
  93. package/dist/components/shared/internal/RestrictedAudioPlayerExam.js.map +1 -0
  94. package/dist/main-bundle.js +5 -5
  95. package/package.json +2 -2
  96. package/dist/__tests__/playwright/DNDAnswerContainer.test.d.ts +0 -2
  97. package/dist/__tests__/playwright/DNDAnswerContainer.test.d.ts.map +0 -1
  98. package/dist/__tests__/playwright/DNDAnswerContainer.test.js +0 -77
  99. package/dist/__tests__/playwright/DNDAnswerContainer.test.js.map +0 -1
  100. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.d.ts +0 -10
  101. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.d.ts.map +0 -1
  102. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.js +0 -21
  103. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.js.map +0 -1
  104. package/dist/__tests__/playwright/utils/ComponentWrapper.d.ts +0 -9
  105. package/dist/__tests__/playwright/utils/ComponentWrapper.d.ts.map +0 -1
  106. package/dist/__tests__/playwright/utils/ComponentWrapper.js +0 -26
  107. package/dist/__tests__/playwright/utils/ComponentWrapper.js.map +0 -1
@@ -0,0 +1,24 @@
1
+ import React, { useContext } from 'react';
2
+ import { AnnotationContext } from '../context/AnnotationProvider';
3
+ import { onMouseDownForAnnotation } from '../grading/examAnnotationUtils';
4
+ import { AnnotationPopup } from './AnnotationPopup';
5
+ export const AnnotationWrapper = ({ children }) => {
6
+ const { setNewAnnotation } = useContext(AnnotationContext);
7
+ const mouseUpCallback = (annotation) => {
8
+ console.log('UP');
9
+ setNewAnnotation(annotation);
10
+ };
11
+ function onMouseDown(e) {
12
+ console.log('DOWN');
13
+ const target = e.target;
14
+ const clickIsInPopup = target.closest('.annotation-popup');
15
+ if (!clickIsInPopup) {
16
+ setNewAnnotation(null);
17
+ }
18
+ onMouseDownForAnnotation(e, mouseUpCallback);
19
+ }
20
+ return (React.createElement("span", { onMouseDown: onMouseDown },
21
+ React.createElement(AnnotationPopup, null),
22
+ children));
23
+ };
24
+ //# sourceMappingURL=AnnotationWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnnotationWrapper.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotationWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAA2D,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxG,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAE1D,MAAM,eAAe,GAAG,CAAC,UAA6B,EAAE,EAAE;QACxD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACjB,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAC9B,CAAC,CAAA;IAED,SAAS,WAAW,CAAC,CAAmB;QACtC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACnB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAiB,CAAA;QAClC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;QAC1D,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,gBAAgB,CAAC,IAAI,CAAC,CAAA;QACxB,CAAC;QAED,wBAAwB,CAAC,CAAC,EAAE,eAAe,CAAC,CAAA;IAC9C,CAAC;IAED,OAAO,CACL,8BAAM,WAAW,EAAE,WAAW;QAC5B,oBAAC,eAAe,OAAG;QAClB,QAAQ,CACJ,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,11 +1,10 @@
1
1
  import { UniqueIdentifier } from '@dnd-kit/core';
2
2
  import React from 'react';
3
3
  import { ExamComponentProps } from '../..';
4
- export declare const DNDAnswerCommon: ({ renderChildNodes, items, answerOptionsByQuestionId, isInExam, correctIds, classes, questionId }: {
4
+ export declare const DNDAnswerDroppableCommon: ({ renderChildNodes, items, answerOptionsByQuestionId, correctIds, classes, questionId }: {
5
5
  items: UniqueIdentifier[];
6
6
  answerOptionsByQuestionId: Record<UniqueIdentifier, Element>;
7
7
  renderChildNodes: ExamComponentProps["renderChildNodes"];
8
- isInExam?: boolean;
9
8
  correctIds?: UniqueIdentifier[];
10
9
  classes?: Record<string, boolean>;
11
10
  questionId: UniqueIdentifier;
@@ -1 +1 @@
1
- {"version":3,"file":"DNDAnswerCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,eAAe,sGAQzB;IACD,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC5D,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,UAAU,EAAE,gBAAgB,CAAA;CAC7B,sBA8CA,CAAA"}
1
+ {"version":3,"file":"DNDAnswerCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAM1C,eAAO,MAAM,wBAAwB,4FAOlC;IACD,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC5D,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,UAAU,EAAE,gBAAgB,CAAA;CAC7B,sBAkDA,CAAA"}
@@ -1,15 +1,18 @@
1
1
  import { useDroppable } from '@dnd-kit/core';
2
2
  import classNames from 'classnames';
3
- import React from 'react';
3
+ import React, { useContext } from 'react';
4
4
  import { query } from '../../dom-utils';
5
5
  import { DNDAnswerOption as DNDAnswerOptionExam } from '../exam/DNDAnswerOption';
6
6
  import { DNDAnswerOptionCommon } from './DNDAnswerOptionCommon';
7
- export const DNDAnswerCommon = ({ renderChildNodes, items, answerOptionsByQuestionId, isInExam, correctIds, classes, questionId }) => {
7
+ import { ResultsContext } from '../context/ResultsContext';
8
+ export const DNDAnswerDroppableCommon = ({ renderChildNodes, items, answerOptionsByQuestionId, correctIds, classes, questionId }) => {
8
9
  const dndAnswerOptions = (items === null || items === void 0 ? void 0 : items.map(id => answerOptionsByQuestionId[id])) || [];
9
10
  const hasImages = dndAnswerOptions.some(option => query(option, 'image'));
10
11
  const hasAudio = dndAnswerOptions.some(option => query(option, 'audio'));
11
12
  const hasFormula = dndAnswerOptions.some(option => query(option, 'formula'));
12
13
  const { active, isOver } = useDroppable({ id: questionId });
14
+ const { gradingStructure } = useContext(ResultsContext);
15
+ const isInExam = !gradingStructure;
13
16
  return (React.createElement("div", { className: classNames('e-dnd-answer-droppable', {
14
17
  'has-images': hasImages,
15
18
  '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ED,CAAC,gBAAgB,CAAC,MAAM;YACvB,CAAC,MAAM,CAAC,CAAC,CAAC,CACR,2BAAG,SAAS,EAAC,qBAAqB,wBAAiB,CACpD,CAAC,CAAC,CAAC,CACF,2BAAG,SAAS,EAAC,qBAAqB,qBAAmB,CACtD,CAAC,CACA,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -1,13 +1,12 @@
1
1
  import { UniqueIdentifier } from '@dnd-kit/core';
2
2
  import React from 'react';
3
3
  import { ExamComponentProps } from '../..';
4
- export declare const DNDAnswerDroppable: ({ renderChildNodes, items, answerOptionsByQuestionId, correctIds, classes, questionId, page }: {
5
- items: UniqueIdentifier[];
6
- answerOptionsByQuestionId: Record<UniqueIdentifier, Element>;
4
+ export declare const DNDDroppable: ({ renderChildNodes, correctIds, classes, questionId, page, answerOptionElements }: {
7
5
  renderChildNodes: ExamComponentProps["renderChildNodes"];
8
6
  correctIds?: UniqueIdentifier[];
9
7
  classes?: Record<string, boolean>;
10
8
  questionId: UniqueIdentifier;
11
9
  page: "exam" | "results";
10
+ answerOptionElements: Element[];
12
11
  }) => React.JSX.Element;
13
12
  //# sourceMappingURL=DNDAnswerDroppable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DNDAnswerDroppable.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerDroppable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,kBAAkB,kGAQ5B;IACD,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC5D,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,sBAgDA,CAAA"}
1
+ {"version":3,"file":"DNDAnswerDroppable.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerDroppable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,YAAY,sFAOtB;IACD,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,oBAAoB,EAAE,OAAO,EAAE,CAAA;CAChC,sBA+CA,CAAA"}
@@ -4,11 +4,10 @@ import React from 'react';
4
4
  import { query } from '../../dom-utils';
5
5
  import { DNDAnswerOptionDraggable } from '../exam/DNDAnswerOptionDraggable';
6
6
  import { DNDAnswerOption } from '../results/DNDAnswerOption';
7
- export const DNDAnswerDroppable = ({ renderChildNodes, items, answerOptionsByQuestionId, correctIds, classes, questionId, page }) => {
8
- const dndAnswerOptions = items === null || items === void 0 ? void 0 : items.map(id => (answerOptionsByQuestionId === null || answerOptionsByQuestionId === void 0 ? void 0 : answerOptionsByQuestionId[id]) || null).filter(Boolean);
9
- const hasImages = dndAnswerOptions.some(option => query(option, 'image'));
10
- const hasAudio = dndAnswerOptions.some(option => query(option, 'audio'));
11
- const hasFormula = dndAnswerOptions.some(option => query(option, 'formula'));
7
+ export const DNDDroppable = ({ renderChildNodes, correctIds, classes, questionId, page, answerOptionElements }) => {
8
+ const hasImages = answerOptionElements.some(option => query(option, 'image'));
9
+ const hasAudio = answerOptionElements.some(option => query(option, 'audio'));
10
+ const hasFormula = answerOptionElements.some(option => query(option, 'formula'));
12
11
  const { active, isOver } = useDroppable({ id: questionId });
13
12
  return (React.createElement("div", { className: classNames('e-dnd-answer-droppable', {
14
13
  'has-images': hasImages,
@@ -16,15 +15,15 @@ export const DNDAnswerDroppable = ({ renderChildNodes, items, answerOptionsByQue
16
15
  'has-formula': hasFormula,
17
16
  hovered: isOver,
18
17
  ...classes
19
- }) }, dndAnswerOptions === null || dndAnswerOptions === void 0 ? void 0 :
20
- dndAnswerOptions.map(element => {
18
+ }) }, answerOptionElements === null || answerOptionElements === void 0 ? void 0 :
19
+ answerOptionElements.map(element => {
21
20
  const optionId = Number(element.getAttribute('option-id'));
22
21
  const hasImage = query(element, 'image');
23
22
  const isCorrect = correctIds === null || correctIds === void 0 ? void 0 : correctIds.includes(optionId);
24
23
  return (React.createElement("div", { className: classNames({ 'has-image': hasImage }), key: element.getAttribute('option-id') }, page === 'exam' ? (React.createElement(DNDAnswerOptionDraggable, { element: element, renderChildNodes: renderChildNodes, key: optionId })) : (React.createElement("div", { className: "e-dnd-answer-option" },
25
24
  React.createElement(DNDAnswerOption, { element: element, renderChildNodes: renderChildNodes, key: optionId, className: !correctIds ? undefined : isCorrect ? 'correct-answer' : 'wrong-answer' })))));
26
25
  }),
27
- !dndAnswerOptions.length &&
26
+ !answerOptionElements.length &&
28
27
  (active ? (React.createElement("i", { className: "droppable-drop-here" }, "Pudota t\u00E4nne")) : (React.createElement("i", { className: "droppable-no-answer" }, "(Ei vastausta)")))));
29
28
  };
30
29
  //# sourceMappingURL=DNDAnswerDroppable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DNDAnswerDroppable.js","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerDroppable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE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MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAE,CAAC,CAAA;YAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACxC,MAAM,SAAS,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;YAChD,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,IAC1F,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACjB,oBAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,GAAI,CAClG,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,qBAAqB;gBAClC,oBAAC,eAAe,IACd,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,GAClF,CACE,CACP,CACG,CACP,CAAA;QACH,CAAC,CAAC;QAED,CAAC,oBAAoB,CAAC,MAAM;YAC3B,CAAC,MAAM,CAAC,CAAC,CAAC,CACR,2BAAG,SAAS,EAAC,qBAAqB,wBAAiB,CACpD,CAAC,CAAC,CAAC,CACF,2BAAG,SAAS,EAAC,qBAAqB,qBAAmB,CACtD,CAAC,CACA,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { UniqueIdentifier } from '@dnd-kit/core';
2
+ import React from 'react';
3
+ import { ExamComponentProps } from '../..';
4
+ export declare const DNDAnswerDroppableCommon: ({ renderChildNodes, items, answerOptionsByQuestionId, correctIds, classes, questionId, page }: {
5
+ items: UniqueIdentifier[];
6
+ answerOptionsByQuestionId: Record<UniqueIdentifier, Element>;
7
+ renderChildNodes: ExamComponentProps["renderChildNodes"];
8
+ correctIds?: UniqueIdentifier[];
9
+ classes?: Record<string, boolean>;
10
+ questionId: UniqueIdentifier;
11
+ page: "exam" | "results";
12
+ }) => React.JSX.Element;
13
+ //# sourceMappingURL=DNDAnswerDroppableCommon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DNDAnswerDroppableCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerDroppableCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAK1C,eAAO,MAAM,wBAAwB,kGAQlC;IACD,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC5D,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,sBAgDA,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { useDroppable } from '@dnd-kit/core';
2
+ import classNames from 'classnames';
3
+ import React from 'react';
4
+ import { query } from '../../dom-utils';
5
+ import { DNDAnswerOptionDraggable } from '../exam/DNDAnswerOptionDraggable';
6
+ import { DNDAnswerOption } from '../results/DNDAnswerOption';
7
+ export const DNDAnswerDroppableCommon = ({ renderChildNodes, items, answerOptionsByQuestionId, correctIds, classes, questionId, page }) => {
8
+ const dndAnswerOptions = items === null || items === void 0 ? void 0 : items.map(id => (answerOptionsByQuestionId === null || answerOptionsByQuestionId === void 0 ? void 0 : answerOptionsByQuestionId[id]) || null).filter(Boolean);
9
+ const hasImages = dndAnswerOptions.some(option => query(option, 'image'));
10
+ const hasAudio = dndAnswerOptions.some(option => query(option, 'audio'));
11
+ const hasFormula = dndAnswerOptions.some(option => query(option, 'formula'));
12
+ const { active, isOver } = useDroppable({ id: questionId });
13
+ return (React.createElement("div", { className: classNames('e-dnd-answer-droppable', {
14
+ 'has-images': hasImages,
15
+ 'has-audio': hasAudio,
16
+ 'has-formula': hasFormula,
17
+ hovered: isOver,
18
+ ...classes
19
+ }) }, dndAnswerOptions === null || dndAnswerOptions === void 0 ? void 0 :
20
+ dndAnswerOptions.map(element => {
21
+ const optionId = Number(element.getAttribute('option-id'));
22
+ const hasImage = query(element, 'image');
23
+ const isCorrect = correctIds === null || correctIds === void 0 ? void 0 : correctIds.includes(optionId);
24
+ return (React.createElement("div", { className: classNames({ 'has-image': hasImage }), key: element.getAttribute('option-id') }, page === 'exam' ? (React.createElement(DNDAnswerOptionDraggable, { element: element, renderChildNodes: renderChildNodes, key: optionId })) : (React.createElement("div", { className: "e-dnd-answer-option" },
25
+ React.createElement(DNDAnswerOption, { element: element, renderChildNodes: renderChildNodes, key: optionId, classes: [isCorrect ? 'correct-answer' : 'wrong-answer'] })))));
26
+ }),
27
+ !dndAnswerOptions.length &&
28
+ (active ? (React.createElement("i", { className: "droppable-drop-here" }, "Pudota t\u00E4nne")) : (React.createElement("i", { className: "droppable-no-answer" }, "(Ei vastausta)")))));
29
+ };
30
+ //# sourceMappingURL=DNDAnswerDroppableCommon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DNDAnswerDroppableCommon.js","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerDroppableCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,UAAU,MAAM,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AAgB,aAAhB,gBAAgB;QAAhB,gBAAgB,CAAE,GAAG,CAAC,OAAO,CAAC,EAAE;YAC/B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAE,CAAC,CAAA;YAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACxC,MAAM,SAAS,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;YAChD,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,IAC1F,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACjB,oBAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,GAAI,CAClG,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,qBAAqB;gBAClC,oBAAC,eAAe,IACd,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,CAAC,GACxD,CACE,CACP,CACG,CACP,CAAA;QACH,CAAC,CAAC;QAED,CAAC,gBAAgB,CAAC,MAAM;YACvB,CAAC,MAAM,CAAC,CAAC,CAAC,CACR,2BAAG,SAAS,EAAC,qBAAqB,wBAAiB,CACpD,CAAC,CAAC,CAAC,CACF,2BAAG,SAAS,EAAC,qBAAqB,qBAAmB,CACtD,CAAC,CACA,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ExamComponentProps } from '../..';
3
+ export declare const DNDAnswerOption: ({ element, renderChildNodes, style, classes }: ExamComponentProps & {
4
+ style?: React.CSSProperties;
5
+ classes?: string[];
6
+ }) => React.JSX.Element;
7
+ //# sourceMappingURL=DNDAnswerOption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DNDAnswerOption.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerOption.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAG1C,eAAO,MAAM,eAAe,kDAKzB,kBAAkB,GAAG;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,sBAmBA,CAAA"}
@@ -0,0 +1,14 @@
1
+ import classNames from 'classnames';
2
+ import React from 'react';
3
+ import { query } from '../../dom-utils';
4
+ export const DNDAnswerOption = ({ element, renderChildNodes, style, classes = [] }) => {
5
+ const hasImages = !!query(element, 'image');
6
+ const hasFormula = !!query(element, 'formula');
7
+ const hasTitle = renderChildNodes(element).length > 0;
8
+ return (React.createElement("div", { className: classNames([...classes], {
9
+ 'has-images': hasImages,
10
+ 'has-formula': hasFormula
11
+ }), style: style },
12
+ React.createElement("div", { className: "option-content" }, !hasTitle ? React.createElement("i", { style: { color: 'grey' } }, "T\u00E4h\u00E4n tulee vastaus...") : renderChildNodes(element))));
13
+ };
14
+ //# sourceMappingURL=DNDAnswerOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DNDAnswerOption.js","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerOption.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,gBAAgB,EAChB,KAAK,EACL,OAAO,GAAG,EAAE,EAIb,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC3C,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAE9C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;IAErD,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE;YAClC,YAAY,EAAE,SAAS;YACvB,aAAa,EAAE,UAAU;SAC1B,CAAC,EACF,KAAK,EAAE,KAAK;QAEZ,6BAAK,SAAS,EAAC,gBAAgB,IAC5B,CAAC,QAAQ,CAAC,CAAC,CAAC,2BAAG,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,uCAA4B,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAC5F,CACF,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ExamComponentProps } from '../..';
3
- export declare const DNDAnswerOptionCommon: ({ element, renderChildNodes, style, classes }: ExamComponentProps & {
3
+ export declare const DNDAnswerOption: ({ element, renderChildNodes, style, classes }: ExamComponentProps & {
4
4
  style?: React.CSSProperties;
5
5
  classes?: string[];
6
6
  }) => React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"DNDAnswerOptionCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerOptionCommon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAG1C,eAAO,MAAM,qBAAqB,kDAK/B,kBAAkB,GAAG;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,sBAmBA,CAAA"}
1
+ {"version":3,"file":"DNDAnswerOptionCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerOptionCommon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAG1C,eAAO,MAAM,eAAe,kDAKzB,kBAAkB,GAAG;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,sBAmBA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import React from 'react';
3
3
  import { query } from '../../dom-utils';
4
- export const DNDAnswerOptionCommon = ({ element, renderChildNodes, style, classes = [] }) => {
4
+ export const DNDAnswerOption = ({ element, renderChildNodes, style, classes = [] }) => {
5
5
  const hasImages = !!query(element, 'image');
6
6
  const hasFormula = !!query(element, 'formula');
7
7
  const hasTitle = renderChildNodes(element).length > 0;
@@ -1 +1 @@
1
- {"version":3,"file":"DNDAnswerOptionCommon.js","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerOptionCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,OAAO,EACP,gBAAgB,EAChB,KAAK,EACL,OAAO,GAAG,EAAE,EAIb,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC3C,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAE9C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,C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AK,EAAE,MAAM,EAAE,uCAA4B,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAC5F,CACF,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ExamComponentProps } from '../..';
3
+ export declare const DNDAnswerTitle: ({ element, renderChildNodes }: ExamComponentProps) => React.JSX.Element;
4
+ //# sourceMappingURL=DNDAnswerTitleCommon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DNDAnswerTitleCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerTitleCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAI1C,eAAO,MAAM,cAAc,kCAAmC,kBAAkB,sBAe/E,CAAA"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+ import { query } from '../../dom-utils';
4
+ export const DNDAnswerTitle = ({ element, renderChildNodes }) => {
5
+ const hasImages = !!query(element, 'image');
6
+ if (!renderChildNodes(element).length) {
7
+ return React.createElement("i", { style: { color: 'grey' } }, "T\u00E4h\u00E4n tulee kysymys...");
8
+ }
9
+ else
10
+ return (React.createElement("span", { className: classNames('e-dnd-answer-title', {
11
+ 'has-images': hasImages
12
+ }) }, renderChildNodes(element)));
13
+ };
14
+ //# sourceMappingURL=DNDAnswerTitleCommon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DNDAnswerTitleCommon.js","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerTitleCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAsB,EAAE,EAAE;IAClF,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAE3C,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,2BAAG,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,uCAA4B,CAAA;IAChE,CAAC;;QACC,OAAO,CACL,8BACE,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE;gBAC1C,YAAY,EAAE,SAAS;aACxB,CAAC,IAED,gBAAgB,CAAC,OAAO,CAAC,CACrB,CACR,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { UniqueIdentifier } from '@dnd-kit/core';
2
+ import React from 'react';
3
+ import { ExamComponentProps } from '../..';
4
+ import { ItemsState } from '../exam/DNDAnswerContainer';
5
+ export declare const DNDTitleAndAnswerCommon: ({ element, renderChildNodes, items, answerOptionsByQuestionId, page }: {
6
+ element: Element;
7
+ renderChildNodes: ExamComponentProps["renderChildNodes"];
8
+ items: ItemsState;
9
+ answerOptionsByQuestionId: Record<UniqueIdentifier, Element>;
10
+ page: "exam" | "results";
11
+ }) => React.JSX.Element;
12
+ //# sourceMappingURL=DNDTitleAndAnswer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DNDTitleAndAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDTitleAndAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAG9D,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAuB,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAKvD,eAAO,MAAM,uBAAuB,0EAMjC;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,KAAK,EAAE,UAAU,CAAA;IACjB,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC5D,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,sBA6DA,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { useDroppable } from '@dnd-kit/core';
2
+ import { SortableContext } from '@dnd-kit/sortable';
3
+ import classNames from 'classnames';
4
+ import React, { useContext } from 'react';
5
+ import { getNumericAttribute, query } from '../../dom-utils';
6
+ import { findMultiChoiceFromGradingStructure, ResultsContext } from '../context/ResultsContext';
7
+ import ResultsExamQuestionAutoScore from '../results/internal/QuestionAutoScore';
8
+ import { DNDAnswerDroppableCommon } from './DNDAnswerDroppable';
9
+ import { Score } from './Score';
10
+ export const DNDTitleAndAnswerCommon = ({ element, renderChildNodes, items, answerOptionsByQuestionId, page }) => {
11
+ var _a;
12
+ const questionId = element.getAttribute('question-id');
13
+ const questionIdNumber = Number(questionId);
14
+ const displayNumber = element.getAttribute('display-number');
15
+ const maxScore = getNumericAttribute(element, 'max-score');
16
+ const hasImages = !!query(element, 'image');
17
+ const titleElement = query(element, 'dnd-answer-title');
18
+ const hasTitle = titleElement && renderChildNodes(titleElement).length > 0;
19
+ const { gradingStructure, answersByQuestionId } = useContext(ResultsContext);
20
+ const isStudentsExam = !gradingStructure;
21
+ const hasAnswer = answersByQuestionId && !!((_a = answersByQuestionId[questionIdNumber]) === null || _a === void 0 ? void 0 : _a.value);
22
+ const { correctOptionIds, scoreValue } = getCorrectOptionIds(questionIdNumber, displayNumber);
23
+ const { setNodeRef, isOver } = useDroppable({ id: questionId });
24
+ return (React.createElement(SortableContext, { id: String(questionId), items: items[questionId] || [] },
25
+ React.createElement("span", { ref: setNodeRef },
26
+ React.createElement("div", { className: classNames('e-dnd-answer', { 'no-answer': !hasAnswer }), "data-question-id": questionId, key: questionId },
27
+ React.createElement("div", { className: "anchor", id: `question-nr-${displayNumber}` }),
28
+ titleElement &&
29
+ (!hasTitle ? (React.createElement("i", { style: { color: 'grey' } }, "T\u00E4st\u00E4 puuttuu kysymys...")) : (React.createElement("span", { className: classNames('e-dnd-answer-title', { 'has-images': hasImages, hovered: isOver }) }, renderChildNodes(titleElement)))),
30
+ React.createElement("div", { className: "connection-line" }),
31
+ React.createElement(DNDAnswerDroppableCommon, { renderChildNodes: renderChildNodes, items: items[questionId] || [], answerOptionsByQuestionId: answerOptionsByQuestionId, questionId: questionId, correctIds: correctOptionIds, page: page }),
32
+ isStudentsExam ? (maxScore && React.createElement(Score, { score: maxScore, size: "small" })) : (React.createElement(ResultsExamQuestionAutoScore, { score: scoreValue, maxScore: maxScore, displayNumber: displayNumber, questionId: Number(questionId) }))))));
33
+ };
34
+ const getCorrectOptionIds = (questionId, displayNumber) => {
35
+ var _a, _b, _c, _d;
36
+ const { answersByQuestionId, gradingStructure } = useContext(ResultsContext);
37
+ const hasAnswer = !!answersByQuestionId && ((_a = answersByQuestionId[questionId]) === null || _a === void 0 ? void 0 : _a.value);
38
+ const answer = hasAnswer ? answersByQuestionId[questionId] : undefined;
39
+ const choice = findMultiChoiceFromGradingStructure(gradingStructure, questionId);
40
+ const scoreValue = !(answer === null || answer === void 0 ? void 0 : answer.value)
41
+ ? undefined
42
+ : ((_c = (_b = choice === null || choice === void 0 ? void 0 : choice.options.find(option => option.id === Number(answer.value) && option.correct)) === null || _b === void 0 ? void 0 : _b.score) !== null && _c !== void 0 ? _c : 0);
43
+ const thisQuestion = gradingStructure === null || gradingStructure === void 0 ? void 0 : gradingStructure.questions.find(q => q.displayNumber === displayNumber);
44
+ const options = ((_d = thisQuestion === null || thisQuestion === void 0 ? void 0 : thisQuestion.choices.find(c => c.id === questionId)) === null || _d === void 0 ? void 0 : _d.options) || [];
45
+ const correctOptionIds = options === null || options === void 0 ? void 0 : options.filter(o => o.correct).map(o => o.id);
46
+ return { correctOptionIds, scoreValue };
47
+ };
48
+ //# sourceMappingURL=DNDTitleAndAnswer.js.map
@@ -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AAK,mCAAI,CAAC,CAAC,CAAA;IACtG,MAAM,YAAY,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,aAAa,CAAwB,CAAA;IACpH,MAAM,OAAO,GAAG,CAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,0CAAE,OAAO,KAAI,EAAE,CAAA;IACnF,MAAM,gBAAgB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACvE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAA;AACzC,CAAC,CAAA"}
@@ -1,13 +1,12 @@
1
1
  import { UniqueIdentifier } from '@dnd-kit/core';
2
2
  import React from 'react';
3
3
  import { ExamComponentProps } from '../..';
4
- import { ItemsState } from '../exam/DNDAnswer';
5
- export declare const DNDTitleAndAnswerCommon: ({ element, renderChildNodes, items, answerOptionsByQuestionId, isInExam, hasAnswer }: {
4
+ import { ItemsState } from '../exam/DNDAnswerContainer';
5
+ export declare const DNDTitleAndAnswerCommon: ({ element, renderChildNodes, items, answerOptionsByQuestionId, page }: {
6
6
  element: Element;
7
7
  renderChildNodes: ExamComponentProps["renderChildNodes"];
8
8
  items: ItemsState;
9
9
  answerOptionsByQuestionId: Record<UniqueIdentifier, Element>;
10
- isInExam?: boolean;
11
- hasAnswer?: boolean;
10
+ page: "exam" | "results";
12
11
  }) => React.JSX.Element;
13
12
  //# sourceMappingURL=DNDTitleAndAnswerCommon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DNDTitleAndAnswerCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDTitleAndAnswerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,EAA8B,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAI1E,eAAO,MAAM,uBAAuB,yFAOjC;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,KAAK,EAAE,UAAU,CAAA;IACjB,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,sBAwDA,CAAA"}
1
+ {"version":3,"file":"DNDTitleAndAnswerCommon.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDTitleAndAnswerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAA;AAG9D,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAuB,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAKvD,eAAO,MAAM,uBAAuB,0EAMjC;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,KAAK,EAAE,UAAU,CAAA;IACjB,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC5D,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,sBA6DA,CAAA"}
@@ -1,27 +1,48 @@
1
1
  import { useDroppable } from '@dnd-kit/core';
2
+ import { SortableContext } from '@dnd-kit/sortable';
2
3
  import classNames from 'classnames';
3
- import React from 'react';
4
+ import React, { useContext } from 'react';
4
5
  import { getNumericAttribute, query } from '../../dom-utils';
5
- import { DNDAnswer as DNDAnswerExam } from '../exam/DNDAnswer';
6
- import { DNDAnswer as DNDAnswerResults } from '../results/DNDAnswer';
7
- import { SortableContext } from '@dnd-kit/sortable';
8
- export const DNDTitleAndAnswerCommon = ({ element, renderChildNodes, items, answerOptionsByQuestionId, isInExam, hasAnswer }) => {
6
+ import { findMultiChoiceFromGradingStructure, ResultsContext } from '../context/ResultsContext';
7
+ import ResultsExamQuestionAutoScore from '../results/internal/QuestionAutoScore';
8
+ import { DNDAnswerDroppableCommon } from './DNDAnswerDroppableCommon';
9
+ import { Score } from './Score';
10
+ export const DNDTitleAndAnswerCommon = ({ element, renderChildNodes, items, answerOptionsByQuestionId, page }) => {
11
+ var _a;
9
12
  const questionId = element.getAttribute('question-id');
13
+ const questionIdNumber = Number(questionId);
10
14
  const displayNumber = element.getAttribute('display-number');
11
15
  const maxScore = getNumericAttribute(element, 'max-score');
12
16
  const hasImages = !!query(element, 'image');
13
17
  const titleElement = query(element, 'dnd-answer-title');
14
18
  const hasTitle = titleElement && renderChildNodes(titleElement).length > 0;
19
+ const { gradingStructure, answersByQuestionId } = useContext(ResultsContext);
20
+ const isStudentsExam = !gradingStructure;
21
+ const hasAnswer = answersByQuestionId && !!((_a = answersByQuestionId[questionIdNumber]) === null || _a === void 0 ? void 0 : _a.value);
22
+ const { correctOptionIds, scoreValue } = getCorrectOptionIds(questionIdNumber, displayNumber);
15
23
  const { setNodeRef, isOver } = useDroppable({ id: questionId });
16
24
  return (React.createElement(SortableContext, { id: String(questionId), items: items[questionId] || [] },
17
25
  React.createElement("span", { ref: setNodeRef },
18
- React.createElement("div", { className: classNames('e-dnd-answer', {
19
- 'no-answer': !hasAnswer
20
- }), "data-question-id": questionId, key: questionId },
26
+ React.createElement("div", { className: classNames('e-dnd-answer', { 'no-answer': !hasAnswer }), "data-question-id": questionId, key: questionId },
21
27
  React.createElement("div", { className: "anchor", id: `question-nr-${displayNumber}` }),
22
28
  titleElement &&
23
29
  (!hasTitle ? (React.createElement("i", { style: { color: 'grey' } }, "T\u00E4st\u00E4 puuttuu kysymys...")) : (React.createElement("span", { className: classNames('e-dnd-answer-title', { 'has-images': hasImages, hovered: isOver }) }, renderChildNodes(titleElement)))),
24
30
  React.createElement("div", { className: "connection-line" }),
25
- isInExam ? (React.createElement(DNDAnswerExam, { renderChildNodes: renderChildNodes, items: items[questionId], answerOptionsByQuestionId: answerOptionsByQuestionId, questionId: questionId, displayNumber: displayNumber, maxScore: maxScore })) : (React.createElement(DNDAnswerResults, { renderChildNodes: renderChildNodes, items: items[questionId], answerOptionsByQuestionId: answerOptionsByQuestionId, questionId: questionId, displayNumber: displayNumber, maxScore: maxScore }))))));
31
+ React.createElement(DNDAnswerDroppableCommon, { renderChildNodes: renderChildNodes, items: items[questionId] || [], answerOptionsByQuestionId: answerOptionsByQuestionId, questionId: questionId, correctIds: correctOptionIds, page: page }),
32
+ isStudentsExam ? (maxScore && React.createElement(Score, { score: maxScore, size: "small" })) : (React.createElement(ResultsExamQuestionAutoScore, { score: scoreValue, maxScore: maxScore, displayNumber: displayNumber, questionId: Number(questionId) }))))));
33
+ };
34
+ const getCorrectOptionIds = (questionId, displayNumber) => {
35
+ var _a, _b, _c, _d;
36
+ const { answersByQuestionId, gradingStructure } = useContext(ResultsContext);
37
+ const hasAnswer = !!answersByQuestionId && ((_a = answersByQuestionId[questionId]) === null || _a === void 0 ? void 0 : _a.value);
38
+ const answer = hasAnswer ? answersByQuestionId[questionId] : undefined;
39
+ const choice = findMultiChoiceFromGradingStructure(gradingStructure, questionId);
40
+ const scoreValue = !(answer === null || answer === void 0 ? void 0 : answer.value)
41
+ ? undefined
42
+ : ((_c = (_b = choice === null || choice === void 0 ? void 0 : choice.options.find(option => option.id === Number(answer.value) && option.correct)) === null || _b === void 0 ? void 0 : _b.score) !== null && _c !== void 0 ? _c : 0);
43
+ const thisQuestion = gradingStructure === null || gradingStructure === void 0 ? void 0 : gradingStructure.questions.find(q => q.displayNumber === displayNumber);
44
+ const options = ((_d = thisQuestion === null || thisQuestion === void 0 ? void 0 : thisQuestion.choices.find(c => c.id === questionId)) === null || _d === void 0 ? void 0 : _d.options) || [];
45
+ const correctOptionIds = options === null || options === void 0 ? void 0 : options.filter(o => o.correct).map(o => o.id);
46
+ return { correctOptionIds, scoreValue };
26
47
  };
27
48
  //# sourceMappingURL=DNDTitleAndAnswerCommon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DNDTitleAndAnswerCommon.js","sourceRoot":"","sources":["../../../src/components/shared/DNDTitleAndAnswerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,SAAS,IAAI,aAAa,EAAc,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,OAAO,EACP,gBAAgB,EAChB,KAAK,EACL,yBAAyB,EACzB,QAAQ,EACR,SAAS,EAQV,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAE,CAAA;IACvD,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAE,CAAA;IAC7D,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;IAC1D,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EA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uBAAN,MAAM,CAAE,KAAK,CAAA;QAC/B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,CAAC,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,0CAAE,KAAK,mCAAI,CAAC,CAAC,CAAA;IACtG,MAAM,YAAY,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,aAAa,CAAwB,CAAA;IACpH,MAAM,OAAO,GAAG,CAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,0CAAE,OAAO,KAAI,EAAE,CAAA;IACnF,MAAM,gBAAgB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACvE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAA;AACzC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { NewRenderableAnnotation, RenderableAnnotation } from '../../types/Score';
3
+ export declare const Mark: ({ annotation, markedText, onClickAnnotation, setNewAnnotationRef }: {
4
+ annotation: RenderableAnnotation | NewRenderableAnnotation;
5
+ markedText: string;
6
+ onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, a: RenderableAnnotation) => void;
7
+ setNewAnnotationRef: (ref: HTMLElement | undefined) => void;
8
+ }) => React.JSX.Element;
9
+ //# sourceMappingURL=Mark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mark.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Mark.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAGjF,eAAO,MAAM,IAAI,uEAKd;IACD,UAAU,EAAE,oBAAoB,GAAG,uBAAuB,CAAA;IAC1D,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAClG,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAA;CAC5D,sBAsBA,CAAA"}
@@ -0,0 +1,14 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import { isExamAnnotation } from './markText';
3
+ export const Mark = ({ annotation, markedText, onClickAnnotation, setNewAnnotationRef }) => {
4
+ const markRef = useRef(null);
5
+ useEffect(() => {
6
+ if (markRef.current && !isExamAnnotation(annotation)) {
7
+ setNewAnnotationRef(markRef.current);
8
+ }
9
+ }, []);
10
+ return (React.createElement("mark", { ref: markRef, className: "e-annotation", "data-annotation-id": isExamAnnotation(annotation) ? annotation.annotationId : '', "data-hidden": "false", "data-annotation-path": annotation.annotationAnchor, onClick: e => (isExamAnnotation(annotation) ? onClickAnnotation(e, annotation) : undefined) },
11
+ markedText,
12
+ (annotation === null || annotation === void 0 ? void 0 : annotation.markNumber) && React.createElement("sup", { className: "e-annotation", "data-content": annotation === null || annotation === void 0 ? void 0 : annotation.markNumber })));
13
+ };
14
+ //# sourceMappingURL=Mark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mark.js","sourceRoot":"","sources":["../../../src/components/shared/Mark.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EAMpB,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;YACrD,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,8BACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAC,cAAc,wBACJ,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,iBACnE,OAAO,0BACG,UAAU,CAAC,gBAAgB,EACjD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE1F,UAAU;QACV,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,6BAAK,SAAS,EAAC,cAAc,kBAAe,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,GAAI,CAC5F,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare function RestrictedAudioPlayerCommon({ duration, durationRemaining, disabled, restrictedAudioId, playing, labelId, onClick }: {
3
+ durationRemaining?: number;
4
+ disabled: boolean;
5
+ playing: boolean;
6
+ restrictedAudioId: number;
7
+ duration: number;
8
+ labelId: string;
9
+ onClick: () => void;
10
+ }): React.JSX.Element;
11
+ export declare function formatDuration(duration: number): string;
12
+ //# sourceMappingURL=RestrictedAudioPlayerCommon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RestrictedAudioPlayerCommon.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/internal/RestrictedAudioPlayerCommon.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6B,MAAM,OAAO,CAAA;AAIjD,wBAAgB,2BAA2B,CAAC,EAC1C,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,OAAO,EACR,EAAE;IACD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,qBAmCA;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKvD"}
@@ -0,0 +1,29 @@
1
+ import { faPlay } from '@fortawesome/free-solid-svg-icons';
2
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
+ import classNames from 'classnames';
4
+ import React, { useContext, useRef } from 'react';
5
+ import { useExamTranslation } from '../../../i18n';
6
+ import { CommonExamContext } from '../../context/CommonExamContext';
7
+ export function RestrictedAudioPlayerCommon({ duration, durationRemaining, disabled, restrictedAudioId, playing, labelId, onClick }) {
8
+ const { abitti2 } = useContext(CommonExamContext);
9
+ const remainingLabelId = `audio-remaining-${restrictedAudioId}`;
10
+ const audioRef = useRef(null);
11
+ const { i18n } = useExamTranslation();
12
+ const labels = playing ? [] : [remainingLabelId, labelId];
13
+ return (React.createElement("div", { className: classNames('restricted-audio-player e-column e-column--narrow e-columns e-columns--inline e-columns--center-v e-pad-1', { 'restricted-audio-player--disabled': disabled }), lang: i18n.language },
14
+ abitti2 && (React.createElement("audio", { ref: audioRef, preload: "none" },
15
+ React.createElement("source", null))),
16
+ React.createElement("button", { className: classNames('restricted-audio-player__play e-column e-column--narrow', {
17
+ 'restricted-audio-player__play--playing': playing
18
+ }), disabled: disabled, onClick: onClick, "aria-labelledby": labels.join(' ') }, !playing && React.createElement(FontAwesomeIcon, { icon: faPlay, fixedWidth: true })),
19
+ React.createElement("span", { className: "restricted-audio-player__duration e-column e-text-right", id: remainingLabelId }, formatDuration(durationRemaining !== null && durationRemaining !== void 0 ? durationRemaining : duration))));
20
+ }
21
+ export function formatDuration(duration) {
22
+ const minutes = Math.floor(duration / 60);
23
+ const seconds = duration % 60;
24
+ return `${padWithZeroes(minutes)}:${padWithZeroes(seconds)}`;
25
+ }
26
+ function padWithZeroes(num) {
27
+ return num.toString().padStart(2, '0');
28
+ }
29
+ //# sourceMappingURL=RestrictedAudioPlayerCommon.js.map