@pie-element/categorize 12.1.2-next.4 → 12.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 CHANGED
@@ -3,6 +3,20 @@
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
+ # [12.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@12.1.2-next.5...@pie-element/categorize@12.2.0-next.0) (2026-03-18)
7
+
8
+ ### Features
9
+
10
+ - **categorize:** add trace log for scoring in outcome function PD-5438 ([53200b5](https://github.com/pie-framework/pie-elements/commit/53200b58af33e81808f6626acbec9e14e631a71d))
11
+
12
+ ## [12.1.2-next.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@12.1.2-next.4...@pie-element/categorize@12.1.2-next.5) (2026-03-12)
13
+
14
+ ### Bug Fixes
15
+
16
+ - 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))
17
+ - bump libs, update mathquill, switch interface PD-5791 ([686a7c0](https://github.com/pie-framework/pie-elements/commit/686a7c0d41ff82f5ddad7cecd93cc0c18324a81b))
18
+ - **categorize:** add missing prop validation ([847df67](https://github.com/pie-framework/pie-elements/commit/847df67bf234bbecb5c5f17f29d84bdd25c2e0d5))
19
+
6
20
  ## [12.1.2-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@12.1.2-next.3...@pie-element/categorize@12.1.2-next.4) (2026-03-09)
7
21
 
8
22
  ### Bug Fixes
@@ -3,6 +3,13 @@
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/categorize-configure@10.1.1-next.3...@pie-element/categorize-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
+
6
13
  ## [10.1.1-next.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-configure@10.1.1-next.2...@pie-element/categorize-configure@10.1.1-next.3) (2026-03-06)
7
14
 
8
15
  **Note:** Version bump only for package @pie-element/categorize-configure
@@ -15,7 +15,8 @@ var _RemoveCircleOutline = _interopRequireDefault(require("@mui/icons-material/R
15
15
  var _renderUi = require("@pie-lib/render-ui");
16
16
  const ChoicePreviewContainer = (0, _styles.styled)('div')({
17
17
  position: 'relative',
18
- overflow: 'auto'
18
+ overflow: 'auto',
19
+ touchAction: 'none'
19
20
  });
20
21
  const DeleteIconButton = (0, _styles.styled)(_IconButton.default)({
21
22
  position: 'absolute',
@@ -1 +1 @@
1
- {"version":3,"file":"choice-preview.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_drag","_IconButton","_RemoveCircleOutline","_renderUi","ChoicePreviewContainer","styled","position","overflow","DeleteIconButton","IconButton","right","top","color","tertiary","ChoicePreview","React","Component","constructor","args","_defineProperty2","default","onDelete","choice","props","render","alternateResponseIndex","category","choiceIndex","categoryId","id","uniqueId","undefined","createElement","DraggableChoice","onRemoveChoice","delete","type","HtmlAndMath","html","content","onClick","size","exports","PropTypes","number","object","isRequired","func","_default"],"sources":["../../../src/design/categories/choice-preview.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { DraggableChoice } from '@pie-lib/drag';\nimport IconButton from '@mui/material/IconButton';\nimport RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline';\nimport { HtmlAndMath } from '@pie-lib/render-ui';\nimport { color } from '@pie-lib/render-ui';\n\nconst ChoicePreviewContainer = styled('div')({\n position: 'relative',\n overflow: 'auto',\n});\n\nconst DeleteIconButton = styled(IconButton)({\n position: 'absolute',\n right: 0,\n top: 0,\n color: `${color.tertiary()} !important`,\n});\n\nexport class ChoicePreview extends React.Component {\n static propTypes = {\n alternateResponseIndex: PropTypes.number,\n category: PropTypes.object,\n choice: PropTypes.object.isRequired,\n choiceIndex: PropTypes.number,\n onDelete: PropTypes.func,\n };\n static defaultProps = {\n onDelete: () => {},\n };\n\n delete = () => {\n const { onDelete, choice } = this.props;\n onDelete(choice);\n };\n\n render() {\n const { alternateResponseIndex, category, choice, choiceIndex } = this.props;\n\n // Generate unique ID for each instance to distinguish multiple instances of the same choice\n const categoryId = category && category.id;\n const uniqueId =\n alternateResponseIndex !== undefined\n ? `${choice.id}-${categoryId}-${choiceIndex}-alt-${alternateResponseIndex}`\n : `${choice.id}-${categoryId}-${choiceIndex}`;\n\n return (\n <ChoicePreviewContainer>\n {choice ? (\n <DraggableChoice\n alternateResponseIndex={alternateResponseIndex}\n category={category}\n choice={choice}\n choiceIndex={choiceIndex}\n onRemoveChoice={this.delete}\n type={'choice-preview'}\n id={uniqueId}\n categoryId={categoryId}\n >\n <HtmlAndMath html={choice?.content} />\n </DraggableChoice>\n ) : null}\n <DeleteIconButton aria-label=\"delete\" onClick={this.delete} size=\"large\">\n <RemoveCircleOutlineIcon />\n </DeleteIconButton>\n </ChoicePreviewContainer>\n );\n }\n}\n\nexport default ChoicePreview;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,oBAAA,GAAAN,sBAAA,CAAAC,O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,QAAS;MACnBJ,MAAM,EAAEA,MAAO;MACfK,WAAW,EAAEA,WAAY;MACzBO,cAAc,EAAE,IAAI,CAACC,MAAO;MAC5BC,IAAI,EAAE,gBAAiB;MACvBP,EAAE,EAAEC,QAAS;MACbF,UAAU,EAAEA;IAAW,gBAEvBjC,MAAA,CAAAyB,OAAA,CAAAY,aAAA,CAAC7B,SAAA,CAAAkC,WAAW;MAACC,IAAI,EAAEhB,MAAM,EAAEiB;IAAQ,CAAE,CACtB,CAAC,GAChB,IAAI,eACR5C,MAAA,CAAAyB,OAAA,CAAAY,aAAA,CAACxB,gBAAgB;MAAC,cAAW,QAAQ;MAACgC,OAAO,EAAE,IAAI,CAACL,MAAO;MAACM,IAAI,EAAC;IAAO,gBACtE9C,MAAA,CAAAyB,OAAA,CAAAY,aAAA,CAAC9B,oBAAA,CAAAkB,OAAuB,MAAE,CACV,CACI,CAAC;EAE7B;AACF;AAACsB,OAAA,CAAA5B,aAAA,GAAAA,aAAA;AAAA,IAAAK,gBAAA,CAAAC,OAAA,EAjDYN,aAAa,eACL;EACjBW,sBAAsB,EAAEkB,kBAAS,CAACC,MAAM;EACxClB,QAAQ,EAAEiB,kBAAS,CAACE,MAAM;EAC1BvB,MAAM,EAAEqB,kBAAS,CAACE,MAAM,CAACC,UAAU;EACnCnB,WAAW,EAAEgB,kBAAS,CAACC,MAAM;EAC7BvB,QAAQ,EAAEsB,kBAAS,CAACI;AACtB,CAAC;AAAA,IAAA5B,gBAAA,CAAAC,OAAA,EAPUN,aAAa,kBAQF;EACpBO,QAAQ,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC;AAAA,IAAA2B,QAAA,GAAAN,OAAA,CAAAtB,OAAA,GAyCYN,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"choice-preview.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_drag","_IconButton","_RemoveCircleOutline","_renderUi","ChoicePreviewContainer","styled","position","overflow","touchAction","DeleteIconButton","IconButton","right","top","color","tertiary","ChoicePreview","React","Component","constructor","args","_defineProperty2","default","onDelete","choice","props","render","alternateResponseIndex","category","choiceIndex","categoryId","id","uniqueId","undefined","createElement","DraggableChoice","onRemoveChoice","delete","type","HtmlAndMath","html","content","onClick","size","exports","PropTypes","number","object","isRequired","func","_default"],"sources":["../../../src/design/categories/choice-preview.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { DraggableChoice } from '@pie-lib/drag';\nimport IconButton from '@mui/material/IconButton';\nimport RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline';\nimport { HtmlAndMath } from '@pie-lib/render-ui';\nimport { color } from '@pie-lib/render-ui';\n\nconst ChoicePreviewContainer = styled('div')({\n position: 'relative',\n overflow: 'auto',\n touchAction: 'none',\n});\n\nconst DeleteIconButton = styled(IconButton)({\n position: 'absolute',\n right: 0,\n top: 0,\n color: `${color.tertiary()} !important`,\n});\n\nexport class ChoicePreview extends React.Component {\n static propTypes = {\n alternateResponseIndex: PropTypes.number,\n category: PropTypes.object,\n choice: PropTypes.object.isRequired,\n choiceIndex: PropTypes.number,\n onDelete: PropTypes.func,\n };\n static defaultProps = {\n onDelete: () => {},\n };\n\n delete = () => {\n const { onDelete, choice } = this.props;\n onDelete(choice);\n };\n\n render() {\n const { alternateResponseIndex, category, choice, choiceIndex } = this.props;\n\n // Generate unique ID for each instance to distinguish multiple instances of the same choice\n const categoryId = category && category.id;\n const uniqueId =\n alternateResponseIndex !== undefined\n ? `${choice.id}-${categoryId}-${choiceIndex}-alt-${alternateResponseIndex}`\n : `${choice.id}-${categoryId}-${choiceIndex}`;\n\n return (\n <ChoicePreviewContainer>\n {choice ? (\n <DraggableChoice\n alternateResponseIndex={alternateResponseIndex}\n category={category}\n choice={choice}\n choiceIndex={choiceIndex}\n onRemoveChoice={this.delete}\n type={'choice-preview'}\n id={uniqueId}\n categoryId={categoryId}\n >\n <HtmlAndMath html={choice?.content} />\n </DraggableChoice>\n ) : null}\n <DeleteIconButton aria-label=\"delete\" onClick={this.delete} size=\"large\">\n <RemoveCircleOutlineIcon />\n </DeleteIconButton>\n </ChoicePreviewContainer>\n );\n }\n}\n\nexport default ChoicePreview;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,oBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAGA,MAAMO,sBAAsB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EAC3CC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,MAAM;EAChBC,WAAW,EAAE;AACf,CAAC,CAAC;AAEF,MAAMC,gBAAgB,GAAG,IAAAJ,cAAM,EAACK,mBAAU,CAAC,CAAC;EAC1CJ,QAAQ,EAAE,UAAU;EACpBK,KAAK,EAAE,CAAC;EACRC,GAAG,EAAE,CAAC;EACNC,KAAK,EAAE,GAAGA,eAAK,CAACC,QAAQ,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEK,MAAMC,aAAa,SAASC,cAAK,CAACC,SAAS,CAAC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,kBAYxC,MAAM;MACb,MAAM;QAAEC,QAAQ;QAAEC;MAAO,CAAC,GAAG,IAAI,CAACC,KAAK;MACvCF,QAAQ,CAACC,MAAM,CAAC;IAClB,CAAC;EAAA;EAEDE,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,sBAAsB;MAAEC,QAAQ;MAAEJ,MAAM;MAAEK;IAAY,CAAC,GAAG,IAAI,CAACJ,KAAK;;IAE5E;IACA,MAAMK,UAAU,GAAGF,Q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B,WAAW,EAAEgB,kBAAS,CAACC,MAAM;EAC7BvB,QAAQ,EAAEsB,kBAAS,CAACI;AACtB,CAAC;AAAA,IAAA5B,gBAAA,CAAAC,OAAA,EAPUN,aAAa,kBAQF;EACpBO,QAAQ,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC;AAAA,IAAA2B,QAAA,GAAAN,OAAA,CAAAtB,OAAA,GAyCYN,aAAa","ignoreList":[]}
@@ -47,7 +47,8 @@ const DragHandleContainer = (0, _styles.styled)('span', {
47
47
  })(({
48
48
  draggable
49
49
  }) => ({
50
- cursor: draggable ? 'move' : 'inherit'
50
+ cursor: draggable ? 'move' : 'inherit',
51
+ touchAction: 'none'
51
52
  }));
52
53
  const ErrorText = (0, _styles.styled)('div')(({
53
54
  theme
@@ -1 +1 @@
1
- {"version":3,"file":"choice.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_Card","_CardActions","_inputHeader","_configUi","_buttons","_DragHandle","_core","_debug","_drag","_utils","log","debug","canDrag","props","lockChoiceOrder","count","choice","categoryCount","correctResponseCount","StyledCard","styled","Card","theme","minWidth","padding","spacing","overflow","StyledCardActions","CardActions","justifyContent","DragHandleContainer","shouldForwardProp","prop","draggable","cursor","ErrorText","fontSize","typography","color","palette","error","main","paddingBottom","Choice","allowMultiplePlacements","configuration","deleteFocusedEl","focusedEl","index","onDelete","onChange","imageSupport","spellCheck","toolbarOpts","maxImageWidth","maxImageHeight","uploadSoundSupport","attributes","dragAttributes","listeners","dragListeners","setNodeRef","setDragNodeRef","isDragging","useDraggable","id","data","type","disabled","setDropNodeRef","useDroppable","changeContent","content","changeCategoryCount","isCheckboxShown","multiplePlacements","perChoice","showRemoveAfterPlacing","element","default","createElement","ref","style","opacity","_extends2","label","DeleteButton","onClick","Checkbox","mini","checked","propTypes","PropTypes","string","object","isRequired","func","number","bool","shape","add","delete","rearrangeChoices","_default","exports","uid","withUid"],"sources":["../../../src/design/choices/choice.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport Card from '@mui/material/Card';\nimport CardActions from '@mui/material/CardActions';\nimport InputHeader from '../input-header';\nimport { Checkbox } from '@pie-lib/config-ui';\nimport { DeleteButton } from '../buttons';\nimport DragHandle from '@mui/icons-material/DragHandle';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport debug from 'debug';\nimport { uid } from '@pie-lib/drag';\nimport { multiplePlacements } from '../../utils';\n\nconst log = debug('@pie-element:categorize:configure:choice');\n\nconst canDrag = (props) => {\n if (props.lockChoiceOrder) {\n return true;\n }\n const count = props.choice.categoryCount || 0;\n if (count === 0) {\n return true;\n } else {\n return props.correctResponseCount < count;\n }\n};\n\nconst StyledCard = styled(Card)(({ theme }) => ({\n minWidth: '196px',\n padding: theme.spacing(1),\n overflow: 'visible',\n}));\n\nconst StyledCardActions = styled(CardActions)({\n padding: 0,\n justifyContent: 'space-between',\n});\n\nconst DragHandleContainer = styled('span', {\n shouldForwardProp: (prop) => prop !== 'draggable',\n})(({ draggable }) => ({\n cursor: draggable ? 'move' : 'inherit',\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingBottom: theme.spacing(1),\n}));\n\nconst Choice = ({\n allowMultiplePlacements,\n configuration,\n choice,\n deleteFocusedEl,\n focusedEl,\n index,\n onDelete,\n onChange,\n correctResponseCount,\n lockChoiceOrder,\n imageSupport,\n spellCheck,\n toolbarOpts,\n error,\n maxImageWidth,\n maxImageHeight,\n uploadSoundSupport,\n}) => {\n const draggable = canDrag({ choice, correctResponseCount, lockChoiceOrder });\n\n const {\n attributes: dragAttributes,\n listeners: dragListeners,\n setNodeRef: setDragNodeRef,\n isDragging,\n } = useDraggable({\n id: `choice-${choice.id}`,\n data: {\n id: choice.id,\n index,\n type: 'choice',\n },\n disabled: !draggable,\n });\n\n const {\n setNodeRef: setDropNodeRef,\n } = useDroppable({\n id: `choice-drop-${choice.id}`,\n data: {\n id: choice.id,\n index,\n type: 'choice',\n },\n });\n\n const changeContent = (content) => {\n choice.content = content;\n onChange(choice);\n };\n\n const changeCategoryCount = () => {\n if (choice.categoryCount === 1) {\n choice.categoryCount = 0;\n } else {\n choice.categoryCount = 1;\n }\n onChange(choice);\n };\n\n const isCheckboxShown = (allowMultiplePlacements) => allowMultiplePlacements === multiplePlacements.perChoice;\n\n const showRemoveAfterPlacing = isCheckboxShown(allowMultiplePlacements);\n\n const setNodeRef = (element) => {\n setDragNodeRef(element);\n setDropNodeRef(element);\n };\n\n return (\n <StyledCard ref={setNodeRef} style={{ opacity: isDragging ? 0.5 : 1 }}>\n <StyledCardActions>\n <DragHandleContainer draggable={draggable} {...dragAttributes} {...dragListeners}>\n <DragHandle color={draggable ? 'primary' : 'disabled'} />\n </DragHandleContainer>\n </StyledCardActions>\n <InputHeader\n imageSupport={imageSupport}\n focusedEl={focusedEl}\n deleteFocusedEl={deleteFocusedEl}\n index={index}\n label={choice.content}\n onChange={changeContent}\n onDelete={onDelete}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n error={error}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n configuration={configuration}\n />\n {error && <ErrorText>{error}</ErrorText>}\n\n <StyledCardActions>\n <DeleteButton label={'delete'} onClick={onDelete} />\n {showRemoveAfterPlacing && (\n <Checkbox\n mini\n label={'Remove after placing'}\n checked={choice.categoryCount === 1}\n onChange={changeCategoryCount}\n />\n )}\n </StyledCardActions>\n </StyledCard>\n );\n};\n\nChoice.propTypes = {\n allowMultiplePlacements: PropTypes.string,\n configuration: PropTypes.object.isRequired,\n choice: PropTypes.object.isRequired,\n deleteFocusedEl: PropTypes.func,\n focusedEl: PropTypes.number,\n index: PropTypes.number,\n lockChoiceOrder: PropTypes.bool,\n maxImageHeight: PropTypes.object,\n maxImageWidth: PropTypes.object,\n onChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n correctResponseCount: PropTypes.number.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n toolbarOpts: PropTypes.object,\n error: PropTypes.string,\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n spellCheck: PropTypes.bool,\n rearrangeChoices: PropTypes.func,\n};\n\nexport default uid.withUid(Choice);\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,YAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAEA,MAAMa,GAAG,GAAG,IAAAC,cAAK,EAAC,0CAA0C,CAAC;AAE7D,MAAMC,OAAO,GAAIC,KAAK,IAAK;EACzB,IAAIA,KAAK,CAACC,eAAe,EAAE;IACzB,OAAO,IAAI;EACb;EACA,MAAMC,KAAK,GAAGF,KAAK,CAACG,MAAM,CAACC,aAAa,IAAI,CAAC;EAC7C,IAAIF,KAAK,KAAK,CAAC,EAAE;IACf,OAAO,IAAI;EACb,CAAC,MAAM;IACL,OAAOF,KAAK,CAACK,oBAAoB,GAAGH,KAAK;EAC3C;AACF,CAAC;AAED,MAAMI,UAAU,GAAG,IAAAC,cAAM,EAACC,aAAI,CAAC,CAAC,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zB,CAAC,CAAC;EACF3C,UAAU,EAAEwC,kBAAS,CAACM,IAAI;EAC1BI,gBAAgB,EAAEV,kBAAS,CAACI;AAC9B,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAzB,OAAA,GAEa0B,SAAG,CAACC,OAAO,CAAC/D,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"choice.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_Card","_CardActions","_inputHeader","_configUi","_buttons","_DragHandle","_core","_debug","_drag","_utils","log","debug","canDrag","props","lockChoiceOrder","count","choice","categoryCount","correctResponseCount","StyledCard","styled","Card","theme","minWidth","padding","spacing","overflow","StyledCardActions","CardActions","justifyContent","DragHandleContainer","shouldForwardProp","prop","draggable","cursor","touchAction","ErrorText","fontSize","typography","color","palette","error","main","paddingBottom","Choice","allowMultiplePlacements","configuration","deleteFocusedEl","focusedEl","index","onDelete","onChange","imageSupport","spellCheck","toolbarOpts","maxImageWidth","maxImageHeight","uploadSoundSupport","attributes","dragAttributes","listeners","dragListeners","setNodeRef","setDragNodeRef","isDragging","useDraggable","id","data","type","disabled","setDropNodeRef","useDroppable","changeContent","content","changeCategoryCount","isCheckboxShown","multiplePlacements","perChoice","showRemoveAfterPlacing","element","default","createElement","ref","style","opacity","_extends2","label","DeleteButton","onClick","Checkbox","mini","checked","propTypes","PropTypes","string","object","isRequired","func","number","bool","shape","add","delete","rearrangeChoices","_default","exports","uid","withUid"],"sources":["../../../src/design/choices/choice.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport Card from '@mui/material/Card';\nimport CardActions from '@mui/material/CardActions';\nimport InputHeader from '../input-header';\nimport { Checkbox } from '@pie-lib/config-ui';\nimport { DeleteButton } from '../buttons';\nimport DragHandle from '@mui/icons-material/DragHandle';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport debug from 'debug';\nimport { uid } from '@pie-lib/drag';\nimport { multiplePlacements } from '../../utils';\n\nconst log = debug('@pie-element:categorize:configure:choice');\n\nconst canDrag = (props) => {\n if (props.lockChoiceOrder) {\n return true;\n }\n const count = props.choice.categoryCount || 0;\n if (count === 0) {\n return true;\n } else {\n return props.correctResponseCount < count;\n }\n};\n\nconst StyledCard = styled(Card)(({ theme }) => ({\n minWidth: '196px',\n padding: theme.spacing(1),\n overflow: 'visible',\n}));\n\nconst StyledCardActions = styled(CardActions)({\n padding: 0,\n justifyContent: 'space-between',\n});\n\nconst DragHandleContainer = styled('span', {\n shouldForwardProp: (prop) => prop !== 'draggable',\n})(({ draggable }) => ({\n cursor: draggable ? 'move' : 'inherit',\n touchAction: 'none',\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingBottom: theme.spacing(1),\n}));\n\nconst Choice = ({\n allowMultiplePlacements,\n configuration,\n choice,\n deleteFocusedEl,\n focusedEl,\n index,\n onDelete,\n onChange,\n correctResponseCount,\n lockChoiceOrder,\n imageSupport,\n spellCheck,\n toolbarOpts,\n error,\n maxImageWidth,\n maxImageHeight,\n uploadSoundSupport,\n}) => {\n const draggable = canDrag({ choice, correctResponseCount, lockChoiceOrder });\n\n const {\n attributes: dragAttributes,\n listeners: dragListeners,\n setNodeRef: setDragNodeRef,\n isDragging,\n } = useDraggable({\n id: `choice-${choice.id}`,\n data: {\n id: choice.id,\n index,\n type: 'choice',\n },\n disabled: !draggable,\n });\n\n const {\n setNodeRef: setDropNodeRef,\n } = useDroppable({\n id: `choice-drop-${choice.id}`,\n data: {\n id: choice.id,\n index,\n type: 'choice',\n },\n });\n\n const changeContent = (content) => {\n choice.content = content;\n onChange(choice);\n };\n\n const changeCategoryCount = () => {\n if (choice.categoryCount === 1) {\n choice.categoryCount = 0;\n } else {\n choice.categoryCount = 1;\n }\n onChange(choice);\n };\n\n const isCheckboxShown = (allowMultiplePlacements) => allowMultiplePlacements === multiplePlacements.perChoice;\n\n const showRemoveAfterPlacing = isCheckboxShown(allowMultiplePlacements);\n\n const setNodeRef = (element) => {\n setDragNodeRef(element);\n setDropNodeRef(element);\n };\n\n return (\n <StyledCard ref={setNodeRef} style={{ opacity: isDragging ? 0.5 : 1 }}>\n <StyledCardActions>\n <DragHandleContainer draggable={draggable} {...dragAttributes} {...dragListeners}>\n <DragHandle color={draggable ? 'primary' : 'disabled'} />\n </DragHandleContainer>\n </StyledCardActions>\n <InputHeader\n imageSupport={imageSupport}\n focusedEl={focusedEl}\n deleteFocusedEl={deleteFocusedEl}\n index={index}\n label={choice.content}\n onChange={changeContent}\n onDelete={onDelete}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n error={error}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n configuration={configuration}\n />\n {error && <ErrorText>{error}</ErrorText>}\n\n <StyledCardActions>\n <DeleteButton label={'delete'} onClick={onDelete} />\n {showRemoveAfterPlacing && (\n <Checkbox\n mini\n label={'Remove after placing'}\n checked={choice.categoryCount === 1}\n onChange={changeCategoryCount}\n />\n )}\n </StyledCardActions>\n </StyledCard>\n );\n};\n\nChoice.propTypes = {\n allowMultiplePlacements: PropTypes.string,\n configuration: PropTypes.object.isRequired,\n choice: PropTypes.object.isRequired,\n deleteFocusedEl: PropTypes.func,\n focusedEl: PropTypes.number,\n index: PropTypes.number,\n lockChoiceOrder: PropTypes.bool,\n maxImageHeight: PropTypes.object,\n maxImageWidth: PropTypes.object,\n onChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n correctResponseCount: PropTypes.number.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n toolbarOpts: PropTypes.object,\n error: PropTypes.string,\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n spellCheck: PropTypes.bool,\n rearrangeChoices: PropTypes.func,\n};\n\nexport default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private": true,
4
4
  "main": "lib/index.js",
5
5
  "module": "src/index.js",
6
- "version": "10.1.1-next.3",
6
+ "version": "10.1.1-next.4",
7
7
  "description": "",
8
8
  "scripts": {},
9
9
  "author": "pie framework developers",
@@ -16,9 +16,9 @@
16
16
  "@mui/material": "^7.3.4",
17
17
  "@pie-framework/pie-configure-events": "^1.3.0",
18
18
  "@pie-lib/categorize": "1.2.0-next.3",
19
- "@pie-lib/config-ui": "12.2.0-next.13",
19
+ "@pie-lib/config-ui": "12.2.0-next.17",
20
20
  "@pie-lib/drag": "3.2.0-next.4",
21
- "@pie-lib/editable-html-tip-tap": "1.2.0-next.13",
21
+ "@pie-lib/editable-html-tip-tap": "1.2.0-next.16",
22
22
  "@pie-lib/math-rendering": "4.2.0-next.3",
23
23
  "@pie-lib/render-ui": "5.2.0-next.4",
24
24
  "@pie-lib/translator": "3.2.0-next.3",
@@ -3,6 +3,12 @@
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
+ # [9.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-controller@9.1.1-next.1...@pie-element/categorize-controller@9.2.0-next.0) (2026-03-18)
7
+
8
+ ### Features
9
+
10
+ - **categorize:** add trace log for scoring in outcome function PD-5438 ([53200b5](https://github.com/pie-framework/pie-elements/commit/53200b58af33e81808f6626acbec9e14e631a71d))
11
+
6
12
  ## [9.1.1-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-controller@9.1.0-next.2...@pie-element/categorize-controller@9.1.1-next.1) (2026-02-26)
7
13
 
8
14
  **Note:** Version bump only for package @pie-element/categorize-controller
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.outcome = exports.normalize = exports.model = exports.getTotalScore = exports.getPartialScore = exports.getCorrectness = exports.createDefaultModel = exports.createCorrectResponseSession = void 0;
7
+ exports.outcome = exports.normalize = exports.model = exports.getTotalScore = exports.getPartialScore = exports.getLogTrace = exports.getCorrectness = exports.createDefaultModel = exports.createCorrectResponseSession = void 0;
8
8
  Object.defineProperty(exports, "score", {
9
9
  enumerable: true,
10
10
  get: function () {
@@ -233,16 +233,106 @@ const model = async (question, session, env, updateSession) => {
233
233
  }
234
234
  return out;
235
235
  };
236
+
237
+ /**
238
+ * Generates detailed trace log for scoring evaluation
239
+ * @param {Object} model - the question model
240
+ * @param {Object} session - the student session
241
+ * @param {Object} env - the environment
242
+ * @returns {Array} traceLog - array of trace messages
243
+ */
236
244
  exports.model = model;
245
+ const getLogTrace = (model, session, env) => {
246
+ const traceLog = [];
247
+ const {
248
+ answers
249
+ } = session || {};
250
+ const {
251
+ categories,
252
+ choices,
253
+ correctResponse
254
+ } = model || {};
255
+ const draggedChoices = answers.reduce((sum, a) => sum + (a.choices?.length || 0), 0);
256
+ const alternates = getAlternates(correctResponse);
257
+ const hasAlternates = alternates.length > 0;
258
+ const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
259
+ const builtState = draggedChoices > 0 ? (0, _categorize.buildState)(categories, choices, answers, correctResponse) : null;
260
+ const builtCategories = builtState?.categories || [];
261
+ if (draggedChoices > 0) {
262
+ traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);
263
+ (categories || []).forEach((category, categoryIndex) => {
264
+ const categoryId = category.id;
265
+ const builtCategory = builtCategories.find(c => c.id === categoryId);
266
+ const studentChoices = builtCategory ? builtCategory.choices || [] : [];
267
+ const correctResponseForCategory = (correctResponse || []).find(cr => cr.category === categoryId);
268
+ const expectedChoices = correctResponseForCategory ? correctResponseForCategory.choices || [] : [];
269
+ if (expectedChoices.length > 0) {
270
+ if (studentChoices.length === 0) {
271
+ traceLog.push(`Category ${categoryId}: student left empty (should contain ${expectedChoices.length} choice(s)).`);
272
+ } else {
273
+ const correctCount = studentChoices.filter(choice => choice.correct).length;
274
+ const incorrectCount = studentChoices.length - correctCount;
275
+ if (correctCount > 0 && incorrectCount === 0) {
276
+ traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct choice(s).`);
277
+ } else if (correctCount === 0 && incorrectCount > 0) {
278
+ traceLog.push(`Category ${categoryId}: student placed ${incorrectCount} incorrect choice(s).`);
279
+ } else {
280
+ traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct and ${incorrectCount} incorrect choice(s).`);
281
+ }
282
+ }
283
+ }
284
+ });
285
+ } else {
286
+ traceLog.push('Student did not place any choices into categories.');
287
+ }
288
+ if (hasAlternates) {
289
+ traceLog.push(`Alternate response combinations are accepted for this question.`);
290
+ }
291
+ if (hasAlternates) {
292
+ traceLog.push(`Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).`);
293
+ traceLog.push(`Student must get all categories completely correct to receive full credit.`);
294
+ } else if (partialScoringEnabled) {
295
+ traceLog.push(`Score calculated using partial scoring.`);
296
+ traceLog.push(`Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.`);
297
+ if (draggedChoices > 0) {
298
+ const totalCorrect = builtCategories.reduce((sum, cat) => sum + (cat.choices || []).filter(choice => choice.correct).length, 0);
299
+ const totalIncorrect = draggedChoices - totalCorrect;
300
+ const maxPossible = (correctResponse || []).reduce((sum, cat) => sum + (cat.choices || []).length, 0);
301
+ traceLog.push(`Partial scoring calculation: ${totalCorrect} correct placements, ${totalIncorrect} incorrect placements.`);
302
+ if (draggedChoices > maxPossible) {
303
+ const extraPlacements = draggedChoices - maxPossible;
304
+ traceLog.push(`${extraPlacements} extra placement(s) beyond required amount will be deducted from score.`);
305
+ }
306
+ }
307
+ } else {
308
+ traceLog.push(`Score calculated using all-or-nothing scoring.`);
309
+ traceLog.push(`Student must get all categories completely correct to receive full credit.`);
310
+ }
311
+ const score = getTotalScore(model, session, env);
312
+ traceLog.push(`Final score: ${score}.`);
313
+ return traceLog;
314
+ };
315
+ exports.getLogTrace = getLogTrace;
237
316
  const outcome = (question, session, env) => {
238
317
  if (env.mode !== 'evaluate') {
239
318
  return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));
240
319
  } else {
241
320
  return new Promise(resolve => {
242
- resolve({
243
- score: getTotalScore(question, session, env),
244
- empty: !session || (0, _lodashEs.isEmpty)(session)
245
- });
321
+ if (!session || (0, _lodashEs.isEmpty)(session)) {
322
+ resolve({
323
+ score: 0,
324
+ empty: true,
325
+ traceLog: ['Student did not place any choices into categories. Score is 0.']
326
+ });
327
+ } else {
328
+ const traceLog = getLogTrace(question, session, env);
329
+ const score = getTotalScore(question, session, env);
330
+ resolve({
331
+ score,
332
+ empty: false,
333
+ traceLog
334
+ });
335
+ }
246
336
  });
247
337
  }
248
338
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_lodashEs","require","_categorize","_feedback","_controllerUtils","_translator","_interopRequireDefault","_defaults","_utils","translator","Translator","getPartialScore","correctResponse","builtCategories","placements","score","reduce","acc","choices","length","filter","ch","correct","maxScore","extraPlacements","totalScore","parseFloat","toFixed","exports","getAlternates","map","c","alternateResponses","alternate","getTotalScore","question","session","env","Object","keys","categories","answers","buildState","alternates","enabled","partialScoring","getCorrectness","Promise","resolve","mode","undefined","createDefaultModel","model","defaults","normalize","updateSession","normalizedQuestion","answerCorrectness","role","categoriesPerRow","choicesLabel","choicesPosition","feedback","feedbackEnabled","promptEnabled","prompt","rowLabels","rationaleEnabled","rationale","teacherInstructionsEnabled","teacherInstructions","language","maxChoicesPerCategory","extraCSSRules","minRowHeight","fontSizeFactor","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","note","fb","lockChoiceOrder","lockChoices","filteredCorrectResponse","response","filteredChoices","choice","getFeedbackForCorrectness","getShuffledChoices","t","lng","responseAreasToBeFilled","possibleResponses","hasUnplacedChoices","getCompleteResponseDetails","allowAlternateEnabled","out","correctness","disabled","showNote","outcome","reject","Error","empty","isEmpty","createCorrectResponseSession","id","getInnerText","html","replaceAll","getContent","replace","validate","config","maxAnswerChoices","minChoices","minCategories","maxCategories","maxLengthPerChoice","maxLengthPerCategory","reversedChoices","reverse","errors","choicesErrors","categoriesErrors","forEach","field","required","category","label","index","content","identicalAnswer","slice","some","nbOfCategories","nbOfChoices","categoriesError","choicesError","hasAssociations","duplicateAlternateIndex","duplicateCategory","isCorrectResponseDuplicated","isAlternateDuplicated","duplicateAlternate","associationError"],"sources":["../src/index.js"],"sourcesContent":["import { isEmpty } from 'lodash-es';\nimport { buildState, score } from '@pie-lib/categorize';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\nimport defaults from './defaults';\nimport { getCompleteResponseDetails, isAlternateDuplicated, isCorrectResponseDuplicated } from './utils';\n\n// eslint-disable-next-line no-console\n\nexport { score };\n\nexport const getPartialScore = (correctResponse, builtCategories) => {\n // in the resulted best scenario we make a sum with all the correct responses\n // and all the placements\n const { placements, score } = builtCategories.reduce(\n (acc, { choices = [] }) => ({\n placements: acc.placements + choices.length,\n score: acc.score + choices.filter((ch) => ch.correct).length,\n }),\n { placements: 0, score: 0 },\n );\n\n // in the correct response, we make a sum of the max possible score\n const { maxScore } = correctResponse.reduce(\n (acc, { choices }) => ({\n maxScore: acc.maxScore + choices.length,\n }),\n { maxScore: 0 },\n );\n\n // if there are any extra placements, we subtract from the obtained score\n const extraPlacements = placements > maxScore ? placements - maxScore : 0;\n const totalScore = (score - extraPlacements) / maxScore;\n\n return totalScore < 0 ? 0 : parseFloat(totalScore.toFixed(2));\n};\n\nconst getAlternates = (correctResponse) =>\n correctResponse.map((c) => c.alternateResponses).filter((alternate) => alternate);\n\nexport const getTotalScore = (question, session, env) => {\n if (!session) {\n return 0;\n }\n\n if (Object.keys(session).length === 0) {\n return 0;\n }\n const { categories, choices } = question || {};\n let { correctResponse } = question || {};\n let { answers } = session || {};\n answers = answers || [];\n correctResponse = correctResponse || [];\n\n // this function is used in pie-ui/categorize as well, in order to get the best scenario\n // so we get the best scenario and calculate the score\n const { categories: builtCategories, correct } = buildState(categories, choices, answers, correctResponse);\n\n const alternates = getAlternates(correctResponse);\n const enabled = partialScoring.enabled(question, env);\n\n // if there are any alternates, there will be no partial scoring!\n if (enabled && !alternates.length) {\n // we apply partial scoring\n return getPartialScore(correctResponse, builtCategories);\n }\n\n // else we apply dichotomous\n return correct ? 1 : 0;\n};\n\nexport const getCorrectness = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode === 'evaluate') {\n const score = getTotalScore(question, session, env);\n if (score === 1) {\n resolve('correct');\n } else if (score === 0) {\n resolve('incorrect');\n } else {\n resolve('partially-correct');\n }\n } else {\n resolve(undefined);\n }\n });\n};\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport const model = async (question, session, env, updateSession) => {\n const normalizedQuestion = normalize(question);\n const answerCorrectness = await getCorrectness(normalizedQuestion, session, env);\n\n const { mode, role } = env || {};\n\n const {\n categories,\n categoriesPerRow,\n choicesLabel,\n choicesPosition,\n correctResponse,\n feedback,\n feedbackEnabled,\n promptEnabled,\n prompt,\n rowLabels,\n rationaleEnabled,\n rationale,\n teacherInstructionsEnabled,\n teacherInstructions,\n language,\n maxChoicesPerCategory,\n extraCSSRules,\n minRowHeight,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n } = normalizedQuestion;\n let { choices, note } = normalizedQuestion;\n let fb;\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n const filteredCorrectResponse = correctResponse.map((response) => {\n const filteredChoices = (response.choices || []).filter((choice) => choice !== 'null');\n return { ...response, choices: filteredChoices };\n });\n\n if (mode === 'evaluate' && feedbackEnabled) {\n fb = await getFeedbackForCorrectness(answerCorrectness, feedback);\n }\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n if (!note) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: language });\n }\n\n const alternates = getAlternates(filteredCorrectResponse);\n const { responseAreasToBeFilled, possibleResponses, hasUnplacedChoices } = getCompleteResponseDetails(\n filteredCorrectResponse,\n normalizedQuestion.allowAlternateEnabled ? alternates : [],\n normalizedQuestion.choices,\n );\n const out = {\n categories: categories || [],\n categoriesPerRow: categoriesPerRow || 2,\n maxChoicesPerCategory,\n correctness: answerCorrectness,\n choices: choices || [],\n choicesLabel: choicesLabel || '',\n choicesPosition,\n disabled: mode !== 'gather',\n feedback: fb,\n lockChoiceOrder,\n prompt: promptEnabled ? prompt : null,\n rowLabels,\n note,\n env,\n showNote: alternates && alternates.length > 0,\n correctResponse: mode === 'evaluate' ? filteredCorrectResponse : undefined,\n language,\n extraCSSRules,\n fontSizeFactor,\n minRowHeight: minRowHeight,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n possibleResponses,\n responseAreasToBeFilled,\n hasUnplacedChoices,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = rationaleEnabled ? rationale : null;\n out.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n return out;\n};\n\nexport const outcome = (question, session, env) => {\n if (env.mode !== 'evaluate') {\n return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));\n } else {\n return new Promise((resolve) => {\n resolve({\n score: getTotalScore(question, session, env),\n empty: !session || isEmpty(session),\n });\n });\n }\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n const { mode, role } = env || {};\n\n if (mode !== 'evaluate' && role === 'instructor') {\n const { correctResponse } = question;\n\n resolve({ answers: correctResponse, id: 1 });\n } else {\n return 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 { categories, choices, correctResponse, maxAnswerChoices } = model;\n const {\n minChoices = 1,\n minCategories = 1,\n maxCategories = 12,\n maxLengthPerChoice = 300,\n maxLengthPerCategory = 150,\n } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const errors = {};\n const choicesErrors = {};\n const categoriesErrors = {};\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 (categories || []).forEach((category) => {\n const { id, label } = category;\n\n if (getInnerText(label).length > maxLengthPerCategory) {\n categoriesErrors[id] = `Category labels should be no more than ${maxLengthPerCategory} characters long.`;\n }\n });\n\n (reversedChoices || []).forEach((choice, index) => {\n const { id, content } = choice;\n\n if (getInnerText(content).length > maxLengthPerChoice) {\n choicesErrors[id] = `Tokens should be no more than ${maxLengthPerChoice} characters long.`;\n }\n\n if (!getContent(content)) {\n choicesErrors[id] = 'Tokens should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.content === content);\n\n if (identicalAnswer) {\n choicesErrors[id] = 'Tokens content should be unique.';\n }\n }\n });\n\n const nbOfCategories = (categories || []).length;\n const nbOfChoices = (choices || []).length;\n\n if (nbOfCategories > maxCategories) {\n errors.categoriesError = `No more than ${maxCategories} categories should be defined.`;\n } else if (nbOfCategories < minCategories) {\n errors.categoriesError = `There should be at least ${minCategories} category defined.`;\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.choicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (nbOfChoices && nbOfCategories) {\n let hasAssociations = false;\n\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [] } = response;\n\n if (choices.length) {\n hasAssociations = true;\n } else {\n alternateResponses.forEach((alternate) => {\n if ((alternate || []).length) {\n hasAssociations = true;\n }\n });\n }\n });\n\n let duplicateAlternateIndex = -1;\n let duplicateCategory = '';\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [], category } = response;\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isCorrectResponseDuplicated(choices, alternateResponses);\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isAlternateDuplicated(alternateResponses);\n }\n\n duplicateCategory = category;\n }\n });\n\n if (duplicateAlternateIndex > -1) {\n errors.duplicateAlternate = { index: duplicateAlternateIndex, category: duplicateCategory };\n }\n\n if (!hasAssociations) {\n errors.associationError = 'At least one token should be assigned to at least one category.';\n }\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n if (!isEmpty(categoriesErrors)) {\n errors.categoriesErrors = categoriesErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AAGA,IAAAM,SAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAFA,MAAM;EAAEQ;AAAW,CAAC,GAAGC,mBAAU;;AAIjC;;AAIO,MAAMC,eAAe,GAAGA,CAACC,eAAe,EAAEC,eAAe,KAAK;EACnE;EACA;EACA,MAAM;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGF,eAAe,CAACG,MAAM,CAClD,CAACC,GAAG,EAAE;IAAEC,OAAO,GAAG;EAAG,CAAC,MAAM;IAC1BJ,UAAU,EAAEG,GAAG,CAACH,UAAU,GAAGI,OAAO,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","_controllerUtils","_translator","_interopRequireDefault","_defaults","_utils","translator","Translator","getPartialScore","correctResponse","builtCategories","placements","score","reduce","acc","choices","length","filter","ch","correct","maxScore","extraPlacements","totalScore","parseFloat","toFixed","exports","getAlternates","map","c","alternateResponses","alternate","getTotalScore","question","session","env","Object","keys","categories","answers","buildState","alternates","enabled","partialScoring","getCorrectness","Promise","resolve","mode","undefined","createDefaultModel","model","defaults","normalize","updateSession","normalizedQuestion","answerCorrectness","role","categoriesPerRow","choicesLabel","choicesPosition","feedback","feedbackEnabled","promptEnabled","prompt","rowLabels","rationaleEnabled","rationale","teacherInstructionsEnabled","teacherInstructions","language","maxChoicesPerCategory","extraCSSRules","minRowHeight","fontSizeFactor","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","note","fb","lockChoiceOrder","lockChoices","filteredCorrectResponse","response","filteredChoices","choice","getFeedbackForCorrectness","getShuffledChoices","t","lng","responseAreasToBeFilled","possibleResponses","hasUnplacedChoices","getCompleteResponseDetails","allowAlternateEnabled","out","correctness","disabled","showNote","getLogTrace","traceLog","draggedChoices","sum","a","hasAlternates","partialScoringEnabled","builtState","push","forEach","category","categoryIndex","categoryId","id","builtCategory","find","studentChoices","correctResponseForCategory","cr","expectedChoices","correctCount","incorrectCount","totalCorrect","cat","totalIncorrect","maxPossible","outcome","reject","Error","isEmpty","empty","createCorrectResponseSession","getInnerText","html","replaceAll","getContent","replace","validate","config","maxAnswerChoices","minChoices","minCategories","maxCategories","maxLengthPerChoice","maxLengthPerCategory","reversedChoices","reverse","errors","choicesErrors","categoriesErrors","field","required","label","index","content","identicalAnswer","slice","some","nbOfCategories","nbOfChoices","categoriesError","choicesError","hasAssociations","duplicateAlternateIndex","duplicateCategory","isCorrectResponseDuplicated","isAlternateDuplicated","duplicateAlternate","associationError"],"sources":["../src/index.js"],"sourcesContent":["import { isEmpty } from 'lodash-es';\nimport { buildState, score } from '@pie-lib/categorize';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\nimport defaults from './defaults';\nimport { getCompleteResponseDetails, isAlternateDuplicated, isCorrectResponseDuplicated } from './utils';\n\n// eslint-disable-next-line no-console\n\nexport { score };\n\nexport const getPartialScore = (correctResponse, builtCategories) => {\n // in the resulted best scenario we make a sum with all the correct responses\n // and all the placements\n const { placements, score } = builtCategories.reduce(\n (acc, { choices = [] }) => ({\n placements: acc.placements + choices.length,\n score: acc.score + choices.filter((ch) => ch.correct).length,\n }),\n { placements: 0, score: 0 },\n );\n\n // in the correct response, we make a sum of the max possible score\n const { maxScore } = correctResponse.reduce(\n (acc, { choices }) => ({\n maxScore: acc.maxScore + choices.length,\n }),\n { maxScore: 0 },\n );\n\n // if there are any extra placements, we subtract from the obtained score\n const extraPlacements = placements > maxScore ? placements - maxScore : 0;\n const totalScore = (score - extraPlacements) / maxScore;\n\n return totalScore < 0 ? 0 : parseFloat(totalScore.toFixed(2));\n};\n\nconst getAlternates = (correctResponse) =>\n correctResponse.map((c) => c.alternateResponses).filter((alternate) => alternate);\n\nexport const getTotalScore = (question, session, env) => {\n if (!session) {\n return 0;\n }\n\n if (Object.keys(session).length === 0) {\n return 0;\n }\n const { categories, choices } = question || {};\n let { correctResponse } = question || {};\n let { answers } = session || {};\n answers = answers || [];\n correctResponse = correctResponse || [];\n\n // this function is used in pie-ui/categorize as well, in order to get the best scenario\n // so we get the best scenario and calculate the score\n const { categories: builtCategories, correct } = buildState(categories, choices, answers, correctResponse);\n\n const alternates = getAlternates(correctResponse);\n const enabled = partialScoring.enabled(question, env);\n\n // if there are any alternates, there will be no partial scoring!\n if (enabled && !alternates.length) {\n // we apply partial scoring\n return getPartialScore(correctResponse, builtCategories);\n }\n\n // else we apply dichotomous\n return correct ? 1 : 0;\n};\n\nexport const getCorrectness = (question, session, env) => {\n return new Promise((resolve) => {\n if (env.mode === 'evaluate') {\n const score = getTotalScore(question, session, env);\n if (score === 1) {\n resolve('correct');\n } else if (score === 0) {\n resolve('incorrect');\n } else {\n resolve('partially-correct');\n }\n } else {\n resolve(undefined);\n }\n });\n};\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport const model = async (question, session, env, updateSession) => {\n const normalizedQuestion = normalize(question);\n const answerCorrectness = await getCorrectness(normalizedQuestion, session, env);\n\n const { mode, role } = env || {};\n\n const {\n categories,\n categoriesPerRow,\n choicesLabel,\n choicesPosition,\n correctResponse,\n feedback,\n feedbackEnabled,\n promptEnabled,\n prompt,\n rowLabels,\n rationaleEnabled,\n rationale,\n teacherInstructionsEnabled,\n teacherInstructions,\n language,\n maxChoicesPerCategory,\n extraCSSRules,\n minRowHeight,\n fontSizeFactor,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n } = normalizedQuestion;\n let { choices, note } = normalizedQuestion;\n let fb;\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n const filteredCorrectResponse = correctResponse.map((response) => {\n const filteredChoices = (response.choices || []).filter((choice) => choice !== 'null');\n return { ...response, choices: filteredChoices };\n });\n\n if (mode === 'evaluate' && feedbackEnabled) {\n fb = await getFeedbackForCorrectness(answerCorrectness, feedback);\n }\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n if (!note) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: language });\n }\n\n const alternates = getAlternates(filteredCorrectResponse);\n const { responseAreasToBeFilled, possibleResponses, hasUnplacedChoices } = getCompleteResponseDetails(\n filteredCorrectResponse,\n normalizedQuestion.allowAlternateEnabled ? alternates : [],\n normalizedQuestion.choices,\n );\n const out = {\n categories: categories || [],\n categoriesPerRow: categoriesPerRow || 2,\n maxChoicesPerCategory,\n correctness: answerCorrectness,\n choices: choices || [],\n choicesLabel: choicesLabel || '',\n choicesPosition,\n disabled: mode !== 'gather',\n feedback: fb,\n lockChoiceOrder,\n prompt: promptEnabled ? prompt : null,\n rowLabels,\n note,\n env,\n showNote: alternates && alternates.length > 0,\n correctResponse: mode === 'evaluate' ? filteredCorrectResponse : undefined,\n language,\n extraCSSRules,\n fontSizeFactor,\n minRowHeight: minRowHeight,\n autoplayAudioEnabled,\n completeAudioEnabled,\n customAudioButton,\n possibleResponses,\n responseAreasToBeFilled,\n hasUnplacedChoices,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = rationaleEnabled ? rationale : null;\n out.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n return out;\n};\n\n /**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { answers } = session || {};\n const { categories, choices, correctResponse } = model || {};\n\n const draggedChoices = answers.reduce(\n (sum, a) => sum + (a.choices?.length || 0),\n 0\n );\n\n const alternates = getAlternates(correctResponse);\n const hasAlternates = alternates.length > 0;\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n const builtState =\n draggedChoices > 0\n ? buildState(categories, choices, answers, correctResponse)\n : null;\n\n const builtCategories = builtState?.categories || [];\n \n if (draggedChoices > 0) {\n traceLog.push(`Student placed ${draggedChoices} choice(s) into categories.`);\n \n (categories || []).forEach((category, categoryIndex) => {\n const categoryId = category.id;\n const builtCategory = builtCategories.find(c => c.id === categoryId);\n const studentChoices = builtCategory ? builtCategory.choices || [] : [];\n const correctResponseForCategory = (correctResponse || []).find(cr => cr.category === categoryId);\n const expectedChoices = correctResponseForCategory ? correctResponseForCategory.choices || [] : [];\n \n if (expectedChoices.length > 0) {\n if (studentChoices.length === 0) {\n traceLog.push(`Category ${categoryId}: student left empty (should contain ${expectedChoices.length} choice(s)).`);\n } else {\n const correctCount = studentChoices.filter(choice => choice.correct).length;\n const incorrectCount = studentChoices.length - correctCount;\n \n if (correctCount > 0 && incorrectCount === 0) {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct choice(s).`);\n } else if (correctCount === 0 && incorrectCount > 0) {\n traceLog.push(`Category ${categoryId}: student placed ${incorrectCount} incorrect choice(s).`);\n } else {\n traceLog.push(`Category ${categoryId}: student placed ${correctCount} correct and ${incorrectCount} incorrect choice(s).`);\n }\n }\n }\n });\n } else {\n traceLog.push('Student did not place any choices into categories.');\n }\n\n if (hasAlternates) {\n traceLog.push(`Alternate response combinations are accepted for this question.`);\n }\n\n if (hasAlternates) {\n traceLog.push(`Score calculated using all-or-nothing scoring (alternate responses disable partial scoring).`);\n traceLog.push(`Student must get all categories completely correct to receive full credit.`);\n } else if (partialScoringEnabled) {\n traceLog.push(`Score calculated using partial scoring.`);\n traceLog.push(`Student receives credit for each correct placement, with deductions for incorrect placements beyond required amount.`);\n \n if (draggedChoices > 0) {\n const totalCorrect = builtCategories.reduce((sum, cat) => \n sum + (cat.choices || []).filter(choice => choice.correct).length, 0);\n const totalIncorrect = draggedChoices - totalCorrect;\n const maxPossible = (correctResponse || []).reduce((sum, cat) => \n sum + (cat.choices || []).length, 0);\n \n traceLog.push(`Partial scoring calculation: ${totalCorrect} correct placements, ${totalIncorrect} incorrect placements.`);\n \n if (draggedChoices > maxPossible) {\n const extraPlacements = draggedChoices - maxPossible;\n traceLog.push(`${extraPlacements} extra placement(s) beyond required amount will be deducted from score.`);\n }\n }\n } else {\n traceLog.push(`Score calculated using all-or-nothing scoring.`);\n traceLog.push(`Student must get all categories completely correct to receive full credit.`);\n }\n\n const score = getTotalScore(model, session, env);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\nexport const outcome = (question, session, env) => {\n if (env.mode !== 'evaluate') {\n return Promise.reject(new Error('Can not call outcome when mode is not evaluate'));\n } else {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not place any choices into categories. Score is 0.'],\n });\n } else {\n const traceLog = getLogTrace(question, session, env);\n const score = getTotalScore(question, session, env);\n \n resolve({\n score,\n empty: false,\n traceLog,\n });\n }\n });\n }\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n const { mode, role } = env || {};\n\n if (mode !== 'evaluate' && role === 'instructor') {\n const { correctResponse } = question;\n\n resolve({ answers: correctResponse, id: 1 });\n } else {\n return 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 { categories, choices, correctResponse, maxAnswerChoices } = model;\n const {\n minChoices = 1,\n minCategories = 1,\n maxCategories = 12,\n maxLengthPerChoice = 300,\n maxLengthPerCategory = 150,\n } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const errors = {};\n const choicesErrors = {};\n const categoriesErrors = {};\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 (categories || []).forEach((category) => {\n const { id, label } = category;\n\n if (getInnerText(label).length > maxLengthPerCategory) {\n categoriesErrors[id] = `Category labels should be no more than ${maxLengthPerCategory} characters long.`;\n }\n });\n\n (reversedChoices || []).forEach((choice, index) => {\n const { id, content } = choice;\n\n if (getInnerText(content).length > maxLengthPerChoice) {\n choicesErrors[id] = `Tokens should be no more than ${maxLengthPerChoice} characters long.`;\n }\n\n if (!getContent(content)) {\n choicesErrors[id] = 'Tokens should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.content === content);\n\n if (identicalAnswer) {\n choicesErrors[id] = 'Tokens content should be unique.';\n }\n }\n });\n\n const nbOfCategories = (categories || []).length;\n const nbOfChoices = (choices || []).length;\n\n if (nbOfCategories > maxCategories) {\n errors.categoriesError = `No more than ${maxCategories} categories should be defined.`;\n } else if (nbOfCategories < minCategories) {\n errors.categoriesError = `There should be at least ${minCategories} category defined.`;\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.choicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (nbOfChoices && nbOfCategories) {\n let hasAssociations = false;\n\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [] } = response;\n\n if (choices.length) {\n hasAssociations = true;\n } else {\n alternateResponses.forEach((alternate) => {\n if ((alternate || []).length) {\n hasAssociations = true;\n }\n });\n }\n });\n\n let duplicateAlternateIndex = -1;\n let duplicateCategory = '';\n (correctResponse || []).forEach((response) => {\n const { choices = [], alternateResponses = [], category } = response;\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isCorrectResponseDuplicated(choices, alternateResponses);\n\n if (duplicateAlternateIndex === -1) {\n duplicateAlternateIndex = isAlternateDuplicated(alternateResponses);\n }\n\n duplicateCategory = category;\n }\n });\n\n if (duplicateAlternateIndex > -1) {\n errors.duplicateAlternate = { index: duplicateAlternateIndex, category: duplicateCategory };\n }\n\n if (!hasAssociations) {\n errors.associationError = 'At least one token should be assigned to at least one category.';\n }\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n if (!isEmpty(categoriesErrors)) {\n errors.categoriesErrors = categoriesErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAA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KAAK,CAAC,CAAC,EAAE;QAClCA,uBAAuB,GAAG,IAAAE,kCAA2B,EAACnJ,OAAO,EAAEc,kBAAkB,CAAC;QAElF,IAAImI,uBAAuB,KAAK,CAAC,CAAC,EAAE;UAClCA,uBAAuB,GAAG,IAAAG,4BAAqB,EAACtI,kBAAkB,CAAC;QACrE;QAEAoI,iBAAiB,GAAGtD,QAAQ;MAC9B;IACF,CAAC,CAAC;IAEF,IAAIqD,uBAAuB,GAAG,CAAC,CAAC,EAAE;MAChChB,MAAM,CAACoB,kBAAkB,GAAG;QAAEd,KAAK,EAAEU,uBAAuB;QAAErD,QAAQ,EAAEsD;MAAkB,CAAC;IAC7F;IAEA,IAAI,CAACF,eAAe,EAAE;MACpBf,MAAM,CAACqB,gBAAgB,GAAG,iEAAiE;IAC7F;EACF;EAEA,IAAI,CAAC,IAAAvC,iBAAO,EAACmB,aAAa,CAAC,EAAE;IAC3BD,MAAM,CAACC,aAAa,GAAGA,aAAa;EACtC;EAEA,IAAI,CAAC,IAAAnB,iBAAO,EAACoB,gBAAgB,CAAC,EAAE;IAC9BF,MAAM,CAACE,gBAAgB,GAAGA,gBAAgB;EAC5C;EAEA,OAAOF,MAAM;AACf,CAAC;AAACvH,OAAA,CAAA6G,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -8,7 +8,7 @@
8
8
  "@pie-lib/translator": "3.2.0-next.3",
9
9
  "lodash-es": "^4.17.23"
10
10
  },
11
- "version": "9.1.1-next.1",
11
+ "version": "9.2.0-next.0",
12
12
  "description": "",
13
13
  "scripts": {},
14
14
  "main": "lib/index.js",
@@ -58,7 +58,8 @@ const DroppablePlaceholder = ({
58
58
  style: {
59
59
  flex: 1,
60
60
  minHeight: minRowHeight || '80px',
61
- position: 'relative'
61
+ position: 'relative',
62
+ touchAction: 'none'
62
63
  }
63
64
  }, /*#__PURE__*/_react.default.createElement(_drag.PlaceHolder, {
64
65
  isOver: isOver,
@@ -1 +1 @@
1
- {"version":3,"file":"droppable-placeholder.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_styles","_core","_drag","_renderUi","log","debug","DroppablePlaceholder","children","grid","disabled","choiceBoard","minRowHeight","id","correct","theme","useTheme","setNodeRef","isOver","useDroppable","data","itemType","categoryId","extraStyles","padding","spacing","borderRadius","gridColumnGap","gridRowGap","display","flexWrap","justifyContent","alignItems","alignContent","width","height","border","color","incorrect","default","createElement","ref","style","flex","minHeight","position","PlaceHolder","isCategorize","propTypes","PropTypes","bool","node","isRequired","object","string","onDropChoice","func","_default","exports"],"sources":["../../src/categorize/droppable-placeholder.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useTheme } from '@mui/material/styles';\nimport { useDroppable } from '@dnd-kit/core';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-ui:categorize:droppable-placeholder');\n\nconst DroppablePlaceholder = ({\n children,\n grid,\n disabled,\n choiceBoard,\n minRowHeight,\n id,\n correct\n}) => {\n const theme = useTheme();\n const { setNodeRef, isOver } = useDroppable({\n id,\n data: {\n itemType: 'categorize',\n categoryId: id\n },\n disabled,\n });\n\n const extraStyles = {\n padding: theme.spacing(0.5),\n borderRadius: theme.spacing(0.5),\n gridColumnGap: 0,\n gridRowGap: 0,\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n alignContent: 'flex-start',\n width: '100%',\n height: '100%',\n ...(correct === false && !choiceBoard && {\n border: `solid 2px ${color.incorrect()}`,\n }),\n ...(correct === true && !choiceBoard && {\n border: `solid 2px ${color.correct()}`,\n }),\n };\n\n return (\n <div\n ref={setNodeRef}\n style={{\n flex: 1,\n minHeight: minRowHeight || '80px',\n position: 'relative'\n }}\n >\n <PlaceHolder\n isOver={isOver}\n grid={grid}\n disabled={disabled}\n choiceBoard={choiceBoard}\n isCategorize\n extraStyles={extraStyles}\n >\n {children}\n </PlaceHolder>\n </div>\n );\n};\n\nDroppablePlaceholder.propTypes = {\n choiceBoard: PropTypes.bool,\n children: PropTypes.node.isRequired,\n grid: PropTypes.object,\n disabled: PropTypes.bool,\n minRowHeight: PropTypes.string,\n onDropChoice: PropTypes.func,\n id: PropTypes.string.isRequired,\n correct: PropTypes.bool\n};\n\nexport default DroppablePlaceholder;\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,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,MAAMO,GAAG,GAAG,IAAAC,cAAK,EAAC,0CAA0C,CAAC;AAE7D,MAAMC,oBAAoB,GAAGA,CAAC;EAC5BC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,WAAW;EACXC,YAAY;EACZC,EAAE;EACFC;AACF,CAAC,KAAK;EACJ,MAAMC,KAAK,GAAG,IAAAC,gBAAQ,EAAC,CAAC;EACxB,MAAM;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAG,IAAAC,kBAAY,EAAC;IAC1CN,EAAE;IACFO,IAAI,EAAE;MACJC,QAAQ,EAAE,YAAY;MACtBC,UAAU,EAAET;IACd,CAAC;IACDH;EACF,CAAC,CAAC;EAEF,MAAMa,WAAW,GAAG;IAClBC,OAAO,EAAET,KAAK,CAACU,OAAO,CAAC,GAAG,CAAC;IAC3BC,YAAY,EAAEX,KAAK,CAACU,OAAO,CAAC,GAAG,CAAC;IAChCE,aAAa,EAAE,CAAC;IAChBC,UAAU,EAAE,CAAC;IACbC,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE,MAAM;IAChBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,YAAY,EAAE,YAAY;IA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[]}
1
+ {"version":3,"file":"droppable-placeholder.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_styles","_core","_drag","_renderUi","log","debug","DroppablePlaceholder","children","grid","disabled","choiceBoard","minRowHeight","id","correct","theme","useTheme","setNodeRef","isOver","useDroppable","data","itemType","categoryId","extraStyles","padding","spacing","borderRadius","gridColumnGap","gridRowGap","display","flexWrap","justifyContent","alignItems","alignContent","width","height","border","color","incorrect","default","createElement","ref","style","flex","minHeight","position","touchAction","PlaceHolder","isCategorize","propTypes","PropTypes","bool","node","isRequired","object","string","onDropChoice","func","_default","exports"],"sources":["../../src/categorize/droppable-placeholder.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { useTheme } from '@mui/material/styles';\nimport { useDroppable } from '@dnd-kit/core';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-ui:categorize:droppable-placeholder');\n\nconst DroppablePlaceholder = ({\n children,\n grid,\n disabled,\n choiceBoard,\n minRowHeight,\n id,\n correct\n}) => {\n const theme = useTheme();\n const { setNodeRef, isOver } = useDroppable({\n id,\n data: {\n itemType: 'categorize',\n categoryId: id\n },\n disabled,\n });\n\n const extraStyles = {\n padding: theme.spacing(0.5),\n borderRadius: theme.spacing(0.5),\n gridColumnGap: 0,\n gridRowGap: 0,\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n alignContent: 'flex-start',\n width: '100%',\n height: '100%',\n ...(correct === false && !choiceBoard && {\n border: `solid 2px ${color.incorrect()}`,\n }),\n ...(correct === true && !choiceBoard && {\n border: `solid 2px ${color.correct()}`,\n }),\n };\n\n return (\n <div\n ref={setNodeRef}\n style={{\n flex: 1,\n minHeight: minRowHeight || '80px',\n position: 'relative',\n touchAction: 'none',\n }}\n >\n <PlaceHolder\n isOver={isOver}\n grid={grid}\n disabled={disabled}\n choiceBoard={choiceBoard}\n isCategorize\n extraStyles={extraStyles}\n >\n {children}\n </PlaceHolder>\n </div>\n );\n};\n\nDroppablePlaceholder.propTypes = {\n choiceBoard: PropTypes.bool,\n children: PropTypes.node.isRequired,\n grid: PropTypes.object,\n disabled: PropTypes.bool,\n minRowHeight: PropTypes.string,\n onDropChoice: PropTypes.func,\n id: PropTypes.string.isRequired,\n correct: PropTypes.bool\n};\n\nexport default DroppablePlaceholder;\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,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,MAAMO,GAAG,GAAG,IAAAC,cAAK,EAAC,0CAA0C,CAAC;AAE7D,MAAMC,oBAAoB,GAAGA,CAAC;EAC5BC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,WAAW;EACXC,YAAY;EACZC,EAAE;EACFC;AACF,CAAC,KAAK;EACJ,MAAMC,KAAK,GAAG,IAAAC,gBAAQ,EAAC,CAAC;EACxB,MAAM;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAG,IAAAC,kBAAY,EAAC;IAC1CN,EAAE;IACFO,IAAI,EAAE;MACJC,QAAQ,EAAE,YAAY;MACtBC,UAAU,EAAET;IACd,CAAC;IACDH;EACF,CAAC,CAAC;EAEF,MAAMa,WAAW,GAAG;IAClBC,OAAO,EAAET,KAAK,CAACU,OAAO,CAAC,GAAG,CAAC;IAC3BC,YAAY,EAAEX,KAAK,CAACU,OAAO,CAAC,GAAG,CAAC;IAChCE,aAAa,EAAE,CAAC;IAChBC,UAAU,EAAE,CAAC;IACbC,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE,MAAM;IAChBC,cAAc,EAAE,QAAQ;IACx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CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEahC,oBAAoB","ignoreList":[]}
@@ -42,6 +42,9 @@ class DragPreviewWrapper extends _react.default.Component {
42
42
  }, this.props.children);
43
43
  }
44
44
  }
45
+ (0, _defineProperty2.default)(DragPreviewWrapper, "propTypes", {
46
+ children: _propTypes.default.node
47
+ });
45
48
  class Categorize extends _react.default.Component {
46
49
  constructor(props) {
47
50
  super(props);
@@ -402,6 +405,19 @@ class CategorizeProvider extends _react.default.Component {
402
405
  }, /*#__PURE__*/_react.default.createElement(DragPreviewWrapper, null, this.renderDragOverlay()))));
403
406
  }
404
407
  }
408
+ (0, _defineProperty2.default)(CategorizeProvider, "propTypes", {
409
+ model: _propTypes.default.object,
410
+ session: _propTypes.default.shape({
411
+ answers: _propTypes.default.arrayOf(_propTypes.default.shape({
412
+ choice: _propTypes.default.string,
413
+ category: _propTypes.default.string
414
+ }))
415
+ }),
416
+ onAnswersChange: _propTypes.default.func.isRequired,
417
+ onShowCorrectToggle: _propTypes.default.func.isRequired,
418
+ pauseMathObserver: _propTypes.default.func,
419
+ resumeMathObserver: _propTypes.default.func
420
+ });
405
421
  const StyledUiLayout = (0, _styles.styled)(_renderUi.UiLayout)({
406
422
  color: _renderUi.color.text(),
407
423
  backgroundColor: _renderUi.color.background(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_styles","_core","_correctAnswerToggle","_categorize","_drag","_renderUi","_mathRendering","_translator","_configUi","_choices","_choice","_categories","translator","Translator","log","debug","DragPreviewWrapper","React","Component","constructor","args","_defineProperty2","default","createRef","componentDidMount","containerRef","current","renderMath","render","createElement","ref","props","children","Categorize","c","onAnswersChange","session","answers","removeChoiceFromCategory","id","categoryId","choiceIndex","draggedChoice","model","maxChoicesPerCategory","newAnswers","undefined","answer","find","category","choices","length","moveChoiceToCategory","setState","showMaxChoiceAlert","removeChoice","showCorrect","state","onShowCorrectToggle","choicePosition","flexDirection","correctResponse","some","correctRes","alternateResponses","UNSAFE_componentWillReceiveProps","nextProps","nextModel","note","language","t","lng","choicesPosition","extraCSSRules","showNote","env","autoplayAudioEnabled","customAudioButton","mode","role","style","getPositionDirection","gap","categories","correct","buildState","disabled","rowLabels","categoriesPerRow","fontSizeFactor","nbOfRows","Math","ceil","existAlternate","existAlternateResponse","displayNote","alertMessage","alertTitle","onCloseText","showRationale","rationale","hasText","hasMedia","showTeacherInstructions","teacherInstructions","StyledUiLayout","Fragment","StyledCollapsible","labels","hidden","visible","PreviewPrompt","prompt","show","toggled","onToggle","toggleShowCorrect","StyledCategorize","display","flex","onDropChoice","dropChoice","onRemoveChoice","slice","StyledNote","dangerouslySetInnerHTML","__html","correctness","feedback","Feedback","AlertDialog","title","text","open","onClose","exports","PropTypes","object","shape","arrayOf","choice","string","func","isRequired","pauseMathObserver","resumeMathObserver","CategorizeProvider","event","active","data","activeDragItem","isValidDrop","over","draggedItem","overData","type","itemType","choiceData","value","categorizeRef","_extends2","key","uid","generateId","dropAnimation","DragProvider","onDragStart","onDragEnd","Provider","DragOverlay","renderDragOverlay","styled","UiLayout","color","backgroundColor","background","position","theme","marginBottom","spacing","Collapsible","paddingBottom","_default"],"sources":["../../src/categorize/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { DragOverlay } from '@dnd-kit/core';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { buildState, removeChoiceFromCategory, moveChoiceToCategory } from '@pie-lib/categorize';\nimport { DragProvider, uid } from '@pie-lib/drag';\nimport { color, Feedback, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport Choices from './choices';\nimport Choice from './choice';\nimport Categories from './categories';\n\nconst { translator } = Translator;\nconst log = debug('@pie-ui:categorize');\n\nclass DragPreviewWrapper extends React.Component {\n containerRef = React.createRef();\n\n componentDidMount() {\n if (this.containerRef.current) {\n renderMath(this.containerRef.current);\n }\n }\n\n render() {\n return <div ref={this.containerRef}>{this.props.children}</div>;\n }\n}\n\nexport class Categorize extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.shape({\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n choice: PropTypes.string,\n category: PropTypes.string,\n }),\n ),\n }),\n onAnswersChange: PropTypes.func.isRequired,\n onShowCorrectToggle: PropTypes.func.isRequired,\n pauseMathObserver: PropTypes.func,\n resumeMathObserver: PropTypes.func,\n };\n\n static defaultProps = {\n disabled: false,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: false,\n showMaxChoiceAlert: false,\n };\n }\n\n removeChoice = (c) => {\n log('[removeChoice]: ', c);\n const { onAnswersChange, session } = this.props;\n const answers = removeChoiceFromCategory(c.id, c.categoryId, c.choiceIndex, session.answers);\n onAnswersChange(answers);\n };\n\n dropChoice = (categoryId, draggedChoice) => {\n const { session, onAnswersChange, model } = this.props;\n const { maxChoicesPerCategory = 0 } = model || {};\n const { answers = [] } = session || {};\n let newAnswers;\n if (draggedChoice) {\n log('[dropChoice] category: ', draggedChoice.categoryId, 'choice: ', draggedChoice);\n } else {\n log('[dropChoice] category: ', undefined, 'choice: ', undefined);\n }\n\n const answer = answers.find((answer) => answer.category === categoryId);\n\n // treat special case to replace the existing choice with the new one when maxChoicesPerCategory = 1\n if (draggedChoice && maxChoicesPerCategory === 1 && answer && answer.choices && answer.choices.length === 1) {\n // First, move the dragged choice to the target category (this will also remove it from source if allowMultiplePlacements is disabled)\n newAnswers = moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n );\n // Then, remove the existing choice from the target category (use newAnswers, not answers)\n newAnswers = removeChoiceFromCategory(answer.choices[0], categoryId, 0, newAnswers);\n }\n\n // treat special case when there are as many choices as maxChoicesPerCategory is\n else if (\n draggedChoice &&\n maxChoicesPerCategory > 1 &&\n answer &&\n answer.choices &&\n answer.choices.length === maxChoicesPerCategory\n ) {\n newAnswers = draggedChoice.categoryId\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n draggedChoice.categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : removeChoiceFromCategory(draggedChoice.id, draggedChoice.categoryId, draggedChoice.choiceIndex, answers);\n this.setState({ showMaxChoiceAlert: true });\n }\n\n // treat special case when there are more choices that maxChoicesPerCategory is (testing purpose in pits)\n else if (maxChoicesPerCategory !== 0 && answer && answer.choices && answer.choices.length > maxChoicesPerCategory) {\n newAnswers = answers;\n this.setState({ showMaxChoiceAlert: true });\n } else {\n newAnswers = draggedChoice\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : this.removeChoice(categoryId);\n }\n\n if (draggedChoice) {\n onAnswersChange(newAnswers);\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model } = this.props;\n const { model: nextModel } = nextProps;\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 (\n model.note &&\n model.language &&\n model.language !== nextModel.language &&\n model.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: model.language })\n ) {\n model.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n this.setState({ showCorrect: false });\n }\n\n toggleShowCorrect = () =>\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n this.props.onShowCorrectToggle();\n });\n\n getPositionDirection = (choicePosition) => {\n let flexDirection;\n\n switch (choicePosition) {\n case 'left':\n flexDirection = 'row-reverse';\n break;\n case 'right':\n flexDirection = 'row';\n break;\n case 'below':\n flexDirection = 'column';\n break;\n default:\n // above\n flexDirection = 'column-reverse';\n break;\n }\n\n return flexDirection;\n };\n\n existAlternateResponse = (correctResponse) =>\n correctResponse?.some((correctRes) => correctRes.alternateResponses?.length > 0);\n\n render() {\n const { model, session } = this.props;\n const { showCorrect, showMaxChoiceAlert } = this.state;\n const {\n choicesPosition,\n extraCSSRules,\n note,\n showNote,\n env,\n language,\n maxChoicesPerCategory,\n autoplayAudioEnabled,\n customAudioButton,\n } = model;\n const { mode, role } = env || {};\n const choicePosition = choicesPosition || 'above';\n\n const style = {\n flexDirection: this.getPositionDirection(choicePosition),\n gap: '8px',\n };\n\n const { categories, choices, correct } = buildState(\n model.categories,\n model.choices,\n showCorrect ? model.correctResponse : session.answers,\n model.correctResponse,\n );\n\n log('[render] disabled: ', model.disabled);\n\n const { rowLabels, categoriesPerRow, correctResponse, fontSizeFactor } = model;\n const nbOfRows = (categories && Math.ceil(categories.length / categoriesPerRow)) || 0;\n const existAlternate = this.existAlternateResponse(correctResponse) || false;\n const displayNote =\n (showCorrect || (mode === 'view' && role === 'instructor')) && showNote && note && existAlternate;\n const alertMessage = translator.t('translation:categorize:limitMaxChoicesPerCategory', {\n lng: model.language,\n maxChoicesPerCategory,\n });\n\n const alertTitle = translator.t('common:warning', {\n lng: model.language,\n });\n\n const onCloseText = translator.t('common:cancel', {\n lng: model.language,\n });\n\n const showRationale = model.rationale && (hasText(model.rationale) || hasMedia(model.rationale));\n const showTeacherInstructions =\n model.teacherInstructions && (hasText(model.teacherInstructions) || hasMedia(model.teacherInstructions));\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules} id={'main-container'} fontSizeFactor={fontSizeFactor}>\n {showTeacherInstructions && (\n <React.Fragment>\n <StyledCollapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={model.teacherInstructions} />\n </StyledCollapsible>\n </React.Fragment>\n )}\n\n {model.prompt && (\n <PreviewPrompt\n prompt={model.prompt}\n autoplayAudioEnabled={autoplayAudioEnabled}\n customAudioButton={customAudioButton}\n />\n )}\n\n <CorrectAnswerToggle\n show={showCorrect || correct === false}\n toggled={showCorrect}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n\n <StyledCategorize style={style}>\n <div style={{ display: 'flex', flex: 1 }}>\n <Categories\n model={model}\n disabled={model.disabled}\n categories={categories}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n rowLabels={(rowLabels || []).slice(0, nbOfRows)}\n />\n </div>\n <Choices\n disabled={model.disabled}\n model={model}\n choices={choices}\n choicePosition={choicePosition}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n correct={correct}\n />\n </StyledCategorize>\n {displayNote && (\n <StyledNote\n dangerouslySetInnerHTML={{\n __html: note,\n }}\n />\n )}\n\n {showRationale && (\n <StyledCollapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={model.rationale} />\n </StyledCollapsible>\n )}\n\n {model.correctness && model.feedback && !showCorrect && (\n <Feedback correctness={model.correctness} feedback={model.feedback} />\n )}\n <AlertDialog\n title={alertTitle}\n text={alertMessage}\n open={showMaxChoiceAlert}\n onCloseText={onCloseText}\n onClose={() => this.setState({ showMaxChoiceAlert: false })}\n ></AlertDialog>\n </StyledUiLayout>\n );\n }\n}\n\nclass CategorizeProvider extends React.Component {\n constructor(props) {\n super(props);\n this.uid = uid.generateId();\n this.state = {\n activeDragItem: null,\n isValidDrop: false,\n };\n }\n\n onDragStart = (event) => {\n const { active } = event;\n const { pauseMathObserver } = this.props;\n\n if (pauseMathObserver) {\n pauseMathObserver();\n }\n\n if (active?.data?.current) {\n this.setState({\n activeDragItem: active.data.current,\n isValidDrop: false,\n });\n }\n };\n\n onDragEnd = (event) => {\n const { active, over } = event;\n const { resumeMathObserver } = this.props;\n\n // Check if drop is valid\n const draggedItem = active?.data?.current;\n const overData = over?.data?.current;\n const isValidDrop = \n over && \n active && \n draggedItem && \n draggedItem.type === 'choice' && \n overData && \n overData.itemType === 'categorize';\n\n this.setState({ \n activeDragItem: null,\n isValidDrop: isValidDrop,\n });\n\n if (resumeMathObserver) {\n resumeMathObserver();\n }\n\n if (!over || !active) {\n return;\n }\n\n if (draggedItem && draggedItem.type === 'choice') {\n const choiceData = {\n id: draggedItem.id,\n categoryId: draggedItem.categoryId,\n choiceIndex: draggedItem.choiceIndex,\n value: draggedItem.value,\n itemType: draggedItem.itemType,\n };\n\n if (over.id === 'choices-board') {\n if (this.categorizeRef && this.categorizeRef.removeChoice && draggedItem.categoryId) {\n this.categorizeRef.removeChoice(choiceData);\n }\n } else {\n const categoryId = over.id;\n\n if (this.categorizeRef && this.categorizeRef.dropChoice) {\n this.categorizeRef.dropChoice(categoryId, choiceData);\n }\n }\n }\n };\n\n renderDragOverlay = () => {\n const { activeDragItem } = this.state;\n const { model } = this.props;\n\n if (!activeDragItem) return null;\n\n if (activeDragItem.type === 'choice') {\n const choice = model.choices?.find((c) => c.id === activeDragItem.id);\n if (choice) {\n return <Choice key={choice.id} id={choice.id} {...choice} />;\n }\n }\n\n return null;\n };\n\n render() {\n const { isValidDrop } = this.state;\n // Disable drop animation for valid drops to prevent visual snap-back\n // Keep default animation for invalid drops to show visual feedback\n const dropAnimation = isValidDrop ? null : undefined;\n \n return (\n <DragProvider onDragStart={this.onDragStart} onDragEnd={this.onDragEnd}>\n <uid.Provider value={this.uid}>\n <Categorize ref={(ref) => (this.categorizeRef = ref)} {...this.props} />\n <DragOverlay dropAnimation={dropAnimation}>\n <DragPreviewWrapper>{this.renderDragOverlay()}</DragPreviewWrapper>\n </DragOverlay>\n </uid.Provider>\n </DragProvider>\n );\n }\n}\n\nconst StyledUiLayout = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n position: 'relative',\n});\n\nconst StyledNote = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst StyledCategorize = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(1),\n display: 'flex',\n flexDirection: 'column',\n}));\n\nconst StyledColl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/B,CAAC,CAAC,CAAC;AAEH,MAAM9D,gBAAgB,GAAG,IAAAsD,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEM;AAAM,CAAC,MAAM;EACrDC,YAAY,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC;EAC9B7D,OAAO,EAAE,MAAM;EACf1D,aAAa,EAAE;AACjB,CAAC,CAAC,CAAC;AAEH,MAAM+C,iBAAiB,GAAG,IAAAgE,cAAM,EAACS,qBAAW,CAAC,CAAC,CAAC;EAAEH;AAAM,CAAC,MAAM;EAC5DI,aAAa,EAAEJ,KAAK,CAACE,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAAC,IAAAG,QAAA,GAAA/C,OAAA,CAAAjH,OAAA,GAEW4H,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_styles","_core","_correctAnswerToggle","_categorize","_drag","_renderUi","_mathRendering","_translator","_configUi","_choices","_choice","_categories","translator","Translator","log","debug","DragPreviewWrapper","React","Component","constructor","args","_defineProperty2","default","createRef","componentDidMount","containerRef","current","renderMath","render","createElement","ref","props","children","PropTypes","node","Categorize","c","onAnswersChange","session","answers","removeChoiceFromCategory","id","categoryId","choiceIndex","draggedChoice","model","maxChoicesPerCategory","newAnswers","undefined","answer","find","category","choices","length","moveChoiceToCategory","setState","showMaxChoiceAlert","removeChoice","showCorrect","state","onShowCorrectToggle","choicePosition","flexDirection","correctResponse","some","correctRes","alternateResponses","UNSAFE_componentWillReceiveProps","nextProps","nextModel","note","language","t","lng","choicesPosition","extraCSSRules","showNote","env","autoplayAudioEnabled","customAudioButton","mode","role","style","getPositionDirection","gap","categories","correct","buildState","disabled","rowLabels","categoriesPerRow","fontSizeFactor","nbOfRows","Math","ceil","existAlternate","existAlternateResponse","displayNote","alertMessage","alertTitle","onCloseText","showRationale","rationale","hasText","hasMedia","showTeacherInstructions","teacherInstructions","StyledUiLayout","Fragment","StyledCollapsible","labels","hidden","visible","PreviewPrompt","prompt","show","toggled","onToggle","toggleShowCorrect","StyledCategorize","display","flex","onDropChoice","dropChoice","onRemoveChoice","slice","StyledNote","dangerouslySetInnerHTML","__html","correctness","feedback","Feedback","AlertDialog","title","text","open","onClose","exports","object","shape","arrayOf","choice","string","func","isRequired","pauseMathObserver","resumeMathObserver","CategorizeProvider","event","active","data","activeDragItem","isValidDrop","over","draggedItem","overData","type","itemType","choiceData","value","categorizeRef","_extends2","key","uid","generateId","dropAnimation","DragProvider","onDragStart","onDragEnd","Provider","DragOverlay","renderDragOverlay","styled","UiLayout","color","backgroundColor","background","position","theme","marginBottom","spacing","Collapsible","paddingBottom","_default"],"sources":["../../src/categorize/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { DragOverlay } from '@dnd-kit/core';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { buildState, removeChoiceFromCategory, moveChoiceToCategory } from '@pie-lib/categorize';\nimport { DragProvider, uid } from '@pie-lib/drag';\nimport { color, Feedback, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport Choices from './choices';\nimport Choice from './choice';\nimport Categories from './categories';\n\nconst { translator } = Translator;\nconst log = debug('@pie-ui:categorize');\n\nclass DragPreviewWrapper extends React.Component {\n static propTypes = {\n children: PropTypes.node,\n };\n \n containerRef = React.createRef();\n\n componentDidMount() {\n if (this.containerRef.current) {\n renderMath(this.containerRef.current);\n }\n }\n\n render() {\n return <div ref={this.containerRef}>{this.props.children}</div>;\n }\n}\n\nexport class Categorize extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.shape({\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n choice: PropTypes.string,\n category: PropTypes.string,\n }),\n ),\n }),\n onAnswersChange: PropTypes.func.isRequired,\n onShowCorrectToggle: PropTypes.func.isRequired,\n pauseMathObserver: PropTypes.func,\n resumeMathObserver: PropTypes.func,\n };\n\n static defaultProps = {\n disabled: false,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: false,\n showMaxChoiceAlert: false,\n };\n }\n\n removeChoice = (c) => {\n log('[removeChoice]: ', c);\n const { onAnswersChange, session } = this.props;\n const answers = removeChoiceFromCategory(c.id, c.categoryId, c.choiceIndex, session.answers);\n onAnswersChange(answers);\n };\n\n dropChoice = (categoryId, draggedChoice) => {\n const { session, onAnswersChange, model } = this.props;\n const { maxChoicesPerCategory = 0 } = model || {};\n const { answers = [] } = session || {};\n let newAnswers;\n if (draggedChoice) {\n log('[dropChoice] category: ', draggedChoice.categoryId, 'choice: ', draggedChoice);\n } else {\n log('[dropChoice] category: ', undefined, 'choice: ', undefined);\n }\n\n const answer = answers.find((answer) => answer.category === categoryId);\n\n // treat special case to replace the existing choice with the new one when maxChoicesPerCategory = 1\n if (draggedChoice && maxChoicesPerCategory === 1 && answer && answer.choices && answer.choices.length === 1) {\n // First, move the dragged choice to the target category (this will also remove it from source if allowMultiplePlacements is disabled)\n newAnswers = moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n );\n // Then, remove the existing choice from the target category (use newAnswers, not answers)\n newAnswers = removeChoiceFromCategory(answer.choices[0], categoryId, 0, newAnswers);\n }\n\n // treat special case when there are as many choices as maxChoicesPerCategory is\n else if (\n draggedChoice &&\n maxChoicesPerCategory > 1 &&\n answer &&\n answer.choices &&\n answer.choices.length === maxChoicesPerCategory\n ) {\n newAnswers = draggedChoice.categoryId\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n draggedChoice.categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : removeChoiceFromCategory(draggedChoice.id, draggedChoice.categoryId, draggedChoice.choiceIndex, answers);\n this.setState({ showMaxChoiceAlert: true });\n }\n\n // treat special case when there are more choices that maxChoicesPerCategory is (testing purpose in pits)\n else if (maxChoicesPerCategory !== 0 && answer && answer.choices && answer.choices.length > maxChoicesPerCategory) {\n newAnswers = answers;\n this.setState({ showMaxChoiceAlert: true });\n } else {\n newAnswers = draggedChoice\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n answers,\n )\n : this.removeChoice(categoryId);\n }\n\n if (draggedChoice) {\n onAnswersChange(newAnswers);\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model } = this.props;\n const { model: nextModel } = nextProps;\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 (\n model.note &&\n model.language &&\n model.language !== nextModel.language &&\n model.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: model.language })\n ) {\n model.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n this.setState({ showCorrect: false });\n }\n\n toggleShowCorrect = () =>\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n this.props.onShowCorrectToggle();\n });\n\n getPositionDirection = (choicePosition) => {\n let flexDirection;\n\n switch (choicePosition) {\n case 'left':\n flexDirection = 'row-reverse';\n break;\n case 'right':\n flexDirection = 'row';\n break;\n case 'below':\n flexDirection = 'column';\n break;\n default:\n // above\n flexDirection = 'column-reverse';\n break;\n }\n\n return flexDirection;\n };\n\n existAlternateResponse = (correctResponse) =>\n correctResponse?.some((correctRes) => correctRes.alternateResponses?.length > 0);\n\n render() {\n const { model, session } = this.props;\n const { showCorrect, showMaxChoiceAlert } = this.state;\n const {\n choicesPosition,\n extraCSSRules,\n note,\n showNote,\n env,\n language,\n maxChoicesPerCategory,\n autoplayAudioEnabled,\n customAudioButton,\n } = model;\n const { mode, role } = env || {};\n const choicePosition = choicesPosition || 'above';\n\n const style = {\n flexDirection: this.getPositionDirection(choicePosition),\n gap: '8px',\n };\n\n const { categories, choices, correct } = buildState(\n model.categories,\n model.choices,\n showCorrect ? model.correctResponse : session.answers,\n model.correctResponse,\n );\n\n log('[render] disabled: ', model.disabled);\n\n const { rowLabels, categoriesPerRow, correctResponse, fontSizeFactor } = model;\n const nbOfRows = (categories && Math.ceil(categories.length / categoriesPerRow)) || 0;\n const existAlternate = this.existAlternateResponse(correctResponse) || false;\n const displayNote =\n (showCorrect || (mode === 'view' && role === 'instructor')) && showNote && note && existAlternate;\n const alertMessage = translator.t('translation:categorize:limitMaxChoicesPerCategory', {\n lng: model.language,\n maxChoicesPerCategory,\n });\n\n const alertTitle = translator.t('common:warning', {\n lng: model.language,\n });\n\n const onCloseText = translator.t('common:cancel', {\n lng: model.language,\n });\n\n const showRationale = model.rationale && (hasText(model.rationale) || hasMedia(model.rationale));\n const showTeacherInstructions =\n model.teacherInstructions && (hasText(model.teacherInstructions) || hasMedia(model.teacherInstructions));\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules} id={'main-container'} fontSizeFactor={fontSizeFactor}>\n {showTeacherInstructions && (\n <React.Fragment>\n <StyledCollapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={model.teacherInstructions} />\n </StyledCollapsible>\n </React.Fragment>\n )}\n\n {model.prompt && (\n <PreviewPrompt\n prompt={model.prompt}\n autoplayAudioEnabled={autoplayAudioEnabled}\n customAudioButton={customAudioButton}\n />\n )}\n\n <CorrectAnswerToggle\n show={showCorrect || correct === false}\n toggled={showCorrect}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n\n <StyledCategorize style={style}>\n <div style={{ display: 'flex', flex: 1 }}>\n <Categories\n model={model}\n disabled={model.disabled}\n categories={categories}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n rowLabels={(rowLabels || []).slice(0, nbOfRows)}\n />\n </div>\n <Choices\n disabled={model.disabled}\n model={model}\n choices={choices}\n choicePosition={choicePosition}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\n correct={correct}\n />\n </StyledCategorize>\n {displayNote && (\n <StyledNote\n dangerouslySetInnerHTML={{\n __html: note,\n }}\n />\n )}\n\n {showRationale && (\n <StyledCollapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={model.rationale} />\n </StyledCollapsible>\n )}\n\n {model.correctness && model.feedback && !showCorrect && (\n <Feedback correctness={model.correctness} feedback={model.feedback} />\n )}\n <AlertDialog\n title={alertTitle}\n text={alertMessage}\n open={showMaxChoiceAlert}\n onCloseText={onCloseText}\n onClose={() => this.setState({ showMaxChoiceAlert: false })}\n ></AlertDialog>\n </StyledUiLayout>\n );\n }\n}\n\nclass CategorizeProvider extends React.Component {\n static propTypes = {\n model: PropTypes.object,\n session: PropTypes.shape({\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n choice: PropTypes.string,\n category: PropTypes.string,\n }),\n ),\n }),\n onAnswersChange: PropTypes.func.isRequired,\n onShowCorrectToggle: PropTypes.func.isRequired,\n pauseMathObserver: PropTypes.func,\n resumeMathObserver: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n this.uid = uid.generateId();\n this.state = {\n activeDragItem: null,\n isValidDrop: false,\n };\n }\n\n onDragStart = (event) => {\n const { active } = event;\n const { pauseMathObserver } = this.props;\n\n if (pauseMathObserver) {\n pauseMathObserver();\n }\n\n if (active?.data?.current) {\n this.setState({\n activeDragItem: active.data.current,\n isValidDrop: false,\n });\n }\n };\n\n onDragEnd = (event) => {\n const { active, over } = event;\n const { resumeMathObserver } = this.props;\n\n // Check if drop is valid\n const draggedItem = active?.data?.current;\n const overData = over?.data?.current;\n const isValidDrop = \n over && \n active && \n draggedItem && \n draggedItem.type === 'choice' && \n overData && \n overData.itemType === 'categorize';\n\n this.setState({ \n activeDragItem: null,\n isValidDrop: isValidDrop,\n });\n\n if (resumeMathObserver) {\n resumeMathObserver();\n }\n\n if (!over || !active) {\n return;\n }\n\n if (draggedItem && draggedItem.type === 'choice') {\n const choiceData = {\n id: draggedItem.id,\n categoryId: draggedItem.categoryId,\n choiceIndex: draggedItem.choiceIndex,\n value: draggedItem.value,\n itemType: draggedItem.itemType,\n };\n\n if (over.id === 'choices-board') {\n if (this.categorizeRef && this.categorizeRef.removeChoice && draggedItem.categoryId) {\n this.categorizeRef.removeChoice(choiceData);\n }\n } else {\n const categoryId = over.id;\n\n if (this.categorizeRef && this.categorizeRef.dropChoice) {\n this.categorizeRef.dropChoice(categoryId, choiceData);\n }\n }\n }\n };\n\n renderDragOverlay = () => {\n const { activeDragItem } = this.state;\n const { model } = this.props;\n\n if (!activeDragItem) return null;\n\n if (activeDragItem.type === 'choice') {\n const choice = model.choices?.find((c) => c.id === activeDragItem.id);\n if (choice) {\n return <Choice key={choice.id} id={choice.id} {...choice} />;\n }\n }\n\n return null;\n };\n\n render() {\n const { isValidDrop } = this.state;\n // Disable drop animation for valid drops to prevent visual snap-back\n // Keep default animation for invalid drops to show visual feedback\n const dropAnimation = isValidDrop ? null : undefined;\n \n return (\n <DragProvider onDragStart={this.onDragStart} onDragEnd={this.onDragEnd}>\n <uid.Provider value={this.uid}>\n <Categorize ref={(ref) => (this.categorizeRef = ref)} {...this.props} />\n <DragOverlay dropAnimation={dropAnimation}>\n <DragPreviewWrapper>{this.renderDragOverlay()}</DragPreviewWrapper>\n </DragOverlay>\n </uid.Provider>\n </DragProvider>\n );\n }\n}\n\nconst StyledUiLayout = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n position: 'relative',\n});\n\nconst StyledNote = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst StyledCategorize = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(1),\n display: 'flex',\n flexDirection: 'column',\n}));\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nexport default CategorizeProvider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8
8
  "description": "",
9
9
  "author": "pie framework developers",
10
10
  "license": "ISC",
@@ -16,7 +16,7 @@
16
16
  "@mui/material": "^7.3.4",
17
17
  "@pie-framework/pie-player-events": "^0.1.0",
18
18
  "@pie-lib/categorize": "1.2.0-next.3",
19
- "@pie-lib/config-ui": "12.2.0-next.13",
19
+ "@pie-lib/config-ui": "12.2.0-next.17",
20
20
  "@pie-lib/correct-answer-toggle": "3.2.0-next.4",
21
21
  "@pie-lib/drag": "3.2.0-next.4",
22
22
  "@pie-lib/math-rendering": "4.2.0-next.3",
@@ -28,7 +28,7 @@
28
28
  "react": "18.3.1",
29
29
  "react-dom": "18.3.1"
30
30
  },
31
- "gitHead": "a8b257ceb051bf973d80b1ae19138ae99117346b",
31
+ "gitHead": "d73b4baeb204e75095024baab5dc99182023301e",
32
32
  "scripts": {
33
33
  "postpublish": "../../scripts/postpublish"
34
34
  },