@pie-element/drag-in-the-blank 10.1.2-next.2 → 10.1.2

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.
Files changed (85) hide show
  1. package/CHANGELOG.json +1042 -0
  2. package/CHANGELOG.md +2183 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +652 -0
  6. package/configure/CHANGELOG.md +1883 -0
  7. package/configure/lib/choice.js +137 -0
  8. package/configure/lib/choice.js.map +1 -0
  9. package/configure/lib/choices.js +319 -0
  10. package/configure/lib/choices.js.map +1 -0
  11. package/configure/lib/defaults.js +169 -0
  12. package/configure/lib/defaults.js.map +1 -0
  13. package/configure/lib/index.js +144 -0
  14. package/configure/lib/index.js.map +1 -0
  15. package/configure/lib/main.js +440 -0
  16. package/configure/lib/main.js.map +1 -0
  17. package/configure/lib/markupUtils.js +83 -0
  18. package/configure/lib/markupUtils.js.map +1 -0
  19. package/configure/package.json +25 -0
  20. package/configure/utils.js +17 -0
  21. package/controller/CHANGELOG.json +457 -0
  22. package/controller/CHANGELOG.md +1284 -0
  23. package/controller/lib/defaults.js +24 -0
  24. package/controller/lib/defaults.js.map +1 -0
  25. package/controller/lib/index.js +251 -0
  26. package/controller/lib/index.js.map +1 -0
  27. package/controller/lib/utils.js +39 -0
  28. package/controller/lib/utils.js.map +1 -0
  29. package/controller/package.json +16 -0
  30. package/docs/config-schema.json +2580 -0
  31. package/docs/config-schema.json.md +1905 -0
  32. package/docs/demo/config.js +8 -0
  33. package/docs/demo/generate.js +41 -0
  34. package/docs/demo/index.html +1 -0
  35. package/docs/demo/session.js +10 -0
  36. package/docs/pie-schema.json +1181 -0
  37. package/docs/pie-schema.json.md +853 -0
  38. package/lib/index.js +206 -0
  39. package/lib/index.js.map +1 -0
  40. package/lib/main.js +126 -0
  41. package/lib/main.js.map +1 -0
  42. package/package.json +22 -87
  43. package/configure.js +0 -2
  44. package/controller.js +0 -1
  45. package/dist/author/choice.d.ts +0 -22
  46. package/dist/author/choice.js +0 -88
  47. package/dist/author/choices.d.ts +0 -41
  48. package/dist/author/choices.js +0 -172
  49. package/dist/author/defaults.d.ts +0 -171
  50. package/dist/author/defaults.js +0 -123
  51. package/dist/author/index.d.ts +0 -42
  52. package/dist/author/index.js +0 -92
  53. package/dist/author/main.d.ts +0 -36
  54. package/dist/author/main.js +0 -301
  55. package/dist/author/markupUtils.d.ts +0 -17
  56. package/dist/author/markupUtils.js +0 -38
  57. package/dist/author/utils.d.ts +0 -9
  58. package/dist/author/utils.js +0 -7
  59. package/dist/browser/author/index.js +0 -39603
  60. package/dist/browser/author/index.js.map +0 -1
  61. package/dist/browser/controller/index.js +0 -176
  62. package/dist/browser/controller/index.js.map +0 -1
  63. package/dist/browser/delivery/index.js +0 -3414
  64. package/dist/browser/delivery/index.js.map +0 -1
  65. package/dist/browser/dist-BkH5WSi5.js +0 -121
  66. package/dist/browser/dist-BkH5WSi5.js.map +0 -1
  67. package/dist/browser/drag-in-the-blank.css +0 -2
  68. package/dist/browser/drag-provider-D0fyq5lq.js +0 -10946
  69. package/dist/browser/drag-provider-D0fyq5lq.js.map +0 -1
  70. package/dist/controller/defaults.d.ts +0 -26
  71. package/dist/controller/defaults.js +0 -20
  72. package/dist/controller/index.d.ts +0 -41
  73. package/dist/controller/index.js +0 -104
  74. package/dist/controller/utils.d.ts +0 -16
  75. package/dist/controller/utils.js +0 -14
  76. package/dist/delivery/index.d.ts +0 -21
  77. package/dist/delivery/index.js +0 -105
  78. package/dist/delivery/main.d.ts +0 -28
  79. package/dist/delivery/main.js +0 -83
  80. package/dist/index.d.ts +0 -1
  81. package/dist/index.iife.d.ts +0 -8
  82. package/dist/index.iife.js +0 -152
  83. package/dist/index.js +0 -2
  84. package/dist/runtime-support.d.ts +0 -12
  85. package/dist/runtime-support.js +0 -12
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.BlankContent = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _MoreVert = _interopRequireDefault(require("@mui/icons-material/MoreVert"));
12
+ var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
13
+ var _core = require("@dnd-kit/core");
14
+ var _styles = require("@mui/material/styles");
15
+ var _markupUtils = require("./markupUtils");
16
+ const GripIcon = ({
17
+ style
18
+ }) => /*#__PURE__*/_react.default.createElement("span", {
19
+ style: style
20
+ }, /*#__PURE__*/_react.default.createElement(_MoreVert.default, {
21
+ style: {
22
+ margin: '0 -16px'
23
+ }
24
+ }), /*#__PURE__*/_react.default.createElement(_MoreVert.default, null));
25
+ GripIcon.propTypes = {
26
+ style: _propTypes.default.object
27
+ };
28
+ const StyledChoice = (0, _styles.styled)('div', {
29
+ shouldForwardProp: prop => !['error', 'isDragging'].includes(prop)
30
+ })(({
31
+ theme,
32
+ error
33
+ }) => ({
34
+ display: 'inline-flex',
35
+ minWidth: '178px',
36
+ minHeight: '36px',
37
+ background: theme.palette.common.white,
38
+ boxSizing: 'border-box',
39
+ borderRadius: '3px',
40
+ overflow: 'hidden',
41
+ position: 'relative',
42
+ padding: '8px 35px 8px 35px',
43
+ cursor: 'grab',
44
+ border: `1px solid ${error ? '#f44336' : '#C0C3CF'}`,
45
+ '& img': {
46
+ display: 'flex'
47
+ },
48
+ // browser adds extra marrgin for p tags by default
49
+ '& p': {
50
+ margin: 0
51
+ },
52
+ '& mjx-frac': {
53
+ fontSize: '120% !important'
54
+ }
55
+ }));
56
+ const StyledDeleteIcon = (0, _styles.styled)(_Delete.default)(({
57
+ theme
58
+ }) => ({
59
+ position: 'absolute',
60
+ top: '6px',
61
+ right: '0',
62
+ color: theme.palette.grey[500],
63
+ zIndex: 2,
64
+ '&:hover': {
65
+ cursor: 'pointer',
66
+ color: theme.palette.common.black
67
+ }
68
+ }));
69
+ const BlankContent = props => {
70
+ const {
71
+ choice,
72
+ onClick,
73
+ onRemoveChoice,
74
+ error,
75
+ instanceId,
76
+ disabled
77
+ } = props;
78
+ const {
79
+ attributes,
80
+ listeners,
81
+ setNodeRef,
82
+ isDragging
83
+ } = (0, _core.useDraggable)({
84
+ id: `choice-${choice.id}-${instanceId || 'default'}`,
85
+ data: {
86
+ type: 'drag-in-the-blank-choice',
87
+ id: choice.id,
88
+ value: choice,
89
+ instanceId: instanceId
90
+ },
91
+ disabled: disabled || (0, _markupUtils.choiceIsEmpty)(choice)
92
+ });
93
+ const handleDragStart = e => {
94
+ if ((0, _markupUtils.choiceIsEmpty)(choice)) {
95
+ e.preventDefault();
96
+ alert('You need to define a value for an answer choice before it can be associated with a response area.');
97
+ return;
98
+ }
99
+ };
100
+ return /*#__PURE__*/_react.default.createElement(StyledChoice, (0, _extends2.default)({
101
+ ref: setNodeRef,
102
+ error: error,
103
+ isDragging: isDragging,
104
+ onClick: onClick
105
+ }, attributes, listeners, {
106
+ onDragStart: handleDragStart
107
+ }), /*#__PURE__*/_react.default.createElement(GripIcon, {
108
+ style: {
109
+ position: 'absolute',
110
+ top: '6px',
111
+ left: '15px',
112
+ color: '#9e9e9e',
113
+ zIndex: 2
114
+ }
115
+ }), /*#__PURE__*/_react.default.createElement("span", {
116
+ dangerouslySetInnerHTML: {
117
+ __html: choice.value
118
+ }
119
+ }), /*#__PURE__*/_react.default.createElement(StyledDeleteIcon, {
120
+ onClick: e => {
121
+ e.preventDefault();
122
+ e.stopPropagation();
123
+ onRemoveChoice(e);
124
+ }
125
+ }));
126
+ };
127
+ exports.BlankContent = BlankContent;
128
+ BlankContent.propTypes = {
129
+ choice: _propTypes.default.object.isRequired,
130
+ onClick: _propTypes.default.func,
131
+ onRemoveChoice: _propTypes.default.func.isRequired,
132
+ error: _propTypes.default.bool,
133
+ instanceId: _propTypes.default.string,
134
+ disabled: _propTypes.default.bool
135
+ };
136
+ var _default = exports.default = BlankContent;
137
+ //# sourceMappingURL=choice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice.js","names":["_react","_interopRequireDefault","require","_propTypes","_MoreVert","_Delete","_core","_styles","_markupUtils","GripIcon","style","default","createElement","margin","propTypes","PropTypes","object","StyledChoice","styled","shouldForwardProp","prop","includes","theme","error","display","minWidth","minHeight","background","palette","common","white","boxSizing","borderRadius","overflow","position","padding","cursor","border","fontSize","StyledDeleteIcon","Delete","top","right","color","grey","zIndex","black","BlankContent","props","choice","onClick","onRemoveChoice","instanceId","disabled","attributes","listeners","setNodeRef","isDragging","useDraggable","id","data","type","value","choiceIsEmpty","handleDragStart","e","preventDefault","alert","_extends2","ref","onDragStart","left","dangerouslySetInnerHTML","__html","stopPropagation","exports","isRequired","func","bool","string","_default"],"sources":["../src/choice.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport MoreVert from '@mui/icons-material/MoreVert';\nimport Delete from '@mui/icons-material/Delete';\nimport { useDraggable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\nimport { choiceIsEmpty } from './markupUtils';\n\nconst GripIcon = ({ style }) => (\n <span style={style}>\n <MoreVert style={{ margin: '0 -16px' }} />\n <MoreVert />\n </span>\n);\n\nGripIcon.propTypes = {\n style: PropTypes.object,\n};\n\nconst StyledChoice = styled('div', {\n shouldForwardProp: (prop) => !['error', 'isDragging'].includes(prop),\n})(({ theme, error }) => ({\n display: 'inline-flex',\n minWidth: '178px',\n minHeight: '36px',\n background: theme.palette.common.white,\n boxSizing: 'border-box',\n borderRadius: '3px',\n overflow: 'hidden',\n position: 'relative',\n padding: '8px 35px 8px 35px',\n cursor: 'grab',\n border: `1px solid ${error ? '#f44336' : '#C0C3CF'}`,\n '& img': {\n display: 'flex',\n },\n // browser adds extra marrgin for p tags by default\n '& p': {\n margin: 0,\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n}));\n\nconst StyledDeleteIcon = styled(Delete)(({ theme }) => ({\n position: 'absolute',\n top: '6px',\n right: '0',\n color: theme.palette.grey[500],\n zIndex: 2,\n '&:hover': {\n cursor: 'pointer',\n color: theme.palette.common.black,\n },\n}));\n\nexport const BlankContent = (props) => {\n const { choice, onClick, onRemoveChoice, error, instanceId, disabled } = props;\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: `choice-${choice.id}-${instanceId || 'default'}`,\n data: {\n type: 'drag-in-the-blank-choice',\n id: choice.id,\n value: choice,\n instanceId: instanceId,\n },\n disabled: disabled || choiceIsEmpty(choice),\n });\n\n const handleDragStart = (e) => {\n if (choiceIsEmpty(choice)) {\n e.preventDefault();\n alert('You need to define a value for an answer choice before it can be associated with a response area.');\n return;\n }\n };\n\n return (\n <StyledChoice\n ref={setNodeRef}\n error={error}\n isDragging={isDragging}\n onClick={onClick}\n {...attributes}\n {...listeners}\n onDragStart={handleDragStart}\n >\n <GripIcon\n style={{\n position: 'absolute',\n top: '6px',\n left: '15px',\n color: '#9e9e9e',\n zIndex: 2,\n }}\n />\n\n <span dangerouslySetInnerHTML={{ __html: choice.value }} />\n\n <StyledDeleteIcon\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n\n onRemoveChoice(e);\n }}\n />\n </StyledChoice>\n );\n};\n\nBlankContent.propTypes = {\n choice: PropTypes.object.isRequired,\n onClick: PropTypes.func,\n onRemoveChoice: PropTypes.func.isRequired,\n error: PropTypes.bool,\n instanceId: PropTypes.string,\n disabled: PropTypes.bool,\n};\n\nexport default BlankContent;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA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KAAM;IACbkC,UAAU,EAAEA,UAAW;IACvBP,OAAO,EAAEA;EAAQ,GACbI,UAAU,EACVC,SAAS;IACbe,WAAW,EAAEN;EAAgB,iBAE7BhE,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACH,QAAQ;IACPC,KAAK,EAAE;MACLwB,QAAQ,EAAE,UAAU;MACpBO,GAAG,EAAE,KAAK;MACV8B,IAAI,EAAE,MAAM;MACZ5B,KAAK,EAAE,SAAS;MAChBE,MAAM,EAAE;IACV;EAAE,CACH,CAAC,eAEF7C,MAAA,CAAAW,OAAA,CAAAC,aAAA;IAAM4D,uBAAuB,EAAE;MAAEC,MAAM,EAAExB,MAAM,CAACa;IAAM;EAAE,CAAE,CAAC,eAE3D9D,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAAC2B,gBAAgB;IACfW,OAAO,EAAGe,CAAC,IAAK;MACdA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClBD,CAAC,CAACS,eAAe,CAAC,CAAC;MAEnBvB,cAAc,CAACc,CAAC,CAAC;IACnB;EAAE,CACH,CACW,CAAC;AAEnB,CAAC;AAACU,OAAA,CAAA5B,YAAA,GAAAA,YAAA;AAEFA,YAAY,CAACjC,SAAS,GAAG;EACvBmC,MAAM,EAAElC,kBAAS,CAACC,MAAM,CAAC4D,UAAU;EACnC1B,OAAO,EAAEnC,kBAAS,CAAC8D,IAAI;EACvB1B,cAAc,EAAEpC,kBAAS,CAAC8D,IAAI,CAACD,UAAU;EACzCrD,KAAK,EAAER,kBAAS,CAAC+D,IAAI;EACrB1B,UAAU,EAAErC,kBAAS,CAACgE,MAAM;EAC5B1B,QAAQ,EAAEtC,kBAAS,CAAC+D;AACtB,CAAC;AAAC,IAAAE,QAAA,GAAAL,OAAA,CAAAhE,OAAA,GAEaoC,YAAY","ignoreList":[]}
@@ -0,0 +1,319 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.Choices = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
12
+ var _configUi = require("@pie-lib/config-ui");
13
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
14
+ var _styles = require("@mui/material/styles");
15
+ var _choice = _interopRequireDefault(require("./choice"));
16
+ var _markupUtils = require("./markupUtils");
17
+ var _mathRendering = require("@pie-lib/math-rendering");
18
+ const StyledDesign = (0, _styles.styled)('div')(({
19
+ theme
20
+ }) => ({
21
+ display: 'flex',
22
+ flexDirection: 'column',
23
+ marginBottom: theme.spacing(1.5)
24
+ }));
25
+ const StyledAddButton = (0, _styles.styled)(_Button.default)({
26
+ marginLeft: 'auto'
27
+ });
28
+ const StyledAltChoices = (0, _styles.styled)('div')(({
29
+ theme
30
+ }) => ({
31
+ alignItems: 'flex-start',
32
+ display: 'flex',
33
+ flexWrap: 'wrap',
34
+ justifyContent: 'space-evenly',
35
+ marginTop: theme.spacing(1),
36
+ '& > *': {
37
+ margin: theme.spacing(1)
38
+ }
39
+ }));
40
+ const ErrorText = (0, _styles.styled)('div')(({
41
+ theme
42
+ }) => ({
43
+ fontSize: theme.typography.fontSize - 2,
44
+ color: theme.palette.error.main,
45
+ paddingBottom: theme.spacing(2)
46
+ }));
47
+ class Choices extends _react.default.Component {
48
+ constructor(...args) {
49
+ super(...args);
50
+ (0, _defineProperty2.default)(this, "state", {
51
+ warning: {
52
+ open: false
53
+ }
54
+ });
55
+ (0, _defineProperty2.default)(this, "preventDone", false);
56
+ (0, _defineProperty2.default)(this, "wrapperRef", /*#__PURE__*/_react.default.createRef(null));
57
+ (0, _defineProperty2.default)(this, "onChoiceChanged", (prevValue, val, key) => {
58
+ const {
59
+ onChange,
60
+ model
61
+ } = this.props;
62
+ const {
63
+ choices,
64
+ correctResponse,
65
+ alternateResponses
66
+ } = model;
67
+ if ((0, _markupUtils.choiceIsEmpty)({
68
+ value: prevValue
69
+ }) && (0, _markupUtils.choiceIsEmpty)({
70
+ value: val
71
+ })) {
72
+ return;
73
+ }
74
+ const duplicatedValue = (choices || []).find(c => c.value === val && c.id !== key);
75
+
76
+ // discard the new added choice or the changes if the choice would be a duplicate to one that already exists
77
+ if (duplicatedValue) {
78
+ if (prevValue === '') {
79
+ // remove the new added choice from choices
80
+ const newChoices = (choices || []).filter(c => c.id !== key);
81
+ onChange(newChoices);
82
+ }
83
+ this.setState({
84
+ warning: {
85
+ open: true,
86
+ text: 'Identical answer choices are not allowed and the changes will be discarded.'
87
+ }
88
+ });
89
+ return;
90
+ }
91
+ const newChoices = choices?.map(choice => choice.id === key ? {
92
+ ...choice,
93
+ value: val
94
+ } : choice) || [];
95
+ if (!(0, _markupUtils.choiceIsEmpty)({
96
+ value: val
97
+ })) {
98
+ onChange(newChoices);
99
+ return;
100
+ }
101
+
102
+ // if the edited content is empty, its usage has to be searched in the correct response definitions
103
+ let usedForResponse = false;
104
+ if (correctResponse) {
105
+ Object.keys(correctResponse).forEach(responseKey => {
106
+ if (correctResponse[responseKey] === key) {
107
+ usedForResponse = true;
108
+ }
109
+ });
110
+ }
111
+ if (alternateResponses && !usedForResponse) {
112
+ Object.values(alternateResponses).forEach(alternate => {
113
+ if (alternate.indexOf(key) >= 0) {
114
+ usedForResponse = true;
115
+ }
116
+ });
117
+ }
118
+ if (usedForResponse) {
119
+ this.setState({
120
+ warning: {
121
+ open: true,
122
+ text: 'Answer choices cannot be blank and the changes will be discarded.'
123
+ }
124
+ });
125
+ return;
126
+ }
127
+ onChange(newChoices);
128
+ });
129
+ (0, _defineProperty2.default)(this, "onChoiceDone", choiceId => {
130
+ const {
131
+ onChange,
132
+ model
133
+ } = this.props;
134
+ const {
135
+ choices
136
+ } = model;
137
+ const currentChoice = (choices || []).find(c => c.id === choiceId);
138
+ if (!currentChoice || !(0, _markupUtils.choiceIsEmpty)(currentChoice)) {
139
+ this.setState({
140
+ focusedEl: undefined
141
+ });
142
+ return;
143
+ }
144
+ onChange((choices || []).filter(c => c.id !== choiceId));
145
+ this.setState({
146
+ focusedEl: undefined,
147
+ warning: {
148
+ open: true,
149
+ text: 'Answer choices cannot be blank.'
150
+ }
151
+ });
152
+ });
153
+ (0, _defineProperty2.default)(this, "onChoiceFocus", id => this.setState({
154
+ focusedEl: id
155
+ }));
156
+ (0, _defineProperty2.default)(this, "onAddChoice", () => {
157
+ const {
158
+ model: {
159
+ choices: oldChoices
160
+ },
161
+ onChange
162
+ } = this.props;
163
+
164
+ // find the maximum existing id and add 1 to generate the new id so we avoid duplicates
165
+ const maxId = oldChoices.length > 0 ? Math.max(...oldChoices.map(choice => parseInt(choice.id, 10) || 0)) : -1;
166
+ const newId = `${maxId + 1}`;
167
+ this.setState({
168
+ focusedEl: newId
169
+ }, () => {
170
+ onChange([...oldChoices, {
171
+ id: newId,
172
+ value: ''
173
+ }]);
174
+ });
175
+ });
176
+ (0, _defineProperty2.default)(this, "onChoiceRemove", id => {
177
+ const {
178
+ onChange,
179
+ model: {
180
+ choices
181
+ }
182
+ } = this.props;
183
+ const newChoices = (choices || []).filter(choice => choice.id !== id);
184
+ onChange(newChoices);
185
+ });
186
+ (0, _defineProperty2.default)(this, "getVisibleChoices", () => {
187
+ const {
188
+ duplicates,
189
+ model: {
190
+ choices,
191
+ correctResponse
192
+ }
193
+ } = this.props;
194
+ if (!choices) {
195
+ return [];
196
+ }
197
+ if (duplicates) {
198
+ return choices;
199
+ }
200
+
201
+ // if duplicates not allowed, remove the choices that are used to define the correct response
202
+ return choices.filter(choice => !(correctResponse && Object.values(correctResponse).includes(choice.id)));
203
+ });
204
+ }
205
+ componentDidUpdate() {
206
+ if (this.focusedNodeRef) {
207
+ this.focusedNodeRef.focus('end');
208
+ }
209
+ (0, _mathRendering.renderMath)(this.wrapperRef.current);
210
+ }
211
+ render() {
212
+ const {
213
+ focusedEl,
214
+ warning
215
+ } = this.state;
216
+ const {
217
+ duplicates,
218
+ error,
219
+ mathMlOptions = {},
220
+ maxChoices,
221
+ model: {
222
+ choices
223
+ },
224
+ toolbarOpts,
225
+ uploadSoundSupport,
226
+ imageSupport = {},
227
+ pluginProps = {},
228
+ maxImageWidth,
229
+ maxImageHeight,
230
+ maxLength
231
+ } = this.props;
232
+ const visibleChoices = this.getVisibleChoices() || [];
233
+ return /*#__PURE__*/_react.default.createElement(StyledDesign, {
234
+ ref: this.wrapperRef
235
+ }, /*#__PURE__*/_react.default.createElement(StyledAddButton, {
236
+ variant: "contained",
237
+ color: "primary",
238
+ onClick: this.onAddChoice,
239
+ disabled: maxChoices && choices && maxChoices === choices.length
240
+ }, "Add Choice"), /*#__PURE__*/_react.default.createElement(StyledAltChoices, null, visibleChoices.map((choice, index) => {
241
+ if (!choice || !choice.id) {
242
+ return null;
243
+ }
244
+ return focusedEl === choice.id ? /*#__PURE__*/_react.default.createElement("div", {
245
+ key: index,
246
+ style: {
247
+ minWidth: '100%',
248
+ zIndex: '100'
249
+ }
250
+ }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
251
+ ref: ref => this.focusedNodeRef = ref,
252
+ autoFocus: true,
253
+ imageSupport: imageSupport,
254
+ markup: choice.value,
255
+ pluginProps: pluginProps,
256
+ languageCharactersProps: [{
257
+ language: 'spanish'
258
+ }, {
259
+ language: 'special'
260
+ }],
261
+ onChange: val => {
262
+ if (this.preventDone) {
263
+ return;
264
+ }
265
+ this.onChoiceChanged(choice.value, val, choice.id);
266
+ },
267
+ onDone: () => {
268
+ if (this.preventDone) {
269
+ return;
270
+ }
271
+ this.onChoiceDone(choice.id);
272
+ },
273
+ onBlur: e => {
274
+ const inInInsertCharacter = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');
275
+ this.preventDone = inInInsertCharacter;
276
+ },
277
+ disableUnderline: true,
278
+ toolbarOpts: toolbarOpts,
279
+ uploadSoundSupport: uploadSoundSupport,
280
+ mathMlOptions: mathMlOptions,
281
+ maxImageHeight: maxImageHeight,
282
+ maxImageWidth: maxImageWidth,
283
+ charactersLimit: maxLength
284
+ })) : /*#__PURE__*/_react.default.createElement(_choice.default, {
285
+ key: index,
286
+ duplicates: duplicates,
287
+ choice: choice,
288
+ error: error,
289
+ onClick: () => this.onChoiceFocus(choice.id),
290
+ onRemoveChoice: () => this.onChoiceRemove(choice.id)
291
+ });
292
+ })), error && /*#__PURE__*/_react.default.createElement(ErrorText, null, error), /*#__PURE__*/_react.default.createElement(_configUi.AlertDialog, {
293
+ open: warning.open,
294
+ title: "Warning",
295
+ text: warning.text,
296
+ onConfirm: () => this.setState({
297
+ warning: {
298
+ open: false
299
+ }
300
+ })
301
+ }));
302
+ }
303
+ }
304
+ exports.Choices = Choices;
305
+ (0, _defineProperty2.default)(Choices, "propTypes", {
306
+ duplicates: _propTypes.default.bool,
307
+ error: _propTypes.default.string,
308
+ model: _propTypes.default.object.isRequired,
309
+ onChange: _propTypes.default.func.isRequired,
310
+ toolbarOpts: _propTypes.default.object,
311
+ pluginProps: _propTypes.default.object,
312
+ maxChoices: _propTypes.default.number,
313
+ uploadSoundSupport: _propTypes.default.object,
314
+ maxImageWidth: _propTypes.default.number,
315
+ maxImageHeight: _propTypes.default.number,
316
+ maxLength: _propTypes.default.number
317
+ });
318
+ var _default = exports.default = Choices;
319
+ //# sourceMappingURL=choices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choices.js","names":["_react","_interopRequireDefault","require","_propTypes","_editableHtmlTipTap","_configUi","_Button","_styles","_choice","_markupUtils","_mathRendering","StyledDesign","styled","theme","display","flexDirection","marginBottom","spacing","StyledAddButton","Button","marginLeft","StyledAltChoices","alignItems","flexWrap","justifyContent","marginTop","margin","ErrorText","fontSize","typography","color","palette","error","main","paddingBottom","Choices","React","Component","constructor","args","_defineProperty2","default","warning","open","createRef","prevValue","val","key","onChange","model","props","choices","correctResponse","alternateResponses","choiceIsEmpty","value","duplicatedValue","find","c","id","newChoices","filter","setState","text","map","choice","usedForResponse","Object","keys","forEach","responseKey","values","alternate","indexOf","choiceId","currentChoice","focusedEl","undefined","oldChoices","maxId","length","Math","max","parseInt","newId","duplicates","includes","componentDidUpdate","focusedNodeRef","focus","renderMath","wrapperRef","current","render","state","mathMlOptions","maxChoices","toolbarOpts","uploadSoundSupport","imageSupport","pluginProps","maxImageWidth","maxImageHeight","maxLength","visibleChoices","getVisibleChoices","createElement","ref","variant","onClick","onAddChoice","disabled","index","style","minWidth","zIndex","autoFocus","markup","languageCharactersProps","language","preventDone","onChoiceChanged","onDone","onChoiceDone","onBlur","e","inInInsertCharacter","relatedTarget","closest","disableUnderline","charactersLimit","onChoiceFocus","onRemoveChoice","onChoiceRemove","AlertDialog","title","onConfirm","exports","PropTypes","bool","string","object","isRequired","func","number","_default"],"sources":["../src/choices.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport Button from '@mui/material/Button';\nimport { styled } from '@mui/material/styles';\n\nimport Choice from './choice';\nimport { choiceIsEmpty } from './markupUtils';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nconst StyledDesign = styled('div')(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst StyledAddButton = styled(Button)({\n marginLeft: 'auto',\n});\n\nconst StyledAltChoices = styled('div')(({ theme }) => ({\n alignItems: 'flex-start',\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'space-evenly',\n marginTop: theme.spacing(1),\n\n '& > *': {\n margin: theme.spacing(1),\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingBottom: theme.spacing(2),\n}));\n\nexport class Choices extends React.Component {\n static propTypes = {\n duplicates: PropTypes.bool,\n error: PropTypes.string,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n toolbarOpts: PropTypes.object,\n pluginProps: PropTypes.object,\n maxChoices: PropTypes.number,\n uploadSoundSupport: PropTypes.object,\n maxImageWidth: PropTypes.number,\n maxImageHeight: PropTypes.number,\n maxLength: PropTypes.number,\n };\n\n state = { warning: { open: false } };\n preventDone = false;\n wrapperRef = React.createRef(null);\n\n componentDidUpdate() {\n if (this.focusedNodeRef) {\n this.focusedNodeRef.focus('end');\n }\n\n renderMath(this.wrapperRef.current);\n }\n\n onChoiceChanged = (prevValue, val, key) => {\n const { onChange, model } = this.props;\n const { choices, correctResponse, alternateResponses } = model;\n\n if (choiceIsEmpty({ value: prevValue }) && choiceIsEmpty({ value: val })) {\n return;\n }\n\n const duplicatedValue = (choices || []).find((c) => c.value === val && c.id !== key);\n\n // discard the new added choice or the changes if the choice would be a duplicate to one that already exists\n if (duplicatedValue) {\n if (prevValue === '') {\n // remove the new added choice from choices\n const newChoices = (choices || []).filter((c) => c.id !== key);\n\n onChange(newChoices);\n }\n\n this.setState({\n warning: {\n open: true,\n text: 'Identical answer choices are not allowed and the changes will be discarded.',\n },\n });\n\n return;\n }\n\n const newChoices = choices?.map((choice) => (choice.id === key ? { ...choice, value: val } : choice)) || [];\n\n if (!choiceIsEmpty({ value: val })) {\n onChange(newChoices);\n\n return;\n }\n\n // if the edited content is empty, its usage has to be searched in the correct response definitions\n let usedForResponse = false;\n\n if (correctResponse) {\n Object.keys(correctResponse).forEach((responseKey) => {\n if (correctResponse[responseKey] === key) {\n usedForResponse = true;\n }\n });\n }\n\n if (alternateResponses && !usedForResponse) {\n Object.values(alternateResponses).forEach((alternate) => {\n if (alternate.indexOf(key) >= 0) {\n usedForResponse = true;\n }\n });\n }\n\n if (usedForResponse) {\n this.setState({\n warning: {\n open: true,\n text: 'Answer choices cannot be blank and the changes will be discarded.',\n },\n });\n\n return;\n }\n\n onChange(newChoices);\n };\n\n onChoiceDone = (choiceId) => {\n const { onChange, model } = this.props;\n const { choices } = model;\n const currentChoice = (choices || []).find((c) => c.id === choiceId);\n\n if (!currentChoice || !choiceIsEmpty(currentChoice)) {\n this.setState({ focusedEl: undefined });\n return;\n }\n\n onChange((choices || []).filter((c) => c.id !== choiceId));\n\n this.setState({\n focusedEl: undefined,\n warning: {\n open: true,\n text: 'Answer choices cannot be blank.',\n },\n });\n };\n\n onChoiceFocus = (id) =>\n this.setState({\n focusedEl: id,\n });\n\n onAddChoice = () => {\n const {\n model: { choices: oldChoices },\n onChange,\n } = this.props;\n\n // find the maximum existing id and add 1 to generate the new id so we avoid duplicates\n const maxId = oldChoices.length > 0 ? Math.max(...oldChoices.map((choice) => parseInt(choice.id, 10) || 0)) : -1;\n const newId = `${maxId + 1}`;\n\n this.setState(\n {\n focusedEl: newId,\n },\n () => {\n onChange([\n ...oldChoices,\n {\n id: newId,\n value: '',\n },\n ]);\n },\n );\n };\n\n onChoiceRemove = (id) => {\n const {\n onChange,\n model: { choices },\n } = this.props;\n const newChoices = (choices || []).filter((choice) => choice.id !== id);\n\n onChange(newChoices);\n };\n\n getVisibleChoices = () => {\n const {\n duplicates,\n model: { choices, correctResponse },\n } = this.props;\n\n if (!choices) {\n return [];\n }\n\n if (duplicates) {\n return choices;\n }\n\n // if duplicates not allowed, remove the choices that are used to define the correct response\n return choices.filter((choice) => !(correctResponse && Object.values(correctResponse).includes(choice.id)));\n };\n\n render() {\n const { focusedEl, warning } = this.state;\n const {\n duplicates,\n error,\n mathMlOptions = {},\n maxChoices,\n model: { choices },\n toolbarOpts,\n uploadSoundSupport,\n imageSupport = {},\n pluginProps = {},\n maxImageWidth,\n maxImageHeight,\n maxLength,\n } = this.props;\n const visibleChoices = this.getVisibleChoices() || [];\n return (\n <StyledDesign ref={this.wrapperRef}>\n <StyledAddButton\n variant=\"contained\"\n color=\"primary\"\n onClick={this.onAddChoice}\n disabled={maxChoices && choices && maxChoices === choices.length}\n >\n Add Choice\n </StyledAddButton>\n\n <StyledAltChoices>\n {visibleChoices.map((choice, index) => {\n if (!choice || !choice.id) {\n return null;\n }\n\n return focusedEl === choice.id ? (\n <div\n key={index}\n style={{\n minWidth: '100%',\n zIndex: '100',\n }}\n >\n <EditableHtml\n ref={(ref) => (this.focusedNodeRef = ref)}\n autoFocus\n imageSupport={imageSupport}\n markup={choice.value}\n pluginProps={pluginProps}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n onChange={(val) => {\n if (this.preventDone) {\n return;\n }\n\n this.onChoiceChanged(choice.value, val, choice.id);\n }}\n onDone={() => {\n if (this.preventDone) {\n return;\n }\n\n this.onChoiceDone(choice.id);\n }}\n onBlur={(e) => {\n const inInInsertCharacter = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');\n\n this.preventDone = inInInsertCharacter;\n }}\n disableUnderline\n toolbarOpts={toolbarOpts}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n maxImageHeight={maxImageHeight}\n maxImageWidth={maxImageWidth}\n charactersLimit={maxLength}\n />\n </div>\n ) : (\n <Choice\n key={index}\n duplicates={duplicates}\n choice={choice}\n error={error}\n onClick={() => this.onChoiceFocus(choice.id)}\n onRemoveChoice={() => this.onChoiceRemove(choice.id)}\n />\n );\n })}\n </StyledAltChoices>\n {error && <ErrorText>{error}</ErrorText>}\n\n <AlertDialog\n open={warning.open}\n title=\"Warning\"\n text={warning.text}\n onConfirm={() => this.setState({ warning: { open: false } })}\n />\n </StyledDesign>\n );\n }\n}\n\nexport default Choices;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,mBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,IAAAM,OAAA,G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iI,WAAW;MACV3F,IAAI,EAAED,OAAO,CAACC,IAAK;MACnB4F,KAAK,EAAC,SAAS;MACfxE,IAAI,EAAErB,OAAO,CAACqB,IAAK;MACnByE,SAAS,EAAEA,CAAA,KAAM,IAAI,CAAC1E,QAAQ,CAAC;QAAEpB,OAAO,EAAE;UAAEC,IAAI,EAAE;QAAM;MAAE,CAAC;IAAE,CAC9D,CACW,CAAC;EAEnB;AACF;AAAC8F,OAAA,CAAAtG,OAAA,GAAAA,OAAA;AAAA,IAAAK,gBAAA,CAAAC,OAAA,EArRYN,OAAO,eACC;EACjBkD,UAAU,EAAEqD,kBAAS,CAACC,IAAI;EAC1B3G,KAAK,EAAE0G,kBAAS,CAACE,MAAM;EACvB3F,KAAK,EAAEyF,kBAAS,CAACG,MAAM,CAACC,UAAU;EAClC9F,QAAQ,EAAE0F,kBAAS,CAACK,IAAI,CAACD,UAAU;EACnC7C,WAAW,EAAEyC,kBAAS,CAACG,MAAM;EAC7BzC,WAAW,EAAEsC,kBAAS,CAACG,MAAM;EAC7B7C,UAAU,EAAE0C,kBAAS,CAACM,MAAM;EAC5B9C,kBAAkB,EAAEwC,kBAAS,CAACG,MAAM;EACpCxC,aAAa,EAAEqC,kBAAS,CAACM,MAAM;EAC/B1C,cAAc,EAAEoC,kBAAS,CAACM,MAAM;EAChCzC,SAAS,EAAEmC,kBAAS,CAACM;AACvB,CAAC;AAAA,IAAAC,QAAA,GAAAR,OAAA,CAAAhG,OAAA,GA0QYN,OAAO","ignoreList":[]}
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ model: {
9
+ choices: [],
10
+ choicesPosition: 'below',
11
+ correctResponse: {},
12
+ disabled: false,
13
+ duplicates: true,
14
+ markup: '',
15
+ mode: 'gather',
16
+ prompt: '',
17
+ promptEnabled: true,
18
+ rationale: '',
19
+ rationaleEnabled: true,
20
+ studentInstructionsEnabled: true,
21
+ teacherInstructions: '',
22
+ teacherInstructionsEnabled: true,
23
+ toolbarEditorPosition: 'bottom'
24
+ },
25
+ configuration: {
26
+ baseInputConfiguration: {
27
+ audio: {
28
+ disabled: false
29
+ },
30
+ video: {
31
+ disabled: false
32
+ },
33
+ image: {
34
+ disabled: false
35
+ },
36
+ h3: {
37
+ disabled: true
38
+ },
39
+ blockquote: {
40
+ disabled: true
41
+ },
42
+ textAlign: {
43
+ disabled: true
44
+ },
45
+ showParagraphs: {
46
+ disabled: false
47
+ },
48
+ separateParagraphs: {
49
+ disabled: true
50
+ }
51
+ },
52
+ spellCheck: {
53
+ label: 'Spellcheck',
54
+ settings: false,
55
+ enabled: true
56
+ },
57
+ choicesPosition: {
58
+ settings: true,
59
+ label: 'Choices Position'
60
+ },
61
+ prompt: {
62
+ settings: true,
63
+ label: 'Prompt',
64
+ inputConfiguration: {
65
+ audio: {
66
+ disabled: false
67
+ },
68
+ video: {
69
+ disabled: false
70
+ },
71
+ image: {
72
+ disabled: false
73
+ }
74
+ },
75
+ required: false
76
+ },
77
+ addChoice: {
78
+ inputConfiguration: {
79
+ audio: {
80
+ disabled: true
81
+ },
82
+ video: {
83
+ disabled: true
84
+ },
85
+ image: {
86
+ disabled: false
87
+ }
88
+ }
89
+ },
90
+ duplicates: {
91
+ settings: true,
92
+ label: 'Duplicates'
93
+ },
94
+ lockChoiceOrder: {
95
+ settings: true,
96
+ label: 'Lock Choice Order'
97
+ },
98
+ partialScoring: {
99
+ settings: false,
100
+ label: 'Allow Partial Scoring'
101
+ },
102
+ rationale: {
103
+ settings: true,
104
+ label: 'Rationale',
105
+ inputConfiguration: {
106
+ audio: {
107
+ disabled: false
108
+ },
109
+ video: {
110
+ disabled: false
111
+ },
112
+ image: {
113
+ disabled: false
114
+ }
115
+ },
116
+ required: false
117
+ },
118
+ settingsPanelDisabled: false,
119
+ teacherInstructions: {
120
+ settings: true,
121
+ label: 'Teacher Instructions',
122
+ inputConfiguration: {
123
+ audio: {
124
+ disabled: false
125
+ },
126
+ video: {
127
+ disabled: false
128
+ },
129
+ image: {
130
+ disabled: false
131
+ }
132
+ },
133
+ required: false
134
+ },
135
+ minChoices: 2,
136
+ maxResponseAreas: 10,
137
+ maxImageWidth: {
138
+ teacherInstructions: 300,
139
+ prompt: 300,
140
+ rationale: 300,
141
+ choice: 300
142
+ },
143
+ maxImageHeight: {
144
+ teacherInstructions: 300,
145
+ prompt: 300,
146
+ rationale: 300,
147
+ choice: 300
148
+ },
149
+ withRubric: {
150
+ settings: false,
151
+ label: 'Add Rubric'
152
+ },
153
+ mathMlOptions: {
154
+ mmlOutput: false,
155
+ mmlEditing: false
156
+ },
157
+ language: {
158
+ settings: false,
159
+ label: 'Specify Language',
160
+ enabled: false
161
+ },
162
+ languageChoices: {
163
+ label: 'Language Choices',
164
+ options: []
165
+ },
166
+ maxLength: 200
167
+ }
168
+ };
169
+ //# sourceMappingURL=defaults.js.map