@pie-element/placement-ordering 13.0.0-next.42 → 13.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/lib/choice-editor.js +4 -5
- package/configure/lib/choice-editor.js.map +1 -1
- package/configure/lib/choice-tile.js +0 -1
- package/configure/lib/choice-tile.js.map +1 -1
- package/configure/lib/defaults.js +3 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design.js +5 -6
- package/configure/lib/design.js.map +1 -1
- package/configure/lib/index.js +2 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +3 -4
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +8 -8
- package/controller/lib/index.js +9 -11
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/scoring.js +6 -6
- package/controller/lib/scoring.js.map +1 -1
- package/controller/package.json +5 -5
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/ordering.js +6 -9
- package/lib/ordering.js.map +1 -1
- package/lib/placement-ordering.js +8 -9
- package/lib/placement-ordering.js.map +1 -1
- package/lib/tile.js +41 -20
- package/lib/tile.js.map +1 -1
- package/package.json +14 -11
- package/module/configure.js +0 -1
- package/module/controller.js +0 -24482
- package/module/demo.js +0 -75
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -113
- package/module/print.html +0 -18
|
@@ -9,8 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _debug = _interopRequireDefault(require("debug"));
|
|
12
|
-
var
|
|
13
|
-
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
12
|
+
var _lodashEs = require("lodash-es");
|
|
14
13
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
15
14
|
var _styles = require("@mui/material/styles");
|
|
16
15
|
var _renderUi = require("@pie-lib/render-ui");
|
|
@@ -144,12 +143,12 @@ class ChoiceEditor extends _react.default.Component {
|
|
|
144
143
|
correctResponse,
|
|
145
144
|
placementArea
|
|
146
145
|
} = this.props;
|
|
147
|
-
let shuffled = (0,
|
|
146
|
+
let shuffled = (0, _lodashEs.shuffle)(choices);
|
|
148
147
|
|
|
149
148
|
// if placementArea is disabled, make sure we don't shuffle choices in the correct order
|
|
150
|
-
const shuffledCorrect = !placementArea && (0,
|
|
149
|
+
const shuffledCorrect = !placementArea && (0, _lodashEs.isEqual)(shuffled.map(item => item.id), correctResponse.map(item => item.id));
|
|
151
150
|
if (shuffledCorrect) {
|
|
152
|
-
const shuffledTwice = (0,
|
|
151
|
+
const shuffledTwice = (0, _lodashEs.shuffle)(shuffled);
|
|
153
152
|
onChange(shuffledTwice, correctResponse);
|
|
154
153
|
} else {
|
|
155
154
|
onChange(shuffled, correctResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choice-editor.js","names":["_propTypes","_interopRequireDefault","require","_react","_debug","_shuffle","_isEqual","_Button","_styles","_renderUi","_configUi","_choiceTile","findFreeChoiceSlot","choices","slot","ids","map","c","id","includes","log","debug","StyledControls","styled","display","alignItems","justifyContent","StyledAddButton","Button","theme","marginTop","spacing","paddingLeft","paddingRight","transition","opacity","StyledVTiler","gridAutoFlow","gridGap","StyledColumnLabel","InputContainer","width","paddingTop","ErrorText","fontSize","typography","color","palette","error","main","ChoiceEditor","React","Component","constructor","props","_defineProperty2","default","warning","open","onChoiceChange","choice","onChange","correctResponse","index","findIndex","splice","label","onDelete","choicesLabel","length","setState","text","updatedChoices","filter","updatedCorrectResponse","v","addChoice","freeId","newChoice","newCorrectResponse","weight","concat","shuffleChoices","placementArea","shuffled","shuffle","shuffledCorrect","isEqual","item","shuffledTwice","render","imageSupport","toolbarOpts","pluginProps","singularChoiceLabel","pluralChoiceLabel","spellCheck","maxImageWidth","maxImageHeight","errors","mathMlOptions","ordering","state","choicesErrors","orderError","vTilerStyle","gridTemplateColumns","gridTemplateRows","createElement","style","tiles","key","type","bind","onClick","size","variant","toUpperCase","AlertDialog","title","onConfirm","PropTypes","array","isRequired","func","shape","add","delete","object","bool","string","_default","exports"],"sources":["../src/choice-editor.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport shuffle from 'lodash/shuffle';\nimport isEqual from 'lodash/isEqual';\nimport Button from '@mui/material/Button';\nimport { styled } from '@mui/material/styles';\nimport { InputContainer } from '@pie-lib/render-ui';\nimport { AlertDialog } from '@pie-lib/config-ui';\n\nimport ChoiceTile from './choice-tile';\n\nfunction findFreeChoiceSlot(choices) {\n let slot = 1;\n const ids = choices.map((c) => c.id);\n\n while (ids.includes(`c${slot}`)) {\n slot++;\n }\n\n return slot;\n}\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-editor');\n\nconst StyledControls = styled('div')({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n});\n\nconst StyledAddButton = styled(Button)(({ theme }) => ({\n marginTop: theme.spacing(2.5),\n paddingLeft: theme.spacing(1.5),\n paddingRight: theme.spacing(1.5),\n '& .MuiButton-label': {\n transition: 'opacity 200ms linear',\n '&:hover': {\n opacity: 0.3,\n },\n },\n}));\n\nconst StyledVTiler = styled('div')({\n gridAutoFlow: 'column',\n display: 'grid',\n gridGap: '10px',\n alignItems: 'center',\n});\n\nconst StyledColumnLabel = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nclass ChoiceEditor extends React.Component {\n static propTypes = {\n correctResponse: PropTypes.array.isRequired,\n choices: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n maxImageHeight: PropTypes.object,\n maxImageWidth: PropTypes.object,\n toolbarOpts: PropTypes.object,\n pluginProps: PropTypes.object,\n placementArea: PropTypes.bool,\n singularChoiceLabel: PropTypes.string,\n pluralChoiceLabel: PropTypes.string,\n choicesLabel: PropTypes.string,\n errors: PropTypes.object,\n spellCheck: PropTypes.bool,\n };\n\n state = { warning: { open: false } };\n\n constructor(props) {\n super(props);\n\n this.onChoiceChange = (choice) => {\n const { choices, onChange, correctResponse } = this.props;\n const index = choices.findIndex((c) => c.id === choice.id);\n\n choices.splice(index, 1, { ...choices[index], label: choice.label });\n onChange(choices, correctResponse);\n };\n\n this.onDelete = (choice) => {\n const { choices, onChange, correctResponse, choicesLabel } = this.props;\n\n if (choices && choices.length === 3) {\n this.setState({\n warning: {\n open: true,\n text: `There have to be at least 3 ${choicesLabel}.`,\n },\n });\n } else {\n const updatedChoices = choices.filter((c) => c.id !== choice.id);\n const updatedCorrectResponse = correctResponse.filter((v) => v.id !== choice.id);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.addChoice = () => {\n const { choices, correctResponse, onChange, choicesLabel } = this.props;\n\n if (choices && choices.length === 10) {\n this.setState({\n warning: {\n open: true,\n text: `There can be maximum 10 ${choicesLabel}.`,\n },\n });\n } else {\n const freeId = findFreeChoiceSlot(choices);\n const id = `c${freeId}`;\n const newChoice = { id, label: '' };\n\n const newCorrectResponse = {\n id,\n /**\n * Note: weights are not configurable in the existing component\n * so we'll want do disable this in the controller and ignore it for now.\n */\n weight: 0,\n };\n\n const updatedChoices = choices.concat([newChoice]);\n const updatedCorrectResponse = correctResponse.concat([newCorrectResponse]);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.shuffleChoices = () => {\n const { onChange, choices, correctResponse, placementArea } = this.props;\n let shuffled = shuffle(choices);\n\n // if placementArea is disabled, make sure we don't shuffle choices in the correct order\n const shuffledCorrect =\n !placementArea &&\n isEqual(\n shuffled.map((item) => item.id),\n correctResponse.map((item) => item.id),\n );\n\n if (shuffledCorrect) {\n const shuffledTwice = shuffle(shuffled);\n\n onChange(shuffledTwice, correctResponse);\n } else {\n onChange(shuffled, correctResponse);\n }\n };\n }\n\n render() {\n const {\n correctResponse,\n choices,\n imageSupport,\n toolbarOpts,\n pluginProps,\n singularChoiceLabel,\n pluralChoiceLabel,\n choicesLabel,\n spellCheck,\n maxImageWidth,\n maxImageHeight,\n errors,\n mathMlOptions = {},\n ordering,\n } = this.props;\n const { warning } = this.state;\n const { choicesErrors, orderError } = errors || {};\n\n const vTilerStyle = {\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridTemplateRows: `repeat(${choices.length}, 1fr)`,\n };\n\n return (\n <div>\n <StyledVTiler style={{ gridTemplateColumns: 'repeat(2, 1fr)' }}>\n <StyledColumnLabel label={`Student ${choicesLabel || 'Choices'}`} />\n <StyledColumnLabel label=\"Correct Order\" />\n </StyledVTiler>\n <StyledVTiler style={vTilerStyle}>\n {ordering.tiles.map((choice, index) => (\n <ChoiceTile\n key={`${choice.type}-${choice.id}`}\n choice={choice}\n index={index}\n imageSupport={imageSupport}\n onDelete={this.onDelete.bind(this, choice)}\n onChoiceChange={this.onChoiceChange}\n toolbarOpts={toolbarOpts}\n pluginProps={pluginProps}\n choices={choices}\n choicesLabel={choicesLabel}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n error={choicesErrors?.[choice.id] || (orderError && ' ') || null}\n mathMlOptions={mathMlOptions}\n />\n ))}\n </StyledVTiler>\n {orderError && <ErrorText>{orderError}</ErrorText>}\n <StyledControls>\n <StyledAddButton\n onClick={this.shuffleChoices}\n size=\"small\"\n variant=\"contained\">\n {`SHUFFLE ${pluralChoiceLabel}`.toUpperCase()}\n </StyledAddButton>\n\n <StyledAddButton\n onClick={this.addChoice}\n size=\"small\"\n variant=\"contained\">\n {`ADD ${singularChoiceLabel}`.toUpperCase()}\n </StyledAddButton>\n </StyledControls>\n <AlertDialog\n open={warning.open}\n title=\"Warning\"\n text={warning.text}\n onConfirm={() => this.setState({ warning: { open: false } })}\n />\n </div>\n );\n }\n}\n\nexport default ChoiceEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AAEA,SAASU,kBAAkBA,CAACC,OAAO,EAAE;EACnC,IAAIC,IAAI,GAAG,CAAC;EACZ,MAAMC,GAAG,GAAGF,OAAO,CAACG,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,CAAC;EAEpC,OAAOH,GAAG,CAACI,QAAQ,CAAC,IAAIL,IAAI,EAAE,CAAC,EAAE;IAC/BA,IAAI,EAAE;EACR;EAEA,OAAOA,IAAI;AACb;AAEA,MAAMM,GAAG,GAAG,IAAAC,cAAK,EAAC,yDAAyD,CAAC;AAE5E,MAAMC,cAAc,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EACnCC,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,QAAQ;EACpBC,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,MAAMC,eAAe,GAAG,IAAAJ,cAAM,EAACK,eAAM,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACrDC,SAAS,EAAED,KAAK,CAACE,OAAO,CAAC,GAAG,CAAC;EAC7BC,WAAW,EAAEH,KA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,CAACC,IAAK;MACnB6D,KAAK,EAAC,SAAS;MACfhD,IAAI,EAAEd,OAAO,CAACc,IAAK;MACnBiD,SAAS,EAAEA,CAAA,KAAM,IAAI,CAAClD,QAAQ,CAAC;QAAEb,OAAO,EAAE;UAAEC,IAAI,EAAE;QAAM;MAAE,CAAC;IAAE,CAC9D,CACE,CAAC;EAEV;AACF;AAAC,IAAAH,gBAAA,CAAAC,OAAA,EAtLKN,YAAY,eACG;EACjBY,eAAe,EAAE2D,kBAAS,CAACC,KAAK,CAACC,UAAU;EAC3C9G,OAAO,EAAE4G,kBAAS,CAACC,KAAK,CAACC,UAAU;EACnC9D,QAAQ,EAAE4D,kBAAS,CAACG,IAAI,CAACD,UAAU;EACnChC,YAAY,EAAE8B,kBAAS,CAACI,KAAK,CAAC;IAC5BC,GAAG,EAAEL,kBAAS,CAACG,IAAI,CAACD,UAAU;IAC9BI,MAAM,EAAEN,kBAAS,CAACG,IAAI,CAACD;EACzB,CAAC,CAAC;EACFzB,cAAc,EAAEuB,kBAAS,CAACO,MAAM;EAChC/B,aAAa,EAAEwB,kBAAS,CAACO,MAAM;EAC/BpC,WAAW,EAAE6B,kBAAS,CAACO,MAAM;EAC7BnC,WAAW,EAAE4B,kBAAS,CAACO,MAAM;EAC7B7C,aAAa,EAAEsC,kBAAS,CAACQ,IAAI;EAC7BnC,mBAAmB,EAAE2B,kBAAS,CAACS,MAAM;EACrCnC,iBAAiB,EAAE0B,kBAAS,CAACS,MAAM;EACnC9D,YAAY,EAAEqD,kBAAS,CAACS,MAAM;EAC9B/B,MAAM,EAAEsB,kBAAS,CAACO,MAAM;EACxBhC,UAAU,EAAEyB,kBAAS,CAACQ;AACxB,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GAqKYN,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"choice-editor.js","names":["_propTypes","_interopRequireDefault","require","_react","_debug","_lodashEs","_Button","_styles","_renderUi","_configUi","_choiceTile","findFreeChoiceSlot","choices","slot","ids","map","c","id","includes","log","debug","StyledControls","styled","display","alignItems","justifyContent","StyledAddButton","Button","theme","marginTop","spacing","paddingLeft","paddingRight","transition","opacity","StyledVTiler","gridAutoFlow","gridGap","StyledColumnLabel","InputContainer","width","paddingTop","ErrorText","fontSize","typography","color","palette","error","main","ChoiceEditor","React","Component","constructor","props","_defineProperty2","default","warning","open","onChoiceChange","choice","onChange","correctResponse","index","findIndex","splice","label","onDelete","choicesLabel","length","setState","text","updatedChoices","filter","updatedCorrectResponse","v","addChoice","freeId","newChoice","newCorrectResponse","weight","concat","shuffleChoices","placementArea","shuffled","shuffle","shuffledCorrect","isEqual","item","shuffledTwice","render","imageSupport","toolbarOpts","pluginProps","singularChoiceLabel","pluralChoiceLabel","spellCheck","maxImageWidth","maxImageHeight","errors","mathMlOptions","ordering","state","choicesErrors","orderError","vTilerStyle","gridTemplateColumns","gridTemplateRows","createElement","style","tiles","key","type","bind","onClick","size","variant","toUpperCase","AlertDialog","title","onConfirm","PropTypes","array","isRequired","func","shape","add","delete","object","bool","string","_default","exports"],"sources":["../src/choice-editor.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport { isEqual, shuffle } from 'lodash-es';\nimport Button from '@mui/material/Button';\nimport { styled } from '@mui/material/styles';\nimport { InputContainer } from '@pie-lib/render-ui';\nimport { AlertDialog } from '@pie-lib/config-ui';\n\nimport ChoiceTile from './choice-tile';\n\nfunction findFreeChoiceSlot(choices) {\n let slot = 1;\n const ids = choices.map((c) => c.id);\n\n while (ids.includes(`c${slot}`)) {\n slot++;\n }\n\n return slot;\n}\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-editor');\n\nconst StyledControls = styled('div')({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n});\n\nconst StyledAddButton = styled(Button)(({ theme }) => ({\n marginTop: theme.spacing(2.5),\n paddingLeft: theme.spacing(1.5),\n paddingRight: theme.spacing(1.5),\n '& .MuiButton-label': {\n transition: 'opacity 200ms linear',\n '&:hover': {\n opacity: 0.3,\n },\n },\n}));\n\nconst StyledVTiler = styled('div')({\n gridAutoFlow: 'column',\n display: 'grid',\n gridGap: '10px',\n alignItems: 'center',\n});\n\nconst StyledColumnLabel = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nclass ChoiceEditor extends React.Component {\n static propTypes = {\n correctResponse: PropTypes.array.isRequired,\n choices: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n maxImageHeight: PropTypes.object,\n maxImageWidth: PropTypes.object,\n toolbarOpts: PropTypes.object,\n pluginProps: PropTypes.object,\n placementArea: PropTypes.bool,\n singularChoiceLabel: PropTypes.string,\n pluralChoiceLabel: PropTypes.string,\n choicesLabel: PropTypes.string,\n errors: PropTypes.object,\n spellCheck: PropTypes.bool,\n };\n\n state = { warning: { open: false } };\n\n constructor(props) {\n super(props);\n\n this.onChoiceChange = (choice) => {\n const { choices, onChange, correctResponse } = this.props;\n const index = choices.findIndex((c) => c.id === choice.id);\n\n choices.splice(index, 1, { ...choices[index], label: choice.label });\n onChange(choices, correctResponse);\n };\n\n this.onDelete = (choice) => {\n const { choices, onChange, correctResponse, choicesLabel } = this.props;\n\n if (choices && choices.length === 3) {\n this.setState({\n warning: {\n open: true,\n text: `There have to be at least 3 ${choicesLabel}.`,\n },\n });\n } else {\n const updatedChoices = choices.filter((c) => c.id !== choice.id);\n const updatedCorrectResponse = correctResponse.filter((v) => v.id !== choice.id);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.addChoice = () => {\n const { choices, correctResponse, onChange, choicesLabel } = this.props;\n\n if (choices && choices.length === 10) {\n this.setState({\n warning: {\n open: true,\n text: `There can be maximum 10 ${choicesLabel}.`,\n },\n });\n } else {\n const freeId = findFreeChoiceSlot(choices);\n const id = `c${freeId}`;\n const newChoice = { id, label: '' };\n\n const newCorrectResponse = {\n id,\n /**\n * Note: weights are not configurable in the existing component\n * so we'll want do disable this in the controller and ignore it for now.\n */\n weight: 0,\n };\n\n const updatedChoices = choices.concat([newChoice]);\n const updatedCorrectResponse = correctResponse.concat([newCorrectResponse]);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.shuffleChoices = () => {\n const { onChange, choices, correctResponse, placementArea } = this.props;\n let shuffled = shuffle(choices);\n\n // if placementArea is disabled, make sure we don't shuffle choices in the correct order\n const shuffledCorrect =\n !placementArea &&\n isEqual(\n shuffled.map((item) => item.id),\n correctResponse.map((item) => item.id),\n );\n\n if (shuffledCorrect) {\n const shuffledTwice = shuffle(shuffled);\n\n onChange(shuffledTwice, correctResponse);\n } else {\n onChange(shuffled, correctResponse);\n }\n };\n }\n\n render() {\n const {\n correctResponse,\n choices,\n imageSupport,\n toolbarOpts,\n pluginProps,\n singularChoiceLabel,\n pluralChoiceLabel,\n choicesLabel,\n spellCheck,\n maxImageWidth,\n maxImageHeight,\n errors,\n mathMlOptions = {},\n ordering,\n } = this.props;\n const { warning } = this.state;\n const { choicesErrors, orderError } = errors || {};\n\n const vTilerStyle = {\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridTemplateRows: `repeat(${choices.length}, 1fr)`,\n };\n\n return (\n <div>\n <StyledVTiler style={{ gridTemplateColumns: 'repeat(2, 1fr)' }}>\n <StyledColumnLabel label={`Student ${choicesLabel || 'Choices'}`} />\n <StyledColumnLabel label=\"Correct Order\" />\n </StyledVTiler>\n <StyledVTiler style={vTilerStyle}>\n {ordering.tiles.map((choice, index) => (\n <ChoiceTile\n key={`${choice.type}-${choice.id}`}\n choice={choice}\n index={index}\n imageSupport={imageSupport}\n onDelete={this.onDelete.bind(this, choice)}\n onChoiceChange={this.onChoiceChange}\n toolbarOpts={toolbarOpts}\n pluginProps={pluginProps}\n choices={choices}\n choicesLabel={choicesLabel}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n error={choicesErrors?.[choice.id] || (orderError && ' ') || null}\n mathMlOptions={mathMlOptions}\n />\n ))}\n </StyledVTiler>\n {orderError && <ErrorText>{orderError}</ErrorText>}\n <StyledControls>\n <StyledAddButton onClick={this.shuffleChoices} size=\"small\" variant=\"contained\">\n {`SHUFFLE ${pluralChoiceLabel}`.toUpperCase()}\n </StyledAddButton>\n\n <StyledAddButton onClick={this.addChoice} size=\"small\" variant=\"contained\">\n {`ADD ${singularChoiceLabel}`.toUpperCase()}\n </StyledAddButton>\n </StyledControls>\n <AlertDialog\n open={warning.open}\n title=\"Warning\"\n text={warning.text}\n onConfirm={() => this.setState({ warning: { open: false } })}\n />\n </div>\n );\n }\n}\n\nexport default ChoiceEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,SAASS,kBAAkBA,CAACC,OAAO,EAAE;EACnC,IAAIC,IAAI,GAAG,CAAC;EACZ,MAAMC,GAAG,GAAGF,OAAO,CAACG,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,CAAC;EAEpC,OAAOH,GAAG,CAACI,QAAQ,CAAC,IAAIL,IAAI,EAAE,CAAC,EAAE;IAC/BA,IAAI,EAAE;EACR;EAEA,OA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C,mBAAmB,EAAE2B,kBAAS,CAACS,MAAM;EACrCnC,iBAAiB,EAAE0B,kBAAS,CAACS,MAAM;EACnC9D,YAAY,EAAEqD,kBAAS,CAACS,MAAM;EAC9B/B,MAAM,EAAEsB,kBAAS,CAACO,MAAM;EACxBhC,UAAU,EAAEyB,kBAAS,CAACQ;AACxB,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GA+JYN,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choice-tile.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_core","_CardActions","_DragHandle","_IconButton","_RemoveCircle","_styles","_renderUi","_editableHtmlTipTap","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","log","debug","StyledChoiceTile","styled","theme","margin","spacing","backgroundColor","palette","background","paper","display","flexDirection","cursor","StyledEditableHtml","EditableHtml","isTargetPrompt","width","border","borderRadius","error","light","StyledControls","justifyContent","StyledActions","DragHandle","color","StyledErrorText","fontSize","typography","main","marginLeft","marginTop","StyledRemoveCircle","RemoveCircle","fill","StyledIconButton","IconButton","tertiary","ChoiceTile","props","choice","index","onChoiceChange","onDelete","imageSupport","spellCheck","toolbarOpts","pluginProps","maxImageWidth","maxImageHeight","mathMlOptions","label","editable","type","draggableId","id","droppableId","attributes","listeners","setNodeRef","setDragRef","transform","isDragging","useDraggable","data","setDropRef","useDroppable","onLabelChange","style","x","y","undefined","opacity","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","createElement","ref","_extends2","disabled","placeholder","includes","markup","onChange","activePlugins","autoWidthToolbar","languageCharactersProps","language","onClick","size","exports","propTypes","PropTypes","any","object","string","isOver","bool","empty","outcome","number","shape","add","func","isRequired","delete","choices","array","choicesLabel","_default"],"sources":["../src/choice-tile.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport CardActions from '@mui/material/CardActions';\nimport DragHandle from '@mui/icons-material/DragHandle';\nimport IconButton from '@mui/material/IconButton';\nimport RemoveCircle from '@mui/icons-material/RemoveCircle';\nimport { styled } from '@mui/material/styles';\n\nimport { color } from '@pie-lib/render-ui';\nimport EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html-tip-tap';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nconst StyledChoiceTile = styled('div')(({ theme }) => ({\n margin: `${theme.spacing(1)}px 0`,\n backgroundColor: theme.palette.background.paper,\n display: 'flex',\n flexDirection: 'column',\n cursor: 'move'\n}));\n\nconst StyledEditableHtml = styled(EditableHtml)(({ theme, isTargetPrompt }) => ({\n width: '80%',\n border: 'none',\n borderRadius: '4px',\n ...(isTargetPrompt && {\n backgroundColor: theme.palette.error.light,\n }),\n}));\n\nconst StyledControls = styled('div')(() => ({\n display: 'flex',\n justifyContent: 'flex-end',\n}));\n\nconst StyledActions = styled(DragHandle)(({ theme }) => ({\n color: theme.palette.error[400],\n}));\n\nconst StyledErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n marginLeft: theme.spacing(5),\n marginTop: theme.spacing(1),\n}));\n\nconst StyledRemoveCircle = styled(RemoveCircle)(({ theme }) => ({\n fill: theme.palette.error[500],\n}));\n\nconst StyledIconButton = styled(IconButton)({\n color: `${color.tertiary()} !important`,\n});\n\nexport const ChoiceTile = (props) => {\n const {\n choice,\n index,\n onChoiceChange,\n onDelete,\n imageSupport,\n spellCheck,\n toolbarOpts,\n pluginProps,\n maxImageWidth,\n maxImageHeight,\n error,\n mathMlOptions = {},\n } = props;\n const { label, editable, type } = choice;\n const draggableId = `${type}-${choice.id}`;\n const droppableId = `${type}-drop-${choice.id}`;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n isDragging,\n } = useDraggable({\n id: draggableId,\n data: {\n id: choice.id,\n index,\n type,\n },\n });\n\n const {\n setNodeRef: setDropRef,\n } = useDroppable({\n id: droppableId,\n data: {\n id: choice.id,\n index,\n type,\n },\n });\n\n const onLabelChange = (label) => {\n choice.label = label;\n onChoiceChange(choice);\n };\n\n const style = {\n transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,\n opacity: isDragging ? 0.5 : 1,\n width: '100%',\n };\n\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'bulleted-list' && p !== 'numbered-list',\n );\n\n return (\n <div ref={setDropRef}>\n <div ref={setDragRef} {...listeners} {...attributes}>\n <StyledChoiceTile style={style}>\n <div style={{ width: '100%', display: 'flex' }}>\n <CardActions>\n <StyledActions />\n </CardActions>\n\n <StyledEditableHtml\n disabled={!editable}\n placeholder={type !== 'target' && !label.includes('data-latex') ? 'Enter a choice' : ''}\n markup={label}\n imageSupport={imageSupport || undefined}\n onChange={onLabelChange}\n pluginProps={pluginProps}\n toolbarOpts={toolbarOpts}\n activePlugins={filteredDefaultPlugins}\n spellCheck={spellCheck}\n autoWidthToolbar\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n error={editable && error}\n mathMlOptions={mathMlOptions}\n />\n\n {editable && (\n <StyledControls>\n <StyledIconButton onClick={onDelete} size=\"large\">\n <StyledRemoveCircle />\n </StyledIconButton>\n </StyledControls>\n )}\n </div>\n\n {editable && error && <StyledErrorText>{error}</StyledErrorText>}\n </StyledChoiceTile>\n </div>\n </div>\n );\n};\n\nChoiceTile.propTypes = {\n id: PropTypes.any,\n maxImageHeight: PropTypes.object,\n maxImageWidth: PropTypes.object,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.object,\n index: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n choice: PropTypes.object,\n choices: PropTypes.array.isRequired,\n onChoiceChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n toolbarOpts: PropTypes.object,\n pluginProps: PropTypes.object,\n choicesLabel: PropTypes.string,\n error: PropTypes.string,\n spellCheck: PropTypes.bool,\n mathMlOptions: PropTypes.object,\n};\n\nexport default ChoiceTile;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAEA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAC,uBAAA,CAAAX,OAAA;AAA+E,SAAAW,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAA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BAAS,CAACG,MAAM;EAC9B7E,KAAK,EAAE0E,kBAAS,CAACG,MAAM;EACvBnD,UAAU,EAAEgD,kBAAS,CAACK,IAAI;EAC1BhD,aAAa,EAAE2C,kBAAS,CAACE;AAC3B,CAAC;AAAC,IAAAe,QAAA,GAAAnB,OAAA,CAAArG,OAAA,GAEagD,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"choice-tile.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_core","_CardActions","_DragHandle","_IconButton","_RemoveCircle","_styles","_renderUi","_editableHtmlTipTap","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","log","debug","StyledChoiceTile","styled","theme","margin","spacing","backgroundColor","palette","background","paper","display","flexDirection","cursor","StyledEditableHtml","EditableHtml","isTargetPrompt","width","borderRadius","error","light","StyledControls","justifyContent","StyledActions","DragHandle","color","StyledErrorText","fontSize","typography","main","marginLeft","marginTop","StyledRemoveCircle","RemoveCircle","fill","StyledIconButton","IconButton","tertiary","ChoiceTile","props","choice","index","onChoiceChange","onDelete","imageSupport","spellCheck","toolbarOpts","pluginProps","maxImageWidth","maxImageHeight","mathMlOptions","label","editable","type","draggableId","id","droppableId","attributes","listeners","setNodeRef","setDragRef","transform","isDragging","useDraggable","data","setDropRef","useDroppable","onLabelChange","style","x","y","undefined","opacity","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","createElement","ref","_extends2","disabled","placeholder","includes","markup","onChange","activePlugins","autoWidthToolbar","languageCharactersProps","language","onClick","size","exports","propTypes","PropTypes","any","object","string","isOver","bool","empty","outcome","number","shape","add","func","isRequired","delete","choices","array","choicesLabel","_default"],"sources":["../src/choice-tile.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport CardActions from '@mui/material/CardActions';\nimport DragHandle from '@mui/icons-material/DragHandle';\nimport IconButton from '@mui/material/IconButton';\nimport RemoveCircle from '@mui/icons-material/RemoveCircle';\nimport { styled } from '@mui/material/styles';\n\nimport { color } from '@pie-lib/render-ui';\nimport EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html-tip-tap';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nconst StyledChoiceTile = styled('div')(({ theme }) => ({\n margin: `${theme.spacing(1)}px 0`,\n backgroundColor: theme.palette.background.paper,\n display: 'flex',\n flexDirection: 'column',\n cursor: 'move'\n}));\n\nconst StyledEditableHtml = styled(EditableHtml)(({ theme, isTargetPrompt }) => ({\n width: '80%',\n borderRadius: '4px',\n ...(isTargetPrompt && {\n backgroundColor: theme.palette.error.light,\n }),\n}));\n\nconst StyledControls = styled('div')(() => ({\n display: 'flex',\n justifyContent: 'flex-end',\n}));\n\nconst StyledActions = styled(DragHandle)(({ theme }) => ({\n color: theme.palette.error[400],\n}));\n\nconst StyledErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n marginLeft: theme.spacing(5),\n marginTop: theme.spacing(1),\n}));\n\nconst StyledRemoveCircle = styled(RemoveCircle)(({ theme }) => ({\n fill: theme.palette.error[500],\n}));\n\nconst StyledIconButton = styled(IconButton)({\n color: `${color.tertiary()} !important`,\n});\n\nexport const ChoiceTile = (props) => {\n const {\n choice,\n index,\n onChoiceChange,\n onDelete,\n imageSupport,\n spellCheck,\n toolbarOpts,\n pluginProps,\n maxImageWidth,\n maxImageHeight,\n error,\n mathMlOptions = {},\n } = props;\n const { label, editable, type } = choice;\n const draggableId = `${type}-${choice.id}`;\n const droppableId = `${type}-drop-${choice.id}`;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n isDragging,\n } = useDraggable({\n id: draggableId,\n data: {\n id: choice.id,\n index,\n type,\n },\n });\n\n const {\n setNodeRef: setDropRef,\n } = useDroppable({\n id: droppableId,\n data: {\n id: choice.id,\n index,\n type,\n },\n });\n\n const onLabelChange = (label) => {\n choice.label = label;\n onChoiceChange(choice);\n };\n\n const style = {\n transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,\n opacity: isDragging ? 0.5 : 1,\n width: '100%',\n };\n\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'bulleted-list' && p !== 'numbered-list',\n );\n\n return (\n <div ref={setDropRef}>\n <div ref={setDragRef} {...listeners} {...attributes}>\n <StyledChoiceTile style={style}>\n <div style={{ width: '100%', display: 'flex' }}>\n <CardActions>\n <StyledActions />\n </CardActions>\n\n <StyledEditableHtml\n disabled={!editable}\n placeholder={type !== 'target' && !label.includes('data-latex') ? 'Enter a choice' : ''}\n markup={label}\n imageSupport={imageSupport || undefined}\n onChange={onLabelChange}\n pluginProps={pluginProps}\n toolbarOpts={toolbarOpts}\n activePlugins={filteredDefaultPlugins}\n spellCheck={spellCheck}\n autoWidthToolbar\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n error={editable && error}\n mathMlOptions={mathMlOptions}\n />\n\n {editable && (\n <StyledControls>\n <StyledIconButton onClick={onDelete} size=\"large\">\n <StyledRemoveCircle />\n </StyledIconButton>\n </StyledControls>\n )}\n </div>\n\n {editable && error && <StyledErrorText>{error}</StyledErrorText>}\n </StyledChoiceTile>\n </div>\n </div>\n );\n};\n\nChoiceTile.propTypes = {\n id: PropTypes.any,\n maxImageHeight: PropTypes.object,\n maxImageWidth: PropTypes.object,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.object,\n index: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n choice: PropTypes.object,\n choices: PropTypes.array.isRequired,\n onChoiceChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n toolbarOpts: PropTypes.object,\n pluginProps: PropTypes.object,\n choicesLabel: PropTypes.string,\n error: PropTypes.string,\n spellCheck: PropTypes.bool,\n mathMlOptions: PropTypes.object,\n};\n\nexport default ChoiceTile;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAEA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAC,uBAAA,CAAAX,OAAA;AAA+E,SAAAW,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAA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AE2C,kBAAS,CAACE;AAC3B,CAAC;AAAC,IAAAe,QAAA,GAAAnB,OAAA,CAAApG,OAAA,GAEa+C,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","names":["_default","exports","default","model","choiceLabel","choiceLabelEnabled","choices","correctResponse","feedbackEnabled","numberedGuides","orientation","partialScoring","placementArea","prompt","promptEnabled","rationale","rationaleEnabled","removeTilesAfterPlacing","scoringType","studentInstructionsEnabled","targetLabel","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","configuration","baseInputConfiguration","
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["_default","exports","default","model","choiceLabel","choiceLabelEnabled","choices","correctResponse","feedbackEnabled","numberedGuides","orientation","partialScoring","placementArea","prompt","promptEnabled","rationale","rationaleEnabled","removeTilesAfterPlacing","scoringType","studentInstructionsEnabled","targetLabel","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","configuration","baseInputConfiguration","h3","disabled","audio","video","image","textAlign","showParagraphs","separateParagraphs","settings","label","inputConfiguration","feedback","enabled","required","settingsPanelDisabled","studentInstructions","spellCheck","maxImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"sources":["../src/defaults.js"],"sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configuration\n */\n\nexport default {\n model: {\n choiceLabel: '',\n choiceLabelEnabled: true,\n choices: [],\n correctResponse: [],\n feedbackEnabled: false,\n numberedGuides: false,\n orientation: 'vertical',\n partialScoring: true,\n placementArea: false,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n removeTilesAfterPlacing: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n targetLabel: '',\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n baseInputConfiguration: {\n h3: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n choiceLabel: {\n settings: true,\n label: 'Choice label',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n choices: {\n settings: true,\n label: 'Choices',\n inputConfiguration: {\n audio: { disabled: true },\n video: { disabled: true },\n image: { disabled: true },\n },\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n enabled: true,\n },\n prompt: {\n settings: true,\n label: 'Item Stem',\n required: false,\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n numberedGuides: {\n settings: true,\n label: 'Numbered guides',\n },\n orientation: {\n settings: true,\n label: 'Orientation',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n placementArea: {\n settings: true,\n label: 'Placement Area',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n required: false,\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n removeTilesAfterPlacing: {\n settings: false,\n label: 'Remove Tiles after placing',\n },\n settingsPanelDisabled: false,\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n targetLabel: {\n settings: true,\n label: 'Target label',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n required: false,\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choicesWithPlacementArea: 240,\n choicesWithoutPlacementArea: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 150,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAHA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe;EACbC,KAAK,EAAE;IACLC,WAAW,EAAE,EAAE;IACfC,kBAAkB,EAAE,IAAI;IACxBC,OAAO,EAAE,EAAE;IACXC,eAAe,EAAE,EAAE;IACnBC,eAAe,EAAE,KAAK;IACtBC,cAAc,EAAE,KAAK;IACrBC,WAAW,EAAE,UAAU;IACvBC,cAAc,EAAE,IAAI;IACpBC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAE,EAAE;IACVC,aAAa,EAAE,IAAI;IACnBC,SAAS,EAAE,EAAE;IACbC,gBAAgB,EAAE,IAAI;IACtBC,uBAAuB,EAAE,IAAI;IAC7BC,WAAW,EAAE,MAAM;IACnBC,0BAA0B,EAAE,IAAI;IAChCC,WAAW,EAAE,EAAE;IACfC,mBAAmB,EAAE,EAAE;IACvBC,0BAA0B,EAAE,IAAI;IAChCC,qBAAqB,EAAE;EACzB,CAAC;EACDC,aAAa,EAAE;IACbC,sBAAsB,EAAE;MACtBC,EAAE,EAAE;QAAEC,QAAQ,EAAE;MAAK,CAAC;MACtBC,KAAK,EAAE;QAAED,QAAQ,EAAE;MAAM,CAAC;MAC1BE,KAAK,EAAE;QAAEF,QAAQ,EAAE;MAAM,CAAC;MAC1BG,KAAK,EAAE;QAAEH,QAAQ,EAAE;MAAM,CAAC;MAC1BI,SAAS,EAAE;QAAEJ,QAAQ,EAAE;MAAK,CAAC;MAC7BK,cAAc,EAAE;QAAEL,QAAQ,EAAE;MAAM,CAAC;MACnCM,kBAAkB,EAAE;QAAEN,QAAQ,EAAE;MAAK;IACvC,CAAC;IACDvB,WAAW,EAAE;MACX8B,QAAQ,EAAE,IA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Vb,QAAQ,EAAE,KAAK;MACfC,KAAK,EAAE;IACT,CAAC;IACDa,aAAa,EAAE;MACbC,SAAS,EAAE,KAAK;MAChBC,UAAU,EAAE;IACd,CAAC;IACDC,QAAQ,EAAE;MACRjB,QAAQ,EAAE,KAAK;MACfC,KAAK,EAAE,kBAAkB;MACzBG,OAAO,EAAE;IACX,CAAC;IACDc,eAAe,EAAE;MACfjB,KAAK,EAAE,kBAAkB;MACzBkB,OAAO,EAAE;IACX;EACF;AACF,CAAC","ignoreList":[]}
|
package/configure/lib/design.js
CHANGED
|
@@ -10,10 +10,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _debug = _interopRequireDefault(require("debug"));
|
|
13
|
-
var
|
|
13
|
+
var _lodashEs = require("lodash-es");
|
|
14
14
|
var _nestedProperty = require("nested-property");
|
|
15
15
|
var _pluralize = _interopRequireDefault(require("pluralize"));
|
|
16
|
-
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
17
16
|
var _styles = require("@mui/material/styles");
|
|
18
17
|
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
19
18
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
@@ -100,7 +99,7 @@ class Design extends _react.default.Component {
|
|
|
100
99
|
model,
|
|
101
100
|
onModelChanged
|
|
102
101
|
} = this.props;
|
|
103
|
-
const update = modelFn((0,
|
|
102
|
+
const update = modelFn((0, _lodashEs.cloneDeep)(model));
|
|
104
103
|
onModelChanged(update);
|
|
105
104
|
};
|
|
106
105
|
this.changeHandler = (modelPath, valuePath) => {
|
|
@@ -124,7 +123,7 @@ class Design extends _react.default.Component {
|
|
|
124
123
|
model,
|
|
125
124
|
onModelChanged
|
|
126
125
|
} = this.props;
|
|
127
|
-
const update = (0,
|
|
126
|
+
const update = (0, _lodashEs.cloneDeep)(model);
|
|
128
127
|
update.choices = choices;
|
|
129
128
|
update.correctResponse = correctResponse;
|
|
130
129
|
onModelChanged(update);
|
|
@@ -138,7 +137,7 @@ class Design extends _react.default.Component {
|
|
|
138
137
|
const {
|
|
139
138
|
feedback
|
|
140
139
|
} = model || {};
|
|
141
|
-
const update = (0,
|
|
140
|
+
const update = (0, _lodashEs.cloneDeep)(model);
|
|
142
141
|
|
|
143
142
|
// requirement made in PD-2182
|
|
144
143
|
if (!feedback) {
|
|
@@ -200,7 +199,7 @@ class Design extends _react.default.Component {
|
|
|
200
199
|
} = errors || {};
|
|
201
200
|
const ordering = {
|
|
202
201
|
choices: model.choices,
|
|
203
|
-
response: !correctResponse || (0,
|
|
202
|
+
response: !correctResponse || (0, _lodashEs.isEmpty)(correctResponse) ? new Array(model.choices.length) : correctResponse,
|
|
204
203
|
tiles: (0, _utils.buildTiles)(model.choices, correctResponse)
|
|
205
204
|
};
|
|
206
205
|
const validationMessage = (0, _utils.generateValidationMessage)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_cloneDeep","_nestedProperty","_pluralize","_isEmpty","_styles","_Info","_Tooltip","_configUi","_editableHtmlTipTap","_drag","_choiceEditor","_utils","log","debug","Panel","toggle","radio","dropdown","settings","getSingularAndPlural","label","pluralize","isPlural","singularLabel","pluralLabel","singular","StyledInputContainer","styled","InputContainer","theme","width","paddingTop","spacing","marginBottom","StyledRow","display","gridAutoFlow","gridAutoColumns","gridGap","StyledChoicesWrapper","FormSection","marginTop","InlineFlexContainer","position","ErrorText","fontSize","typography","color","palette","error","main","Design","React","Component","constructor","props","_defineProperty2","default","event","ordering","active","over","target","data","current","source","rawFrom","tiles","find","t","id","type","rawTo","from","index","normalizeIndex","to","response","choices","updatedChoices","updateResponseOrChoices","onChoiceEditorChange","applyUpdate","modelFn","model","onModelChanged","update","cloneDeep","changeHandler","modelPath","valuePath","value","v","get","set","onPromptChange","onTeacherInstructionsChange","onRationaleChange","onChoiceAreaLabelChange","onAnswerAreaLabelChange","onFeedbackChange","correctResponse","componentDidMount","feedback","feedbackEnabled","render","imageSupport","uploadSoundSupport","configuration","onConfigurationChanged","baseInputConfiguration","choiceLabel","contentDimensions","prompt","placementArea","maxImageWidth","maxImageHeight","numberedGuides","orientation","partialScoring","rationale","removeTilesAfterPlacing","settingsPanelDisabled","studentInstructions","spellCheck","scoringType","targetLabel","teacherInstructions","withRubric","mathMlOptions","language","languageChoices","choiceLabelEnabled","errors","extraCSSRules","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","rationaleError","teacherInstructionsError","isEmpty","Array","length","buildTiles","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","maxChoicesImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxChoicesImageHeight","toolbarOpts","panelSettings","enabled","options","panelProperties","studentInstructionsEnabled","rubricEnabled","getPluginProps","createElement","DragProvider","onDragEnd","layout","ConfigLayout","dimensions","hideSettings","onChangeModel","onChangeConfiguration","groups","Settings","Properties","className","markup","onChange","nonEmpty","pluginProps","inputConfiguration","languageCharactersProps","labelExtraStyle","slotProps","tooltip","sx","whiteSpace","maxWidth","disableFocusListener","disableTouchListener","placement","title","style","marginLeft","_extends2","autoWidthToolbar","choicesLabel","singularChoiceLabel","pluralChoiceLabel","FeedbackConfig","exports","PropTypes","object","defaultProps","propTypes","isRequired","func","_default"],"sources":["../src/design.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { get, set } from 'nested-property';\nimport pluralize from 'pluralize';\nimport isEmpty from 'lodash/isEmpty';\nimport { styled } from '@mui/material/styles';\nimport Info from '@mui/icons-material/Info';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { FeedbackConfig, FormSection, InputContainer, settings, layout } from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport ChoiceEditor from './choice-editor';\nimport { generateValidationMessage, buildTiles, updateResponseOrChoices, normalizeIndex } from './utils';\n\nconst log = debug('@pie-element:placement-ordering:design');\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst getSingularAndPlural = (label) =>\n !pluralize.isPlural(label)\n ? {\n singularLabel: label,\n pluralLabel: pluralize(label),\n }\n : {\n singularLabel: pluralize.singular(label),\n pluralLabel: label,\n };\n\nconst StyledInputContainer = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst StyledRow = styled('div')({\n display: 'grid',\n gridAutoFlow: 'column',\n gridAutoColumns: '1fr',\n gridGap: '8px',\n});\n\nconst StyledChoicesWrapper = styled(FormSection)(({ theme }) => ({\n marginTop: 0,\n marginBottom: theme.spacing(2.5),\n}));\n\nconst InlineFlexContainer = styled('div')({\n display: 'inline-flex',\n position: 'absolute',\n});\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class Design extends React.Component {\n static propTypes = {\n uploadSoundSupport: PropTypes.object,\n };\n\n static defaultProps = {};\n\n constructor(props) {\n super(props);\n\n this.applyUpdate = (modelFn) => {\n const { model, onModelChanged } = this.props;\n const update = modelFn(cloneDeep(model));\n\n onModelChanged(update);\n };\n\n this.changeHandler = (modelPath, valuePath) => {\n return (value) => {\n log('[changeHandler] value: ', value);\n\n const v = valuePath ? get(value, valuePath) : value;\n\n this.applyUpdate((model) => {\n set(model, modelPath, v);\n\n return model;\n });\n };\n };\n\n this.onPromptChange = this.changeHandler('prompt');\n\n this.onTeacherInstructionsChange = this.changeHandler('teacherInstructions');\n\n this.onRationaleChange = this.changeHandler('rationale');\n\n this.onChoiceAreaLabelChange = this.changeHandler('choiceLabel', 'target.value');\n\n this.onAnswerAreaLabelChange = this.changeHandler('targetLabel', 'target.value');\n\n this.onFeedbackChange = this.changeHandler('feedback');\n\n this.onChoiceEditorChange = (choices, correctResponse) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n update.choices = choices;\n update.correctResponse = correctResponse;\n onModelChanged(update);\n };\n }\n\n componentDidMount() {\n const { model, onModelChanged } = this.props || {};\n const { feedback } = model || {};\n const update = cloneDeep(model);\n\n // requirement made in PD-2182\n if (!feedback) {\n update.feedbackEnabled = false;\n onModelChanged(update);\n }\n }\n\n onDragEnd = (event, ordering) => {\n const { active, over } = event;\n\n if (!over || !active) {\n return;\n }\n\n const target = over.data.current;\n const source = active.data.current;\n const rawFrom = ordering.tiles.find(t => t.id === source.id && t.type === source.type);\n const rawTo = target;\n\n const from = {\n ...rawFrom,\n index: normalizeIndex(rawFrom, ordering)\n };\n const to = {\n ...rawTo,\n index: normalizeIndex(rawTo, ordering)\n };\n\n const { response, choices: updatedChoices } = updateResponseOrChoices(\n ordering.response,\n ordering.choices,\n from,\n to\n );\n\n this.onChoiceEditorChange(updatedChoices, response);\n };\n\n render() {\n const { model, imageSupport, uploadSoundSupport, onModelChanged, configuration, onConfigurationChanged } =\n this.props;\n const {\n baseInputConfiguration = {},\n choiceLabel = {},\n choices = {},\n contentDimensions = {},\n feedback = {},\n prompt = {},\n placementArea = {},\n maxImageWidth = {},\n maxImageHeight = {},\n numberedGuides = {},\n orientation = {},\n partialScoring = {},\n rationale = {},\n removeTilesAfterPlacing = {},\n settingsPanelDisabled,\n studentInstructions = {},\n spellCheck = {},\n scoringType = {},\n targetLabel = {},\n teacherInstructions = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n choiceLabelEnabled,\n errors,\n extraCSSRules,\n feedbackEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n correctResponse,\n } = model || {};\n const {\n prompt: promptError,\n rationale: rationaleError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n\n const ordering = {\n choices: model.choices,\n response: !correctResponse || isEmpty(correctResponse) ? new Array(model.choices.length) : correctResponse,\n tiles: buildTiles(model.choices, correctResponse),\n };\n\n const validationMessage = generateValidationMessage();\n\n const { singularLabel = '', pluralLabel = '' } = (choices?.label && getSingularAndPlural(choices.label)) || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const maxChoicesImageWidth =\n maxImageWidth && model.placementArea\n ? maxImageWidth.choicesWithPlacementArea\n : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;\n const maxChoicesImageHeight = (maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n choiceLabelEnabled: choiceLabel.settings && toggle(choiceLabel.label),\n placementArea: placementArea.settings && toggle(placementArea.label),\n numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),\n orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),\n removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n return (\n <DragProvider onDragEnd={(event) => this.onDragEnd(event, ordering)}>\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(configuration) => onConfigurationChanged(configuration, true)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <StyledInputContainer label={teacherInstructions.label}>\n <EditableHtml\n className=\"prompt\"\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <div className=\"errorText\">{teacherInstructionsError}</div>}\n </StyledInputContainer>\n )}\n\n {promptEnabled && (\n <StyledInputContainer label={prompt && prompt.label}>\n <EditableHtml\n className=\"prompt\"\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <div className=\"errorText\">{promptError}</div>}\n </StyledInputContainer>\n )}\n\n <StyledChoicesWrapper\n label={`Define ${pluralLabel}`}\n labelExtraStyle={{ display: 'inline-flex' }}\n >\n <InlineFlexContainer>\n <Tooltip\n slotProps={\n {\n tooltip: {\n sx: {\n fontSize: 14,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n },\n }\n }\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '8px' }} />\n </Tooltip>\n </InlineFlexContainer>\n\n <StyledRow>\n {choiceLabelEnabled && (\n <StyledInputContainer\n label={choiceLabel && choiceLabel.label && `${singularLabel} label`}\n >\n <EditableHtml\n {...(model.placementArea && { autoWidthToolbar: true })}\n className=\"prompt\"\n markup={model.choiceLabel}\n onChange={this.onChoiceAreaLabelChange}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(choiceLabel?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </StyledInputContainer>\n )}\n\n {targetLabel.settings && model.placementArea && (\n <StyledInputContainer\n label={targetLabel && targetLabel.label && targetLabel.label}\n >\n <EditableHtml\n autoWidthToolbar\n className=\"prompt\"\n markup={model.targetLabel}\n onChange={this.onAnswerAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.choicesWithPlacementArea) || defaultImageMaxWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </StyledInputContainer>\n )}\n </StyledRow>\n\n {choices.settings && (\n <ChoiceEditor\n correctResponse={correctResponse}\n choices={model.choices}\n onChange={this.onChoiceEditorChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(choices?.inputConfiguration)}\n choicesLabel={choices.label}\n placementArea={model.placementArea}\n singularChoiceLabel={singularLabel}\n pluralChoiceLabel={pluralLabel}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n errors={errors || {}}\n mathMlOptions={mathMlOptions}\n ordering={ordering}\n />\n )}\n </StyledChoicesWrapper>\n\n {rationaleEnabled && (\n <StyledInputContainer label={rationale.label}>\n <EditableHtml\n className=\"prompt\"\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n error={rationaleError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleError && <ErrorText>{rationaleError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {feedbackEnabled && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={this.onFeedbackChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n </DragProvider>\n );\n }\n}\n\nDesign.defaultProps = {\n onModelChanged: () => { },\n onConfigurationChanged: () => { },\n};\n\nDesign.propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n imageSupport: PropTypes.object,\n};\n\nexport default Design;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,C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AA,CAAAC,OAAA,EAHUN,MAAM,kBAKK,CAAC,CAAC;AAuX1BA,MAAM,CAACwJ,YAAY,GAAG;EACpBtH,cAAc,EAAEA,CAAA,KAAM,CAAE,CAAC;EACzBwB,sBAAsB,EAAEA,CAAA,KAAM,CAAE;AAClC,CAAC;AAED1D,MAAM,CAACyJ,SAAS,GAAG;EACjBxH,KAAK,EAAEqH,kBAAS,CAACC,MAAM,CAACG,UAAU;EAClCjG,aAAa,EAAE6F,kBAAS,CAACC,MAAM,CAACG,UAAU;EAC1CxH,cAAc,EAAEoH,kBAAS,CAACK,IAAI;EAC9BjG,sBAAsB,EAAE4F,kBAAS,CAACK,IAAI;EACtCpG,YAAY,EAAE+F,kBAAS,CAACC;AAC1B,CAAC;AAAC,IAAAK,QAAA,GAAAP,OAAA,CAAA/I,OAAA,GAEaN,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"design.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_lodashEs","_nestedProperty","_pluralize","_styles","_Info","_Tooltip","_configUi","_editableHtmlTipTap","_drag","_choiceEditor","_utils","log","debug","Panel","toggle","radio","dropdown","settings","getSingularAndPlural","label","pluralize","isPlural","singularLabel","pluralLabel","singular","StyledInputContainer","styled","InputContainer","theme","width","paddingTop","spacing","marginBottom","StyledRow","display","gridAutoFlow","gridAutoColumns","gridGap","StyledChoicesWrapper","FormSection","marginTop","InlineFlexContainer","position","ErrorText","fontSize","typography","color","palette","error","main","Design","React","Component","constructor","props","_defineProperty2","default","event","ordering","active","over","target","data","current","source","rawFrom","tiles","find","t","id","type","rawTo","from","index","normalizeIndex","to","response","choices","updatedChoices","updateResponseOrChoices","onChoiceEditorChange","applyUpdate","modelFn","model","onModelChanged","update","cloneDeep","changeHandler","modelPath","valuePath","value","v","get","set","onPromptChange","onTeacherInstructionsChange","onRationaleChange","onChoiceAreaLabelChange","onAnswerAreaLabelChange","onFeedbackChange","correctResponse","componentDidMount","feedback","feedbackEnabled","render","imageSupport","uploadSoundSupport","configuration","onConfigurationChanged","baseInputConfiguration","choiceLabel","contentDimensions","prompt","placementArea","maxImageWidth","maxImageHeight","numberedGuides","orientation","partialScoring","rationale","removeTilesAfterPlacing","settingsPanelDisabled","studentInstructions","spellCheck","scoringType","targetLabel","teacherInstructions","withRubric","mathMlOptions","language","languageChoices","choiceLabelEnabled","errors","extraCSSRules","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","rationaleError","teacherInstructionsError","isEmpty","Array","length","buildTiles","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","maxChoicesImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxChoicesImageHeight","toolbarOpts","panelSettings","enabled","options","panelProperties","studentInstructionsEnabled","rubricEnabled","getPluginProps","createElement","DragProvider","onDragEnd","layout","ConfigLayout","dimensions","hideSettings","onChangeModel","onChangeConfiguration","groups","Settings","Properties","className","markup","onChange","nonEmpty","pluginProps","inputConfiguration","languageCharactersProps","labelExtraStyle","slotProps","tooltip","sx","whiteSpace","maxWidth","disableFocusListener","disableTouchListener","placement","title","style","marginLeft","_extends2","autoWidthToolbar","choicesLabel","singularChoiceLabel","pluralChoiceLabel","FeedbackConfig","exports","PropTypes","object","defaultProps","propTypes","isRequired","func","_default"],"sources":["../src/design.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { cloneDeep, isEmpty } from 'lodash-es';\nimport { get, set } from 'nested-property';\nimport pluralize from 'pluralize';\nimport { styled } from '@mui/material/styles';\nimport Info from '@mui/icons-material/Info';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { FeedbackConfig, FormSection, InputContainer, settings, layout } from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport ChoiceEditor from './choice-editor';\nimport { generateValidationMessage, buildTiles, updateResponseOrChoices, normalizeIndex } from './utils';\n\nconst log = debug('@pie-element:placement-ordering:design');\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst getSingularAndPlural = (label) =>\n !pluralize.isPlural(label)\n ? {\n singularLabel: label,\n pluralLabel: pluralize(label),\n }\n : {\n singularLabel: pluralize.singular(label),\n pluralLabel: label,\n };\n\nconst StyledInputContainer = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst StyledRow = styled('div')({\n display: 'grid',\n gridAutoFlow: 'column',\n gridAutoColumns: '1fr',\n gridGap: '8px',\n});\n\nconst StyledChoicesWrapper = styled(FormSection)(({ theme }) => ({\n marginTop: 0,\n marginBottom: theme.spacing(2.5),\n}));\n\nconst InlineFlexContainer = styled('div')({\n display: 'inline-flex',\n position: 'absolute',\n});\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class Design extends React.Component {\n static propTypes = {\n uploadSoundSupport: PropTypes.object,\n };\n\n static defaultProps = {};\n\n constructor(props) {\n super(props);\n\n this.applyUpdate = (modelFn) => {\n const { model, onModelChanged } = this.props;\n const update = modelFn(cloneDeep(model));\n\n onModelChanged(update);\n };\n\n this.changeHandler = (modelPath, valuePath) => {\n return (value) => {\n log('[changeHandler] value: ', value);\n\n const v = valuePath ? get(value, valuePath) : value;\n\n this.applyUpdate((model) => {\n set(model, modelPath, v);\n\n return model;\n });\n };\n };\n\n this.onPromptChange = this.changeHandler('prompt');\n\n this.onTeacherInstructionsChange = this.changeHandler('teacherInstructions');\n\n this.onRationaleChange = this.changeHandler('rationale');\n\n this.onChoiceAreaLabelChange = this.changeHandler('choiceLabel', 'target.value');\n\n this.onAnswerAreaLabelChange = this.changeHandler('targetLabel', 'target.value');\n\n this.onFeedbackChange = this.changeHandler('feedback');\n\n this.onChoiceEditorChange = (choices, correctResponse) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n update.choices = choices;\n update.correctResponse = correctResponse;\n onModelChanged(update);\n };\n }\n\n componentDidMount() {\n const { model, onModelChanged } = this.props || {};\n const { feedback } = model || {};\n const update = cloneDeep(model);\n\n // requirement made in PD-2182\n if (!feedback) {\n update.feedbackEnabled = false;\n onModelChanged(update);\n }\n }\n\n onDragEnd = (event, ordering) => {\n const { active, over } = event;\n\n if (!over || !active) {\n return;\n }\n\n const target = over.data.current;\n const source = active.data.current;\n const rawFrom = ordering.tiles.find((t) => t.id === source.id && t.type === source.type);\n const rawTo = target;\n\n const from = {\n ...rawFrom,\n index: normalizeIndex(rawFrom, ordering),\n };\n const to = {\n ...rawTo,\n index: normalizeIndex(rawTo, ordering),\n };\n\n const { response, choices: updatedChoices } = updateResponseOrChoices(\n ordering.response,\n ordering.choices,\n from,\n to,\n );\n\n this.onChoiceEditorChange(updatedChoices, response);\n };\n\n render() {\n const { model, imageSupport, uploadSoundSupport, onModelChanged, configuration, onConfigurationChanged } =\n this.props;\n const {\n baseInputConfiguration = {},\n choiceLabel = {},\n choices = {},\n contentDimensions = {},\n feedback = {},\n prompt = {},\n placementArea = {},\n maxImageWidth = {},\n maxImageHeight = {},\n numberedGuides = {},\n orientation = {},\n partialScoring = {},\n rationale = {},\n removeTilesAfterPlacing = {},\n settingsPanelDisabled,\n studentInstructions = {},\n spellCheck = {},\n scoringType = {},\n targetLabel = {},\n teacherInstructions = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n choiceLabelEnabled,\n errors,\n extraCSSRules,\n feedbackEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n correctResponse,\n } = model || {};\n const {\n prompt: promptError,\n rationale: rationaleError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n\n const ordering = {\n choices: model.choices,\n response: !correctResponse || isEmpty(correctResponse) ? new Array(model.choices.length) : correctResponse,\n tiles: buildTiles(model.choices, correctResponse),\n };\n\n const validationMessage = generateValidationMessage();\n\n const { singularLabel = '', pluralLabel = '' } = (choices?.label && getSingularAndPlural(choices.label)) || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const maxChoicesImageWidth =\n maxImageWidth && model.placementArea\n ? maxImageWidth.choicesWithPlacementArea\n : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;\n const maxChoicesImageHeight = (maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n choiceLabelEnabled: choiceLabel.settings && toggle(choiceLabel.label),\n placementArea: placementArea.settings && toggle(placementArea.label),\n numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),\n orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),\n removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n return (\n <DragProvider onDragEnd={(event) => this.onDragEnd(event, ordering)}>\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(configuration) => onConfigurationChanged(configuration, true)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <StyledInputContainer label={teacherInstructions.label}>\n <EditableHtml\n className=\"prompt\"\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <div className=\"errorText\">{teacherInstructionsError}</div>}\n </StyledInputContainer>\n )}\n\n {promptEnabled && (\n <StyledInputContainer label={prompt && prompt.label}>\n <EditableHtml\n className=\"prompt\"\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <div className=\"errorText\">{promptError}</div>}\n </StyledInputContainer>\n )}\n\n <StyledChoicesWrapper label={`Define ${pluralLabel}`} labelExtraStyle={{ display: 'inline-flex' }}>\n <InlineFlexContainer>\n <Tooltip\n slotProps={{\n tooltip: {\n sx: {\n fontSize: 14,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n },\n }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '8px' }} />\n </Tooltip>\n </InlineFlexContainer>\n\n <StyledRow>\n {choiceLabelEnabled && (\n <StyledInputContainer label={choiceLabel && choiceLabel.label && `${singularLabel} label`}>\n <EditableHtml\n {...(model.placementArea && { autoWidthToolbar: true })}\n className=\"prompt\"\n markup={model.choiceLabel}\n onChange={this.onChoiceAreaLabelChange}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(choiceLabel?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </StyledInputContainer>\n )}\n\n {targetLabel.settings && model.placementArea && (\n <StyledInputContainer label={targetLabel && targetLabel.label && targetLabel.label}>\n <EditableHtml\n autoWidthToolbar\n className=\"prompt\"\n markup={model.targetLabel}\n onChange={this.onAnswerAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.choicesWithPlacementArea) || defaultImageMaxWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </StyledInputContainer>\n )}\n </StyledRow>\n\n {choices.settings && (\n <ChoiceEditor\n correctResponse={correctResponse}\n choices={model.choices}\n onChange={this.onChoiceEditorChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(choices?.inputConfiguration)}\n choicesLabel={choices.label}\n placementArea={model.placementArea}\n singularChoiceLabel={singularLabel}\n pluralChoiceLabel={pluralLabel}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n errors={errors || {}}\n mathMlOptions={mathMlOptions}\n ordering={ordering}\n />\n )}\n </StyledChoicesWrapper>\n\n {rationaleEnabled && (\n <StyledInputContainer label={rationale.label}>\n <EditableHtml\n className=\"prompt\"\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n error={rationaleError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleError && <ErrorText>{rationaleError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {feedbackEnabled && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={this.onFeedbackChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n </DragProvider>\n );\n }\n}\n\nDesign.defaultProps = {\n onModelChanged: () => {},\n onConfigurationChanged: () => {},\n};\n\nDesign.propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n imageSupport: PropTypes.object,\n};\n\nexport default Design;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;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EqH,kBAAS,CAACC,MAAM,CAACG,UAAU;EAClCjG,aAAa,EAAE6F,kBAAS,CAACC,MAAM,CAACG,UAAU;EAC1CxH,cAAc,EAAEoH,kBAAS,CAACK,IAAI;EAC9BjG,sBAAsB,EAAE4F,kBAAS,CAACK,IAAI;EACtCpG,YAAY,EAAE+F,kBAAS,CAACC;AAC1B,CAAC;AAAC,IAAAK,QAAA,GAAAP,OAAA,CAAA/I,OAAA,GAEaN,MAAM","ignoreList":[]}
|
package/configure/lib/index.js
CHANGED
|
@@ -11,9 +11,9 @@ var _design = _interopRequireDefault(require("./design"));
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _client = require("react-dom/client");
|
|
13
13
|
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
14
|
-
var
|
|
14
|
+
var _lodashEs = require("lodash-es");
|
|
15
15
|
const prepareCustomizationObject = (config, model) => {
|
|
16
|
-
const configuration = (0,
|
|
16
|
+
const configuration = (0, _lodashEs.defaults)(config, _defaults.default.configuration);
|
|
17
17
|
return {
|
|
18
18
|
configuration,
|
|
19
19
|
model
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_pieConfigureEvents","require","_design","_interopRequireDefault","_react","_client","_defaults","_defaults2","prepareCustomizationObject","config","model","configuration","defaults","defaultValues","addWeightToCorrectResponse","correctResponse","map","correct","weight","undefined","id","exports","PlacementOrdering","HTMLElement","constructor","_root","_model","createDefaultModel","_configuration","onModelChanged","resetSession","_rerender","dispatchUpdate","onConfigurationChanged","insertImage","handler","dispatchEvent","InsertImageEvent","deleteImage","src","done","DeleteImageEvent","reset","ModelUpdatedEvent","s","c","info","newConfiguration","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","bind","createRoot","render","disconnectedCallback","unmount","default","_defineProperty2","mapChoicesToReturnCorrectResponse","choices","ch","defaultModel"],"sources":["../src/index.js"],"sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './design';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport defaultValues from './defaults';\nimport defaults from 'lodash/defaults';\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, defaultValues.configuration);\n\n return { configuration, model };\n};\n\nexport const addWeightToCorrectResponse = (correctResponse) =>\n correctResponse &&\n correctResponse.map((correct) => {\n // if weight is set\n if (correct.weight !== undefined) {\n return { id: correct.id, weight: correct.weight };\n } else {\n return { id: correct.id || correct, weight: 0 };\n }\n });\n/**\n * assuming that the correct response will be set via ui, not via config,\n * correctResponse (if not set) will be initialized with choices default order\n */\nexport default class PlacementOrdering extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const mapChoicesToReturnCorrectResponse = (choices) => choices && choices.map((ch) => ({ id: ch.id, weight: 0 }));\n\n let correctResponse =\n addWeightToCorrectResponse(model.correctResponse) || mapChoicesToReturnCorrectResponse(model.choices);\n\n const defaultModel = {\n ...defaultValues.model,\n ...model,\n };\n\n if (correctResponse) {\n defaultModel.correctResponse = correctResponse;\n }\n\n return defaultModel;\n };\n\n constructor() {\n super();\n this._root = null;\n\n this._model = PlacementOrdering.createDefaultModel();\n this._configuration = defaultValues.configuration;\n\n this.onModelChanged = (model, resetSession) => {\n this._model = model;\n this._rerender();\n this.dispatchUpdate(resetSession);\n };\n\n this.onConfigurationChanged = (configuration) => {\n this._configuration = prepareCustomizationObject(configuration).configuration;\n\n this.onModelChanged(this._model);\n this._rerender();\n };\n\n this.insertImage = (handler) => {\n this.dispatchEvent(new InsertImageEvent(handler));\n };\n\n this.deleteImage = (src, done) => {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n };\n }\n\n dispatchUpdate(reset) {\n this.dispatchEvent(new ModelUpdatedEvent(this._model, reset));\n }\n\n set model(s) {\n this._model = PlacementOrdering.createDefaultModel(s);\n this._rerender();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...defaultValues.configuration,\n ...info.configuration,\n };\n\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._rerender();\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _rerender() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n imageSupport: {\n add: this.insertImage,\n delete: this.deleteImage,\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAC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C,CAAC,CAAC;EAEjH,IAAIH,eAAe,GACjBD,0BAA0B,CAACJ,KAAK,CAACK,eAAe,CAAC,IAAI+D,iCAAiC,CAACpE,KAAK,CAACqE,OAAO,CAAC;EAEvG,MAAME,YAAY,GAAG;IACnB,GAAGpE,iBAAa,CAACH,KAAK;IACtB,GAAGA;EACL,CAAC;EAED,IAAIK,eAAe,EAAE;IACnBkE,YAAY,CAAClE,eAAe,GAAGA,eAAe;EAChD;EAEA,OAAOkE,YAAY;AACrB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_pieConfigureEvents","require","_design","_interopRequireDefault","_react","_client","_defaults","_lodashEs","prepareCustomizationObject","config","model","configuration","defaults","defaultValues","addWeightToCorrectResponse","correctResponse","map","correct","weight","undefined","id","exports","PlacementOrdering","HTMLElement","constructor","_root","_model","createDefaultModel","_configuration","onModelChanged","resetSession","_rerender","dispatchUpdate","onConfigurationChanged","insertImage","handler","dispatchEvent","InsertImageEvent","deleteImage","src","done","DeleteImageEvent","reset","ModelUpdatedEvent","s","c","info","newConfiguration","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","bind","createRoot","render","disconnectedCallback","unmount","default","_defineProperty2","mapChoicesToReturnCorrectResponse","choices","ch","defaultModel"],"sources":["../src/index.js"],"sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './design';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport defaultValues from './defaults';\nimport { defaults } from 'lodash-es';\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, defaultValues.configuration);\n\n return { configuration, model };\n};\n\nexport const addWeightToCorrectResponse = (correctResponse) =>\n correctResponse &&\n correctResponse.map((correct) => {\n // if weight is set\n if (correct.weight !== undefined) {\n return { id: correct.id, weight: correct.weight };\n } else {\n return { id: correct.id || correct, weight: 0 };\n }\n });\n/**\n * assuming that the correct response will be set via ui, not via config,\n * correctResponse (if not set) will be initialized with choices default order\n */\nexport default class PlacementOrdering extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const mapChoicesToReturnCorrectResponse = (choices) => choices && choices.map((ch) => ({ id: ch.id, weight: 0 }));\n\n let correctResponse =\n addWeightToCorrectResponse(model.correctResponse) || mapChoicesToReturnCorrectResponse(model.choices);\n\n const defaultModel = {\n ...defaultValues.model,\n ...model,\n };\n\n if (correctResponse) {\n defaultModel.correctResponse = correctResponse;\n }\n\n return defaultModel;\n };\n\n constructor() {\n super();\n this._root = null;\n\n this._model = PlacementOrdering.createDefaultModel();\n this._configuration = defaultValues.configuration;\n\n this.onModelChanged = (model, resetSession) => {\n this._model = model;\n this._rerender();\n this.dispatchUpdate(resetSession);\n };\n\n this.onConfigurationChanged = (configuration) => {\n this._configuration = prepareCustomizationObject(configuration).configuration;\n\n this.onModelChanged(this._model);\n this._rerender();\n };\n\n this.insertImage = (handler) => {\n this.dispatchEvent(new InsertImageEvent(handler));\n };\n\n this.deleteImage = (src, done) => {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n };\n }\n\n dispatchUpdate(reset) {\n this.dispatchEvent(new ModelUpdatedEvent(this._model, reset));\n }\n\n set model(s) {\n this._model = PlacementOrdering.createDefaultModel(s);\n this._rerender();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...defaultValues.configuration,\n ...info.configuration,\n };\n\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._rerender();\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _rerender() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n imageSupport: {\n add: this.insertImage,\n delete: this.deleteImage,\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,MAAMO,0BAA0B,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACpD,MAAMC,aAAa,GAAG,IAAAC,kBAAQ,EAACH,MAAM,EAAEI,iBAAa,CAACF,aAAa,CAAC;EAEnE,OAAO;IAAEA,aAAa;IAAED;EAAM,CAAC;AACjC,CAAC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use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,7 +7,7 @@ exports.buildTiles = buildTiles;
|
|
|
8
7
|
exports.generateValidationMessage = void 0;
|
|
9
8
|
exports.normalizeIndex = normalizeIndex;
|
|
10
9
|
exports.updateResponseOrChoices = updateResponseOrChoices;
|
|
11
|
-
var
|
|
10
|
+
var _lodashEs = require("lodash-es");
|
|
12
11
|
const generateValidationMessage = () => {
|
|
13
12
|
const answersMessage = '\nThere should be at least 3 tokens.' + '\nThe tokens should not be empty and should be unique.' + '\nThe correct ordering should not be identical to the initial ordering.';
|
|
14
13
|
return 'Validation requirements:' + answersMessage;
|
|
@@ -33,7 +32,7 @@ function updateResponseOrChoices(response, choices, from, to) {
|
|
|
33
32
|
index: placeAtIndex
|
|
34
33
|
} = to;
|
|
35
34
|
if (fromType === 'target' && toType === 'target') {
|
|
36
|
-
const updatedResponse = (0,
|
|
35
|
+
const updatedResponse = (0, _lodashEs.cloneDeep)(response) || [];
|
|
37
36
|
const {
|
|
38
37
|
movedItem,
|
|
39
38
|
remainingItems
|
|
@@ -54,7 +53,7 @@ function updateResponseOrChoices(response, choices, from, to) {
|
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
55
|
if (fromType === 'choice' && toType === 'choice') {
|
|
57
|
-
const updatedChoices = (0,
|
|
56
|
+
const updatedChoices = (0, _lodashEs.cloneDeep)(choices) || [];
|
|
58
57
|
const {
|
|
59
58
|
movedItem,
|
|
60
59
|
remainingItems,
|