@pie-element/placement-ordering 13.1.1-next.3 → 13.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/lib/choice-tile.js +21 -2
- package/configure/lib/choice-tile.js.map +1 -1
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +10 -0
- package/controller/lib/index.js +74 -2
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [13.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@13.1.1-next.4...@pie-element/placement-ordering@13.2.0-next.0) (2026-03-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- tests ([bcea404](https://github.com/pie-framework/pie-elements/commit/bcea40428ae344270edf703186cbe83b85b1ead2))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **placement-ordering:** add scoring trace in outcome function PD-5459 ([ddaeeea](https://github.com/pie-framework/pie-elements/commit/ddaeeea858dde5a462225798bdca4acc90cd7a39))
|
|
15
|
+
|
|
16
|
+
## [13.1.1-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@13.1.1-next.3...@pie-element/placement-ordering@13.1.1-next.4) (2026-03-12)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- add touchAction none to various styled components for improved touch handling drag and drop PD-5811 ([bc5a8af](https://github.com/pie-framework/pie-elements/commit/bc5a8afab27ee254608c55ecc7e7c7130a191f38))
|
|
21
|
+
- bump libs, update mathquill, switch interface PD-5791 ([686a7c0](https://github.com/pie-framework/pie-elements/commit/686a7c0d41ff82f5ddad7cecd93cc0c18324a81b))
|
|
22
|
+
- **placement-ordering:** prevent dragging when editing content PD-5788 ([4523606](https://github.com/pie-framework/pie-elements/commit/452360638540351e74506da0c1723ab587538800))
|
|
23
|
+
|
|
6
24
|
## [13.1.1-next.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@13.1.1-next.2...@pie-element/placement-ordering@13.1.1-next.3) (2026-03-06)
|
|
7
25
|
|
|
8
26
|
**Note:** Version bump only for package @pie-element/placement-ordering
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [10.1.1-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@10.1.1-next.3...@pie-element/placement-ordering-configure@10.1.1-next.4) (2026-03-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- add touchAction none to various styled components for improved touch handling drag and drop PD-5811 ([bc5a8af](https://github.com/pie-framework/pie-elements/commit/bc5a8afab27ee254608c55ecc7e7c7130a191f38))
|
|
11
|
+
- bump libs, update mathquill, switch interface PD-5791 ([686a7c0](https://github.com/pie-framework/pie-elements/commit/686a7c0d41ff82f5ddad7cecd93cc0c18324a81b))
|
|
12
|
+
- **placement-ordering:** prevent dragging when editing content PD-5788 ([4523606](https://github.com/pie-framework/pie-elements/commit/452360638540351e74506da0c1723ab587538800))
|
|
13
|
+
|
|
6
14
|
## [10.1.1-next.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@10.1.1-next.2...@pie-element/placement-ordering-configure@10.1.1-next.3) (2026-03-06)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/placement-ordering-configure
|
|
@@ -26,7 +26,8 @@ const StyledChoiceTile = (0, _styles.styled)('div')(({
|
|
|
26
26
|
backgroundColor: theme.palette.background.paper,
|
|
27
27
|
display: 'flex',
|
|
28
28
|
flexDirection: 'column',
|
|
29
|
-
cursor: 'move'
|
|
29
|
+
cursor: 'move',
|
|
30
|
+
touchAction: 'none'
|
|
30
31
|
}));
|
|
31
32
|
const StyledEditableHtml = (0, _styles.styled)(_editableHtmlTipTap.default)(({
|
|
32
33
|
theme,
|
|
@@ -119,11 +120,29 @@ const ChoiceTile = props => {
|
|
|
119
120
|
width: '100%'
|
|
120
121
|
};
|
|
121
122
|
const filteredDefaultPlugins = (_editableHtmlTipTap.DEFAULT_PLUGINS || []).filter(p => p !== 'bulleted-list' && p !== 'numbered-list');
|
|
123
|
+
const isEditableElement = target => target.closest('[contenteditable]') || target.closest('input') || target.closest('textarea') || target.isContentEditable;
|
|
124
|
+
|
|
125
|
+
// edit listeners to prevent dragging when interacting with editable-html element
|
|
126
|
+
const filteredListeners = {
|
|
127
|
+
...listeners,
|
|
128
|
+
onKeyDown: e => {
|
|
129
|
+
if (isEditableElement(e.target)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
listeners?.onKeyDown?.(e);
|
|
133
|
+
},
|
|
134
|
+
onPointerDown: e => {
|
|
135
|
+
if (isEditableElement(e.target)) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
listeners?.onPointerDown?.(e);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
122
141
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
142
|
ref: setDropRef
|
|
124
143
|
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
125
144
|
ref: setDragRef
|
|
126
|
-
},
|
|
145
|
+
}, filteredListeners, attributes), /*#__PURE__*/_react.default.createElement(StyledChoiceTile, {
|
|
127
146
|
style: style
|
|
128
147
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
129
148
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choice-tile.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_core","_CardActions","_DragHandle","_IconButton","_RemoveCircle","_styles","_renderUi","_editableHtmlTipTap","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","log","debug","StyledChoiceTile","styled","theme","margin","spacing","backgroundColor","palette","background","paper","display","flexDirection","cursor","StyledEditableHtml","EditableHtml","isTargetPrompt","width","borderRadius","error","light","StyledControls","justifyContent","StyledActions","DragHandle","color","StyledErrorText","fontSize","typography","main","marginLeft","marginTop","StyledRemoveCircle","RemoveCircle","fill","StyledIconButton","IconButton","tertiary","ChoiceTile","props","choice","index","onChoiceChange","onDelete","imageSupport","spellCheck","toolbarOpts","pluginProps","maxImageWidth","maxImageHeight","mathMlOptions","label","editable","type","draggableId","id","droppableId","attributes","listeners","setNodeRef","setDragRef","transform","isDragging","useDraggable","data","setDropRef","useDroppable","onLabelChange","style","x","y","undefined","opacity","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","createElement","ref","_extends2","disabled","placeholder","includes","markup","onChange","activePlugins","autoWidthToolbar","languageCharactersProps","language","onClick","size","exports","propTypes","PropTypes","any","object","string","isOver","bool","empty","outcome","number","shape","add","func","isRequired","delete","choices","array","choicesLabel","_default"],"sources":["../src/choice-tile.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport CardActions from '@mui/material/CardActions';\nimport DragHandle from '@mui/icons-material/DragHandle';\nimport IconButton from '@mui/material/IconButton';\nimport RemoveCircle from '@mui/icons-material/RemoveCircle';\nimport { styled } from '@mui/material/styles';\n\nimport { color } from '@pie-lib/render-ui';\nimport EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html-tip-tap';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nconst StyledChoiceTile = styled('div')(({ theme }) => ({\n margin: `${theme.spacing(1)}px 0`,\n backgroundColor: theme.palette.background.paper,\n display: 'flex',\n flexDirection: 'column',\n cursor: 'move'\n}));\n\nconst StyledEditableHtml = styled(EditableHtml)(({ theme, isTargetPrompt }) => ({\n width: '80%',\n borderRadius: '4px',\n ...(isTargetPrompt && {\n backgroundColor: theme.palette.error.light,\n }),\n}));\n\nconst StyledControls = styled('div')(() => ({\n display: 'flex',\n justifyContent: 'flex-end',\n}));\n\nconst StyledActions = styled(DragHandle)(({ theme }) => ({\n color: theme.palette.error[400],\n}));\n\nconst StyledErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n marginLeft: theme.spacing(5),\n marginTop: theme.spacing(1),\n}));\n\nconst StyledRemoveCircle = styled(RemoveCircle)(({ theme }) => ({\n fill: theme.palette.error[500],\n}));\n\nconst StyledIconButton = styled(IconButton)({\n color: `${color.tertiary()} !important`,\n});\n\nexport const ChoiceTile = (props) => {\n const {\n choice,\n index,\n onChoiceChange,\n onDelete,\n imageSupport,\n spellCheck,\n toolbarOpts,\n pluginProps,\n maxImageWidth,\n maxImageHeight,\n error,\n mathMlOptions = {},\n } = props;\n const { label, editable, type } = choice;\n const draggableId = `${type}-${choice.id}`;\n const droppableId = `${type}-drop-${choice.id}`;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n isDragging,\n } = useDraggable({\n id: draggableId,\n data: {\n id: choice.id,\n index,\n type,\n },\n });\n\n const {\n setNodeRef: setDropRef,\n } = useDroppable({\n id: droppableId,\n data: {\n id: choice.id,\n index,\n type,\n },\n });\n\n const onLabelChange = (label) => {\n choice.label = label;\n onChoiceChange(choice);\n };\n\n const style = {\n transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,\n opacity: isDragging ? 0.5 : 1,\n width: '100%',\n };\n\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'bulleted-list' && p !== 'numbered-list',\n );\n\n return (\n <div ref={setDropRef}>\n <div ref={setDragRef} {...listeners} {...attributes}>\n <StyledChoiceTile style={style}>\n <div style={{ width: '100%', display: 'flex' }}>\n <CardActions>\n <StyledActions />\n </CardActions>\n\n <StyledEditableHtml\n disabled={!editable}\n placeholder={type !== 'target' && !label.includes('data-latex') ? 'Enter a choice' : ''}\n markup={label}\n imageSupport={imageSupport || undefined}\n onChange={onLabelChange}\n pluginProps={pluginProps}\n toolbarOpts={toolbarOpts}\n activePlugins={filteredDefaultPlugins}\n spellCheck={spellCheck}\n autoWidthToolbar\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n error={editable && error}\n mathMlOptions={mathMlOptions}\n />\n\n {editable && (\n <StyledControls>\n <StyledIconButton onClick={onDelete} size=\"large\">\n <StyledRemoveCircle />\n </StyledIconButton>\n </StyledControls>\n )}\n </div>\n\n {editable && error && <StyledErrorText>{error}</StyledErrorText>}\n </StyledChoiceTile>\n </div>\n </div>\n );\n};\n\nChoiceTile.propTypes = {\n id: PropTypes.any,\n maxImageHeight: PropTypes.object,\n maxImageWidth: PropTypes.object,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.object,\n index: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n choice: PropTypes.object,\n choices: PropTypes.array.isRequired,\n onChoiceChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n toolbarOpts: PropTypes.object,\n pluginProps: PropTypes.object,\n choicesLabel: PropTypes.string,\n error: PropTypes.string,\n spellCheck: PropTypes.bool,\n mathMlOptions: PropTypes.object,\n};\n\nexport default ChoiceTile;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GA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AG;EACjB7C,cAAc,EAAE4C,kBAAS,CAACE,MAAM;EAChC/C,aAAa,EAAE6C,kBAAS,CAACE,MAAM;EAC/B5C,KAAK,EAAE0C,kBAAS,CAACG,MAAM;EACvBC,MAAM,EAAEJ,kBAAS,CAACK,IAAI;EACtB7C,IAAI,EAAEwC,kBAAS,CAACG,MAAM;EACtBG,KAAK,EAAEN,kBAAS,CAACK,IAAI;EACrBlB,QAAQ,EAAEa,kBAAS,CAACK,IAAI;EACxBE,OAAO,EAAEP,kBAAS,CAACE,MAAM;EACzBtD,KAAK,EAAEoD,kBAAS,CAACQ,MAAM;EACvBzD,YAAY,EAAEiD,kBAAS,CAACS,KAAK,CAAC;IAC5BC,GAAG,EAAEV,kBAAS,CAACW,IAAI,CAACC,UAAU;IAC9BC,MAAM,EAAEb,kBAAS,CAACW,IAAI,CAACC;EACzB,CAAC,CAAC;EACFjE,MAAM,EAAEqD,kBAAS,CAACE,MAAM;EACxBY,OAAO,EAAEd,kBAAS,CAACe,KAAK,CAACH,UAAU;EACnC/D,cAAc,EAAEmD,kBAAS,CAACW,IAAI,CAACC,UAAU;EACzC9D,QAAQ,EAAEkD,kBAAS,CAACW,IAAI,CAACC,UAAU;EACnC3D,WAAW,EAAE+C,kBAAS,CAACE,MAAM;EAC7BhD,WAAW,EAAE8C,kBAAS,CAACE,MAAM;EAC7Bc,YAAY,EAAEhB,kBAAS,CAACG,MAAM;EAC9B7E,KAAK,EAAE0E,kBAAS,CAACG,MAAM;EACvBnD,UAAU,EAAEgD,kBAAS,CAACK,IAAI;EAC1BhD,aAAa,EAAE2C,kBAAS,CAACE;AAC3B,CAAC;AAAC,IAAAe,QAAA,GAAAnB,OAAA,CAAApG,OAAA,GAEa+C,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","disabled","placeholder","includes","markup","onChange","activePlugins","autoWidthToolbar","languageCharactersProps","language","onClick","size","exports","propTypes","PropTypes","any","object","string","isOver","bool","empty","outcome","number","shape","add","func","isRequired","delete","choices","array","choicesLabel","_default"],"sources":["../src/choice-tile.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport CardActions from '@mui/material/CardActions';\nimport DragHandle from '@mui/icons-material/DragHandle';\nimport IconButton from '@mui/material/IconButton';\nimport RemoveCircle from '@mui/icons-material/RemoveCircle';\nimport { styled } from '@mui/material/styles';\n\nimport { color } from '@pie-lib/render-ui';\nimport EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html-tip-tap';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nconst StyledChoiceTile = styled('div')(({ theme }) => ({\n margin: `${theme.spacing(1)}px 0`,\n backgroundColor: theme.palette.background.paper,\n display: 'flex',\n flexDirection: 'column',\n cursor: 'move',\n 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,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAEA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAC,uBAAA,CAAAX,OAAA;AAA+E,SAAAW,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAA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AAM;EACvBhE,YAAY,EAAEwD,kBAAS,CAACS,KAAK,CAAC;IAC5BC,GAAG,EAAEV,kBAAS,CAACW,IAAI,CAACC,UAAU;IAC9BC,MAAM,EAAEb,kBAAS,CAACW,IAAI,CAACC;EACzB,CAAC,CAAC;EACFxE,MAAM,EAAE4D,kBAAS,CAACE,MAAM;EACxBY,OAAO,EAAEd,kBAAS,CAACe,KAAK,CAACH,UAAU;EACnCtE,cAAc,EAAE0D,kBAAS,CAACW,IAAI,CAACC,UAAU;EACzCrE,QAAQ,EAAEyD,kBAAS,CAACW,IAAI,CAACC,UAAU;EACnClE,WAAW,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":[]}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/placement-ordering-configure",
|
|
3
|
-
"version": "10.1.1-next.
|
|
3
|
+
"version": "10.1.1-next.4",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -11,9 +11,9 @@
|
|
|
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": "12.2.0-next.
|
|
14
|
+
"@pie-lib/config-ui": "12.2.0-next.17",
|
|
15
15
|
"@pie-lib/drag": "3.2.0-next.4",
|
|
16
|
-
"@pie-lib/editable-html-tip-tap": "1.2.0-next.
|
|
16
|
+
"@pie-lib/editable-html-tip-tap": "1.2.0-next.16",
|
|
17
17
|
"@pie-lib/render-ui": "5.2.0-next.4",
|
|
18
18
|
"debug": "^4.1.1",
|
|
19
19
|
"lodash-es": "^4.17.23",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [10.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-controller@10.1.1-next.1...@pie-element/placement-ordering-controller@10.2.0-next.0) (2026-03-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- tests ([bcea404](https://github.com/pie-framework/pie-elements/commit/bcea40428ae344270edf703186cbe83b85b1ead2))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **placement-ordering:** add scoring trace in outcome function PD-5459 ([ddaeeea](https://github.com/pie-framework/pie-elements/commit/ddaeeea858dde5a462225798bdca4acc90cd7a39))
|
|
15
|
+
|
|
6
16
|
## [10.1.1-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-controller@10.1.0-next.2...@pie-element/placement-ordering-controller@10.1.1-next.1) (2026-02-26)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @pie-element/placement-ordering-controller
|
package/controller/lib/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.createCorrectResponseSession = void 0;
|
|
8
8
|
exports.createDefaultModel = createDefaultModel;
|
|
9
|
+
exports.getLogTrace = void 0;
|
|
9
10
|
exports.model = model;
|
|
10
11
|
exports.normalize = void 0;
|
|
11
12
|
exports.outcome = outcome;
|
|
@@ -22,14 +23,84 @@ const {
|
|
|
22
23
|
translator
|
|
23
24
|
} = _translator.default;
|
|
24
25
|
const questionError = () => new Error('Question is missing required array: correctResponse');
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Generates detailed trace log for placement-ordering scoring evaluation
|
|
29
|
+
* @param {Object} question - the question model
|
|
30
|
+
* @param {Object} session - the student session
|
|
31
|
+
* @param {Object} env - the environment
|
|
32
|
+
* @returns {Array<string>} traceLog
|
|
33
|
+
*/
|
|
25
34
|
exports.questionError = questionError;
|
|
35
|
+
const getLogTrace = (question, session, env) => {
|
|
36
|
+
const traceLog = [];
|
|
37
|
+
const value = session?.value || [];
|
|
38
|
+
const correctResponse = question?.correctResponse || [];
|
|
39
|
+
const hasPlacementArea = question?.placementArea === true;
|
|
40
|
+
if (!value.length) {
|
|
41
|
+
if (hasPlacementArea) {
|
|
42
|
+
traceLog.push('Student did not place any tiles in the target area.');
|
|
43
|
+
} else {
|
|
44
|
+
traceLog.push('Student did not reorder any tiles.');
|
|
45
|
+
}
|
|
46
|
+
traceLog.push('Final score: 0.');
|
|
47
|
+
return traceLog;
|
|
48
|
+
}
|
|
49
|
+
const allCorrectResponses = (0, _scoring.getAllCorrectResponses)(question);
|
|
50
|
+
let bestMatch = {
|
|
51
|
+
score: 0,
|
|
52
|
+
response: []
|
|
53
|
+
};
|
|
54
|
+
allCorrectResponses.forEach(cr => {
|
|
55
|
+
let matchCount = 0;
|
|
56
|
+
value.forEach((v, idx) => {
|
|
57
|
+
if (cr[idx] === v) {
|
|
58
|
+
matchCount++;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
if (matchCount > bestMatch.score) {
|
|
62
|
+
bestMatch = {
|
|
63
|
+
score: matchCount,
|
|
64
|
+
response: cr
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const correctCount = bestMatch.score;
|
|
69
|
+
const incorrectCount = value.length - correctCount;
|
|
70
|
+
if (correctCount > 0) {
|
|
71
|
+
traceLog.push(`${correctCount} tile(s) placed in the correct order.`);
|
|
72
|
+
}
|
|
73
|
+
if (incorrectCount > 0) {
|
|
74
|
+
traceLog.push(`${incorrectCount} tile(s) placed in an incorrect order.`);
|
|
75
|
+
}
|
|
76
|
+
const isFullyCorrect = allCorrectResponses.some(cr => (0, _lodashEs.isEqual)(cr, value));
|
|
77
|
+
const partialScoringEnabled = _controllerUtils.partialScoring.enabled(question, env || {});
|
|
78
|
+
if (partialScoringEnabled) {
|
|
79
|
+
traceLog.push('Score calculated using partial scoring.');
|
|
80
|
+
traceLog.push('Each tile placed in the correct position contributes to the score.');
|
|
81
|
+
} else {
|
|
82
|
+
traceLog.push('Score calculated using all-or-nothing scoring.');
|
|
83
|
+
if (hasPlacementArea) {
|
|
84
|
+
traceLog.push('Student must place all tiles in the correct positions within the target area to receive full credit.');
|
|
85
|
+
} else {
|
|
86
|
+
traceLog.push('Student must arrange all tiles in the correct order to receive full credit.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const rawScore = (0, _scoring.score)(question, session);
|
|
90
|
+
const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;
|
|
91
|
+
traceLog.push(`Final score: ${finalScore}.`);
|
|
92
|
+
return traceLog;
|
|
93
|
+
};
|
|
94
|
+
exports.getLogTrace = getLogTrace;
|
|
26
95
|
function outcome(question, session, env) {
|
|
27
96
|
return new Promise((resolve, reject) => {
|
|
28
97
|
if (!session || (0, _lodashEs.isEmpty)(session)) {
|
|
29
98
|
resolve({
|
|
30
99
|
score: 0,
|
|
31
|
-
empty: true
|
|
100
|
+
empty: true,
|
|
101
|
+
logTrace: ['Student did not interact with the placement-ordering item.']
|
|
32
102
|
});
|
|
103
|
+
return;
|
|
33
104
|
}
|
|
34
105
|
if (!question || !question.correctResponse || (0, _lodashEs.isEmpty)(question.correctResponse)) {
|
|
35
106
|
reject(questionError());
|
|
@@ -38,7 +109,8 @@ function outcome(question, session, env) {
|
|
|
38
109
|
const s = (0, _scoring.score)(question, session);
|
|
39
110
|
const finalScore = _controllerUtils.partialScoring.enabled(question, env || {}) ? s : s === 1 ? 1 : 0;
|
|
40
111
|
resolve({
|
|
41
|
-
score: finalScore
|
|
112
|
+
score: finalScore,
|
|
113
|
+
logTrace: getLogTrace(question, session, env)
|
|
42
114
|
});
|
|
43
115
|
} catch (e) {
|
|
44
116
|
reject(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_scoring","require","_lodashEs","_feedback","_controllerUtils","_debug","_interopRequireDefault","_defaults","_translator","log","debug","translator","Translator","questionError","Error","exports","outcome","question","session","env","Promise","resolve","reject","isEmpty","score","empty","correctResponse","s","finalScore","partialScoring","enabled","e","createDefaultModel","model","defaults","normalize","rationaleEnabled","feedbackEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","normalizedQuestion","base","alternateResponses","every","isArray","console","error","extraCSSRules","outcomes","completeLength","length","choices","filter","choice","label","note","showNote","language","prompt","config","orientation","includeTargets","placementArea","choiceLabelEnabled","targetLabel","choiceLabel","showOrdering","numberedGuides","allowSameChoiceInTargets","removeTilesAfterPlacing","disabled","mode","t","lng","role","rationale","teacherInstructions","value","allCorrectResponses","getAllCorrectResponses","bestSetOfResponses","reduce","info","cr","currentScore","acc","c","idx","Array","arr","map","id","isResponseCorrect","some","response","isEqual","responseScore","isCorrect","isPartialCorrect","correctness","flattenCorrect","feedback","getFeedbackForCorrectness","undefined","createCorrectResponseSession","getInnerText","html","replaceAll","getContent","replace","validate","errors","forEach","field","required","reversedChoices","reverse","choicesErrors","index","identicalAnswer","slice","choicesIds","correctResponseIds","orderError"],"sources":["../src/index.js"],"sourcesContent":["import { flattenCorrect, getAllCorrectResponses, score } from './scoring';\n\nimport { every, isArray, isEmpty, isEqual, map, reduce } from 'lodash-es';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport debug from 'debug';\n\nimport defaults from './defaults';\n\nconst log = debug('@pie-element:placement-ordering:controller');\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nexport const questionError = () => new Error('Question is missing required array: correctResponse');\n\nexport function outcome(question, session, env) {\n return new Promise((resolve, reject) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n }\n\n if (!question || !question.correctResponse || isEmpty(question.correctResponse)) {\n reject(questionError());\n } else {\n try {\n const s = score(question, session);\n const finalScore = partialScoring.enabled(question, env || {}) ? s : s === 1 ? 1 : 0;\n resolve({\n score: finalScore,\n });\n } catch (e) {\n reject(e);\n }\n }\n });\n}\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n}\n\nexport const normalize = (question) => ({\n ...defaults,\n rationaleEnabled: true,\n feedbackEnabled: false,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const base = {};\n\n if (question.alternateResponses && every(question.alternateResponses, isArray)) {\n log('Deprecated structure of alternateResponses is in use');\n // eslint-disable-next-line no-console\n console.error('Deprecated structure of alternateResponses is in use');\n }\n\n base.env = env;\n base.extraCSSRules = normalizedQuestion.extraCSSRules;\n base.outcomes = [];\n base.completeLength = (normalizedQuestion.correctResponse || []).length;\n base.choices = (normalizedQuestion.choices || []).filter((choice) => choice.label);\n base.note = normalizedQuestion.note;\n base.showNote = normalizedQuestion.alternateResponses && normalizedQuestion.alternateResponses.length > 0;\n base.language = normalizedQuestion.language;\n\n log('[model] removing tileSize for the moment.');\n\n base.prompt = normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null;\n base.config = {\n orientation: normalizedQuestion.orientation || 'vertical',\n includeTargets: normalizedQuestion.placementArea,\n choiceLabelEnabled: normalizedQuestion.choiceLabelEnabled,\n targetLabel: normalizedQuestion.targetLabel,\n choiceLabel: normalizedQuestion.choiceLabel,\n showOrdering: normalizedQuestion.numberedGuides,\n allowSameChoiceInTargets: !normalizedQuestion.removeTilesAfterPlacing,\n };\n\n base.disabled = env.mode !== 'gather';\n\n if (!base.note) {\n base.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: normalizedQuestion.language });\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n base.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n if (env.mode === 'evaluate') {\n const value = (session && session.value) || [];\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n\n const bestSetOfResponses = allCorrectResponses.reduce(\n (info, cr) => {\n const currentScore = reduce(value, (acc, c, idx) => acc + (Array.isArray(cr) && cr[idx] === c ? 1 : 0), 0);\n\n if (currentScore > info.score) {\n return {\n arr: cr,\n score: currentScore,\n };\n }\n\n return info;\n },\n { arr: [], score: 0 },\n );\n\n base.outcomes = map(value, (c, idx) => {\n return {\n id: c,\n outcome: bestSetOfResponses.arr[idx] === c ? 'correct' : 'incorrect',\n };\n });\n\n const isResponseCorrect = allCorrectResponses.some((response) => isEqual(response, value));\n const responseScore = score(question, session);\n const isCorrect = responseScore === 1;\n const isPartialCorrect = !isCorrect && partialScoring.enabled(normalizedQuestion, env || {}) && responseScore !== 0;\n\n base.correctness = isCorrect ? 'correct' : isPartialCorrect ? 'partial' : 'incorrect';\n\n if (!isResponseCorrect) {\n base.correctResponse = flattenCorrect(normalizedQuestion);\n }\n\n // requirement made in PD-2182\n if (!normalizedQuestion.feedback) {\n normalizedQuestion.feedbackEnabled = false;\n }\n\n const feedback = normalizedQuestion.feedbackEnabled\n ? await getFeedbackForCorrectness(base.correctness, normalizedQuestion.feedback)\n : undefined;\n\n base.feedback = feedback;\n return base;\n } else {\n return base;\n }\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({\n id: '1',\n value: flattenCorrect(question),\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, correctResponse } = model;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const reversedChoices = [...(choices || [])].reverse();\n const choicesErrors = {};\n\n reversedChoices.forEach((choice, index) => {\n const { id, label } = choice;\n\n if (!getContent(label)) {\n choicesErrors[id] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[id] = 'Content should be unique.';\n }\n }\n });\n\n const choicesIds = (choices || []).map((choice) => choice.id);\n const correctResponseIds = (correctResponse || []).map((response) => response.id || response);\n\n if (isEqual(choicesIds, correctResponseIds)) {\n errors.orderError = 'The correct ordering should not be identical to the initial ordering.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AAEA,IAAAM,SAAA,GAAAD,sBAAA,CAAAL,OAAA;AAGA,IAAAO,WAAA,GAAAF,sBAAA,CAAAL,OAAA;AADA,MAAMQ,GAAG,GAAG,IAAAC,cAAK,EAAC,4CAA4C,CAAC;AAG/D,MAAM;EAAEC;AAAW,CA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M8B,UAAU,GAAG,CAACtE,OAAO,IAAI,EAAE,EAAEuC,GAAG,CAAErC,MAAM,IAAKA,MAAM,CAACsC,EAAE,CAAC;EAC7D,MAAM+B,kBAAkB,GAAG,CAACjG,eAAe,IAAI,EAAE,EAAEiE,GAAG,CAAEI,QAAQ,IAAKA,QAAQ,CAACH,EAAE,IAAIG,QAAQ,CAAC;EAE7F,IAAI,IAAAC,iBAAO,EAAC0B,UAAU,EAAEC,kBAAkB,CAAC,EAAE;IAC3CX,MAAM,CAACY,UAAU,GAAG,uEAAuE;EAC7F;EAEA,IAAI,CAAC,IAAArG,iBAAO,EAAC+F,aAAa,CAAC,EAAE;IAC3BN,MAAM,CAACM,aAAa,GAAGA,aAAa;EACtC;EAEA,OAAON,MAAM;AACf,CAAC;AAACjG,OAAA,CAAAgG,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_scoring","require","_lodashEs","_feedback","_controllerUtils","_debug","_interopRequireDefault","_defaults","_translator","log","debug","translator","Translator","questionError","Error","exports","getLogTrace","question","session","env","traceLog","value","correctResponse","hasPlacementArea","placementArea","length","push","allCorrectResponses","getAllCorrectResponses","bestMatch","score","response","forEach","cr","matchCount","v","idx","correctCount","incorrectCount","isFullyCorrect","some","isEqual","partialScoringEnabled","partialScoring","enabled","rawScore","finalScore","outcome","Promise","resolve","reject","isEmpty","empty","logTrace","s","e","createDefaultModel","model","defaults","normalize","rationaleEnabled","feedbackEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","normalizedQuestion","base","alternateResponses","every","isArray","console","error","extraCSSRules","outcomes","completeLength","choices","filter","choice","label","note","showNote","language","prompt","config","orientation","includeTargets","choiceLabelEnabled","targetLabel","choiceLabel","showOrdering","numberedGuides","allowSameChoiceInTargets","removeTilesAfterPlacing","disabled","mode","t","lng","role","rationale","teacherInstructions","bestSetOfResponses","reduce","info","currentScore","acc","c","Array","arr","map","id","isResponseCorrect","responseScore","isCorrect","isPartialCorrect","correctness","flattenCorrect","feedback","getFeedbackForCorrectness","undefined","createCorrectResponseSession","getInnerText","html","replaceAll","getContent","replace","validate","errors","field","required","reversedChoices","reverse","choicesErrors","index","identicalAnswer","slice","choicesIds","correctResponseIds","orderError"],"sources":["../src/index.js"],"sourcesContent":["import { flattenCorrect, getAllCorrectResponses, score } from './scoring';\n\nimport { every, isArray, isEmpty, isEqual, map, reduce } from 'lodash-es';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport debug from 'debug';\n\nimport defaults from './defaults';\n\nconst log = debug('@pie-element:placement-ordering:controller');\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nexport const questionError = () => new Error('Question is missing required array: correctResponse');\n\n/**\n * Generates detailed trace log for placement-ordering scoring evaluation\n * @param {Object} question - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array<string>} traceLog\n */\nexport const getLogTrace = (question, session, env) => {\n const traceLog = [];\n\n const value = session?.value || [];\n const correctResponse = question?.correctResponse || [];\n const hasPlacementArea = question?.placementArea === true;\n\n if (!value.length) {\n if (hasPlacementArea) {\n traceLog.push('Student did not place any tiles in the target area.');\n } else {\n traceLog.push('Student did not reorder any tiles.');\n }\n traceLog.push('Final score: 0.');\n return traceLog;\n }\n\n const allCorrectResponses = getAllCorrectResponses(question);\n\n let bestMatch = { score: 0, response: [] };\n\n allCorrectResponses.forEach((cr) => {\n let matchCount = 0;\n value.forEach((v, idx) => {\n if (cr[idx] === v) {\n matchCount++;\n }\n });\n\n if (matchCount > bestMatch.score) {\n bestMatch = { score: matchCount, response: cr };\n }\n });\n\n const correctCount = bestMatch.score;\n const incorrectCount = value.length - correctCount;\n\n if (correctCount > 0) {\n traceLog.push(`${correctCount} tile(s) placed in the correct order.`);\n }\n\n if (incorrectCount > 0) {\n traceLog.push(`${incorrectCount} tile(s) placed in an incorrect order.`);\n }\n\n const isFullyCorrect = allCorrectResponses.some((cr) => isEqual(cr, value));\n\n const partialScoringEnabled = partialScoring.enabled(question, env || {});\n\n if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n traceLog.push(\n 'Each tile placed in the correct position contributes to the score.',\n );\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n if (hasPlacementArea) {\n traceLog.push(\n 'Student must place all tiles in the correct positions within the target area to receive full credit.',\n );\n } else {\n traceLog.push(\n 'Student must arrange all tiles in the correct order to receive full credit.',\n );\n }\n }\n\n const rawScore = score(question, session);\n const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;\n\n traceLog.push(`Final score: ${finalScore}.`);\n\n return traceLog;\n};\n\nexport function outcome(question, session, env) {\n return new Promise((resolve, reject) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n logTrace: ['Student did not interact with the placement-ordering item.'] \n });\n return;\n }\n\n if (!question || !question.correctResponse || isEmpty(question.correctResponse)) {\n reject(questionError());\n } else {\n try {\n const s = score(question, session);\n const finalScore = partialScoring.enabled(question, env || {}) ? s : s === 1 ? 1 : 0;\n resolve({\n score: finalScore,\n logTrace: getLogTrace(question, session, env)\n });\n } catch (e) {\n reject(e);\n }\n }\n });\n}\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n}\n\nexport const normalize = (question) => ({\n ...defaults,\n rationaleEnabled: true,\n feedbackEnabled: false,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const base = {};\n\n if (question.alternateResponses && every(question.alternateResponses, isArray)) {\n log('Deprecated structure of alternateResponses is in use');\n // eslint-disable-next-line no-console\n console.error('Deprecated structure of alternateResponses is in use');\n }\n\n base.env = env;\n base.extraCSSRules = normalizedQuestion.extraCSSRules;\n base.outcomes = [];\n base.completeLength = (normalizedQuestion.correctResponse || []).length;\n base.choices = (normalizedQuestion.choices || []).filter((choice) => choice.label);\n base.note = normalizedQuestion.note;\n base.showNote = normalizedQuestion.alternateResponses && normalizedQuestion.alternateResponses.length > 0;\n base.language = normalizedQuestion.language;\n\n log('[model] removing tileSize for the moment.');\n\n base.prompt = normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null;\n base.config = {\n orientation: normalizedQuestion.orientation || 'vertical',\n includeTargets: normalizedQuestion.placementArea,\n choiceLabelEnabled: normalizedQuestion.choiceLabelEnabled,\n targetLabel: normalizedQuestion.targetLabel,\n choiceLabel: normalizedQuestion.choiceLabel,\n showOrdering: normalizedQuestion.numberedGuides,\n allowSameChoiceInTargets: !normalizedQuestion.removeTilesAfterPlacing,\n };\n\n base.disabled = env.mode !== 'gather';\n\n if (!base.note) {\n base.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: normalizedQuestion.language });\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n base.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n if (env.mode === 'evaluate') {\n const value = (session && session.value) || [];\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n\n const bestSetOfResponses = allCorrectResponses.reduce(\n (info, cr) => {\n const currentScore = reduce(value, (acc, c, idx) => acc + (Array.isArray(cr) && cr[idx] === c ? 1 : 0), 0);\n\n if (currentScore > info.score) {\n return {\n arr: cr,\n score: currentScore,\n };\n }\n\n return info;\n },\n { arr: [], score: 0 },\n );\n\n base.outcomes = map(value, (c, idx) => {\n return {\n id: c,\n outcome: bestSetOfResponses.arr[idx] === c ? 'correct' : 'incorrect',\n };\n });\n\n const isResponseCorrect = allCorrectResponses.some((response) => isEqual(response, value));\n const responseScore = score(question, session);\n const isCorrect = responseScore === 1;\n const isPartialCorrect = !isCorrect && partialScoring.enabled(normalizedQuestion, env || {}) && responseScore !== 0;\n\n base.correctness = isCorrect ? 'correct' : isPartialCorrect ? 'partial' : 'incorrect';\n\n if (!isResponseCorrect) {\n base.correctResponse = flattenCorrect(normalizedQuestion);\n }\n\n // requirement made in PD-2182\n if (!normalizedQuestion.feedback) {\n normalizedQuestion.feedbackEnabled = false;\n }\n\n const feedback = normalizedQuestion.feedbackEnabled\n ? await getFeedbackForCorrectness(base.correctness, normalizedQuestion.feedback)\n : undefined;\n\n base.feedback = feedback;\n return base;\n } else {\n return base;\n }\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({\n id: '1',\n value: flattenCorrect(question),\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, correctResponse } = model;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const reversedChoices = [...(choices || [])].reverse();\n const choicesErrors = {};\n\n reversedChoices.forEach((choice, index) => {\n const { id, label } = choice;\n\n if (!getContent(label)) {\n choicesErrors[id] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[id] = 'Content should be unique.';\n }\n }\n });\n\n const choicesIds = (choices || []).map((choice) => choice.id);\n const correctResponseIds = (correctResponse || []).map((response) => response.id || response);\n\n if (isEqual(choicesIds, correctResponseIds)) {\n errors.orderError = 'The correct ordering should not be identical to the initial ordering.';\n }\n\n if (!is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;IACzC,MAAM;MAAEvB,EAAE;MAAE/B;IAAM,CAAC,GAAGD,MAAM;IAE5B,IAAI,CAAC8C,UAAU,CAAC7C,KAAK,CAAC,EAAE;MACtBqD,aAAa,CAACtB,EAAE,CAAC,GAAG,8BAA8B;IACpD,CAAC,MAAM;MACL,MAAMwB,eAAe,GAAGJ,eAAe,CAACK,KAAK,CAACF,KAAK,GAAG,CAAC,CAAC,CAAC5F,IAAI,CAAEiE,CAAC,IAAKA,CAAC,CAAC3B,KAAK,KAAKA,KAAK,CAAC;MAEvF,IAAIuD,eAAe,EAAE;QACnBF,aAAa,CAACtB,EAAE,CAAC,GAAG,2BAA2B;MACjD;IACF;EACF,CAAC,CAAC;EAEF,MAAM0B,UAAU,GAAG,CAAC5D,OAAO,IAAI,EAAE,EAAEiC,GAAG,CAAE/B,MAAM,IAAKA,MAAM,CAACgC,EAAE,CAAC;EAC7D,MAAM2B,kBAAkB,GAAG,CAAClH,eAAe,IAAI,EAAE,EAAEsF,GAAG,CAAE7E,QAAQ,IAAKA,QAAQ,CAAC8E,EAAE,IAAI9E,QAAQ,CAAC;EAE7F,IAAI,IAAAU,iBAAO,EAAC8F,UAAU,EAAEC,kBAAkB,CAAC,EAAE;IAC3CV,MAAM,CAACW,UAAU,GAAG,uEAAuE;EAC7F;EAEA,IAAI,CAAC,IAAAtF,iBAAO,EAACgF,aAAa,CAAC,EAAE;IAC3BL,MAAM,CAACK,aAAa,GAAGA,aAAa;EACtC;EAEA,OAAOL,MAAM;AACf,CAAC;AAAC/G,OAAA,CAAA8G,QAAA,GAAAA,QAAA","ignoreList":[]}
|
package/controller/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/placement-ordering",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.2.0-next.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"author": "",
|
|
30
30
|
"license": "ISC",
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "5052ddbf1c97a5a414330a25b453455ae56977e9",
|
|
32
32
|
"scripts": {
|
|
33
33
|
"postpublish": "../../scripts/postpublish"
|
|
34
34
|
},
|