@pie-element/placement-ordering 7.8.12 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/configure/CHANGELOG.md +17 -0
- package/configure/lib/choice-editor.js +6 -2
- package/configure/lib/choice-editor.js.map +1 -1
- package/configure/lib/choice-tile.js +6 -2
- package/configure/lib/choice-tile.js.map +1 -1
- package/configure/lib/defaults.js +13 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design.js +28 -7
- package/configure/lib/design.js.map +1 -1
- package/configure/package.json +4 -4
- package/docs/config-schema.json +108 -0
- package/docs/config-schema.json.md +85 -1
- package/docs/pie-schema.json +36 -0
- package/docs/pie-schema.json.md +28 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@7.8.12...@pie-element/placement-ordering@8.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [7.8.12](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@7.8.11...@pie-element/placement-ordering@7.8.12) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @pie-element/placement-ordering
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@5.6.12...@pie-element/placement-ordering-configure@6.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [5.6.12](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@5.6.11...@pie-element/placement-ordering-configure@5.6.12) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @pie-element/placement-ordering-configure
|
|
@@ -348,7 +348,9 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
348
348
|
singularChoiceLabel = _this$props5.singularChoiceLabel,
|
|
349
349
|
pluralChoiceLabel = _this$props5.pluralChoiceLabel,
|
|
350
350
|
choicesLabel = _this$props5.choicesLabel,
|
|
351
|
-
spellCheck = _this$props5.spellCheck
|
|
351
|
+
spellCheck = _this$props5.spellCheck,
|
|
352
|
+
maxImageWidth = _this$props5.maxImageWidth,
|
|
353
|
+
maxImageHeight = _this$props5.maxImageHeight;
|
|
352
354
|
var dialog = this.state.dialog;
|
|
353
355
|
var ordering = {
|
|
354
356
|
choices: choices,
|
|
@@ -379,7 +381,9 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
379
381
|
toolbarOpts: toolbarOpts,
|
|
380
382
|
choices: choices,
|
|
381
383
|
choicesLabel: choicesLabel,
|
|
382
|
-
spellCheck: spellCheck
|
|
384
|
+
spellCheck: spellCheck,
|
|
385
|
+
maxImageWidth: maxImageWidth,
|
|
386
|
+
maxImageHeight: maxImageHeight
|
|
383
387
|
});
|
|
384
388
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
385
389
|
className: classes.controls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/choice-editor.jsx"],"names":["InfoDialog","title","open","onOk","propTypes","PropTypes","string","bool","func","findFreeChoiceSlot","choices","slot","ids","map","c","id","includes","log","updateResponseOrChoices","response","from","to","fromType","type","fromIndex","index","toType","placeAtIndex","updatedResponse","reduce","acc","item","movedItem","remainingItems","push","slice","updatedChoices","toIndex","buildTiles","instanceId","targets","r","respId","choice","find","undefined","draggable","editable","processedChoices","m","Object","assign","droppable","concat","ChoiceEditor","props","dialog","onChoiceChange","onChange","correctResponse","toolbarOpts","findIndex","splice","label","onDelete","choicesLabel","length","setState","message","filter","updatedCorrectResponse","v","addChoice","freeId","newChoice","newCorrectResponse","weight","shuffleChoices","placementArea","shuffled","shuffledCorrect","shuffledTwice","onDropChoice","ordering","target","source","tiles","t","classes","imageSupport","disableImages","singularChoiceLabel","pluralChoiceLabel","spellCheck","state","Array","style","gridTemplateColumns","gridTemplateRows","choiceEditor","vtiler","bind","controls","root","addButtonRoot","addButtonLabel","toUpperCase","React","Component","object","isRequired","array","shape","add","styles","theme","allToggle","marginTop","display","alignItems","justifyContent","width","height","fill","palette","primary","paddingHorizontal","transition","opacity","gridAutoFlow","gridGap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,IAAMA,UAAU,GAAG,SAAbA,UAAa;AAAA,MAA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AAE,MADE;AAEbS,MAAAA,iBAAiB,EAAE;AAFN,KAfQ;AAmBvBrB,IAAAA,cAAc,EAAE;AACdsB,MAAAA,UAAU,EAAE,sBADE;AAEd,iBAAW;AACTC,QAAAA,OAAO,EAAE;AADA;AAFG,KAnBO;AAyBvB5B,IAAAA,MAAM,EAAE;AACN6B,MAAAA,YAAY,EAAE,QADR;AAENX,MAAAA,OAAO,EAAE,MAFH;AAGNY,MAAAA,OAAO,EAAE;AAHH;AAzBe,GAAL;AAAA,CAApB;;eAgCe,wBAAWhB,MAAX,EAAmB5D,YAAnB,C","sourcesContent":["import ChoiceTile from './choice-tile';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport isEmpty from 'lodash/isEmpty';\nimport cloneDeep from 'lodash/cloneDeep';\nimport uniqueId from 'lodash/uniqueId';\nimport shuffle from 'lodash/shuffle';\nimport isEqual from 'lodash/isEqual';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\n\nexport const InfoDialog = ({ title, open, onOk }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n title: PropTypes.string,\n open: PropTypes.bool,\n onOk: PropTypes.func,\n};\n\nfunction findFreeChoiceSlot(choices) {\n let slot = 1;\n const ids = choices.map(c => c.id);\n while (ids.includes(`c${slot}`)) {\n slot++;\n }\n return slot;\n}\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-editor');\n\nfunction updateResponseOrChoices(response, choices, from, to) {\n const { type: fromType, index: fromIndex } = from;\n const { type: toType, index: placeAtIndex } = to;\n\n if (fromType === 'target' && toType === 'target') {\n const updatedResponse = cloneDeep(response) || [];\n\n const { movedItem, remainingItems } = updatedResponse.reduce(\n (acc, item, index) => {\n if (index === fromIndex) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [] }\n );\n\n return {\n response: [\n ...remainingItems.slice(0, placeAtIndex),\n movedItem,\n ...remainingItems.slice(placeAtIndex)\n ],\n choices\n };\n }\n\n if (fromType === 'choice' && toType === 'choice') {\n const updatedChoices = cloneDeep(choices) || [];\n\n const { movedItem, remainingItems, toIndex } = updatedChoices.reduce(\n (acc, item, index) => {\n if (item.id === from.id) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n if (item.id === to.id) {\n acc.toIndex = index;\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [], toIndex: null }\n );\n\n return {\n response,\n choices: [\n ...remainingItems.slice(0, toIndex),\n movedItem,\n ...remainingItems.slice(toIndex)\n ]\n };\n }\n\n return { response, choices };\n}\n\nfunction buildTiles(choices, response, instanceId) {\n const targets = response.map((r, index) => {\n const respId = r && r.id;\n\n const choice = choices.find(c => respId !== undefined && respId !== null && c.id === respId);\n\n return {\n type: 'target',\n instanceId,\n ...choice,\n draggable: true,\n index,\n editable: false\n };\n });\n\n const processedChoices = choices.map(m => {\n return Object.assign({}, m, {\n type: 'choice',\n droppable: false,\n draggable: true,\n instanceId,\n editable: true\n });\n });\n\n return processedChoices.concat(targets);\n}\n\nclass ChoiceEditor extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array.isRequired,\n choices: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n }),\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n placementArea: PropTypes.bool,\n singularChoiceLabel: PropTypes.string,\n pluralChoiceLabel: PropTypes.string,\n choicesLabel: PropTypes.string\n };\n\n state = {\n dialog: {\n open: false\n }\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n this.onChoiceChange = choice => {\n const { choices, onChange, correctResponse, toolbarOpts } = this.props;\n const index = choices.findIndex(c => c.id === choice.id);\n\n choices.splice(index, 1, { ...choices[index], label: choice.label });\n onChange(choices, correctResponse);\n };\n\n this.onDelete = choice => {\n const { choices, onChange, correctResponse, choicesLabel } = this.props;\n\n if (choices && choices.length === 3) {\n this.setState({\n dialog: {\n open: true,\n message: `There have to be at least 3 ${choicesLabel}.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false,\n }\n }\n );\n }\n }\n });\n }\n else {\n const updatedChoices = choices.filter(c => c.id !== choice.id);\n const updatedCorrectResponse = correctResponse.filter(\n v => v.id !== choice.id\n );\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.addChoice = () => {\n const { choices, correctResponse, onChange, choicesLabel } = this.props;\n\n if (choices && choices.length === 10) {\n this.setState({\n dialog: {\n open: true,\n message: `There can be maximum 10 ${choicesLabel}.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false,\n }\n }\n );\n }\n }\n });\n }\n else {\n const freeId = findFreeChoiceSlot(choices);\n const id = `c${freeId}`;\n const newChoice = {id, label: ''};\n\n const newCorrectResponse = {\n id,\n /**\n * Note: weights are not configurable in the existing component\n * so we'll want do disable this in the controller and ignore it for now.\n */\n weight: 0\n };\n\n const updatedChoices = choices.concat([newChoice]);\n const updatedCorrectResponse = correctResponse.concat([\n newCorrectResponse\n ]);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.shuffleChoices = () => {\n const { onChange, choices, correctResponse, placementArea } = this.props;\n let shuffled = shuffle(choices);\n\n // if placementArea is disabled, make sure we don't shuffle choices in the correct order\n const shuffledCorrect = !placementArea && isEqual(shuffled.map(item => item.id), correctResponse.map(item => item.id));\n\n if (shuffledCorrect) {\n const shuffledTwice = shuffle(shuffled);\n\n onChange(shuffledTwice, correctResponse);\n } else {\n onChange(shuffled, correctResponse);\n }\n };\n\n this.onDropChoice = (ordering, target, source) => {\n const { onChange } = this.props;\n const from = ordering.tiles.find(\n t => t.id === source.id && t.type === source.type\n );\n const to = target;\n log('[onDropChoice] ', from, to);\n const { response, choices } = updateResponseOrChoices(ordering.response, ordering.choices, from, to);\n\n onChange(choices, response);\n };\n }\n\n render() {\n const {\n classes,\n correctResponse,\n choices,\n imageSupport,\n disableImages,\n toolbarOpts,\n singularChoiceLabel,\n pluralChoiceLabel,\n choicesLabel,\n spellCheck\n } = this.props;\n const { dialog } = this.state;\n\n const ordering = {\n choices,\n response: !correctResponse || isEmpty(correctResponse) ? new Array(choices.length) : correctResponse,\n tiles: buildTiles(choices, correctResponse, this.instanceId),\n };\n\n const style = {\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridTemplateRows: `repeat(${choices.length}, 1fr)`\n };\n\n return (\n <div className={classes.choiceEditor}>\n <div className={classes.vtiler} style={style}>\n\n {ordering.tiles.map((c, index) => (\n <ChoiceTile\n choice={c}\n index={index}\n key={index}\n imageSupport={imageSupport}\n onDelete={this.onDelete.bind(this, c)}\n onChoiceChange={this.onChoiceChange}\n onDropChoice={(source, index) => this.onDropChoice(ordering, c, source, index)}\n disableImages={disableImages}\n toolbarOpts={toolbarOpts}\n choices={choices}\n choicesLabel={choicesLabel}\n spellCheck={spellCheck}\n />\n ))}\n </div>\n <div className={classes.controls}>\n <Button\n onClick={this.shuffleChoices}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{\n root: classes.addButtonRoot,\n label: classes.addButtonLabel\n }}\n >\n {`SHUFFLE ${pluralChoiceLabel}`.toUpperCase()}\n </Button>\n <Button\n onClick={this.addChoice}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{\n root: classes.addButtonRoot,\n label: classes.addButtonLabel\n }}\n >\n {`ADD ${singularChoiceLabel}`.toUpperCase()}\n </Button>\n </div>\n <InfoDialog\n title={dialog.message}\n open={dialog.open}\n onOk={dialog.onOk}\n />\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n allToggle: {},\n choiceEditor: {\n marginTop: '10px'\n },\n controls: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between'\n },\n root: {\n width: '30px',\n height: '30px',\n fill: theme.palette.primary[500]\n },\n addButtonRoot: {\n marginTop: '24px',\n paddingHorizontal: '12px'\n },\n addButtonLabel: {\n transition: 'opacity 200ms linear',\n '&:hover': {\n opacity: 0.3\n }\n },\n vtiler: {\n gridAutoFlow: 'column',\n display: 'grid',\n gridGap: '10px'\n }\n});\n\nexport default withStyles(styles)(ChoiceEditor);\n"],"file":"choice-editor.js"}
|
|
1
|
+
{"version":3,"sources":["../src/choice-editor.jsx"],"names":["InfoDialog","title","open","onOk","propTypes","PropTypes","string","bool","func","findFreeChoiceSlot","choices","slot","ids","map","c","id","includes","log","updateResponseOrChoices","response","from","to","fromType","type","fromIndex","index","toType","placeAtIndex","updatedResponse","reduce","acc","item","movedItem","remainingItems","push","slice","updatedChoices","toIndex","buildTiles","instanceId","targets","r","respId","choice","find","undefined","draggable","editable","processedChoices","m","Object","assign","droppable","concat","ChoiceEditor","props","dialog","onChoiceChange","onChange","correctResponse","toolbarOpts","findIndex","splice","label","onDelete","choicesLabel","length","setState","message","filter","updatedCorrectResponse","v","addChoice","freeId","newChoice","newCorrectResponse","weight","shuffleChoices","placementArea","shuffled","shuffledCorrect","shuffledTwice","onDropChoice","ordering","target","source","tiles","t","classes","imageSupport","disableImages","singularChoiceLabel","pluralChoiceLabel","spellCheck","maxImageWidth","maxImageHeight","state","Array","style","gridTemplateColumns","gridTemplateRows","choiceEditor","vtiler","bind","controls","root","addButtonRoot","addButtonLabel","toUpperCase","React","Component","object","isRequired","array","shape","add","styles","theme","allToggle","marginTop","display","alignItems","justifyContent","width","height","fill","palette","primary","paddingHorizontal","transition","opacity","gridAutoFlow","gridGap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;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AAHR,KALa;AAUvBjB,IAAAA,IAAI,EAAE;AACJkB,MAAAA,KAAK,EAAE,MADH;AAEJC,MAAAA,MAAM,EAAE,MAFJ;AAGJC,MAAAA,IAAI,EAAER,KAAK,CAACS,OAAN,CAAcC,OAAd,CAAsB,GAAtB;AAHF,KAViB;AAevBrB,IAAAA,aAAa,EAAE;AACba,MAAAA,SAAS,EAAE,MADE;AAEbS,MAAAA,iBAAiB,EAAE;AAFN,KAfQ;AAmBvBrB,IAAAA,cAAc,EAAE;AACdsB,MAAAA,UAAU,EAAE,sBADE;AAEd,iBAAW;AACTC,QAAAA,OAAO,EAAE;AADA;AAFG,KAnBO;AAyBvB5B,IAAAA,MAAM,EAAE;AACN6B,MAAAA,YAAY,EAAE,QADR;AAENX,MAAAA,OAAO,EAAE,MAFH;AAGNY,MAAAA,OAAO,EAAE;AAHH;AAzBe,GAAL;AAAA,CAApB;;eAgCe,wBAAWhB,MAAX,EAAmB9D,YAAnB,C","sourcesContent":["import ChoiceTile from './choice-tile';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport isEmpty from 'lodash/isEmpty';\nimport cloneDeep from 'lodash/cloneDeep';\nimport uniqueId from 'lodash/uniqueId';\nimport shuffle from 'lodash/shuffle';\nimport isEqual from 'lodash/isEqual';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\n\nexport const InfoDialog = ({ title, open, onOk }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n title: PropTypes.string,\n open: PropTypes.bool,\n onOk: PropTypes.func,\n};\n\nfunction findFreeChoiceSlot(choices) {\n let slot = 1;\n const ids = choices.map(c => c.id);\n while (ids.includes(`c${slot}`)) {\n slot++;\n }\n return slot;\n}\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-editor');\n\nfunction updateResponseOrChoices(response, choices, from, to) {\n const { type: fromType, index: fromIndex } = from;\n const { type: toType, index: placeAtIndex } = to;\n\n if (fromType === 'target' && toType === 'target') {\n const updatedResponse = cloneDeep(response) || [];\n\n const { movedItem, remainingItems } = updatedResponse.reduce(\n (acc, item, index) => {\n if (index === fromIndex) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [] }\n );\n\n return {\n response: [\n ...remainingItems.slice(0, placeAtIndex),\n movedItem,\n ...remainingItems.slice(placeAtIndex)\n ],\n choices\n };\n }\n\n if (fromType === 'choice' && toType === 'choice') {\n const updatedChoices = cloneDeep(choices) || [];\n\n const { movedItem, remainingItems, toIndex } = updatedChoices.reduce(\n (acc, item, index) => {\n if (item.id === from.id) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n if (item.id === to.id) {\n acc.toIndex = index;\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [], toIndex: null }\n );\n\n return {\n response,\n choices: [\n ...remainingItems.slice(0, toIndex),\n movedItem,\n ...remainingItems.slice(toIndex)\n ]\n };\n }\n\n return { response, choices };\n}\n\nfunction buildTiles(choices, response, instanceId) {\n const targets = response.map((r, index) => {\n const respId = r && r.id;\n\n const choice = choices.find(c => respId !== undefined && respId !== null && c.id === respId);\n\n return {\n type: 'target',\n instanceId,\n ...choice,\n draggable: true,\n index,\n editable: false\n };\n });\n\n const processedChoices = choices.map(m => {\n return Object.assign({}, m, {\n type: 'choice',\n droppable: false,\n draggable: true,\n instanceId,\n editable: true\n });\n });\n\n return processedChoices.concat(targets);\n}\n\nclass ChoiceEditor extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array.isRequired,\n choices: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n }),\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n placementArea: PropTypes.bool,\n singularChoiceLabel: PropTypes.string,\n pluralChoiceLabel: PropTypes.string,\n choicesLabel: PropTypes.string\n };\n\n state = {\n dialog: {\n open: false\n }\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n this.onChoiceChange = choice => {\n const { choices, onChange, correctResponse, toolbarOpts } = this.props;\n const index = choices.findIndex(c => c.id === choice.id);\n\n choices.splice(index, 1, { ...choices[index], label: choice.label });\n onChange(choices, correctResponse);\n };\n\n this.onDelete = choice => {\n const { choices, onChange, correctResponse, choicesLabel } = this.props;\n\n if (choices && choices.length === 3) {\n this.setState({\n dialog: {\n open: true,\n message: `There have to be at least 3 ${choicesLabel}.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false,\n }\n }\n );\n }\n }\n });\n }\n else {\n const updatedChoices = choices.filter(c => c.id !== choice.id);\n const updatedCorrectResponse = correctResponse.filter(\n v => v.id !== choice.id\n );\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.addChoice = () => {\n const { choices, correctResponse, onChange, choicesLabel } = this.props;\n\n if (choices && choices.length === 10) {\n this.setState({\n dialog: {\n open: true,\n message: `There can be maximum 10 ${choicesLabel}.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false,\n }\n }\n );\n }\n }\n });\n }\n else {\n const freeId = findFreeChoiceSlot(choices);\n const id = `c${freeId}`;\n const newChoice = {id, label: ''};\n\n const newCorrectResponse = {\n id,\n /**\n * Note: weights are not configurable in the existing component\n * so we'll want do disable this in the controller and ignore it for now.\n */\n weight: 0\n };\n\n const updatedChoices = choices.concat([newChoice]);\n const updatedCorrectResponse = correctResponse.concat([\n newCorrectResponse\n ]);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.shuffleChoices = () => {\n const { onChange, choices, correctResponse, placementArea } = this.props;\n let shuffled = shuffle(choices);\n\n // if placementArea is disabled, make sure we don't shuffle choices in the correct order\n const shuffledCorrect = !placementArea && isEqual(shuffled.map(item => item.id), correctResponse.map(item => item.id));\n\n if (shuffledCorrect) {\n const shuffledTwice = shuffle(shuffled);\n\n onChange(shuffledTwice, correctResponse);\n } else {\n onChange(shuffled, correctResponse);\n }\n };\n\n this.onDropChoice = (ordering, target, source) => {\n const { onChange } = this.props;\n const from = ordering.tiles.find(\n t => t.id === source.id && t.type === source.type\n );\n const to = target;\n log('[onDropChoice] ', from, to);\n const { response, choices } = updateResponseOrChoices(ordering.response, ordering.choices, from, to);\n\n onChange(choices, response);\n };\n }\n\n render() {\n const {\n classes,\n correctResponse,\n choices,\n imageSupport,\n disableImages,\n toolbarOpts,\n singularChoiceLabel,\n pluralChoiceLabel,\n choicesLabel,\n spellCheck,\n maxImageWidth,\n maxImageHeight\n } = this.props;\n const { dialog } = this.state;\n\n const ordering = {\n choices,\n response: !correctResponse || isEmpty(correctResponse) ? new Array(choices.length) : correctResponse,\n tiles: buildTiles(choices, correctResponse, this.instanceId),\n };\n\n const style = {\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridTemplateRows: `repeat(${choices.length}, 1fr)`\n };\n\n return (\n <div className={classes.choiceEditor}>\n <div className={classes.vtiler} style={style}>\n\n {ordering.tiles.map((c, index) => (\n <ChoiceTile\n choice={c}\n index={index}\n key={index}\n imageSupport={imageSupport}\n onDelete={this.onDelete.bind(this, c)}\n onChoiceChange={this.onChoiceChange}\n onDropChoice={(source, index) => this.onDropChoice(ordering, c, source, index)}\n disableImages={disableImages}\n toolbarOpts={toolbarOpts}\n choices={choices}\n choicesLabel={choicesLabel}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n />\n ))}\n </div>\n <div className={classes.controls}>\n <Button\n onClick={this.shuffleChoices}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{\n root: classes.addButtonRoot,\n label: classes.addButtonLabel\n }}\n >\n {`SHUFFLE ${pluralChoiceLabel}`.toUpperCase()}\n </Button>\n <Button\n onClick={this.addChoice}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{\n root: classes.addButtonRoot,\n label: classes.addButtonLabel\n }}\n >\n {`ADD ${singularChoiceLabel}`.toUpperCase()}\n </Button>\n </div>\n <InfoDialog\n title={dialog.message}\n open={dialog.open}\n onOk={dialog.onOk}\n />\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n allToggle: {},\n choiceEditor: {\n marginTop: '10px'\n },\n controls: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between'\n },\n root: {\n width: '30px',\n height: '30px',\n fill: theme.palette.primary[500]\n },\n addButtonRoot: {\n marginTop: '24px',\n paddingHorizontal: '12px'\n },\n addButtonLabel: {\n transition: 'opacity 200ms linear',\n '&:hover': {\n opacity: 0.3\n }\n },\n vtiler: {\n gridAutoFlow: 'column',\n display: 'grid',\n gridGap: '10px'\n }\n});\n\nexport default withStyles(styles)(ChoiceEditor);\n"],"file":"choice-editor.js"}
|
|
@@ -128,7 +128,9 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
|
|
|
128
128
|
imageSupport = _this$props2.imageSupport,
|
|
129
129
|
disableImages = _this$props2.disableImages,
|
|
130
130
|
spellCheck = _this$props2.spellCheck,
|
|
131
|
-
toolbarOpts = _this$props2.toolbarOpts
|
|
131
|
+
toolbarOpts = _this$props2.toolbarOpts,
|
|
132
|
+
maxImageWidth = _this$props2.maxImageWidth,
|
|
133
|
+
maxImageHeight = _this$props2.maxImageHeight;
|
|
132
134
|
var dialog = this.state.dialog;
|
|
133
135
|
var dragSourceOpts = {}; //dropEffect: moveOnDrag ? 'move' : 'copy'};
|
|
134
136
|
|
|
@@ -169,7 +171,9 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
|
|
|
169
171
|
toolbarOpts: toolbarOpts,
|
|
170
172
|
activePlugins: filteredDefaultPlugins,
|
|
171
173
|
spellCheck: spellCheck,
|
|
172
|
-
allowValidation: true
|
|
174
|
+
allowValidation: true,
|
|
175
|
+
maxImageWidth: maxImageWidth,
|
|
176
|
+
maxImageHeight: maxImageHeight
|
|
173
177
|
}), editable && /*#__PURE__*/_react["default"].createElement("div", {
|
|
174
178
|
className: classes.controls
|
|
175
179
|
}, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/choice-tile.jsx"],"names":["log","ChoiceTile","dialog","open","label","props","choice","onChoiceChange","choices","choicesLabel","currentValue","sameValue","filter","wasChanged","sameValueEntered","empty","length","setState","message","onOk","editable","isDragging","connectDragSource","connectDropTarget","classes","onDelete","imageSupport","disableImages","spellCheck","toolbarOpts","state","dragSourceOpts","choicePlugins","image","disabled","audio","video","filteredDefaultPlugins","DEFAULT_PLUGINS","p","opacity","markup","choiceTile","width","dragHandle","actions","prompt","targetPrompt","undefined","onLabelChange","controls","root","removeCircle","React","Component","PropTypes","func","isRequired","bool","id","any","string","isOver","object","type","outcome","index","number","shape","add","array","Styled","theme","fill","palette","error","cursor","backgroundColor","marginTop","marginBottom","display","alignItems","justifyContent","border","color","NAME","choiceSource","beginDrag","instanceId","StyledSource","connect","monitor","dragSource","choiceTarget","hover","drop","item","getItem","didDrop","onDropChoice","StyledSourceAndTarget","dropTarget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,uDAAN,CAAZ;;IAEaC,U;;;;;;;;;;;;;;;8FA2BH;AACNC,MAAAA,MAAM,EAAE;AACNC,QAAAA,IAAI,EAAE;AADA;AADF,K;sGAMQ,UAAAC,KAAK,EAAI;AACvB,wBAA0D,MAAKC,KAA/D;AAAA,UAAQC,MAAR,eAAQA,MAAR;AAAA,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,OAAO,CAACO,OAAR,EAApC,CAAH;AAEA7F,IAAAA,KAAK,CAAC8F,YAAN,CAAmBH,IAAnB,EAAyB3F,KAAK,CAAC6D,KAA/B;AACD;AATkB,CAArB;AAYA,IAAMkC,qBAAqB,GAAG,0BAAWf,IAAX,EAAiBQ,YAAjB,EAA+B,UAACH,OAAD,EAAUC,OAAV;AAAA,SAAuB;AAClFpE,IAAAA,iBAAiB,EAAEmE,OAAO,CAACW,UAAR,EAD+D;AAElFvC,IAAAA,MAAM,EAAE6B,OAAO,CAAC7B,MAAR;AAF0E,GAAvB;AAAA,CAA/B,EAG1B2B,YAH0B,CAA9B;eAKeW,qB","sourcesContent":["import EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\nimport CardActions from '@material-ui/core/CardActions';\nimport DragHandle from '@material-ui/icons/DragHandle';\n\nimport { DragSource, DropTarget } from 'react-dnd';\nimport classNames from 'classnames';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport RemoveCircle from '@material-ui/icons/RemoveCircle';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport { InfoDialog } from './choice-editor';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nexport class ChoiceTile extends React.Component {\n static propTypes = {\n connectDragSource: PropTypes.func.isRequired,\n connectDropTarget: PropTypes.func.isRequired,\n isDragging: PropTypes.bool.isRequired,\n id: PropTypes.any,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.object,\n index: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n }),\n choice: PropTypes.object,\n choices: PropTypes.array.isRequired,\n onChoiceChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n choicesLabel: PropTypes.string\n };\n\n state = {\n dialog: {\n open: false\n }\n };\n\n onLabelChange = label => {\n const { choice, onChoiceChange, choices, choicesLabel } = this.props;\n const currentValue = choice.label;\n const sameValue = choices.filter(choice => {\n const wasChanged = currentValue !== label && `<div>${currentValue}</div>` !== label;\n const sameValueEntered = choice.label === label || `<div>${choice.label}</div>` === label;\n\n return wasChanged && sameValueEntered;\n });\n\n const empty = label === '<div></div>';\n\n if (sameValue.length || empty) {\n this.setState({\n dialog: {\n open: true,\n message: `Each of the ${choicesLabel} must be non-empty and unique.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false\n }\n }\n );\n }\n }\n });\n } else {\n choice.label = label;\n onChoiceChange(choice);\n }\n };\n\n render() {\n const {\n choice: {\n label,\n editable\n },\n isDragging,\n connectDragSource,\n connectDropTarget,\n classes,\n onDelete,\n imageSupport,\n disableImages,\n spellCheck,\n toolbarOpts\n } = this.props;\n const { dialog } = this.state;\n\n const dragSourceOpts = {}; //dropEffect: moveOnDrag ? 'move' : 'copy'};\n\n const choicePlugins = {\n image: {\n disabled: disableImages\n },\n audio: { disabled: true },\n video: { disabled: true }\n };\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || [])\n .filter(p => p !== 'bulleted-list' && p !== 'numbered-list');\n\n const opacity = isDragging ? 0 : 1;\n const markup = (\n <div className={classes.choiceTile} style={{ opacity: opacity, width: '100%' }}>\n <CardActions>\n <span className={classNames(classes.dragHandle )}>\n <DragHandle className={classes.actions} />\n </span>\n </CardActions>\n <EditableHtml\n disabled={!editable}\n className={classNames(classes.prompt, !editable && classes.targetPrompt)}\n placeholder=\"Enter a choice\"\n markup={label}\n imageSupport={imageSupport || undefined}\n onChange={this.onLabelChange}\n pluginProps={choicePlugins}\n toolbarOpts={toolbarOpts}\n activePlugins={filteredDefaultPlugins}\n spellCheck={spellCheck}\n allowValidation\n />\n {editable && (\n <div className={classes.controls}>\n <IconButton color='default' onClick={onDelete}>\n <RemoveCircle\n classes={{\n root: classes.removeCircle\n }}\n />\n </IconButton>\n </div>\n )}\n <InfoDialog\n title={dialog.message}\n open={dialog.open}\n onOk={dialog.onOk}\n />\n </div>\n );\n\n\n return connectDragSource(\n connectDropTarget(\n <div>\n {markup}\n </div>\n ),\n dragSourceOpts\n );\n }\n}\n\nconst Styled = withStyles(theme => ({\n removeCircle: {\n fill: theme.palette.error[500]\n },\n choiceTile: {\n cursor: 'move',\n backgroundColor: 'white',\n marginTop: '5px',\n marginBottom: '5px',\n display: 'flex',\n alignItems: 'center'\n },\n controls: {\n display: 'flex',\n justifyContent: 'flex-end'\n },\n prompt: {\n width: '80%',\n border: 'none',\n },\n targetPrompt: {\n backgroundColor: '#D7D7D7'\n },\n actions: {\n color: '#B1B1B1'\n }\n}))(ChoiceTile);\n\nconst NAME = 'choice-config';\n\nconst choiceSource = {\n beginDrag(props) {\n return {\n id: props.choice.id,\n index: props.index,\n type: props.choice.type,\n instanceId: props.choice.instanceId\n };\n }\n};\n\nconst StyledSource = DragSource(NAME, choiceSource, (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging()\n}))(Styled);\n\nconst choiceTarget = {\n hover() {\n log('[hover]');\n },\n drop(props, monitor) {\n const item = monitor.getItem();\n log('[drop] item: ', item, 'didDrop?', monitor.didDrop());\n\n props.onDropChoice(item, props.index);\n }\n};\n\nconst StyledSourceAndTarget = DropTarget(NAME, choiceTarget, (connect, monitor) => ({\n connectDropTarget: connect.dropTarget(),\n isOver: monitor.isOver()\n}))(StyledSource);\n\nexport default StyledSourceAndTarget;\n"],"file":"choice-tile.js"}
|
|
1
|
+
{"version":3,"sources":["../src/choice-tile.jsx"],"names":["log","ChoiceTile","dialog","open","label","props","choice","onChoiceChange","choices","choicesLabel","currentValue","sameValue","filter","wasChanged","sameValueEntered","empty","length","setState","message","onOk","editable","isDragging","connectDragSource","connectDropTarget","classes","onDelete","imageSupport","disableImages","spellCheck","toolbarOpts","maxImageWidth","maxImageHeight","state","dragSourceOpts","choicePlugins","image","disabled","audio","video","filteredDefaultPlugins","DEFAULT_PLUGINS","p","opacity","markup","choiceTile","width","dragHandle","actions","prompt","targetPrompt","undefined","onLabelChange","controls","root","removeCircle","React","Component","PropTypes","func","isRequired","bool","id","any","string","isOver","object","type","outcome","index","number","shape","add","array","Styled","theme","fill","palette","error","cursor","backgroundColor","marginTop","marginBottom","display","alignItems","justifyContent","border","color","NAME","choiceSource","beginDrag","instanceId","StyledSource","connect","monitor","dragSource","choiceTarget","hover","drop","item","getItem","didDrop","onDropChoice","StyledSourceAndTarget","dropTarget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,uDAAN,CAAZ;;IAEaC,U;;;;;;;;;;;;;;;8FA2BH;AACNC,MAAAA,MAAM,EAAE;AACNC,QAAAA,IAAI,EAAE;AADA;AADF,K;sGAMQ,UAAAC,KAAK,EAAI;AACvB,wBAA0D,MAAKC,KAA/D;AAAA,UAAQC,MAAR,eAAQA,MAAR;AAAA,UAAgBC,cAAhB,eAAgBA,cAAhB;AAAA,UAAgCC,OAAhC,eAAgCA,OAAhC;AAAA,UAAyCC,YAAzC,eAAyCA,YAAzC;AACA,UAAMC,YAAY,GAAGJ,MAAM,CAACF,KAA5B;AACA,UAAMO,SAAS,GAAGH,OAAO,CAACI,MAAR,CAAe,UAAAN,MAAM,EAAI;AACzC,YAAMO,UAAU,GAAGH,YAAY,KAAKN,KAAjB,IAA0B,eAAQM,YAAR,gBAAiCN,KAA9E;AACA,YAAMU,gBAAgB,GAAGR,MAAM,CAACF,KAAP,KAAiBA,KAAjB,IAA0B,eAAQE,MAAM,CAACF,KAAf,gBAAiCA,KAApF;AAEA,eAAOS,UAAU,IAAIC,gBAArB;AACD,OALiB,CAAlB;AAOA,UAAMC,KAAK,GAAGX,KAAK,KAAK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B,EAG1B2B,YAH0B,CAA9B;eAKeW,qB","sourcesContent":["import EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\nimport CardActions from '@material-ui/core/CardActions';\nimport DragHandle from '@material-ui/icons/DragHandle';\n\nimport { DragSource, DropTarget } from 'react-dnd';\nimport classNames from 'classnames';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport RemoveCircle from '@material-ui/icons/RemoveCircle';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport { InfoDialog } from './choice-editor';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nexport class ChoiceTile extends React.Component {\n static propTypes = {\n connectDragSource: PropTypes.func.isRequired,\n connectDropTarget: PropTypes.func.isRequired,\n isDragging: PropTypes.bool.isRequired,\n id: PropTypes.any,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.object,\n index: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n }),\n choice: PropTypes.object,\n choices: PropTypes.array.isRequired,\n onChoiceChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n choicesLabel: PropTypes.string\n };\n\n state = {\n dialog: {\n open: false\n }\n };\n\n onLabelChange = label => {\n const { choice, onChoiceChange, choices, choicesLabel } = this.props;\n const currentValue = choice.label;\n const sameValue = choices.filter(choice => {\n const wasChanged = currentValue !== label && `<div>${currentValue}</div>` !== label;\n const sameValueEntered = choice.label === label || `<div>${choice.label}</div>` === label;\n\n return wasChanged && sameValueEntered;\n });\n\n const empty = label === '<div></div>';\n\n if (sameValue.length || empty) {\n this.setState({\n dialog: {\n open: true,\n message: `Each of the ${choicesLabel} must be non-empty and unique.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false\n }\n }\n );\n }\n }\n });\n } else {\n choice.label = label;\n onChoiceChange(choice);\n }\n };\n\n render() {\n const {\n choice: {\n label,\n editable\n },\n isDragging,\n connectDragSource,\n connectDropTarget,\n classes,\n onDelete,\n imageSupport,\n disableImages,\n spellCheck,\n toolbarOpts,\n maxImageWidth,\n maxImageHeight\n } = this.props;\n const { dialog } = this.state;\n\n const dragSourceOpts = {}; //dropEffect: moveOnDrag ? 'move' : 'copy'};\n\n const choicePlugins = {\n image: {\n disabled: disableImages\n },\n audio: { disabled: true },\n video: { disabled: true }\n };\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || [])\n .filter(p => p !== 'bulleted-list' && p !== 'numbered-list');\n\n const opacity = isDragging ? 0 : 1;\n const markup = (\n <div className={classes.choiceTile} style={{ opacity: opacity, width: '100%' }}>\n <CardActions>\n <span className={classNames(classes.dragHandle )}>\n <DragHandle className={classes.actions} />\n </span>\n </CardActions>\n <EditableHtml\n disabled={!editable}\n className={classNames(classes.prompt, !editable && classes.targetPrompt)}\n placeholder=\"Enter a choice\"\n markup={label}\n imageSupport={imageSupport || undefined}\n onChange={this.onLabelChange}\n pluginProps={choicePlugins}\n toolbarOpts={toolbarOpts}\n activePlugins={filteredDefaultPlugins}\n spellCheck={spellCheck}\n allowValidation\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n />\n {editable && (\n <div className={classes.controls}>\n <IconButton color='default' onClick={onDelete}>\n <RemoveCircle\n classes={{\n root: classes.removeCircle\n }}\n />\n </IconButton>\n </div>\n )}\n <InfoDialog\n title={dialog.message}\n open={dialog.open}\n onOk={dialog.onOk}\n />\n </div>\n );\n\n\n return connectDragSource(\n connectDropTarget(\n <div>\n {markup}\n </div>\n ),\n dragSourceOpts\n );\n }\n}\n\nconst Styled = withStyles(theme => ({\n removeCircle: {\n fill: theme.palette.error[500]\n },\n choiceTile: {\n cursor: 'move',\n backgroundColor: 'white',\n marginTop: '5px',\n marginBottom: '5px',\n display: 'flex',\n alignItems: 'center'\n },\n controls: {\n display: 'flex',\n justifyContent: 'flex-end'\n },\n prompt: {\n width: '80%',\n border: 'none',\n },\n targetPrompt: {\n backgroundColor: '#D7D7D7'\n },\n actions: {\n color: '#B1B1B1'\n }\n}))(ChoiceTile);\n\nconst NAME = 'choice-config';\n\nconst choiceSource = {\n beginDrag(props) {\n return {\n id: props.choice.id,\n index: props.index,\n type: props.choice.type,\n instanceId: props.choice.instanceId\n };\n }\n};\n\nconst StyledSource = DragSource(NAME, choiceSource, (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging()\n}))(Styled);\n\nconst choiceTarget = {\n hover() {\n log('[hover]');\n },\n drop(props, monitor) {\n const item = monitor.getItem();\n log('[drop] item: ', item, 'didDrop?', monitor.didDrop());\n\n props.onDropChoice(item, props.index);\n }\n};\n\nconst StyledSourceAndTarget = DropTarget(NAME, choiceTarget, (connect, monitor) => ({\n connectDropTarget: connect.dropTarget(),\n isOver: monitor.isOver()\n}))(StyledSource);\n\nexport default StyledSourceAndTarget;\n"],"file":"choice-tile.js"}
|
|
@@ -97,6 +97,19 @@ var _default = {
|
|
|
97
97
|
teacherInstructions: {
|
|
98
98
|
settings: true,
|
|
99
99
|
label: 'Teacher Instructions'
|
|
100
|
+
},
|
|
101
|
+
maxImageWidth: {
|
|
102
|
+
teacherInstructions: 300,
|
|
103
|
+
prompt: 300,
|
|
104
|
+
rationale: 300,
|
|
105
|
+
choicesWithPlacementArea: 240,
|
|
106
|
+
choicesWithoutPlacementArea: 300
|
|
107
|
+
},
|
|
108
|
+
maxImageHeight: {
|
|
109
|
+
teacherInstructions: 300,
|
|
110
|
+
prompt: 300,
|
|
111
|
+
rationale: 300,
|
|
112
|
+
choices: 150
|
|
100
113
|
}
|
|
101
114
|
}
|
|
102
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","choiceLabel","choices","correctResponse","enableImages","prompt","numberedGuides","orientation","partialScoring","placementArea","removeTilesAfterPlacing","choiceLabelEnabled","scoringType","targetLabel","rationaleEnabled","feedbackEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","settings","label","feedback","enabled","rationale","studentInstructions","spellCheck","teacherInstructions"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,EADR;AAELC,IAAAA,OAAO,EAAE,EAFJ;AAGLC,IAAAA,eAAe,EAAE,EAHZ;AAILC,IAAAA,YAAY,EAAE,KAJT;AAKLC,IAAAA,MAAM,EAAE,qBALH;AAMLC,IAAAA,cAAc,EAAE,KANX;AAOLC,IAAAA,WAAW,EAAE,UAPR;AAQLC,IAAAA,cAAc,EAAE,IARX;AASLC,IAAAA,aAAa,EAAE,KATV;AAULC,IAAAA,uBAAuB,EAAE,IAVpB;AAWLC,IAAAA,kBAAkB,EAAE,IAXf;AAYLC,IAAAA,WAAW,EAAE,MAZR;AAaLC,IAAAA,WAAW,EAAE,EAbR;AAcLC,IAAAA,gBAAgB,EAAE,IAdb;AAeLC,IAAAA,eAAe,EAAE,IAfZ;AAgBLC,IAAAA,aAAa,EAAE,IAhBV;AAiBLC,IAAAA,0BAA0B,EAAE,IAjBvB;AAkBLC,IAAAA,0BAA0B,EAAE,IAlBvB;AAmBLC,IAAAA,qBAAqB,EAAE;AAnBlB,GADM;AAsBbC,EAAAA,aAAa,EAAE;AACbnB,IAAAA,WAAW,EAAE;AACXoB,MAAAA,QAAQ,EAAE,IADC;AAEXC,MAAAA,KAAK,EAAE;AAFI,KADA;AAKbpB,IAAAA,OAAO,EAAE;AACPmB,MAAAA,QAAQ,EAAE,IADH;AAEPC,MAAAA,KAAK,EAAE;AAFA,KALI;AASblB,IAAAA,YAAY,EAAE;AACZiB,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KATD;AAabC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,OAAO,EAAC;AAHE,KA1DC;AA+DbI,IAAAA,mBAAmB,EAAE;AACnBP,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","choiceLabel","choices","correctResponse","enableImages","prompt","numberedGuides","orientation","partialScoring","placementArea","removeTilesAfterPlacing","choiceLabelEnabled","scoringType","targetLabel","rationaleEnabled","feedbackEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","settings","label","feedback","enabled","rationale","studentInstructions","spellCheck","teacherInstructions","maxImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxImageHeight"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,EADR;AAELC,IAAAA,OAAO,EAAE,EAFJ;AAGLC,IAAAA,eAAe,EAAE,EAHZ;AAILC,IAAAA,YAAY,EAAE,KAJT;AAKLC,IAAAA,MAAM,EAAE,qBALH;AAMLC,IAAAA,cAAc,EAAE,KANX;AAOLC,IAAAA,WAAW,EAAE,UAPR;AAQLC,IAAAA,cAAc,EAAE,IARX;AASLC,IAAAA,aAAa,EAAE,KATV;AAULC,IAAAA,uBAAuB,EAAE,IAVpB;AAWLC,IAAAA,kBAAkB,EAAE,IAXf;AAYLC,IAAAA,WAAW,EAAE,MAZR;AAaLC,IAAAA,WAAW,EAAE,EAbR;AAcLC,IAAAA,gBAAgB,EAAE,IAdb;AAeLC,IAAAA,eAAe,EAAE,IAfZ;AAgBLC,IAAAA,aAAa,EAAE,IAhBV;AAiBLC,IAAAA,0BAA0B,EAAE,IAjBvB;AAkBLC,IAAAA,0BAA0B,EAAE,IAlBvB;AAmBLC,IAAAA,qBAAqB,EAAE;AAnBlB,GADM;AAsBbC,EAAAA,aAAa,EAAE;AACbnB,IAAAA,WAAW,EAAE;AACXoB,MAAAA,QAAQ,EAAE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BC,MAAAA,KAAK,EAAE;AAFY,KAlDR;AAsDbT,IAAAA,WAAW,EAAE;AACXQ,MAAAA,QAAQ,EAAE,IADC;AAEXC,MAAAA,KAAK,EAAE;AAFI,KAtDA;AA0DbK,IAAAA,UAAU,EAAE;AACVL,MAAAA,KAAK,EAAE,YADG;AAEVD,MAAAA,QAAQ,EAAC,KAFC;AAGVG,MAAAA,OAAO,EAAC;AAHE,KA1DC;AA+DbI,IAAAA,mBAAmB,EAAE;AACnBP,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KA/DR;AAmEbO,IAAAA,aAAa,EAAE;AACbD,MAAAA,mBAAmB,EAAE,GADR;AAEbvB,MAAAA,MAAM,EAAE,GAFK;AAGboB,MAAAA,SAAS,EAAE,GAHE;AAIbK,MAAAA,wBAAwB,EAAE,GAJb;AAKbC,MAAAA,2BAA2B,EAAE;AALhB,KAnEF;AA0EbC,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEdvB,MAAAA,MAAM,EAAE,GAFM;AAGdoB,MAAAA,SAAS,EAAE,GAHG;AAIdvB,MAAAA,OAAO,EAAE;AAJK;AA1EH;AAtBF,C","sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configuration\n */\n\nexport default {\n model: {\n choiceLabel: '',\n choices: [],\n correctResponse: [],\n enableImages: false,\n prompt: 'Item Stem goes here',\n numberedGuides: false,\n orientation: 'vertical',\n partialScoring: true,\n placementArea: false,\n removeTilesAfterPlacing: true,\n choiceLabelEnabled: true,\n scoringType: 'auto',\n targetLabel: '',\n rationaleEnabled: true,\n feedbackEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom'\n },\n configuration: {\n choiceLabel: {\n settings: true,\n label: 'Choice label'\n },\n choices: {\n settings: true,\n label: 'Choices',\n },\n enableImages: {\n settings: true,\n label: 'Enable Images',\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n enabled: true\n },\n prompt: {\n settings: true,\n label: 'Item Stem'\n },\n numberedGuides: {\n settings: true,\n label: 'Numbered guides',\n },\n orientation: {\n settings: true,\n label: 'Orientation',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n placementArea: {\n settings: true,\n label: 'Placement Area',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n removeTilesAfterPlacing: {\n settings: false,\n label: 'Remove Tiles after placing'\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n targetLabel: {\n settings: true,\n label: 'Target label',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choicesWithPlacementArea: 240,\n choicesWithoutPlacementArea: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 150\n }\n }\n};\n"],"file":"defaults.js"}
|
package/configure/lib/design.js
CHANGED
|
@@ -158,7 +158,11 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
158
158
|
_ref$spellCheck = _ref.spellCheck,
|
|
159
159
|
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
160
160
|
_ref$scoringType = _ref.scoringType,
|
|
161
|
-
scoringType = _ref$scoringType === void 0 ? {} : _ref$scoringType
|
|
161
|
+
scoringType = _ref$scoringType === void 0 ? {} : _ref$scoringType,
|
|
162
|
+
_ref$maxImageWidth = _ref.maxImageWidth,
|
|
163
|
+
maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
|
|
164
|
+
_ref$maxImageHeight = _ref.maxImageHeight,
|
|
165
|
+
maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight;
|
|
162
166
|
|
|
163
167
|
var _ref2 = model || {},
|
|
164
168
|
teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
|
|
@@ -181,6 +185,11 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
181
185
|
_ref4$pluralLabel = _ref4.pluralLabel,
|
|
182
186
|
pluralLabel = _ref4$pluralLabel === void 0 ? '' : _ref4$pluralLabel;
|
|
183
187
|
|
|
188
|
+
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
189
|
+
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
190
|
+
var maxChoicesImageWidth = maxImageWidth && model.placementArea ? maxImageWidth.choicesWithPlacementArea : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;
|
|
191
|
+
var maxChoicesImageHeight = maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight;
|
|
192
|
+
|
|
184
193
|
switch (model.toolbarEditorPosition) {
|
|
185
194
|
case 'top':
|
|
186
195
|
toolbarOpts.position = 'top';
|
|
@@ -232,7 +241,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
232
241
|
imageSupport: imageSupport,
|
|
233
242
|
nonEmpty: false,
|
|
234
243
|
toolbarOpts: toolbarOpts,
|
|
235
|
-
spellCheck: spellCheckEnabled
|
|
244
|
+
spellCheck: spellCheckEnabled,
|
|
245
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
246
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight
|
|
236
247
|
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FormSection, {
|
|
237
248
|
label: "Ordering"
|
|
238
249
|
}, /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
@@ -244,7 +255,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
244
255
|
onChange: this.onPromptChange,
|
|
245
256
|
imageSupport: imageSupport,
|
|
246
257
|
toolbarOpts: toolbarOpts,
|
|
247
|
-
spellCheck: spellCheckEnabled
|
|
258
|
+
spellCheck: spellCheckEnabled,
|
|
259
|
+
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
260
|
+
maxImageHeight: maxImageHeight && maxImageHeight.prompt
|
|
248
261
|
})), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
249
262
|
label: rationale.label,
|
|
250
263
|
className: classes.promptHolder
|
|
@@ -254,7 +267,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
254
267
|
onChange: this.onRationaleChange,
|
|
255
268
|
imageSupport: imageSupport,
|
|
256
269
|
toolbarOpts: toolbarOpts,
|
|
257
|
-
spellCheck: spellCheckEnabled
|
|
270
|
+
spellCheck: spellCheckEnabled,
|
|
271
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
272
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight
|
|
258
273
|
}))), /*#__PURE__*/_react["default"].createElement(_configUi.FormSection, {
|
|
259
274
|
label: "Define ".concat(pluralLabel),
|
|
260
275
|
labelExtraStyle: {
|
|
@@ -288,7 +303,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
288
303
|
markup: model.choiceLabel,
|
|
289
304
|
onChange: this.onChoiceAreaLabelChange,
|
|
290
305
|
toolbarOpts: toolbarOpts,
|
|
291
|
-
spellCheck: spellCheckEnabled
|
|
306
|
+
spellCheck: spellCheckEnabled,
|
|
307
|
+
maxImageWidth: maxChoicesImageWidth,
|
|
308
|
+
maxImageHeight: maxChoicesImageHeight
|
|
292
309
|
})), targetLabel.settings && model.placementArea && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
293
310
|
label: targetLabel && targetLabel.label && targetLabel.label.toUpperCase(),
|
|
294
311
|
className: classes.promptHolder
|
|
@@ -297,7 +314,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
297
314
|
markup: model.targetLabel,
|
|
298
315
|
onChange: this.onAnswerAreaLabelChange,
|
|
299
316
|
toolbarOpts: toolbarOpts,
|
|
300
|
-
spellCheck: spellCheckEnabled
|
|
317
|
+
spellCheck: spellCheckEnabled,
|
|
318
|
+
maxImageWidth: maxImageWidth && maxImageWidth.choicesWithPlacementArea || defaultImageMaxWidth,
|
|
319
|
+
maxImageHeight: maxChoicesImageHeight
|
|
301
320
|
}))), choices.settings && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
302
321
|
label: choices && choices.label && pluralLabel.toUpperCase(),
|
|
303
322
|
className: classes.promptHolder
|
|
@@ -312,7 +331,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
312
331
|
placementArea: model.placementArea,
|
|
313
332
|
singularChoiceLabel: singularLabel,
|
|
314
333
|
pluralChoiceLabel: pluralLabel,
|
|
315
|
-
spellCheck: spellCheckEnabled
|
|
334
|
+
spellCheck: spellCheckEnabled,
|
|
335
|
+
maxImageWidth: maxChoicesImageWidth,
|
|
336
|
+
maxImageHeight: maxChoicesImageHeight
|
|
316
337
|
}))), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
|
|
317
338
|
feedback: model.feedback,
|
|
318
339
|
onChange: this.onFeedbackChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/design.jsx"],"names":["log","Panel","settings","toggle","radio","getSingularAndPlural","label","pluralize","isPlural","singularLabel","pluralLabel","singular","Design","props","applyUpdate","modelFn","model","onModelChanged","update","changeHandler","modelPath","valuePath","value","v","onPromptChange","onTeacherInstructionsChange","onRationaleChange","onChoiceAreaLabelChange","onAnswerAreaLabelChange","onFeedbackChange","onChoiceEditorChange","choices","correctResponse","classes","imageSupport","configuration","onConfigurationChanged","choiceLabel","feedback","targetLabel","prompt","placementArea","numberedGuides","enableImages","orientation","removeTilesAfterPlacing","partialScoring","teacherInstructions","studentInstructions","rationale","spellCheck","scoringType","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","feedbackEnabled","choiceLabelEnabled","spellCheckEnabled","errors","orderError","validationMessage","toolbarOpts","toolbarEditorPosition","position","Settings","Properties","studentInstructionsEnabled","promptHolder","toUpperCase","display","inlineFlexContainer","tooltip","marginLeft","errorText","row","React","Component","defaultProps","propTypes","PropTypes","object","isRequired","func","theme","width","paddingTop","marginTop","spacing","unit","paddingBottom","gridAutoFlow","gridAutoColumns","gridGap","fontSize","whiteSpace","maxWidth","color","padding"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,wCAAN,CAAZ;AACA,IAAQC,KAAR,GAAiCC,kBAAjC,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAAiCD,kBAAjC,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAAiCF,kBAAjC,CAAuBE,KAAvB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAAAC,KAAK,EAAI;AACpC,SAAO,CAACC,sBAAUC,QAAV,CAAmBF,KAAnB,CAAD,GAA6B;AAClCG,IAAAA,aAAa,EAAEH,KADmB;AAElCI,IAAAA,WAAW,EAAE,2BAAUJ,KAAV;AAFqB,GAA7B,GAGH;AACFG,IAAAA,aAAa,EAAEF,sBAAUI,QAAV,CAAmBL,KAAnB,CADb;AAEFI,IAAAA,WAAW,EAAEJ;AAFX,GAHJ;AAOD,CARD;;IAUaM,M;;;;;AACX,kBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;;AAEA,UAAKC,WAAL,GAAmB,UAAAC,OAAO,EAAI;AAC5B,wBAAkC,MAAKF,KAAvC;AAAA,UAAQG,KAAR,eAAQA,KAAR;AAAA,UAAeC,cAAf,eAAeA,cAAf;AACA,UAAMC,MA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OAAO,EAAE,MADN;AAEHqB,MAAAA,YAAY,EAAE,QAFX;AAGHC,MAAAA,eAAe,EAAE,KAHd;AAIHC,MAAAA,OAAO,EAAE;AAJN,KAVc;AAgBnBrB,IAAAA,OAAO,EAAE;AACPsB,MAAAA,QAAQ,EAAE,MADH;AAEPC,MAAAA,UAAU,EAAE,KAFL;AAGPC,MAAAA,QAAQ,EAAE;AAHH,KAhBU;AAqBnBtB,IAAAA,SAAS,EAAE;AACToB,MAAAA,QAAQ,EAAE,MADD;AAETG,MAAAA,KAAK,EAAE,KAFE;AAGTC,MAAAA,OAAO,EAAE;AAHA,KArBQ;AA0BnB3B,IAAAA,mBAAmB,EAAE;AACnBD,MAAAA,OAAO,EAAE,aADU;AAEnBN,MAAAA,QAAQ,EAAE;AAFS;AA1BF,GAAL;AAAA,CAAhB,EA8BInD,MA9BJ,CADa,C","sourcesContent":["import {\n FeedbackConfig,\n FormSection,\n InputContainer,\n settings,\n layout\n} from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { withStyles } from '@material-ui/core/styles';\nimport { withDragContext } from '@pie-lib/drag';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport debug from 'debug';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { get, set } from 'nested-property';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport pluralize from 'pluralize';\n\nimport ChoiceEditor from './choice-editor';\nimport { generateValidationMessage } from './utils';\n\nconst log = debug('@pie-element:placement-ordering:design');\nconst { Panel, toggle, radio } = settings;\n\nconst getSingularAndPlural = label => {\n return !pluralize.isPlural(label) ? {\n singularLabel: label,\n pluralLabel: pluralize(label)\n } : {\n singularLabel: pluralize.singular(label),\n pluralLabel: label\n };\n};\n\nexport class Design extends React.Component {\n constructor(props) {\n super(props);\n\n this.applyUpdate = modelFn => {\n const { model, onModelChanged } = this.props;\n const update = modelFn(cloneDeep(model));\n\n onModelChanged(update);\n };\n\n this.changeHandler = (modelPath, valuePath) => {\n return value => {\n log('[changeHandler] value: ', value);\n\n const v = valuePath ? get(value, valuePath) : value;\n\n this.applyUpdate(model => {\n set(model, modelPath, v);\n return model;\n });\n };\n };\n\n this.onPromptChange = this.changeHandler('prompt');\n this.onTeacherInstructionsChange = this.changeHandler(\n 'teacherInstructions'\n );\n this.onRationaleChange = this.changeHandler('rationale');\n this.onChoiceAreaLabelChange = this.changeHandler(\n 'choiceLabel',\n 'target.value'\n );\n this.onAnswerAreaLabelChange = this.changeHandler(\n 'targetLabel',\n 'target.value'\n );\n this.onFeedbackChange = this.changeHandler('feedback');\n\n this.onChoiceEditorChange = (choices, correctResponse) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n update.choices = choices;\n update.correctResponse = correctResponse;\n onModelChanged(update);\n };\n }\n\n render() {\n const {\n model,\n classes,\n imageSupport,\n onModelChanged,\n configuration,\n onConfigurationChanged\n } = this.props;\n const {\n choiceLabel = {},\n choices = {},\n feedback = {},\n targetLabel = {},\n prompt = {},\n\n placementArea = {},\n numberedGuides = {},\n enableImages = {},\n orientation = {},\n removeTilesAfterPlacing = {},\n partialScoring = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n spellCheck = {},\n scoringType = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, feedbackEnabled, choiceLabelEnabled, spellCheckEnabled, errors } =\n model || {};\n const { orderError } = errors || {};\n const validationMessage = generateValidationMessage();\n\n const toolbarOpts = {};\n const {\n singularLabel = '',\n pluralLabel = ''\n } = choices && choices.label && getSingularAndPlural(choices.label) || {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={model => onModelChanged(model)}\n onChangeConfiguration={configuration =>\n onConfigurationChanged(configuration, true)\n }\n groups={{\n Settings: {\n choiceLabelEnabled:\n choiceLabel.settings && toggle(choiceLabel.label),\n placementArea:\n placementArea.settings && toggle(placementArea.label),\n numberedGuides:\n numberedGuides.settings &&\n model.placementArea &&\n toggle(numberedGuides.label),\n enableImages:\n enableImages.settings && toggle(enableImages.label),\n orientation:\n orientation.settings &&\n radio(orientation.label, ['vertical', 'horizontal']),\n removeTilesAfterPlacing:\n removeTilesAfterPlacing.settings &&\n toggle(removeTilesAfterPlacing.label),\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n feedbackEnabled:\n feedback.settings && toggle(feedback.label)\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric'])\n }\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <FormSection label=\"Ordering\">\n <InputContainer\n label={prompt && prompt.label && prompt.label.toUpperCase()}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </FormSection>\n )}\n\n <FormSection label={`Define ${pluralLabel}`} labelExtraStyle={{display: 'inline-flex'}}>\n <div className={classes.inlineFlexContainer}>\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 </div>\n {orderError && <div className={classes.errorText}>{orderError}</div>}\n <div className={classes.row}>\n {choiceLabelEnabled && (\n <InputContainer\n label={\n choiceLabel &&\n choiceLabel.label &&\n `${singularLabel} label`.toUpperCase()\n }\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.choiceLabel}\n onChange={this.onChoiceAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {targetLabel.settings && model.placementArea && (\n <InputContainer\n label={\n targetLabel &&\n targetLabel.label &&\n targetLabel.label.toUpperCase()\n }\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.targetLabel}\n onChange={this.onAnswerAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </div>\n\n {choices.settings && (\n <InputContainer\n label={choices && choices.label && pluralLabel.toUpperCase()}\n className={classes.promptHolder}\n >\n <ChoiceEditor\n correctResponse={model.correctResponse}\n choices={model.choices}\n onChange={this.onChoiceEditorChange}\n imageSupport={imageSupport}\n disableImages={!model.enableImages}\n toolbarOpts={toolbarOpts}\n choicesLabel={choices.label}\n placementArea={model.placementArea}\n singularChoiceLabel={singularLabel}\n pluralChoiceLabel={pluralLabel}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </FormSection>\n\n {feedbackEnabled && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={this.onFeedbackChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nDesign.defaultProps = {\n onModelChanged: () => {},\n onConfigurationChanged: () => {}\n};\n\nDesign.propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.object\n};\n\nexport default withDragContext(\n withStyles(theme => ({\n promptHolder: {\n width: '100%',\n paddingTop: '12px',\n marginTop: '24px'\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit\n },\n row: {\n display: 'grid',\n gridAutoFlow: 'column',\n gridAutoColumns: '1fr',\n gridGap: '8px'\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 inlineFlexContainer: {\n display: 'inline-flex',\n position: 'absolute'\n }\n }))(Design)\n);\n"],"file":"design.js"}
|
|
1
|
+
{"version":3,"sources":["../src/design.jsx"],"names":["log","Panel","settings","toggle","radio","getSingularAndPlural","label","pluralize","isPlural","singularLabel","pluralLabel","singular","Design","props","applyUpdate","modelFn","model","onModelChanged","update","changeHandler","modelPath","valuePath","value","v","onPromptChange","onTeacherInstructionsChange","onRationaleChange","onChoiceAreaLabelChange","onAnswerAreaLabelChange","onFeedbackChange","onChoiceEditorChange","choices","correctResponse","classes","imageSupport","configuration","onConfigurationChanged","choiceLabel","feedback","targetLabel","prompt","placementArea","numberedGuides","enableImages","orientation","removeTilesAfterPlacing","partialScoring","teacherInstructions","studentInstructions","rationale","spellCheck","scoringType","maxImageWidth","maxImageHeight","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","feedbackEnabled","choiceLabelEnabled","spellCheckEnabled","errors","orderError","validationMessage","toolbarOpts","defaultImageMaxWidth","defaultImageMaxHeight","maxChoicesImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxChoicesImageHeight","toolbarEditorPosition","position","Settings","Properties","studentInstructionsEnabled","promptHolder","toUpperCase","display","inlineFlexContainer","tooltip","marginLeft","errorText","row","React","Component","defaultProps","propTypes","PropTypes","object","isRequired","func","theme","width","paddingTop","marginTop","spacing","unit","paddingBottom","gridAutoFlow","gridAutoColumns","gridGap","fontSize","whiteSpace","maxWidth","color","padding"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,wCAAN,CAAZ;AACA,IAAQC,KAAR,GAAiCC,kBAAjC,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAAiCD,kBAAjC,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAAiCF,kBAAjC,CAAuBE,KAAvB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAAAC,KAAK,EAAI;AACpC,SAAO,CAACC,sBAAUC,QAAV,CAAmBF,KAAnB,CAAD,GAA6B;AAClCG,IAAAA,aAAa,EAAEH,KADmB;AAElCI,IAAAA,WAAW,EAAE,2BAAUJ,KAAV;AAFqB,GAA7B,GAGH;AACFG,IAAAA,aAAa,EAAEF,sBAAUI,QAAV,CAAmBL,KAAnB,CADb;AAEFI,IAAAA,WAAW,EAAEJ;AAFX,GAHJ;AAOD,CARD;;IAUaM,M;;;;;AACX,kBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;;AAEA,UAAKC,WAAL,GAAmB,UAAAC,OAAO,EAAI;AAC5B,wBAAkC,MAAKF,KAAvC;AAAA,UAAQG,KAAR,eAAQA,KAAR;AAAA,UAAeC,cAAf,eAAeA,cAAf;AACA,UAAMC,MAAM,GAAGH,OAAO,CAAC,2BAAUC,KAAV,CAAD,CAAtB;AAEAC,MAA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,EAAE;AACPsB,MAAAA,QAAQ,EAAE,MADH;AAEPC,MAAAA,UAAU,EAAE,KAFL;AAGPC,MAAAA,QAAQ,EAAE;AAHH,KAhBU;AAqBnBtB,IAAAA,SAAS,EAAE;AACToB,MAAAA,QAAQ,EAAE,MADD;AAETG,MAAAA,KAAK,EAAE,KAFE;AAGTC,MAAAA,OAAO,EAAE;AAHA,KArBQ;AA0BnB3B,IAAAA,mBAAmB,EAAE;AACnBD,MAAAA,OAAO,EAAE,aADU;AAEnBN,MAAAA,QAAQ,EAAE;AAFS;AA1BF,GAAL;AAAA,CAAhB,EA8BI3D,MA9BJ,CADa,C","sourcesContent":["import {\n FeedbackConfig,\n FormSection,\n InputContainer,\n settings,\n layout\n} from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { withStyles } from '@material-ui/core/styles';\nimport { withDragContext } from '@pie-lib/drag';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport debug from 'debug';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { get, set } from 'nested-property';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport pluralize from 'pluralize';\n\nimport ChoiceEditor from './choice-editor';\nimport { generateValidationMessage } from './utils';\n\nconst log = debug('@pie-element:placement-ordering:design');\nconst { Panel, toggle, radio } = settings;\n\nconst getSingularAndPlural = label => {\n return !pluralize.isPlural(label) ? {\n singularLabel: label,\n pluralLabel: pluralize(label)\n } : {\n singularLabel: pluralize.singular(label),\n pluralLabel: label\n };\n};\n\nexport class Design extends React.Component {\n constructor(props) {\n super(props);\n\n this.applyUpdate = modelFn => {\n const { model, onModelChanged } = this.props;\n const update = modelFn(cloneDeep(model));\n\n onModelChanged(update);\n };\n\n this.changeHandler = (modelPath, valuePath) => {\n return value => {\n log('[changeHandler] value: ', value);\n\n const v = valuePath ? get(value, valuePath) : value;\n\n this.applyUpdate(model => {\n set(model, modelPath, v);\n return model;\n });\n };\n };\n\n this.onPromptChange = this.changeHandler('prompt');\n this.onTeacherInstructionsChange = this.changeHandler(\n 'teacherInstructions'\n );\n this.onRationaleChange = this.changeHandler('rationale');\n this.onChoiceAreaLabelChange = this.changeHandler(\n 'choiceLabel',\n 'target.value'\n );\n this.onAnswerAreaLabelChange = this.changeHandler(\n 'targetLabel',\n 'target.value'\n );\n this.onFeedbackChange = this.changeHandler('feedback');\n\n this.onChoiceEditorChange = (choices, correctResponse) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n update.choices = choices;\n update.correctResponse = correctResponse;\n onModelChanged(update);\n };\n }\n\n render() {\n const {\n model,\n classes,\n imageSupport,\n onModelChanged,\n configuration,\n onConfigurationChanged\n } = this.props;\n const {\n choiceLabel = {},\n choices = {},\n feedback = {},\n targetLabel = {},\n prompt = {},\n placementArea = {},\n numberedGuides = {},\n enableImages = {},\n orientation = {},\n removeTilesAfterPlacing = {},\n partialScoring = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n spellCheck = {},\n scoringType = {},\n maxImageWidth = {},\n maxImageHeight = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, feedbackEnabled, choiceLabelEnabled, spellCheckEnabled, errors } =\n model || {};\n const { orderError } = errors || {};\n const validationMessage = generateValidationMessage();\n\n const toolbarOpts = {};\n const {\n singularLabel = '',\n pluralLabel = ''\n } = choices && choices.label && getSingularAndPlural(choices.label) || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const maxChoicesImageWidth = maxImageWidth && model.placementArea ? maxImageWidth.choicesWithPlacementArea : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;\n const maxChoicesImageHeight = maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight;\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={model => onModelChanged(model)}\n onChangeConfiguration={configuration =>\n onConfigurationChanged(configuration, true)\n }\n groups={{\n Settings: {\n choiceLabelEnabled:\n choiceLabel.settings && toggle(choiceLabel.label),\n placementArea:\n placementArea.settings && toggle(placementArea.label),\n numberedGuides:\n numberedGuides.settings &&\n model.placementArea &&\n toggle(numberedGuides.label),\n enableImages:\n enableImages.settings && toggle(enableImages.label),\n orientation:\n orientation.settings &&\n radio(orientation.label, ['vertical', 'horizontal']),\n removeTilesAfterPlacing:\n removeTilesAfterPlacing.settings &&\n toggle(removeTilesAfterPlacing.label),\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n feedbackEnabled:\n feedback.settings && toggle(feedback.label)\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric'])\n }\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\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 />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <FormSection label=\"Ordering\">\n <InputContainer\n label={prompt && prompt.label && prompt.label.toUpperCase()}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n />\n </InputContainer>\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n </FormSection>\n )}\n\n <FormSection label={`Define ${pluralLabel}`} labelExtraStyle={{display: 'inline-flex'}}>\n <div className={classes.inlineFlexContainer}>\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 </div>\n {orderError && <div className={classes.errorText}>{orderError}</div>}\n <div className={classes.row}>\n {choiceLabelEnabled && (\n <InputContainer\n label={\n choiceLabel &&\n choiceLabel.label &&\n `${singularLabel} label`.toUpperCase()\n }\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.choiceLabel}\n onChange={this.onChoiceAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n />\n </InputContainer>\n )}\n\n {targetLabel.settings && model.placementArea && (\n <InputContainer\n label={\n targetLabel &&\n targetLabel.label &&\n targetLabel.label.toUpperCase()\n }\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.targetLabel}\n onChange={this.onAnswerAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.choicesWithPlacementArea || defaultImageMaxWidth}\n maxImageHeight={maxChoicesImageHeight}\n />\n </InputContainer>\n )}\n </div>\n\n {choices.settings && (\n <InputContainer\n label={choices && choices.label && pluralLabel.toUpperCase()}\n className={classes.promptHolder}\n >\n <ChoiceEditor\n correctResponse={model.correctResponse}\n choices={model.choices}\n onChange={this.onChoiceEditorChange}\n imageSupport={imageSupport}\n disableImages={!model.enableImages}\n toolbarOpts={toolbarOpts}\n choicesLabel={choices.label}\n placementArea={model.placementArea}\n singularChoiceLabel={singularLabel}\n pluralChoiceLabel={pluralLabel}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n />\n </InputContainer>\n )}\n </FormSection>\n\n {feedbackEnabled && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={this.onFeedbackChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nDesign.defaultProps = {\n onModelChanged: () => {},\n onConfigurationChanged: () => {}\n};\n\nDesign.propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.object\n};\n\nexport default withDragContext(\n withStyles(theme => ({\n promptHolder: {\n width: '100%',\n paddingTop: '12px',\n marginTop: '24px'\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit\n },\n row: {\n display: 'grid',\n gridAutoFlow: 'column',\n gridAutoColumns: '1fr',\n gridGap: '8px'\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 inlineFlexContainer: {\n display: 'inline-flex',\n position: 'absolute'\n }\n }))(Design)\n);\n"],"file":"design.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/placement-ordering-configure",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@material-ui/core": "^3.9.2",
|
|
9
9
|
"@material-ui/icons": "^3.0.1",
|
|
10
10
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
11
|
-
"@pie-lib/config-ui": "^
|
|
12
|
-
"@pie-lib/editable-html": "^
|
|
13
|
-
"@pie-lib/scoring-config": "^3.5.
|
|
11
|
+
"@pie-lib/config-ui": "^11.0.1",
|
|
12
|
+
"@pie-lib/editable-html": "^8.1.0",
|
|
13
|
+
"@pie-lib/scoring-config": "^3.5.165",
|
|
14
14
|
"debug": "^3.1.0",
|
|
15
15
|
"lodash": "^4.17.15",
|
|
16
16
|
"nested-property": "^0.0.7",
|
package/docs/config-schema.json
CHANGED
|
@@ -275,6 +275,78 @@
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
|
+
"maxImageWidth": {
|
|
279
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
280
|
+
"type": "object",
|
|
281
|
+
"properties": {
|
|
282
|
+
"teacherInstructions": {
|
|
283
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
284
|
+
"type": "number",
|
|
285
|
+
"title": "teacherInstructions"
|
|
286
|
+
},
|
|
287
|
+
"prompt": {
|
|
288
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
289
|
+
"type": "number",
|
|
290
|
+
"title": "prompt"
|
|
291
|
+
},
|
|
292
|
+
"rationale": {
|
|
293
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
294
|
+
"type": "number",
|
|
295
|
+
"title": "rationale"
|
|
296
|
+
},
|
|
297
|
+
"choicesWithPlacementArea": {
|
|
298
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled",
|
|
299
|
+
"type": "number",
|
|
300
|
+
"title": "choicesWithPlacementArea"
|
|
301
|
+
},
|
|
302
|
+
"choicesWithoutPlacementArea": {
|
|
303
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled",
|
|
304
|
+
"type": "number",
|
|
305
|
+
"title": "choicesWithoutPlacementArea"
|
|
306
|
+
},
|
|
307
|
+
"choices": {
|
|
308
|
+
"description": "Only available for the height prop: indicates the max height for images in choices and choices labels",
|
|
309
|
+
"type": "number",
|
|
310
|
+
"title": "choices"
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"maxImageHeight": {
|
|
315
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
316
|
+
"type": "object",
|
|
317
|
+
"properties": {
|
|
318
|
+
"teacherInstructions": {
|
|
319
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
320
|
+
"type": "number",
|
|
321
|
+
"title": "teacherInstructions"
|
|
322
|
+
},
|
|
323
|
+
"prompt": {
|
|
324
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
325
|
+
"type": "number",
|
|
326
|
+
"title": "prompt"
|
|
327
|
+
},
|
|
328
|
+
"rationale": {
|
|
329
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
330
|
+
"type": "number",
|
|
331
|
+
"title": "rationale"
|
|
332
|
+
},
|
|
333
|
+
"choicesWithPlacementArea": {
|
|
334
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled",
|
|
335
|
+
"type": "number",
|
|
336
|
+
"title": "choicesWithPlacementArea"
|
|
337
|
+
},
|
|
338
|
+
"choicesWithoutPlacementArea": {
|
|
339
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled",
|
|
340
|
+
"type": "number",
|
|
341
|
+
"title": "choicesWithoutPlacementArea"
|
|
342
|
+
},
|
|
343
|
+
"choices": {
|
|
344
|
+
"description": "Only available for the height prop: indicates the max height for images in choices and choices labels",
|
|
345
|
+
"type": "number",
|
|
346
|
+
"title": "choices"
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
278
350
|
"showPrompt": {
|
|
279
351
|
"description": "Determines whether prompt field will be displayed or not",
|
|
280
352
|
"default": true,
|
|
@@ -310,6 +382,42 @@
|
|
|
310
382
|
"title": "label"
|
|
311
383
|
}
|
|
312
384
|
}
|
|
385
|
+
},
|
|
386
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
387
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
388
|
+
"type": "object",
|
|
389
|
+
"properties": {
|
|
390
|
+
"teacherInstructions": {
|
|
391
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
392
|
+
"type": "number",
|
|
393
|
+
"title": "teacherInstructions"
|
|
394
|
+
},
|
|
395
|
+
"prompt": {
|
|
396
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
397
|
+
"type": "number",
|
|
398
|
+
"title": "prompt"
|
|
399
|
+
},
|
|
400
|
+
"rationale": {
|
|
401
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
402
|
+
"type": "number",
|
|
403
|
+
"title": "rationale"
|
|
404
|
+
},
|
|
405
|
+
"choicesWithPlacementArea": {
|
|
406
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled",
|
|
407
|
+
"type": "number",
|
|
408
|
+
"title": "choicesWithPlacementArea"
|
|
409
|
+
},
|
|
410
|
+
"choicesWithoutPlacementArea": {
|
|
411
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled",
|
|
412
|
+
"type": "number",
|
|
413
|
+
"title": "choicesWithoutPlacementArea"
|
|
414
|
+
},
|
|
415
|
+
"choices": {
|
|
416
|
+
"description": "Only available for the height prop: indicates the max height for images in choices and choices labels",
|
|
417
|
+
"type": "number",
|
|
418
|
+
"title": "choices"
|
|
419
|
+
}
|
|
420
|
+
}
|
|
313
421
|
}
|
|
314
422
|
},
|
|
315
423
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -206,6 +206,62 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
206
206
|
|
|
207
207
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
208
208
|
|
|
209
|
+
# `maxImageWidth` (object)
|
|
210
|
+
|
|
211
|
+
Properties of the `maxImageWidth` object:
|
|
212
|
+
|
|
213
|
+
## `teacherInstructions` (number)
|
|
214
|
+
|
|
215
|
+
Indicates the max dimension for images in teacher instructions
|
|
216
|
+
|
|
217
|
+
## `prompt` (number)
|
|
218
|
+
|
|
219
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
220
|
+
|
|
221
|
+
## `rationale` (number)
|
|
222
|
+
|
|
223
|
+
Indicates the max dimension for images in rationale
|
|
224
|
+
|
|
225
|
+
## `choicesWithPlacementArea` (number)
|
|
226
|
+
|
|
227
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled
|
|
228
|
+
|
|
229
|
+
## `choicesWithoutPlacementArea` (number)
|
|
230
|
+
|
|
231
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled
|
|
232
|
+
|
|
233
|
+
## `choices` (number)
|
|
234
|
+
|
|
235
|
+
Only available for the height prop: indicates the max height for images in choices and choices labels
|
|
236
|
+
|
|
237
|
+
# `maxImageHeight` (object)
|
|
238
|
+
|
|
239
|
+
Properties of the `maxImageHeight` object:
|
|
240
|
+
|
|
241
|
+
## `teacherInstructions` (number)
|
|
242
|
+
|
|
243
|
+
Indicates the max dimension for images in teacher instructions
|
|
244
|
+
|
|
245
|
+
## `prompt` (number)
|
|
246
|
+
|
|
247
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
248
|
+
|
|
249
|
+
## `rationale` (number)
|
|
250
|
+
|
|
251
|
+
Indicates the max dimension for images in rationale
|
|
252
|
+
|
|
253
|
+
## `choicesWithPlacementArea` (number)
|
|
254
|
+
|
|
255
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled
|
|
256
|
+
|
|
257
|
+
## `choicesWithoutPlacementArea` (number)
|
|
258
|
+
|
|
259
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled
|
|
260
|
+
|
|
261
|
+
## `choices` (number)
|
|
262
|
+
|
|
263
|
+
Only available for the height prop: indicates the max height for images in choices and choices labels
|
|
264
|
+
|
|
209
265
|
# `showPrompt` (boolean)
|
|
210
266
|
|
|
211
267
|
Determines whether prompt field will be displayed or not
|
|
@@ -240,4 +296,32 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
240
296
|
|
|
241
297
|
### `label` (string)
|
|
242
298
|
|
|
243
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
299
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
300
|
+
|
|
301
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
302
|
+
|
|
303
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
304
|
+
|
|
305
|
+
### `teacherInstructions` (number)
|
|
306
|
+
|
|
307
|
+
Indicates the max dimension for images in teacher instructions
|
|
308
|
+
|
|
309
|
+
### `prompt` (number)
|
|
310
|
+
|
|
311
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
312
|
+
|
|
313
|
+
### `rationale` (number)
|
|
314
|
+
|
|
315
|
+
Indicates the max dimension for images in rationale
|
|
316
|
+
|
|
317
|
+
### `choicesWithPlacementArea` (number)
|
|
318
|
+
|
|
319
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled
|
|
320
|
+
|
|
321
|
+
### `choicesWithoutPlacementArea` (number)
|
|
322
|
+
|
|
323
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled
|
|
324
|
+
|
|
325
|
+
### `choices` (number)
|
|
326
|
+
|
|
327
|
+
Only available for the height prop: indicates the max height for images in choices and choices labels
|
package/docs/pie-schema.json
CHANGED
|
@@ -406,6 +406,42 @@
|
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
},
|
|
409
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
410
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
411
|
+
"type": "object",
|
|
412
|
+
"properties": {
|
|
413
|
+
"teacherInstructions": {
|
|
414
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
415
|
+
"type": "number",
|
|
416
|
+
"title": "teacherInstructions"
|
|
417
|
+
},
|
|
418
|
+
"prompt": {
|
|
419
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
420
|
+
"type": "number",
|
|
421
|
+
"title": "prompt"
|
|
422
|
+
},
|
|
423
|
+
"rationale": {
|
|
424
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
425
|
+
"type": "number",
|
|
426
|
+
"title": "rationale"
|
|
427
|
+
},
|
|
428
|
+
"choicesWithPlacementArea": {
|
|
429
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled",
|
|
430
|
+
"type": "number",
|
|
431
|
+
"title": "choicesWithPlacementArea"
|
|
432
|
+
},
|
|
433
|
+
"choicesWithoutPlacementArea": {
|
|
434
|
+
"description": "Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled",
|
|
435
|
+
"type": "number",
|
|
436
|
+
"title": "choicesWithoutPlacementArea"
|
|
437
|
+
},
|
|
438
|
+
"choices": {
|
|
439
|
+
"description": "Only available for the height prop: indicates the max height for images in choices and choices labels",
|
|
440
|
+
"type": "number",
|
|
441
|
+
"title": "choices"
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
},
|
|
409
445
|
"Choice": {
|
|
410
446
|
"title": "Choice",
|
|
411
447
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -200,6 +200,34 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
200
200
|
|
|
201
201
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
202
202
|
|
|
203
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
204
|
+
|
|
205
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
206
|
+
|
|
207
|
+
### `teacherInstructions` (number)
|
|
208
|
+
|
|
209
|
+
Indicates the max dimension for images in teacher instructions
|
|
210
|
+
|
|
211
|
+
### `prompt` (number)
|
|
212
|
+
|
|
213
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
214
|
+
|
|
215
|
+
### `rationale` (number)
|
|
216
|
+
|
|
217
|
+
Indicates the max dimension for images in rationale
|
|
218
|
+
|
|
219
|
+
### `choicesWithPlacementArea` (number)
|
|
220
|
+
|
|
221
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is enabled
|
|
222
|
+
|
|
223
|
+
### `choicesWithoutPlacementArea` (number)
|
|
224
|
+
|
|
225
|
+
Only available for the width prop: indicates the max width for images in choices and choices labels when placement area is disabled
|
|
226
|
+
|
|
227
|
+
### `choices` (number)
|
|
228
|
+
|
|
229
|
+
Only available for the height prop: indicates the max height for images in choices and choices labels
|
|
230
|
+
|
|
203
231
|
## `Choice` (object)
|
|
204
232
|
|
|
205
233
|
Properties of the `Choice` object:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/placement-ordering",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "ISC",
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "ff92cee6f9a7bf3f3dc75dbafd2263710f0a6b3d",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"postpublish": "../../scripts/postpublish"
|
|
30
30
|
},
|