@pie-element/categorize 7.9.1-next.36 → 7.9.1-next.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/lib/design/categories/RowLabel.js +8 -7
- package/configure/lib/design/categories/RowLabel.js.map +1 -1
- package/configure/lib/design/categories/alternateResponses.js +1 -1
- package/configure/lib/design/categories/alternateResponses.js.map +1 -1
- package/configure/lib/design/categories/index.js +11 -17
- package/configure/lib/design/categories/index.js.map +1 -1
- package/configure/lib/design/choices/config.js +6 -39
- package/configure/lib/design/choices/config.js.map +1 -1
- package/configure/lib/design/choices/index.js +8 -12
- package/configure/lib/design/choices/index.js.map +1 -1
- package/configure/lib/design/header.js +4 -3
- package/configure/lib/design/header.js.map +1 -1
- package/configure/lib/design/index.js +33 -59
- package/configure/lib/design/index.js.map +1 -1
- package/configure/lib/main.js +8 -14
- package/configure/lib/main.js.map +1 -1
- package/lib/categorize/choices.js.map +1 -1
- package/lib/categorize/index.js +5 -12
- package/lib/categorize/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -11,16 +11,17 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _styles = require("@material-ui/core/styles");
|
|
13
13
|
|
|
14
|
-
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
15
|
-
|
|
16
14
|
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
17
15
|
|
|
16
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
17
|
+
|
|
18
18
|
var styles = function styles(theme) {
|
|
19
19
|
return {
|
|
20
20
|
rowLabel: {
|
|
21
21
|
gridColumn: '1/3'
|
|
22
22
|
},
|
|
23
23
|
rowLabelHolder: {
|
|
24
|
+
paddingTop: theme.spacing.unit * 2,
|
|
24
25
|
width: '100%'
|
|
25
26
|
}
|
|
26
27
|
};
|
|
@@ -43,10 +44,10 @@ var RowLabel = (0, _styles.withStyles)(styles)(function (_ref) {
|
|
|
43
44
|
gridColumn: "1/".concat(categoriesPerRow + 1),
|
|
44
45
|
width: '100%'
|
|
45
46
|
}
|
|
46
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
|
|
48
|
+
label: "Row Label",
|
|
49
|
+
className: classes.rowLabelHolder
|
|
50
|
+
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
50
51
|
disabled: disabled,
|
|
51
52
|
markup: markup,
|
|
52
53
|
onChange: onChange,
|
|
@@ -62,7 +63,7 @@ var RowLabel = (0, _styles.withStyles)(styles)(function (_ref) {
|
|
|
62
63
|
}, {
|
|
63
64
|
language: 'special'
|
|
64
65
|
}]
|
|
65
|
-
}));
|
|
66
|
+
})));
|
|
66
67
|
});
|
|
67
68
|
exports.RowLabel = RowLabel;
|
|
68
69
|
//# sourceMappingURL=RowLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/design/categories/RowLabel.jsx"],"names":["styles","theme","rowLabel","gridColumn","rowLabelHolder","width","RowLabel","categoriesPerRow","classes","disabled","markup","imageSupport","onChange","toolbarOpts","spellCheck","maxImageWidth","maxImageHeight","uploadSoundSupport","
|
|
1
|
+
{"version":3,"sources":["../../../src/design/categories/RowLabel.jsx"],"names":["styles","theme","rowLabel","gridColumn","rowLabelHolder","paddingTop","spacing","unit","width","RowLabel","categoriesPerRow","classes","disabled","markup","imageSupport","onChange","toolbarOpts","spellCheck","maxImageWidth","maxImageHeight","uploadSoundSupport","language"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,UAAU,EAAE;AADJ,KADe;AAIzBC,IAAAA,cAAc,EAAE;AACdC,MAAAA,UAAU,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AjB","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { InputContainer } from '@pie-lib/render-ui';\n\nconst styles = (theme) => ({\n rowLabel: {\n gridColumn: '1/3',\n },\n rowLabelHolder: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n});\n\nexport const RowLabel = withStyles(styles)(\n ({\n categoriesPerRow,\n classes,\n disabled,\n markup,\n imageSupport,\n onChange,\n toolbarOpts,\n spellCheck,\n maxImageWidth,\n maxImageHeight,\n uploadSoundSupport,\n }) => {\n return (\n <div\n style={{\n gridColumn: `1/${categoriesPerRow + 1}`,\n width: '100%',\n }}\n >\n <InputContainer label=\"Row Label\" className={classes.rowLabelHolder}>\n <EditableHtml\n disabled={disabled}\n markup={markup}\n onChange={onChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n </div>\n );\n },\n);\n"],"file":"RowLabel.js"}
|
|
@@ -42,7 +42,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
42
42
|
var styles = function styles(theme) {
|
|
43
43
|
return {
|
|
44
44
|
categories: {
|
|
45
|
-
marginBottom: theme.spacing.unit
|
|
45
|
+
marginBottom: theme.spacing.unit * 2.5
|
|
46
46
|
},
|
|
47
47
|
categoriesHolder: {
|
|
48
48
|
display: 'grid',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/design/categories/alternateResponses.jsx"],"names":["styles","theme","categories","marginBottom","spacing","unit","categoriesHolder","display","gridRowGap","gridColumnGap","row","gridTemplateColumns","alignItems","width","marginTop","rowLabel","gridColumn","rowLabelHolder","AlternateResponses","addedChoice","categoryId","props","altIndex","model","correctResponse","choices","onModelChanged","choice","find","c","id","forEach","a","category","alternateResponses","push","categoryCount","reduce","acc","currentValue","foundIndex","findIndex","filter","choiceId","from","to","choiceIndex","alternateIndex","altId","configuration","classes","className","imageSupport","spellCheck","uploadSoundSupport","toolbarOpts","defaultImageMaxHeight","defaultImageMaxWidth","categoriesPerRow","errors","rowLabels","duplicateAlternate","maxImageWidth","maxImageHeight","holderStyle","isDuplicated","index","map","hasRowLabel","rowIndex","val","changeRowLabel","addChoiceToCategory","deleteChoiceFromCategory","moveChoice","React","Component","PropTypes","number","isRequired","object","shape","add","func","string","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YAAY,EAAEF,KAAK,CAACG,OAAN,CAAcC;AADlB,KADa;AAIzBC,IAAAA,gBAAgB,EAAE;AAChBC,MAAAA,OAAO,EAAE,MADO;AAEhBC,MAAAA,UAAU,YAAKP,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAFM;AAGhBI,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB;AAHG,KAJO;AASzBK,IAAAA,GAAG,EAAE;AACHH,MAAAA,OAAO,EAAE,MADN;AAEHI,MAAAA,mBAAmB,EAAE,gBAFlB;AAGHF,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAHV;AAIHO,MAAAA,UAAU,EAAE,UAJT;AAKHC,MAAAA,KAAK,EAAE,MALJ;AAMHC,MAAAA,SAAS,EAAEb,KAAK,CAACG,OAAN,CAAcC,IANtB;AAOHF,MAAAA,YAAY,EAAE,IAAIF,KAAK,CAACG,OAAN,CAAcC;AAP7B,KAToB;AAkBzBU,IAAAA,QAAQ,EAAE;AACRC,MAAAA,UAAU,EAAE;AADJ,KAlBe;AAqBzBC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,WAApC,EAAiDC,cAAjD,CADY;AAAA,WAThB;AAYE,UAAA,kBAAkB,EAAEO;AAZtB,UAhBF,CADJ;AAiCD,OApCA,CADH,CADF,CADF;AA2CD;;;EA/JqCqB,kBAAMC,S;;;iCAAjC1D,kB,eACQ;AACjBI,EAAAA,QAAQ,EAAEuD,sBAAUC,MAAV,CAAiBC,UADV;AAEjB9B,EAAAA,aAAa,EAAE4B,sBAAUG,MAFR;AAGjB5B,EAAAA,YAAY,EAAEyB,sBAAUI,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEL,sBAAUM,IAAV,CAAeJ,UADQ;AAE5B,cAAQF,sBAAUM,IAAV,CAAeJ;AAFK,GAAhB,CAHG;AAOjB7B,EAAAA,OAAO,EAAE2B,sBAAUG,MAAV,CAAiBD,UAPT;AAQjB5B,EAAAA,SAAS,EAAE0B,sBAAUO,MARJ;AASjBlF,EAAAA,UAAU,EAAE2E,sBAAUQ,KATL;AAUjB3D,EAAAA,cAAc,EAAEmD,sBAAUM,IAVT;AAWjB5D,EAAAA,KAAK,EAAEsD,sBAAUG,MAAV,CAAiBD,UAXP;AAYjBzB,EAAAA,kBAAkB,EAAEuB,sBAAUI,KAAV,CAAgB;AAClCC,IAAAA,GAAG,EAAEL,sBAAUM,IAAV,CAAeJ,UADc;AAElC,cAAQF,sBAAUM,IAAV,CAAeJ;AAFW,GAAhB,CAZH;AAgBjBxB,EAAAA,WAAW,EAAEsB,sBAAUG;AAhBN,C;;eAiKN,wBAAWhF,MAAX,EAAmBkB,kBAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Category from './category';\nimport { moveChoiceToAlternate } from '@pie-lib/categorize';\nimport {RowLabel} from './RowLabel';\n\nconst styles = (theme) => ({\n categories: {\n marginBottom: theme.spacing.unit,\n },\n categoriesHolder: {\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n row: {\n display: 'grid',\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridColumnGap: `${theme.spacing.unit}px`,\n alignItems: 'baseline',\n width: '100%',\n marginTop: theme.spacing.unit,\n marginBottom: 2 * theme.spacing.unit,\n },\n rowLabel: {\n gridColumn: '1/3',\n },\n rowLabelHolder: {\n width: '100%',\n },\n});\n\nexport class AlternateResponses extends React.Component {\n static propTypes = {\n altIndex: PropTypes.number.isRequired,\n configuration: PropTypes.object,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n categories: PropTypes.array,\n onModelChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n toolbarOpts: PropTypes.object,\n };\n\n addChoiceToCategory = (addedChoice, categoryId) => {\n const {\n altIndex,\n model: { correctResponse, choices },\n onModelChanged,\n } = this.props;\n\n const choice = choices.find((c) => c.id === addedChoice.id);\n\n correctResponse.forEach((a) => {\n if (a.category === categoryId) {\n a.alternateResponses = a.alternateResponses || [];\n\n if (!a.alternateResponses[altIndex]) {\n a.alternateResponses[altIndex] = [];\n }\n\n a.alternateResponses[altIndex].push(addedChoice.id);\n if (choice.categoryCount && choice.categoryCount !== 0) {\n a.alternateResponses[altIndex] = a.alternateResponses[altIndex].reduce((acc, currentValue) => {\n if (currentValue === choice.id) {\n const foundIndex = acc.findIndex((c) => c === choice.id);\n if (foundIndex === -1) {\n acc.push(currentValue);\n }\n } else {\n acc.push(currentValue);\n }\n\n return acc;\n }, []);\n }\n\n return a;\n } else {\n if (a.alternateResponses[altIndex] && choice.categoryCount !== 0) {\n a.alternateResponses[altIndex] = a.alternateResponses[altIndex].filter((c) => c !== addedChoice.id);\n return a;\n }\n }\n\n return a;\n });\n\n onModelChanged({ correctResponse });\n };\n\n moveChoice = (choiceId, from, to, choiceIndex, alternateIndex) => {\n const { model, onModelChanged } = this.props;\n let { choices, correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === choiceId);\n correctResponse = moveChoiceToAlternate(\n choiceId,\n from,\n to,\n choiceIndex,\n correctResponse,\n alternateIndex,\n choice?.categoryCount,\n );\n\n onModelChanged({ correctResponse });\n };\n\n deleteChoiceFromCategory = (category, choice) => {\n const {\n altIndex,\n model: { correctResponse },\n onModelChanged,\n } = this.props;\n\n correctResponse.forEach((a) => {\n if (a.category === category.id) {\n if (a.alternateResponses[altIndex]) {\n a.alternateResponses[altIndex] = a.alternateResponses[altIndex].filter((altId) => altId !== choice.id);\n }\n }\n\n return a;\n });\n\n onModelChanged({ correctResponse });\n };\n\n render() {\n const { altIndex, model, configuration, classes, className, categories, imageSupport, spellCheck, uploadSoundSupport, toolbarOpts, defaultImageMaxHeight, defaultImageMaxWidth } =\n this.props;\n const { categoriesPerRow, errors, rowLabels } = model;\n const { duplicateAlternate } = errors || {};\n const { maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n\n const holderStyle = {\n gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`,\n };\n const isDuplicated = duplicateAlternate ? duplicateAlternate.index === altIndex : false;\n\n return (\n <div className={classNames(classes.categories, className)}>\n <div className={classes.categoriesHolder} style={holderStyle}>\n {categories.map((category, index) => {\n const hasRowLabel = index % categoriesPerRow === 0;\n const rowIndex = index / categoriesPerRow;\n return (\n <React.Fragment key={index}>\n {hasRowLabel && (\n <RowLabel\n categoriesPerRow={categoriesPerRow}\n disabled={true}\n rowIndex={rowIndex}\n markup={rowLabels[rowIndex] || ''}\n onChange={(val) => this.changeRowLabel(val, rowIndex)}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n maxImageWidth={(maxImageWidth && maxImageWidth.rowLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rowLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n )}\n <Category\n key={index}\n alternateResponseIndex={altIndex}\n imageSupport={imageSupport}\n isDuplicated={isDuplicated && duplicateAlternate.category === category.id}\n category={category}\n spellCheck={spellCheck}\n onAddChoice={this.addChoiceToCategory}\n onDeleteChoice={(choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex)}\n onMoveChoice={(choiceId, from, to, choiceIndex, alternateIndex) =>\n this.moveChoice(choiceId, from, to, choiceIndex, alternateIndex)\n }\n uploadSoundSupport={uploadSoundSupport}\n />\n </React.Fragment>\n )\n })}\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(AlternateResponses);\n"],"file":"alternateResponses.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/design/categories/alternateResponses.jsx"],"names":["styles","theme","categories","marginBottom","spacing","unit","categoriesHolder","display","gridRowGap","gridColumnGap","row","gridTemplateColumns","alignItems","width","marginTop","rowLabel","gridColumn","rowLabelHolder","AlternateResponses","addedChoice","categoryId","props","altIndex","model","correctResponse","choices","onModelChanged","choice","find","c","id","forEach","a","category","alternateResponses","push","categoryCount","reduce","acc","currentValue","foundIndex","findIndex","filter","choiceId","from","to","choiceIndex","alternateIndex","altId","configuration","classes","className","imageSupport","spellCheck","uploadSoundSupport","toolbarOpts","defaultImageMaxHeight","defaultImageMaxWidth","categoriesPerRow","errors","rowLabels","duplicateAlternate","maxImageWidth","maxImageHeight","holderStyle","isDuplicated","index","map","hasRowLabel","rowIndex","val","changeRowLabel","addChoiceToCategory","deleteChoiceFromCategory","moveChoice","React","Component","PropTypes","number","isRequired","object","shape","add","func","string","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YAAY,EAAEF,KAAK,CAACG,OAAN,CAA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IAVT;AAWjB5D,EAAAA,KAAK,EAAEsD,sBAAUG,MAAV,CAAiBD,UAXP;AAYjBzB,EAAAA,kBAAkB,EAAEuB,sBAAUI,KAAV,CAAgB;AAClCC,IAAAA,GAAG,EAAEL,sBAAUM,IAAV,CAAeJ,UADc;AAElC,cAAQF,sBAAUM,IAAV,CAAeJ;AAFW,GAAhB,CAZH;AAgBjBxB,EAAAA,WAAW,EAAEsB,sBAAUG;AAhBN,C;;eA+KN,wBAAWhF,MAAX,EAAmBkB,kBAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Category from './category';\nimport { moveChoiceToAlternate } from '@pie-lib/categorize';\nimport { RowLabel } from './RowLabel';\n\nconst styles = (theme) => ({\n categories: {\n marginBottom: theme.spacing.unit * 2.5,\n },\n categoriesHolder: {\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n row: {\n display: 'grid',\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridColumnGap: `${theme.spacing.unit}px`,\n alignItems: 'baseline',\n width: '100%',\n marginTop: theme.spacing.unit,\n marginBottom: 2 * theme.spacing.unit,\n },\n rowLabel: {\n gridColumn: '1/3',\n },\n rowLabelHolder: {\n width: '100%',\n },\n});\n\nexport class AlternateResponses extends React.Component {\n static propTypes = {\n altIndex: PropTypes.number.isRequired,\n configuration: PropTypes.object,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n categories: PropTypes.array,\n onModelChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n toolbarOpts: PropTypes.object,\n };\n\n addChoiceToCategory = (addedChoice, categoryId) => {\n const {\n altIndex,\n model: { correctResponse, choices },\n onModelChanged,\n } = this.props;\n\n const choice = choices.find((c) => c.id === addedChoice.id);\n\n correctResponse.forEach((a) => {\n if (a.category === categoryId) {\n a.alternateResponses = a.alternateResponses || [];\n\n if (!a.alternateResponses[altIndex]) {\n a.alternateResponses[altIndex] = [];\n }\n\n a.alternateResponses[altIndex].push(addedChoice.id);\n if (choice.categoryCount && choice.categoryCount !== 0) {\n a.alternateResponses[altIndex] = a.alternateResponses[altIndex].reduce((acc, currentValue) => {\n if (currentValue === choice.id) {\n const foundIndex = acc.findIndex((c) => c === choice.id);\n if (foundIndex === -1) {\n acc.push(currentValue);\n }\n } else {\n acc.push(currentValue);\n }\n\n return acc;\n }, []);\n }\n\n return a;\n } else {\n if (a.alternateResponses[altIndex] && choice.categoryCount !== 0) {\n a.alternateResponses[altIndex] = a.alternateResponses[altIndex].filter((c) => c !== addedChoice.id);\n return a;\n }\n }\n\n return a;\n });\n\n onModelChanged({ correctResponse });\n };\n\n moveChoice = (choiceId, from, to, choiceIndex, alternateIndex) => {\n const { model, onModelChanged } = this.props;\n let { choices, correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === choiceId);\n correctResponse = moveChoiceToAlternate(\n choiceId,\n from,\n to,\n choiceIndex,\n correctResponse,\n alternateIndex,\n choice?.categoryCount,\n );\n\n onModelChanged({ correctResponse });\n };\n\n deleteChoiceFromCategory = (category, choice) => {\n const {\n altIndex,\n model: { correctResponse },\n onModelChanged,\n } = this.props;\n\n correctResponse.forEach((a) => {\n if (a.category === category.id) {\n if (a.alternateResponses[altIndex]) {\n a.alternateResponses[altIndex] = a.alternateResponses[altIndex].filter((altId) => altId !== choice.id);\n }\n }\n\n return a;\n });\n\n onModelChanged({ correctResponse });\n };\n\n render() {\n const {\n altIndex,\n model,\n configuration,\n classes,\n className,\n categories,\n imageSupport,\n spellCheck,\n uploadSoundSupport,\n toolbarOpts,\n defaultImageMaxHeight,\n defaultImageMaxWidth,\n } = this.props;\n const { categoriesPerRow, errors, rowLabels } = model;\n const { duplicateAlternate } = errors || {};\n const { maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n\n const holderStyle = {\n gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`,\n };\n const isDuplicated = duplicateAlternate ? duplicateAlternate.index === altIndex : false;\n\n return (\n <div className={classNames(classes.categories, className)}>\n <div className={classes.categoriesHolder} style={holderStyle}>\n {categories.map((category, index) => {\n const hasRowLabel = index % categoriesPerRow === 0;\n const rowIndex = index / categoriesPerRow;\n\n return (\n <React.Fragment key={index}>\n {hasRowLabel && (\n <RowLabel\n categoriesPerRow={categoriesPerRow}\n disabled={true}\n rowIndex={rowIndex}\n markup={rowLabels[rowIndex] || ''}\n onChange={(val) => this.changeRowLabel(val, rowIndex)}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n maxImageWidth={(maxImageWidth && maxImageWidth.rowLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rowLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n )}\n\n <Category\n key={index}\n alternateResponseIndex={altIndex}\n imageSupport={imageSupport}\n isDuplicated={isDuplicated && duplicateAlternate.category === category.id}\n category={category}\n spellCheck={spellCheck}\n onAddChoice={this.addChoiceToCategory}\n onDeleteChoice={(choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex)}\n onMoveChoice={(choiceId, from, to, choiceIndex, alternateIndex) =>\n this.moveChoice(choiceId, from, to, choiceIndex, alternateIndex)\n }\n uploadSoundSupport={uploadSoundSupport}\n />\n </React.Fragment>\n );\n })}\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(AlternateResponses);\n"],"file":"alternateResponses.js"}
|
|
@@ -29,14 +29,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
29
29
|
|
|
30
30
|
var _styles = require("@material-ui/core/styles");
|
|
31
31
|
|
|
32
|
-
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
33
|
-
|
|
34
|
-
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
35
|
-
|
|
36
32
|
var _configUi = require("@pie-lib/config-ui");
|
|
37
33
|
|
|
38
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
39
|
-
|
|
40
34
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
41
35
|
|
|
42
36
|
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
@@ -60,7 +54,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
60
54
|
var styles = function styles(theme) {
|
|
61
55
|
return {
|
|
62
56
|
categories: {
|
|
63
|
-
marginBottom: theme.spacing.unit
|
|
57
|
+
marginBottom: theme.spacing.unit * 3
|
|
64
58
|
},
|
|
65
59
|
categoriesHolder: {
|
|
66
60
|
display: 'grid',
|
|
@@ -83,14 +77,14 @@ var styles = function styles(theme) {
|
|
|
83
77
|
width: '100%'
|
|
84
78
|
},
|
|
85
79
|
tooltip: {
|
|
86
|
-
fontSize:
|
|
80
|
+
fontSize: theme.typography.fontSize - 2,
|
|
87
81
|
whiteSpace: 'pre',
|
|
88
82
|
maxWidth: '500px'
|
|
89
83
|
},
|
|
90
84
|
errorText: {
|
|
91
|
-
fontSize:
|
|
92
|
-
color:
|
|
93
|
-
|
|
85
|
+
fontSize: theme.typography.fontSize - 2,
|
|
86
|
+
color: theme.palette.error.main,
|
|
87
|
+
paddingTop: theme.spacing.unit / 2
|
|
94
88
|
}
|
|
95
89
|
};
|
|
96
90
|
};
|
|
@@ -315,11 +309,7 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
315
309
|
}
|
|
316
310
|
})),
|
|
317
311
|
buttonDisabled: maxCategories && categories && maxCategories === categories.length
|
|
318
|
-
}),
|
|
319
|
-
className: classes.errorText
|
|
320
|
-
}, associationError), categoriesError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
321
|
-
className: classes.errorText
|
|
322
|
-
}, categoriesError), /*#__PURE__*/_react["default"].createElement("div", {
|
|
312
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
323
313
|
className: classes.categoriesHolder,
|
|
324
314
|
style: holderStyle
|
|
325
315
|
}, categories.map(function (category, index) {
|
|
@@ -365,7 +355,11 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
365
355
|
maxImageHeight: maxImageHeight && maxImageHeight.categoryLabel || defaultImageMaxHeight,
|
|
366
356
|
uploadSoundSupport: uploadSoundSupport
|
|
367
357
|
}));
|
|
368
|
-
}))
|
|
358
|
+
})), associationError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
359
|
+
className: classes.errorText
|
|
360
|
+
}, associationError), categoriesError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
361
|
+
className: classes.errorText
|
|
362
|
+
}, categoriesError));
|
|
369
363
|
}
|
|
370
364
|
}]);
|
|
371
365
|
return Categories;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/design/categories/index.jsx"],"names":["styles","theme","categories","marginBottom","spacing","unit","categoriesHolder","display","gridRowGap","gridColumnGap","row","gridTemplateColumns","alignItems","width","marginTop","rowLabel","gridColumn","rowLabelHolder","tooltip","fontSize","whiteSpace","maxWidth","errorText","color","padding","Categories","focusedEl","props","model","oldCategories","categoriesPerRow","id","utils","firstAvailableIndex","map","a","data","label","addRowLabel","length","rowLabels","push","setState","onModelChanged","concat","category","index","findIndex","splice","correctResponse","c","addedChoice","categoryId","choices","choice","find","undefined","categoryCount","choiceIndex","choiceId","from","to","val","newRowLabels","classes","className","imageSupport","uploadSoundSupport","toolbarOpts","spellCheck","configuration","defaultImageMaxHeight","defaultImageMaxWidth","errors","associationError","categoriesError","categoriesErrors","maxCategories","maxImageWidth","maxImageHeight","holderStyle","validationMessage","add","marginLeft","hasRowLabel","rowIndex","changeRowLabel","state","deleteFocusedEl","change","addChoiceToCategory","moveChoice","deleteChoiceFromCategory","categoryLabel","React","Component","PropTypes","shape","func","isRequired","object","string","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YAAY,EAAEF,KAAK,CAACG,OAAN,CAAcC;AADlB,KADa;AAIzBC,IAAAA,gBAAgB,EAAE;AAChBC,MAAAA,OAAO,EAAE,MADO;AAEhBC,MAAAA,UAAU,YAAKP,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAFM;AAGhBI,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB;AAHG,KAJO;AASzBK,IAAAA,GAAG,EAAE;AACHH,MAAAA,OAAO,EAAE,MADN;AAEHI,MAAAA,mBAAmB,EAAE,gBAFlB;AAGHF,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAHV;AAIHO,MAAAA,UAAU,EAAE,UAJT;AAKHC,MAAAA,KAAK,EAAE,MALJ;AAMHC,MAAAA,SAAS,EAAEb,KAAK,CAACG,OAAN,CAAcC,IANtB;AAOHF,MAAAA,YAAY,EAAE,IAAIF,KAAK,CAACG,OAAN,CAAcC;AAP7B,KAToB;AAkBzBU,IAAAA,QAAQ,EAAE;AACRC,MAAAA,UAAU,EAAE;AADJ,KAlBe;AAqBzBC,IAAAA,cAAc,EAAE;AACdJ,MAAAA,KAAK,EAAE;AADO,KArBS;AAwBzBK,IAAAA,OAAO,EAAE;AACPC,MAAAA,QAAQ,EAAE,MADH;AAEPC,MAAAA,UAAU,EAAE,KAFL;AAGPC,MAAAA,QAAQ,EAAE;AAHH,KAxBgB;AA6BzBC,IAAAA,SAAS,EAAE;AACTH,MAAAA,QAAQ,EAAE,MADD;AAETI,MAAAA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AyB,MAAI,CAACkC,wBAAL,CAA8B/C,QAA9B,EAAwCS,MAAxC,EAAgDI,WAAhD,CAAzB;AAAA,WAblB;AAcE,UAAA,aAAa,EAAGoB,aAAa,IAAIA,aAAa,CAACe,aAAhC,IAAkDrB,oBAdnE;AAeE,UAAA,cAAc,EAAGO,cAAc,IAAIA,cAAc,CAACc,aAAlC,IAAoDtB,qBAftE;AAgBE,UAAA,kBAAkB,EAAEJ;AAhBtB,UAhBF,CADF;AAqCD,OAzCA,CADH,CApBF,CADF;AAmED;;;EA5N6B2B,kBAAMC,S;;;iCAAzBtE,U,eACQ;AACjByC,EAAAA,YAAY,EAAE8B,sBAAUC,KAAV,CAAgB;AAC5Bf,IAAAA,GAAG,EAAEc,sBAAUE,IAAV,CAAeC,UADQ;AAE5B,cAAQH,sBAAUE,IAAV,CAAeC;AAFK,GAAhB,CADG;AAKjBhC,EAAAA,kBAAkB,EAAE6B,sBAAUC,KAAV,CAAgB;AAClCf,IAAAA,GAAG,EAAEc,sBAAUE,IAAV,CAAeC,UADc;AAElC,cAAQH,sBAAUE,IAAV,CAAeC;AAFW,GAAhB,CALH;AASjBnC,EAAAA,OAAO,EAAEgC,sBAAUI,MAAV,CAAiBD,UATT;AAUjBlC,EAAAA,SAAS,EAAE+B,sBAAUK,MAVJ;AAWjBnG,EAAAA,UAAU,EAAE8F,sBAAUM,KAXL;AAYjB3D,EAAAA,cAAc,EAAEqD,sBAAUE,IAZT;AAajBtE,EAAAA,KAAK,EAAEoE,sBAAUI,MAAV,CAAiBD,UAbP;AAcjB7B,EAAAA,aAAa,EAAE0B,sBAAUI,MAAV,CAAiBD,UAdf;AAejB/B,EAAAA,WAAW,EAAE4B,sBAAUI;AAfN,C;;eA8NN,wBAAWpG,MAAX,EAAmByB,UAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport classNames from 'classnames';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport {\n moveChoiceToAlternate,\n moveChoiceToCategory,\n removeCategory,\n removeChoiceFromCategory,\n verifyAllowMultiplePlacements,\n} from '@pie-lib/categorize';\n\nimport Category from './category';\nimport Header from '../header';\nimport { generateValidationMessage } from '../../utils';\nimport { RowLabel } from './RowLabel';\n\nconst styles = (theme) => ({\n categories: {\n marginBottom: theme.spacing.unit,\n },\n categoriesHolder: {\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n row: {\n display: 'grid',\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridColumnGap: `${theme.spacing.unit}px`,\n alignItems: 'baseline',\n width: '100%',\n marginTop: theme.spacing.unit,\n marginBottom: 2 * theme.spacing.unit,\n },\n rowLabel: {\n gridColumn: '1/3',\n },\n rowLabelHolder: {\n width: '100%',\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n padding: '5px 0',\n },\n});\n\nexport class Categories extends React.Component {\n static propTypes = {\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n categories: PropTypes.array,\n onModelChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n toolbarOpts: PropTypes.object,\n };\n\n state = {\n focusedEl: null,\n };\n\n add = () => {\n const { model, categories: oldCategories } = this.props;\n const { categoriesPerRow } = model;\n const id = utils.firstAvailableIndex(\n model.categories.map((a) => a.id),\n 0,\n );\n const data = { id, label: 'Category ' + id };\n const addRowLabel = model.categories.length % categoriesPerRow === 0;\n const rowLabels = [...model.rowLabels];\n\n if (addRowLabel) {\n rowLabels.push('');\n }\n\n this.setState(\n {\n focusedEl: oldCategories.length,\n },\n () => {\n this.props.onModelChanged({\n rowLabels,\n categories: model.categories.concat([data]),\n });\n },\n );\n };\n\n deleteFocusedEl = () => {\n this.setState({\n focusedEl: null,\n });\n };\n\n delete = (category) => {\n const { model, onModelChanged } = this.props;\n const index = model.categories.findIndex((a) => a.id === category.id);\n\n if (index !== -1) {\n model.categories.splice(index, 1);\n model.correctResponse = removeCategory(category.id, model.correctResponse);\n onModelChanged(model);\n }\n };\n\n change = (c) => {\n const { categories } = this.props;\n const index = categories.findIndex((a) => a.id === c.id);\n\n if (index !== -1) {\n categories.splice(index, 1, c);\n this.props.onModelChanged({ categories });\n }\n };\n\n addChoiceToCategory = (addedChoice, categoryId) => {\n const { model, onModelChanged } = this.props;\n let { choices = [], correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === addedChoice.id);\n correctResponse = moveChoiceToCategory(addedChoice.id, undefined, categoryId, 0, model.correctResponse);\n // if multiplePlacements not allowed, ensure the consistency in the other categories\n if (choice.categoryCount !== 0) {\n correctResponse = verifyAllowMultiplePlacements(addedChoice, categoryId, correctResponse);\n }\n onModelChanged({ correctResponse });\n };\n\n deleteChoiceFromCategory = (category, choice, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n const correctResponse = removeChoiceFromCategory(choice.id, category.id, choiceIndex, model.correctResponse);\n\n onModelChanged({ correctResponse });\n };\n\n moveChoice = (choiceId, from, to, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n let { choices, correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === choiceId);\n if (to === from || !choice) {\n return;\n }\n if (choice.categoryCount !== 0) {\n correctResponse = moveChoiceToCategory(choice.id, from, to, choiceIndex, correctResponse);\n correctResponse = verifyAllowMultiplePlacements(choice, to, correctResponse);\n } else if (choice.categoryCount === 0) {\n correctResponse = moveChoiceToCategory(choice.id, undefined, to, 0, correctResponse);\n }\n onModelChanged({ correctResponse });\n };\n\n changeRowLabel = (val, index) => {\n const { model } = this.props;\n const { rowLabels } = model;\n const newRowLabels = [...rowLabels];\n\n if (newRowLabels.length < index) {\n newRowLabels.push(val);\n } else {\n newRowLabels[index] = val;\n }\n\n this.props.onModelChanged({\n rowLabels: newRowLabels,\n });\n };\n\n render() {\n const {\n model,\n classes,\n className,\n categories,\n imageSupport,\n uploadSoundSupport,\n toolbarOpts,\n spellCheck,\n configuration,\n defaultImageMaxHeight,\n defaultImageMaxWidth,\n } = this.props;\n\n const { categoriesPerRow, rowLabels, errors } = model;\n const { associationError, categoriesError, categoriesErrors } = errors || {};\n const { maxCategories, maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n const holderStyle = {\n gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`,\n };\n\n const validationMessage = generateValidationMessage(configuration);\n\n return (\n <div className={classNames(classes.categories, className)}>\n <Header\n label=\"Categories\"\n buttonLabel=\"ADD A CATEGORY\"\n onAdd={this.add}\n info={\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '5px' }} />\n </Tooltip>\n }\n buttonDisabled={maxCategories && categories && maxCategories === categories.length}\n />\n {associationError && <div className={classes.errorText}>{associationError}</div>}\n {categoriesError && <div className={classes.errorText}>{categoriesError}</div>}\n <div className={classes.categoriesHolder} style={holderStyle}>\n {categories.map((category, index) => {\n const hasRowLabel = index % categoriesPerRow === 0;\n const rowIndex = index / categoriesPerRow;\n\n return (\n <React.Fragment key={index}>\n {hasRowLabel && (\n <RowLabel\n categoriesPerRow={categoriesPerRow}\n disabled={false}\n rowIndex={rowIndex}\n markup={rowLabels[rowIndex] || ''}\n onChange={(val) => this.changeRowLabel(val, rowIndex)}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n maxImageWidth={(maxImageWidth && maxImageWidth.rowLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rowLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n )}\n <Category\n imageSupport={imageSupport}\n focusedEl={this.state.focusedEl}\n deleteFocusedEl={this.deleteFocusedEl}\n index={index}\n category={category}\n error={categoriesErrors && categoriesErrors[category.id]}\n onChange={this.change}\n onDelete={() => this.delete(category)}\n onAddChoice={this.addChoiceToCategory}\n onMoveChoice={(choiceId, from, to, choiceIndex) => this.moveChoice(choiceId, from, to, choiceIndex)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n onDeleteChoice={(choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex)}\n maxImageWidth={(maxImageWidth && maxImageWidth.categoryLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.categoryLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n </React.Fragment>\n );\n })}\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(Categories);\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/design/categories/index.jsx"],"names":["styles","theme","categories","marginBottom","spacing","unit","categoriesHolder","display","gridRowGap","gridColumnGap","row","gridTemplateColumns","alignItems","width","marginTop","rowLabel","gridColumn","rowLabelHolder","tooltip","fontSize","typography","whiteSpace","maxWidth","errorText","color","palette","error","main","paddingTop","Categories","focusedEl","props","model","oldCategories","categoriesPerRow","id","utils","firstAvailableIndex","map","a","data","label","addRowLabel","length","rowLabels","push","setState","onModelChanged","concat","category","index","findIndex","splice","correctResponse","c","addedChoice","categoryId","choices","choice","find","undefined","categoryCount","choiceIndex","choiceId","from","to","val","newRowLabels","classes","className","imageSupport","uploadSoundSupport","toolbarOpts","spellCheck","configuration","defaultImageMaxHeight","defaultImageMaxWidth","errors","associationError","categoriesError","categoriesErrors","maxCategories","maxImageWidth","maxImageHeight","holderStyle","validationMessage","add","marginLeft","hasRowLabel","rowIndex","changeRowLabel","state","deleteFocusedEl","change","addChoiceToCategory","moveChoice","deleteChoiceFromCategory","categoryLabel","React","Component","PropTypes","shape","func","isRequired","object","string","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YAAY,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB;AADzB,KADa;AAIzBC,IAAAA,gBAAgB,EAAE;AAChBC,MAAAA,OAAO,EAAE,MADO;AAEhBC,MAAAA,UAAU,YAAKP,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAFM;AAGhBI,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB;AAHG,KAJO;AASzBK,IAAAA,GAAG,EAAE;AACHH,MAAAA,OAAO,EAAE,MADN;AAEHI,MAAAA,mBAAmB,EAAE,gBAFlB;AAGHF,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAHV;AAIHO,MAAAA,UAAU,EAAE,UAJT;AAKHC,MAAAA,KAAK,EAAE,MALJ;AAMHC,MAAAA,SAAS,EAAEb,KAAK,CAACG,OAAN,CAAcC,IANtB;AAOHF,MAAAA,YAAY,EAAE,IAAIF,KAAK,CAACG,OAAN,CAAcC;AAP7B,KAToB;AAkBzBU,IAAAA,QAAQ,EAAE;AACRC,MAAAA,UAAU,EAAE;AADJ,KAlBe;AAqBzBC,IAAAA,cAAc,EAAE;AACdJ,MAAAA,KAAK,EAAE;AADO,KArBS;AAwBzBK,IAAAA,OAAO,EAAE;AACPC,MAAAA,QAAQ,EAAElB,KAAK,CAACmB,UAAN,CAAiBD,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MAAV,CAAiBD,UAbP;AAcjB7B,EAAAA,aAAa,EAAE0B,sBAAUI,MAAV,CAAiBD,UAdf;AAejB/B,EAAAA,WAAW,EAAE4B,sBAAUI;AAfN,C;;eAiON,wBAAWxG,MAAX,EAAmB6B,UAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport classNames from 'classnames';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport {\n moveChoiceToCategory,\n removeCategory,\n removeChoiceFromCategory,\n verifyAllowMultiplePlacements,\n} from '@pie-lib/categorize';\n\nimport Category from './category';\nimport Header from '../header';\nimport { generateValidationMessage } from '../../utils';\nimport { RowLabel } from './RowLabel';\n\nconst styles = (theme) => ({\n categories: {\n marginBottom: theme.spacing.unit * 3,\n },\n categoriesHolder: {\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n row: {\n display: 'grid',\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridColumnGap: `${theme.spacing.unit}px`,\n alignItems: 'baseline',\n width: '100%',\n marginTop: theme.spacing.unit,\n marginBottom: 2 * theme.spacing.unit,\n },\n rowLabel: {\n gridColumn: '1/3',\n },\n rowLabelHolder: {\n width: '100%',\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit / 2,\n },\n});\n\nexport class Categories extends React.Component {\n static propTypes = {\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n categories: PropTypes.array,\n onModelChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n toolbarOpts: PropTypes.object,\n };\n\n state = {\n focusedEl: null,\n };\n\n add = () => {\n const { model, categories: oldCategories } = this.props;\n const { categoriesPerRow } = model;\n const id = utils.firstAvailableIndex(\n model.categories.map((a) => a.id),\n 0,\n );\n const data = { id, label: 'Category ' + id };\n const addRowLabel = model.categories.length % categoriesPerRow === 0;\n const rowLabels = [...model.rowLabels];\n\n if (addRowLabel) {\n rowLabels.push('');\n }\n\n this.setState(\n {\n focusedEl: oldCategories.length,\n },\n () => {\n this.props.onModelChanged({\n rowLabels,\n categories: model.categories.concat([data]),\n });\n },\n );\n };\n\n deleteFocusedEl = () => {\n this.setState({\n focusedEl: null,\n });\n };\n\n delete = (category) => {\n const { model, onModelChanged } = this.props;\n const index = model.categories.findIndex((a) => a.id === category.id);\n\n if (index !== -1) {\n model.categories.splice(index, 1);\n model.correctResponse = removeCategory(category.id, model.correctResponse);\n onModelChanged(model);\n }\n };\n\n change = (c) => {\n const { categories } = this.props;\n const index = categories.findIndex((a) => a.id === c.id);\n\n if (index !== -1) {\n categories.splice(index, 1, c);\n this.props.onModelChanged({ categories });\n }\n };\n\n addChoiceToCategory = (addedChoice, categoryId) => {\n const { model, onModelChanged } = this.props;\n let { choices = [], correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === addedChoice.id);\n correctResponse = moveChoiceToCategory(addedChoice.id, undefined, categoryId, 0, model.correctResponse);\n // if multiplePlacements not allowed, ensure the consistency in the other categories\n if (choice.categoryCount !== 0) {\n correctResponse = verifyAllowMultiplePlacements(addedChoice, categoryId, correctResponse);\n }\n onModelChanged({ correctResponse });\n };\n\n deleteChoiceFromCategory = (category, choice, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n const correctResponse = removeChoiceFromCategory(choice.id, category.id, choiceIndex, model.correctResponse);\n\n onModelChanged({ correctResponse });\n };\n\n moveChoice = (choiceId, from, to, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n let { choices, correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === choiceId);\n if (to === from || !choice) {\n return;\n }\n if (choice.categoryCount !== 0) {\n correctResponse = moveChoiceToCategory(choice.id, from, to, choiceIndex, correctResponse);\n correctResponse = verifyAllowMultiplePlacements(choice, to, correctResponse);\n } else if (choice.categoryCount === 0) {\n correctResponse = moveChoiceToCategory(choice.id, undefined, to, 0, correctResponse);\n }\n onModelChanged({ correctResponse });\n };\n\n changeRowLabel = (val, index) => {\n const { model } = this.props;\n const { rowLabels } = model;\n const newRowLabels = [...rowLabels];\n\n if (newRowLabels.length < index) {\n newRowLabels.push(val);\n } else {\n newRowLabels[index] = val;\n }\n\n this.props.onModelChanged({\n rowLabels: newRowLabels,\n });\n };\n\n render() {\n const {\n model,\n classes,\n className,\n categories,\n imageSupport,\n uploadSoundSupport,\n toolbarOpts,\n spellCheck,\n configuration,\n defaultImageMaxHeight,\n defaultImageMaxWidth,\n } = this.props;\n\n const { categoriesPerRow, rowLabels, errors } = model;\n const { associationError, categoriesError, categoriesErrors } = errors || {};\n const { maxCategories, maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n const holderStyle = {\n gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`,\n };\n\n const validationMessage = generateValidationMessage(configuration);\n\n return (\n <div className={classNames(classes.categories, className)}>\n <Header\n label=\"Categories\"\n buttonLabel=\"ADD A CATEGORY\"\n onAdd={this.add}\n info={\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '5px' }} />\n </Tooltip>\n }\n buttonDisabled={maxCategories && categories && maxCategories === categories.length}\n />\n\n <div className={classes.categoriesHolder} style={holderStyle}>\n {categories.map((category, index) => {\n const hasRowLabel = index % categoriesPerRow === 0;\n const rowIndex = index / categoriesPerRow;\n\n return (\n <React.Fragment key={index}>\n {hasRowLabel && (\n <RowLabel\n categoriesPerRow={categoriesPerRow}\n disabled={false}\n rowIndex={rowIndex}\n markup={rowLabels[rowIndex] || ''}\n onChange={(val) => this.changeRowLabel(val, rowIndex)}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n maxImageWidth={(maxImageWidth && maxImageWidth.rowLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rowLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n )}\n\n <Category\n imageSupport={imageSupport}\n focusedEl={this.state.focusedEl}\n deleteFocusedEl={this.deleteFocusedEl}\n index={index}\n category={category}\n error={categoriesErrors && categoriesErrors[category.id]}\n onChange={this.change}\n onDelete={() => this.delete(category)}\n onAddChoice={this.addChoiceToCategory}\n onMoveChoice={(choiceId, from, to, choiceIndex) => this.moveChoice(choiceId, from, to, choiceIndex)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n onDeleteChoice={(choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex)}\n maxImageWidth={(maxImageWidth && maxImageWidth.categoryLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.categoryLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n </React.Fragment>\n );\n })}\n </div>\n\n {associationError && <div className={classes.errorText}>{associationError}</div>}\n {categoriesError && <div className={classes.errorText}>{categoriesError}</div>}\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(Categories);\n"],"file":"index.js"}
|
|
@@ -31,18 +31,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
31
31
|
|
|
32
32
|
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
33
33
|
|
|
34
|
-
var _List = _interopRequireDefault(require("@material-ui/core/List"));
|
|
35
|
-
|
|
36
|
-
var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));
|
|
37
|
-
|
|
38
|
-
var _ListItemText = _interopRequireDefault(require("@material-ui/core/ListItemText"));
|
|
39
|
-
|
|
40
|
-
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
41
|
-
|
|
42
|
-
var _Menu = _interopRequireDefault(require("@material-ui/core/Menu"));
|
|
43
|
-
|
|
44
|
-
var _configUi = require("@pie-lib/config-ui");
|
|
45
|
-
|
|
46
34
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
47
35
|
|
|
48
36
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -82,18 +70,17 @@ var Config = /*#__PURE__*/function (_React$Component) {
|
|
|
82
70
|
spellCheck = _this$props.spellCheck;
|
|
83
71
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
84
72
|
className: (0, _classnames["default"])(classes.config, className)
|
|
85
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
86
|
-
className: classes.configuration
|
|
87
73
|
}, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
88
74
|
className: classes.label,
|
|
89
75
|
InputLabelProps: {
|
|
90
76
|
shrink: true
|
|
91
77
|
},
|
|
78
|
+
variant: "outlined",
|
|
92
79
|
label: "Label",
|
|
93
80
|
value: config.choicesLabel,
|
|
94
81
|
onChange: this.changeLabel,
|
|
95
82
|
spellCheck: spellCheck
|
|
96
|
-
}))
|
|
83
|
+
}));
|
|
97
84
|
}
|
|
98
85
|
}]);
|
|
99
86
|
return Config;
|
|
@@ -110,32 +97,12 @@ exports.Config = Config;
|
|
|
110
97
|
|
|
111
98
|
var styles = function styles(theme) {
|
|
112
99
|
return {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
alignItems: 'center',
|
|
116
|
-
gridColumnGap: "".concat(theme.spacing.unit, "px"),
|
|
117
|
-
gridRowGap: "".concat(theme.spacing.unit, "px"),
|
|
118
|
-
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
119
|
-
justifyContent: 'space-between',
|
|
120
|
-
marginBottom: theme.spacing.unit
|
|
121
|
-
},
|
|
122
|
-
choiceConfig: {
|
|
123
|
-
width: '100%',
|
|
124
|
-
maxWidth: 360,
|
|
125
|
-
backgroundColor: theme.palette.background.paper
|
|
126
|
-
},
|
|
127
|
-
row: {
|
|
128
|
-
display: 'grid',
|
|
129
|
-
gridColumnGap: "".concat(theme.spacing.unit, "px"),
|
|
130
|
-
gridRowGap: "".concat(theme.spacing.unit, "px"),
|
|
131
|
-
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
132
|
-
justifyContent: 'space-between',
|
|
133
|
-
marginTop: theme.spacing.unit,
|
|
100
|
+
config: {
|
|
101
|
+
paddingTop: theme.spacing.unit,
|
|
134
102
|
marginBottom: theme.spacing.unit
|
|
135
103
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
gridColumnEnd: 2
|
|
104
|
+
label: {
|
|
105
|
+
width: '100%'
|
|
139
106
|
}
|
|
140
107
|
};
|
|
141
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/design/choices/config.jsx"],"names":["Config","target","props","onModelChanged","choicesLabel","value","classes","className","config","spellCheck","
|
|
1
|
+
{"version":3,"sources":["../../../src/design/choices/config.jsx"],"names":["Config","target","props","onModelChanged","choicesLabel","value","classes","className","config","spellCheck","label","shrink","changeLabel","React","Component","PropTypes","object","isRequired","string","func","styles","theme","paddingTop","spacing","unit","marginBottom","width"],"mappings":";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AAAA,YAAY,EAAEJ,KAAK,CAACE,OAAN,CAAcC;AAFtB,KADiB;AAKzBd,IAAAA,KAAK,EAAE;AACLgB,MAAAA,KAAK,EAAE;AADF;AALkB,GAAZ;AAAA,CAAf;;eAUe,wBAAWN,MAAX,EAAmBpB,MAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport TextField from '@material-ui/core/TextField';\n\nexport class Config extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n config: PropTypes.object,\n onModelChanged: PropTypes.func,\n };\n\n static defaultProps = {};\n\n changeLabel = ({ target }) => {\n this.props.onModelChanged({ choicesLabel: target.value });\n };\n\n render() {\n const { classes, className, config, spellCheck } = this.props;\n\n return (\n <div className={classNames(classes.config, className)}>\n <TextField\n className={classes.label}\n InputLabelProps={{\n shrink: true,\n }}\n variant=\"outlined\"\n label=\"Label\"\n value={config.choicesLabel}\n onChange={this.changeLabel}\n spellCheck={spellCheck}\n />\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n config: {\n paddingTop: theme.spacing.unit,\n marginBottom: theme.spacing.unit,\n },\n label: {\n width: '100%',\n },\n});\n\nexport default withStyles(styles)(Config);\n"],"file":"config.js"}
|
|
@@ -27,8 +27,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
27
27
|
|
|
28
28
|
var _styles = require("@material-ui/core/styles");
|
|
29
29
|
|
|
30
|
-
var _buttons = require("../buttons");
|
|
31
|
-
|
|
32
30
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
31
|
|
|
34
32
|
var _choice = _interopRequireDefault(require("./choice"));
|
|
@@ -189,9 +187,7 @@ var Choices = /*#__PURE__*/function (_React$Component) {
|
|
|
189
187
|
buttonLabel: "ADD A CHOICE",
|
|
190
188
|
onAdd: this.addChoice,
|
|
191
189
|
buttonDisabled: maxChoices && choices && maxChoices === choices.length
|
|
192
|
-
}),
|
|
193
|
-
className: classes.errorText
|
|
194
|
-
}, choicesError), /*#__PURE__*/_react["default"].createElement(_config["default"], {
|
|
190
|
+
}), /*#__PURE__*/_react["default"].createElement(_config["default"], {
|
|
195
191
|
config: model,
|
|
196
192
|
onModelChanged: onModelChanged,
|
|
197
193
|
spellCheck: spellCheck
|
|
@@ -223,7 +219,9 @@ var Choices = /*#__PURE__*/function (_React$Component) {
|
|
|
223
219
|
maxImageHeight: maxImageHeight && maxImageHeight.choice || defaultImageMaxHeight,
|
|
224
220
|
uploadSoundSupport: uploadSoundSupport
|
|
225
221
|
});
|
|
226
|
-
})), /*#__PURE__*/_react["default"].createElement(
|
|
222
|
+
})), choicesError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
|
+
className: classes.errorText
|
|
224
|
+
}, choicesError));
|
|
227
225
|
}
|
|
228
226
|
}]);
|
|
229
227
|
return Choices;
|
|
@@ -259,14 +257,12 @@ var styles = function styles(theme) {
|
|
|
259
257
|
gridColumnGap: "".concat(theme.spacing.unit, "px")
|
|
260
258
|
},
|
|
261
259
|
choices: {
|
|
262
|
-
|
|
263
|
-
paddingBottom: theme.spacing.unit * 2
|
|
260
|
+
marginBottom: theme.spacing.unit * 2.5
|
|
264
261
|
},
|
|
265
|
-
label: {},
|
|
266
262
|
errorText: {
|
|
267
|
-
fontSize:
|
|
268
|
-
color:
|
|
269
|
-
|
|
263
|
+
fontSize: theme.typography.fontSize - 2,
|
|
264
|
+
color: theme.palette.error.main,
|
|
265
|
+
paddingTop: theme.spacing.unit / 2
|
|
270
266
|
}
|
|
271
267
|
};
|
|
272
268
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/design/choices/index.jsx"],"names":["Choices","focusedEl","choice","props","choices","onModelChanged","index","findIndex","h","id","splice","count","c","categoryCount","model","oldChoices","utils","firstAvailableIndex","map","a","data","content","setState","length","concat","correctResponse","indexFrom","indexTo","state","classes","className","imageSupport","uploadSoundSupport","spellCheck","toolbarOpts","configuration","defaultImageMaxWidth","defaultImageMaxHeight","errors","allowMultiplePlacementsEnabled","lockChoiceOrder","choicesError","choicesErrors","maxChoices","maxImageWidth","maxImageHeight","categoryCountIsOne","allChoicesHaveCount","choiceHolderStyle","gridTemplateColumns","categoriesPerRow","addChoice","errorText","choiceHolder","deleteFocusedEl","correctResponseCount","changeChoice","deleteChoice","rearrangeChoices","React","Component","PropTypes","object","isRequired","string","array","func","shape","add","styles","theme","paddingTop","spacing","unit","paddingBottom","display","gridRowGap","gridColumnGap","label","fontSize","color","padding"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAGaA,O;;;;;;;;;;;;;;;8FAqBH;AACNC,MAAAA,SAAS,EAAE;AADL,K;qGAIO,UAACC,MAAD,EAAY;AACzB,wBAAoC,MAAKC,KAAzC;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,cAAjB,eAAiBA,cAAjB;AACA,UAAMC,KAAK,GAAGF,OAAO,CAACG,SAAR,CAAkB,UAACC,CAAD;AAAA,eAAOA,CAAC,CAACC,EAAF,KAASP,MAAM,CAACO,EAAvB;AAAA,OAAlB,CAAd;;AACA,UAAIH,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChBF,QAAAA,OAAO,CAACM,MAAR,CAAeJ,KAAf,EAAsB,CAAtB,EAAyBJ,MAAzB;AACAG,QAAAA,cAAc,CAAC;AAAED,UAAAA,OAAO,EAAPA;AAAF,SAAD,CAAd;AACD;AACF,K;4GAEqB,UAACO,KAAD,EAAW;AAC/B,UAAQP,OAAR,GAAoB,MAAKD,KAAzB,CAAQC,OAAR;AACA,aAAO,uBAAMA,OAAN,EAAe,UAACQ,CAAD;AAAA,eAAOA,CAAC,CAACC,aAAF,KAAoBF,KAA3B;AAAA,OAAf,CAAP;AACD,K;kGAEW,YAAM;AAChB,yBAAuD,MAAKR,KAA5D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V,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB,CAPG;AAWjB/B,EAAAA,kBAAkB,EAAE6B,sBAAUM,KAAV,CAAgB;AAClCC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADc;AAElC,cAAQF,sBAAUK,IAAV,CAAeH;AAFW,GAAhB,CAXH;AAejB7B,EAAAA,WAAW,EAAE2B,sBAAUC;AAfN,C;iCADR9D,O,kBAmBW,E;;AAgIxB,IAAMqE,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBjB,IAAAA,YAAY,EAAE;AACZkB,MAAAA,UAAU,EAAED,KAAK,CAACE,OAAN,CAAcC,IADd;AAEZC,MAAAA,aAAa,EAAEJ,KAAK,CAACE,OAAN,CAAcC,IAFjB;AAGZE,MAAAA,OAAO,EAAE,MAHG;AAIZC,MAAAA,UAAU,YAAKN,KAAK,CAACE,OAAN,CAAcC,IAAnB,OAJE;AAKZI,MAAAA,aAAa,YAAKP,KAAK,CAACE,OAAN,CAAcC,IAAnB;AALD,KADW;AAQzBrE,IAAAA,OAAO,EAAE;AACPmE,MAAAA,UAAU,EAAED,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAD1B;AAEPC,MAAAA,aAAa,EAAEJ,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AAF7B,KARgB;AAYzBK,IAAAA,KAAK,EAAE,EAZkB;AAazB1B,IAAAA,SAAS,EAAE;AACT2B,MAAAA,QAAQ,EAAE,MADD;AAETC,MAAAA,KAAK,EAAE,KAFE;AAGTC,MAAAA,OAAO,EAAE;AAHA;AAbc,GAAZ;AAAA,CAAf;;eAmBe,wBAAWZ,MAAX,EAAmBrE,OAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Divider } from '../buttons';\nimport classNames from 'classnames';\nimport Choice from './choice';\nimport Header from '../header';\nimport every from 'lodash/every';\nimport Config from './config';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { removeAllChoices } from '@pie-lib/categorize';\nimport { rearrangeChoices } from '@pie-lib/categorize';\n\nexport class Choices extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n choices: PropTypes.array.isRequired,\n onModelChanged: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n toolbarOpts: PropTypes.object,\n };\n\n static defaultProps = {};\n\n state = {\n focusedEl: null,\n };\n\n changeChoice = (choice) => {\n const { choices, onModelChanged } = this.props;\n const index = choices.findIndex((h) => h.id === choice.id);\n if (index !== -1) {\n choices.splice(index, 1, choice);\n onModelChanged({ choices });\n }\n };\n\n allChoicesHaveCount = (count) => {\n const { choices } = this.props;\n return every(choices, (c) => c.categoryCount === count);\n };\n\n addChoice = () => {\n const { onModelChanged, model, choices: oldChoices } = this.props;\n\n const id = utils.firstAvailableIndex(\n model.choices.map((a) => a.id),\n 0,\n );\n const data = { id, content: 'Choice ' + id };\n\n this.setState(\n {\n focusedEl: oldChoices.length,\n },\n () => {\n onModelChanged({ choices: model.choices.concat([data]) });\n },\n );\n };\n\n deleteFocusedEl = () => {\n this.setState({\n focusedEl: null,\n });\n };\n\n deleteChoice = (choice) => {\n const { model, onModelChanged } = this.props;\n const index = model.choices.findIndex((a) => a.id === choice.id);\n if (index !== -1) {\n model.choices.splice(index, 1);\n model.correctResponse = removeAllChoices(choice.id, model.correctResponse);\n onModelChanged(model);\n }\n };\n\n rearrangeChoices = (indexFrom, indexTo) => {\n const { model, onModelChanged } = this.props || {};\n let { choices } = model || [];\n choices = rearrangeChoices(choices, indexFrom, indexTo);\n onModelChanged({ choices });\n };\n\n render() {\n const { focusedEl } = this.state;\n const {\n classes,\n className,\n choices,\n model,\n imageSupport,\n uploadSoundSupport,\n onModelChanged,\n spellCheck,\n toolbarOpts,\n configuration,\n defaultImageMaxWidth,\n defaultImageMaxHeight,\n } = this.props;\n const { errors, allowMultiplePlacementsEnabled, lockChoiceOrder } = model;\n const { choicesError, choicesErrors } = errors || {};\n const { maxChoices, maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n\n const categoryCountIsOne = this.allChoicesHaveCount(1);\n const choiceHolderStyle = {\n gridTemplateColumns: `repeat(${model.categoriesPerRow}, 1fr)`,\n };\n\n return (\n <div className={classNames(classes.choices, className)}>\n <Header\n label=\"Choices\"\n buttonLabel=\"ADD A CHOICE\"\n onAdd={this.addChoice}\n buttonDisabled={maxChoices && choices && maxChoices === choices.length}\n />\n {choicesError && <div className={classes.errorText}>{choicesError}</div>}\n <Config config={model} onModelChanged={onModelChanged} spellCheck={spellCheck} />\n <div className={classes.choiceHolder} style={choiceHolderStyle}>\n {choices.map((h, index) => {\n return (\n <Choice\n choice={h}\n focusedEl={focusedEl}\n deleteFocusedEl={this.deleteFocusedEl}\n correctResponseCount={h.correctResponseCount}\n allowMultiplePlacements={allowMultiplePlacementsEnabled}\n lockChoiceOrder={lockChoiceOrder}\n index={index}\n key={index}\n imageSupport={imageSupport}\n onChange={this.changeChoice}\n onDelete={() => this.deleteChoice(h)}\n rearrangeChoices={(indexFrom, indexTo) => this.rearrangeChoices(indexFrom, indexTo)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n error={choicesErrors && choicesErrors[h.id]}\n maxImageWidth={(maxImageWidth && maxImageWidth.choice) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.choice) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n );\n })}\n </div>\n <Divider />\n </div>\n );\n }\n}\nconst styles = (theme) => ({\n choiceHolder: {\n paddingTop: theme.spacing.unit,\n paddingBottom: theme.spacing.unit,\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n choices: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n label: {},\n errorText: {\n fontSize: '12px',\n color: 'red',\n padding: '5px 0',\n },\n});\nexport default withStyles(styles)(Choices);\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/design/choices/index.jsx"],"names":["Choices","focusedEl","choice","props","choices","onModelChanged","index","findIndex","h","id","splice","count","c","categoryCount","model","oldChoices","utils","firstAvailableIndex","map","a","data","content","setState","length","concat","correctResponse","indexFrom","indexTo","state","classes","className","imageSupport","uploadSoundSupport","spellCheck","toolbarOpts","configuration","defaultImageMaxWidth","defaultImageMaxHeight","errors","allowMultiplePlacementsEnabled","lockChoiceOrder","choicesError","choicesErrors","maxChoices","maxImageWidth","maxImageHeight","categoryCountIsOne","allChoicesHaveCount","choiceHolderStyle","gridTemplateColumns","categoriesPerRow","addChoice","choiceHolder","deleteFocusedEl","correctResponseCount","changeChoice","deleteChoice","rearrangeChoices","errorText","React","Component","PropTypes","object","isRequired","string","array","func","shape","add","styles","theme","paddingTop","spacing","unit","paddingBottom","display","gridRowGap","gridColumnGap","marginBottom","fontSize","typography","color","palette","error","main"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAGaA,O;;;;;;;;;;;;;;;8FAqBH;AACNC,MAAAA,SAAS,EAAE;AADL,K;qGAIO,UAACC,MAAD,EAAY;AACzB,wBAAoC,MAAKC,KAAzC;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,cAAjB,eAAiBA,cAAjB;AACA,UAAMC,KAAK,GAAGF,OAAO,CAACG,SAAR,CAAkB,UAACC,CAAD;AAAA,eAAOA,CAAC,CAACC,EAAF,KAASP,MAAM,CAACO,EAAvB;AAAA,OAAlB,CAAd;;AAC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AACTqB,MAAAA,QAAQ,EAAET,KAAK,CAACU,UAAN,CAAiBD,QAAjB,GAA4B,CAD7B;AAETE,MAAAA,KAAK,EAAEX,KAAK,CAACY,OAAN,CAAcC,KAAd,CAAoBC,IAFlB;AAGTb,MAAAA,UAAU,EAAED,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AAHxB;AAXc,GAAZ;AAAA,CAAf;;eAkBe,wBAAWJ,MAAX,EAAmBrE,OAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Choice from './choice';\nimport Header from '../header';\nimport every from 'lodash/every';\nimport Config from './config';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { removeAllChoices } from '@pie-lib/categorize';\nimport { rearrangeChoices } from '@pie-lib/categorize';\n\nexport class Choices extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n choices: PropTypes.array.isRequired,\n onModelChanged: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n toolbarOpts: PropTypes.object,\n };\n\n static defaultProps = {};\n\n state = {\n focusedEl: null,\n };\n\n changeChoice = (choice) => {\n const { choices, onModelChanged } = this.props;\n const index = choices.findIndex((h) => h.id === choice.id);\n if (index !== -1) {\n choices.splice(index, 1, choice);\n onModelChanged({ choices });\n }\n };\n\n allChoicesHaveCount = (count) => {\n const { choices } = this.props;\n return every(choices, (c) => c.categoryCount === count);\n };\n\n addChoice = () => {\n const { onModelChanged, model, choices: oldChoices } = this.props;\n\n const id = utils.firstAvailableIndex(\n model.choices.map((a) => a.id),\n 0,\n );\n const data = { id, content: 'Choice ' + id };\n\n this.setState(\n {\n focusedEl: oldChoices.length,\n },\n () => {\n onModelChanged({ choices: model.choices.concat([data]) });\n },\n );\n };\n\n deleteFocusedEl = () => {\n this.setState({\n focusedEl: null,\n });\n };\n\n deleteChoice = (choice) => {\n const { model, onModelChanged } = this.props;\n const index = model.choices.findIndex((a) => a.id === choice.id);\n if (index !== -1) {\n model.choices.splice(index, 1);\n model.correctResponse = removeAllChoices(choice.id, model.correctResponse);\n onModelChanged(model);\n }\n };\n\n rearrangeChoices = (indexFrom, indexTo) => {\n const { model, onModelChanged } = this.props || {};\n let { choices } = model || [];\n choices = rearrangeChoices(choices, indexFrom, indexTo);\n onModelChanged({ choices });\n };\n\n render() {\n const { focusedEl } = this.state;\n const {\n classes,\n className,\n choices,\n model,\n imageSupport,\n uploadSoundSupport,\n onModelChanged,\n spellCheck,\n toolbarOpts,\n configuration,\n defaultImageMaxWidth,\n defaultImageMaxHeight,\n } = this.props;\n const { errors, allowMultiplePlacementsEnabled, lockChoiceOrder } = model;\n const { choicesError, choicesErrors } = errors || {};\n const { maxChoices, maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n\n const categoryCountIsOne = this.allChoicesHaveCount(1);\n const choiceHolderStyle = {\n gridTemplateColumns: `repeat(${model.categoriesPerRow}, 1fr)`,\n };\n\n return (\n <div className={classNames(classes.choices, className)}>\n <Header\n label=\"Choices\"\n buttonLabel=\"ADD A CHOICE\"\n onAdd={this.addChoice}\n buttonDisabled={maxChoices && choices && maxChoices === choices.length}\n />\n\n <Config config={model} onModelChanged={onModelChanged} spellCheck={spellCheck} />\n\n <div className={classes.choiceHolder} style={choiceHolderStyle}>\n {choices.map((h, index) => {\n return (\n <Choice\n choice={h}\n focusedEl={focusedEl}\n deleteFocusedEl={this.deleteFocusedEl}\n correctResponseCount={h.correctResponseCount}\n allowMultiplePlacements={allowMultiplePlacementsEnabled}\n lockChoiceOrder={lockChoiceOrder}\n index={index}\n key={index}\n imageSupport={imageSupport}\n onChange={this.changeChoice}\n onDelete={() => this.deleteChoice(h)}\n rearrangeChoices={(indexFrom, indexTo) => this.rearrangeChoices(indexFrom, indexTo)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n error={choicesErrors && choicesErrors[h.id]}\n maxImageWidth={(maxImageWidth && maxImageWidth.choice) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.choice) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n );\n })}\n </div>\n {choicesError && <div className={classes.errorText}>{choicesError}</div>}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n choiceHolder: {\n paddingTop: theme.spacing.unit,\n paddingBottom: theme.spacing.unit,\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n choices: {\n marginBottom: theme.spacing.unit * 2.5,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit / 2,\n },\n});\n\nexport default withStyles(styles)(Choices);\n"],"file":"index.js"}
|
|
@@ -62,7 +62,7 @@ var Header = /*#__PURE__*/function (_React$Component) {
|
|
|
62
62
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
63
63
|
className: classes.titleContainer
|
|
64
64
|
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
65
|
-
variant: variant ||
|
|
65
|
+
variant: variant || 'title',
|
|
66
66
|
className: classes.title
|
|
67
67
|
}, label), info), /*#__PURE__*/_react["default"].createElement(_buttons.AddButton, {
|
|
68
68
|
onClick: onAdd,
|
|
@@ -92,10 +92,11 @@ var styles = function styles(theme) {
|
|
|
92
92
|
header: {
|
|
93
93
|
display: 'flex',
|
|
94
94
|
justifyContent: 'space-between',
|
|
95
|
-
marginBottom:
|
|
95
|
+
marginBottom: theme.spacing.unit
|
|
96
96
|
},
|
|
97
97
|
titleContainer: {
|
|
98
|
-
display: 'flex'
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center'
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
102
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/design/header.jsx"],"names":["Header","props","classes","className","onAdd","label","buttonLabel","info","buttonDisabled","variant","header","titleContainer","title","React","Component","PropTypes","object","isRequired","string","func","any","bool","styles","theme","display","justifyContent","marginBottom","spacing","unit"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,M;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/design/header.jsx"],"names":["Header","props","classes","className","onAdd","label","buttonLabel","info","buttonDisabled","variant","header","titleContainer","title","React","Component","PropTypes","object","isRequired","string","func","any","bool","styles","theme","display","justifyContent","marginBottom","spacing","unit","alignItems"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,M;;;;;;;;;;;;WAcX,kBAAS;AACP,wBAAyF,KAAKC,KAA9F;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,SAAjB,eAAiBA,SAAjB;AAAA,UAA4BC,KAA5B,eAA4BA,KAA5B;AAAA,UAAmCC,KAAnC,eAAmCA,KAAnC;AAAA,UAA0CC,WAA1C,eAA0CA,WAA1C;AAAA,UAAuDC,IAAvD,eAAuDA,IAAvD;AAAA,UAA6DC,cAA7D,eAA6DA,cAA7D;AAAA,UAA6EC,OAA7E,eAA6EA,OAA7E;AACA,0BACE;AAAK,QAAA,SAAS,EAAE,4BAAWP,OAAO,CAACQ,MAAnB,EAA2BP,SAA3B;AAAhB,sBACE;AAAK,QAAA,SAAS,EAAED,OAAO,CAACS;AAAxB,sBACE,gCAAC,sBAAD;AAAY,QAAA,OAAO,EAAEF,OAAO,IAAI,OAAhC;AAAyC,QAAA,SAAS,EAAEP,OAAO,CAACU;AAA5D,SACGP,KADH,CADF,EAIGE,IAJH,CADF,eAQE,gCAAC,kBAAD;AAAW,QAAA,OAAO,EAAEH,KAApB;AAA2B,QAAA,KAAK,EAAEE,WAAlC;AAA+C,QAAA,QAAQ,EAAEE;AAAzD,QARF,CADF;AAYD;;;EA5ByBK,kBAAMC,S;;;iCAArBd,M,eACQ;AACjBE,EAAAA,OAAO,EAAEa,sBAAUC,MAAV,CAAiBC,UADT;AAEjBd,EAAAA,SAAS,EAAEY,sBAAUG,MAFJ;AAGjBZ,EAAAA,WAAW,EAAES,sBAAUG,MAHN;AAIjBd,EAAAA,KAAK,EAAEW,sBAAUI,IAAV,CAAeF,UAJL;AAKjBZ,EAAAA,KAAK,EAAEU,sBAAUG,MAAV,CAAiBD,UALP;AAMjBV,EAAAA,IAAI,EAAEQ,sBAAUK,GANC;AAOjBZ,EAAAA,cAAc,EAAEO,sBAAUM,IAPT;AAQjBZ,EAAAA,OAAO,EAAEM,sBAAUG;AARF,C;iCADRlB,M,kBAYW,E;;AAkBxB,IAAMsB,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBb,IAAAA,MAAM,EAAE;AACNc,MAAAA,OAAO,EAAE,MADH;AAENC,MAAAA,cAAc,EAAE,eAFV;AAGNC,MAAAA,YAAY,EAAEH,KAAK,CAACI,OAAN,CAAcC;AAHtB,KADiB;AAMzBjB,IAAAA,cAAc,EAAE;AACda,MAAAA,OAAO,EAAE,MADK;AAEdK,MAAAA,UAAU,EAAE;AAFE;AANS,GAAZ;AAAA,CAAf;;eAWe,wBAAWP,MAAX,EAAmBtB,MAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { AddButton } from './buttons';\n\nexport class Header extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n buttonLabel: PropTypes.string,\n onAdd: PropTypes.func.isRequired,\n label: PropTypes.string.isRequired,\n info: PropTypes.any,\n buttonDisabled: PropTypes.bool,\n variant: PropTypes.string,\n };\n\n static defaultProps = {};\n\n render() {\n const { classes, className, onAdd, label, buttonLabel, info, buttonDisabled, variant } = this.props;\n return (\n <div className={classNames(classes.header, className)}>\n <div className={classes.titleContainer}>\n <Typography variant={variant || 'title'} className={classes.title}>\n {label}\n </Typography>\n {info}\n </div>\n\n <AddButton onClick={onAdd} label={buttonLabel} disabled={buttonDisabled} />\n </div>\n );\n }\n}\nconst styles = (theme) => ({\n header: {\n display: 'flex',\n justifyContent: 'space-between',\n marginBottom: theme.spacing.unit,\n },\n titleContainer: {\n display: 'flex',\n alignItems: 'center',\n },\n});\nexport default withStyles(styles)(Header);\n"],"file":"header.js"}
|
|
@@ -29,8 +29,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
29
29
|
|
|
30
30
|
var _styles = require("@material-ui/core/styles");
|
|
31
31
|
|
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
|
|
34
32
|
var _configUi = require("@pie-lib/config-ui");
|
|
35
33
|
|
|
36
34
|
var _categorize = require("@pie-lib/categorize");
|
|
@@ -45,8 +43,6 @@ var _alternateResponses = _interopRequireDefault(require("./categories/alternate
|
|
|
45
43
|
|
|
46
44
|
var _choices = _interopRequireDefault(require("./choices"));
|
|
47
45
|
|
|
48
|
-
var _buttons = require("./buttons");
|
|
49
|
-
|
|
50
46
|
var _builder = require("./builder");
|
|
51
47
|
|
|
52
48
|
var _header = _interopRequireDefault(require("./header"));
|
|
@@ -186,7 +182,6 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
186
182
|
|
|
187
183
|
var _this$props4 = this.props,
|
|
188
184
|
classes = _this$props4.classes,
|
|
189
|
-
className = _this$props4.className,
|
|
190
185
|
configuration = _this$props4.configuration,
|
|
191
186
|
imageSupport = _this$props4.imageSupport,
|
|
192
187
|
model = _this$props4.model,
|
|
@@ -291,31 +286,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
291
286
|
Properties: panelProperties
|
|
292
287
|
}
|
|
293
288
|
})
|
|
294
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
295
|
-
className: (0, _classnames["default"])(classes.design, className)
|
|
296
|
-
}, promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
297
|
-
label: prompt.label,
|
|
298
|
-
className: classes.promptHolder
|
|
299
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
300
|
-
className: classes.prompt,
|
|
301
|
-
markup: model.prompt || '',
|
|
302
|
-
onChange: this.onPromptChanged,
|
|
303
|
-
imageSupport: imageSupport,
|
|
304
|
-
nonEmpty: false,
|
|
305
|
-
disableUnderline: true,
|
|
306
|
-
toolbarOpts: toolbarOpts,
|
|
307
|
-
spellCheck: spellCheckEnabled,
|
|
308
|
-
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
309
|
-
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
310
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
311
|
-
languageCharactersProps: [{
|
|
312
|
-
language: 'spanish'
|
|
313
|
-
}, {
|
|
314
|
-
language: 'special'
|
|
315
|
-
}]
|
|
316
|
-
})), teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
289
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
317
290
|
label: teacherInstructions.label,
|
|
318
|
-
className: classes.
|
|
291
|
+
className: classes.inputContainer
|
|
319
292
|
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
320
293
|
className: classes.input,
|
|
321
294
|
markup: model.teacherInstructions || '',
|
|
@@ -332,19 +305,20 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
332
305
|
}, {
|
|
333
306
|
language: 'special'
|
|
334
307
|
}]
|
|
335
|
-
})),
|
|
336
|
-
label:
|
|
337
|
-
className: classes.
|
|
308
|
+
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
309
|
+
label: prompt.label,
|
|
310
|
+
className: classes.inputContainer
|
|
338
311
|
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
339
312
|
className: classes.input,
|
|
340
|
-
markup: model.
|
|
341
|
-
onChange: this.
|
|
313
|
+
markup: model.prompt || '',
|
|
314
|
+
onChange: this.onPromptChanged,
|
|
342
315
|
imageSupport: imageSupport,
|
|
343
316
|
nonEmpty: false,
|
|
317
|
+
disableUnderline: true,
|
|
344
318
|
toolbarOpts: toolbarOpts,
|
|
345
319
|
spellCheck: spellCheckEnabled,
|
|
346
|
-
maxImageWidth: maxImageWidth && maxImageWidth.
|
|
347
|
-
maxImageHeight: maxImageHeight && maxImageHeight.
|
|
320
|
+
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
321
|
+
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
348
322
|
uploadSoundSupport: uploadSoundSupport,
|
|
349
323
|
languageCharactersProps: [{
|
|
350
324
|
language: 'spanish'
|
|
@@ -401,11 +375,30 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
401
375
|
defaultImageMaxWidth: defaultImageMaxWidth,
|
|
402
376
|
defaultImageMaxHeight: defaultImageMaxHeight
|
|
403
377
|
}));
|
|
404
|
-
}),
|
|
378
|
+
}), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
379
|
+
label: rationale.label,
|
|
380
|
+
className: classes.inputContainer
|
|
381
|
+
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
382
|
+
className: classes.input,
|
|
383
|
+
markup: model.rationale || '',
|
|
384
|
+
onChange: this.changeRationale,
|
|
385
|
+
imageSupport: imageSupport,
|
|
386
|
+
nonEmpty: false,
|
|
387
|
+
toolbarOpts: toolbarOpts,
|
|
388
|
+
spellCheck: spellCheckEnabled,
|
|
389
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
390
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
391
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
392
|
+
languageCharactersProps: [{
|
|
393
|
+
language: 'spanish'
|
|
394
|
+
}, {
|
|
395
|
+
language: 'special'
|
|
396
|
+
}]
|
|
397
|
+
})), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
|
|
405
398
|
feedback: model.feedback,
|
|
406
399
|
onChange: this.changeFeedback,
|
|
407
400
|
toolbarOpts: toolbarOpts
|
|
408
|
-
})))
|
|
401
|
+
})));
|
|
409
402
|
}
|
|
410
403
|
}]);
|
|
411
404
|
return Design;
|
|
@@ -433,34 +426,15 @@ exports.Design = Design;
|
|
|
433
426
|
var styles = function styles(theme) {
|
|
434
427
|
return {
|
|
435
428
|
alternatesHeader: {
|
|
436
|
-
|
|
437
|
-
paddingBottom: theme.spacing.unit * 2
|
|
429
|
+
marginBottom: theme.spacing.unit * 2
|
|
438
430
|
},
|
|
439
431
|
text: {
|
|
440
432
|
paddingTop: theme.spacing.unit * 2,
|
|
441
433
|
paddingBottom: theme.spacing.unit * 2
|
|
442
434
|
},
|
|
443
|
-
|
|
444
|
-
paddingTop: theme.spacing.unit,
|
|
445
|
-
paddingBottom: theme.spacing.unit
|
|
446
|
-
},
|
|
447
|
-
inputHolder: {
|
|
435
|
+
inputContainer: {
|
|
448
436
|
width: '100%',
|
|
449
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
450
|
-
marginBottom: theme.spacing.unit * 2
|
|
451
|
-
},
|
|
452
|
-
input: {
|
|
453
437
|
paddingTop: theme.spacing.unit * 2,
|
|
454
|
-
width: '100%',
|
|
455
|
-
maxWidth: '600px'
|
|
456
|
-
},
|
|
457
|
-
prompt: {
|
|
458
|
-
paddingTop: theme.spacing.unit * 2,
|
|
459
|
-
width: '100%'
|
|
460
|
-
},
|
|
461
|
-
promptHolder: {
|
|
462
|
-
width: '100%',
|
|
463
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
464
438
|
marginBottom: theme.spacing.unit * 2
|
|
465
439
|
},
|
|
466
440
|
title: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/design/index.jsx"],"names":["dropdown","settings","Panel","toggle","radio","numberField","IdProvider","uid","Provider","Design","props","model","onChange","updatedModel","choices","map","c","categoryCount","checkAllowMultiplePlacements","allowMultiplePlacementsEnabled","correctResponse","categories","id","label","h","content","rationale","teacherInstructions","feedback","updateModel","cr","alternateResponses","prompt","index","filter","alt","altIndex","choice","allowMultiplePlacements","multiplePlacements","enabled","disabled","generateId","classes","className","configuration","imageSupport","uploadSoundSupport","onConfigurationChanged","allowAlternate","categoriesPerRow","choicesPosition","lockChoiceOrder","maxImageHeight","maxImageWidth","minCategoriesPerRow","partialScoring","scoringType","settingsPanelDisabled","spellCheck","studentInstructions","withRubric","allowAlternateEnabled","feedbackEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","toolbarOpts","position","config","columns","correctResponseCount","countChoiceInCorrectResponse","defaultImageMaxWidth","defaultImageMaxHeight","panelSettings","min","max","perChoice","panelProperties","studentInstructionsEnabled","rubricEnabled","Settings","Properties","design","promptHolder","onPromptChanged","language","inputHolder","input","changeTeacherInstructions","changeRationale","alternatesHeader","onAddAlternateResponse","categoriesList","onRemoveAlternateResponse","changeFeedback","React","Component","PropTypes","object","isRequired","string","func","shape","add","styles","theme","paddingTop","spacing","unit","paddingBottom","text","width","marginBottom","maxWidth","title"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,QAAR,GAAwDC,kBAAxD,CAAQD,QAAR;AAAA,IAAkBE,KAAlB,GAAwDD,kBAAxD,CAAkBC,KA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A,KAAK,EAAE;AACLF,MAAAA,YAAY,EAAEP,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AAD9B;AAhCkB,GAAZ;AAAA,CAAf;;eAqCe,2BAAgB,wBAAWJ,MAAX,EAAmBnG,MAAnB,CAAhB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { FeedbackConfig, InputContainer, layout, settings } from '@pie-lib/config-ui';\nimport { countInAnswer, ensureNoExtraChoicesInAnswer, ensureNoExtraChoicesInAlternate } from '@pie-lib/categorize';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { uid, withDragContext } from '@pie-lib/drag';\n\nimport Categories from './categories';\nimport AlternateResponses from './categories/alternateResponses';\nimport Choices from './choices';\nimport { Divider } from './buttons';\nimport { buildAlternateResponses, buildCategories } from './builder';\nimport Header from './header';\nimport { multiplePlacements } from '../utils';\n\nconst { dropdown, Panel, toggle, radio, numberField } = settings;\nconst { Provider: IdProvider } = uid;\n\nexport class Design extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n configuration: PropTypes.object,\n className: PropTypes.string,\n onConfigurationChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n uid: PropTypes.string,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n constructor(props) {\n super(props);\n this.uid = props.uid || uid.generateId();\n }\n\n updateModel = (props) => {\n const { model, onChange } = this.props;\n\n const updatedModel = {\n ...model,\n ...props,\n };\n\n updatedModel.choices = updatedModel.choices.map((c) => ({\n ...c,\n categoryCount: this.checkAllowMultiplePlacements(updatedModel.allowMultiplePlacementsEnabled, c),\n }));\n\n //Ensure that there are no extra choices in correctResponse, if the user has decided that only one choice may be used.\n updatedModel.correctResponse = ensureNoExtraChoicesInAnswer(\n updatedModel.correctResponse || [],\n updatedModel.choices,\n );\n\n //Ensure that there are no extra choices in alternate responses, if the user has decided that only one choice may be used.\n updatedModel.correctResponse = ensureNoExtraChoicesInAlternate(\n updatedModel.correctResponse || [],\n updatedModel.choices,\n );\n\n //clean categories\n updatedModel.categories = updatedModel.categories.map((c) => ({\n id: c.id,\n label: c.label,\n }));\n\n updatedModel.choices = updatedModel.choices.map((h) => ({\n id: h.id,\n content: h.content,\n categoryCount: h.categoryCount,\n }));\n\n onChange(updatedModel);\n };\n\n changeRationale = (rationale) => {\n const { model, onChange } = this.props;\n\n onChange({\n ...model,\n rationale,\n });\n };\n\n changeTeacherInstructions = (teacherInstructions) => {\n const { model, onChange } = this.props;\n\n onChange({\n ...model,\n teacherInstructions,\n });\n };\n\n changeFeedback = (feedback) => {\n this.updateModel({ feedback });\n };\n\n onAddAlternateResponse = () => {\n const {\n model: { correctResponse },\n } = this.props;\n\n this.updateModel({\n correctResponse: (correctResponse || []).map((cr) => ({\n ...cr,\n alternateResponses: [...(cr.alternateResponses || []), []],\n })),\n });\n };\n\n onPromptChanged = (prompt) => this.updateModel({ prompt });\n\n onRemoveAlternateResponse = (index) => {\n const {\n model: { correctResponse },\n } = this.props;\n\n this.updateModel({\n correctResponse: (correctResponse || []).map((cr) => ({\n ...cr,\n alternateResponses: (cr.alternateResponses || []).filter((alt, altIndex) => altIndex !== index),\n })),\n });\n };\n\n countChoiceInCorrectResponse = (choice) => {\n const { model } = this.props;\n\n return countInAnswer(choice.id, model.correctResponse);\n };\n\n checkAllowMultiplePlacements = (allowMultiplePlacements, c) => {\n if (allowMultiplePlacements === multiplePlacements.enabled) {\n return 0;\n }\n\n if (allowMultiplePlacements === multiplePlacements.disabled) {\n return 1;\n }\n\n return c.categoryCount || 0;\n };\n\n render() {\n const {\n classes,\n className,\n configuration,\n imageSupport,\n model,\n uploadSoundSupport,\n onConfigurationChanged,\n } = this.props;\n const {\n allowMultiplePlacements = {},\n allowAlternate = {},\n categoriesPerRow = {},\n choicesPosition = {},\n feedback = {},\n lockChoiceOrder = {},\n maxImageHeight = {},\n maxImageWidth = {},\n minCategoriesPerRow = 1,\n partialScoring = {},\n prompt = {},\n rationale = {},\n scoringType = {},\n settingsPanelDisabled,\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n withRubric = {},\n } = configuration || {};\n const {\n allowAlternateEnabled,\n feedbackEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const config = model.config || {};\n config.choices = config.choices || { label: '', columns: 2 };\n\n const categories = buildCategories(model.categories || [], model.choices || [], model.correctResponse || []);\n\n const alternateResponses = buildAlternateResponses(\n model.categories || [],\n model.choices || [],\n model.correctResponse || [],\n );\n\n const choices = model.choices.map((c) => {\n c.correctResponseCount = this.countChoiceInCorrectResponse(c);\n\n return c;\n });\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const panelSettings = {\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n categoriesPerRow:\n categoriesPerRow.settings &&\n numberField(categoriesPerRow.label, {\n label: categoriesPerRow.label,\n min: minCategoriesPerRow,\n max: 6,\n }),\n choicesPosition: choicesPosition.settings && radio(choicesPosition.label, ['below', 'above', 'left', 'right']),\n allowMultiplePlacementsEnabled:\n allowMultiplePlacements.settings &&\n dropdown(allowMultiplePlacements.label, [\n multiplePlacements.enabled,\n multiplePlacements.disabled,\n multiplePlacements.perChoice,\n ]),\n promptEnabled: prompt.settings && toggle(prompt.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n allowAlternateEnabled: allowAlternate.settings && toggle(allowAlternate.label),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n return (\n <IdProvider value={this.uid}>\n <layout.ConfigLayout\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={this.updateModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n <div className={classNames(classes.design, className)}>\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt || ''}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.inputHolder}>\n <EditableHtml\n className={classes.input}\n markup={model.teacherInstructions || ''}\n onChange={this.changeTeacherInstructions}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {rationaleEnabled && (\n <InputContainer label={rationale.label} className={classes.inputHolder}>\n <EditableHtml\n className={classes.input}\n markup={model.rationale || ''}\n onChange={this.changeRationale}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n <Categories\n imageSupport={imageSupport}\n uploadSoundSupport={uploadSoundSupport}\n model={model}\n categories={categories || []}\n onModelChanged={this.updateModel}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n configuration={configuration}\n defaultImageMaxWidth={defaultImageMaxWidth}\n defaultImageMaxHeight={defaultImageMaxHeight}\n />\n <Choices\n imageSupport={imageSupport}\n uploadSoundSupport={uploadSoundSupport}\n choices={choices}\n model={model}\n onModelChanged={this.updateModel}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n configuration={configuration}\n defaultImageMaxWidth={defaultImageMaxWidth}\n defaultImageMaxHeight={defaultImageMaxHeight}\n />\n {allowAlternateEnabled && (\n <Header\n className={classes.alternatesHeader}\n label=\"Alternate Responses\"\n buttonLabel=\"ADD AN ALTERNATE RESPONSE\"\n onAdd={this.onAddAlternateResponse}\n />\n )}\n {allowAlternateEnabled &&\n alternateResponses.map((categoriesList, index) => {\n return (\n <React.Fragment key={index}>\n <Header\n className={classes.alternatesHeader}\n variant={'subtitle1'}\n label=\"Alternate Response\"\n buttonLabel=\"REMOVE ALTERNATE RESPONSE\"\n onAdd={() => this.onRemoveAlternateResponse(index)}\n />\n <AlternateResponses\n altIndex={index}\n imageSupport={imageSupport}\n model={model}\n configuration={configuration}\n categories={categoriesList}\n onModelChanged={this.updateModel}\n uploadSoundSupport={uploadSoundSupport}\n toolbarOpts={toolbarOpts}\n defaultImageMaxWidth={defaultImageMaxWidth}\n defaultImageMaxHeight={defaultImageMaxHeight}\n />\n </React.Fragment>\n );\n })}\n {allowAlternateEnabled &&\n <Divider/>\n }\n {feedbackEnabled && (\n <FeedbackConfig feedback={model.feedback} onChange={this.changeFeedback} toolbarOpts={toolbarOpts} />\n )}\n </div>\n </layout.ConfigLayout>\n </IdProvider>\n );\n }\n}\n\nconst styles = (theme) => ({\n alternatesHeader: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n text: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n design: {\n paddingTop: theme.spacing.unit,\n paddingBottom: theme.spacing.unit,\n },\n inputHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n input: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n maxWidth: '600px',\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n title: {\n marginBottom: theme.spacing.unit * 4,\n },\n});\n\nexport default withDragContext(withStyles(styles)(Design));\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/design/index.jsx"],"names":["dropdown","settings","Panel","toggle","radio","numberField","IdProvider","uid","Provider","Design","props","model","onChange","updatedModel","choices","map","c","categoryCount","checkAllowMultiplePlacements","allowMultiplePlacementsEnabled","correctResponse","categories","id","label","h","content","rationale","teacherInstructions","feedback","updateModel","cr","alternateResponses","prompt","index","filter","alt","altIndex","choice","allowMultiplePlacements","multiplePlacements","enabled","disabled","generateId","classes","configuration","imageSupport","uploadSoundSupport","onConfigurationChanged","allowAlternate","categoriesPerRow","choicesPosition","lockChoiceOrder","maxImageHeight","maxImageWidth","minCategoriesPerRow","partialScoring","scoringType","settingsPanelDisabled","spellCheck","studentInstructions","withRubric","allowAlternateEnabled","feedbackEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","toolbarOpts","position","config","columns","correctResponseCount","countChoiceInCorrectResponse","defaultImageMaxWidth","defaultImageMaxHeight","panelSettings","min","max","perChoice","panelProperties","studentInstructionsEnabled","rubricEnabled","Settings","Properties","inputContainer","input","changeTeacherInstructions","language","onPromptChanged","alternatesHeader","onAddAlternateResponse","categoriesList","onRemoveAlternateResponse","changeRationale","changeFeedback","React","Component","PropTypes","object","isRequired","className","string","func","shape","add","styles","theme","marginBottom","spacing","unit","text","paddingTop","paddingBottom","width","title"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,QAAR,GAAwDC,kBAAxD,CAAQD,QAAR;AAAA,IAAkBE,KAAlB,GAAwDD,kBAAxD,CAAkBC,KAAlB;AAAA,IAAyBC,MAAzB,GAAwDF,kBAAxD,CAAyBE,MAAzB;AAAA,IAAiCC,KAAjC,GAAwDH,kBAAxD,CAAiCG,KAAjC;AAAA,IAAwCC,WAAxC,GAAwDJ,kBAAxD,CAAwCI,WAAxC;AACA,IAAkBC,UAAlB,GAAiCC,SAAjC,CAAQC,QAAR;;IAEaC,M;;;;;AAmBX,kBAAYC,MAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,MAAN;AADiB,oGAKL,UAACA,KAAD,EAAW;AACvB,wBAA4B,MAAKA,KAAjC;AAAA,UAAQC,KAAR,eAAQA,KAAR;AAAA,UAAeC,QAAf,eAAeA,QAAf;;AAEA,UAAMC,YAAY,mCACbF,KADa,GAEbD,KAFa,CAAlB;;AAKAG,MAAAA,YAAY,CAACC,OAAb,GAAuBD,YAAY,CAACC,OAAb,CAAqBC,GAArB,CAAyB,UAACC,CAAD;AAAA,+CAC3CA,CAD2C;AAE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AAV,CAAeH,UANR;AAOjB7F,EAAAA,GAAG,EAAE2F,sBAAUI,MAPE;AAQjBzD,EAAAA,YAAY,EAAEqD,sBAAUM,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB,CARG;AAYjBtD,EAAAA,kBAAkB,EAAEoD,sBAAUM,KAAV,CAAgB;AAClCC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADc;AAElC,cAAQF,sBAAUK,IAAV,CAAeH;AAFW,GAAhB;AAZH,C;;AAyWrB,IAAMM,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBjB,IAAAA,gBAAgB,EAAE;AAChBkB,MAAAA,YAAY,EAAED,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AADnB,KADO;AAIzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,UAAU,EAAEL,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAD7B;AAEJG,MAAAA,aAAa,EAAEN,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AAFhC,KAJmB;AAQzBzB,IAAAA,cAAc,EAAE;AACd6B,MAAAA,KAAK,EAAE,MADO;AAEdF,MAAAA,UAAU,EAAEL,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAFnB;AAGdF,MAAAA,YAAY,EAAED,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AAHrB,KARS;AAazBK,IAAAA,KAAK,EAAE;AACLP,MAAAA,YAAY,EAAED,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AAD9B;AAbkB,GAAZ;AAAA,CAAf;;eAkBe,2BAAgB,wBAAWJ,MAAX,EAAmBjG,MAAnB,CAAhB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { FeedbackConfig, InputContainer, layout, settings } from '@pie-lib/config-ui';\nimport { countInAnswer, ensureNoExtraChoicesInAnswer, ensureNoExtraChoicesInAlternate } from '@pie-lib/categorize';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { uid, withDragContext } from '@pie-lib/drag';\n\nimport Categories from './categories';\nimport AlternateResponses from './categories/alternateResponses';\nimport Choices from './choices';\nimport { buildAlternateResponses, buildCategories } from './builder';\nimport Header from './header';\nimport { multiplePlacements } from '../utils';\n\nconst { dropdown, Panel, toggle, radio, numberField } = settings;\nconst { Provider: IdProvider } = uid;\n\nexport class Design extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n configuration: PropTypes.object,\n className: PropTypes.string,\n onConfigurationChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n uid: PropTypes.string,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n constructor(props) {\n super(props);\n this.uid = props.uid || uid.generateId();\n }\n\n updateModel = (props) => {\n const { model, onChange } = this.props;\n\n const updatedModel = {\n ...model,\n ...props,\n };\n\n updatedModel.choices = updatedModel.choices.map((c) => ({\n ...c,\n categoryCount: this.checkAllowMultiplePlacements(updatedModel.allowMultiplePlacementsEnabled, c),\n }));\n\n //Ensure that there are no extra choices in correctResponse, if the user has decided that only one choice may be used.\n updatedModel.correctResponse = ensureNoExtraChoicesInAnswer(\n updatedModel.correctResponse || [],\n updatedModel.choices,\n );\n\n //Ensure that there are no extra choices in alternate responses, if the user has decided that only one choice may be used.\n updatedModel.correctResponse = ensureNoExtraChoicesInAlternate(\n updatedModel.correctResponse || [],\n updatedModel.choices,\n );\n\n //clean categories\n updatedModel.categories = updatedModel.categories.map((c) => ({\n id: c.id,\n label: c.label,\n }));\n\n updatedModel.choices = updatedModel.choices.map((h) => ({\n id: h.id,\n content: h.content,\n categoryCount: h.categoryCount,\n }));\n\n onChange(updatedModel);\n };\n\n changeRationale = (rationale) => {\n const { model, onChange } = this.props;\n\n onChange({\n ...model,\n rationale,\n });\n };\n\n changeTeacherInstructions = (teacherInstructions) => {\n const { model, onChange } = this.props;\n\n onChange({\n ...model,\n teacherInstructions,\n });\n };\n\n changeFeedback = (feedback) => {\n this.updateModel({ feedback });\n };\n\n onAddAlternateResponse = () => {\n const {\n model: { correctResponse },\n } = this.props;\n\n this.updateModel({\n correctResponse: (correctResponse || []).map((cr) => ({\n ...cr,\n alternateResponses: [...(cr.alternateResponses || []), []],\n })),\n });\n };\n\n onPromptChanged = (prompt) => this.updateModel({ prompt });\n\n onRemoveAlternateResponse = (index) => {\n const {\n model: { correctResponse },\n } = this.props;\n\n this.updateModel({\n correctResponse: (correctResponse || []).map((cr) => ({\n ...cr,\n alternateResponses: (cr.alternateResponses || []).filter((alt, altIndex) => altIndex !== index),\n })),\n });\n };\n\n countChoiceInCorrectResponse = (choice) => {\n const { model } = this.props;\n\n return countInAnswer(choice.id, model.correctResponse);\n };\n\n checkAllowMultiplePlacements = (allowMultiplePlacements, c) => {\n if (allowMultiplePlacements === multiplePlacements.enabled) {\n return 0;\n }\n\n if (allowMultiplePlacements === multiplePlacements.disabled) {\n return 1;\n }\n\n return c.categoryCount || 0;\n };\n\n render() {\n const { classes, configuration, imageSupport, model, uploadSoundSupport, onConfigurationChanged } = this.props;\n const {\n allowMultiplePlacements = {},\n allowAlternate = {},\n categoriesPerRow = {},\n choicesPosition = {},\n feedback = {},\n lockChoiceOrder = {},\n maxImageHeight = {},\n maxImageWidth = {},\n minCategoriesPerRow = 1,\n partialScoring = {},\n prompt = {},\n rationale = {},\n scoringType = {},\n settingsPanelDisabled,\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n withRubric = {},\n } = configuration || {};\n const {\n allowAlternateEnabled,\n feedbackEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const config = model.config || {};\n config.choices = config.choices || { label: '', columns: 2 };\n\n const categories = buildCategories(model.categories || [], model.choices || [], model.correctResponse || []);\n\n const alternateResponses = buildAlternateResponses(\n model.categories || [],\n model.choices || [],\n model.correctResponse || [],\n );\n\n const choices = model.choices.map((c) => {\n c.correctResponseCount = this.countChoiceInCorrectResponse(c);\n\n return c;\n });\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const panelSettings = {\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n categoriesPerRow:\n categoriesPerRow.settings &&\n numberField(categoriesPerRow.label, {\n label: categoriesPerRow.label,\n min: minCategoriesPerRow,\n max: 6,\n }),\n choicesPosition: choicesPosition.settings && radio(choicesPosition.label, ['below', 'above', 'left', 'right']),\n allowMultiplePlacementsEnabled:\n allowMultiplePlacements.settings &&\n dropdown(allowMultiplePlacements.label, [\n multiplePlacements.enabled,\n multiplePlacements.disabled,\n multiplePlacements.perChoice,\n ]),\n promptEnabled: prompt.settings && toggle(prompt.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n allowAlternateEnabled: allowAlternate.settings && toggle(allowAlternate.label),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n return (\n <IdProvider value={this.uid}>\n <layout.ConfigLayout\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={this.updateModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.inputContainer}>\n <EditableHtml\n className={classes.input}\n markup={model.teacherInstructions || ''}\n onChange={this.changeTeacherInstructions}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.inputContainer}>\n <EditableHtml\n className={classes.input}\n markup={model.prompt || ''}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n <Categories\n imageSupport={imageSupport}\n uploadSoundSupport={uploadSoundSupport}\n model={model}\n categories={categories || []}\n onModelChanged={this.updateModel}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n configuration={configuration}\n defaultImageMaxWidth={defaultImageMaxWidth}\n defaultImageMaxHeight={defaultImageMaxHeight}\n />\n\n <Choices\n imageSupport={imageSupport}\n uploadSoundSupport={uploadSoundSupport}\n choices={choices}\n model={model}\n onModelChanged={this.updateModel}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n configuration={configuration}\n defaultImageMaxWidth={defaultImageMaxWidth}\n defaultImageMaxHeight={defaultImageMaxHeight}\n />\n\n {allowAlternateEnabled && (\n <Header\n className={classes.alternatesHeader}\n label=\"Alternate Responses\"\n buttonLabel=\"ADD AN ALTERNATE RESPONSE\"\n onAdd={this.onAddAlternateResponse}\n />\n )}\n {allowAlternateEnabled &&\n alternateResponses.map((categoriesList, index) => {\n return (\n <React.Fragment key={index}>\n <Header\n className={classes.alternatesHeader}\n variant={'subtitle1'}\n label=\"Alternate Response\"\n buttonLabel=\"REMOVE ALTERNATE RESPONSE\"\n onAdd={() => this.onRemoveAlternateResponse(index)}\n />\n <AlternateResponses\n altIndex={index}\n imageSupport={imageSupport}\n model={model}\n configuration={configuration}\n categories={categoriesList}\n onModelChanged={this.updateModel}\n uploadSoundSupport={uploadSoundSupport}\n toolbarOpts={toolbarOpts}\n defaultImageMaxWidth={defaultImageMaxWidth}\n defaultImageMaxHeight={defaultImageMaxHeight}\n />\n </React.Fragment>\n );\n })}\n\n {rationaleEnabled && (\n <InputContainer label={rationale.label} className={classes.inputContainer}>\n <EditableHtml\n className={classes.input}\n markup={model.rationale || ''}\n onChange={this.changeRationale}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {feedbackEnabled && (\n <FeedbackConfig feedback={model.feedback} onChange={this.changeFeedback} toolbarOpts={toolbarOpts} />\n )}\n </layout.ConfigLayout>\n </IdProvider>\n );\n }\n}\n\nconst styles = (theme) => ({\n alternatesHeader: {\n marginBottom: theme.spacing.unit * 2,\n },\n text: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n inputContainer: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n title: {\n marginBottom: theme.spacing.unit * 4,\n },\n});\n\nexport default withDragContext(withStyles(styles)(Design));\n"],"file":"index.js"}
|
package/configure/lib/main.js
CHANGED
|
@@ -25,8 +25,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
25
25
|
|
|
26
26
|
var _styles = require("@material-ui/core/styles");
|
|
27
27
|
|
|
28
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
29
|
-
|
|
30
28
|
var _design = _interopRequireDefault(require("./design"));
|
|
31
29
|
|
|
32
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
@@ -47,23 +45,21 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
47
45
|
key: "render",
|
|
48
46
|
value: function render() {
|
|
49
47
|
var _this$props = this.props,
|
|
50
|
-
classes = _this$props.classes,
|
|
51
|
-
className = _this$props.className,
|
|
52
48
|
model = _this$props.model,
|
|
53
49
|
onModelChanged = _this$props.onModelChanged,
|
|
54
50
|
configuration = _this$props.configuration,
|
|
55
|
-
onConfigurationChanged = _this$props.onConfigurationChanged
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
imageSupport:
|
|
60
|
-
uploadSoundSupport:
|
|
51
|
+
onConfigurationChanged = _this$props.onConfigurationChanged,
|
|
52
|
+
imageSupport = _this$props.imageSupport,
|
|
53
|
+
uploadSoundSupport = _this$props.uploadSoundSupport;
|
|
54
|
+
return /*#__PURE__*/_react["default"].createElement(_design["default"], {
|
|
55
|
+
imageSupport: imageSupport,
|
|
56
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
61
57
|
title: "Design",
|
|
62
58
|
model: model,
|
|
63
59
|
configuration: configuration,
|
|
64
60
|
onChange: onModelChanged,
|
|
65
61
|
onConfigurationChanged: onConfigurationChanged
|
|
66
|
-
})
|
|
62
|
+
});
|
|
67
63
|
}
|
|
68
64
|
}]);
|
|
69
65
|
return Main;
|
|
@@ -83,9 +79,7 @@ exports.Main = Main;
|
|
|
83
79
|
(0, _defineProperty2["default"])(Main, "defaultProps", {});
|
|
84
80
|
|
|
85
81
|
var styles = function styles() {
|
|
86
|
-
return {
|
|
87
|
-
main: {}
|
|
88
|
-
};
|
|
82
|
+
return {};
|
|
89
83
|
};
|
|
90
84
|
|
|
91
85
|
var _default = (0, _styles.withStyles)(styles)(Main);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","model","onModelChanged","configuration","onConfigurationChanged","imageSupport","uploadSoundSupport","React","Component","classes","PropTypes","object","isRequired","className","string","func","styles"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;IAEaA,I;;;;;;;;;;;;WAcX,kBAAS;AACP,wBACE,KAAKC,KADP;AAAA,UAAQC,KAAR,eAAQA,KAAR;AAAA,UAAeC,cAAf,eAAeA,cAAf;AAAA,UAA+BC,aAA/B,eAA+BA,aAA/B;AAAA,UAA8CC,sBAA9C,eAA8CA,sBAA9C;AAAA,UAAsEC,YAAtE,eAAsEA,YAAtE;AAAA,UAAoFC,kBAApF,eAAoFA,kBAApF;AAGA,0BACE,gCAAC,kBAAD;AACE,QAAA,YAAY,EAAED,YADhB;AAEE,QAAA,kBAAkB,EAAEC,kBAFtB;AAGE,QAAA,KAAK,EAAC,QAHR;AAIE,QAAA,KAAK,EAAEL,KAJT;AAKE,QAAA,aAAa,EAAEE,aALjB;AAME,QAAA,QAAQ,EAAED,cANZ;AAOE,QAAA,sBAAsB,EAAEE;AAP1B,QADF;AAWD;;;EA7BuBG,kBAAMC,S;;;iCAAnBT,I,eACQ;AACjBU,EAAAA,OAAO,EAAEC,sBAAUC,MAAV,CAAiBC,UADT;AAEjBT,EAAAA,aAAa,EAAEO,sBAAUC,MAFR;AAGjBE,EAAAA,SAAS,EAAEH,sBAAUI,MAHJ;AAIjBV,EAAAA,sBAAsB,EAAEM,sBAAUK,IAJjB;AAKjBd,EAAAA,KAAK,EAAES,sBAAUC,MAAV,CAAiBC,UALP;AAMjBV,EAAAA,cAAc,EAAEQ,sBAAUK,IAAV,CAAeH,UANd;AAOjBP,EAAAA,YAAY,EAAEK,sBAAUC,MAPP;AAQjBL,EAAAA,kBAAkB,EAAEI,sBAAUC;AARb,C;iCADRZ,I,kBAYW,E;;AAmBxB,IAAMiB,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO,EAAP;AAAA,CAAf;;eAEe,wBAAWA,MAAX,EAAmBjB,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport Design from './design';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n configuration: PropTypes.object,\n className: PropTypes.string,\n onConfigurationChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n onModelChanged: PropTypes.func.isRequired,\n imageSupport: PropTypes.object,\n uploadSoundSupport: PropTypes.object,\n };\n\n static defaultProps = {};\n\n render() {\n const { model, onModelChanged, configuration, onConfigurationChanged, imageSupport, uploadSoundSupport } =\n this.props;\n\n return (\n <Design\n imageSupport={imageSupport}\n uploadSoundSupport={uploadSoundSupport}\n title=\"Design\"\n model={model}\n configuration={configuration}\n onChange={onModelChanged}\n onConfigurationChanged={onConfigurationChanged}\n />\n );\n }\n}\nconst styles = () => ({});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/categorize/choices.jsx"],"names":["Blank","Choices","props","classes","choices","model","disabled","onDropChoice","onRemoveChoice","choicePosition","style","textAlign","direction","wrapper","background","choicesLabel","labelHolder","__html","map","c","index","empty","choice","maxWidth","categoriesPerRow","React","Component","PropTypes","object","isRequired","arrayOf","oneOfType","shape","ChoiceType","bool","number","string","styles","theme","flex","padding","spacing","unit","touchAction","display","justifyContent","alignItems","margin","paddingTop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAGA,IAAMA,KAAK,GAAG,SAARA,KAAQ;AAAA,sBAAM,4CAAN;AAAA,CAAd;;IAEaC,O;;;;;;;;;;;;WAqBX,kBAAS;AACP,
|
|
1
|
+
{"version":3,"sources":["../../src/categorize/choices.jsx"],"names":["Blank","Choices","props","classes","choices","model","disabled","onDropChoice","onRemoveChoice","choicePosition","style","textAlign","direction","wrapper","background","choicesLabel","labelHolder","__html","map","c","index","empty","choice","maxWidth","categoriesPerRow","React","Component","PropTypes","object","isRequired","arrayOf","oneOfType","shape","ChoiceType","bool","number","string","styles","theme","flex","padding","spacing","unit","touchAction","display","justifyContent","alignItems","margin","paddingTop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAGA,IAAMA,KAAK,GAAG,SAARA,KAAQ;AAAA,sBAAM,4CAAN;AAAA,CAAd;;IAEaC,O;;;;;;;;;;;;WAqBX,kBAAS;AACP,wBAAiG,KAAKC,KAAtG;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,4CAAiBC,OAAjB;AAAA,UAAiBA,OAAjB,oCAA2B,EAA3B;AAAA,UAA+BC,KAA/B,eAA+BA,KAA/B;AAAA,UAAsCC,QAAtC,eAAsCA,QAAtC;AAAA,UAAgDC,YAAhD,eAAgDA,YAAhD;AAAA,UAA8DC,cAA9D,eAA8DA,cAA9D;AAAA,UAA8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yles } from '@material-ui/core/styles';\nimport Choice, { ChoiceType } from './choice';\nimport DroppablePlaceholder from './droppable-placeholder';\nexport { ChoiceType };\n\nconst Blank = () => <div />;\n\nexport class Choices extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n choices: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.shape(ChoiceType), PropTypes.shape({ empty: PropTypes.bool })]),\n ),\n model: PropTypes.shape({\n categoriesPerRow: PropTypes.number,\n choicesLabel: PropTypes.string,\n }),\n disabled: PropTypes.bool,\n choicePosition: PropTypes.string,\n };\n\n static defaultProps = {\n model: {\n categoriesPerRow: 1,\n choicesLabel: '',\n },\n };\n\n render() {\n const { classes, choices = [], model, disabled, onDropChoice, onRemoveChoice, choicePosition } = this.props;\n\n let style = {\n textAlign: 'center',\n };\n\n if (choicePosition === 'left') {\n style.direction = 'rtl';\n }\n\n return (\n <div className={classes.wrapper}>\n <DroppablePlaceholder\n onDropChoice={onDropChoice}\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n style={{ background: 'none' }}\n choiceBoard={true}\n >\n {model.choicesLabel && model.choicesLabel !== '' && (\n <div className={classes.labelHolder} dangerouslySetInnerHTML={{ __html: model.choicesLabel }}></div>\n )}\n {choices.map((c, index) => {\n return c.empty ? (\n <Blank key={index} />\n ) : (\n <Choice\n disabled={disabled}\n className={classes.choice}\n key={index}\n extraStyle={{ maxWidth: `${95 / model.categoriesPerRow}%` }}\n {...c}\n />\n );\n })}\n </DroppablePlaceholder>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n wrapper: {\n flex: 1,\n padding: theme.spacing.unit,\n touchAction: 'none',\n },\n choices: {\n padding: theme.spacing.unit / 2,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n },\n labelHolder: {\n margin: '0 auto',\n textAlign: 'center',\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport default withStyles(styles)(Choices);\n"],"file":"choices.js"}
|
package/lib/categorize/index.js
CHANGED
|
@@ -184,15 +184,13 @@ var Categorize = /*#__PURE__*/function (_React$Component) {
|
|
|
184
184
|
className: classes.collapsible
|
|
185
185
|
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
186
186
|
prompt: model.teacherInstructions
|
|
187
|
-
})),
|
|
187
|
+
}))), model.prompt && removeHTMLTags(model.prompt) && /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
188
|
+
prompt: model.prompt
|
|
189
|
+
}), /*#__PURE__*/_react["default"].createElement(_correctAnswerToggle["default"], {
|
|
188
190
|
show: showCorrect || correct === false,
|
|
189
191
|
toggled: showCorrect,
|
|
190
192
|
onToggle: this.toggleShowCorrect
|
|
191
|
-
}),
|
|
192
|
-
className: classes.prompt
|
|
193
|
-
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
194
|
-
prompt: model.prompt
|
|
195
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
193
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
196
194
|
className: classes.categorize,
|
|
197
195
|
style: style
|
|
198
196
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -296,16 +294,11 @@ var CategorizeProvider = /*#__PURE__*/function (_React$Component2) {
|
|
|
296
294
|
var styles = function styles(theme) {
|
|
297
295
|
return {
|
|
298
296
|
mainContainer: {
|
|
299
|
-
padding: theme.spacing.unit,
|
|
300
297
|
color: _renderUi.color.text(),
|
|
301
298
|
backgroundColor: _renderUi.color.background()
|
|
302
299
|
},
|
|
303
|
-
prompt: {
|
|
304
|
-
marginBottom: '35px',
|
|
305
|
-
verticalAlign: 'middle'
|
|
306
|
-
},
|
|
307
300
|
note: {
|
|
308
|
-
|
|
301
|
+
marginBottom: theme.spacing.unit * 2
|
|
309
302
|
},
|
|
310
303
|
categorize: {
|
|
311
304
|
marginBottom: theme.spacing.unit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/categorize/index.jsx"],"names":["log","removeHTMLTags","html","tmp","document","createElement","innerHTML","value","textContent","innerText","trim","Categorize","props","c","onAnswersChange","session","answers","id","categoryId","choiceIndex","draggedChoice","undefined","removeChoice","setState","showCorrect","state","onShowCorrectToggle","choicePosition","flexDirection","correctResponse","some","correctRes","alternateResponses","length","classes","model","choicesPosition","note","showNote","env","mode","role","style","getPositionDirection","categories","choices","correct","disabled","rowLabels","categoriesPerRow","nbOfRows","Math","ceil","existAlternate","existAlternateResponse","displayNote","mainContainer","teacherInstructions","hidden","visible","collapsible","toggleShowCorrect","prompt","categorize","display","flex","slice","map","label","index","alignItems","justifyContent","__html","dropChoice","rationale","correctness","feedback","React","Component","PropTypes","object","isRequired","shape","arrayOf","choice","string","category","func","CategorizeProvider","uid","generateId","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","marginBottom","verticalAlign","paddingBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAOA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,oBAAN,CAAZ;;AAEA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,IAAD,EAAU;AAC/B,MAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAZ;AAEAF,EAAAA,GAAG,CAACG,SAAJ,GAAgBJ,IAAhB;AAEA,MAAMK,KAAK,GAAGJ,GAAG,CAACK,WAAJ,IAAmBL,GAAG,CAACM,SAAvB,IAAoC,EAAlD;AAEA,SAAOF,KAAK,CAACG,IAAN,EAAP;AACD,CARD;;IAUaC,U;;;;;AAoBX,sBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,qGAQJ,UAACC,CAAD,EAAO;AACpBb,MAAAA,GAAG,CAAC,kBAAD,EAAqBa,CAArB,CAAH;AACA,wBAAqC,MAAKD,KAA1C;AAAA,UAAQE,eAAR,eAAQA,eAA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ba;AAkBzBgC,IAAAA,WAAW,EAAE;AACX0C,MAAAA,aAAa,EAAEV,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB;AADzB;AAlBY,GAAZ;AAAA,CAAf;;eAuBe,2BAAgB,wBAAWJ,MAAX,EAAmBH,kBAAnB,CAAhB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Choices from './choices';\nimport Categories from './categories';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { withStyles } from '@material-ui/core/styles';\nimport {\n buildState,\n removeChoiceFromCategory,\n moveChoiceToCategory,\n} from '@pie-lib/categorize';\nimport { withDragContext, uid } from '@pie-lib/drag';\nimport {\n color,\n Feedback,\n Collapsible,\n hasText,\n PreviewPrompt,\n} from '@pie-lib/render-ui';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:categorize');\n\nconst removeHTMLTags = (html) => {\n const tmp = document.createElement('DIV');\n\n tmp.innerHTML = html;\n\n const value = tmp.textContent || tmp.innerText || '';\n\n return value.trim();\n};\n\nexport class Categorize extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\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 };\n\n static defaultProps = {\n disabled: false,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: false,\n };\n }\n\n removeChoice = (c) => {\n log('[removeChoice]: ', c);\n const { onAnswersChange, session } = this.props;\n const answers = removeChoiceFromCategory(\n c.id,\n c.categoryId,\n c.choiceIndex,\n session.answers\n );\n onAnswersChange(answers);\n };\n\n dropChoice = (categoryId, draggedChoice) => {\n const { session, onAnswersChange } = this.props;\n if (draggedChoice) {\n log(\n '[dropChoice] category: ',\n draggedChoice.categoryId,\n 'choice: ',\n draggedChoice\n );\n } else {\n log('[dropChoice] category: ', undefined, 'choice: ', undefined);\n }\n\n const answers = draggedChoice ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n session.answers\n ) : this.removeChoice(categoryId)\n\n if (draggedChoice) {\n onAnswersChange(answers);\n } \n };\n\n UNSAFE_componentWillReceiveProps() {\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) => correctResponse?.some(correctRes => correctRes.alternateResponses?.length > 0);\n\n render() {\n const { classes, model, session } = this.props;\n const { showCorrect } = this.state;\n const { choicesPosition, note, showNote, env } = model;\n const { mode, role } = env || {};\n const choicePosition = choicesPosition || 'above';\n\n const style = {\n flexDirection: this.getPositionDirection(choicePosition),\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 } = model;\n const nbOfRows = categories && Math.ceil(categories.length / categoriesPerRow) || 0;\n const existAlternate = this.existAlternateResponse(correctResponse) || false;\n const displayNote = (showCorrect || mode === 'view' && role === 'instructor') && showNote && note && existAlternate;\n\n return (\n <div className={classes.mainContainer}>\n {model.teacherInstructions && hasText(model.teacherInstructions) && (\n <React.Fragment>\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n className={classes.collapsible}\n >\n <PreviewPrompt prompt={model.teacherInstructions} />\n </Collapsible>\n <br />\n </React.Fragment>\n )}\n <CorrectAnswerToggle\n show={showCorrect || correct === false}\n toggled={showCorrect}\n onToggle={this.toggleShowCorrect}\n />\n {model.prompt && removeHTMLTags(model.prompt) && (\n <div className={classes.prompt}>\n <PreviewPrompt prompt={model.prompt} />\n </div>\n )}\n <div className={classes.categorize} style={style}>\n <div style={{ display: 'flex', flex: 1 }}>\n\n {\n !!(rowLabels && nbOfRows) && (\n <div style={{ display: 'grid'}}>\n {rowLabels.slice(0, nbOfRows).map((label, index) => (\n <div\n key={index}\n style={{\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center'\n }}\n dangerouslySetInnerHTML={{\n __html: label\n }}\n />\n ))}\n </div>\n )\n }\n <Categories\n model={model}\n disabled={model.disabled}\n categories={categories}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\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 />\n </div>\n {displayNote && (\n <div\n className={classes.note}\n dangerouslySetInnerHTML={{\n __html: `<strong>Note:</strong> ${note}`,\n }}\n />\n )}\n {model.rationale && hasText(model.rationale) && (\n <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n className={classes.collapsible}\n >\n <PreviewPrompt prompt={model.rationale} />\n </Collapsible>\n )}\n {model.correctness && model.feedback && !showCorrect && (\n <Feedback correctness={model.correctness} feedback={model.feedback} />\n )}\n </div>\n );\n }\n}\n\nclass CategorizeProvider extends React.Component {\n constructor(props) {\n super(props);\n this.uid = uid.generateId();\n }\n\n render() {\n return (\n <uid.Provider value={this.uid}>\n <Categorize {...this.props} />\n </uid.Provider>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background(),\n },\n prompt: {\n marginBottom: '35px',\n verticalAlign: 'middle',\n },\n note: {\n padding: '5px 0',\n },\n categorize: {\n marginBottom: theme.spacing.unit,\n display: 'flex',\n flexDirection: 'column',\n },\n collapsible: {\n paddingBottom: theme.spacing.unit * 2,\n },\n});\n\nexport default withDragContext(withStyles(styles)(CategorizeProvider));\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/categorize/index.jsx"],"names":["log","removeHTMLTags","html","tmp","document","createElement","innerHTML","value","textContent","innerText","trim","Categorize","props","c","onAnswersChange","session","answers","id","categoryId","choiceIndex","draggedChoice","undefined","removeChoice","setState","showCorrect","state","onShowCorrectToggle","choicePosition","flexDirection","correctResponse","some","correctRes","alternateResponses","length","classes","model","choicesPosition","note","showNote","env","mode","role","style","getPositionDirection","categories","choices","correct","disabled","rowLabels","categoriesPerRow","nbOfRows","Math","ceil","existAlternate","existAlternateResponse","displayNote","mainContainer","teacherInstructions","hidden","visible","collapsible","prompt","toggleShowCorrect","categorize","display","flex","slice","map","label","index","alignItems","justifyContent","__html","dropChoice","rationale","correctness","feedback","React","Component","PropTypes","object","isRequired","shape","arrayOf","choice","string","category","func","CategorizeProvider","uid","generateId","styles","theme","color","text","backgroundColor","background","marginBottom","spacing","unit","paddingBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,oBAAN,CAAZ;;AAEA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,IAAD,EAAU;AAC/B,MAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAZ;AAEAF,EAAAA,GAAG,CAACG,SAAJ,GAAgBJ,IAAhB;AAEA,MAAMK,KAAK,GAAGJ,GAAG,CAACK,WAAJ,IAAmBL,GAAG,CAACM,SAAvB,IAAoC,EAAlD;AAEA,SAAOF,KAAK,CAACG,IAAN,EAAP;AACD,CARD;;IAUaC,U;;;;;AAoBX,sBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA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E;AACXwC,MAAAA,aAAa,EAAER,KAAK,CAACM,OAAN,CAAcC,IAAd,GAAqB;AADzB;AAbY,GAAZ;AAAA,CAAf;;eAkBe,2BAAgB,wBAAWR,MAAX,EAAmBH,kBAAnB,CAAhB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Choices from './choices';\nimport Categories from './categories';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { withStyles } from '@material-ui/core/styles';\nimport { buildState, removeChoiceFromCategory, moveChoiceToCategory } from '@pie-lib/categorize';\nimport { withDragContext, uid } from '@pie-lib/drag';\nimport { color, Feedback, Collapsible, hasText, PreviewPrompt } from '@pie-lib/render-ui';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:categorize');\n\nconst removeHTMLTags = (html) => {\n const tmp = document.createElement('DIV');\n\n tmp.innerHTML = html;\n\n const value = tmp.textContent || tmp.innerText || '';\n\n return value.trim();\n};\n\nexport class Categorize extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\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 };\n\n static defaultProps = {\n disabled: false,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: 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 } = this.props;\n if (draggedChoice) {\n log('[dropChoice] category: ', draggedChoice.categoryId, 'choice: ', draggedChoice);\n } else {\n log('[dropChoice] category: ', undefined, 'choice: ', undefined);\n }\n\n const answers = draggedChoice\n ? moveChoiceToCategory(\n draggedChoice.id,\n draggedChoice.categoryId,\n categoryId,\n draggedChoice.choiceIndex,\n session.answers,\n )\n : this.removeChoice(categoryId);\n\n if (draggedChoice) {\n onAnswersChange(answers);\n }\n };\n\n UNSAFE_componentWillReceiveProps() {\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 { classes, model, session } = this.props;\n const { showCorrect } = this.state;\n const { choicesPosition, note, showNote, env } = model;\n const { mode, role } = env || {};\n const choicePosition = choicesPosition || 'above';\n\n const style = {\n flexDirection: this.getPositionDirection(choicePosition),\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 } = 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\n return (\n <div className={classes.mainContainer}>\n {model.teacherInstructions && hasText(model.teacherInstructions) && (\n <React.Fragment>\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n className={classes.collapsible}\n >\n <PreviewPrompt prompt={model.teacherInstructions} />\n </Collapsible>\n </React.Fragment>\n )}\n\n {model.prompt && removeHTMLTags(model.prompt) && <PreviewPrompt prompt={model.prompt} />}\n\n <CorrectAnswerToggle\n show={showCorrect || correct === false}\n toggled={showCorrect}\n onToggle={this.toggleShowCorrect}\n />\n\n <div className={classes.categorize} style={style}>\n <div style={{ display: 'flex', flex: 1 }}>\n {!!(rowLabels && nbOfRows) && (\n <div style={{ display: 'grid' }}>\n {rowLabels.slice(0, nbOfRows).map((label, index) => (\n <div\n key={index}\n style={{\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n }}\n dangerouslySetInnerHTML={{\n __html: label,\n }}\n />\n ))}\n </div>\n )}\n <Categories\n model={model}\n disabled={model.disabled}\n categories={categories}\n onDropChoice={this.dropChoice}\n onRemoveChoice={this.removeChoice}\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 />\n </div>\n\n {displayNote && (\n <div\n className={classes.note}\n dangerouslySetInnerHTML={{\n __html: `<strong>Note:</strong> ${note}`,\n }}\n />\n )}\n\n {model.rationale && hasText(model.rationale) && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }} className={classes.collapsible}>\n <PreviewPrompt prompt={model.rationale} />\n </Collapsible>\n )}\n\n {model.correctness && model.feedback && !showCorrect && (\n <Feedback correctness={model.correctness} feedback={model.feedback} />\n )}\n </div>\n );\n }\n}\n\nclass CategorizeProvider extends React.Component {\n constructor(props) {\n super(props);\n this.uid = uid.generateId();\n }\n\n render() {\n return (\n <uid.Provider value={this.uid}>\n <Categorize {...this.props} />\n </uid.Provider>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n },\n note: {\n marginBottom: theme.spacing.unit * 2,\n },\n categorize: {\n marginBottom: theme.spacing.unit,\n display: 'flex',\n flexDirection: 'column',\n },\n collapsible: {\n paddingBottom: theme.spacing.unit * 2,\n },\n});\n\nexport default withDragContext(withStyles(styles)(CategorizeProvider));\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "7.9.1-next.
|
|
7
|
+
"version": "7.9.1-next.51+a42a408d1",
|
|
8
8
|
"description": "",
|
|
9
9
|
"author": "pie framework developers",
|
|
10
10
|
"license": "ISC",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"react-dnd": "^14.0.5",
|
|
25
25
|
"react-dom": "^16.8.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "a42a408d1d238e52cbcf907fbbaec2ee98550385",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"postpublish": "../../scripts/postpublish"
|
|
30
30
|
},
|