@pie-element/explicit-constructed-response 3.12.0 → 3.12.1-beta.1443
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 +350 -0
- package/configure/CHANGELOG.md +330 -0
- package/configure/lib/alternateResponses.js +13 -7
- package/configure/lib/alternateResponses.js.map +1 -1
- package/configure/lib/alternateSection.js +39 -17
- package/configure/lib/alternateSection.js.map +1 -1
- package/configure/lib/defaults.js +28 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/ecr-toolbar.js +15 -6
- package/configure/lib/ecr-toolbar.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +234 -74
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/markupUtils.js +9 -3
- package/configure/lib/markupUtils.js.map +1 -1
- package/configure/lib/utils.js +15 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +23 -5
- package/controller/CHANGELOG.md +40 -0
- package/controller/lib/index.js +64 -6
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/config-schema.json +121 -0
- package/docs/config-schema.json.md +93 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +4 -3
- package/docs/pie-schema.json +39 -0
- package/docs/pie-schema.json.md +28 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/main.js +6 -3
- package/lib/main.js.map +1 -1
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/package.json +6 -6
- package/module/configure.js +0 -1953
- package/module/controller.js +0 -21340
- package/module/demo.js +0 -45
- package/module/element.js +0 -14384
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -83
- package/module/print.html +0 -18
- package/module/print.js +0 -14331
package/docs/pie-schema.json
CHANGED
|
@@ -54,6 +54,16 @@
|
|
|
54
54
|
"type": "boolean",
|
|
55
55
|
"title": "promptEnabled"
|
|
56
56
|
},
|
|
57
|
+
"spellCheckEnabled": {
|
|
58
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"title": "spellCheckEnabled"
|
|
61
|
+
},
|
|
62
|
+
"playerSpellCheckEnabled": {
|
|
63
|
+
"description": "Indicates if spellcheck is enabled for the player. Default value is true",
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"title": "playerSpellCheckEnabled"
|
|
66
|
+
},
|
|
57
67
|
"rationale": {
|
|
58
68
|
"description": "Indicates correct answer rationale",
|
|
59
69
|
"type": "string",
|
|
@@ -121,6 +131,11 @@
|
|
|
121
131
|
},
|
|
122
132
|
"title": "maxLengthPerChoice"
|
|
123
133
|
},
|
|
134
|
+
"rubricEnabled": {
|
|
135
|
+
"description": "Indicates if Rubric is enabled",
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"title": "rubricEnabled"
|
|
138
|
+
},
|
|
124
139
|
"id": {
|
|
125
140
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
126
141
|
"type": "string",
|
|
@@ -139,9 +154,12 @@
|
|
|
139
154
|
"element",
|
|
140
155
|
"id",
|
|
141
156
|
"markup",
|
|
157
|
+
"playerSpellCheckEnabled",
|
|
142
158
|
"rationale",
|
|
143
159
|
"rationaleEnabled",
|
|
144
160
|
"rubric",
|
|
161
|
+
"rubricEnabled",
|
|
162
|
+
"spellCheckEnabled",
|
|
145
163
|
"studentInstructionsEnabled",
|
|
146
164
|
"teacherInstructionsEnabled"
|
|
147
165
|
],
|
|
@@ -162,6 +180,27 @@
|
|
|
162
180
|
}
|
|
163
181
|
}
|
|
164
182
|
},
|
|
183
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
184
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
185
|
+
"type": "object",
|
|
186
|
+
"properties": {
|
|
187
|
+
"teacherInstructions": {
|
|
188
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
189
|
+
"type": "number",
|
|
190
|
+
"title": "teacherInstructions"
|
|
191
|
+
},
|
|
192
|
+
"prompt": {
|
|
193
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
194
|
+
"type": "number",
|
|
195
|
+
"title": "prompt"
|
|
196
|
+
},
|
|
197
|
+
"rationale": {
|
|
198
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
199
|
+
"type": "number",
|
|
200
|
+
"title": "rationale"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
165
204
|
"Choice": {
|
|
166
205
|
"title": "Choice",
|
|
167
206
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -23,6 +23,14 @@ The item stem for the question
|
|
|
23
23
|
|
|
24
24
|
Indicates if the prompt is enabled
|
|
25
25
|
|
|
26
|
+
# `spellCheckEnabled` (boolean, required)
|
|
27
|
+
|
|
28
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
29
|
+
|
|
30
|
+
# `playerSpellCheckEnabled` (boolean, required)
|
|
31
|
+
|
|
32
|
+
Indicates if spellcheck is enabled for the player. Default value is true
|
|
33
|
+
|
|
26
34
|
# `rationale` (string, required)
|
|
27
35
|
|
|
28
36
|
Indicates correct answer rationale
|
|
@@ -81,6 +89,10 @@ Indicates the maximum length for each response area
|
|
|
81
89
|
|
|
82
90
|
The object is an array with all elements of the type `number`.
|
|
83
91
|
|
|
92
|
+
# `rubricEnabled` (boolean, required)
|
|
93
|
+
|
|
94
|
+
Indicates if Rubric is enabled
|
|
95
|
+
|
|
84
96
|
# `id` (string, required)
|
|
85
97
|
|
|
86
98
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -107,6 +119,22 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
107
119
|
|
|
108
120
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
109
121
|
|
|
122
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
123
|
+
|
|
124
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
125
|
+
|
|
126
|
+
### `teacherInstructions` (number)
|
|
127
|
+
|
|
128
|
+
Indicates the max dimension for images in teacher instructions
|
|
129
|
+
|
|
130
|
+
### `prompt` (number)
|
|
131
|
+
|
|
132
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
133
|
+
|
|
134
|
+
### `rationale` (number)
|
|
135
|
+
|
|
136
|
+
Indicates the max dimension for images in rationale
|
|
137
|
+
|
|
110
138
|
## `Choice` (object)
|
|
111
139
|
|
|
112
140
|
Properties of the `Choice` object:
|
package/lib/index.js
CHANGED
|
@@ -62,6 +62,7 @@ var InlineDropdown = /*#__PURE__*/function (_HTMLElement) {
|
|
|
62
62
|
mode: _this._model.mode,
|
|
63
63
|
maxLengthPerChoice: _this._model.maxLengthPerChoice,
|
|
64
64
|
maxLengthPerChoiceEnabled: _this._model.maxLengthPerChoiceEnabled,
|
|
65
|
+
playerSpellCheckEnabled: _this._model.playerSpellCheckEnabled,
|
|
65
66
|
value: _this._session.value,
|
|
66
67
|
feedback: _this._model.feedback,
|
|
67
68
|
displayType: _this._model.displayType,
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["InlineDropdown","_model","_session","elem","React","createElement","Main","teacherInstructions","prompt","note","showNote","env","rationale","disabled","choices","markup","mode","maxLengthPerChoice","maxLengthPerChoiceEnabled","value","feedback","displayType","onChange","changeSession","ReactDOM","render","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","session","dispatchChangedEvent","_render","m","ModelSetEvent","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["InlineDropdown","_model","_session","elem","React","createElement","Main","teacherInstructions","prompt","note","showNote","env","rationale","disabled","choices","markup","mode","maxLengthPerChoice","maxLengthPerChoiceEnabled","playerSpellCheckEnabled","value","feedback","displayType","onChange","changeSession","ReactDOM","render","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","session","dispatchChangedEvent","_render","m","ModelSetEvent","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;IAEqBA,c;;;;;AACnB,4BAAc;AAAA;;AAAA;AACZ;AADY,gGAwBJ,YAAM;AACd,UAAI,MAAKC,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAIC,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,UAAAA,mBAAmB,EAAE,MAAKN,MAAL,CAAYM,mBADE;AAEnCC,UAAAA,MAAM,EAAE,MAAKP,MAAL,CAAYO,MAFe;AAGnCC,UAAAA,IAAI,EAAE,MAAKR,MAAL,CAAYQ,IAHiB;AAInCC,UAAAA,QAAQ,EAAE,MAAKT,MAAL,CAAYS,QAJa;AAKnCC,UAAAA,GAAG,EAAE,MAAKV,MAAL,CAAYU,GALkB;AAMnCC,UAAAA,SAAS,EAAE,MAAKX,MAAL,CAAYW,SANY;AAOnCC,UAAAA,QAAQ,EAAE,MAAKZ,MAAL,CAAYY,QAPa;AAQnCC,UAAAA,OAAO,EAAE,MAAKb,MAAL,CAAYa,OARc;AASnCC,UAAAA,MAAM,EAAE,MAAKd,MAAL,CAAYc,MATe;AAUnCC,UAAAA,IAAI,EAAE,MAAKf,MAAL,CAAYe,IAViB;AAWnCC,UAAAA,kBAAkB,EAAE,MAAKhB,MAAL,CAAYgB,kBAXG;AAYnCC,UAAAA,yBAAyB,EAAE,MAAKjB,MAAL,CAAYiB,yBAZJ;AAanCC,UAAAA,uBAAuB,EAAE,MAAKlB,MAAL,CAAYkB,uBAbF;AAcnCC,UAAAA,KAAK,EAAE,MAAKlB,QAAL,CAAckB,KAdc;AAenCC,UAAAA,QAAQ,EAAE,MAAKpB,MAAL,CAAYoB,QAfa;AAgBnCC,UAAAA,WAAW,EAAE,MAAKrB,MAAL,CAAYqB,WAhBU;AAiBnCC,UAAAA,QAAQ,EAAE,MAAKC;AAjBoB,SAA1B,CAAX;;AAoBAC,6BAASC,MAAT,CAAgBvB,IAAhB,kDAA4B,YAAM;AAChC;AACD,SAFD;AAGD;AACF,KAlDa;AAAA,6GAoDS,YAAM;AAC3B,YAAKwB,aAAL,CAAmB,IAAIC,oCAAJ,CAAwB,MAAKC,OAAL,CAAaC,WAAb,EAAxB,EAAoD,MAAKC,OAAL,IAAgB,CAAC,CAAC,MAAKA,OAAL,CAAaX,KAAnF,CAAnB;AACD,KAtDa;AAAA,sGAwDE,UAACA,KAAD,EAAW;AACzB,YAAKW,OAAL,CAAaX,KAAb,GAAqBA,KAArB;;AACA,YAAKY,oBAAL;;AACA,YAAKC,OAAL;AACD,KA5Da;AAEZ,UAAKhC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAHY;AAIb;;;;SAED,aAAUgC,CAAV,EAAa;AACX,WAAKjC,MAAL,GAAciC,CAAd;AACA,WAAKP,aAAL,CACE,IAAIQ,8BAAJ,CAAkB,KAAKN,OAAL,CAAaC,WAAb,EAAlB,EAA8C,KAAKC,OAAL,IAAgB,CAAC,CAAC,KAAKA,OAAL,CAAaX,KAA7E,EAAoF,CAAC,CAAC,KAAKnB,MAA3F,CADF;;AAIA,WAAKgC,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAK/B,QAAZ;AACD,K;SAPD,aAAYkC,CAAZ,EAAe;AACb,WAAKlC,QAAL,GAAgBkC,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WA4CD,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;kDAjEyCI,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport Main from './main';\n\nexport default class InlineDropdown extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model),\n );\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n _render = () => {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n teacherInstructions: this._model.teacherInstructions,\n prompt: this._model.prompt,\n note: this._model.note,\n showNote: this._model.showNote,\n env: this._model.env,\n rationale: this._model.rationale,\n disabled: this._model.disabled,\n choices: this._model.choices,\n markup: this._model.markup,\n mode: this._model.mode,\n maxLengthPerChoice: this._model.maxLengthPerChoice,\n maxLengthPerChoiceEnabled: this._model.maxLengthPerChoiceEnabled,\n playerSpellCheckEnabled: this._model.playerSpellCheckEnabled,\n value: this._session.value,\n feedback: this._model.feedback,\n displayType: this._model.displayType,\n onChange: this.changeSession,\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n };\n\n dispatchChangedEvent = () => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.session && !!this.session.value));\n };\n\n changeSession = (value) => {\n this.session.value = value;\n this.dispatchChangedEvent();\n this._render();\n };\n\n connectedCallback() {\n this._render();\n }\n}\n"],"file":"index.js"}
|
package/lib/main.js
CHANGED
|
@@ -129,7 +129,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
129
129
|
alwaysShowCorrect = _this$props.alwaysShowCorrect,
|
|
130
130
|
maxLengthPerChoice = _this$props.maxLengthPerChoice,
|
|
131
131
|
maxLengthPerChoiceEnabled = _this$props.maxLengthPerChoiceEnabled,
|
|
132
|
-
displayType = _this$props.displayType
|
|
132
|
+
displayType = _this$props.displayType,
|
|
133
|
+
playerSpellCheckEnabled = _this$props.playerSpellCheckEnabled;
|
|
133
134
|
|
|
134
135
|
var _ref = env || {},
|
|
135
136
|
role = _ref.role;
|
|
@@ -169,7 +170,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
169
170
|
showCorrectAnswer: showCorrectAnswer,
|
|
170
171
|
value: value,
|
|
171
172
|
maxLength: maxLengthPerChoice,
|
|
172
|
-
adjustedLimit: maxLengthPerChoiceEnabled
|
|
173
|
+
adjustedLimit: maxLengthPerChoiceEnabled,
|
|
174
|
+
spellCheck: playerSpellCheckEnabled
|
|
173
175
|
})), displayNote && /*#__PURE__*/_react["default"].createElement("div", {
|
|
174
176
|
className: (0, _classnames["default"])(classes.note, 'note'),
|
|
175
177
|
dangerouslySetInnerHTML: {
|
|
@@ -205,7 +207,8 @@ exports.Main = Main;
|
|
|
205
207
|
onChange: _propTypes["default"].func,
|
|
206
208
|
alwaysShowCorrect: _propTypes["default"].bool,
|
|
207
209
|
animationsDisabled: _propTypes["default"].bool,
|
|
208
|
-
maxLengthPerChoice: _propTypes["default"].array
|
|
210
|
+
maxLengthPerChoice: _propTypes["default"].array,
|
|
211
|
+
playerSpellCheckEnabled: _propTypes["default"].bool
|
|
209
212
|
});
|
|
210
213
|
(0, _defineProperty2["default"])(Main, "defaultProps", {
|
|
211
214
|
value: {}
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.js"],"names":["Main","showCorrectAnswer","props","alwaysShowCorrect","value","maxLengthPerChoice","every","val","i","arr","onChange","maxWait","setState","state","getChangeSession","changeSession","nextProps","feedback","classes","mode","prompt","rationale","teacherInstructions","note","showNote","env","animationsDisabled","maxLengthPerChoiceEnabled","displayType","role","displayNote","mainClasses","mainContainer","noBorderColor","teacherInstructionsDiv","rationaleDiv","display","collapsible","hidden","visible","toggleShowCorrect","__html","React","Component","PropTypes","object","isRequired","string","bool","disabled","markup","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","inlineDisplay","blockDisplay","margin","borderColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;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AACb1B,MAAAA,OAAO,EAAE;AADI,KANQ;AASvB2B,IAAAA,YAAY,EAAE;AACZ3B,MAAAA,OAAO,EAAE;AADG,KATS;AAYvBb,IAAAA,IAAI,EAAE;AACJgC,MAAAA,OAAO,EAAE;AADL,KAZiB;AAevBlB,IAAAA,WAAW,EAAE;AACX2B,MAAAA,MAAM,YAAKV,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAA1B;AADK,KAfU;AAkBvBxB,IAAAA,aAAa,EAAE;AACb,aAAO;AACLgC,QAAAA,WAAW,YAAKP,gBAAMC,IAAN,EAAL;AADN;AADM;AAlBQ,GAAL;AAAA,CAApB;;eAyBe,wBAAWN,MAAX,EAAmBrD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport {color, Collapsible, hasText, PreviewPrompt} from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n prompt: PropTypes.string,\n note: PropTypes.string,\n showNote: PropTypes.bool,\n env: PropTypes.object,\n rationale: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n maxLengthPerChoice: PropTypes.array\n };\n\n static defaultProps = {\n value: {}\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n value: this.props.value\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = maxLengthPerChoice =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, i, arr) => val === arr[0] && val === 1) ? this.props.onChange\n : debounce(this.props.onChange, 1500, { maxWait: 1500 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = value => {\n this.setState({ value });\n\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer, value } = this.state;\n const {\n classes,\n mode,\n prompt,\n rationale,\n teacherInstructions,\n note,\n showNote,\n env,\n animationsDisabled,\n alwaysShowCorrect,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n displayType\n } = this.props;\n const { role } = env || {};\n const displayNote = (showCorrectAnswer || mode === 'view' && role === 'instructor') && showNote && note;\n const mainClasses = classNames([classes.mainContainer, {\n [classes.noBorderColor]: alwaysShowCorrect\n }]);\n\n const teacherInstructionsDiv = <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />;\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n return (\n <div className={mainClasses} style={{ display: `${displayType}` }}>\n {\n teacherInstructions && hasText(teacherInstructions) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n : teacherInstructionsDiv}\n </div>\n )\n }\n {!alwaysShowCorrect && <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n />}\n {prompt && <PreviewPrompt prompt={prompt} />}\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n />\n {displayNote && (\n <div\n className={classNames(classes.note, 'note')}\n dangerouslySetInnerHTML={{ __html: `<strong>Note:</strong> ${note}` }}\n />\n )}\n {rationale && hasText(rationale) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n >\n {rationaleDiv}\n </Collapsible>\n : rationaleDiv}\n </div>\n )}\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background()\n },\n inlineDisplay: {\n display: 'inline-block'\n },\n blockDisplay: {\n display: 'block'\n },\n note: {\n padding: '5px 0'\n },\n collapsible: {\n margin: `${theme.spacing.unit * 2}px 0`\n },\n noBorderColor: {\n '& *': {\n borderColor: `${color.text()} !important`\n }\n }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"sources":["../src/main.js"],"names":["Main","showCorrectAnswer","props","alwaysShowCorrect","value","maxLengthPerChoice","every","val","i","arr","onChange","maxWait","setState","state","getChangeSession","changeSession","nextProps","feedback","classes","mode","prompt","rationale","teacherInstructions","note","showNote","env","animationsDisabled","maxLengthPerChoiceEnabled","displayType","playerSpellCheckEnabled","role","displayNote","mainClasses","mainContainer","noBorderColor","teacherInstructionsDiv","rationaleDiv","display","collapsible","hidden","visible","toggleShowCorrect","__html","React","Component","PropTypes","object","isRequired","string","bool","disabled","markup","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","inlineDisplay","blockDisplay","margin","borderColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IA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BAAMG,UAAN;AAHJ,KADU;AAMzBC,IAAAA,aAAa,EAAE;AACb1B,MAAAA,OAAO,EAAE;AADI,KANU;AASzB2B,IAAAA,YAAY,EAAE;AACZ3B,MAAAA,OAAO,EAAE;AADG,KATW;AAYzBd,IAAAA,IAAI,EAAE;AACJiC,MAAAA,OAAO,EAAE;AADL,KAZmB;AAezBlB,IAAAA,WAAW,EAAE;AACX2B,MAAAA,MAAM,YAAKV,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAA1B;AADK,KAfY;AAkBzBxB,IAAAA,aAAa,EAAE;AACb,aAAO;AACLgC,QAAAA,WAAW,YAAKP,gBAAMC,IAAN,EAAL;AADN;AADM;AAlBU,GAAZ;AAAA,CAAf;;eAyBe,wBAAWN,MAAX,EAAmBtD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, PreviewPrompt } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n prompt: PropTypes.string,\n note: PropTypes.string,\n showNote: PropTypes.bool,\n env: PropTypes.object,\n rationale: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n maxLengthPerChoice: PropTypes.array,\n playerSpellCheckEnabled: PropTypes.bool,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n value: this.props.value,\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = (maxLengthPerChoice) =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, i, arr) => val === arr[0] && val === 1)\n ? this.props.onChange\n : debounce(this.props.onChange, 1500, { maxWait: 1500 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = (value) => {\n this.setState({ value });\n\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer, value } = this.state;\n const {\n classes,\n mode,\n prompt,\n rationale,\n teacherInstructions,\n note,\n showNote,\n env,\n animationsDisabled,\n alwaysShowCorrect,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n displayType,\n playerSpellCheckEnabled,\n } = this.props;\n\n const { role } = env || {};\n const displayNote = (showCorrectAnswer || (mode === 'view' && role === 'instructor')) && showNote && note;\n const mainClasses = classNames([\n classes.mainContainer,\n {\n [classes.noBorderColor]: alwaysShowCorrect,\n },\n ]);\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n return (\n <div className={mainClasses} style={{ display: `${displayType}` }}>\n {teacherInstructions && hasText(teacherInstructions) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n />\n )}\n {prompt && <PreviewPrompt prompt={prompt} />}\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n spellCheck={playerSpellCheckEnabled}\n />\n {displayNote && (\n <div\n className={classNames(classes.note, 'note')}\n dangerouslySetInnerHTML={{ __html: `<strong>Note:</strong> ${note}` }}\n />\n )}\n {rationale && hasText(rationale) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>{rationaleDiv}</Collapsible>\n ) : (\n rationaleDiv\n )}\n </div>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background(),\n },\n inlineDisplay: {\n display: 'inline-block',\n },\n blockDisplay: {\n display: 'block',\n },\n note: {\n padding: '5px 0',\n },\n collapsible: {\n margin: `${theme.spacing.unit * 2}px 0`,\n },\n noBorderColor: {\n '& *': {\n borderColor: `${color.text()} !important`,\n },\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
|
package/lib/print.js
CHANGED
|
@@ -35,9 +35,9 @@ var _mathRendering = require("@pie-lib/math-rendering");
|
|
|
35
35
|
|
|
36
36
|
var _debug = _interopRequireDefault(require("debug"));
|
|
37
37
|
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
39
|
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
43
|
|
package/lib/print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","rationale","rationaleEnabled","alwaysShowCorrect","mode","disabled","animationsDisabled","ExplicitConstructedResponsePrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","onChange","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,iDAAN,CAAZ;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;AAEAH,EAAAA,KAAK,CAACI,MAAN,GAAeJ,KAAK,CAACK,aAAN,KAAwB,KAAxB,GAAgCL,KAAK,CAACI,MAAtC,GAA+CE,SAA9D;AACAN,EAAAA,KAAK,CAACO,mBAAN,
|
|
1
|
+
{"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","rationale","rationaleEnabled","alwaysShowCorrect","mode","disabled","animationsDisabled","ExplicitConstructedResponsePrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","onChange","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,iDAAN,CAAZ;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;AAEAH,EAAAA,KAAK,CAACI,MAAN,GAAeJ,KAAK,CAACK,aAAN,KAAwB,KAAxB,GAAgCL,KAAK,CAACI,MAAtC,GAA+CE,SAA9D;AACAN,EAAAA,KAAK,CAACO,mBAAN,GACEL,KAAK,IAAIF,KAAK,CAACQ,0BAAN,KAAqC,KAA9C,GAAsDR,KAAK,CAACO,mBAA5D,GAAkFD,SADpF;AAEAN,EAAAA,KAAK,CAACS,SAAN,GAAkBP,KAAK,IAAIF,KAAK,CAACU,gBAAN,KAA2B,KAApC,GAA4CV,KAAK,CAACS,SAAlD,GAA8DH,SAAhF;AAEAN,EAAAA,KAAK,CAACW,iBAAN,GAA0BT,KAA1B;AACAF,EAAAA,KAAK,CAACY,IAAN,GAAaV,KAAK,GAAG,UAAH,GAAgBF,KAAK,CAACY,IAAxC;AAEAZ,EAAAA,KAAK,CAACa,QAAN,GAAiB,IAAjB;AACAb,EAAAA,KAAK,CAACc,kBAAN,GAA2B,IAA3B;AAEA,SAAOd,KAAP;AACD,CAfD;;IAiBqBe,gC;;;;;AACnB,8CAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AACA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAGrB,iBAAiB,CAAC,MAAKkB,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,kCACKJ,UADL;AAEEK,UAAAA,QAAQ,EAAE,oBAAM,CAAE;AAFpB,WAFF;;AAOAC,6BAASC,MAAT,CAAgBN,OAAhB,kDAA+B,YAAM;AACnCvB,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAdD,MAcO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAnBc,EAoBf,EApBe,EAqBf;AAAE8B,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KArBe,CAAjB;AALY;AA4Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKd,QAAL,GAAgBc,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKd,MAAL,GAAcc,CAAd;;AACA,WAAKZ,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAvCsCa,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:explicit-constructed-response:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.rationale = instr && model.rationaleEnabled !== false ? model.rationale : undefined;\n\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class ExplicitConstructedResponsePrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n onChange: () => {},\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "3.12.
|
|
7
|
+
"version": "3.12.1-beta.1443+449763c04",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@material-ui/core": "^3.9.2",
|
|
15
15
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
16
|
-
"@pie-lib/correct-answer-toggle": "^2.3.
|
|
17
|
-
"@pie-lib/mask-markup": "
|
|
18
|
-
"@pie-lib/math-rendering": "^2.
|
|
19
|
-
"@pie-lib/render-ui": "^4.12
|
|
16
|
+
"@pie-lib/correct-answer-toggle": "^2.3.62",
|
|
17
|
+
"@pie-lib/mask-markup": "2.0.0-beta.1",
|
|
18
|
+
"@pie-lib/math-rendering": "^2.5.12",
|
|
19
|
+
"@pie-lib/render-ui": "^4.14.12",
|
|
20
20
|
"classnames": "^2.2.5",
|
|
21
21
|
"lodash": "^4.17.10",
|
|
22
22
|
"prop-types": "^15.6.1",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "449763c046b78327513c38ea5367b8d4da120760",
|
|
29
29
|
"main": "lib/index.js",
|
|
30
30
|
"module": "src/index.js",
|
|
31
31
|
"exports": {
|