@pie-element/ebsr 11.0.0 → 12.0.1-esmbeta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +1972 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +4186 -0
- package/configure/node_modules/@pie-element/multiple-choice/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +35 -0
- package/configure/node_modules/@pie-element/multiple-choice/README.md +56 -0
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +1387 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +3332 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +202 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +248 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +597 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +20 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +527 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +2297 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +34 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +346 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +28 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +15 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +2993 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +2217 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +61 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +7 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +1332 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +1015 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js +1218 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js +324 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.js +3287 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.js +3017 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +427 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +252 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +174 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +388 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +108 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +469 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +129 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +48 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +3472 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +86 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/element.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/index.html +21 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/index.js +2 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +10 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +124 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print.html +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/package.json +53 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.md +898 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js +262 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js +88 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js +181 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js +66 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/package.json +44 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/__tests__/index.test.jsx +99 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/expander.jsx +61 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/index.jsx +98 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/styles.js +61 -0
- package/configure/node_modules/@pie-lib/icons/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/icons/CHANGELOG.md +539 -0
- package/configure/node_modules/@pie-lib/icons/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/icons/esm/index.js +1153 -0
- package/configure/node_modules/@pie-lib/icons/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js +89 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js +153 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-base.js +206 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-base.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-root.js +130 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-root.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js +92 -0
- package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/index.js +72 -0
- package/configure/node_modules/@pie-lib/icons/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js +229 -0
- package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js +145 -0
- package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js +183 -0
- package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js +82 -0
- package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js +206 -0
- package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/sized.js +41 -0
- package/configure/node_modules/@pie-lib/icons/lib/sized.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/package.json +35 -0
- package/configure/node_modules/@pie-lib/icons/src/__tests__/index.test.js +3 -0
- package/configure/node_modules/@pie-lib/icons/src/correct-icon.jsx +64 -0
- package/configure/node_modules/@pie-lib/icons/src/correct-response-icon.jsx +121 -0
- package/configure/node_modules/@pie-lib/icons/src/icon-base.jsx +158 -0
- package/configure/node_modules/@pie-lib/icons/src/icon-root.jsx +76 -0
- package/configure/node_modules/@pie-lib/icons/src/incorrect-icon.jsx +61 -0
- package/configure/node_modules/@pie-lib/icons/src/index.js +19 -0
- package/configure/node_modules/@pie-lib/icons/src/instructions-icon.jsx +189 -0
- package/configure/node_modules/@pie-lib/icons/src/learn-more-icon.jsx +107 -0
- package/configure/node_modules/@pie-lib/icons/src/nothing-submitted-icon.jsx +130 -0
- package/configure/node_modules/@pie-lib/icons/src/partially-correct-icon.jsx +49 -0
- package/configure/node_modules/@pie-lib/icons/src/show-rationale-icon.jsx +152 -0
- package/configure/node_modules/@pie-lib/icons/src/sized.jsx +25 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +775 -0
- package/configure/node_modules/@pie-lib/math-rendering/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/esm/index.js +690 -0
- package/configure/node_modules/@pie-lib/math-rendering/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +38 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js +15 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +296 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +23 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +109 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +95 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +438 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/package.json +28 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/mml-to-latex.test.js +14 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/normalization.test.js +50 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/render-math.test.js +155 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +5 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mml-to-latex.js +2 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/__snapshots__/chtml.test.js.snap +9 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/chtml.test.js +104 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +220 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +13 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +24 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +69 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +387 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +1026 -0
- package/configure/node_modules/@pie-lib/render-ui/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/render-ui/esm/index.js +1616 -0
- package/configure/node_modules/@pie-lib/render-ui/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js +88 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js +9 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +135 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +344 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +150 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js +27 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +74 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +136 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +60 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +145 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +321 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +151 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js +122 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +181 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/package.json +40 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/html-and-math.test.js.snap +11 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/preview-prompt.test.jsx.snap +37 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/purpose.test.jsx.snap +42 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/readable.test.jsx.snap +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/response-indicators.test.jsx.snap +27 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/color.test.js +12 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-media.test.js +20 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-text.test.js +21 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/html-and-math.test.js +24 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/preview-prompt.test.jsx +56 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/purpose.test.jsx +47 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/readable.test.jsx +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/response-indicators.test.jsx +16 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/ui-layout.test.jsx +34 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/withUndoReset.test.jsx +254 -0
- package/configure/node_modules/@pie-lib/render-ui/src/append-css-rules.js +51 -0
- package/configure/node_modules/@pie-lib/render-ui/src/assets/enableAudioAutoplayImage.js +1 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/__snapshots__/index.test.jsx.snap +18 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/index.test.jsx +13 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +121 -0
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +99 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-media.js +16 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +18 -0
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +21 -0
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +35 -0
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +41 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +95 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +254 -0
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +17 -0
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +19 -0
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +89 -0
- package/configure/node_modules/@pie-lib/render-ui/src/ui-layout.jsx +66 -0
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +116 -0
- package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.md +410 -0
- package/configure/node_modules/@pie-lib/test-utils/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/test-utils/esm/index.js +39 -0
- package/configure/node_modules/@pie-lib/test-utils/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/test-utils/lib/index.js +40 -0
- package/configure/node_modules/@pie-lib/test-utils/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/test-utils/package.json +25 -0
- package/configure/node_modules/@pie-lib/test-utils/src/__tests__/index.test.js +45 -0
- package/configure/node_modules/@pie-lib/test-utils/src/index.js +18 -0
- package/configure/node_modules/@pie-lib/translator/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/translator/CHANGELOG.md +282 -0
- package/configure/node_modules/@pie-lib/translator/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/translator/esm/index.js +257 -0
- package/configure/node_modules/@pie-lib/translator/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/en.js +102 -0
- package/configure/node_modules/@pie-lib/translator/lib/en.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/es.js +102 -0
- package/configure/node_modules/@pie-lib/translator/lib/es.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/index.js +69 -0
- package/configure/node_modules/@pie-lib/translator/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/package.json +25 -0
- package/configure/node_modules/@pie-lib/translator/src/en.js +99 -0
- package/configure/node_modules/@pie-lib/translator/src/es.js +99 -0
- package/configure/node_modules/@pie-lib/translator/src/index.js +43 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +3 -3
- package/esm/configure.js +38602 -0
- package/esm/configure.js.map +1 -0
- package/esm/controller.js +3358 -0
- package/esm/controller.js.map +1 -0
- package/esm/element.js +2203 -0
- package/esm/element.js.map +1 -0
- package/esm/package.json +4 -0
- package/esm/print.js +4090 -0
- package/esm/print.js.map +1 -0
- package/module/controller.js +4973 -2252
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +24 -6
|
@@ -0,0 +1,1218 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import debug from 'debug';
|
|
4
|
+
import { ModelUpdatedEvent, InsertImageEvent, DeleteImageEvent, InsertSoundEvent, DeleteSoundEvent } from '@pie-framework/pie-configure-events';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import EditableHtml from '@pie-lib/editable-html';
|
|
7
|
+
import { layout, InputContainer, ChoiceConfiguration, choiceUtils, AlertDialog, settings } from '@pie-lib/config-ui';
|
|
8
|
+
import { color } from '@pie-lib/render-ui';
|
|
9
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
10
|
+
import Button from '@material-ui/core/Button';
|
|
11
|
+
import Tooltip from '@material-ui/core/Tooltip';
|
|
12
|
+
import Typography from '@material-ui/core/Typography';
|
|
13
|
+
import require$$3 from '@material-ui/core/SvgIcon';
|
|
14
|
+
import merge from 'lodash/merge';
|
|
15
|
+
import defaults from 'lodash/defaults';
|
|
16
|
+
|
|
17
|
+
function _extends() {
|
|
18
|
+
_extends = Object.assign || function (target) {
|
|
19
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
20
|
+
var source = arguments[i];
|
|
21
|
+
|
|
22
|
+
for (var key in source) {
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
24
|
+
target[key] = source[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return target;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return _extends.apply(this, arguments);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var Info = {};
|
|
36
|
+
|
|
37
|
+
var interopRequireDefault = {exports: {}};
|
|
38
|
+
|
|
39
|
+
(function (module) {
|
|
40
|
+
function _interopRequireDefault(obj) {
|
|
41
|
+
return obj && obj.__esModule ? obj : {
|
|
42
|
+
"default": obj
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
47
|
+
}(interopRequireDefault));
|
|
48
|
+
|
|
49
|
+
var createSvgIcon$1 = {};
|
|
50
|
+
|
|
51
|
+
var pure$1 = {};
|
|
52
|
+
|
|
53
|
+
var shouldUpdate$1 = {};
|
|
54
|
+
|
|
55
|
+
var inheritsLoose = {exports: {}};
|
|
56
|
+
|
|
57
|
+
var setPrototypeOf = {exports: {}};
|
|
58
|
+
|
|
59
|
+
(function (module) {
|
|
60
|
+
function _setPrototypeOf(o, p) {
|
|
61
|
+
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
62
|
+
o.__proto__ = p;
|
|
63
|
+
return o;
|
|
64
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
65
|
+
return _setPrototypeOf(o, p);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
69
|
+
}(setPrototypeOf));
|
|
70
|
+
|
|
71
|
+
(function (module) {
|
|
72
|
+
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
73
|
+
|
|
74
|
+
function _inheritsLoose(subClass, superClass) {
|
|
75
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
76
|
+
subClass.prototype.constructor = subClass;
|
|
77
|
+
setPrototypeOf$1(subClass, superClass);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
81
|
+
}(inheritsLoose));
|
|
82
|
+
|
|
83
|
+
var setDisplayName$1 = {};
|
|
84
|
+
|
|
85
|
+
var setStatic$1 = {};
|
|
86
|
+
|
|
87
|
+
setStatic$1.__esModule = true;
|
|
88
|
+
setStatic$1.default = void 0;
|
|
89
|
+
|
|
90
|
+
var setStatic = function setStatic(key, value) {
|
|
91
|
+
return function (BaseComponent) {
|
|
92
|
+
/* eslint-disable no-param-reassign */
|
|
93
|
+
BaseComponent[key] = value;
|
|
94
|
+
/* eslint-enable no-param-reassign */
|
|
95
|
+
|
|
96
|
+
return BaseComponent;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var _default$8 = setStatic;
|
|
101
|
+
setStatic$1.default = _default$8;
|
|
102
|
+
|
|
103
|
+
var _interopRequireDefault$6 = interopRequireDefault.exports;
|
|
104
|
+
|
|
105
|
+
setDisplayName$1.__esModule = true;
|
|
106
|
+
setDisplayName$1.default = void 0;
|
|
107
|
+
|
|
108
|
+
var _setStatic = _interopRequireDefault$6(setStatic$1);
|
|
109
|
+
|
|
110
|
+
var setDisplayName = function setDisplayName(displayName) {
|
|
111
|
+
return (0, _setStatic.default)('displayName', displayName);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var _default$7 = setDisplayName;
|
|
115
|
+
setDisplayName$1.default = _default$7;
|
|
116
|
+
|
|
117
|
+
var wrapDisplayName$1 = {};
|
|
118
|
+
|
|
119
|
+
var getDisplayName$1 = {};
|
|
120
|
+
|
|
121
|
+
getDisplayName$1.__esModule = true;
|
|
122
|
+
getDisplayName$1.default = void 0;
|
|
123
|
+
|
|
124
|
+
var getDisplayName = function getDisplayName(Component) {
|
|
125
|
+
if (typeof Component === 'string') {
|
|
126
|
+
return Component;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (!Component) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return Component.displayName || Component.name || 'Component';
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
var _default$6 = getDisplayName;
|
|
137
|
+
getDisplayName$1.default = _default$6;
|
|
138
|
+
|
|
139
|
+
var _interopRequireDefault$5 = interopRequireDefault.exports;
|
|
140
|
+
|
|
141
|
+
wrapDisplayName$1.__esModule = true;
|
|
142
|
+
wrapDisplayName$1.default = void 0;
|
|
143
|
+
|
|
144
|
+
var _getDisplayName = _interopRequireDefault$5(getDisplayName$1);
|
|
145
|
+
|
|
146
|
+
var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
|
|
147
|
+
return hocName + "(" + (0, _getDisplayName.default)(BaseComponent) + ")";
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
var _default$5 = wrapDisplayName;
|
|
151
|
+
wrapDisplayName$1.default = _default$5;
|
|
152
|
+
|
|
153
|
+
var _interopRequireDefault$4 = interopRequireDefault.exports;
|
|
154
|
+
|
|
155
|
+
shouldUpdate$1.__esModule = true;
|
|
156
|
+
shouldUpdate$1.default = void 0;
|
|
157
|
+
|
|
158
|
+
var _inheritsLoose2 = _interopRequireDefault$4(inheritsLoose.exports);
|
|
159
|
+
|
|
160
|
+
var _react$2 = React;
|
|
161
|
+
|
|
162
|
+
var _setDisplayName$1 = _interopRequireDefault$4(setDisplayName$1);
|
|
163
|
+
|
|
164
|
+
var _wrapDisplayName$1 = _interopRequireDefault$4(wrapDisplayName$1);
|
|
165
|
+
|
|
166
|
+
var shouldUpdate = function shouldUpdate(test) {
|
|
167
|
+
return function (BaseComponent) {
|
|
168
|
+
var factory = (0, _react$2.createFactory)(BaseComponent);
|
|
169
|
+
|
|
170
|
+
var ShouldUpdate =
|
|
171
|
+
/*#__PURE__*/
|
|
172
|
+
function (_Component) {
|
|
173
|
+
(0, _inheritsLoose2.default)(ShouldUpdate, _Component);
|
|
174
|
+
|
|
175
|
+
function ShouldUpdate() {
|
|
176
|
+
return _Component.apply(this, arguments) || this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
var _proto = ShouldUpdate.prototype;
|
|
180
|
+
|
|
181
|
+
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
182
|
+
return test(this.props, nextProps);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
_proto.render = function render() {
|
|
186
|
+
return factory(this.props);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
return ShouldUpdate;
|
|
190
|
+
}(_react$2.Component);
|
|
191
|
+
|
|
192
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
193
|
+
return (0, _setDisplayName$1.default)((0, _wrapDisplayName$1.default)(BaseComponent, 'shouldUpdate'))(ShouldUpdate);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return ShouldUpdate;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
var _default$4 = shouldUpdate;
|
|
201
|
+
shouldUpdate$1.default = _default$4;
|
|
202
|
+
|
|
203
|
+
var shallowEqual$1 = {};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
207
|
+
*
|
|
208
|
+
* This source code is licensed under the MIT license found in the
|
|
209
|
+
* LICENSE file in the root directory of this source tree.
|
|
210
|
+
*
|
|
211
|
+
* @typechecks
|
|
212
|
+
*
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
219
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
220
|
+
*/
|
|
221
|
+
function is(x, y) {
|
|
222
|
+
// SameValue algorithm
|
|
223
|
+
if (x === y) {
|
|
224
|
+
// Steps 1-5, 7-10
|
|
225
|
+
// Steps 6.b-6.e: +0 != -0
|
|
226
|
+
// Added the nonzero y check to make Flow happy, but it is redundant
|
|
227
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
228
|
+
} else {
|
|
229
|
+
// Step 6.a: NaN == NaN
|
|
230
|
+
return x !== x && y !== y;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Performs equality by iterating through keys on an object and returning false
|
|
236
|
+
* when any key has values which are not strictly equal between the arguments.
|
|
237
|
+
* Returns true when the values of all keys are strictly equal.
|
|
238
|
+
*/
|
|
239
|
+
function shallowEqual(objA, objB) {
|
|
240
|
+
if (is(objA, objB)) {
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
var keysA = Object.keys(objA);
|
|
249
|
+
var keysB = Object.keys(objB);
|
|
250
|
+
|
|
251
|
+
if (keysA.length !== keysB.length) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Test for A's keys different from B.
|
|
256
|
+
for (var i = 0; i < keysA.length; i++) {
|
|
257
|
+
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var shallowEqual_1 = shallowEqual;
|
|
266
|
+
|
|
267
|
+
var _interopRequireDefault$3 = interopRequireDefault.exports;
|
|
268
|
+
|
|
269
|
+
shallowEqual$1.__esModule = true;
|
|
270
|
+
shallowEqual$1.default = void 0;
|
|
271
|
+
|
|
272
|
+
var _shallowEqual$1 = _interopRequireDefault$3(shallowEqual_1);
|
|
273
|
+
|
|
274
|
+
var _default$3 = _shallowEqual$1.default;
|
|
275
|
+
shallowEqual$1.default = _default$3;
|
|
276
|
+
|
|
277
|
+
var _interopRequireDefault$2 = interopRequireDefault.exports;
|
|
278
|
+
|
|
279
|
+
pure$1.__esModule = true;
|
|
280
|
+
pure$1.default = void 0;
|
|
281
|
+
|
|
282
|
+
var _shouldUpdate = _interopRequireDefault$2(shouldUpdate$1);
|
|
283
|
+
|
|
284
|
+
var _shallowEqual = _interopRequireDefault$2(shallowEqual$1);
|
|
285
|
+
|
|
286
|
+
var _setDisplayName = _interopRequireDefault$2(setDisplayName$1);
|
|
287
|
+
|
|
288
|
+
var _wrapDisplayName = _interopRequireDefault$2(wrapDisplayName$1);
|
|
289
|
+
|
|
290
|
+
var pure = function pure(BaseComponent) {
|
|
291
|
+
var hoc = (0, _shouldUpdate.default)(function (props, nextProps) {
|
|
292
|
+
return !(0, _shallowEqual.default)(props, nextProps);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
296
|
+
return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return hoc(BaseComponent);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
var _default$2 = pure;
|
|
303
|
+
pure$1.default = _default$2;
|
|
304
|
+
|
|
305
|
+
var _interopRequireDefault$1 = interopRequireDefault.exports;
|
|
306
|
+
|
|
307
|
+
Object.defineProperty(createSvgIcon$1, "__esModule", {
|
|
308
|
+
value: true
|
|
309
|
+
});
|
|
310
|
+
createSvgIcon$1.default = void 0;
|
|
311
|
+
|
|
312
|
+
var _react$1 = _interopRequireDefault$1(React);
|
|
313
|
+
|
|
314
|
+
var _pure = _interopRequireDefault$1(pure$1);
|
|
315
|
+
|
|
316
|
+
var _SvgIcon = _interopRequireDefault$1(require$$3);
|
|
317
|
+
|
|
318
|
+
function createSvgIcon(path, displayName) {
|
|
319
|
+
var Icon = function Icon(props) {
|
|
320
|
+
return _react$1.default.createElement(_SvgIcon.default, props, path);
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
Icon.displayName = "".concat(displayName, "Icon");
|
|
324
|
+
Icon = (0, _pure.default)(Icon);
|
|
325
|
+
Icon.muiName = 'SvgIcon';
|
|
326
|
+
return Icon;
|
|
327
|
+
}
|
|
328
|
+
var _default$1 = createSvgIcon;
|
|
329
|
+
createSvgIcon$1.default = _default$1;
|
|
330
|
+
|
|
331
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
332
|
+
|
|
333
|
+
Object.defineProperty(Info, "__esModule", {
|
|
334
|
+
value: true
|
|
335
|
+
});
|
|
336
|
+
var default_1 = Info.default = void 0;
|
|
337
|
+
|
|
338
|
+
var _react = _interopRequireDefault(React);
|
|
339
|
+
|
|
340
|
+
var _createSvgIcon = _interopRequireDefault(createSvgIcon$1);
|
|
341
|
+
|
|
342
|
+
var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
|
|
343
|
+
fill: "none",
|
|
344
|
+
d: "M0 0h24v24H0z"
|
|
345
|
+
}), _react.default.createElement("path", {
|
|
346
|
+
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
347
|
+
})), 'Info');
|
|
348
|
+
|
|
349
|
+
default_1 = Info.default = _default;
|
|
350
|
+
|
|
351
|
+
const generateValidationMessage = config => {
|
|
352
|
+
const {
|
|
353
|
+
minAnswerChoices,
|
|
354
|
+
maxAnswerChoices
|
|
355
|
+
} = config;
|
|
356
|
+
const answerChoicesMessage = `\nThere should be at least ${minAnswerChoices} ` + (maxAnswerChoices ? `and at most ${maxAnswerChoices} ` : '') + 'answer choices defined.' + '\nEvery answer choice should be non-blank and unique.';
|
|
357
|
+
const correctAnswerMessage = '\nA correct answer must be defined.';
|
|
358
|
+
const message = 'Validation requirements:' + answerChoicesMessage + correctAnswerMessage;
|
|
359
|
+
return message;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
const {
|
|
363
|
+
Panel,
|
|
364
|
+
toggle,
|
|
365
|
+
radio,
|
|
366
|
+
dropdown
|
|
367
|
+
} = settings;
|
|
368
|
+
const MAX_CHOICES = 9;
|
|
369
|
+
|
|
370
|
+
const styles = theme => ({
|
|
371
|
+
promptHolder: {
|
|
372
|
+
width: '100%',
|
|
373
|
+
paddingTop: theme.spacing.unit * 2,
|
|
374
|
+
marginBottom: theme.spacing.unit * 2
|
|
375
|
+
},
|
|
376
|
+
rationaleHolder: {
|
|
377
|
+
flex: 1,
|
|
378
|
+
marginTop: theme.spacing.unit * 1.5,
|
|
379
|
+
paddingTop: theme.spacing.unit * 2,
|
|
380
|
+
marginLeft: theme.spacing.unit * 3.5
|
|
381
|
+
},
|
|
382
|
+
choiceConfigurationHolder: {
|
|
383
|
+
display: 'flex',
|
|
384
|
+
flexDirection: 'column',
|
|
385
|
+
marginBottom: theme.spacing.unit
|
|
386
|
+
},
|
|
387
|
+
choiceConfiguration: {
|
|
388
|
+
width: '100%'
|
|
389
|
+
},
|
|
390
|
+
switchElement: {
|
|
391
|
+
justifyContent: 'space-between',
|
|
392
|
+
margin: 0
|
|
393
|
+
},
|
|
394
|
+
addButton: {
|
|
395
|
+
marginTop: theme.spacing.unit,
|
|
396
|
+
float: 'right'
|
|
397
|
+
},
|
|
398
|
+
disableButton: {
|
|
399
|
+
cursor: 'not-allowed',
|
|
400
|
+
pointerEvents: 'all',
|
|
401
|
+
backgroundColor: color.disabled(),
|
|
402
|
+
'&:hover': {
|
|
403
|
+
backgroundColor: color.disabled()
|
|
404
|
+
},
|
|
405
|
+
'&:focus': {
|
|
406
|
+
backgroundColor: color.disabled()
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
flexContainer: {
|
|
410
|
+
display: 'flex',
|
|
411
|
+
alignItems: 'center'
|
|
412
|
+
},
|
|
413
|
+
titleText: {
|
|
414
|
+
fontSize: theme.typography.fontSize + 2,
|
|
415
|
+
marginRight: theme.spacing.unit
|
|
416
|
+
},
|
|
417
|
+
tooltip: {
|
|
418
|
+
fontSize: theme.typography.fontSize - 2,
|
|
419
|
+
whiteSpace: 'pre',
|
|
420
|
+
maxWidth: '500px'
|
|
421
|
+
},
|
|
422
|
+
errorText: {
|
|
423
|
+
fontSize: theme.typography.fontSize - 2,
|
|
424
|
+
color: theme.palette.error.main,
|
|
425
|
+
paddingTop: theme.spacing.unit
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
const Design = withStyles(styles)(props => {
|
|
430
|
+
var _configuration$teache, _configuration$prompt;
|
|
431
|
+
|
|
432
|
+
const {
|
|
433
|
+
classes,
|
|
434
|
+
model,
|
|
435
|
+
configuration,
|
|
436
|
+
onPromptChanged,
|
|
437
|
+
onChoiceChanged,
|
|
438
|
+
onRemoveChoice,
|
|
439
|
+
onAddChoice,
|
|
440
|
+
imageSupport,
|
|
441
|
+
uploadSoundSupport,
|
|
442
|
+
onChangeModel,
|
|
443
|
+
onConfigurationChanged,
|
|
444
|
+
onTeacherInstructionsChanged
|
|
445
|
+
} = props;
|
|
446
|
+
const {
|
|
447
|
+
addChoiceButton = {},
|
|
448
|
+
contentDimensions = {},
|
|
449
|
+
feedback = {},
|
|
450
|
+
deleteChoice = {},
|
|
451
|
+
choiceMode = {},
|
|
452
|
+
choicePrefix = {},
|
|
453
|
+
partialScoring = {},
|
|
454
|
+
lockChoiceOrder = {},
|
|
455
|
+
teacherInstructions = {},
|
|
456
|
+
studentInstructions = {},
|
|
457
|
+
rationale = {},
|
|
458
|
+
scoringType = {},
|
|
459
|
+
sequentialChoiceLabels = {},
|
|
460
|
+
settingsPanelDisabled,
|
|
461
|
+
choicesLayout,
|
|
462
|
+
spellCheck = {},
|
|
463
|
+
gridColumns,
|
|
464
|
+
maxImageWidth = {},
|
|
465
|
+
maxImageHeight = {},
|
|
466
|
+
prompt = {},
|
|
467
|
+
withRubric = {},
|
|
468
|
+
mathMlOptions = {},
|
|
469
|
+
language = {},
|
|
470
|
+
languageChoices = {}
|
|
471
|
+
} = configuration || {};
|
|
472
|
+
let {
|
|
473
|
+
maxAnswerChoices
|
|
474
|
+
} = configuration || {};
|
|
475
|
+
const {
|
|
476
|
+
limitChoicesNumber,
|
|
477
|
+
teacherInstructionsEnabled,
|
|
478
|
+
rationaleEnabled,
|
|
479
|
+
feedbackEnabled,
|
|
480
|
+
promptEnabled,
|
|
481
|
+
spellCheckEnabled,
|
|
482
|
+
choices,
|
|
483
|
+
errors,
|
|
484
|
+
toolbarEditorPosition,
|
|
485
|
+
extraCSSRules
|
|
486
|
+
} = model || {};
|
|
487
|
+
const {
|
|
488
|
+
answerChoices: answerChoicesError,
|
|
489
|
+
choices: choicesErrors,
|
|
490
|
+
correctResponse: correctResponseError,
|
|
491
|
+
prompt: promptError,
|
|
492
|
+
rationale: rationaleErrors,
|
|
493
|
+
teacherInstructions: teacherInstructionsError
|
|
494
|
+
} = errors || {};
|
|
495
|
+
const nrOfColumnsAvailable = choices != null && choices.length ? Array.from({
|
|
496
|
+
length: choices.length
|
|
497
|
+
}, (_, i) => `${i + 1}`) : [];
|
|
498
|
+
const {
|
|
499
|
+
baseInputConfiguration = {}
|
|
500
|
+
} = configuration;
|
|
501
|
+
const toolbarOpts = {
|
|
502
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
503
|
+
}; // if old property is used, set maxAnswerChoices to 9
|
|
504
|
+
|
|
505
|
+
if (limitChoicesNumber) {
|
|
506
|
+
maxAnswerChoices = MAX_CHOICES;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
const getPluginProps = (props = {}) => _extends({}, baseInputConfiguration, props);
|
|
510
|
+
|
|
511
|
+
const validationMessage = generateValidationMessage(configuration);
|
|
512
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
513
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
514
|
+
const addChoiceButtonTooltip = maxAnswerChoices && (choices == null ? void 0 : choices.length) >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '';
|
|
515
|
+
const panelSettings = {
|
|
516
|
+
choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),
|
|
517
|
+
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
518
|
+
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
519
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
520
|
+
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
521
|
+
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
522
|
+
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
523
|
+
gridColumns: choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 && dropdown(gridColumns.label, nrOfColumnsAvailable),
|
|
524
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
525
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
526
|
+
};
|
|
527
|
+
const panelProperties = {
|
|
528
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
529
|
+
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
530
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
531
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
532
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
533
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
534
|
+
rubricEnabled: (withRubric == null ? void 0 : withRubric.settings) && toggle(withRubric == null ? void 0 : withRubric.label)
|
|
535
|
+
};
|
|
536
|
+
return /*#__PURE__*/React.createElement(layout.ConfigLayout, {
|
|
537
|
+
dimensions: contentDimensions,
|
|
538
|
+
hideSettings: settingsPanelDisabled,
|
|
539
|
+
extraCSSRules: extraCSSRules,
|
|
540
|
+
settings: /*#__PURE__*/React.createElement(Panel, {
|
|
541
|
+
model: model,
|
|
542
|
+
onChangeModel: onChangeModel,
|
|
543
|
+
configuration: configuration,
|
|
544
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
545
|
+
groups: {
|
|
546
|
+
Settings: panelSettings,
|
|
547
|
+
Properties: panelProperties
|
|
548
|
+
}
|
|
549
|
+
})
|
|
550
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/React.createElement(InputContainer, {
|
|
551
|
+
label: teacherInstructions.label,
|
|
552
|
+
className: classes.promptHolder
|
|
553
|
+
}, /*#__PURE__*/React.createElement(EditableHtml, {
|
|
554
|
+
className: classes.prompt,
|
|
555
|
+
markup: model.teacherInstructions || '',
|
|
556
|
+
onChange: onTeacherInstructionsChanged,
|
|
557
|
+
imageSupport: imageSupport,
|
|
558
|
+
nonEmpty: false,
|
|
559
|
+
error: teacherInstructionsError,
|
|
560
|
+
toolbarOpts: toolbarOpts,
|
|
561
|
+
pluginProps: getPluginProps(configuration == null ? void 0 : (_configuration$teache = configuration.teacherInstructions) == null ? void 0 : _configuration$teache.inputConfiguration),
|
|
562
|
+
spellCheck: spellCheckEnabled,
|
|
563
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
564
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
565
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
566
|
+
languageCharactersProps: [{
|
|
567
|
+
language: 'spanish'
|
|
568
|
+
}, {
|
|
569
|
+
language: 'special'
|
|
570
|
+
}],
|
|
571
|
+
mathMlOptions: mathMlOptions
|
|
572
|
+
}), teacherInstructionsError && /*#__PURE__*/React.createElement("div", {
|
|
573
|
+
className: classes.errorText
|
|
574
|
+
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/React.createElement(InputContainer, {
|
|
575
|
+
label: prompt.label,
|
|
576
|
+
className: classes.promptHolder
|
|
577
|
+
}, /*#__PURE__*/React.createElement(EditableHtml, {
|
|
578
|
+
className: classes.prompt,
|
|
579
|
+
markup: model.prompt,
|
|
580
|
+
onChange: onPromptChanged,
|
|
581
|
+
imageSupport: imageSupport,
|
|
582
|
+
nonEmpty: false,
|
|
583
|
+
disableUnderline: true,
|
|
584
|
+
error: promptError,
|
|
585
|
+
toolbarOpts: toolbarOpts,
|
|
586
|
+
pluginProps: getPluginProps(configuration == null ? void 0 : (_configuration$prompt = configuration.prompt) == null ? void 0 : _configuration$prompt.inputConfiguration),
|
|
587
|
+
spellCheck: spellCheckEnabled,
|
|
588
|
+
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
589
|
+
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
590
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
591
|
+
languageCharactersProps: [{
|
|
592
|
+
language: 'spanish'
|
|
593
|
+
}, {
|
|
594
|
+
language: 'special'
|
|
595
|
+
}],
|
|
596
|
+
mathMlOptions: mathMlOptions
|
|
597
|
+
}), promptError && /*#__PURE__*/React.createElement("div", {
|
|
598
|
+
className: classes.errorText
|
|
599
|
+
}, promptError)), /*#__PURE__*/React.createElement("div", {
|
|
600
|
+
className: classes.flexContainer
|
|
601
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
602
|
+
className: classes.titleText,
|
|
603
|
+
component: 'div'
|
|
604
|
+
}, "Choices"), /*#__PURE__*/React.createElement(Tooltip, {
|
|
605
|
+
classes: {
|
|
606
|
+
tooltip: classes.tooltip
|
|
607
|
+
},
|
|
608
|
+
disableFocusListener: true,
|
|
609
|
+
disableTouchListener: true,
|
|
610
|
+
placement: 'right',
|
|
611
|
+
title: validationMessage
|
|
612
|
+
}, /*#__PURE__*/React.createElement(default_1, {
|
|
613
|
+
fontSize: 'small',
|
|
614
|
+
color: 'primary'
|
|
615
|
+
}))), choices.map((choice, index) => {
|
|
616
|
+
var _configuration$choice, _configuration$ration;
|
|
617
|
+
|
|
618
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
619
|
+
key: `choice-${index}`,
|
|
620
|
+
className: classes.choiceConfigurationHolder
|
|
621
|
+
}, /*#__PURE__*/React.createElement(ChoiceConfiguration, {
|
|
622
|
+
key: index,
|
|
623
|
+
index: index + 1,
|
|
624
|
+
useLetterOrdering: model.choicePrefix === 'letters',
|
|
625
|
+
className: classes.choiceConfiguration,
|
|
626
|
+
mode: model.choiceMode,
|
|
627
|
+
data: choice,
|
|
628
|
+
defaultFeedback: {},
|
|
629
|
+
imageSupport: imageSupport,
|
|
630
|
+
disableImageAlignmentButtons: true,
|
|
631
|
+
onDelete: () => onRemoveChoice(index),
|
|
632
|
+
onChange: c => onChoiceChanged(index, c),
|
|
633
|
+
allowFeedBack: feedbackEnabled,
|
|
634
|
+
allowDelete: deleteChoice.settings,
|
|
635
|
+
noLabels: true,
|
|
636
|
+
pluginOpts: getPluginProps(configuration == null ? void 0 : (_configuration$choice = configuration.choices) == null ? void 0 : _configuration$choice.inputConfiguration),
|
|
637
|
+
toolbarOpts: toolbarOpts,
|
|
638
|
+
spellCheck: spellCheckEnabled,
|
|
639
|
+
error: (choicesErrors == null ? void 0 : choicesErrors[choice.value]) || null,
|
|
640
|
+
noCorrectAnswerError: correctResponseError,
|
|
641
|
+
maxImageWidth: maxImageWidth && maxImageWidth.choices || defaultImageMaxWidth,
|
|
642
|
+
maxImageHeight: maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight,
|
|
643
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
644
|
+
mathMlOptions: mathMlOptions
|
|
645
|
+
}), rationaleEnabled && /*#__PURE__*/React.createElement(InputContainer, {
|
|
646
|
+
key: `rationale-${index}`,
|
|
647
|
+
label: rationale.label,
|
|
648
|
+
className: classes.rationaleHolder
|
|
649
|
+
}, /*#__PURE__*/React.createElement(EditableHtml, {
|
|
650
|
+
className: classes.rationale,
|
|
651
|
+
markup: choice.rationale || '',
|
|
652
|
+
onChange: c => onChoiceChanged(index, _extends({}, choice, {
|
|
653
|
+
rationale: c
|
|
654
|
+
})),
|
|
655
|
+
imageSupport: imageSupport,
|
|
656
|
+
error: (rationaleErrors == null ? void 0 : rationaleErrors[choice.value]) || null,
|
|
657
|
+
toolbarOpts: toolbarOpts,
|
|
658
|
+
pluginProps: getPluginProps(configuration == null ? void 0 : (_configuration$ration = configuration.rationale) == null ? void 0 : _configuration$ration.inputConfiguration),
|
|
659
|
+
spellCheck: spellCheckEnabled,
|
|
660
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
661
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
662
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
663
|
+
languageCharactersProps: [{
|
|
664
|
+
language: 'spanish'
|
|
665
|
+
}, {
|
|
666
|
+
language: 'special'
|
|
667
|
+
}],
|
|
668
|
+
mathMlOptions: mathMlOptions
|
|
669
|
+
}), (rationaleErrors == null ? void 0 : rationaleErrors[choice.value]) && /*#__PURE__*/React.createElement("div", {
|
|
670
|
+
className: classes.errorText
|
|
671
|
+
}, rationaleErrors == null ? void 0 : rationaleErrors[choice.value])));
|
|
672
|
+
}), correctResponseError && /*#__PURE__*/React.createElement("div", {
|
|
673
|
+
className: classes.errorText
|
|
674
|
+
}, correctResponseError), answerChoicesError && /*#__PURE__*/React.createElement("div", {
|
|
675
|
+
className: classes.errorText
|
|
676
|
+
}, answerChoicesError), addChoiceButton.settings && /*#__PURE__*/React.createElement(Tooltip, {
|
|
677
|
+
title: addChoiceButtonTooltip,
|
|
678
|
+
classes: {
|
|
679
|
+
tooltip: classes.tooltip
|
|
680
|
+
}
|
|
681
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
682
|
+
classes: {
|
|
683
|
+
root: maxAnswerChoices && (choices == null ? void 0 : choices.length) >= maxAnswerChoices && classes.disableButton
|
|
684
|
+
},
|
|
685
|
+
className: classes.addButton,
|
|
686
|
+
variant: "contained",
|
|
687
|
+
color: "primary",
|
|
688
|
+
onClick: onAddChoice
|
|
689
|
+
}, addChoiceButton.label)));
|
|
690
|
+
});
|
|
691
|
+
class Main extends React.Component {
|
|
692
|
+
constructor(...args) {
|
|
693
|
+
super(...args);
|
|
694
|
+
this.state = {
|
|
695
|
+
showWarning: false
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
this.onRemoveChoice = index => {
|
|
699
|
+
const {
|
|
700
|
+
model,
|
|
701
|
+
configuration,
|
|
702
|
+
onModelChanged
|
|
703
|
+
} = this.props;
|
|
704
|
+
const {
|
|
705
|
+
minAnswerChoices
|
|
706
|
+
} = configuration || {};
|
|
707
|
+
|
|
708
|
+
if (minAnswerChoices && model.choices.length === minAnswerChoices) {
|
|
709
|
+
this.setState({
|
|
710
|
+
showWarning: true
|
|
711
|
+
});
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
model.choices.splice(index, 1);
|
|
716
|
+
onModelChanged(model);
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
this.onAddChoice = () => {
|
|
720
|
+
const {
|
|
721
|
+
model,
|
|
722
|
+
configuration,
|
|
723
|
+
onModelChanged
|
|
724
|
+
} = this.props;
|
|
725
|
+
let {
|
|
726
|
+
maxAnswerChoices
|
|
727
|
+
} = configuration || {};
|
|
728
|
+
const {
|
|
729
|
+
limitChoicesNumber
|
|
730
|
+
} = model || {}; // if old property is used, set maxAnswerChoices to 9
|
|
731
|
+
|
|
732
|
+
if (limitChoicesNumber) {
|
|
733
|
+
maxAnswerChoices = MAX_CHOICES;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
model.choices.push({
|
|
741
|
+
label: '',
|
|
742
|
+
value: choiceUtils.firstAvailableIndex(model.choices.map(c => c.value), 0),
|
|
743
|
+
feedback: {
|
|
744
|
+
type: 'none'
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
onModelChanged(model);
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
this.onChoiceChanged = (index, choice) => {
|
|
751
|
+
const {
|
|
752
|
+
model,
|
|
753
|
+
onModelChanged
|
|
754
|
+
} = this.props;
|
|
755
|
+
|
|
756
|
+
if (choice.correct && model.choiceMode === 'radio') {
|
|
757
|
+
model.choices = model.choices.map(c => merge({}, c, {
|
|
758
|
+
correct: false
|
|
759
|
+
}));
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
model.choices.splice(index, 1, choice);
|
|
763
|
+
onModelChanged(model);
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
this.onPromptChanged = prompt => {
|
|
767
|
+
this.props.onModelChanged(_extends({}, this.props.model, {
|
|
768
|
+
prompt
|
|
769
|
+
}));
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
this.onTeacherInstructionsChanged = teacherInstructions => {
|
|
773
|
+
this.props.onModelChanged(_extends({}, this.props.model, {
|
|
774
|
+
teacherInstructions
|
|
775
|
+
}));
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
this.onModelChanged = (model, key) => {
|
|
779
|
+
const {
|
|
780
|
+
onModelChanged
|
|
781
|
+
} = this.props;
|
|
782
|
+
|
|
783
|
+
switch (key) {
|
|
784
|
+
case 'choiceMode':
|
|
785
|
+
{
|
|
786
|
+
let value = model.choiceMode;
|
|
787
|
+
|
|
788
|
+
if (value === 'radio') {
|
|
789
|
+
let correctFound = false;
|
|
790
|
+
model.choices = model.choices.map(c => {
|
|
791
|
+
if (correctFound) {
|
|
792
|
+
c.correct = false;
|
|
793
|
+
return c;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
if (c.correct) {
|
|
797
|
+
correctFound = true;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return c;
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
onModelChanged(model, true);
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
default:
|
|
809
|
+
onModelChanged(model);
|
|
810
|
+
break;
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
render() {
|
|
816
|
+
const {
|
|
817
|
+
configuration: {
|
|
818
|
+
minAnswerChoices
|
|
819
|
+
} = {}
|
|
820
|
+
} = this.props;
|
|
821
|
+
const {
|
|
822
|
+
showWarning
|
|
823
|
+
} = this.state;
|
|
824
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AlertDialog, {
|
|
825
|
+
open: showWarning,
|
|
826
|
+
title: "Warning",
|
|
827
|
+
text: `There can't be less than ${minAnswerChoices || 0} choices.`,
|
|
828
|
+
onConfirm: () => this.setState({
|
|
829
|
+
showWarning: false
|
|
830
|
+
})
|
|
831
|
+
}), /*#__PURE__*/React.createElement(Design, _extends({}, this.props, {
|
|
832
|
+
onChangeModel: this.onModelChanged,
|
|
833
|
+
onRemoveChoice: this.onRemoveChoice,
|
|
834
|
+
onChoiceChanged: this.onChoiceChanged,
|
|
835
|
+
onAddChoice: this.onAddChoice,
|
|
836
|
+
onPromptChanged: this.onPromptChanged,
|
|
837
|
+
onTeacherInstructionsChanged: this.onTeacherInstructionsChanged
|
|
838
|
+
})));
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
}
|
|
842
|
+
Main.propTypes = {
|
|
843
|
+
model: PropTypes.object.isRequired,
|
|
844
|
+
configuration: PropTypes.object.isRequired,
|
|
845
|
+
disableSidePanel: PropTypes.bool,
|
|
846
|
+
onModelChanged: PropTypes.func.isRequired,
|
|
847
|
+
onConfigurationChanged: PropTypes.func.isRequired,
|
|
848
|
+
classes: PropTypes.object.isRequired,
|
|
849
|
+
imageSupport: PropTypes.shape({
|
|
850
|
+
add: PropTypes.func.isRequired,
|
|
851
|
+
delete: PropTypes.func.isRequired
|
|
852
|
+
})
|
|
853
|
+
};
|
|
854
|
+
const Styled = withStyles(styles)(Main);
|
|
855
|
+
|
|
856
|
+
/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType
|
|
857
|
+
* functionalities are not defined yet - the value for those can belong to
|
|
858
|
+
* model or to configure
|
|
859
|
+
*/
|
|
860
|
+
var sensibleDefaults = {
|
|
861
|
+
model: {
|
|
862
|
+
choiceMode: 'checkbox',
|
|
863
|
+
choicePrefix: 'letters',
|
|
864
|
+
choices: [],
|
|
865
|
+
choicesLayout: 'vertical',
|
|
866
|
+
feedbackEnabled: false,
|
|
867
|
+
gridColumns: 2,
|
|
868
|
+
lockChoiceOrder: true,
|
|
869
|
+
partialScoring: true,
|
|
870
|
+
prompt: '',
|
|
871
|
+
promptEnabled: true,
|
|
872
|
+
rationale: '',
|
|
873
|
+
rationaleEnabled: true,
|
|
874
|
+
scoringType: 'auto',
|
|
875
|
+
studentInstructionsEnabled: true,
|
|
876
|
+
teacherInstructions: '',
|
|
877
|
+
teacherInstructionsEnabled: true,
|
|
878
|
+
toolbarEditorPosition: 'bottom',
|
|
879
|
+
selectedAnswerBackgroundColor: 'initial',
|
|
880
|
+
keyboardEventsEnabled: false
|
|
881
|
+
},
|
|
882
|
+
configuration: {
|
|
883
|
+
baseInputConfiguration: {
|
|
884
|
+
audio: {
|
|
885
|
+
disabled: false
|
|
886
|
+
},
|
|
887
|
+
video: {
|
|
888
|
+
disabled: false
|
|
889
|
+
},
|
|
890
|
+
image: {
|
|
891
|
+
disabled: false
|
|
892
|
+
},
|
|
893
|
+
textAlign: {
|
|
894
|
+
disabled: true
|
|
895
|
+
},
|
|
896
|
+
showParagraphs: {
|
|
897
|
+
disabled: false
|
|
898
|
+
},
|
|
899
|
+
separateParagraphs: {
|
|
900
|
+
disabled: true
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
choices: {
|
|
904
|
+
inputConfiguration: {
|
|
905
|
+
audio: {
|
|
906
|
+
disabled: false
|
|
907
|
+
},
|
|
908
|
+
video: {
|
|
909
|
+
disabled: false
|
|
910
|
+
},
|
|
911
|
+
image: {
|
|
912
|
+
disabled: false
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
spellCheck: {
|
|
917
|
+
label: 'Spellcheck',
|
|
918
|
+
settings: false,
|
|
919
|
+
enabled: true
|
|
920
|
+
},
|
|
921
|
+
choicesLayout: {
|
|
922
|
+
settings: false,
|
|
923
|
+
label: 'Choices Layout'
|
|
924
|
+
},
|
|
925
|
+
gridColumns: {
|
|
926
|
+
label: 'Grid columns'
|
|
927
|
+
},
|
|
928
|
+
answerChoiceCount: 0,
|
|
929
|
+
addChoiceButton: {
|
|
930
|
+
settings: true,
|
|
931
|
+
label: 'Add a Choice'
|
|
932
|
+
},
|
|
933
|
+
choiceMode: {
|
|
934
|
+
settings: true,
|
|
935
|
+
label: 'Response Type'
|
|
936
|
+
},
|
|
937
|
+
choicePrefix: {
|
|
938
|
+
settings: true,
|
|
939
|
+
label: 'Choice Labels'
|
|
940
|
+
},
|
|
941
|
+
deleteChoice: {
|
|
942
|
+
settings: true
|
|
943
|
+
},
|
|
944
|
+
feedback: {
|
|
945
|
+
settings: true,
|
|
946
|
+
label: 'Feedback'
|
|
947
|
+
},
|
|
948
|
+
prompt: {
|
|
949
|
+
settings: true,
|
|
950
|
+
label: 'Prompt',
|
|
951
|
+
inputConfiguration: {
|
|
952
|
+
audio: {
|
|
953
|
+
disabled: false
|
|
954
|
+
},
|
|
955
|
+
video: {
|
|
956
|
+
disabled: false
|
|
957
|
+
},
|
|
958
|
+
image: {
|
|
959
|
+
disabled: false
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
required: false
|
|
963
|
+
},
|
|
964
|
+
lockChoiceOrder: {
|
|
965
|
+
settings: true,
|
|
966
|
+
label: 'Lock Choice Order'
|
|
967
|
+
},
|
|
968
|
+
partialScoring: {
|
|
969
|
+
settings: false,
|
|
970
|
+
label: 'Allow Partial Scoring'
|
|
971
|
+
},
|
|
972
|
+
rationale: {
|
|
973
|
+
settings: true,
|
|
974
|
+
label: 'Rationale',
|
|
975
|
+
inputConfiguration: {
|
|
976
|
+
audio: {
|
|
977
|
+
disabled: true
|
|
978
|
+
},
|
|
979
|
+
video: {
|
|
980
|
+
disabled: true
|
|
981
|
+
},
|
|
982
|
+
image: {
|
|
983
|
+
disabled: false
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
required: false
|
|
987
|
+
},
|
|
988
|
+
scoringType: {
|
|
989
|
+
settings: false,
|
|
990
|
+
label: 'Scoring Type'
|
|
991
|
+
},
|
|
992
|
+
studentInstructions: {
|
|
993
|
+
settings: false,
|
|
994
|
+
label: 'Student Instructions'
|
|
995
|
+
},
|
|
996
|
+
teacherInstructions: {
|
|
997
|
+
settings: true,
|
|
998
|
+
label: 'Teacher Instructions',
|
|
999
|
+
inputConfiguration: {
|
|
1000
|
+
audio: {
|
|
1001
|
+
disabled: false
|
|
1002
|
+
},
|
|
1003
|
+
video: {
|
|
1004
|
+
disabled: false
|
|
1005
|
+
},
|
|
1006
|
+
image: {
|
|
1007
|
+
disabled: false
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
required: false
|
|
1011
|
+
},
|
|
1012
|
+
toolbarEditorPosition: {
|
|
1013
|
+
settings: false,
|
|
1014
|
+
label: 'Toolbar Editor Position'
|
|
1015
|
+
},
|
|
1016
|
+
minAnswerChoices: 2,
|
|
1017
|
+
maxAnswerChoices: 5,
|
|
1018
|
+
maxImageWidth: {
|
|
1019
|
+
teacherInstructions: 300,
|
|
1020
|
+
prompt: 300,
|
|
1021
|
+
rationale: 636,
|
|
1022
|
+
choices: 900
|
|
1023
|
+
},
|
|
1024
|
+
maxImageHeight: {
|
|
1025
|
+
teacherInstructions: 300,
|
|
1026
|
+
prompt: 300,
|
|
1027
|
+
rationale: 300,
|
|
1028
|
+
choices: 300
|
|
1029
|
+
},
|
|
1030
|
+
withRubric: {
|
|
1031
|
+
settings: false,
|
|
1032
|
+
label: 'Add Rubric'
|
|
1033
|
+
},
|
|
1034
|
+
mathMlOptions: {
|
|
1035
|
+
mmlOutput: false,
|
|
1036
|
+
mmlEditing: false
|
|
1037
|
+
},
|
|
1038
|
+
language: {
|
|
1039
|
+
settings: false,
|
|
1040
|
+
label: 'Specify Language',
|
|
1041
|
+
enabled: false
|
|
1042
|
+
},
|
|
1043
|
+
languageChoices: {
|
|
1044
|
+
label: 'Language Choices',
|
|
1045
|
+
options: []
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
const log = debug('multiple-choice:configure');
|
|
1051
|
+
|
|
1052
|
+
const generateFormattedChoices = (choices, choiceCount = 0) => {
|
|
1053
|
+
if (!choices || choices.length === 0) {
|
|
1054
|
+
let formattedChoices = [];
|
|
1055
|
+
|
|
1056
|
+
for (let i = 0; i < choiceCount; i++) {
|
|
1057
|
+
formattedChoices.push({
|
|
1058
|
+
value: `${i}`,
|
|
1059
|
+
label: '',
|
|
1060
|
+
feedback: {
|
|
1061
|
+
type: 'none',
|
|
1062
|
+
value: ''
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
return formattedChoices;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
return choices;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
const prepareCustomizationObject = (config, model) => {
|
|
1074
|
+
const configuration = defaults(config, sensibleDefaults.configuration);
|
|
1075
|
+
return {
|
|
1076
|
+
configuration,
|
|
1077
|
+
model: _extends({}, model, {
|
|
1078
|
+
choices: generateFormattedChoices(model && model.choices || [], configuration && configuration.answerChoiceCount)
|
|
1079
|
+
})
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
class MultipleChoice extends HTMLElement {
|
|
1084
|
+
constructor() {
|
|
1085
|
+
super();
|
|
1086
|
+
this._model = MultipleChoice.createDefaultModel();
|
|
1087
|
+
this._configuration = sensibleDefaults.configuration;
|
|
1088
|
+
this.onModelChanged = this.onModelChanged.bind(this);
|
|
1089
|
+
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
set model(s) {
|
|
1093
|
+
this._model = MultipleChoice.createDefaultModel(s);
|
|
1094
|
+
|
|
1095
|
+
this._render();
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
set configuration(c) {
|
|
1099
|
+
var _newConfiguration$lan;
|
|
1100
|
+
|
|
1101
|
+
const info = prepareCustomizationObject(c, this._model);
|
|
1102
|
+
this.onModelChanged(info.model);
|
|
1103
|
+
|
|
1104
|
+
const newConfiguration = _extends({}, sensibleDefaults.configuration, info.configuration);
|
|
1105
|
+
|
|
1106
|
+
this._configuration = newConfiguration; // if language:enabled is true, then the corresponding default item model should include a language value;
|
|
1107
|
+
// if it is false, then the language field should be omitted from the item model.
|
|
1108
|
+
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
1109
|
+
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
1110
|
+
|
|
1111
|
+
if (newConfiguration != null && (_newConfiguration$lan = newConfiguration.language) != null && _newConfiguration$lan.enabled) {
|
|
1112
|
+
var _newConfiguration$lan2, _newConfiguration$lan3;
|
|
1113
|
+
|
|
1114
|
+
if (newConfiguration != null && (_newConfiguration$lan2 = newConfiguration.languageChoices) != null && (_newConfiguration$lan3 = _newConfiguration$lan2.options) != null && _newConfiguration$lan3.length) {
|
|
1115
|
+
this._model.language = newConfiguration == null ? void 0 : newConfiguration.languageChoices.options[0].value;
|
|
1116
|
+
}
|
|
1117
|
+
} else if (newConfiguration.language.settings && this._model.language) {
|
|
1118
|
+
this._configuration.language.enabled = true;
|
|
1119
|
+
|
|
1120
|
+
if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
|
|
1121
|
+
this._configuration.languageChoices.options = [];
|
|
1122
|
+
} // check if the language is already included in the languageChoices.options array
|
|
1123
|
+
// and if not, then add it.
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {
|
|
1127
|
+
this._configuration.languageChoices.options.push({
|
|
1128
|
+
value: this._model.language,
|
|
1129
|
+
label: this._model.language
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
} else {
|
|
1133
|
+
delete this._model.language;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
this._render();
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
set disableSidePanel(s) {
|
|
1140
|
+
this._disableSidePanel = s;
|
|
1141
|
+
|
|
1142
|
+
this._render();
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
dispatchModelUpdated(reset) {
|
|
1146
|
+
const resetValue = !!reset;
|
|
1147
|
+
this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
onModelChanged(m, reset) {
|
|
1151
|
+
this._model = m;
|
|
1152
|
+
|
|
1153
|
+
this._render();
|
|
1154
|
+
|
|
1155
|
+
this.dispatchModelUpdated(reset);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
onConfigurationChanged(c) {
|
|
1159
|
+
this._configuration = prepareCustomizationObject(c, this._model).configuration;
|
|
1160
|
+
|
|
1161
|
+
if (this._model) {
|
|
1162
|
+
this.onModelChanged(this._model);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
this._render();
|
|
1166
|
+
}
|
|
1167
|
+
/** @param {done, progress, file} handler */
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
insertImage(handler) {
|
|
1171
|
+
this.dispatchEvent(new InsertImageEvent(handler));
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
onDeleteImage(src, done) {
|
|
1175
|
+
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
insertSound(handler) {
|
|
1179
|
+
this.dispatchEvent(new InsertSoundEvent(handler));
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
onDeleteSound(src, done) {
|
|
1183
|
+
this.dispatchEvent(new DeleteSoundEvent(src, done));
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
_render() {
|
|
1187
|
+
log('_render');
|
|
1188
|
+
let element = /*#__PURE__*/React.createElement(Styled, {
|
|
1189
|
+
model: this._model,
|
|
1190
|
+
configuration: this._configuration,
|
|
1191
|
+
onModelChanged: this.onModelChanged,
|
|
1192
|
+
onConfigurationChanged: this.onConfigurationChanged,
|
|
1193
|
+
disableSidePanel: this._disableSidePanel,
|
|
1194
|
+
imageSupport: {
|
|
1195
|
+
add: this.insertImage.bind(this),
|
|
1196
|
+
delete: this.onDeleteImage.bind(this)
|
|
1197
|
+
},
|
|
1198
|
+
uploadSoundSupport: {
|
|
1199
|
+
add: this.insertSound.bind(this),
|
|
1200
|
+
delete: this.onDeleteSound.bind(this)
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
ReactDOM.render(element, this);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
MultipleChoice.createDefaultModel = (model = {}) => {
|
|
1209
|
+
const normalizedModel = choiceUtils.normalizeChoices(_extends({}, sensibleDefaults.model, model, {
|
|
1210
|
+
choices: generateFormattedChoices(model && model.choices || [])
|
|
1211
|
+
})); // This is used for offering support for old models which have the property "verticalMode"
|
|
1212
|
+
|
|
1213
|
+
normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || sensibleDefaults.model.choicesLayout;
|
|
1214
|
+
return normalizedModel;
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
export { MultipleChoice as default };
|
|
1218
|
+
//# sourceMappingURL=configure.js.map
|