@pie-element/placement-ordering 14.1.1-next.11 → 14.1.1-next.115
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 +1 -1
- package/configure/lib/choice-editor.js.map +1 -1
- package/configure/lib/choice-tile.js +2 -1
- package/configure/lib/choice-tile.js.map +1 -1
- package/configure/lib/index.js +4 -0
- package/configure/lib/index.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/package.json +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/placement-ordering.js +27 -4
- package/lib/placement-ordering.js.map +1 -1
- package/package.json +7 -6
|
@@ -181,7 +181,7 @@ class ChoiceEditor extends _react.default.Component {
|
|
|
181
181
|
} = errors || {};
|
|
182
182
|
const vTilerStyle = {
|
|
183
183
|
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
184
|
-
gridTemplateRows: `repeat(${choices.length},
|
|
184
|
+
gridTemplateRows: `repeat(${choices.length}, auto)`
|
|
185
185
|
};
|
|
186
186
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(StyledVTiler, {
|
|
187
187
|
style: {
|
|
@@ -1 +1 @@
|
|
|
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,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,OAA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AAA,CAAA4G,WAAW;MACV5D,IAAI,EAAED,OAAO,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,EAhLKN,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,GA+JYN,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}, auto)`,\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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AAa,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,GA+JYN,YAAY","ignoreList":[]}
|
|
@@ -147,7 +147,8 @@ const ChoiceTile = props => {
|
|
|
147
147
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
148
148
|
style: {
|
|
149
149
|
width: '100%',
|
|
150
|
-
display: 'flex'
|
|
150
|
+
display: 'flex',
|
|
151
|
+
alignItems: 'center'
|
|
151
152
|
}
|
|
152
153
|
}, /*#__PURE__*/_react.default.createElement(_CardActions.default, null, /*#__PURE__*/_react.default.createElement(StyledActions, null)), /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
|
|
153
154
|
disabled: !editable,
|
|
@@ -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","touchAction","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","isEditableElement","target","closest","isContentEditable","filteredListeners","onKeyDown","onPointerDown","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)} 0`,\n backgroundColor: theme.palette.background.paper,\n display: 'flex',\n flexDirection: 'column',\n cursor: 'move',\n touchAction: 'none',\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 { setNodeRef: setDropRef } = 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((p) => p !== 'bulleted-list' && p !== 'numbered-list');\n\n const isEditableElement = (target) =>\n target.closest('[contenteditable]') ||\n target.closest('input') ||\n target.closest('textarea') ||\n target.isContentEditable;\n\n // edit listeners to prevent dragging when interacting with editable-html element\n const filteredListeners = {\n ...listeners,\n onKeyDown: (e) => {\n if (isEditableElement(e.target)) {\n return;\n }\n\n listeners?.onKeyDown?.(e);\n },\n onPointerDown: (e) => {\n if (isEditableElement(e.target)) {\n return;\n }\n\n listeners?.onPointerDown?.(e);\n },\n };\n\n return (\n <div ref={setDropRef}>\n <div ref={setDragRef} {...filteredListeners} {...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,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,EAAEsD,kBAAS,CAACE,MAAM;EAC7BvD,WAAW,EAAEqD,kBAAS,CAACE,MAAM;EAC7Bc,YAAY,EAAEhB,kBAAS,CAACG,MAAM;EAC9BpF,KAAK,EAAEiF,kBAAS,CAACG,MAAM;EACvB1D,UAAU,EAAEuD,kBAAS,CAACK,IAAI;EAC1BvD,aAAa,EAAEkD,kBAAS,CAACE;AAC3B,CAAC;AAAC,IAAAe,QAAA,GAAAnB,OAAA,CAAA5G,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","touchAction","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","isEditableElement","target","closest","isContentEditable","filteredListeners","onKeyDown","onPointerDown","createElement","ref","_extends2","alignItems","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)} 0`,\n backgroundColor: theme.palette.background.paper,\n display: 'flex',\n flexDirection: 'column',\n cursor: 'move',\n touchAction: 'none',\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 { setNodeRef: setDropRef } = 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((p) => p !== 'bulleted-list' && p !== 'numbered-list');\n\n const isEditableElement = (target) =>\n target.closest('[contenteditable]') ||\n target.closest('input') ||\n target.closest('textarea') ||\n target.isContentEditable;\n\n // edit listeners to prevent dragging when interacting with editable-html element\n const filteredListeners = {\n ...listeners,\n onKeyDown: (e) => {\n if (isEditableElement(e.target)) {\n return;\n }\n\n listeners?.onKeyDown?.(e);\n },\n onPointerDown: (e) => {\n if (isEditableElement(e.target)) {\n return;\n }\n\n listeners?.onPointerDown?.(e);\n },\n };\n\n return (\n <div ref={setDropRef}>\n <div ref={setDragRef} {...filteredListeners} {...attributes}>\n <StyledChoiceTile style={style}>\n <div style={{ width: '100%', display: 'flex', alignItems: 'center' }}>\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,uBAA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ure/lib/index.js
CHANGED
|
@@ -130,9 +130,13 @@ class PlacementOrdering extends HTMLElement {
|
|
|
130
130
|
}
|
|
131
131
|
this._root.render(element);
|
|
132
132
|
}
|
|
133
|
+
connectedCallback() {
|
|
134
|
+
this._rerender();
|
|
135
|
+
}
|
|
133
136
|
disconnectedCallback() {
|
|
134
137
|
if (this._root) {
|
|
135
138
|
this._root.unmount();
|
|
139
|
+
this._root = null;
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
}
|
|
@@ -1 +1 @@
|
|
|
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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;QACrBmC,MAAM,EAAE,IAAI,CAAC/B;MACf,CAAC;MACDgC,kBAAkB,EAAE;QAClBF,GAAG,EAAE,IAAI,CAACT,WAAW,CAACY,IAAI,CAAC,IAAI,CAAC;QAChCF,MAAM,EAAE,IAAI,CAACR,aAAa,CAACU,IAAI,CAAC,IAAI;MACtC;IACF,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC9C,KAAK,EAAE;MACf,IAAI,CAACA,KAAK,GAAG,IAAA+C,kBAAU,EAAC,IAAI,CAAC;IAC/B;IACA,IAAI,CAAC/C,KAAK,CAACgD,MAAM,CAACV,OAAO,CAAC;EAC5B;EAEAW,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAACjD,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACkD,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACtD,OAAA,CAAAuD,OAAA,GAAAtD,iBAAA;AAAA,IAAAuD,gBAAA,CAAAD,OAAA,EAtIoBtD,iBAAiB,wBACR,CAACZ,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1C,MAAMoE,iCAAiC,GAAIC,OAAO,IAAKA,OAAO,IAAIA,OAAO,CAAC/D,GAAG,CAAEgE,EAAE,KAAM;IAAE5D,EAAE,EAAE4D,EAAE,CAAC5D,EAAE;IAAEF,MAAM,EAAE;EAAE,CAAC,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","connectedCallback","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 connectedCallback() {\n this._rerender();\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\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;AAEM,MAAMI,0BAA0B,GAAIC,eAAe,IACxDA,eAAe,IACfA,eAAe,CAACC,GAAG,CAAEC,OAAO,IAAK;EAC/B;EACA,IAAIA,OAAO,CAACC,MAAM,KAAKC,SAAS,EAAE;IAChC,OAAO;MAAEC,EAAE,EAAEH,OAAO,CAACG,EAAE;MAAEF,MAAM,EAAED,OAAO,CAACC;IAAO,CAAC;EACnD,CAAC,MAAM;IACL,OAAO;MAAEE,EAAE,EAAEH,OAAO,CAACG,EAAE,IAAIH,OAAO;MAAEC,MAAM,EAAE;IAA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AAC/C,KAAK,CAACgD,MAAM,CAACV,OAAO,CAAC;EAC5B;EAEAW,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAAC3C,SAAS,CAAC,CAAC;EAClB;EAEA4C,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAAClD,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACmD,OAAO,CAAC,CAAC;MACpB,IAAI,CAACnD,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACJ,OAAA,CAAAwD,OAAA,GAAAvD,iBAAA;AAAA,IAAAwD,gBAAA,CAAAD,OAAA,EA3IoBvD,iBAAiB,wBACR,CAACZ,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1C,MAAMqE,iCAAiC,GAAIC,OAAO,IAAKA,OAAO,IAAIA,OAAO,CAAChE,GAAG,CAAEiE,EAAE,KAAM;IAAE7D,EAAE,EAAE6D,EAAE,CAAC7D,EAAE;IAAEF,MAAM,EAAE;EAAE,CAAC,CAAC,CAAC;EAEjH,IAAIH,eAAe,GACjBD,0BAA0B,CAACJ,KAAK,CAACK,eAAe,CAAC,IAAIgE,iCAAiC,CAACrE,KAAK,CAACsE,OAAO,CAAC;EAEvG,MAAME,YAAY,GAAG;IACnB,GAAGrE,iBAAa,CAACH,KAAK;IACtB,GAAGA;EACL,CAAC;EAED,IAAIK,eAAe,EAAE;IACnBmE,YAAY,CAACnE,eAAe,GAAGA,eAAe;EAChD;EAEA,OAAOmE,YAAY;AACrB,CAAC","ignoreList":[]}
|
package/configure/package.json
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"@mui/icons-material": "^7.3.4",
|
|
12
12
|
"@mui/material": "^7.3.4",
|
|
13
13
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
14
|
-
"@pie-lib/config-ui": "13.0.
|
|
15
|
-
"@pie-lib/drag": "4.0.
|
|
16
|
-
"@pie-lib/editable-html-tip-tap": "2.1.
|
|
17
|
-
"@pie-lib/render-ui": "6.1.
|
|
14
|
+
"@pie-lib/config-ui": "13.0.13",
|
|
15
|
+
"@pie-lib/drag": "4.0.6",
|
|
16
|
+
"@pie-lib/editable-html-tip-tap": "2.1.11",
|
|
17
|
+
"@pie-lib/render-ui": "6.1.3",
|
|
18
18
|
"debug": "^4.1.1",
|
|
19
19
|
"lodash-es": "^4.17.23",
|
|
20
20
|
"nested-property": "^0.0.7",
|
package/controller/package.json
CHANGED
package/lib/index.js
CHANGED
|
@@ -110,11 +110,13 @@ class Ordering extends HTMLElement {
|
|
|
110
110
|
}
|
|
111
111
|
connectedCallback() {
|
|
112
112
|
this._initMathObserver();
|
|
113
|
+
this.render();
|
|
113
114
|
}
|
|
114
115
|
disconnectedCallback() {
|
|
115
116
|
this._disconnectMathObserver();
|
|
116
117
|
if (this._root) {
|
|
117
118
|
this._root.unmount();
|
|
119
|
+
this._root = null;
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_lodashEs","_debug","_mathRendering","_piePlayerEvents","_main","log","debug","isValidSession","model","session","config","compactSessionValues","compact","value","completeSession","length","choices","includeTargets","exports","Ordering","HTMLElement","constructor","_defineProperty2","default","_mathRenderPending","requestAnimationFrame","_mathObserver","disconnect","renderMath","setTimeout","observe","childList","subtree","_model","completeLength","_session","render","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_root","_initMathObserver","MutationObserver","_scheduleMathRender","_disconnectMathObserver","newModel","CustomEvent","bubbles","detail","complete","newSession","element","React","createElement","Main","onSessionChange","sessionChange","createRoot","connectedCallback","disconnectedCallback","unmount"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { compact } from 'lodash-es';\nimport debug from 'debug';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport Main from './main';\n\nconst log = debug('pie-elements:placement-ordering');\n\nexport const isValidSession = ({ model, session }) => {\n const { config } = model;\n\n const compactSessionValues = (session && compact(session.value)) || [];\n const completeSession = compactSessionValues.length === model.choices.length;\n\n // if it includes targets, it doesn't have to contain all the choices selected (eg: only 2 targets were filled)\n // but if it does not include targets, it's a must to have all choices selected\n return config.includeTargets || completeSession;\n};\n\nexport default class Ordering extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n _scheduleMathRender = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n isComplete = (value) => value && compact(value).length === this._model.completeLength;\n\n sessionChange = (session) => {\n this._session.value = session.value;\n this.render();\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), this._session && this.isComplete(this._session.value)),\n );\n };\n\n set model(newModel) {\n this._model = newModel;\n\n this.render();\n this.dispatchEvent(\n new CustomEvent('model-set', {\n bubbles: true,\n detail: {\n complete: false,\n },\n }),\n );\n }\n\n set session(newSession) {\n this._session = newSession;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n render() {\n if (this._model && this._session) {\n log('[render] session: ', this._session.value);\n log('[render] model: ', this._model);\n\n this._initMathObserver();\n\n const element = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSessionChange: this.sessionChange,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n }\n\n connectedCallback() {\n this._initMathObserver();\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEA,MAAMO,GAAG,GAAG,IAAAC,cAAK,EAAC,iCAAiC,CAAC;AAE7C,MAAMC,cAAc,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAQ,CAAC,KAAK;EACpD,MAAM;IAAEC;EAAO,CAAC,GAAGF,KAAK;EAExB,MAAMG,oBAAoB,GAAIF,OAAO,IAAI,IAAAG,iBAAO,EAACH,OAAO,CAACI,KAAK,CAAC,IAAK,EAAE;EACtE,MAAMC,eAAe,GAAGH,oBAAoB,CAACI,MAAM,KAAKP,KAAK,CAACQ,OAAO,CAACD,MAAM;;EAE5E;EACA;EACA,OAAOL,MAAM,CAACO,cAAc,IAAIH,eAAe;AACjD,CAAC;AAACI,OAAA,CAAAX,cAAA,GAAAA,cAAA;AAEa,MAAMY,QAAQ,SAASC,WAAW,CAAC;EAChDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,+BAMY,MAAM;MAC1B,IAAI,IAAI,CAACC,kBAAkB,EAAE;MAC7B,IAAI,CAACA,kBAAkB,GAAG,IAAI;MAE9BC,qBAAqB,CAAC,MAAM;QAC1B,IAAI,IAAI,CAACC,aAAa,EAAE;UACtB,IAAI,CAACA,aAAa,CAACC,UAAU,CAAC,CAAC;QACjC;QACA,IAAAC,yBAAU,EAAC,IAAI,CAAC;QAChB,I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F;EAEAO,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACjB,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_lodashEs","_debug","_mathRendering","_piePlayerEvents","_main","log","debug","isValidSession","model","session","config","compactSessionValues","compact","value","completeSession","length","choices","includeTargets","exports","Ordering","HTMLElement","constructor","_defineProperty2","default","_mathRenderPending","requestAnimationFrame","_mathObserver","disconnect","renderMath","setTimeout","observe","childList","subtree","_model","completeLength","_session","render","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_root","_initMathObserver","MutationObserver","_scheduleMathRender","_disconnectMathObserver","newModel","CustomEvent","bubbles","detail","complete","newSession","element","React","createElement","Main","onSessionChange","sessionChange","createRoot","connectedCallback","disconnectedCallback","unmount"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { compact } from 'lodash-es';\nimport debug from 'debug';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport Main from './main';\n\nconst log = debug('pie-elements:placement-ordering');\n\nexport const isValidSession = ({ model, session }) => {\n const { config } = model;\n\n const compactSessionValues = (session && compact(session.value)) || [];\n const completeSession = compactSessionValues.length === model.choices.length;\n\n // if it includes targets, it doesn't have to contain all the choices selected (eg: only 2 targets were filled)\n // but if it does not include targets, it's a must to have all choices selected\n return config.includeTargets || completeSession;\n};\n\nexport default class Ordering extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n _scheduleMathRender = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n isComplete = (value) => value && compact(value).length === this._model.completeLength;\n\n sessionChange = (session) => {\n this._session.value = session.value;\n this.render();\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), this._session && this.isComplete(this._session.value)),\n );\n };\n\n set model(newModel) {\n this._model = newModel;\n\n this.render();\n this.dispatchEvent(\n new CustomEvent('model-set', {\n bubbles: true,\n detail: {\n complete: false,\n },\n }),\n );\n }\n\n set session(newSession) {\n this._session = newSession;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n render() {\n if (this._model && this._session) {\n log('[render] session: ', this._session.value);\n log('[render] model: ', this._model);\n\n this._initMathObserver();\n\n const element = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSessionChange: this.sessionChange,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n }\n\n connectedCallback() {\n this._initMathObserver();\n this.render();\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEA,MAAMO,GAAG,GAAG,IAAAC,cAAK,EAAC,iCAAiC,CAAC;AAE7C,MAAMC,cAAc,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAQ,CAAC,KAAK;EACpD,MAAM;I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AI3B,OAAOA,CAAA,EAAG;IACZ,OAAO,IAAI,CAAC0B,QAAQ;EACtB;EAEAC,MAAMA,CAAA,EAAG;IACP,IAAI,IAAI,CAACH,MAAM,IAAI,IAAI,CAACE,QAAQ,EAAE;MAChC9B,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC8B,QAAQ,CAACtB,KAAK,CAAC;MAC9CR,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC4B,MAAM,CAAC;MAEpC,IAAI,CAACU,iBAAiB,CAAC,CAAC;MAExB,MAAMU,OAAO,gBAAGC,cAAK,CAACC,aAAa,CAACC,aAAI,EAAE;QACxChD,KAAK,EAAE,IAAI,CAACyB,MAAM;QAClBxB,OAAO,EAAE,IAAI,CAAC0B,QAAQ;QACtBsB,eAAe,EAAE,IAAI,CAACC;MACxB,CAAC,CAAC;MAEF,IAAI,CAAC,IAAI,CAAChB,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAAiB,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAACjB,KAAK,CAACN,MAAM,CAACiB,OAAO,CAAC;IAC5B;EACF;EAEAO,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACjB,iBAAiB,CAAC,CAAC;IACxB,IAAI,CAACP,MAAM,CAAC,CAAC;EACf;EAEAyB,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAACf,uBAAuB,CAAC,CAAC;IAC9B,IAAI,IAAI,CAACJ,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACoB,OAAO,CAAC,CAAC;MACpB,IAAI,CAACpB,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACxB,OAAA,CAAAK,OAAA,GAAAJ,QAAA","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
14
14
|
var _lodashEs = require("lodash-es");
|
|
15
15
|
var _styles = require("@mui/material/styles");
|
|
16
16
|
var _core = require("@dnd-kit/core");
|
|
17
|
+
var _modifiers = require("@dnd-kit/modifiers");
|
|
17
18
|
var _renderUi = require("@pie-lib/render-ui");
|
|
18
19
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
19
20
|
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
@@ -34,6 +35,26 @@ const PlacementOrderingContainer = (0, _styles.styled)('div')({
|
|
|
34
35
|
alignItems: 'center',
|
|
35
36
|
boxSizing: 'border-box'
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
// The interactive region - the choices and answers columns for a vertical item, or the choices and
|
|
40
|
+
// answers rows for a horizontal one - scrolls horizontally when it does not fit the available width.
|
|
41
|
+
const InteractiveRegion = (0, _styles.styled)('div')({
|
|
42
|
+
// the ancestors centre their children, which shrink-wraps this box to its content. without a
|
|
43
|
+
// definite width it grows with the tiler and the overflow escapes outwards instead of scrolling.
|
|
44
|
+
alignSelf: 'stretch',
|
|
45
|
+
maxWidth: '100%',
|
|
46
|
+
overflowX: 'auto',
|
|
47
|
+
// tiles are dragged by transform, which counts towards scrollable overflow, so leaving this axis
|
|
48
|
+
// scrollable would pop a vertical scrollbar mid-drag
|
|
49
|
+
overflowY: 'hidden'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// keeps the tiler at its natural width, and centred while it still fits
|
|
53
|
+
const InteractiveRegionContent = (0, _styles.styled)('div')({
|
|
54
|
+
display: 'flex',
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
minWidth: 'min-content'
|
|
57
|
+
});
|
|
37
58
|
const StyledPrompt = (0, _styles.styled)('div')(({
|
|
38
59
|
theme
|
|
39
60
|
}) => ({
|
|
@@ -356,12 +377,14 @@ class PlacementOrdering extends _react.default.Component {
|
|
|
356
377
|
display: 'flex',
|
|
357
378
|
flexDirection: 'column',
|
|
358
379
|
alignItems: 'center',
|
|
359
|
-
boxSizing: 'border-box'
|
|
380
|
+
boxSizing: 'border-box',
|
|
381
|
+
width: '100%'
|
|
360
382
|
};
|
|
361
383
|
return /*#__PURE__*/_react.default.createElement(_drag.DragProvider, {
|
|
362
384
|
onDragStart: () => {},
|
|
363
385
|
onDragEnd: this.onDragEnd,
|
|
364
|
-
collisionDetection: _core.closestCenter
|
|
386
|
+
collisionDetection: _core.closestCenter,
|
|
387
|
+
modifiers: [_modifiers.restrictToParentElement]
|
|
365
388
|
}, /*#__PURE__*/_react.default.createElement(PlacementOrderingContainer, null, /*#__PURE__*/_react.default.createElement(_renderUi.UiLayout, {
|
|
366
389
|
extraCSSRules: extraCSSRules,
|
|
367
390
|
style: containerStyle
|
|
@@ -380,7 +403,7 @@ class PlacementOrdering extends _react.default.Component {
|
|
|
380
403
|
toggled: showingCorrect,
|
|
381
404
|
onToggle: this.toggleCorrect,
|
|
382
405
|
language: language
|
|
383
|
-
}), /*#__PURE__*/_react.default.createElement(OrderingTiler, {
|
|
406
|
+
}), /*#__PURE__*/_react.default.createElement(InteractiveRegion, null, /*#__PURE__*/_react.default.createElement(InteractiveRegionContent, null, /*#__PURE__*/_react.default.createElement(OrderingTiler, {
|
|
384
407
|
instanceId: this.instanceId,
|
|
385
408
|
choiceLabel: config.choiceLabel,
|
|
386
409
|
targetLabel: config.targetLabel,
|
|
@@ -391,7 +414,7 @@ class PlacementOrdering extends _react.default.Component {
|
|
|
391
414
|
tileSize: config.tileSize,
|
|
392
415
|
includeTargets: includeTargets,
|
|
393
416
|
choiceLabelEnabled: model.config && model.config.choiceLabelEnabled
|
|
394
|
-
}), displayNote && /*#__PURE__*/_react.default.createElement(StyledNote, {
|
|
417
|
+
}))), displayNote && /*#__PURE__*/_react.default.createElement(StyledNote, {
|
|
395
418
|
dangerouslySetInnerHTML: {
|
|
396
419
|
__html: note
|
|
397
420
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement-ordering.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_debug","_lodashEs","_styles","_core","_renderUi","_mathRendering","_translator","_correctAnswerToggle","_drag","_tiler","_ordering","_utils","translator","Translator","log","debug","PlacementOrderingContainer","styled","color","text","backgroundColor","background","display","flexDirection","alignItems","boxSizing","StyledPrompt","theme","paddingBottom","spacing","StyledNote","StyledToggle","CorrectAnswerToggle","StyledCollapsible","Collapsible","marginBottom","alignSelf","OrderingTiler","props","tiler","Comp","ordering","onDropChoice","onRemoveChoice","compProps","default","createElement","_extends2","tiles","t","s","propTypes","PropTypes","func","any","PlacementOrdering","React","Component","constructor","_defineProperty2","showingCorrect","setState","model","session","areChoicesShuffled","config","choices","includeTargets","choicesIds","map","c","id","value","needsReset","sessionMissing","length","missingChoiceIds","difference","extraChoiceIds","isEqual","sessionIsMismatched","concat","Array","filter","cId","includes","console","warn","target","source","onSessionChange","from","find","type","index","to","update","reducer","sessionUpdate","Object","assign","response","state","orientation","buildState","correctResponse","outcome","allowSameChoiceInTargets","outcomes","event","over","active","createOrdering","draggedItem","data","current","droppedOnItem","instanceId","uniqueId","validateSession","env","mode","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","UNSAFE_componentWillReceiveProps","nextProps","nextModel","currentModel","nextChoices","newState","isLanguageChanged","language","isDefaultNote","note","lng","haveSameValuesButDifferentOrder","validatedSession","newSession","includeTargetsChanged","render","correctness","extraCSSRules","prompt","rationale","feedback","configs","showNote","disabled","teacherInstructions","showToggle","vertical","role","Tiler","VerticalTiler","HorizontalTiler","displayNote","showRationale","hasText","hasMedia","showTeacherInstructions","containerStyle","DragProvider","onDragStart","onDragEnd","collisionDetection","closestCenter","UiLayout","style","labels","hidden","visible","className","PreviewPrompt","show","toggled","onToggle","toggleCorrect","choiceLabel","targetLabel","addGuide","showOrdering","tileSize","choiceLabelEnabled","dangerouslySetInnerHTML","__html","Feedback","exports","isRequired","object","oneOfType","array","_default"],"sources":["../src/placement-ordering.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { difference, isEqual, uniqueId } from 'lodash-es';\nimport { styled } from '@mui/material/styles';\nimport { closestCenter } from '@dnd-kit/core';\n\nimport { Collapsible, color, Feedback, hasMedia, hasText, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport { HorizontalTiler, VerticalTiler } from './tiler';\nimport { buildState, reducer } from './ordering';\nimport { haveSameValuesButDifferentOrder } from './utils';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-elements:placement-ordering');\n\nconst PlacementOrderingContainer = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n});\n\nconst StyledPrompt = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledNote = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nconst StyledToggle = styled(CorrectAnswerToggle)(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n alignSelf: 'flex-start',\n}));\n\nconst OrderingTiler = (props) => {\n const { tiler: Comp, ordering, onDropChoice, onRemoveChoice, ...compProps } = props;\n\n return (\n <Comp\n {...compProps}\n tiles={ordering.tiles}\n onDropChoice={(t, s) => onDropChoice(t, s, ordering)}\n onRemoveChoice={(t) => onRemoveChoice(t, ordering)}\n />\n );\n};\n\nOrderingTiler.propTypes = {\n tiler: PropTypes.func,\n ordering: PropTypes.any,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n};\n\nexport class PlacementOrdering extends React.Component {\n static propTypes = {\n onSessionChange: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n session: PropTypes.oneOfType([PropTypes.array.isRequired, PropTypes.object.isRequired]),\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n const { value, needsReset } = this.validateSession(props);\n\n this.state = {\n showingCorrect: false,\n };\n\n const { model } = props || {};\n const { env } = model || {};\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange({\n ...props.session,\n value,\n });\n }\n }\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n validateSession = ({ model, session }, areChoicesShuffled = false) => {\n const { config, choices } = model || {};\n const { includeTargets } = config || {};\n const choicesIds = choices.map((c) => c.id);\n\n let { value } = session || {};\n let needsReset;\n\n if (!includeTargets) {\n // Use all choice IDs if choices were shuffled or session is missing/invalid\n const sessionMissing = !value || !value.length;\n if (sessionMissing || areChoicesShuffled) {\n // if there's no value on session in No Targets Mode, we need to set an initial session\n value = choicesIds;\n } else {\n // in No Targets Mode, all choice ids need to be used\n const missingChoiceIds = difference(choicesIds, value);\n // this is the case that handles extra choice ids in session\n const extraChoiceIds = difference(value, choicesIds);\n\n if (missingChoiceIds.length || extraChoiceIds.length) {\n value = choicesIds;\n }\n }\n\n needsReset = !isEqual(session.value, value);\n } else {\n // in Targets Area selected, it's important to check the length of session\n const sessionIsMismatched = value && value.length !== choicesIds.length;\n if (sessionIsMismatched) {\n needsReset = true;\n\n // if choices were added, add value in session\n if (value.length < choicesIds.length) {\n value = value.concat(new Array(choicesIds.length - value.length));\n } else {\n // if choices were removed, make sure to remove from session as well\n value = value.filter((cId) => choicesIds.includes(cId));\n }\n }\n }\n\n if (needsReset) {\n // eslint-disable-next-line no-console\n console.warn('This session is not valid anymore. It will be reset.');\n }\n\n return { value, needsReset };\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: nextModel = {} } = nextProps || {};\n const { model: currentModel = {} } = this.props || {};\n const { correctResponse, config, choices: nextChoices = [], env } = nextModel;\n const { includeTargets } = config || {};\n\n const newState = {};\n\n const isLanguageChanged = currentModel.language && currentModel.language !== nextModel.language;\n const isDefaultNote =\n currentModel.note &&\n currentModel.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: currentModel.language });\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (isLanguageChanged && isDefaultNote) {\n currentModel.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n if (!correctResponse) {\n newState.showingCorrect = false;\n }\n\n //PD-4924\n // show student choices same order as in model when teacher changes student choices order\n // for cases when student view and instructor view are on same page\n const areChoicesShuffled = haveSameValuesButDifferentOrder(nextChoices, currentModel.choices);\n\n const validatedSession = this.validateSession(nextProps, areChoicesShuffled);\n let { value, needsReset } = validatedSession;\n\n const newSession = {\n ...nextProps.session,\n value,\n };\n const includeTargetsChanged = currentModel.config?.includeTargets !== includeTargets;\n\n if (includeTargets && includeTargetsChanged) {\n needsReset = true;\n\n delete newSession.value;\n }\n\n this.setState(newState, () => {\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange(newSession);\n }\n });\n }\n\n onDropChoice = (target, source, ordering) => {\n const { onSessionChange, session } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type && t.index === source.index);\n const to = target;\n log('[onDropChoice] ', from, to);\n const update = reducer({ type: 'move', from, to }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n\n onSessionChange(sessionUpdate);\n };\n\n onRemoveChoice = (target, ordering) => {\n const { onSessionChange, session } = this.props;\n log('[onRemoveChoice]', target);\n const update = reducer({ type: 'remove', target }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n onSessionChange(sessionUpdate);\n };\n\n createOrdering = () => {\n const { model, session } = this.props;\n const { showingCorrect } = this.state;\n const config = model.config || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { includeTargets } = config;\n\n return showingCorrect\n ? buildState(\n model.choices,\n model.correctResponse,\n model.correctResponse.map((id) => ({ id, outcome: 'correct' })),\n {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n },\n )\n : buildState(model.choices, session.value, model.outcomes, {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n });\n };\n\n onDragEnd = (event) => {\n const { over, active } = event;\n const ordering = this.createOrdering();\n\n if (over && active) {\n const draggedItem = active.data.current;\n const droppedOnItem = over.data.current;\n\n if (draggedItem && droppedOnItem && droppedOnItem.type === 'target') {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n return;\n }\n\n if (draggedItem && droppedOnItem) {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n }\n } else if (!over && active) {\n const draggedItem = active.data.current;\n if (draggedItem && draggedItem.type === 'target') {\n this.onRemoveChoice(draggedItem, ordering);\n }\n }\n };\n\n render() {\n const { model } = this.props;\n const {\n correctResponse,\n correctness,\n extraCSSRules,\n prompt,\n rationale,\n feedback,\n config: configs,\n note,\n showNote,\n env,\n disabled,\n teacherInstructions,\n language,\n } = model;\n const showToggle = correctResponse && correctResponse.length > 0;\n const { showingCorrect } = this.state;\n const config = configs || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { orientation, includeTargets } = config;\n const vertical = orientation === 'vertical';\n const ordering = this.createOrdering();\n const { mode, role } = env || {};\n\n const Tiler = vertical ? VerticalTiler : HorizontalTiler;\n const displayNote = (showingCorrect || (mode === 'view' && role === 'instructor')) && showNote && note;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const containerStyle = {\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n };\n\n return (\n <DragProvider onDragStart={() => { }} onDragEnd={this.onDragEnd} collisionDetection={closestCenter}>\n <PlacementOrderingContainer>\n <UiLayout extraCSSRules={extraCSSRules} style={containerStyle}>\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n <StyledPrompt>\n <PreviewPrompt prompt={prompt} />\n </StyledPrompt>\n\n <StyledToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n language={language}\n />\n\n <OrderingTiler\n instanceId={this.instanceId}\n choiceLabel={config.choiceLabel}\n targetLabel={config.targetLabel}\n ordering={ordering}\n tiler={Tiler}\n disabled={disabled}\n addGuide={config.showOrdering}\n tileSize={config.tileSize}\n includeTargets={includeTargets}\n choiceLabelEnabled={model.config && model.config.choiceLabelEnabled}\n />\n\n {displayNote && <StyledNote dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <StyledCollapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={rationale} />\n </StyledCollapsible>\n )}\n\n {!showingCorrect && <Feedback correctness={correctness} feedback={feedback} />}\n </UiLayout>\n </PlacementOrderingContainer>\n </DragProvider>\n );\n }\n}\n\nexport default PlacementOrdering;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,oBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,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AU;MAAC4J,uBAAuB,EAAE;QAAEC,MAAM,EAAEnD;MAAK;IAAE,CAAE,CAAC,EAExEuB,aAAa,iBACZpK,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAACb,iBAAiB;MAChB0I,MAAM,EAAE;QAAEC,MAAM,EAAE,gBAAgB;QAAEC,OAAO,EAAE;MAAiB,CAAE;MAChEC,SAAS,EAAC;IAAa,gBAEvBnL,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAAC1C,SAAA,CAAA2K,aAAa;MAAC9B,MAAM,EAAEC;IAAU,CAAE,CAClB,CACpB,EAEA,CAACtF,cAAc,iBAAIjE,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAAC1C,SAAA,CAAAwL,QAAQ;MAAC7C,WAAW,EAAEA,WAAY;MAACI,QAAQ,EAAEA;IAAS,CAAE,CACrE,CACgB,CAChB,CAAC;EAEnB;AACF;AAAC0C,OAAA,CAAAtI,iBAAA,GAAAA,iBAAA;AAAA,IAAAI,gBAAA,CAAAd,OAAA,EAvTYU,iBAAiB,eACT;EACjBmC,eAAe,EAAEtC,kBAAS,CAACC,IAAI,CAACyI,UAAU;EAC1ChI,KAAK,EAAEV,kBAAS,CAAC2I,MAAM,CAACD,UAAU;EAClC/H,OAAO,EAAEX,kBAAS,CAAC4I,SAAS,CAAC,CAAC5I,kBAAS,CAAC6I,KAAK,CAACH,UAAU,EAAE1I,kBAAS,CAAC2I,MAAM,CAACD,UAAU,CAAC;AACxF,CAAC;AAAA,IAAAI,QAAA,GAAAL,OAAA,CAAAhJ,OAAA,GAoTYU,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"placement-ordering.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_debug","_lodashEs","_styles","_core","_modifiers","_renderUi","_mathRendering","_translator","_correctAnswerToggle","_drag","_tiler","_ordering","_utils","translator","Translator","log","debug","PlacementOrderingContainer","styled","color","text","backgroundColor","background","display","flexDirection","alignItems","boxSizing","InteractiveRegion","alignSelf","maxWidth","overflowX","overflowY","InteractiveRegionContent","justifyContent","minWidth","StyledPrompt","theme","paddingBottom","spacing","StyledNote","StyledToggle","CorrectAnswerToggle","StyledCollapsible","Collapsible","marginBottom","OrderingTiler","props","tiler","Comp","ordering","onDropChoice","onRemoveChoice","compProps","default","createElement","_extends2","tiles","t","s","propTypes","PropTypes","func","any","PlacementOrdering","React","Component","constructor","_defineProperty2","showingCorrect","setState","model","session","areChoicesShuffled","config","choices","includeTargets","choicesIds","map","c","id","value","needsReset","sessionMissing","length","missingChoiceIds","difference","extraChoiceIds","isEqual","sessionIsMismatched","concat","Array","filter","cId","includes","console","warn","target","source","onSessionChange","from","find","type","index","to","update","reducer","sessionUpdate","Object","assign","response","state","orientation","buildState","correctResponse","outcome","allowSameChoiceInTargets","outcomes","event","over","active","createOrdering","draggedItem","data","current","droppedOnItem","instanceId","uniqueId","validateSession","env","mode","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","UNSAFE_componentWillReceiveProps","nextProps","nextModel","currentModel","nextChoices","newState","isLanguageChanged","language","isDefaultNote","note","lng","haveSameValuesButDifferentOrder","validatedSession","newSession","includeTargetsChanged","render","correctness","extraCSSRules","prompt","rationale","feedback","configs","showNote","disabled","teacherInstructions","showToggle","vertical","role","Tiler","VerticalTiler","HorizontalTiler","displayNote","showRationale","hasText","hasMedia","showTeacherInstructions","containerStyle","width","DragProvider","onDragStart","onDragEnd","collisionDetection","closestCenter","modifiers","restrictToParentElement","UiLayout","style","labels","hidden","visible","className","PreviewPrompt","show","toggled","onToggle","toggleCorrect","choiceLabel","targetLabel","addGuide","showOrdering","tileSize","choiceLabelEnabled","dangerouslySetInnerHTML","__html","Feedback","exports","isRequired","object","oneOfType","array","_default"],"sources":["../src/placement-ordering.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { difference, isEqual, uniqueId } from 'lodash-es';\nimport { styled } from '@mui/material/styles';\nimport { closestCenter } from '@dnd-kit/core';\nimport { restrictToParentElement } from '@dnd-kit/modifiers';\n\nimport { Collapsible, color, Feedback, hasMedia, hasText, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport { HorizontalTiler, VerticalTiler } from './tiler';\nimport { buildState, reducer } from './ordering';\nimport { haveSameValuesButDifferentOrder } from './utils';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-elements:placement-ordering');\n\nconst PlacementOrderingContainer = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n});\n\n// The interactive region - the choices and answers columns for a vertical item, or the choices and\n// answers rows for a horizontal one - scrolls horizontally when it does not fit the available width.\nconst InteractiveRegion = styled('div')({\n // the ancestors centre their children, which shrink-wraps this box to its content. without a\n // definite width it grows with the tiler and the overflow escapes outwards instead of scrolling.\n alignSelf: 'stretch',\n maxWidth: '100%',\n overflowX: 'auto',\n // tiles are dragged by transform, which counts towards scrollable overflow, so leaving this axis\n // scrollable would pop a vertical scrollbar mid-drag\n overflowY: 'hidden',\n});\n\n// keeps the tiler at its natural width, and centred while it still fits\nconst InteractiveRegionContent = styled('div')({\n display: 'flex',\n justifyContent: 'center',\n minWidth: 'min-content',\n});\n\nconst StyledPrompt = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledNote = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nconst StyledToggle = styled(CorrectAnswerToggle)(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n alignSelf: 'flex-start',\n}));\n\nconst OrderingTiler = (props) => {\n const { tiler: Comp, ordering, onDropChoice, onRemoveChoice, ...compProps } = props;\n\n return (\n <Comp\n {...compProps}\n tiles={ordering.tiles}\n onDropChoice={(t, s) => onDropChoice(t, s, ordering)}\n onRemoveChoice={(t) => onRemoveChoice(t, ordering)}\n />\n );\n};\n\nOrderingTiler.propTypes = {\n tiler: PropTypes.func,\n ordering: PropTypes.any,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n};\n\nexport class PlacementOrdering extends React.Component {\n static propTypes = {\n onSessionChange: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n session: PropTypes.oneOfType([PropTypes.array.isRequired, PropTypes.object.isRequired]),\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n const { value, needsReset } = this.validateSession(props);\n\n this.state = {\n showingCorrect: false,\n };\n\n const { model } = props || {};\n const { env } = model || {};\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange({\n ...props.session,\n value,\n });\n }\n }\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n validateSession = ({ model, session }, areChoicesShuffled = false) => {\n const { config, choices } = model || {};\n const { includeTargets } = config || {};\n const choicesIds = choices.map((c) => c.id);\n\n let { value } = session || {};\n let needsReset;\n\n if (!includeTargets) {\n // Use all choice IDs if choices were shuffled or session is missing/invalid\n const sessionMissing = !value || !value.length;\n if (sessionMissing || areChoicesShuffled) {\n // if there's no value on session in No Targets Mode, we need to set an initial session\n value = choicesIds;\n } else {\n // in No Targets Mode, all choice ids need to be used\n const missingChoiceIds = difference(choicesIds, value);\n // this is the case that handles extra choice ids in session\n const extraChoiceIds = difference(value, choicesIds);\n\n if (missingChoiceIds.length || extraChoiceIds.length) {\n value = choicesIds;\n }\n }\n\n needsReset = !isEqual(session.value, value);\n } else {\n // in Targets Area selected, it's important to check the length of session\n const sessionIsMismatched = value && value.length !== choicesIds.length;\n if (sessionIsMismatched) {\n needsReset = true;\n\n // if choices were added, add value in session\n if (value.length < choicesIds.length) {\n value = value.concat(new Array(choicesIds.length - value.length));\n } else {\n // if choices were removed, make sure to remove from session as well\n value = value.filter((cId) => choicesIds.includes(cId));\n }\n }\n }\n\n if (needsReset) {\n // eslint-disable-next-line no-console\n console.warn('This session is not valid anymore. It will be reset.');\n }\n\n return { value, needsReset };\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: nextModel = {} } = nextProps || {};\n const { model: currentModel = {} } = this.props || {};\n const { correctResponse, config, choices: nextChoices = [], env } = nextModel;\n const { includeTargets } = config || {};\n\n const newState = {};\n\n const isLanguageChanged = currentModel.language && currentModel.language !== nextModel.language;\n const isDefaultNote =\n currentModel.note &&\n currentModel.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: currentModel.language });\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (isLanguageChanged && isDefaultNote) {\n currentModel.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n if (!correctResponse) {\n newState.showingCorrect = false;\n }\n\n //PD-4924\n // show student choices same order as in model when teacher changes student choices order\n // for cases when student view and instructor view are on same page\n const areChoicesShuffled = haveSameValuesButDifferentOrder(nextChoices, currentModel.choices);\n\n const validatedSession = this.validateSession(nextProps, areChoicesShuffled);\n let { value, needsReset } = validatedSession;\n\n const newSession = {\n ...nextProps.session,\n value,\n };\n const includeTargetsChanged = currentModel.config?.includeTargets !== includeTargets;\n\n if (includeTargets && includeTargetsChanged) {\n needsReset = true;\n\n delete newSession.value;\n }\n\n this.setState(newState, () => {\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange(newSession);\n }\n });\n }\n\n onDropChoice = (target, source, ordering) => {\n const { onSessionChange, session } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type && t.index === source.index);\n const to = target;\n log('[onDropChoice] ', from, to);\n const update = reducer({ type: 'move', from, to }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n\n onSessionChange(sessionUpdate);\n };\n\n onRemoveChoice = (target, ordering) => {\n const { onSessionChange, session } = this.props;\n log('[onRemoveChoice]', target);\n const update = reducer({ type: 'remove', target }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n onSessionChange(sessionUpdate);\n };\n\n createOrdering = () => {\n const { model, session } = this.props;\n const { showingCorrect } = this.state;\n const config = model.config || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { includeTargets } = config;\n\n return showingCorrect\n ? buildState(\n model.choices,\n model.correctResponse,\n model.correctResponse.map((id) => ({ id, outcome: 'correct' })),\n {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n },\n )\n : buildState(model.choices, session.value, model.outcomes, {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n });\n };\n\n onDragEnd = (event) => {\n const { over, active } = event;\n const ordering = this.createOrdering();\n\n if (over && active) {\n const draggedItem = active.data.current;\n const droppedOnItem = over.data.current;\n\n if (draggedItem && droppedOnItem && droppedOnItem.type === 'target') {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n return;\n }\n\n if (draggedItem && droppedOnItem) {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n }\n } else if (!over && active) {\n const draggedItem = active.data.current;\n if (draggedItem && draggedItem.type === 'target') {\n this.onRemoveChoice(draggedItem, ordering);\n }\n }\n };\n\n render() {\n const { model } = this.props;\n const {\n correctResponse,\n correctness,\n extraCSSRules,\n prompt,\n rationale,\n feedback,\n config: configs,\n note,\n showNote,\n env,\n disabled,\n teacherInstructions,\n language,\n } = model;\n const showToggle = correctResponse && correctResponse.length > 0;\n const { showingCorrect } = this.state;\n const config = configs || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { orientation, includeTargets } = config;\n const vertical = orientation === 'vertical';\n const ordering = this.createOrdering();\n const { mode, role } = env || {};\n\n const Tiler = vertical ? VerticalTiler : HorizontalTiler;\n const displayNote = (showingCorrect || (mode === 'view' && role === 'instructor')) && showNote && note;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const containerStyle = {\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n width: '100%',\n };\n\n return (\n <DragProvider\n onDragStart={() => { }}\n onDragEnd={this.onDragEnd}\n collisionDetection={closestCenter}\n modifiers={[restrictToParentElement]}\n >\n <PlacementOrderingContainer>\n <UiLayout extraCSSRules={extraCSSRules} style={containerStyle}>\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n <StyledPrompt>\n <PreviewPrompt prompt={prompt} />\n </StyledPrompt>\n\n <StyledToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n language={language}\n />\n\n <InteractiveRegion>\n <InteractiveRegionContent>\n <OrderingTiler\n instanceId={this.instanceId}\n choiceLabel={config.choiceLabel}\n targetLabel={config.targetLabel}\n ordering={ordering}\n tiler={Tiler}\n disabled={disabled}\n addGuide={config.showOrdering}\n tileSize={config.tileSize}\n includeTargets={includeTargets}\n choiceLabelEnabled={model.config && model.config.choiceLabelEnabled}\n />\n </InteractiveRegionContent>\n </InteractiveRegion>\n\n {displayNote && <StyledNote dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <StyledCollapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={rationale} />\n </StyledCollapsible>\n )}\n\n {!showingCorrect && <Feedback correctness={correctness} feedback={feedback} />}\n </UiLayout>\n </PlacementOrderingContainer>\n </DragProvider>\n );\n }\n}\n\nexport default PlacementOrdering;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,oBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,KAAA,GAAAZ,OAAA;AAEA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,SAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AAEA,MAAM;EAAEgB;AAAW,CAAC,GAAGC,mBAAU;AAEjC,MAAMC,GAAG,GAAG,IAAAC,cAAK,EAAC,iCAAiC,CAAC;AAEpD,MAAMC,0BAA0B,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EAC/CC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;EACnBC,eAAe,EAAEF,eAAK,CAACG,UAAU,CAAC,CAAC;EACnCC,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE,QAAQ;EACvBC,UAAU,EAAE,QAAQ;EACpBC,SAAS,EAAE;AACb,CAAC,CAAC;;AAEF;AACA;AACA,MAAMC,iBAAiB,GAAG,IAAAT,cAAM,EAAC,KAAK,CAAC,CAAC;EACtC;EACA;EACAU,SAAS,EAAE,SAAS;EACpBC,QAAQ,EAAE,MAAM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CAAE,CAAC,EAExEuB,aAAa,iBACZ5K,MAAA,CAAA0D,OAAA,CAAAC,aAAA,CAACZ,iBAAiB;MAChB4I,MAAM,EAAE;QAAEC,MAAM,EAAE,gBAAgB;QAAEC,OAAO,EAAE;MAAiB,CAAE;MAChEC,SAAS,EAAC;IAAa,gBAEvB9L,MAAA,CAAA0D,OAAA,CAAAC,aAAA,CAACjD,SAAA,CAAAqL,aAAa;MAACjC,MAAM,EAAEC;IAAU,CAAE,CAClB,CACpB,EAEA,CAACtF,cAAc,iBAAIzE,MAAA,CAAA0D,OAAA,CAAAC,aAAA,CAACjD,SAAA,CAAAkM,QAAQ;MAAChD,WAAW,EAAEA,WAAY;MAACI,QAAQ,EAAEA;IAAS,CAAE,CACrE,CACgB,CAChB,CAAC;EAEnB;AACF;AAAC6C,OAAA,CAAAzI,iBAAA,GAAAA,iBAAA;AAAA,IAAAI,gBAAA,CAAAd,OAAA,EAjUYU,iBAAiB,eACT;EACjBmC,eAAe,EAAEtC,kBAAS,CAACC,IAAI,CAAC4I,UAAU;EAC1CnI,KAAK,EAAEV,kBAAS,CAAC8I,MAAM,CAACD,UAAU;EAClClI,OAAO,EAAEX,kBAAS,CAAC+I,SAAS,CAAC,CAAC/I,kBAAS,CAACgJ,KAAK,CAACH,UAAU,EAAE7I,kBAAS,CAAC8I,MAAM,CAACD,UAAU,CAAC;AACxF,CAAC;AAAA,IAAAI,QAAA,GAAAL,OAAA,CAAAnJ,OAAA,GA8TYU,iBAAiB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/placement-ordering",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "14.1.1-next.
|
|
4
|
+
"version": "14.1.1-next.115+08a608683",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@dnd-kit/core": "6.3.1",
|
|
11
|
+
"@dnd-kit/modifiers": "9.0.0",
|
|
11
12
|
"@emotion/react": "^11.14.0",
|
|
12
13
|
"@emotion/style": "^0.8.0",
|
|
13
14
|
"@mui/icons-material": "^7.3.4",
|
|
14
15
|
"@mui/material": "^7.3.4",
|
|
15
16
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
16
|
-
"@pie-lib/correct-answer-toggle": "4.0.
|
|
17
|
-
"@pie-lib/drag": "4.0.
|
|
18
|
-
"@pie-lib/math-rendering": "5.0
|
|
19
|
-
"@pie-lib/render-ui": "6.1.
|
|
17
|
+
"@pie-lib/correct-answer-toggle": "4.0.5",
|
|
18
|
+
"@pie-lib/drag": "4.0.6",
|
|
19
|
+
"@pie-lib/math-rendering": "5.1.0",
|
|
20
|
+
"@pie-lib/render-ui": "6.1.3",
|
|
20
21
|
"@pie-lib/translator": "4.0.2",
|
|
21
22
|
"debug": "^4.1.1",
|
|
22
23
|
"decimal.js": "^10.0.0",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
},
|
|
29
30
|
"author": "",
|
|
30
31
|
"license": "ISC",
|
|
31
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "08a6086837ed974f44ce621b178dc3115b8b65dc",
|
|
32
33
|
"scripts": {
|
|
33
34
|
"postpublish": "../../scripts/postpublish"
|
|
34
35
|
},
|