@pie-element/multi-trait-rubric 6.1.0 → 6.2.0-mui-update.1
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 +11 -0
- package/configure/CHANGELOG.md +11 -0
- package/configure/lib/common.js +379 -534
- package/configure/lib/common.js.map +1 -1
- package/configure/lib/defaults.js +35 -6
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +96 -162
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +346 -437
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/modals.js +178 -333
- package/configure/lib/modals.js.map +1 -1
- package/configure/lib/scale.js +358 -463
- package/configure/lib/scale.js.map +1 -1
- package/configure/lib/trait.js +253 -358
- package/configure/lib/trait.js.map +1 -1
- package/configure/lib/traitsHeader.js +201 -264
- package/configure/lib/traitsHeader.js.map +1 -1
- package/configure/lib/utils.js +42 -73
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +12 -9
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +66 -123
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +1 -3
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/index.js +40 -77
- package/lib/index.js.map +1 -1
- package/lib/main.js +99 -140
- package/lib/main.js.map +1 -1
- package/lib/scale.js +217 -299
- package/lib/scale.js.map +1 -1
- package/lib/trait.js +51 -71
- package/lib/trait.js.map +1 -1
- package/package.json +15 -8
- package/LICENSE.md +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/traitsHeader.jsx"],"names":["styles","theme","label","textAlign","width","border","margin","spacing","unit","padding","display","alignItems","justifyContent","greyHeader","background","color","secondaryBackground","borderRadius","position","marginBottom","primaryBlockGreyHeader","paddingTop","scorePointErrorText","fontSize","typography","palette","error","main","TraitsHeaderTile","anchorEl","scorePointLabel","value","props","scorePointsLabels","onScaleChange","length","event","setState","currentTarget","secondaryBlock","scrollTo","left","showDeleteScaleModal","handleClose","nextProps","currentPosition","scrollToPosition","scorePointsValues","traitLabel","classes","showStandards","onTraitLabelChange","showDescription","showLevelTagInput","maxPoints","updateMaxPointsFieldValue","scaleIndex","showScorePointLabels","secondaryBlockWidth","setSecondaryBlockRef","spellCheck","uploadSoundSupport","maxPointsEnabled","mathMlOptions","errors","maxMaxPoints","labelPluginProps","imageSupport","state","HeaderHeightLarge","HeaderHeight","handleClick","map","option","openMenu","ref","scorePointsValue","index","adjustedBlockWidth","BlockWidth","remainingSpace","scoreDescriptor","e","onScorePointLabelChange","React","Component","PropTypes","bool","object","propTypes","isRequired","func","arrayOf","number","string","shape","add"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAcA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,SAAS,EAAE,QADN;AAELC,MAAAA,KAAK,EAAE,OAFF;AAGLC,MAAAA,MAAM,EAAE,MAHH;AAILC,MAAAA,MAAM,EAAEL,KAAK,CAACM,OAAN,CAAcC,IAJjB;AAKLC,MAAAA,OAAO,EAAE,QALJ;AAMLC,MAAAA,OAAO,EAAE,MANJ;AAOLC,MAAAA,UAAU,EAAE,QAPP;AAQLC,MAAAA,cAAc,EAAE;AARX,KADkB;AAWzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,UAAU,EAAEC,gBAAMC,mBAAN,EADF;AAEVC,MAAAA,YAAY,EAAE,KAFJ;AAGVC,MAAAA,QAAQ,EAAE,UAHA;AAIVC,MAAAA,YAAY,EAAElB,KAAK,CAACM,OAAN,CAAcC,IAAd,GAAqB;AAJzB,KAXa;AAiBzBY,IAAAA,sBAAsB,EAAE;AACtBC,MAAAA,UAAU,EA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AEoC,sBAAUC,IAPE;AAQ3BlC,EAAAA,iBAAiB,EAAEiC,sBAAUC,IARF;AAS3BnC,EAAAA,eAAe,EAAEkC,sBAAUC,IATA;AAU3BjC,EAAAA,SAAS,EAAEgC,sBAAUO,MAVM;AAW3BtC,EAAAA,yBAAyB,EAAE+B,sBAAUK,IAXV;AAY3BnC,EAAAA,UAAU,EAAE8B,sBAAUO,MAZK;AAa3BhD,EAAAA,eAAe,EAAEyC,sBAAUO,MAbA;AAc3BnC,EAAAA,mBAAmB,EAAE4B,sBAAUO,MAdJ;AAe3BnD,EAAAA,oBAAoB,EAAE4C,sBAAUK,IAfL;AAgB3BlC,EAAAA,oBAAoB,EAAE6B,sBAAUC,IAhBL;AAiB3B5B,EAAAA,oBAAoB,EAAE2B,sBAAUK,IAjBL;AAkB3B9B,EAAAA,kBAAkB,EAAEyB,sBAAUE,MAlBH;AAmB3BvB,EAAAA,YAAY,EAAEqB,sBAAUO,MAnBG;AAoB3B3B,EAAAA,gBAAgB,EAAEoB,sBAAUE,MApBD;AAqB3BrB,EAAAA,YAAY,EAAEmB,sBAAUS,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEV,sBAAUK,IAAV,CAAeD,UADQ;AAE5B,cAAQJ,sBAAUK,IAAV,CAAeD;AAFK,GAAhB;AArBa,CAA7B;;eA2Be,wBAAW1F,MAAX,EAAmB4B,gBAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport { color } from '@pie-lib/render-ui';\n\nimport {\n Block,\n BlockWidth,\n PrimaryBlock,\n Row,\n SecondaryBlock,\n ScorePoint,\n MaxPointsPicker,\n SimpleInput,\n ScaleSettings,\n HeaderHeight,\n HeaderHeightLarge,\n} from './common';\n\nconst styles = (theme) => ({\n label: {\n textAlign: 'center',\n width: '140px',\n border: 'none',\n margin: theme.spacing.unit,\n padding: '10px 0',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-around',\n },\n greyHeader: {\n background: color.secondaryBackground(),\n borderRadius: '4px',\n position: 'relative',\n marginBottom: theme.spacing.unit * 2,\n },\n primaryBlockGreyHeader: {\n paddingTop: theme.spacing.unit * 1.5,\n },\n scorePointErrorText: {\n position: 'absolute',\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit / 2,\n },\n});\n\nexport class TraitsHeaderTile extends React.Component {\n static propTypes = {\n maxPointsEnabled: PropTypes.bool,\n spellCheck: PropTypes.bool,\n errors: PropTypes.object,\n };\n\n state = {\n anchorEl: null,\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (nextProps.currentPosition !== this.props.currentPosition) {\n this.scrollToPosition(nextProps.currentPosition);\n }\n }\n\n onScorePointLabelChange = ({ scorePointLabel, value }) => {\n const { scorePointsLabels, onScaleChange } = this.props;\n\n if (value < 0 || value >= scorePointsLabels.length) return;\n\n scorePointsLabels[value] = scorePointLabel;\n\n onScaleChange({ scorePointsLabels });\n };\n\n handleClick = (event) => this.setState({ anchorEl: event.currentTarget });\n\n handleClose = () => this.setState({ anchorEl: null });\n\n scrollToPosition = (position) => this.secondaryBlock.scrollTo({ left: position });\n\n openMenu = () => {\n this.props.showDeleteScaleModal();\n this.handleClose();\n };\n\n render() {\n const {\n scorePointsValues,\n scorePointsLabels,\n traitLabel,\n classes,\n currentPosition,\n showStandards,\n onTraitLabelChange,\n showDescription,\n showLevelTagInput,\n maxPoints,\n updateMaxPointsFieldValue,\n scaleIndex,\n showScorePointLabels,\n secondaryBlockWidth,\n setSecondaryBlockRef,\n spellCheck,\n uploadSoundSupport,\n maxPointsEnabled,\n mathMlOptions = {},\n errors = {},\n maxMaxPoints,\n labelPluginProps = {},\n imageSupport = {},\n } = this.props;\n const { anchorEl } = this.state;\n\n return (\n <Row className={classes.greyHeader} height={showLevelTagInput ? HeaderHeightLarge : HeaderHeight}>\n <PrimaryBlock className={classes.primaryBlockGreyHeader}>\n {showLevelTagInput && (\n <SimpleInput\n markup={traitLabel || 'Trait'}\n onChange={onTraitLabelChange}\n pluginProps={labelPluginProps}\n spellCheck={spellCheck}\n label=\"Level Label\"\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n imageSupport={imageSupport}\n />\n )}\n\n <ScaleSettings>\n <div>Scale {scaleIndex + 1}</div>\n\n {maxPointsEnabled && (\n <MaxPointsPicker maxPoints={maxPoints} maxMaxPoints={maxMaxPoints} onChange={updateMaxPointsFieldValue} />\n )}\n\n <div>\n <IconButton aria-label=\"more\" aria-controls=\"long-menu\" aria-haspopup=\"true\" onClick={this.handleClick}>\n <MoreVertIcon />\n </IconButton>\n <Menu id=\"long-menu\" anchorEl={anchorEl} keepMounted open={!!anchorEl} onClose={this.handleClose}>\n {['Remove Scale'].map((option) => (\n <MenuItem key={option} onClick={this.openMenu}>\n {option}\n </MenuItem>\n ))}\n </Menu>\n </div>\n </ScaleSettings>\n </PrimaryBlock>\n\n <SecondaryBlock\n setRef={(ref) => {\n if (ref) {\n this.secondaryBlock = ref;\n setSecondaryBlockRef(ref);\n }\n }}\n width={`${secondaryBlockWidth}px`}\n >\n {showStandards && (\n <Block>\n <div className={classes.label}>Standard(s)</div>\n </Block>\n )}\n\n {showDescription && (\n <Block>\n <div className={classes.label}>Description</div>\n </Block>\n )}\n\n {scorePointsValues.map((scorePointsValue, index) => {\n const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding\n const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 128;\n const value = scorePointsValues.length - index - 1;\n let scoreDescriptor;\n let error;\n\n try {\n scoreDescriptor = scorePointsLabels[value] || '';\n error = errors[value] || '';\n } catch (e) {\n scoreDescriptor = '';\n }\n\n return (\n <Block key={`secondary-block-part-${index}`}>\n <ScorePoint\n scorePointsValue={scorePointsValue}\n error={error}\n scoreDescriptor={scoreDescriptor}\n pluginProps={labelPluginProps}\n showScorePointLabels={showScorePointLabels}\n onChange={(scorePointLabel) => this.onScorePointLabelChange({ scorePointLabel, value })}\n alignToRight={remainingSpace < 296 && scorePointsValue < maxPoints} // 296 is the space required for the toolbar\n spellCheck={spellCheck}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n imageSupport={imageSupport}\n />\n {error && <div className={classes.scorePointErrorText}>{error}</div>}\n </Block>\n );\n })}\n </SecondaryBlock>\n </Row>\n );\n }\n}\n\nTraitsHeaderTile.propTypes = {\n classes: PropTypes.object.isRequired,\n onTraitLabelChange: PropTypes.func,\n onScaleChange: PropTypes.func,\n scorePointsValues: PropTypes.arrayOf(PropTypes.number),\n scorePointsLabels: PropTypes.arrayOf(PropTypes.string),\n traitLabel: PropTypes.string,\n showStandards: PropTypes.bool,\n showLevelTagInput: PropTypes.bool,\n showDescription: PropTypes.bool,\n maxPoints: PropTypes.number,\n updateMaxPointsFieldValue: PropTypes.func,\n scaleIndex: PropTypes.number,\n currentPosition: PropTypes.number,\n secondaryBlockWidth: PropTypes.number,\n showDeleteScaleModal: PropTypes.func,\n showScorePointLabels: PropTypes.bool,\n setSecondaryBlockRef: PropTypes.func,\n uploadSoundSupport: PropTypes.object,\n maxMaxPoints: PropTypes.number,\n labelPluginProps: PropTypes.object,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n};\n\nexport default withStyles(styles)(TraitsHeaderTile);\n"],"file":"traitsHeader.js"}
|
|
1
|
+
{"version":3,"file":"traitsHeader.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_IconButton","_Menu","_MenuItem","_MoreVert","_renderUi","_common","Label","styled","theme","width","border","padding","display","alignItems","justifyContent","GreyHeaderRow","height","background","color","secondaryBackground","borderRadius","position","marginBottom","spacing","PrimaryBlockGreyHeader","PrimaryBlockWidth","minWidth","boxSizing","paddingTop","alignSelf","ScorePointErrorText","fontSize","typography","palette","error","main","TraitsHeaderTile","React","Component","constructor","args","_defineProperty2","default","anchorEl","scorePointLabel","value","scorePointsLabels","onScaleChange","props","length","event","setState","currentTarget","secondaryBlock","scrollTo","left","showDeleteScaleModal","handleClose","UNSAFE_componentWillReceiveProps","nextProps","currentPosition","scrollToPosition","render","scorePointsValues","traitLabel","showStandards","onTraitLabelChange","showDescription","showLevelTagInput","maxPoints","updateMaxPointsFieldValue","scaleIndex","showScorePointLabels","secondaryBlockWidth","setSecondaryBlockRef","spellCheck","uploadSoundSupport","maxPointsEnabled","mathMlOptions","errors","maxMaxPoints","labelPluginProps","imageSupport","state","createElement","HeaderHeightLarge","HeaderHeight","SimpleInput","markup","onChange","pluginProps","label","ScaleSettings","MaxPointsPicker","onClick","handleClick","size","id","keepMounted","open","onClose","transitionDuration","enter","exit","map","option","key","openMenu","SecondaryBlock","setRef","ref","Block","scorePointsValue","index","adjustedBlockWidth","BlockWidth","remainingSpace","scoreDescriptor","e","ScorePoint","onScorePointLabelChange","alignToRight","exports","PropTypes","bool","object","propTypes","func","arrayOf","number","string","shape","add","isRequired","delete","_default"],"sources":["../src/traitsHeader.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { styled } from '@mui/material/styles';\nimport IconButton from '@mui/material/IconButton';\nimport Menu from '@mui/material/Menu';\nimport MenuItem from '@mui/material/MenuItem';\nimport MoreVertIcon from '@mui/icons-material/MoreVert';\nimport { color } from '@pie-lib/render-ui';\n\nimport {\n Block,\n BlockWidth,\n PrimaryBlockWidth,\n SecondaryBlock,\n ScorePoint,\n MaxPointsPicker,\n SimpleInput,\n ScaleSettings,\n HeaderHeight,\n HeaderHeightLarge,\n} from './common';\n\nconst Label = styled('div')(({ theme }) => ({\n width: '140px',\n border: 'none',\n padding: '10px 0',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-around',\n}));\n\nconst GreyHeaderRow = styled('div')(({ height, theme }) => ({\n background: color.secondaryBackground(),\n borderRadius: '4px',\n position: 'relative',\n marginBottom: theme.spacing(2),\n display: 'flex',\n height: height,\n}));\n\nconst PrimaryBlockGreyHeader = styled('div')(({ theme }) => ({\n width: `${PrimaryBlockWidth}px`,\n minWidth: `${PrimaryBlockWidth}px`,\n position: 'relative',\n padding: '0 10px',\n boxSizing: 'border-box',\n paddingTop: theme.spacing(1.5),\n alignSelf: 'center'\n}));\n\nconst ScorePointErrorText = styled('div')(({ theme }) => ({\n position: 'absolute',\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(0.5),\n}));\n\nexport class TraitsHeaderTile extends React.Component {\n static propTypes = {\n maxPointsEnabled: PropTypes.bool,\n spellCheck: PropTypes.bool,\n errors: PropTypes.object,\n };\n\n state = {\n anchorEl: null,\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (nextProps.currentPosition !== this.props.currentPosition) {\n this.scrollToPosition(nextProps.currentPosition);\n }\n }\n\n onScorePointLabelChange = ({ scorePointLabel, value }) => {\n const { scorePointsLabels, onScaleChange } = this.props;\n\n if (value < 0 || value >= scorePointsLabels.length) return;\n\n scorePointsLabels[value] = scorePointLabel;\n\n onScaleChange({ scorePointsLabels });\n };\n\n handleClick = (event) => this.setState({ anchorEl: event.currentTarget });\n\n handleClose = () => this.setState({ anchorEl: null });\n\n scrollToPosition = (position) => this.secondaryBlock.scrollTo({ left: position });\n\n openMenu = () => {\n this.props.showDeleteScaleModal();\n this.handleClose();\n };\n\n render() {\n const {\n scorePointsValues,\n scorePointsLabels,\n traitLabel,\n currentPosition,\n showStandards,\n onTraitLabelChange,\n showDescription,\n showLevelTagInput,\n maxPoints,\n updateMaxPointsFieldValue,\n scaleIndex,\n showScorePointLabels,\n secondaryBlockWidth,\n setSecondaryBlockRef,\n spellCheck,\n uploadSoundSupport,\n maxPointsEnabled,\n mathMlOptions = {},\n errors = {},\n maxMaxPoints,\n labelPluginProps = {},\n imageSupport = {},\n } = this.props;\n const { anchorEl } = this.state;\n\n return (\n <GreyHeaderRow height={showLevelTagInput ? HeaderHeightLarge : HeaderHeight}>\n <PrimaryBlockGreyHeader>\n {showLevelTagInput && (\n <SimpleInput\n markup={traitLabel || 'Trait'}\n onChange={onTraitLabelChange}\n pluginProps={labelPluginProps}\n spellCheck={spellCheck}\n label=\"Level Label\"\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n imageSupport={imageSupport}\n />\n )}\n\n <ScaleSettings>\n <div>Scale {scaleIndex + 1}</div>\n\n {maxPointsEnabled && (\n <MaxPointsPicker maxPoints={maxPoints} maxMaxPoints={maxMaxPoints} onChange={updateMaxPointsFieldValue} />\n )}\n\n <div>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={this.handleClick}\n size=\"large\">\n <MoreVertIcon />\n </IconButton>\n <Menu\n id=\"long-menu\"\n anchorEl={anchorEl}\n keepMounted\n open={!!anchorEl}\n onClose={this.handleClose}\n transitionDuration={{ enter: 225, exit: 195 }}\n >\n {['Remove Scale'].map((option) => (\n <MenuItem key={option} onClick={this.openMenu}>\n {option}\n </MenuItem>\n ))}\n </Menu>\n </div>\n </ScaleSettings>\n </PrimaryBlockGreyHeader>\n <SecondaryBlock\n setRef={(ref) => {\n if (ref) {\n this.secondaryBlock = ref;\n setSecondaryBlockRef(ref);\n }\n }}\n width={`${secondaryBlockWidth}px`}\n >\n {showStandards && (\n <Block>\n <Label>Standard(s)</Label>\n </Block>\n )}\n\n {showDescription && (\n <Block>\n <Label>Description</Label>\n </Block>\n )}\n\n {scorePointsValues.map((scorePointsValue, index) => {\n const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding\n const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 128;\n const value = scorePointsValues.length - index - 1;\n let scoreDescriptor;\n let error;\n\n try {\n scoreDescriptor = scorePointsLabels[value] || '';\n error = errors[value] || '';\n } catch (e) {\n scoreDescriptor = '';\n }\n\n return (\n <Block key={`secondary-block-part-${index}`}>\n <ScorePoint\n scorePointsValue={scorePointsValue}\n error={error}\n scoreDescriptor={scoreDescriptor}\n pluginProps={labelPluginProps}\n showScorePointLabels={showScorePointLabels}\n onChange={(scorePointLabel) => this.onScorePointLabelChange({ scorePointLabel, value })}\n alignToRight={remainingSpace < 296 && scorePointsValue < maxPoints} // 296 is the space required for the toolbar\n spellCheck={spellCheck}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n imageSupport={imageSupport}\n />\n {error && <ScorePointErrorText>{error}</ScorePointErrorText>}\n </Block>\n );\n })}\n </SecondaryBlock>\n </GreyHeaderRow>\n );\n }\n}\n\nTraitsHeaderTile.propTypes = {\n onTraitLabelChange: PropTypes.func,\n onScaleChange: PropTypes.func,\n scorePointsValues: PropTypes.arrayOf(PropTypes.number),\n scorePointsLabels: PropTypes.arrayOf(PropTypes.string),\n traitLabel: PropTypes.string,\n showStandards: PropTypes.bool,\n showLevelTagInput: PropTypes.bool,\n showDescription: PropTypes.bool,\n maxPoints: PropTypes.number,\n updateMaxPointsFieldValue: PropTypes.func,\n scaleIndex: PropTypes.number,\n currentPosition: PropTypes.number,\n secondaryBlockWidth: PropTypes.number,\n showDeleteScaleModal: PropTypes.func,\n showScorePointLabels: PropTypes.bool,\n setSecondaryBlockRef: PropTypes.func,\n uploadSoundSupport: PropTypes.object,\n maxMaxPoints: PropTypes.number,\n labelPluginProps: PropTypes.object,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n};\n\nexport default TraitsHeaderTile;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,K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DlE,UAAU,EAAE2D,kBAAS,CAACO,MAAM;EAC5BjE,aAAa,EAAE0D,kBAAS,CAACC,IAAI;EAC7BxD,iBAAiB,EAAEuD,kBAAS,CAACC,IAAI;EACjCzD,eAAe,EAAEwD,kBAAS,CAACC,IAAI;EAC/BvD,SAAS,EAAEsD,kBAAS,CAACM,MAAM;EAC3B3D,yBAAyB,EAAEqD,kBAAS,CAACI,IAAI;EACzCxD,UAAU,EAAEoD,kBAAS,CAACM,MAAM;EAC5BrE,eAAe,EAAE+D,kBAAS,CAACM,MAAM;EACjCxD,mBAAmB,EAAEkD,kBAAS,CAACM,MAAM;EACrCzE,oBAAoB,EAAEmE,kBAAS,CAACI,IAAI;EACpCvD,oBAAoB,EAAEmD,kBAAS,CAACC,IAAI;EACpClD,oBAAoB,EAAEiD,kBAAS,CAACI,IAAI;EACpCnD,kBAAkB,EAAE+C,kBAAS,CAACE,MAAM;EACpC7C,YAAY,EAAE2C,kBAAS,CAACM,MAAM;EAC9BhD,gBAAgB,EAAE0C,kBAAS,CAACE,MAAM;EAClC3C,YAAY,EAAEyC,kBAAS,CAACQ,KAAK,CAAC;IAC5BC,GAAG,EAAET,kBAAS,CAACI,IAAI,CAACM,UAAU;IAC9BC,MAAM,EAAEX,kBAAS,CAACI,IAAI,CAACM;EACzB,CAAC;AACH,CAAC;AAAC,IAAAE,QAAA,GAAAb,OAAA,CAAAhF,OAAA,GAEaN,gBAAgB","ignoreList":[]}
|
package/configure/lib/utils.js
CHANGED
|
@@ -1,118 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.filteredDefaultPlugins = exports.addOrRemoveScaleColumn = void 0;
|
|
9
|
-
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
7
|
var _editableHtml = require("@pie-lib/editable-html");
|
|
17
|
-
|
|
18
8
|
var _modals = require("./modals");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_excluded2 = ["scorePointsDescriptors"],
|
|
22
|
-
_excluded3 = ["scorePointsDescriptors"],
|
|
23
|
-
_excluded4 = ["scorePointsDescriptors"];
|
|
24
|
-
|
|
25
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
-
|
|
27
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
28
|
-
|
|
29
|
-
var filteredDefaultPlugins = (_editableHtml.DEFAULT_PLUGINS || []).filter(function (p) {
|
|
30
|
-
return p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list';
|
|
31
|
-
});
|
|
32
|
-
exports.filteredDefaultPlugins = filteredDefaultPlugins;
|
|
33
|
-
|
|
34
|
-
var addOrRemoveScaleColumn = function addOrRemoveScaleColumn(scales, excludeZeroType) {
|
|
9
|
+
const filteredDefaultPlugins = exports.filteredDefaultPlugins = (_editableHtml.DEFAULT_PLUGINS || []).filter(p => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list');
|
|
10
|
+
const addOrRemoveScaleColumn = (scales, excludeZeroType) => {
|
|
35
11
|
if (!scales || !scales.length) {
|
|
36
12
|
return [];
|
|
37
13
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
14
|
+
return scales.reduce((acc, scale) => {
|
|
15
|
+
let {
|
|
16
|
+
scorePointsLabels,
|
|
17
|
+
traits
|
|
18
|
+
} = scale || {};
|
|
44
19
|
if (scorePointsLabels.length < 1) {
|
|
45
20
|
return acc;
|
|
46
21
|
}
|
|
47
|
-
|
|
48
22
|
switch (excludeZeroType) {
|
|
49
23
|
case _modals.excludeZeroTypes.remove0:
|
|
50
24
|
{
|
|
51
25
|
// removes column 0
|
|
52
26
|
scorePointsLabels = scorePointsLabels.slice(1);
|
|
53
|
-
traits = traits.map(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
27
|
+
traits = traits.map(({
|
|
28
|
+
scorePointsDescriptors,
|
|
29
|
+
...trait
|
|
30
|
+
}) => ({
|
|
31
|
+
...trait,
|
|
32
|
+
scorePointsDescriptors: scorePointsDescriptors.slice(1)
|
|
33
|
+
}));
|
|
60
34
|
break;
|
|
61
35
|
}
|
|
62
|
-
|
|
63
36
|
case _modals.excludeZeroTypes.add0:
|
|
64
37
|
{
|
|
65
38
|
// adds empty column at start
|
|
66
|
-
scorePointsLabels = [''
|
|
67
|
-
traits = traits.map(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
39
|
+
scorePointsLabels = ['', ...scorePointsLabels];
|
|
40
|
+
traits = traits.map(({
|
|
41
|
+
scorePointsDescriptors,
|
|
42
|
+
...trait
|
|
43
|
+
}) => ({
|
|
44
|
+
...trait,
|
|
45
|
+
scorePointsDescriptors: ['', ...scorePointsDescriptors]
|
|
46
|
+
}));
|
|
74
47
|
break;
|
|
75
48
|
}
|
|
76
|
-
|
|
77
49
|
case _modals.excludeZeroTypes.shiftLeft:
|
|
78
50
|
{
|
|
79
51
|
// removes last column
|
|
80
52
|
scorePointsLabels = scorePointsLabels.slice(0, -1);
|
|
81
|
-
traits = traits.map(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
53
|
+
traits = traits.map(({
|
|
54
|
+
scorePointsDescriptors,
|
|
55
|
+
...trait
|
|
56
|
+
}) => ({
|
|
57
|
+
...trait,
|
|
58
|
+
scorePointsDescriptors: scorePointsDescriptors.slice(0, -1)
|
|
59
|
+
}));
|
|
88
60
|
break;
|
|
89
61
|
}
|
|
90
|
-
|
|
91
62
|
case _modals.excludeZeroTypes.shiftRight:
|
|
92
63
|
{
|
|
93
64
|
// adds empty column at end
|
|
94
|
-
scorePointsLabels = [
|
|
95
|
-
traits = traits.map(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
65
|
+
scorePointsLabels = [...scorePointsLabels, ''];
|
|
66
|
+
traits = traits.map(({
|
|
67
|
+
scorePointsDescriptors,
|
|
68
|
+
...trait
|
|
69
|
+
}) => ({
|
|
70
|
+
...trait,
|
|
71
|
+
scorePointsDescriptors: [...scorePointsDescriptors, '']
|
|
72
|
+
}));
|
|
102
73
|
break;
|
|
103
74
|
}
|
|
104
|
-
|
|
105
75
|
default:
|
|
106
76
|
break;
|
|
107
77
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
scorePointsLabels
|
|
111
|
-
traits
|
|
112
|
-
})
|
|
78
|
+
acc.push({
|
|
79
|
+
...scale,
|
|
80
|
+
scorePointsLabels,
|
|
81
|
+
traits
|
|
82
|
+
});
|
|
113
83
|
return acc;
|
|
114
84
|
}, []);
|
|
115
85
|
};
|
|
116
|
-
|
|
117
86
|
exports.addOrRemoveScaleColumn = addOrRemoveScaleColumn;
|
|
118
87
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_editableHtml","require","_modals","filteredDefaultPlugins","exports","DEFAULT_PLUGINS","filter","p","addOrRemoveScaleColumn","scales","excludeZeroType","length","reduce","acc","scale","scorePointsLabels","traits","excludeZeroTypes","remove0","slice","map","scorePointsDescriptors","trait","add0","shiftLeft","shiftRight","push"],"sources":["../src/utils.js"],"sourcesContent":["import { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\nimport { excludeZeroTypes } from './modals';\n\nexport const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list',\n);\n\nexport const addOrRemoveScaleColumn = (scales, excludeZeroType) => {\n if (!scales || !scales.length) {\n return [];\n }\n\n return scales.reduce((acc, scale) => {\n let { scorePointsLabels, traits } = scale || {};\n\n if (scorePointsLabels.length < 1) {\n return acc;\n }\n\n switch (excludeZeroType) {\n case excludeZeroTypes.remove0: {\n // removes column 0\n scorePointsLabels = scorePointsLabels.slice(1);\n traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({\n ...trait,\n scorePointsDescriptors: scorePointsDescriptors.slice(1),\n }));\n\n break;\n }\n\n case excludeZeroTypes.add0: {\n // adds empty column at start\n scorePointsLabels = ['', ...scorePointsLabels];\n traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({\n ...trait,\n scorePointsDescriptors: ['', ...scorePointsDescriptors],\n }));\n\n break;\n }\n\n case excludeZeroTypes.shiftLeft: {\n // removes last column\n scorePointsLabels = scorePointsLabels.slice(0, -1);\n traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({\n ...trait,\n scorePointsDescriptors: scorePointsDescriptors.slice(0, -1),\n }));\n\n break;\n }\n\n case excludeZeroTypes.shiftRight: {\n // adds empty column at end\n scorePointsLabels = [...scorePointsLabels, ''];\n traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({\n ...trait,\n scorePointsDescriptors: [...scorePointsDescriptors, ''],\n }));\n\n break;\n }\n\n default:\n break;\n }\n\n acc.push({ ...scale, scorePointsLabels, traits });\n\n return acc;\n }, []);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEO,MAAME,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CAACE,6BAAe,IAAI,EAAE,EAAEC,MAAM,CACjEC,CAAC,IAAKA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,eAAe,IAAIA,CAAC,KAAK,eACzD,CAAC;AAEM,MAAMC,sBAAsB,GAAGA,CAACC,MAAM,EAAEC,eAAe,KAAK;EACjE,IAAI,CAACD,MAAM,IAAI,CAACA,MAAM,CAACE,MAAM,EAAE;IAC7B,OAAO,EAAE;EACX;EAEA,OAAOF,MAAM,CAACG,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IACnC,IAAI;MAAEC,iBAAiB;MAAEC;IAAO,CAAC,GAAGF,KAAK,IAAI,CAAC,CAAC;IAE/C,IAAIC,iBAAiB,CAACJ,MAAM,GAAG,CAAC,EAAE;MAChC,OAAOE,GAAG;IACZ;IAEA,QAAQH,eAAe;MACrB,KAAKO,wBAAgB,CAACC,OAAO;QAAE;UAC7B;UACAH,iBAAiB,GAAGA,iBAAiB,CAACI,KAAK,CAAC,CAAC,CAAC;UAC9CH,MAAM,GAAGA,MAAM,CAACI,GAAG,CAAC,CAAC;YAAEC,sBAAsB;YAAE,GAAGC;UAAM,CAAC,MAAM;YAC7D,GAAGA,KAAK;YACRD,sBAAsB,EAAEA,sBAAsB,CAACF,KAAK,CAAC,CAAC;UACxD,CAAC,CAAC,CAAC;UAEH;QACF;MAEA,KAAKF,wBAAgB,CAACM,IAAI;QAAE;UAC1B;UACAR,iBAAiB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-trait-rubric-configure",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@
|
|
9
|
-
"@
|
|
8
|
+
"@emotion/react": "^11.14.0",
|
|
9
|
+
"@emotion/style": "^0.8.0",
|
|
10
|
+
"@mui/icons-material": "^7.3.4",
|
|
11
|
+
"@mui/material": "^7.3.4",
|
|
10
12
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
11
|
-
"@pie-lib/config-ui": "
|
|
12
|
-
"@pie-lib/drag": "
|
|
13
|
-
"@pie-lib/editable-html": "
|
|
14
|
-
"@pie-lib/render-ui": "
|
|
13
|
+
"@pie-lib/config-ui": "11.36.1-mui-update.0",
|
|
14
|
+
"@pie-lib/drag": "2.29.1-mui-update.0",
|
|
15
|
+
"@pie-lib/editable-html": "11.28.1-mui-update.0",
|
|
16
|
+
"@pie-lib/render-ui": "4.42.1-mui-update.0",
|
|
15
17
|
"debug": "^3.1.0",
|
|
16
18
|
"lodash": "^4.17.15",
|
|
17
19
|
"prop-types": "^15.6.2",
|
|
18
|
-
"react": "
|
|
19
|
-
"react-dom": "
|
|
20
|
+
"react": "18.2.0",
|
|
21
|
+
"react-dom": "18.2.0",
|
|
22
|
+
"@dnd-kit/core": "6.1.0"
|
|
20
23
|
}
|
|
21
24
|
}
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@4.0.1...@pie-element/multi-trait-rubric-controller@4.1.1) (2025-10-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multi-trait-rubric-controller
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [4.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multi-trait-rubric-controller@4.0.0...@pie-element/multi-trait-rubric-controller@4.1.0) (2025-10-07)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/multi-trait-rubric-controller
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
var _default = {
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = exports.default = {
|
|
8
8
|
addScaleEnabled: true,
|
|
9
9
|
description: false,
|
|
10
10
|
excludeZero: false,
|
|
@@ -15,5 +15,4 @@ var _default = {
|
|
|
15
15
|
standards: false,
|
|
16
16
|
visibleToStudent: true
|
|
17
17
|
};
|
|
18
|
-
exports["default"] = _default;
|
|
19
18
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["addScaleEnabled","description","excludeZero","halfScoring","maxPointsEnabled","pointLabels","scales","standards","visibleToStudent"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n addScaleEnabled: true,\n description: false,\n excludeZero: false,\n halfScoring: false,\n maxPointsEnabled: true,\n pointLabels: true,\n scales: [],\n standards: false,\n visibleToStudent: true,\n};\n"],"mappings":";;;;;;iCAAe;EACbA,eAAe,EAAE,IAAI;EACrBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,KAAK;EAClBC,gBAAgB,EAAE,IAAI;EACtBC,WAAW,EAAE,IAAI;EACjBC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE,KAAK;EAChBC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
|
package/controller/lib/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -12,105 +11,64 @@ exports.model = model;
|
|
|
12
11
|
exports.normalize = void 0;
|
|
13
12
|
exports.outcome = outcome;
|
|
14
13
|
exports.validate = void 0;
|
|
15
|
-
|
|
16
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
17
|
-
|
|
18
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
-
|
|
20
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
23
|
-
|
|
24
15
|
var _utils = require("./utils");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function createDefaultModel() {
|
|
31
|
-
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
-
return new Promise(function (resolve) {
|
|
33
|
-
return resolve(_objectSpread(_objectSpread({}, _defaults["default"]), model));
|
|
34
|
-
});
|
|
16
|
+
function createDefaultModel(model = {}) {
|
|
17
|
+
return new Promise(resolve => resolve({
|
|
18
|
+
..._defaults.default,
|
|
19
|
+
...model
|
|
20
|
+
}));
|
|
35
21
|
}
|
|
22
|
+
const normalize = question => ({
|
|
23
|
+
..._defaults.default,
|
|
24
|
+
...question
|
|
25
|
+
});
|
|
36
26
|
|
|
37
|
-
var normalize = function normalize(question) {
|
|
38
|
-
return _objectSpread(_objectSpread({}, _defaults["default"]), question);
|
|
39
|
-
};
|
|
40
27
|
/**
|
|
41
28
|
*
|
|
42
29
|
* @param {*} question
|
|
43
30
|
* @param {*} session
|
|
44
31
|
* @param {*} env
|
|
45
32
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
33
|
exports.normalize = normalize;
|
|
34
|
+
async function model(question, session, env) {
|
|
35
|
+
const normalizedQuestion = normalize(question);
|
|
36
|
+
if (!env.role || env.role === 'student') {
|
|
37
|
+
normalizedQuestion.visible = normalizedQuestion.visibleToStudent;
|
|
38
|
+
} else {
|
|
39
|
+
normalizedQuestion.visible = true;
|
|
40
|
+
}
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
59
|
-
while (1) {
|
|
60
|
-
switch (_context.prev = _context.next) {
|
|
61
|
-
case 0:
|
|
62
|
-
normalizedQuestion = normalize(question);
|
|
63
|
-
|
|
64
|
-
if (!env.role || env.role === 'student') {
|
|
65
|
-
normalizedQuestion.visible = normalizedQuestion.visibleToStudent;
|
|
66
|
-
} else {
|
|
67
|
-
normalizedQuestion.visible = true;
|
|
68
|
-
} // todo update pie-ui instead of parsing this here:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_ref = normalizedQuestion || {}, scales = _ref.scales, excludeZero = _ref.excludeZero;
|
|
72
|
-
parsedScales = (scales || []).map(function (scale) {
|
|
73
|
-
return _objectSpread(_objectSpread({}, scale), {}, {
|
|
74
|
-
excludeZero: excludeZero
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
return _context.abrupt("return", _objectSpread(_objectSpread({}, normalizedQuestion), {}, {
|
|
78
|
-
scales: parsedScales
|
|
79
|
-
}));
|
|
80
|
-
|
|
81
|
-
case 5:
|
|
82
|
-
case "end":
|
|
83
|
-
return _context.stop();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, _callee);
|
|
42
|
+
// todo update pie-ui instead of parsing this here:
|
|
43
|
+
const {
|
|
44
|
+
scales,
|
|
45
|
+
excludeZero
|
|
46
|
+
} = normalizedQuestion || {};
|
|
47
|
+
const parsedScales = (scales || []).map(scale => ({
|
|
48
|
+
...scale,
|
|
49
|
+
excludeZero
|
|
87
50
|
}));
|
|
88
|
-
return
|
|
51
|
+
return {
|
|
52
|
+
...normalizedQuestion,
|
|
53
|
+
scales: parsedScales
|
|
54
|
+
};
|
|
89
55
|
}
|
|
56
|
+
const getScore = () => 0;
|
|
90
57
|
|
|
91
|
-
var getScore = function getScore() {
|
|
92
|
-
return 0;
|
|
93
|
-
};
|
|
94
58
|
/**
|
|
95
59
|
* @param {Object} model - the main model
|
|
96
60
|
* @param {*} session
|
|
97
61
|
* @param {Object} env
|
|
98
62
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
63
|
exports.getScore = getScore;
|
|
102
|
-
|
|
103
64
|
function outcome() {
|
|
104
|
-
return new Promise(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
});
|
|
65
|
+
return new Promise(resolve => resolve({
|
|
66
|
+
score: 0,
|
|
67
|
+
empty: true
|
|
68
|
+
}));
|
|
110
69
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return new Promise(function (resolve) {
|
|
70
|
+
const createCorrectResponseSession = (question, env) => {
|
|
71
|
+
return new Promise(resolve => {
|
|
114
72
|
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
115
73
|
resolve({
|
|
116
74
|
id: '1'
|
|
@@ -119,97 +77,82 @@ var createCorrectResponseSession = function createCorrectResponseSession(questio
|
|
|
119
77
|
resolve(null);
|
|
120
78
|
}
|
|
121
79
|
});
|
|
122
|
-
};
|
|
123
|
-
|
|
80
|
+
};
|
|
124
81
|
|
|
82
|
+
// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.
|
|
125
83
|
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
84
|
+
const validate = (model, config) => {
|
|
85
|
+
const {
|
|
86
|
+
scales,
|
|
87
|
+
description = false,
|
|
88
|
+
pointLabels = false
|
|
89
|
+
} = model;
|
|
90
|
+
const errors = {};
|
|
91
|
+
const traitsErrors = {};
|
|
92
|
+
const scorePointsErrors = {};
|
|
93
|
+
(scales || []).forEach((scale, scaleIndex) => {
|
|
94
|
+
const {
|
|
95
|
+
traits = []
|
|
96
|
+
} = scale;
|
|
97
|
+
const {
|
|
98
|
+
scorePointsLabels = []
|
|
99
|
+
} = scale;
|
|
100
|
+
const scaleErrors = {};
|
|
101
|
+
const scorePointsLabelsErrors = {};
|
|
144
102
|
if (pointLabels) {
|
|
145
|
-
scorePointsLabels.forEach(
|
|
103
|
+
scorePointsLabels.forEach((scorePointLabel, scoreIndex) => {
|
|
146
104
|
if (!scorePointLabel || scorePointLabel === '<div></div>') {
|
|
147
105
|
scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';
|
|
148
106
|
} else {
|
|
149
|
-
|
|
150
|
-
return (0, _utils.markupToText)(s) === (0, _utils.markupToText)(scorePointLabel);
|
|
151
|
-
});
|
|
152
|
-
|
|
107
|
+
const identicalScorePointLabel = scorePointsLabels.slice(scoreIndex + 1).some(s => (0, _utils.markupToText)(s) === (0, _utils.markupToText)(scorePointLabel));
|
|
153
108
|
if (identicalScorePointLabel) {
|
|
154
109
|
scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';
|
|
155
110
|
}
|
|
156
111
|
}
|
|
157
112
|
});
|
|
158
113
|
}
|
|
159
|
-
|
|
160
114
|
if (Object.keys(scorePointsLabelsErrors).length > 0) {
|
|
161
115
|
scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;
|
|
162
116
|
}
|
|
163
|
-
|
|
164
|
-
traits.forEach(function (trait, traitIndex) {
|
|
117
|
+
traits.forEach((trait, traitIndex) => {
|
|
165
118
|
if (!trait.name || trait.name === '<div></div>') {
|
|
166
119
|
scaleErrors[traitIndex] = {
|
|
167
120
|
name: 'Trait names should not be empty.'
|
|
168
121
|
};
|
|
169
122
|
} else {
|
|
170
|
-
|
|
171
|
-
return (0, _utils.markupToText)(t.name) === (0, _utils.markupToText)(trait.name);
|
|
172
|
-
});
|
|
173
|
-
|
|
123
|
+
const identicalTraitName = traits.slice(traitIndex + 1).some(t => (0, _utils.markupToText)(t.name) === (0, _utils.markupToText)(trait.name));
|
|
174
124
|
if (identicalTraitName) {
|
|
175
125
|
scaleErrors[traitIndex] = {
|
|
176
126
|
name: 'Trait names should be unique.'
|
|
177
127
|
};
|
|
178
128
|
}
|
|
179
129
|
}
|
|
180
|
-
|
|
181
130
|
if (description && (!trait.description || trait.description === '<div></div>')) {
|
|
182
|
-
scaleErrors[traitIndex] =
|
|
131
|
+
scaleErrors[traitIndex] = {
|
|
132
|
+
...scaleErrors[traitIndex],
|
|
183
133
|
description: 'Trait description should not be empty'
|
|
184
|
-
}
|
|
134
|
+
};
|
|
185
135
|
} else {
|
|
186
|
-
|
|
187
|
-
return (0, _utils.markupToText)(t.description) === (0, _utils.markupToText)(trait.description);
|
|
188
|
-
});
|
|
189
|
-
|
|
136
|
+
const identicalTraitDescr = traits.slice(traitIndex + 1).some(t => (0, _utils.markupToText)(t.description) === (0, _utils.markupToText)(trait.description));
|
|
190
137
|
if (description && identicalTraitDescr) {
|
|
191
|
-
scaleErrors[traitIndex] =
|
|
138
|
+
scaleErrors[traitIndex] = {
|
|
139
|
+
...scaleErrors[traitIndex],
|
|
192
140
|
description: 'Trait descriptions should be unique.'
|
|
193
|
-
}
|
|
141
|
+
};
|
|
194
142
|
}
|
|
195
143
|
}
|
|
196
144
|
});
|
|
197
|
-
|
|
198
145
|
if (Object.keys(scaleErrors).length > 0) {
|
|
199
146
|
traitsErrors[scaleIndex] = scaleErrors;
|
|
200
147
|
}
|
|
201
148
|
});
|
|
202
|
-
|
|
203
149
|
if (Object.keys(traitsErrors).length > 0) {
|
|
204
150
|
errors.traitsErrors = traitsErrors;
|
|
205
151
|
}
|
|
206
|
-
|
|
207
152
|
if (Object.keys(scorePointsErrors).length > 0) {
|
|
208
153
|
errors.scorePointsErrors = scorePointsErrors;
|
|
209
154
|
}
|
|
210
|
-
|
|
211
155
|
return errors;
|
|
212
156
|
};
|
|
213
|
-
|
|
214
157
|
exports.validate = validate;
|
|
215
158
|
//# sourceMappingURL=index.js.map
|