@pie-element/math-templated 5.0.1-next.19 → 5.0.1-next.28
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/configure/package.json +4 -4
- package/controller/package.json +2 -2
- package/module/configure.js +1 -1
- package/module/controller.js +105 -85
- package/module/element.js +1 -1
- package/module/manifest.json +4 -8
- package/module/print.js +1 -1
- package/package.json +7 -7
package/configure/package.json
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@material-ui/core": "^3.9.2",
|
|
10
10
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
11
|
-
"@pie-lib/config-ui": "^11.25.
|
|
12
|
-
"@pie-lib/editable-html": "^11.17.
|
|
13
|
-
"@pie-lib/math-toolbar": "^1.27.
|
|
14
|
-
"@pie-lib/render-ui": "^4.31.
|
|
11
|
+
"@pie-lib/config-ui": "^11.25.1",
|
|
12
|
+
"@pie-lib/editable-html": "^11.17.1",
|
|
13
|
+
"@pie-lib/math-toolbar": "^1.27.1",
|
|
14
|
+
"@pie-lib/render-ui": "^4.31.1",
|
|
15
15
|
"debug": "^3.1.0",
|
|
16
16
|
"lodash": "^4.17.15",
|
|
17
17
|
"prop-types": "^15.6.2",
|
package/controller/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@pie-framework/math-validation": "^1.4.2",
|
|
10
|
-
"@pie-lib/controller-utils": "^0.
|
|
11
|
-
"@pie-lib/translator": "^2.
|
|
10
|
+
"@pie-lib/controller-utils": "^0.19.4",
|
|
11
|
+
"@pie-lib/translator": "^2.20.4",
|
|
12
12
|
"debug": "^3.1.0",
|
|
13
13
|
"lodash": "^4.17.15"
|
|
14
14
|
},
|
package/module/configure.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_dll_react as e,_dll_prop_types as t,_dll_material_ui__core as n,_dll_material_ui__core_styles as a,_dll_material_ui__icons as o,_dll_pie_lib__render_ui as s,_dll_lodash as i,_dll_debug as l,_dll_react_dom as r}from"../../../@pie-lib/shared-module@^1.14.0/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.19.0/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.6.0/module/index.js";import{_dll_pie_lib__math_toolbar as c}from"../../../@pie-lib/math-edit-module@^2.4.0/module/index.js";var h={};Object.defineProperty(h,"__esModule",{value:!0});class u extends CustomEvent{constructor(e,t=!1){super(u.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}u.TYPE="model.updated";var g=h.ModelUpdatedEvent=u;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.image";var b=h.DeleteImageEvent=m;class _ extends CustomEvent{constructor(e){super(_.TYPE,{bubbles:!0,detail:e}),this.handler=e}}_.TYPE="insert.image";var C=h.InsertImageEvent=_;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.sound";var E=h.DeleteSoundEvent=y;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.sound";var S=h.InsertSoundEvent=f;const v=e,w=t,{Card:x}=n,{CardContent:A}=n,{Button:T}=n,{FormControlLabel:I}=n,{Typography:k}=n,{InputLabel:R}=n,{Checkbox:M}=n,{Select:N}=n,{MenuItem:O}=n,{IconButton:P}=n,{withStyles:K}=a,{Delete:D}=o,{color:q}=s,{InputContainer:j}=p,{MathToolbar:B}=c;class L extends v.Component{static __initStatic(){this.propTypes={classes:w.object.isRequired,defaultResponse:w.bool,error:w.object,mode:w.oneOfType([w.string,w.number]),onResponseChange:w.func.isRequired,onResponseDone:w.func.isRequired,response:w.object.isRequired,cIgnoreOrder:w.object.isRequired,cAllowTrailingZeros:w.object.isRequired,responseKey:w.number.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"8"}}constructor(e){super(e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),L.prototype.__init4.call(this),L.prototype.__init5.call(this),L.prototype.__init6.call(this),L.prototype.__init7.call(this),L.prototype.__init8.call(this),L.prototype.__init9.call(this),L.prototype.__init10.call(this),L.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.value,a(s,o)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.checked,a(s,o)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o[e]=!t[e],n(o,a)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o.answer=e,n(o,a)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s.alternates[e]=t,a(s,o)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,responseKey:n}=this.props,{alternateIdCounter:a}=this.state,o={...e};o.alternates||(o.alternates={}),o.alternates[a]="",t(o,n),this.setState({alternateIdCounter:a+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};delete o.alternates[e],n(o,a),this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}})))}}__init8(){this.onDone=()=>{const{onResponseDone:e}=this.props;this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}}))),e()}}__init9(){this.onFocus=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}})))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}})))}}__init11(){this.onAlternateDone=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}})))}}render(){const{classes:e,mode:t,responseKey:n,response:a,cAllowTrailingZeros:o,cIgnoreOrder:s,error:i}=this.props,{showKeypad:l}=this.state,{validation:r,answer:p,alternates:d,ignoreOrder:c,allowTrailingZeros:h}=a,u=Object.keys(d||{}).length>0,g={editor:e.responseEditor,mathToolbar:e.mathToolbar},m={minHeight:(l.openCount>0?430:230)+"px"},b=`R ${parseInt(n)+1}`;return v.createElement(x,{className:e.responseContainer,style:m},v.createElement(A,{className:e.cardContent},v.createElement("div",{className:e.titleBar},v.createElement(k,{className:e.title,component:"div"},"Response for ",v.createElement("div",{className:e.responseBox},b)),v.createElement(j,{label:"Validation",className:e.selectContainer},v.createElement(N,{className:e.select,onChange:this.onChange("validation"),value:r||"literal"},v.createElement(O,{value:"literal"},"Literal Validation"),v.createElement(O,{value:"symbolic"},"Symbolic Validation")))),"literal"===r&&v.createElement("div",{className:e.flexContainer},o.enabled&&v.createElement(I,{label:o.label,control:v.createElement(M,{className:e.customColor,checked:h,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),s.enabled&&v.createElement(I,{label:s.label,control:v.createElement(M,{className:e.customColor,checked:c,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),v.createElement("div",{className:e.inputContainer},v.createElement(R,null,"Correct Answer"),v.createElement(B,{keypadMode:t,classNames:g,controlledKeypad:!0,showKeypad:l.main,latex:p||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:i&&i.answer}),i&&i.answer?v.createElement("div",{className:e.errorText},i.answer):null),u&&Object.keys(d).map(((n,a)=>v.createElement("div",{className:e.inputContainer,key:n},v.createElement(R,null,"Alternate",Object.keys(d).length>1?` ${a+1}`:""),v.createElement("div",{className:e.alternateBar},v.createElement(B,{classNames:g,controlledKeypad:!0,keypadMode:t,showKeypad:l[n]||!1,latex:d[n]||"",onChange:this.onAlternateAnswerChange(n),onFocus:this.onAlternateFocus(n),onDone:this.onAlternateDone(n),error:i&&i[n]}),v.createElement(P,{className:e.removeAlternateButton,onClick:this.onRemoveAlternate(n)},v.createElement(D,null))),i&&i[n]?v.createElement("div",{className:e.errorText},i[n]):null))),v.createElement(T,{className:e.alternateButton,type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}L.__initStatic(),L.__initStatic2();var H=K((e=>({responseContainer:{marginBottom:2.5*e.spacing.unit,width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"},cardContent:{paddingBottom:2*e.spacing.unit+"px !important"},title:{fontWeight:700,fontSize:"1.2rem",flex:3},selectContainer:{flex:2},inputContainer:{marginBottom:2*e.spacing.unit},titleBar:{display:"flex",alignItems:"center",justifyContent:"space-between"},responseEditor:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minWidth:"500px",maxWidth:"900px",height:"auto",minHeight:"40px"},mathToolbar:{width:"100%"},alternateButton:{border:`1px solid ${e.palette.grey.A100}`},removeAlternateButton:{marginLeft:e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},responseBox:{background:e.palette.grey.A100,color:e.palette.grey.A700,display:"inline",minWidth:"50px",padding:"8px",border:"1px solid #C0C3CF"},alternateBar:{display:"flex",justifyContent:"space-between",alignItems:"center"},customColor:{color:`${q.tertiary()} !important`}})))(L);const Z="imes|riangle|an|heta|herefore",$="throot|parallel|cong|approx|eq|e|sim",W=new RegExp(`(\\t(?!${Z}))|(\\n(?!${$}))|(\\\\t(?!${Z}))|(\\\\n(?!${$}))`,"g"),z=e=>e.replace(W,"").replace(/\\"/g,'"').replace(/\\\//g,"/"),F=e=>{const t=((e="")=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(z(e||"")||"");return t.querySelectorAll('[data-type="math_templated"]').forEach((e=>e.replaceWith(`{{${e.dataset.index}}}`))),t.innerHTML},Y=/\{\{(\d+)\}\}/g,G=(e,t)=>e?z(e).replace(Y,((e,n)=>{const a=function(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}([t,"access",e=>e[n],"optionalAccess",e=>e.answer])||"";return`<span data-type="math_templated" data-index="${n}" data-value="${a}"></span>`})):"",U=e,V=t,{withStyles:J}=a,{Typography:Q}=n,{Select:X}=n,{MenuItem:ee}=n,{Tooltip:te}=n,{Info:ne}=o,{cloneDeep:ae}=i,{pick:oe}=i,{throttle:se}=i,{InputContainer:ie}=p,{settings:le}=p,{layout:re}=p,{dropdown:pe}=p,de=d,{ALL_PLUGINS:ce}=d;function he(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const{Panel:ue,toggle:ge}=le;class me extends U.Component{constructor(...e){super(...e),me.prototype.__init.call(this),me.prototype.__init2.call(this),me.prototype.__init3.call(this),me.prototype.__init4.call(this),me.prototype.__init5.call(this),me.prototype.__init6.call(this),me.prototype.__init7.call(this),me.prototype.__init8.call(this),me.prototype.__init9.call(this)}static __initStatic(){this.propTypes={model:V.object.isRequired,configuration:V.object.isRequired,classes:V.object.isRequired,onModelChanged:V.func.isRequired,onConfigurationChanged:V.func.isRequired,imageSupport:V.shape({add:V.func.isRequired,delete:V.func.isRequired}),uploadSoundSupport:V.object}}__init(){this.state={}}componentDidMount(){const{model:{slateMarkup:e}}=this.props;this.setState({markup:e})}__init2(){this.handleChange=(e,t)=>{const{onModelChanged:n,model:a}=this.props,o=ae(a);o[e]=t,n(o)}}__init3(){this.onResponseChange=(e,t)=>{const{model:n,onModelChanged:a}=this.props,o={...n};o.responses[t]=e,a(o)}}__init4(){this.onResponseDone=()=>{const{model:e,onModelChanged:t}=this.props;t({...e,slateMarkup:G(e.markup,e.responses)})}}__init5(){this.onChangeResponse=(e,t)=>{const{model:n,onModelChanged:a}=this.props,{responses:o}=n;o[e]?o[e][0].answer=t||"":o[e]=[{answer:t||"",id:"response"+e,allowSpaces:!0}],a({...n,responses:o})}}__init6(){this.onResponsesChanged=e=>{this.props.onModelChanged({...this.props.model,responses:e})}}__init7(){this.onChange=e=>{const{model:{responses:t,validationDefault:n,allowTrailingZerosDefault:a,ignoreOrderDefault:o},onModelChanged:s}=this.props,i={},l=(e=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(e);l.querySelectorAll('[data-type="math_templated"]').forEach(((e,s)=>{const{value:l,index:r}=e.dataset;l||(e.dataset.value=""),i[s]=t[r]||{allowSpaces:!0,validation:n||"symbolic",allowTrailingZeros:a||!1,ignoreOrder:o||!1,answer:"",alternates:{}},e.dataset.index=s.toString()})),console.log("newResponses",i);const r=F(e);this.setState({cachedResponses:void 0},(()=>s({...this.props.model,slateMarkup:l.innerHTML,responses:i,markup:r})))}}__init8(){this.onHandleAreaChange=se((e=>{const{model:{responses:t},onModelChanged:n}=this.props,{cachedResponses:a}=this.state;if(!e)return;const o=t?ae(t):{},s=a?ae(a):{};e.forEach((e=>{const t=e.data.get("index");!o[t]&&s[t]?(Object.assign(o,oe(s,t)),s.hasOwnProperty(t)&&delete s[t]):(Object.assign(s,oe(o,t)),o.hasOwnProperty(t)&&delete o[t])})),this.setState({cachedResponses:s},(()=>n({...this.props.model,responses:o})))}),500,{trailing:!1,leading:!0})}__init9(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:n}=e||{},a=function e(t,n=0){if(!t||n>=16)return null;const a=t.offsetParent;return a?"tooltip"===a.getAttribute("role")?a:e(a,n+1):null}(t),o=a?function e(t,n=0){if(!t||n>=4)return null;const a=he([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return a?a.attributes&&a.attributes["data-keypad"]?a:e(a,n+1):null}(a):null;t&&n&&he([o,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||this.setState({activeAnswerBlock:""})}}render(){const{classes:e,configuration:t,imageSupport:n,model:a,onConfigurationChanged:o,onModelChanged:s,uploadSoundSupport:i}=this.props,{baseInputConfiguration:l={},contentDimensions:r={},prompt:p={},rationale:d={},settingsPanelDisabled:c,teacherInstructions:h={},language:u={},languageChoices:g={},spellCheck:m={},playerSpellCheck:b={},maxImageWidth:_={},maxImageHeight:C={},mathMlOptions:y={},template:E={},editSource:f={},ignoreOrder:S={},allowTrailingZeros:v={},partialScoring:w={},maxResponseAreas:x}=t||{},{errors:A,extraCSSRules:T,promptEnabled:I,rationaleEnabled:k,spellCheckEnabled:R,teacherInstructionsEnabled:M,toolbarEditorPosition:N,responses:O,equationEditor:P}=a||{},{prompt:K,rationale:D,responseAreas:q,teacherInstructions:j,responses:B={}}=A||{},L=(e=>{const{maxResponseAreas:t}=e;return"Validation requirements:\nCorrect answers should not be blank.\nEach answer defined for a response area should be unique.\nThere should be at least 1 "+(t?`and at most ${t} `:"")+"response area"+(t?"s":"")+" defined."})(t),Z={"language.enabled":u.settings&&ge(u.label,!0),language:u.settings&&u.enabled&&pe(g.label,g.options)},$={teacherInstructionsEnabled:h.settings&&ge(h.label),rationaleEnabled:d.settings&&ge(d.label),promptEnabled:p.settings&&ge(p.label),spellCheckEnabled:m.settings&&ge(m.label),playerSpellCheckEnabled:b.settings&&ge(b.label),"editSource.enabled":he([f,"optionalAccess",e=>e.settings])&&ge(f.label,!0),partialScoring:w.settings&&ge(w.label)},W=_&&_.prompt,z=C&&C.prompt,F={position:"top"===N?"top":"bottom"},Y=(e={},t={})=>({...t,...e});return U.createElement(re.ConfigLayout,{extraCSSRules:T,dimensions:r,hideSettings:c,settings:U.createElement(ue,{model:a,configuration:t,onChangeModel:e=>s(e),onChangeConfiguration:o,groups:{Settings:Z,Properties:$}})},M&&U.createElement(ie,{label:h.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.teacherInstructions||"",onChange:e=>this.handleChange("teacherInstructions",e),imageSupport:n,nonEmpty:!1,error:j,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:_&&_.teacherInstructions||W,maxImageHeight:C&&C.teacherInstructions||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),j&&U.createElement("div",{className:e.errorText},j)),I&&U.createElement(ie,{label:p.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.prompt,onChange:e=>this.handleChange("prompt",e),imageSupport:n,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:W,maxImageHeight:z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),K&&U.createElement("div",{className:e.errorText},K)),U.createElement("div",{className:e.tooltipContainer},U.createElement(Q,{className:e.title,component:"div"},"Response Template"),U.createElement(te,{classes:{tooltip:e.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:L},U.createElement(ne,{fontSize:"small",color:"primary"}))),U.createElement(de,{activePlugins:ce,toolbarOpts:{position:"top"},spellCheck:R,pluginProps:Y(he([E,"optionalAccess",e=>e.inputConfiguration]),l),responseAreaProps:{type:"math-templated",respAreaToolbar:null,error:()=>B,onHandleAreaChange:this.onHandleAreaChange,maxResponseAreas:x},className:e.markup,markup:a.slateMarkup,onChange:this.onChange,imageSupport:n,disableImageAlignmentButtons:!0,onBlur:this.onBlur,disabled:!1,highlightShape:!1,error:q,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),q&&U.createElement("div",{className:e.responseAreaError},q),U.createElement(Q,{className:e.title},"Define Response"),U.createElement(ie,{label:"Response Template Equation Editor",className:e.selectContainer},U.createElement(X,{className:e.select,onChange:e=>this.handleChange("equationEditor",e.target.value),value:P},U.createElement(ee,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),U.createElement(ee,{value:"integers"},"Numeric - Integers"),U.createElement(ee,{value:"decimals"},"Numeric - Decimals"),U.createElement(ee,{value:"fractions"},"Numeric - Fractions"),U.createElement(ee,{value:1},"Grade 1 - 2"),U.createElement(ee,{value:3},"Grade 3 - 5"),U.createElement(ee,{value:6},"Grade 6 - 7"),U.createElement(ee,{value:8},"Grade 8 - HS"),U.createElement(ee,{value:"geometry"},"Geometry"),U.createElement(ee,{value:"advanced-algebra"},"Advanced Algebra"),U.createElement(ee,{value:"statistics"},"Statistics"),U.createElement(ee,{value:"item-authoring"},"Item Authoring"))),Object.keys(O||{}).map(((e,t)=>{const n=O[t];return n?U.createElement(H,{key:t,responseKey:t,mode:P,response:n,onResponseChange:this.onResponseChange,onResponseDone:this.onResponseDone,index:t,cIgnoreOrder:S,cAllowTrailingZeros:v,error:B&&B[t]}):null})),k&&U.createElement(ie,{label:d.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.rationale||"",onChange:e=>this.handleChange("rationale",e),imageSupport:n,nonEmpty:!1,error:D,toolbarOpts:F,pluginProps:Y(he([d,"optionalAccess",e=>e.inputConfiguration]),{...l,math:{controlledKeypadMode:!1}}),spellCheck:R,maxImageWidth:_&&_.rationale||W,maxImageHeight:C&&C.rationale||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),D&&U.createElement("div",{className:e.errorText},D)))}}me.__initStatic();var be=J((e=>({promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},prompt:{width:"100%"},errorText:{color:e.palette.error.main,fontSize:"0.75rem",marginTop:e.spacing.unit},responseAreaError:{color:e.palette.error.main,fontSize:"0.75rem",marginBottom:e.spacing.unit},markup:{width:"100%",marginTop:2*e.spacing.unit,marginBottom:3*e.spacing.unit},selectContainer:{width:"100%",marginTop:2*e.spacing.unit},select:{width:"100%"},title:{fontSize:1.25*e.typography.fontSize,fontWeight:"bold"},tooltipContainer:{display:"flex",alignItems:"center",gap:"8px"},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})))(me),_e={allowTrailingZerosDefault:!1,equationEditor:"8",ignoreOrderDefault:!1,markup:"",playerSpellCheckEnabled:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responses:{},spellCheckEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Ce={ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},partialScoring:{settings:!0,label:"Allow Partial Scoring"},baseInputConfiguration:{html:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{label:"Prompt",settings:!0,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},editSource:{label:"Edit Source",settings:!1,enabled:!1},playerSpellCheck:{label:"Student Spellcheck",settings:!0,enabled:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},template:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]},maxResponseAreas:10};const ye=e,Ee=r,fe=l,{defaults:Se}=i,{isArray:ve}=i;function we(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const xe=fe("math-templated:configure");class Ae extends HTMLElement{static __initStatic(){this.prepareModel=(e={})=>{const{validationDefault:t,allowTrailingZerosDefault:n,ignoreOrderDefault:a,responses:o={}}=e,s=Object.keys(o).reduce(((e,s)=>{const i=o[s];return e[s]={...i,validation:i.validation||t,allowTrailingZeros:i.allowTrailingZeros||n,ignoreOrder:i.ignoreOrder||a},e}),{}),i={..._e,...e,responses:s},l=i.slateMarkup||G(i.markup,i.responses),r=F(l);return i.responses&&Object.keys(i.responses).forEach((e=>{ve(i.responses[e])&&(i.responses[e]=(i.responses[e]||[]).map(((e,t)=>e.answer?e:(xe('Choice does not contain "answer" property, which is required.',e),{answer:`${t}`,...e}))))})),{...i,slateMarkup:l,markup:r}}}constructor(){super(),this._model=Ae.prepareModel(),this._configuration=Ce,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=Ae.prepareModel(e),this._render()}set configuration(e){this._configuration=Se(e,Ce),we([e,"access",e=>e.language,"optionalAccess",e=>e.enabled])?we([e,"access",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=e.languageChoices.options[0].value):e.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new g(this._model,t))}onModelChanged(e,t){this._model=Ae.prepareModel(e),this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=e,this._render()}insertImage(e){this.dispatchEvent(new C(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new S(e))}onDeleteSound(e,t){this.dispatchEvent(new E(e,t))}_render(){xe("_render");let e=ye.createElement(be,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});Ee.render(e,this)}}Ae.__initStatic();export{Ae as default};
|
|
1
|
+
import{_dll_react as e,_dll_prop_types as t,_dll_material_ui__core as n,_dll_material_ui__core_styles as a,_dll_material_ui__icons as o,_dll_pie_lib__render_ui as s,_dll_lodash as i,_dll_debug as l,_dll_react_dom as r}from"../../../@pie-lib/shared-module@^1.14.5/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.19.5/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.6.5/module/index.js";import{_dll_pie_lib__math_toolbar as c}from"../../../@pie-lib/math-edit-module@^2.4.5/module/index.js";var h={};Object.defineProperty(h,"__esModule",{value:!0});class u extends CustomEvent{constructor(e,t=!1){super(u.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}u.TYPE="model.updated";var g=h.ModelUpdatedEvent=u;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.image";var b=h.DeleteImageEvent=m;class _ extends CustomEvent{constructor(e){super(_.TYPE,{bubbles:!0,detail:e}),this.handler=e}}_.TYPE="insert.image";var C=h.InsertImageEvent=_;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.sound";var E=h.DeleteSoundEvent=y;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.sound";var S=h.InsertSoundEvent=f;const v=e,w=t,{Card:x}=n,{CardContent:A}=n,{Button:T}=n,{FormControlLabel:I}=n,{Typography:k}=n,{InputLabel:R}=n,{Checkbox:M}=n,{Select:N}=n,{MenuItem:O}=n,{IconButton:P}=n,{withStyles:K}=a,{Delete:D}=o,{color:q}=s,{InputContainer:j}=p,{MathToolbar:B}=c;class L extends v.Component{static __initStatic(){this.propTypes={classes:w.object.isRequired,defaultResponse:w.bool,error:w.object,mode:w.oneOfType([w.string,w.number]),onResponseChange:w.func.isRequired,onResponseDone:w.func.isRequired,response:w.object.isRequired,cIgnoreOrder:w.object.isRequired,cAllowTrailingZeros:w.object.isRequired,responseKey:w.number.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"8"}}constructor(e){super(e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),L.prototype.__init4.call(this),L.prototype.__init5.call(this),L.prototype.__init6.call(this),L.prototype.__init7.call(this),L.prototype.__init8.call(this),L.prototype.__init9.call(this),L.prototype.__init10.call(this),L.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.value,a(s,o)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.checked,a(s,o)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o[e]=!t[e],n(o,a)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o.answer=e,n(o,a)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s.alternates[e]=t,a(s,o)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,responseKey:n}=this.props,{alternateIdCounter:a}=this.state,o={...e};o.alternates||(o.alternates={}),o.alternates[a]="",t(o,n),this.setState({alternateIdCounter:a+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};delete o.alternates[e],n(o,a),this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}})))}}__init8(){this.onDone=()=>{const{onResponseDone:e}=this.props;this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}}))),e()}}__init9(){this.onFocus=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}})))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}})))}}__init11(){this.onAlternateDone=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}})))}}render(){const{classes:e,mode:t,responseKey:n,response:a,cAllowTrailingZeros:o,cIgnoreOrder:s,error:i}=this.props,{showKeypad:l}=this.state,{validation:r,answer:p,alternates:d,ignoreOrder:c,allowTrailingZeros:h}=a,u=Object.keys(d||{}).length>0,g={editor:e.responseEditor,mathToolbar:e.mathToolbar},m={minHeight:(l.openCount>0?430:230)+"px"},b=`R ${parseInt(n)+1}`;return v.createElement(x,{className:e.responseContainer,style:m},v.createElement(A,{className:e.cardContent},v.createElement("div",{className:e.titleBar},v.createElement(k,{className:e.title,component:"div"},"Response for ",v.createElement("div",{className:e.responseBox},b)),v.createElement(j,{label:"Validation",className:e.selectContainer},v.createElement(N,{className:e.select,onChange:this.onChange("validation"),value:r||"literal"},v.createElement(O,{value:"literal"},"Literal Validation"),v.createElement(O,{value:"symbolic"},"Symbolic Validation")))),"literal"===r&&v.createElement("div",{className:e.flexContainer},o.enabled&&v.createElement(I,{label:o.label,control:v.createElement(M,{className:e.customColor,checked:h,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),s.enabled&&v.createElement(I,{label:s.label,control:v.createElement(M,{className:e.customColor,checked:c,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),v.createElement("div",{className:e.inputContainer},v.createElement(R,null,"Correct Answer"),v.createElement(B,{keypadMode:t,classNames:g,controlledKeypad:!0,showKeypad:l.main,latex:p||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:i&&i.answer}),i&&i.answer?v.createElement("div",{className:e.errorText},i.answer):null),u&&Object.keys(d).map(((n,a)=>v.createElement("div",{className:e.inputContainer,key:n},v.createElement(R,null,"Alternate",Object.keys(d).length>1?` ${a+1}`:""),v.createElement("div",{className:e.alternateBar},v.createElement(B,{classNames:g,controlledKeypad:!0,keypadMode:t,showKeypad:l[n]||!1,latex:d[n]||"",onChange:this.onAlternateAnswerChange(n),onFocus:this.onAlternateFocus(n),onDone:this.onAlternateDone(n),error:i&&i[n]}),v.createElement(P,{className:e.removeAlternateButton,onClick:this.onRemoveAlternate(n)},v.createElement(D,null))),i&&i[n]?v.createElement("div",{className:e.errorText},i[n]):null))),v.createElement(T,{className:e.alternateButton,type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}L.__initStatic(),L.__initStatic2();var H=K((e=>({responseContainer:{marginBottom:2.5*e.spacing.unit,width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"},cardContent:{paddingBottom:2*e.spacing.unit+"px !important"},title:{fontWeight:700,fontSize:"1.2rem",flex:3},selectContainer:{flex:2},inputContainer:{marginBottom:2*e.spacing.unit},titleBar:{display:"flex",alignItems:"center",justifyContent:"space-between"},responseEditor:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minWidth:"500px",maxWidth:"900px",height:"auto",minHeight:"40px"},mathToolbar:{width:"100%"},alternateButton:{border:`1px solid ${e.palette.grey.A100}`},removeAlternateButton:{marginLeft:e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},responseBox:{background:e.palette.grey.A100,color:e.palette.grey.A700,display:"inline",minWidth:"50px",padding:"8px",border:"1px solid #C0C3CF"},alternateBar:{display:"flex",justifyContent:"space-between",alignItems:"center"},customColor:{color:`${q.tertiary()} !important`}})))(L);const Z="imes|riangle|an|heta|herefore",$="throot|parallel|cong|approx|eq|e|sim",W=new RegExp(`(\\t(?!${Z}))|(\\n(?!${$}))|(\\\\t(?!${Z}))|(\\\\n(?!${$}))`,"g"),z=e=>e.replace(W,"").replace(/\\"/g,'"').replace(/\\\//g,"/"),F=e=>{const t=((e="")=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(z(e||"")||"");return t.querySelectorAll('[data-type="math_templated"]').forEach((e=>e.replaceWith(`{{${e.dataset.index}}}`))),t.innerHTML},Y=/\{\{(\d+)\}\}/g,G=(e,t)=>e?z(e).replace(Y,((e,n)=>{const a=function(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}([t,"access",e=>e[n],"optionalAccess",e=>e.answer])||"";return`<span data-type="math_templated" data-index="${n}" data-value="${a}"></span>`})):"",U=e,V=t,{withStyles:J}=a,{Typography:Q}=n,{Select:X}=n,{MenuItem:ee}=n,{Tooltip:te}=n,{Info:ne}=o,{cloneDeep:ae}=i,{pick:oe}=i,{throttle:se}=i,{InputContainer:ie}=p,{settings:le}=p,{layout:re}=p,{dropdown:pe}=p,de=d,{ALL_PLUGINS:ce}=d;function he(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const{Panel:ue,toggle:ge}=le;class me extends U.Component{constructor(...e){super(...e),me.prototype.__init.call(this),me.prototype.__init2.call(this),me.prototype.__init3.call(this),me.prototype.__init4.call(this),me.prototype.__init5.call(this),me.prototype.__init6.call(this),me.prototype.__init7.call(this),me.prototype.__init8.call(this),me.prototype.__init9.call(this)}static __initStatic(){this.propTypes={model:V.object.isRequired,configuration:V.object.isRequired,classes:V.object.isRequired,onModelChanged:V.func.isRequired,onConfigurationChanged:V.func.isRequired,imageSupport:V.shape({add:V.func.isRequired,delete:V.func.isRequired}),uploadSoundSupport:V.object}}__init(){this.state={}}componentDidMount(){const{model:{slateMarkup:e}}=this.props;this.setState({markup:e})}__init2(){this.handleChange=(e,t)=>{const{onModelChanged:n,model:a}=this.props,o=ae(a);o[e]=t,n(o)}}__init3(){this.onResponseChange=(e,t)=>{const{model:n,onModelChanged:a}=this.props,o={...n};o.responses[t]=e,a(o)}}__init4(){this.onResponseDone=()=>{const{model:e,onModelChanged:t}=this.props;t({...e,slateMarkup:G(e.markup,e.responses)})}}__init5(){this.onChangeResponse=(e,t)=>{const{model:n,onModelChanged:a}=this.props,{responses:o}=n;o[e]?o[e][0].answer=t||"":o[e]=[{answer:t||"",id:"response"+e,allowSpaces:!0}],a({...n,responses:o})}}__init6(){this.onResponsesChanged=e=>{this.props.onModelChanged({...this.props.model,responses:e})}}__init7(){this.onChange=e=>{const{model:{responses:t,validationDefault:n,allowTrailingZerosDefault:a,ignoreOrderDefault:o},onModelChanged:s}=this.props,i={},l=(e=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(e);l.querySelectorAll('[data-type="math_templated"]').forEach(((e,s)=>{const{value:l,index:r}=e.dataset;l||(e.dataset.value=""),i[s]=t[r]||{allowSpaces:!0,validation:n||"symbolic",allowTrailingZeros:a||!1,ignoreOrder:o||!1,answer:"",alternates:{}},e.dataset.index=s.toString()})),console.log("newResponses",i);const r=F(e);this.setState({cachedResponses:void 0},(()=>s({...this.props.model,slateMarkup:l.innerHTML,responses:i,markup:r})))}}__init8(){this.onHandleAreaChange=se((e=>{const{model:{responses:t},onModelChanged:n}=this.props,{cachedResponses:a}=this.state;if(!e)return;const o=t?ae(t):{},s=a?ae(a):{};e.forEach((e=>{const t=e.data.get("index");!o[t]&&s[t]?(Object.assign(o,oe(s,t)),s.hasOwnProperty(t)&&delete s[t]):(Object.assign(s,oe(o,t)),o.hasOwnProperty(t)&&delete o[t])})),this.setState({cachedResponses:s},(()=>n({...this.props.model,responses:o})))}),500,{trailing:!1,leading:!0})}__init9(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:n}=e||{},a=function e(t,n=0){if(!t||n>=16)return null;const a=t.offsetParent;return a?"tooltip"===a.getAttribute("role")?a:e(a,n+1):null}(t),o=a?function e(t,n=0){if(!t||n>=4)return null;const a=he([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return a?a.attributes&&a.attributes["data-keypad"]?a:e(a,n+1):null}(a):null;t&&n&&he([o,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||this.setState({activeAnswerBlock:""})}}render(){const{classes:e,configuration:t,imageSupport:n,model:a,onConfigurationChanged:o,onModelChanged:s,uploadSoundSupport:i}=this.props,{baseInputConfiguration:l={},contentDimensions:r={},prompt:p={},rationale:d={},settingsPanelDisabled:c,teacherInstructions:h={},language:u={},languageChoices:g={},spellCheck:m={},playerSpellCheck:b={},maxImageWidth:_={},maxImageHeight:C={},mathMlOptions:y={},template:E={},editSource:f={},ignoreOrder:S={},allowTrailingZeros:v={},partialScoring:w={},maxResponseAreas:x}=t||{},{errors:A,extraCSSRules:T,promptEnabled:I,rationaleEnabled:k,spellCheckEnabled:R,teacherInstructionsEnabled:M,toolbarEditorPosition:N,responses:O,equationEditor:P}=a||{},{prompt:K,rationale:D,responseAreas:q,teacherInstructions:j,responses:B={}}=A||{},L=(e=>{const{maxResponseAreas:t}=e;return"Validation requirements:\nCorrect answers should not be blank.\nEach answer defined for a response area should be unique.\nThere should be at least 1 "+(t?`and at most ${t} `:"")+"response area"+(t?"s":"")+" defined."})(t),Z={"language.enabled":u.settings&&ge(u.label,!0),language:u.settings&&u.enabled&&pe(g.label,g.options)},$={teacherInstructionsEnabled:h.settings&&ge(h.label),rationaleEnabled:d.settings&&ge(d.label),promptEnabled:p.settings&&ge(p.label),spellCheckEnabled:m.settings&&ge(m.label),playerSpellCheckEnabled:b.settings&&ge(b.label),"editSource.enabled":he([f,"optionalAccess",e=>e.settings])&&ge(f.label,!0),partialScoring:w.settings&&ge(w.label)},W=_&&_.prompt,z=C&&C.prompt,F={position:"top"===N?"top":"bottom"},Y=(e={},t={})=>({...t,...e});return U.createElement(re.ConfigLayout,{extraCSSRules:T,dimensions:r,hideSettings:c,settings:U.createElement(ue,{model:a,configuration:t,onChangeModel:e=>s(e),onChangeConfiguration:o,groups:{Settings:Z,Properties:$}})},M&&U.createElement(ie,{label:h.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.teacherInstructions||"",onChange:e=>this.handleChange("teacherInstructions",e),imageSupport:n,nonEmpty:!1,error:j,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:_&&_.teacherInstructions||W,maxImageHeight:C&&C.teacherInstructions||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),j&&U.createElement("div",{className:e.errorText},j)),I&&U.createElement(ie,{label:p.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.prompt,onChange:e=>this.handleChange("prompt",e),imageSupport:n,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:W,maxImageHeight:z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),K&&U.createElement("div",{className:e.errorText},K)),U.createElement("div",{className:e.tooltipContainer},U.createElement(Q,{className:e.title,component:"div"},"Response Template"),U.createElement(te,{classes:{tooltip:e.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:L},U.createElement(ne,{fontSize:"small",color:"primary"}))),U.createElement(de,{activePlugins:ce,toolbarOpts:{position:"top"},spellCheck:R,pluginProps:Y(he([E,"optionalAccess",e=>e.inputConfiguration]),l),responseAreaProps:{type:"math-templated",respAreaToolbar:null,error:()=>B,onHandleAreaChange:this.onHandleAreaChange,maxResponseAreas:x},className:e.markup,markup:a.slateMarkup,onChange:this.onChange,imageSupport:n,disableImageAlignmentButtons:!0,onBlur:this.onBlur,disabled:!1,highlightShape:!1,error:q,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),q&&U.createElement("div",{className:e.responseAreaError},q),U.createElement(Q,{className:e.title},"Define Response"),U.createElement(ie,{label:"Response Template Equation Editor",className:e.selectContainer},U.createElement(X,{className:e.select,onChange:e=>this.handleChange("equationEditor",e.target.value),value:P},U.createElement(ee,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),U.createElement(ee,{value:"integers"},"Numeric - Integers"),U.createElement(ee,{value:"decimals"},"Numeric - Decimals"),U.createElement(ee,{value:"fractions"},"Numeric - Fractions"),U.createElement(ee,{value:1},"Grade 1 - 2"),U.createElement(ee,{value:3},"Grade 3 - 5"),U.createElement(ee,{value:6},"Grade 6 - 7"),U.createElement(ee,{value:8},"Grade 8 - HS"),U.createElement(ee,{value:"geometry"},"Geometry"),U.createElement(ee,{value:"advanced-algebra"},"Advanced Algebra"),U.createElement(ee,{value:"statistics"},"Statistics"),U.createElement(ee,{value:"item-authoring"},"Item Authoring"))),Object.keys(O||{}).map(((e,t)=>{const n=O[t];return n?U.createElement(H,{key:t,responseKey:t,mode:P,response:n,onResponseChange:this.onResponseChange,onResponseDone:this.onResponseDone,index:t,cIgnoreOrder:S,cAllowTrailingZeros:v,error:B&&B[t]}):null})),k&&U.createElement(ie,{label:d.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.rationale||"",onChange:e=>this.handleChange("rationale",e),imageSupport:n,nonEmpty:!1,error:D,toolbarOpts:F,pluginProps:Y(he([d,"optionalAccess",e=>e.inputConfiguration]),{...l,math:{controlledKeypadMode:!1}}),spellCheck:R,maxImageWidth:_&&_.rationale||W,maxImageHeight:C&&C.rationale||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),D&&U.createElement("div",{className:e.errorText},D)))}}me.__initStatic();var be=J((e=>({promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},prompt:{width:"100%"},errorText:{color:e.palette.error.main,fontSize:"0.75rem",marginTop:e.spacing.unit},responseAreaError:{color:e.palette.error.main,fontSize:"0.75rem",marginBottom:e.spacing.unit},markup:{width:"100%",marginTop:2*e.spacing.unit,marginBottom:3*e.spacing.unit},selectContainer:{width:"100%",marginTop:2*e.spacing.unit},select:{width:"100%"},title:{fontSize:1.25*e.typography.fontSize,fontWeight:"bold"},tooltipContainer:{display:"flex",alignItems:"center",gap:"8px"},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})))(me),_e={allowTrailingZerosDefault:!1,equationEditor:"8",ignoreOrderDefault:!1,markup:"",playerSpellCheckEnabled:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responses:{},spellCheckEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Ce={ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},partialScoring:{settings:!0,label:"Allow Partial Scoring"},baseInputConfiguration:{html:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{label:"Prompt",settings:!0,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},editSource:{label:"Edit Source",settings:!1,enabled:!1},playerSpellCheck:{label:"Student Spellcheck",settings:!0,enabled:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},template:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]},maxResponseAreas:10};const ye=e,Ee=r,fe=l,{defaults:Se}=i,{isArray:ve}=i;function we(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const xe=fe("math-templated:configure");class Ae extends HTMLElement{static __initStatic(){this.prepareModel=(e={})=>{const{validationDefault:t,allowTrailingZerosDefault:n,ignoreOrderDefault:a,responses:o={}}=e,s=Object.keys(o).reduce(((e,s)=>{const i=o[s];return e[s]={...i,validation:i.validation||t,allowTrailingZeros:i.allowTrailingZeros||n,ignoreOrder:i.ignoreOrder||a},e}),{}),i={..._e,...e,responses:s},l=i.slateMarkup||G(i.markup,i.responses),r=F(l);return i.responses&&Object.keys(i.responses).forEach((e=>{ve(i.responses[e])&&(i.responses[e]=(i.responses[e]||[]).map(((e,t)=>e.answer?e:(xe('Choice does not contain "answer" property, which is required.',e),{answer:`${t}`,...e}))))})),{...i,slateMarkup:l,markup:r}}}constructor(){super(),this._model=Ae.prepareModel(),this._configuration=Ce,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=Ae.prepareModel(e),this._render()}set configuration(e){this._configuration=Se(e,Ce),we([e,"access",e=>e.language,"optionalAccess",e=>e.enabled])?we([e,"access",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=e.languageChoices.options[0].value):e.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new g(this._model,t))}onModelChanged(e,t){this._model=Ae.prepareModel(e),this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=e,this._render()}insertImage(e){this.dispatchEvent(new C(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new S(e))}onDeleteSound(e,t){this.dispatchEvent(new E(e,t))}_render(){xe("_render");let e=ye.createElement(be,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});Ee.render(e,this)}}Ae.__initStatic();export{Ae as default};
|
package/module/controller.js
CHANGED
|
@@ -1603,7 +1603,7 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
1603
1603
|
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1604
1604
|
function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1605
1605
|
var checkedLoadedFor = {};
|
|
1606
|
-
var Translator
|
|
1606
|
+
var Translator = function (_EventEmitter) {
|
|
1607
1607
|
_inherits(Translator, _EventEmitter);
|
|
1608
1608
|
var _super = _createSuper$2(Translator);
|
|
1609
1609
|
function Translator(services) {
|
|
@@ -3212,7 +3212,7 @@ var I18n = function (_EventEmitter) {
|
|
|
3212
3212
|
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
3213
3213
|
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
3214
3214
|
}
|
|
3215
|
-
this.translator = new Translator
|
|
3215
|
+
this.translator = new Translator(this.services, this.options);
|
|
3216
3216
|
this.translator.on('*', function (event) {
|
|
3217
3217
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
3218
3218
|
args[_key2 - 1] = arguments[_key2];
|
|
@@ -3572,7 +3572,7 @@ var I18n = function (_EventEmitter) {
|
|
|
3572
3572
|
clone.services.utils = {
|
|
3573
3573
|
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
3574
3574
|
};
|
|
3575
|
-
clone.translator = new Translator
|
|
3575
|
+
clone.translator = new Translator(clone.services, clone.options);
|
|
3576
3576
|
clone.translator.on('*', function (event) {
|
|
3577
3577
|
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
3578
3578
|
args[_key4 - 1] = arguments[_key4];
|
|
@@ -3623,26 +3623,41 @@ instance.hasLoadedNamespace;
|
|
|
3623
3623
|
instance.loadNamespaces;
|
|
3624
3624
|
instance.loadLanguages;
|
|
3625
3625
|
|
|
3626
|
+
function _extends() {
|
|
3627
|
+
_extends = Object.assign || function (target) {
|
|
3628
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
3629
|
+
var source = arguments[i];
|
|
3630
|
+
|
|
3631
|
+
for (var key in source) {
|
|
3632
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3633
|
+
target[key] = source[key];
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3638
|
+
return target;
|
|
3639
|
+
};
|
|
3640
|
+
|
|
3641
|
+
return _extends.apply(this, arguments);
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3626
3644
|
var en = {
|
|
3627
3645
|
translation: {
|
|
3628
3646
|
categorize: {
|
|
3629
|
-
limitMaxChoicesPerCategory:
|
|
3630
|
-
|
|
3631
|
-
maxChoicesPerCategoryRestriction:
|
|
3632
|
-
'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].',
|
|
3647
|
+
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
3648
|
+
maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
|
|
3633
3649
|
},
|
|
3634
3650
|
ebsr: {
|
|
3635
|
-
part: 'Part {{index}}'
|
|
3651
|
+
part: 'Part {{index}}'
|
|
3636
3652
|
},
|
|
3637
3653
|
numberLine: {
|
|
3638
3654
|
addElementLimit_one: 'You can only add {{count}} element',
|
|
3639
3655
|
addElementLimit_other: 'You can only add {{count}} elements',
|
|
3640
|
-
clearAll: 'Clear all'
|
|
3656
|
+
clearAll: 'Clear all'
|
|
3641
3657
|
},
|
|
3642
3658
|
imageClozeAssociation: {
|
|
3643
|
-
reachedLimit_one:
|
|
3644
|
-
|
|
3645
|
-
reachedLimit_other: 'Full',
|
|
3659
|
+
reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
|
|
3660
|
+
reachedLimit_other: 'Full'
|
|
3646
3661
|
},
|
|
3647
3662
|
drawingResponse: {
|
|
3648
3663
|
fillColor: 'Fill color',
|
|
@@ -3658,7 +3673,7 @@ var en = {
|
|
|
3658
3673
|
green: 'Green',
|
|
3659
3674
|
white: 'White',
|
|
3660
3675
|
black: 'Black',
|
|
3661
|
-
onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
|
|
3676
|
+
onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
|
|
3662
3677
|
},
|
|
3663
3678
|
charting: {
|
|
3664
3679
|
addCategory: 'Add category',
|
|
@@ -3670,8 +3685,8 @@ var en = {
|
|
|
3670
3685
|
keyLegend: {
|
|
3671
3686
|
incorrectAnswer: 'Student incorrect answer',
|
|
3672
3687
|
correctAnswer: 'Student correct answer',
|
|
3673
|
-
correctKeyAnswer: 'Answer key correct'
|
|
3674
|
-
}
|
|
3688
|
+
correctKeyAnswer: 'Answer key correct'
|
|
3689
|
+
}
|
|
3675
3690
|
},
|
|
3676
3691
|
graphing: {
|
|
3677
3692
|
point: 'Point',
|
|
@@ -3687,25 +3702,24 @@ var en = {
|
|
|
3687
3702
|
vector: 'Vector',
|
|
3688
3703
|
label: 'Label',
|
|
3689
3704
|
redo: 'Redo',
|
|
3690
|
-
reset: 'Reset'
|
|
3705
|
+
reset: 'Reset'
|
|
3691
3706
|
},
|
|
3692
3707
|
mathInline: {
|
|
3693
|
-
primaryCorrectWithAlternates:
|
|
3694
|
-
'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.',
|
|
3708
|
+
primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
|
|
3695
3709
|
},
|
|
3696
3710
|
multipleChoice: {
|
|
3697
3711
|
minSelections: 'Select at least {{minSelections}}.',
|
|
3698
3712
|
maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
|
|
3699
3713
|
maxSelections_other: 'Only {{maxSelections}} answers are allowed.',
|
|
3700
3714
|
minmaxSelections_equal: 'Select {{minSelections}}.',
|
|
3701
|
-
minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.'
|
|
3715
|
+
minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.'
|
|
3702
3716
|
},
|
|
3703
3717
|
selectText: {
|
|
3704
3718
|
correctAnswerSelected: 'Correct',
|
|
3705
3719
|
correctAnswerNotSelected: 'Correct Answer Not Selected',
|
|
3706
3720
|
incorrectSelection: 'Incorrect Selection',
|
|
3707
|
-
key: 'Key'
|
|
3708
|
-
}
|
|
3721
|
+
key: 'Key'
|
|
3722
|
+
}
|
|
3709
3723
|
},
|
|
3710
3724
|
common: {
|
|
3711
3725
|
undo: 'Undo',
|
|
@@ -3714,35 +3728,31 @@ var en = {
|
|
|
3714
3728
|
incorrect: 'Incorrect',
|
|
3715
3729
|
showCorrectAnswer: 'Show correct answer',
|
|
3716
3730
|
hideCorrectAnswer: 'Hide correct answer',
|
|
3717
|
-
commonCorrectAnswerWithAlternates:
|
|
3718
|
-
'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
|
|
3731
|
+
commonCorrectAnswerWithAlternates: 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
|
|
3719
3732
|
warning: 'Warning',
|
|
3720
3733
|
showNote: 'Show Note',
|
|
3721
3734
|
hideNote: 'Hide Note',
|
|
3722
|
-
cancel: 'Cancel'
|
|
3723
|
-
}
|
|
3735
|
+
cancel: 'Cancel'
|
|
3736
|
+
}
|
|
3724
3737
|
};
|
|
3725
3738
|
|
|
3726
3739
|
var es = {
|
|
3727
3740
|
translation: {
|
|
3728
3741
|
categorize: {
|
|
3729
|
-
limitMaxChoicesPerCategory:
|
|
3730
|
-
|
|
3731
|
-
maxChoicesPerCategoryRestriction:
|
|
3732
|
-
'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta',
|
|
3742
|
+
limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
3743
|
+
maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
|
|
3733
3744
|
},
|
|
3734
3745
|
ebsr: {
|
|
3735
|
-
part: 'Parte {{index}}'
|
|
3746
|
+
part: 'Parte {{index}}'
|
|
3736
3747
|
},
|
|
3737
3748
|
numberLine: {
|
|
3738
3749
|
addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
|
|
3739
3750
|
addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
|
|
3740
|
-
clearAll: 'Borrar todo'
|
|
3751
|
+
clearAll: 'Borrar todo'
|
|
3741
3752
|
},
|
|
3742
3753
|
imageClozeAssociation: {
|
|
3743
|
-
reachedLimit_one:
|
|
3744
|
-
|
|
3745
|
-
reachedLimit_other: 'Lleno',
|
|
3754
|
+
reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
3755
|
+
reachedLimit_other: 'Lleno'
|
|
3746
3756
|
},
|
|
3747
3757
|
drawingResponse: {
|
|
3748
3758
|
fillColor: 'Color de relleno',
|
|
@@ -3758,7 +3768,7 @@ var es = {
|
|
|
3758
3768
|
green: 'Verde',
|
|
3759
3769
|
white: 'Blanco',
|
|
3760
3770
|
black: 'Negro',
|
|
3761
|
-
onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
|
|
3771
|
+
onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
|
|
3762
3772
|
},
|
|
3763
3773
|
charting: {
|
|
3764
3774
|
addCategory: 'Añadir categoría',
|
|
@@ -3770,8 +3780,8 @@ var es = {
|
|
|
3770
3780
|
keyLegend: {
|
|
3771
3781
|
incorrectAnswer: 'Respuesta incorrecta del estudiante',
|
|
3772
3782
|
correctAnswer: 'Respuesta correcta del estudiante',
|
|
3773
|
-
correctKeyAnswer: 'Clave de respuesta correcta'
|
|
3774
|
-
}
|
|
3783
|
+
correctKeyAnswer: 'Clave de respuesta correcta'
|
|
3784
|
+
}
|
|
3775
3785
|
},
|
|
3776
3786
|
graphing: {
|
|
3777
3787
|
point: 'Punto',
|
|
@@ -3787,25 +3797,24 @@ var es = {
|
|
|
3787
3797
|
vector: 'Vector',
|
|
3788
3798
|
label: 'Etiqueta',
|
|
3789
3799
|
redo: 'Rehacer',
|
|
3790
|
-
reset: 'Reiniciar'
|
|
3800
|
+
reset: 'Reiniciar'
|
|
3791
3801
|
},
|
|
3792
3802
|
mathInline: {
|
|
3793
|
-
primaryCorrectWithAlternates:
|
|
3794
|
-
'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.',
|
|
3803
|
+
primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
|
|
3795
3804
|
},
|
|
3796
3805
|
multipleChoice: {
|
|
3797
3806
|
minSelections: 'Seleccione al menos {{minSelections}}.',
|
|
3798
3807
|
maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
|
|
3799
3808
|
maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.',
|
|
3800
3809
|
minmaxSelections_equal: 'Seleccione {{minSelections}}.',
|
|
3801
|
-
minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.'
|
|
3810
|
+
minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.'
|
|
3802
3811
|
},
|
|
3803
3812
|
selectText: {
|
|
3804
3813
|
correctAnswerSelected: 'Respuesta Correcta',
|
|
3805
3814
|
correctAnswerNotSelected: 'Respuesta Correcta No Seleccionada',
|
|
3806
3815
|
incorrectSelection: 'Selección Incorrecta',
|
|
3807
|
-
key: 'Clave'
|
|
3808
|
-
}
|
|
3816
|
+
key: 'Clave'
|
|
3817
|
+
}
|
|
3809
3818
|
},
|
|
3810
3819
|
common: {
|
|
3811
3820
|
undo: 'Deshacer',
|
|
@@ -3814,13 +3823,12 @@ var es = {
|
|
|
3814
3823
|
incorrect: 'Incorrect',
|
|
3815
3824
|
showCorrectAnswer: 'Mostrar respuesta correcta',
|
|
3816
3825
|
hideCorrectAnswer: 'Ocultar respuesta correcta',
|
|
3817
|
-
commonCorrectAnswerWithAlternates:
|
|
3818
|
-
'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
|
|
3826
|
+
commonCorrectAnswerWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
|
|
3819
3827
|
warning: 'Advertencia',
|
|
3820
3828
|
showNote: 'Mostrar Nota',
|
|
3821
3829
|
hideNote: 'Ocultar Nota',
|
|
3822
|
-
cancel: 'Cancelar'
|
|
3823
|
-
}
|
|
3830
|
+
cancel: 'Cancelar'
|
|
3831
|
+
}
|
|
3824
3832
|
};
|
|
3825
3833
|
|
|
3826
3834
|
instance.init({
|
|
@@ -3829,15 +3837,15 @@ instance.init({
|
|
|
3829
3837
|
debug: true,
|
|
3830
3838
|
resources: {
|
|
3831
3839
|
en: en,
|
|
3832
|
-
es: es
|
|
3833
|
-
}
|
|
3840
|
+
es: es
|
|
3841
|
+
}
|
|
3834
3842
|
});
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
translator: {
|
|
3838
|
-
...instance,
|
|
3843
|
+
var index = {
|
|
3844
|
+
translator: _extends({}, instance, {
|
|
3839
3845
|
t: (key, options) => {
|
|
3840
|
-
const {
|
|
3846
|
+
const {
|
|
3847
|
+
lng
|
|
3848
|
+
} = options;
|
|
3841
3849
|
|
|
3842
3850
|
switch (lng) {
|
|
3843
3851
|
// these keys don't work with plurals, don't know why, so I added a workaround to convert them to the correct lng
|
|
@@ -3845,6 +3853,7 @@ var Translator = {
|
|
|
3845
3853
|
case 'en-US':
|
|
3846
3854
|
options.lng = 'en';
|
|
3847
3855
|
break;
|
|
3856
|
+
|
|
3848
3857
|
case 'es_ES':
|
|
3849
3858
|
case 'es-ES':
|
|
3850
3859
|
case 'es_MX':
|
|
@@ -3852,13 +3861,19 @@ var Translator = {
|
|
|
3852
3861
|
options.lng = 'es';
|
|
3853
3862
|
break;
|
|
3854
3863
|
}
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3864
|
+
|
|
3865
|
+
return instance.t(key, _extends({
|
|
3866
|
+
lng
|
|
3867
|
+
}, options));
|
|
3868
|
+
}
|
|
3869
|
+
}),
|
|
3870
|
+
languageOptions: [{
|
|
3871
|
+
value: 'en_US',
|
|
3872
|
+
label: 'English (US)'
|
|
3873
|
+
}, {
|
|
3874
|
+
value: 'es_ES',
|
|
3875
|
+
label: 'Spanish'
|
|
3876
|
+
}]
|
|
3862
3877
|
};
|
|
3863
3878
|
|
|
3864
3879
|
// Should be exactly the same as configure/defaults.js
|
|
@@ -3883,26 +3898,6 @@ var defaults = {
|
|
|
3883
3898
|
configuration: {},
|
|
3884
3899
|
};
|
|
3885
3900
|
|
|
3886
|
-
const enabled = (config, env, defaultValue) => {
|
|
3887
|
-
// if model.partialScoring = false
|
|
3888
|
-
// - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
|
|
3889
|
-
// else if model.partialScoring = true || undefined
|
|
3890
|
-
// - if env.partialScoring = false, use dichotomous scoring
|
|
3891
|
-
// - else if env.partialScoring = true, use partial scoring
|
|
3892
|
-
config = config || {};
|
|
3893
|
-
env = env || {};
|
|
3894
|
-
|
|
3895
|
-
if (config.partialScoring === false) {
|
|
3896
|
-
return false;
|
|
3897
|
-
}
|
|
3898
|
-
|
|
3899
|
-
if (env.partialScoring === false) {
|
|
3900
|
-
return false;
|
|
3901
|
-
}
|
|
3902
|
-
|
|
3903
|
-
return typeof defaultValue === 'boolean' ? defaultValue : true;
|
|
3904
|
-
};
|
|
3905
|
-
|
|
3906
3901
|
var getNative = _getNative;
|
|
3907
3902
|
|
|
3908
3903
|
/* Built-in method references that are verified to be native. */
|
|
@@ -4566,14 +4561,39 @@ var Symbol$1 = _Symbol;
|
|
|
4566
4561
|
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined;
|
|
4567
4562
|
symbolProto ? symbolProto.toString : undefined;
|
|
4568
4563
|
|
|
4569
|
-
|
|
4570
|
-
|
|
4564
|
+
const enabled = (config, env, defaultValue) => {
|
|
4565
|
+
// if model.partialScoring = false
|
|
4566
|
+
// - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
|
|
4567
|
+
// else if model.partialScoring = true || undefined
|
|
4568
|
+
// - if env.partialScoring = false, use dichotomous scoring
|
|
4569
|
+
// - else if env.partialScoring = true, use partial scoring
|
|
4570
|
+
config = config || {};
|
|
4571
|
+
env = env || {};
|
|
4572
|
+
|
|
4573
|
+
if (config.partialScoring === false) {
|
|
4574
|
+
return false;
|
|
4575
|
+
}
|
|
4576
|
+
|
|
4577
|
+
if (env.partialScoring === false) {
|
|
4578
|
+
return false;
|
|
4579
|
+
}
|
|
4580
|
+
|
|
4581
|
+
return typeof defaultValue === 'boolean' ? defaultValue : true;
|
|
4582
|
+
};
|
|
4583
|
+
|
|
4584
|
+
var partialScoring = /*#__PURE__*/Object.freeze({
|
|
4585
|
+
__proto__: null,
|
|
4586
|
+
enabled: enabled
|
|
4587
|
+
});
|
|
4588
|
+
|
|
4589
|
+
const lg = n => console[n].bind(console, 'controller-utils:');
|
|
4590
|
+
|
|
4571
4591
|
lg('debug');
|
|
4572
4592
|
lg('log');
|
|
4573
4593
|
lg('warn');
|
|
4574
4594
|
lg('error');
|
|
4575
4595
|
|
|
4576
|
-
const { translator } =
|
|
4596
|
+
const { translator } = index;
|
|
4577
4597
|
|
|
4578
4598
|
const getFeedback = (value) => (value ? 'correct' : 'incorrect');
|
|
4579
4599
|
const getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
|
|
@@ -4664,7 +4684,7 @@ const outcome = (question, session, env) =>
|
|
|
4664
4684
|
if (!session || isEmpty_1(session)) {
|
|
4665
4685
|
resolve({ score: 0, empty: true });
|
|
4666
4686
|
}
|
|
4667
|
-
const partialScoringEnabled = enabled(question, env);
|
|
4687
|
+
const partialScoringEnabled = partialScoring.enabled(question, env);
|
|
4668
4688
|
session = normalizeSession(session);
|
|
4669
4689
|
|
|
4670
4690
|
if (env.mode !== 'evaluate') {
|