@digabi/exam-engine-core 23.1.0-alpha.0 → 23.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/dist/__tests__/results/ResultsContext.test.js +1 -1
  2. package/dist/__tests__/results/ResultsContext.test.js.map +1 -1
  3. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  4. package/dist/components/context/QuestionContext.js +1 -1
  5. package/dist/components/context/QuestionContext.js.map +1 -1
  6. package/dist/components/exam/Exam.d.ts.map +1 -1
  7. package/dist/components/exam/Exam.js +0 -2
  8. package/dist/components/exam/Exam.js.map +1 -1
  9. package/dist/components/results/Results.d.ts.map +1 -1
  10. package/dist/components/results/Results.js +1 -3
  11. package/dist/components/results/Results.js.map +1 -1
  12. package/dist/components/results/internal/QuestionScoresContainer.d.ts.map +1 -1
  13. package/dist/components/results/internal/QuestionScoresContainer.js +2 -4
  14. package/dist/components/results/internal/QuestionScoresContainer.js.map +1 -1
  15. package/dist/dom-utils.d.ts.map +1 -1
  16. package/dist/dom-utils.js +1 -1
  17. package/dist/dom-utils.js.map +1 -1
  18. package/dist/i18n/fi-FI.d.ts +0 -8
  19. package/dist/i18n/fi-FI.d.ts.map +1 -1
  20. package/dist/i18n/fi-FI.js +0 -8
  21. package/dist/i18n/fi-FI.js.map +1 -1
  22. package/dist/i18n/sv-FI.d.ts.map +1 -1
  23. package/dist/i18n/sv-FI.js +0 -8
  24. package/dist/i18n/sv-FI.js.map +1 -1
  25. package/dist/main-bundle.js +10 -10
  26. package/dist/main.css +1 -1
  27. package/dist/parser/parseExam.js +1 -1
  28. package/dist/parser/parseExam.js.map +1 -1
  29. package/dist/parser/parseExamStructure.d.ts +1 -8
  30. package/dist/parser/parseExamStructure.d.ts.map +1 -1
  31. package/dist/parser/parseExamStructure.js +1 -1
  32. package/dist/parser/parseExamStructure.js.map +1 -1
  33. package/dist/validateAnswers.js +0 -1
  34. package/dist/validateAnswers.js.map +1 -1
  35. package/package.json +3 -3
  36. package/dist/__tests__/playwright/DNDAnswerContainer.test.d.ts +0 -2
  37. package/dist/__tests__/playwright/DNDAnswerContainer.test.d.ts.map +0 -1
  38. package/dist/__tests__/playwright/DNDAnswerContainer.test.js +0 -77
  39. package/dist/__tests__/playwright/DNDAnswerContainer.test.js.map +0 -1
  40. package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.d.ts +0 -1
  41. package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.d.ts.map +0 -1
  42. package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.js +0 -17
  43. package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.js.map +0 -1
  44. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.d.ts +0 -10
  45. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.d.ts.map +0 -1
  46. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.js +0 -21
  47. package/dist/__tests__/playwright/stories/DNDAnswerContainer.story.js.map +0 -1
  48. package/dist/__tests__/playwright/utils/ComponentWrapper.d.ts +0 -9
  49. package/dist/__tests__/playwright/utils/ComponentWrapper.d.ts.map +0 -1
  50. package/dist/__tests__/playwright/utils/ComponentWrapper.js +0 -26
  51. package/dist/__tests__/playwright/utils/ComponentWrapper.js.map +0 -1
  52. package/dist/components/exam/AllDNDOptions.d.ts +0 -9
  53. package/dist/components/exam/AllDNDOptions.d.ts.map +0 -1
  54. package/dist/components/exam/AllDNDOptions.js +0 -12
  55. package/dist/components/exam/AllDNDOptions.js.map +0 -1
  56. package/dist/components/exam/DNDAllOptions.d.ts +0 -9
  57. package/dist/components/exam/DNDAllOptions.d.ts.map +0 -1
  58. package/dist/components/exam/DNDAllOptions.js +0 -14
  59. package/dist/components/exam/DNDAllOptions.js.map +0 -1
  60. package/dist/components/exam/DNDAnswer.d.ts +0 -20
  61. package/dist/components/exam/DNDAnswer.d.ts.map +0 -1
  62. package/dist/components/exam/DNDAnswer.js +0 -7
  63. package/dist/components/exam/DNDAnswer.js.map +0 -1
  64. package/dist/components/exam/DNDAnswerContainer.d.ts +0 -9
  65. package/dist/components/exam/DNDAnswerContainer.d.ts.map +0 -1
  66. package/dist/components/exam/DNDAnswerContainer.js +0 -128
  67. package/dist/components/exam/DNDAnswerContainer.js.map +0 -1
  68. package/dist/components/exam/DNDAnswerOption.d.ts +0 -4
  69. package/dist/components/exam/DNDAnswerOption.d.ts.map +0 -1
  70. package/dist/components/exam/DNDAnswerOption.js +0 -18
  71. package/dist/components/exam/DNDAnswerOption.js.map +0 -1
  72. package/dist/components/exam/DNDAnswerOptionDraggable.d.ts +0 -4
  73. package/dist/components/exam/DNDAnswerOptionDraggable.d.ts.map +0 -1
  74. package/dist/components/exam/DNDAnswerOptionDraggable.js +0 -18
  75. package/dist/components/exam/DNDAnswerOptionDraggable.js.map +0 -1
  76. package/dist/components/results/CorrectDNDAnswers.d.ts +0 -7
  77. package/dist/components/results/CorrectDNDAnswers.d.ts.map +0 -1
  78. package/dist/components/results/CorrectDNDAnswers.js +0 -19
  79. package/dist/components/results/CorrectDNDAnswers.js.map +0 -1
  80. package/dist/components/results/DNDAnswer.d.ts +0 -12
  81. package/dist/components/results/DNDAnswer.d.ts.map +0 -1
  82. package/dist/components/results/DNDAnswer.js +0 -21
  83. package/dist/components/results/DNDAnswer.js.map +0 -1
  84. package/dist/components/results/DNDAnswerContainer.d.ts +0 -4
  85. package/dist/components/results/DNDAnswerContainer.d.ts.map +0 -1
  86. package/dist/components/results/DNDAnswerContainer.js +0 -35
  87. package/dist/components/results/DNDAnswerContainer.js.map +0 -1
  88. package/dist/components/results/DNDAnswerOption.d.ts +0 -7
  89. package/dist/components/results/DNDAnswerOption.d.ts.map +0 -1
  90. package/dist/components/results/DNDAnswerOption.js +0 -9
  91. package/dist/components/results/DNDAnswerOption.js.map +0 -1
  92. package/dist/components/shared/DNDAnswerCommon.d.ts +0 -13
  93. package/dist/components/shared/DNDAnswerCommon.d.ts.map +0 -1
  94. package/dist/components/shared/DNDAnswerCommon.js +0 -30
  95. package/dist/components/shared/DNDAnswerCommon.js.map +0 -1
  96. package/dist/components/shared/DNDAnswerDroppable.d.ts +0 -13
  97. package/dist/components/shared/DNDAnswerDroppable.d.ts.map +0 -1
  98. package/dist/components/shared/DNDAnswerDroppable.js +0 -30
  99. package/dist/components/shared/DNDAnswerDroppable.js.map +0 -1
  100. package/dist/components/shared/DNDAnswerOptionCommon.d.ts +0 -7
  101. package/dist/components/shared/DNDAnswerOptionCommon.d.ts.map +0 -1
  102. package/dist/components/shared/DNDAnswerOptionCommon.js +0 -14
  103. package/dist/components/shared/DNDAnswerOptionCommon.js.map +0 -1
  104. package/dist/components/shared/DNDDroppable.d.ts +0 -12
  105. package/dist/components/shared/DNDDroppable.d.ts.map +0 -1
  106. package/dist/components/shared/DNDDroppable.js +0 -27
  107. package/dist/components/shared/DNDDroppable.js.map +0 -1
  108. package/dist/components/shared/DNDTitleAndAnswerCommon.d.ts +0 -13
  109. package/dist/components/shared/DNDTitleAndAnswerCommon.d.ts.map +0 -1
  110. package/dist/components/shared/DNDTitleAndAnswerCommon.js +0 -27
  111. package/dist/components/shared/DNDTitleAndAnswerCommon.js.map +0 -1
  112. package/dist/components/shared/DNDTitleAndDroppable.d.ts +0 -11
  113. package/dist/components/shared/DNDTitleAndDroppable.d.ts.map +0 -1
  114. package/dist/components/shared/DNDTitleAndDroppable.js +0 -53
  115. package/dist/components/shared/DNDTitleAndDroppable.js.map +0 -1
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { ExamComponentProps } from '../..';
3
- export declare const DNDAnswerOption: ({ element, renderChildNodes, style, className }: ExamComponentProps & {
4
- style?: React.CSSProperties;
5
- className?: "correct-answer" | "wrong-answer";
6
- }) => React.JSX.Element;
7
- //# sourceMappingURL=DNDAnswerOption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDAnswerOption.d.ts","sourceRoot":"","sources":["../../../src/components/results/DNDAnswerOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAG1C,eAAO,MAAM,eAAe,oDAKzB,kBAAkB,GAAG;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,SAAS,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAA;CAC9C,sBAWA,CAAA"}
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { useExamTranslation } from '../../i18n';
3
- export const DNDAnswerOption = ({ element, renderChildNodes, style, className }) => {
4
- const hasContent = renderChildNodes(element).length > 0;
5
- const { t } = useExamTranslation();
6
- return (React.createElement("div", { className: className, style: style },
7
- React.createElement("div", { className: "option-content" }, !hasContent ? React.createElement("i", { style: { color: 'grey' } }, t('dnd-answers.answer-missing')) : renderChildNodes(element))));
8
- };
9
- //# sourceMappingURL=DNDAnswerOption.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDAnswerOption.js","sourceRoot":"","sources":["../../../src/components/results/DNDAnswerOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,gBAAgB,EAChB,KAAK,EACL,SAAS,EAIV,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;IACvD,MAAM,EAAE,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAElC,OAAO,CACL,6BAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK;QACrC,6BAAK,SAAS,EAAC,gBAAgB,IAC5B,CAAC,UAAU,CAAC,CAAC,CAAC,2BAAG,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAG,CAAC,CAAC,4BAA4B,CAAC,CAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CACzG,CACF,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -1,13 +0,0 @@
1
- import { UniqueIdentifier } from '@dnd-kit/core';
2
- import React from 'react';
3
- import { ExamComponentProps } from '../..';
4
- export declare const DNDAnswerCommon: ({ renderChildNodes, items, answerOptionsByQuestionId, isInExam, correctIds, classes, questionId }: {
5
- items: UniqueIdentifier[];
6
- answerOptionsByQuestionId: Record<UniqueIdentifier, Element>;
7
- renderChildNodes: ExamComponentProps["renderChildNodes"];
8
- isInExam?: boolean;
9
- correctIds?: UniqueIdentifier[];
10
- classes?: Record<string, boolean>;
11
- questionId: UniqueIdentifier;
12
- }) => React.JSX.Element;
13
- //# sourceMappingURL=DNDAnswerCommon.d.ts.map
@@ -1 +0,0 @@
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,30 +0,0 @@
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 { DNDAnswerOption as DNDAnswerOptionExam } from '../exam/DNDAnswerOption';
6
- import { DNDAnswerOptionCommon } from './DNDAnswerOptionCommon';
7
- export const DNDAnswerCommon = ({ renderChildNodes, items, answerOptionsByQuestionId, isInExam, correctIds, classes, questionId }) => {
8
- const dndAnswerOptions = (items === null || items === void 0 ? void 0 : items.map(id => answerOptionsByQuestionId[id])) || [];
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') }, isInExam ? (React.createElement(DNDAnswerOptionExam, { element: element, renderChildNodes: renderChildNodes, key: optionId })) : (React.createElement("div", { className: "e-dnd-answer-option" },
25
- React.createElement(DNDAnswerOptionCommon, { 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=DNDAnswerCommon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDAnswerCommon.js","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAA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,gBAAgB,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,QAAQ,CAAC,CAAC,CAAC,CACV,oBAAC,mBAAmB,IAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,GAAI,CAC7F,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,qBAAqB;gBAClC,oBAAC,qBAAqB,IACpB,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;QACD,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 +0,0 @@
1
- import { UniqueIdentifier } from '@dnd-kit/core';
2
- import React from 'react';
3
- import { ExamComponentProps } from '../..';
4
- export declare const DNDAnswerDroppable: ({ 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=DNDAnswerDroppable.d.ts.map
@@ -1 +0,0 @@
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,30 +0,0 @@
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 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'));
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, className: !correctIds ? undefined : 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=DNDAnswerDroppable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDAnswerDroppable.js","sourceRoot":"","sources":["../../../src/components/shared/DNDAnswerDroppable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OA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AAE,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,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,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,7 +0,0 @@
1
- import React from 'react';
2
- import { ExamComponentProps } from '../..';
3
- export declare const DNDAnswerOptionCommon: ({ element, renderChildNodes, style, classes }: ExamComponentProps & {
4
- style?: React.CSSProperties;
5
- classes?: string[];
6
- }) => React.JSX.Element;
7
- //# sourceMappingURL=DNDAnswerOptionCommon.d.ts.map
@@ -1 +0,0 @@
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,14 +0,0 @@
1
- import classNames from 'classnames';
2
- import React from 'react';
3
- import { query } from '../../dom-utils';
4
- export const DNDAnswerOptionCommon = ({ 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=DNDAnswerOptionCommon.js.map
@@ -1 +0,0 @@
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,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,12 +0,0 @@
1
- import { UniqueIdentifier } from '@dnd-kit/core';
2
- import React from 'react';
3
- import { ExamComponentProps } from '../..';
4
- export declare const DNDDroppable: ({ renderChildNodes, correctIds, classes, questionId, page, answerOptionElements }: {
5
- renderChildNodes: ExamComponentProps["renderChildNodes"];
6
- correctIds?: UniqueIdentifier[];
7
- classes?: string[];
8
- questionId: UniqueIdentifier;
9
- page: "exam" | "results";
10
- answerOptionElements: Element[];
11
- }) => React.JSX.Element;
12
- //# sourceMappingURL=DNDDroppable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDDroppable.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDDroppable.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;AAM1C,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,EAAE,CAAA;IAClB,UAAU,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,oBAAoB,EAAE,OAAO,EAAE,CAAA;CAChC,sBA4CA,CAAA"}
@@ -1,27 +0,0 @@
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
- import { useExamTranslation } from '../../i18n';
8
- export const DNDDroppable = ({ renderChildNodes, correctIds, classes = [], questionId, page, answerOptionElements = [] }) => {
9
- const hasImages = answerOptionElements.some(option => query(option, 'image'));
10
- const hasAudio = answerOptionElements.some(option => query(option, 'audio'));
11
- const { active, isOver } = useDroppable({ id: questionId });
12
- const { t } = useExamTranslation();
13
- return (React.createElement("div", { className: classNames(['e-dnd-answer-droppable', ...classes], {
14
- 'has-images': hasImages,
15
- 'has-audio': hasAudio,
16
- hovered: isOver
17
- }) }, answerOptionElements === null || answerOptionElements === void 0 ? void 0 :
18
- answerOptionElements.map(element => {
19
- const optionId = Number(element.getAttribute('option-id'));
20
- const isCorrect = correctIds === null || correctIds === void 0 ? void 0 : correctIds.includes(optionId);
21
- return (React.createElement(React.Fragment, { key: element.getAttribute('option-id') }, page === 'exam' ? (React.createElement(DNDAnswerOptionDraggable, { element: element, renderChildNodes: renderChildNodes, key: optionId })) : (React.createElement("div", { className: "e-dnd-answer-option" },
22
- React.createElement(DNDAnswerOption, { element: element, renderChildNodes: renderChildNodes, key: optionId, className: !correctIds ? undefined : isCorrect ? 'correct-answer' : 'wrong-answer' })))));
23
- }),
24
- !answerOptionElements.length &&
25
- (active ? (React.createElement("i", { className: "droppable-drop-here" }, t('dnd-answers.drop-here'))) : (React.createElement("i", { className: "droppable-no-answer" }, t('dnd-answers.no-answer'))))));
26
- };
27
- //# sourceMappingURL=DNDDroppable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDDroppable.js","sourceRoot":"","sources":["../../../src/components/shared/DNDDroppable.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,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,gBAAgB,EAChB,UAAU,EACV,OAAO,GAAG,EAAE,EACZ,UAAU,EACV,IAAI,EACJ,oBAAoB,GAAG,EAAE,EAQ1B,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAC7E,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAE5E,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;IAC3D,MAAM,EAAE,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAElC,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CAAC,CAAC,w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CAAA"}
@@ -1,13 +0,0 @@
1
- import { UniqueIdentifier } from '@dnd-kit/core';
2
- import React from 'react';
3
- import { ExamComponentProps } from '../..';
4
- import { ItemsState } from '../exam/DNDAnswer';
5
- export declare const DNDTitleAndAnswerCommon: ({ element, renderChildNodes, items, answerOptionsByQuestionId, isInExam, hasAnswer }: {
6
- element: Element;
7
- renderChildNodes: ExamComponentProps["renderChildNodes"];
8
- items: ItemsState;
9
- answerOptionsByQuestionId: Record<UniqueIdentifier, Element>;
10
- isInExam?: boolean;
11
- hasAnswer?: boolean;
12
- }) => React.JSX.Element;
13
- //# sourceMappingURL=DNDTitleAndAnswerCommon.d.ts.map
@@ -1 +0,0 @@
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,27 +0,0 @@
1
- import { useDroppable } from '@dnd-kit/core';
2
- import classNames from 'classnames';
3
- import React from 'react';
4
- 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 }) => {
9
- const questionId = element.getAttribute('question-id');
10
- const displayNumber = element.getAttribute('display-number');
11
- const maxScore = getNumericAttribute(element, 'max-score');
12
- const hasImages = !!query(element, 'image');
13
- const titleElement = query(element, 'dnd-answer-title');
14
- const hasTitle = titleElement && renderChildNodes(titleElement).length > 0;
15
- const { setNodeRef, isOver } = useDroppable({ id: questionId });
16
- return (React.createElement(SortableContext, { id: String(questionId), items: items[questionId] || [] },
17
- 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 },
21
- React.createElement("div", { className: "anchor", id: `question-nr-${displayNumber}` }),
22
- titleElement &&
23
- (!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
- 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 }))))));
26
- };
27
- //# sourceMappingURL=DNDTitleAndAnswerCommon.js.map
@@ -1 +0,0 @@
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,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AC,sBACgB,UAAU,EAC5B,GAAG,EAAE,UAAU;gBAEf,6BAAK,SAAS,EAAC,QAAQ,EAAC,EAAE,EAAE,eAAe,aAAa,EAAE,GAAI;gBAE7D,YAAY;oBACX,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACX,2BAAG,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,yCAA8B,CAC1D,CAAC,CAAC,CAAC,CACF,8BAAM,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,IAC5F,gBAAgB,CAAC,YAAY,CAAC,CAC1B,CACR,CAAC;gBAEJ,6BAAK,SAAS,EAAC,iBAAiB,GAAG;gBAElC,QAAQ,CAAC,CAAC,CAAC,CACV,oBAAC,aAAa,IACZ,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,KAAK,CAAC,UAA8B,CAAC,EAC5C,yBAAyB,EAAE,yBAAyB,EACpD,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,gBAAgB,IACf,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,EACxB,yBAAyB,EAAE,yBAAyB,EACpD,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,GAClB,CACH,CACG,CACD,CACS,CACnB,CAAA;AACH,CAAC,CAAA"}
@@ -1,11 +0,0 @@
1
- import { UniqueIdentifier } from '@dnd-kit/core';
2
- import React from 'react';
3
- import { ExamComponentProps } from '../..';
4
- export declare const DNDTitleAndDroppable: ({ element, renderChildNodes, itemIds, page, answerOptionElements }: {
5
- element: Element;
6
- renderChildNodes: ExamComponentProps["renderChildNodes"];
7
- itemIds: UniqueIdentifier[];
8
- page: "exam" | "results";
9
- answerOptionElements: Element[];
10
- }) => React.JSX.Element;
11
- //# sourceMappingURL=DNDTitleAndDroppable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDTitleAndDroppable.d.ts","sourceRoot":"","sources":["../../../src/components/shared/DNDTitleAndDroppable.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;AAQ/D,eAAO,MAAM,oBAAoB,uEAM9B;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IACxD,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,oBAAoB,EAAE,OAAO,EAAE,CAAA;CAChC,sBA6DA,CAAA"}
@@ -1,53 +0,0 @@
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 { DNDDroppable } from './DNDDroppable';
9
- import { Score } from './Score';
10
- import { useExamTranslation } from '../../i18n';
11
- export const DNDTitleAndDroppable = ({ element, renderChildNodes, itemIds, page, answerOptionElements }) => {
12
- var _a;
13
- const { t } = useExamTranslation();
14
- const questionId = element.getAttribute('question-id');
15
- const questionIdNumber = Number(questionId);
16
- const displayNumber = element.getAttribute('display-number');
17
- const maxScore = getNumericAttribute(element, 'max-score');
18
- const hasImages = !!query(element, 'image');
19
- const titleElement = query(element, 'dnd-answer-title');
20
- const hasTitle = titleElement && renderChildNodes(titleElement).length > 0;
21
- const { gradingStructure, answersByQuestionId } = useContext(ResultsContext);
22
- const isStudentsExam = !gradingStructure;
23
- const hasAnswer = answersByQuestionId && !!((_a = answersByQuestionId[questionIdNumber]) === null || _a === void 0 ? void 0 : _a.value);
24
- const { correctOptionIds, scoreValue } = getCorrectOptionIds(questionIdNumber, displayNumber);
25
- const { setNodeRef, isOver } = useDroppable({ id: questionId });
26
- return (React.createElement(SortableContext, { id: questionId, items: itemIds },
27
- React.createElement("span", { ref: setNodeRef },
28
- React.createElement("div", { className: classNames('e-dnd-answer', { 'no-answer': page === 'results' && !hasAnswer }), "data-question-id": questionId, key: questionId },
29
- React.createElement("div", { className: "anchor", id: `question-nr-${displayNumber}` }),
30
- titleElement &&
31
- (!hasTitle ? (React.createElement("i", { style: { color: 'grey' } }, t('dnd-answers.question-missing'))) : (React.createElement("span", { className: classNames('e-dnd-answer-title', { 'has-images': hasImages, hovered: isOver }) }, renderChildNodes(titleElement)))),
32
- React.createElement("div", { className: "connection-line" }),
33
- React.createElement(DNDDroppable, { page: page, answerOptionElements: answerOptionElements, questionId: questionId, renderChildNodes: renderChildNodes, correctIds: correctOptionIds }),
34
- isStudentsExam ? (maxScore && React.createElement(Score, { score: maxScore, size: "small" })) : (React.createElement(ResultsExamQuestionAutoScore, { score: scoreValue, maxScore: maxScore, displayNumber: displayNumber, questionId: questionIdNumber }))))));
35
- };
36
- const getCorrectOptionIds = (questionId, displayNumber) => {
37
- var _a, _b, _c, _d;
38
- const { answersByQuestionId, gradingStructure } = useContext(ResultsContext);
39
- if (!gradingStructure) {
40
- return { correctOptionIds: undefined, scoreValue: undefined };
41
- }
42
- const hasAnswer = !!answersByQuestionId && ((_a = answersByQuestionId[questionId]) === null || _a === void 0 ? void 0 : _a.value);
43
- const answer = hasAnswer ? answersByQuestionId[questionId] : undefined;
44
- const choice = findMultiChoiceFromGradingStructure(gradingStructure, questionId);
45
- const scoreValue = !(answer === null || answer === void 0 ? void 0 : answer.value)
46
- ? undefined
47
- : ((_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);
48
- const thisQuestion = gradingStructure === null || gradingStructure === void 0 ? void 0 : gradingStructure.questions.find(q => q.displayNumber === displayNumber);
49
- 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) || [];
50
- const correctOptionIds = options === null || options === void 0 ? void 0 : options.filter(o => o.correct).map(o => o.id);
51
- return { correctOptionIds, scoreValue };
52
- };
53
- //# sourceMappingURL=DNDTitleAndDroppable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DNDTitleAndDroppable.js","sourceRoot":"","sources":["../../../src/components/shared/DNDTitleAndDroppable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,mCAAmC,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/F,OAAO,4BAA4B,MAAM,uCAAuC,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,OAAO,EACP,gBAAgB,EAChB,OAAO,EACP,IAAI,EACJ,oBAAoB,EAOrB,EAAE,EAAE;;IACH,MAAM,EAAE,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAClC,MAAM,UAAU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