@pie-element/categorize 8.0.2-next.3 → 8.1.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 +21 -0
- package/configure/CHANGELOG.md +21 -0
- package/configure/lib/defaults.js +6 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design/categories/index.js +14 -4
- package/configure/lib/design/categories/index.js.map +1 -1
- package/configure/lib/design/index.js +100 -55
- package/configure/lib/design/index.js.map +1 -1
- package/configure/lib/utils.js +14 -1
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +2 -2
- package/controller/CHANGELOG.md +18 -0
- package/controller/lib/defaults.js +1 -0
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +3 -2
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/pie-schema.json +12 -0
- package/docs/pie-schema.json.md +8 -0
- package/lib/categorize/index.js +68 -13
- package/lib/categorize/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
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.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@8.0.1...@pie-element/categorize@8.1.0) (2023-11-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-597 ([1ec84aa](https://github.com/pie-framework/pie-elements/commit/1ec84aadae515088ef65b99f780a5e5dca516f99))
|
|
12
|
+
* update pie-libs PD-2996 ([cd092c6](https://github.com/pie-framework/pie-elements/commit/cd092c6b5c4db91645394cd23febc1f9a07f46f9))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **categorize:** add maxChoicesPerCategory logic both author and student PD-2996 ([fbb7562](https://github.com/pie-framework/pie-elements/commit/fbb7562f2a878bcdaa68114c1ec430150c45e62c))
|
|
18
|
+
* **categorize:** correct tests PD-2996 ([12f5dd4](https://github.com/pie-framework/pie-elements/commit/12f5dd41de9db5ede18a0ad32358c8d8dd5413ad))
|
|
19
|
+
* **categorize:** PD-2996 - add setting for max nr of choices in a category ([b6162c6](https://github.com/pie-framework/pie-elements/commit/b6162c6294c851f4dfeb984211c97a0bc610166e))
|
|
20
|
+
* **categorize:** solve code review observations, add translator PD-2996 ([be13dc6](https://github.com/pie-framework/pie-elements/commit/be13dc671ab416212b7db06d8dc08666ef218b7e))
|
|
21
|
+
* **categorize:** update tests, update docu PD-2996 ([4c13904](https://github.com/pie-framework/pie-elements/commit/4c13904299d9fe518c3cc13398a0114e61f723ca))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
6
27
|
## [8.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize@8.0.0...@pie-element/categorize@8.0.1) (2023-11-09)
|
|
7
28
|
|
|
8
29
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
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
|
+
# [7.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-configure@7.0.1...@pie-element/categorize-configure@7.1.0) (2023-11-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-597 ([1ec84aa](https://github.com/pie-framework/pie-elements/commit/1ec84aadae515088ef65b99f780a5e5dca516f99))
|
|
12
|
+
* update pie-libs PD-2996 ([cd092c6](https://github.com/pie-framework/pie-elements/commit/cd092c6b5c4db91645394cd23febc1f9a07f46f9))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **categorize:** add maxChoicesPerCategory logic both author and student PD-2996 ([fbb7562](https://github.com/pie-framework/pie-elements/commit/fbb7562f2a878bcdaa68114c1ec430150c45e62c))
|
|
18
|
+
* **categorize:** correct tests PD-2996 ([12f5dd4](https://github.com/pie-framework/pie-elements/commit/12f5dd41de9db5ede18a0ad32358c8d8dd5413ad))
|
|
19
|
+
* **categorize:** PD-2996 - add setting for max nr of choices in a category ([b6162c6](https://github.com/pie-framework/pie-elements/commit/b6162c6294c851f4dfeb984211c97a0bc610166e))
|
|
20
|
+
* **categorize:** solve code review observations, add translator PD-2996 ([be13dc6](https://github.com/pie-framework/pie-elements/commit/be13dc671ab416212b7db06d8dc08666ef218b7e))
|
|
21
|
+
* **categorize:** update tests, update docu PD-2996 ([4c13904](https://github.com/pie-framework/pie-elements/commit/4c13904299d9fe518c3cc13398a0114e61f723ca))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
6
27
|
## [7.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/categorize-configure@7.0.0...@pie-element/categorize-configure@7.0.1) (2023-11-09)
|
|
7
28
|
|
|
8
29
|
|
|
@@ -15,6 +15,8 @@ var _default = {
|
|
|
15
15
|
lockChoiceOrder: true,
|
|
16
16
|
allowMultiplePlacementsEnabled: _utils.multiplePlacements.enabled,
|
|
17
17
|
allowAlternateEnabled: false,
|
|
18
|
+
allowMaxChoicesPerCategory: false,
|
|
19
|
+
maxChoicesPerCategory: 0,
|
|
18
20
|
categoriesPerRow: 2,
|
|
19
21
|
categories: [],
|
|
20
22
|
alternates: [],
|
|
@@ -51,6 +53,10 @@ var _default = {
|
|
|
51
53
|
settings: true,
|
|
52
54
|
label: 'Allow Multiple Placements'
|
|
53
55
|
},
|
|
56
|
+
maxPlacements: {
|
|
57
|
+
settings: true,
|
|
58
|
+
label: 'Max choices per category'
|
|
59
|
+
},
|
|
54
60
|
allowAlternate: {
|
|
55
61
|
settings: true,
|
|
56
62
|
label: 'Allow Alternate Correct Answers'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","choices","choicesPosition","choicesLabel","lockChoiceOrder","allowMultiplePlacementsEnabled","multiplePlacements","enabled","allowAlternateEnabled","categoriesPerRow","categories","alternates","correctResponse","rowLabels","partialScoring","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","spellCheck","label","settings","feedback","allowMultiplePlacements","allowAlternate","prompt","rationale","scoringType","settingsPanelDisabled","studentInstructions","teacherInstructions","maxImageWidth","rowLabel","categoryLabel","maxImageHeight","withRubric","minCategoriesPerRow","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"mappings":";;;;;;;AAAA;;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE,EADJ;AAELC,IAAAA,eAAe,EAAE,OAFZ;AAGLC,IAAAA,YAAY,EAAE,EAHT;AAILC,IAAAA,eAAe,EAAE,IAJZ;AAKLC,IAAAA,8BAA8B,EAAEC,0BAAmBC,OAL9C;AAMLC,IAAAA,qBAAqB,EAAE,KANlB;AAOLC,IAAAA,
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","choices","choicesPosition","choicesLabel","lockChoiceOrder","allowMultiplePlacementsEnabled","multiplePlacements","enabled","allowAlternateEnabled","allowMaxChoicesPerCategory","maxChoicesPerCategory","categoriesPerRow","categories","alternates","correctResponse","rowLabels","partialScoring","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","spellCheck","label","settings","feedback","allowMultiplePlacements","maxPlacements","allowAlternate","prompt","rationale","scoringType","settingsPanelDisabled","studentInstructions","teacherInstructions","maxImageWidth","rowLabel","categoryLabel","maxImageHeight","withRubric","minCategoriesPerRow","mathMlOptions","mmlOutput","mmlEditing","language","languageCho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;AAEbL,MAAAA,MAAM,EAAE,GAFK;AAGbC,MAAAA,SAAS,EAAE,GAHE;AAIbM,MAAAA,QAAQ,EAAE,GAJG;AAKbC,MAAAA,aAAa,EAAE,GALF;AAMbtC,MAAAA,OAAO,EAAE;AANI,KAhEF;AAwEbuC,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEdL,MAAAA,MAAM,EAAE,GAFM;AAGdC,MAAAA,SAAS,EAAE,GAHG;AAIdM,MAAAA,QAAQ,EAAE,GAJI;AAKdC,MAAAA,aAAa,EAAE,GALD;AAMdtC,MAAAA,OAAO,EAAE;AANK,KAxEH;AAgFbwC,IAAAA,UAAU,EAAE;AACVf,MAAAA,QAAQ,EAAE,KADA;AAEVD,MAAAA,KAAK,EAAE;AAFG,KAhFC;AAoFbiB,IAAAA,mBAAmB,EAAE,CApFR;AAqFbC,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KArFF;AAyFbC,IAAAA,QAAQ,EAAE;AACRpB,MAAAA,QAAQ,EAAE,KADF;AAERD,MAAAA,KAAK,EAAE,kBAFC;AAGRlB,MAAAA,OAAO,EAAE;AAHD,KAzFG;AA8FbwC,IAAAA,eAAe,EAAE;AACftB,MAAAA,KAAK,EAAE,kBADQ;AAEfuB,MAAAA,OAAO,EAAE;AAFM;AA9FJ;AAvBF,C","sourcesContent":["import { multiplePlacements } from './utils';\n\nexport default {\n model: {\n choices: [],\n choicesPosition: 'below',\n choicesLabel: '',\n lockChoiceOrder: true,\n allowMultiplePlacementsEnabled: multiplePlacements.enabled,\n allowAlternateEnabled: false,\n allowMaxChoicesPerCategory: false,\n maxChoicesPerCategory: 0,\n categoriesPerRow: 2,\n categories: [],\n alternates: [],\n correctResponse: [],\n rowLabels: [''],\n partialScoring: true,\n feedbackEnabled: false,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n enabled: true,\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order',\n },\n choicesPosition: {\n settings: true,\n label: 'Choices Position',\n },\n allowMultiplePlacements: {\n settings: true,\n label: 'Allow Multiple Placements',\n },\n maxPlacements: {\n settings: true,\n label: 'Max choices per category',\n },\n allowAlternate: {\n settings: true,\n label: 'Allow Alternate Correct Answers',\n },\n categoriesPerRow: {\n settings: true,\n label: 'Categories per row',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n prompt: {\n settings: true,\n label: 'Prompt',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n settingsPanelDisabled: false,\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n },\n toolbarEditorPosition: {\n settings: false,\n label: 'Toolbar Editor Position',\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n rowLabel: 200,\n categoryLabel: 260,\n choices: 240,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n rowLabel: 100,\n categoryLabel: 100,\n choices: 150,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n minCategoriesPerRow: 1,\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"file":"defaults.js"}
|
|
@@ -179,7 +179,9 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
179
179
|
_ref$choices = _ref.choices,
|
|
180
180
|
choices = _ref$choices === void 0 ? [] : _ref$choices,
|
|
181
181
|
_ref$correctResponse = _ref.correctResponse,
|
|
182
|
-
correctResponse = _ref$correctResponse === void 0 ? [] : _ref$correctResponse
|
|
182
|
+
correctResponse = _ref$correctResponse === void 0 ? [] : _ref$correctResponse,
|
|
183
|
+
_ref$maxChoicesPerCat = _ref.maxChoicesPerCategory,
|
|
184
|
+
maxChoicesPerCategory = _ref$maxChoicesPerCat === void 0 ? 0 : _ref$maxChoicesPerCat;
|
|
183
185
|
|
|
184
186
|
var choice = (choices || []).find(function (choice) {
|
|
185
187
|
return choice.id === addedChoice.id;
|
|
@@ -190,8 +192,11 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
190
192
|
correctResponse = (0, _categorize.verifyAllowMultiplePlacements)(addedChoice, categoryId, correctResponse);
|
|
191
193
|
}
|
|
192
194
|
|
|
195
|
+
var maxCategoryChoices = (0, _utils.getMaxCategoryChoices)(model); // when maxChoicesPerCategory is set to 0, there is no limit so it should not be updated
|
|
196
|
+
|
|
193
197
|
onModelChanged({
|
|
194
|
-
correctResponse: correctResponse
|
|
198
|
+
correctResponse: correctResponse,
|
|
199
|
+
maxChoicesPerCategory: maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices ? maxChoicesPerCategory + 1 : maxChoicesPerCategory
|
|
195
200
|
});
|
|
196
201
|
});
|
|
197
202
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "deleteChoiceFromCategory", function (category, choice, choiceIndex) {
|
|
@@ -211,7 +216,9 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
211
216
|
var _ref2 = model || {},
|
|
212
217
|
choices = _ref2.choices,
|
|
213
218
|
_ref2$correctResponse = _ref2.correctResponse,
|
|
214
|
-
correctResponse = _ref2$correctResponse === void 0 ? [] : _ref2$correctResponse
|
|
219
|
+
correctResponse = _ref2$correctResponse === void 0 ? [] : _ref2$correctResponse,
|
|
220
|
+
_ref2$maxChoicesPerCa = _ref2.maxChoicesPerCategory,
|
|
221
|
+
maxChoicesPerCategory = _ref2$maxChoicesPerCa === void 0 ? 0 : _ref2$maxChoicesPerCa;
|
|
215
222
|
|
|
216
223
|
var choice = (choices || []).find(function (choice) {
|
|
217
224
|
return choice.id === choiceId;
|
|
@@ -228,8 +235,11 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
228
235
|
correctResponse = (0, _categorize.moveChoiceToCategory)(choice.id, undefined, to, 0, correctResponse);
|
|
229
236
|
}
|
|
230
237
|
|
|
238
|
+
var maxCategoryChoices = (0, _utils.getMaxCategoryChoices)(model); // when maxChoicesPerCategory is set to 0, there is no limit so it should not be updated
|
|
239
|
+
|
|
231
240
|
onModelChanged({
|
|
232
|
-
correctResponse: correctResponse
|
|
241
|
+
correctResponse: correctResponse,
|
|
242
|
+
maxChoicesPerCategory: maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices ? maxChoicesPerCategory + 1 : maxChoicesPerCategory
|
|
233
243
|
});
|
|
234
244
|
});
|
|
235
245
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeRowLabel", function (val, index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/design/categories/index.jsx"],"names":["styles","theme","categories","marginBottom","spacing","unit","categoriesHolder","display","gridRowGap","gridColumnGap","row","gridTemplateColumns","alignItems","width","marginTop","rowLabel","gridColumn","rowLabelHolder","tooltip","fontSize","typography","whiteSpace","maxWidth","errorText","color","palette","error","main","paddingTop","Categories","focusedEl","props","model","oldCategories","categoriesPerRow","id","utils","firstAvailableIndex","map","a","data","label","addRowLabel","length","rowLabels","push","setState","onModelChanged","concat","category","index","findIndex","splice","correctResponse","c","addedChoice","categoryId","choices","choice","find","undefined","categoryCount","choiceIndex","choiceId","from","to","val","newRowLabels","classes","className","imageSupport","uploadSoundSupport","toolbarOpts","spellCheck","configuration","defaultImageMaxHeight","defaultImageMaxWidth","mathMlOptions","errors","associationError","categoriesError","categoriesErrors","maxCategories","maxImageWidth","maxImageHeight","holderStyle","validationMessage","add","marginLeft","hasRowLabel","rowIndex","changeRowLabel","state","deleteFocusedEl","change","addChoiceToCategory","moveChoice","deleteChoiceFromCategory","categoryLabel","React","Component","PropTypes","number","shape","func","isRequired","object","string","array","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YAAY,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB;AADzB,KADa;AAIzBC,IAAAA,gBAAgB,EAAE;AAChBC,MAAAA,OAAO,EAAE,MADO;AAEhBC,MAAAA,UAAU,YAAKP,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAFM;AAGhBI,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB;AAHG,KAJO;AASzBK,IAAAA,GAAG,EAAE;AACHH,MAAAA,OAAO,EAAE,MADN;AAEHI,MAAAA,mBAAmB,EAAE,gBAFlB;AAGHF,MAAAA,aAAa,YAAKR,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAHV;AAIHO,MAAAA,UAAU,EAAE,UAJT;AAKHC,MAAAA,KAAK,EAAE,MALJ;AAMHC,MAAAA,SAAS,EAAEb,KAAK,CAACG,OAAN,CAAcC,IANtB;AAOHF,MAAAA,YAAY,EAAE,IAAIF,KAAK,CAACG,OAAN,CAAcC;AAP7B,KAToB;AAkBzBU,IAAAA,QAAQ,EAAE;AACRC,MAAAA,UAAU,EAAE;AADJ,KAlBe;AAqBzBC,IAAAA,cAAc,EAAE;AACdJ,MAAAA,KAAK,EAAE;AADO,KArBS;AAwBzBK,IAAAA,OAAO,EAAE;AACPC,MAAAA,QAAQ,EAAElB,KAAK,CAACmB,UAAN,CAAiBD,QAAjB,GAA4B,CAD/B;AAEPE,MAA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AAA,SAAS,EAAEgC,sBAAUM,MAZJ;AAajBzG,EAAAA,UAAU,EAAEmG,sBAAUO,KAbL;AAcjB7D,EAAAA,cAAc,EAAEsD,sBAAUG,IAdT;AAejBxE,EAAAA,KAAK,EAAEqE,sBAAUK,MAAV,CAAiBD,UAfP;AAgBjB/B,EAAAA,aAAa,EAAE2B,sBAAUK,MAAV,CAAiBD,UAhBf;AAiBjBjC,EAAAA,WAAW,EAAE6B,sBAAUK,MAjBN;AAkBjBjC,EAAAA,UAAU,EAAE4B,sBAAUQ;AAlBL,C;;eAsON,wBAAW7G,MAAX,EAAmB6B,UAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { choiceUtils as utils } from '@pie-lib/pie-toolbox/config-ui';\nimport classNames from 'classnames';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport {\n moveChoiceToCategory,\n removeCategory,\n removeChoiceFromCategory,\n verifyAllowMultiplePlacements,\n} from '@pie-lib/pie-toolbox/categorize';\n\nimport Category from './category';\nimport Header from '../header';\nimport { generateValidationMessage } from '../../utils';\nimport { RowLabel } from './RowLabel';\n\nconst styles = (theme) => ({\n categories: {\n marginBottom: theme.spacing.unit * 3,\n },\n categoriesHolder: {\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n row: {\n display: 'grid',\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridColumnGap: `${theme.spacing.unit}px`,\n alignItems: 'baseline',\n width: '100%',\n marginTop: theme.spacing.unit,\n marginBottom: 2 * theme.spacing.unit,\n },\n rowLabel: {\n gridColumn: '1/3',\n },\n rowLabelHolder: {\n width: '100%',\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit / 2,\n },\n});\n\nexport class Categories extends React.Component {\n static propTypes = {\n defaultImageMaxHeight: PropTypes.number,\n defaultImageMaxWidth: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n categories: PropTypes.array,\n onModelChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n toolbarOpts: PropTypes.object,\n spellCheck: PropTypes.bool,\n };\n\n state = {\n focusedEl: null,\n };\n\n add = () => {\n const { model, categories: oldCategories } = this.props;\n const { categoriesPerRow } = model;\n const id = utils.firstAvailableIndex(\n model.categories.map((a) => a.id),\n 0,\n );\n const data = { id, label: 'Category ' + id };\n const addRowLabel = model.categories.length % categoriesPerRow === 0;\n const rowLabels = [...model.rowLabels];\n\n if (addRowLabel) {\n rowLabels.push('');\n }\n\n this.setState(\n {\n focusedEl: oldCategories.length,\n },\n () => {\n this.props.onModelChanged({\n rowLabels,\n categories: model.categories.concat([data]),\n });\n },\n );\n };\n\n deleteFocusedEl = () => {\n this.setState({\n focusedEl: null,\n });\n };\n\n delete = (category) => {\n const { model, onModelChanged } = this.props;\n const index = model.categories.findIndex((a) => a.id === category.id);\n\n if (index !== -1) {\n model.categories.splice(index, 1);\n model.correctResponse = removeCategory(category.id, model.correctResponse);\n onModelChanged(model);\n }\n };\n\n change = (c) => {\n const { categories } = this.props;\n const index = categories.findIndex((a) => a.id === c.id);\n\n if (index !== -1) {\n categories.splice(index, 1, c);\n this.props.onModelChanged({ categories });\n }\n };\n\n addChoiceToCategory = (addedChoice, categoryId) => {\n const { model, onModelChanged } = this.props;\n let { choices = [], correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === addedChoice.id);\n correctResponse = moveChoiceToCategory(addedChoice.id, undefined, categoryId, 0, model.correctResponse);\n // if multiplePlacements not allowed, ensure the consistency in the other categories\n if (choice.categoryCount !== 0) {\n correctResponse = verifyAllowMultiplePlacements(addedChoice, categoryId, correctResponse);\n }\n onModelChanged({ correctResponse });\n };\n\n deleteChoiceFromCategory = (category, choice, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n const correctResponse = removeChoiceFromCategory(choice.id, category.id, choiceIndex, model.correctResponse);\n\n onModelChanged({ correctResponse });\n };\n\n moveChoice = (choiceId, from, to, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n let { choices, correctResponse = [] } = model || {};\n const choice = (choices || []).find((choice) => choice.id === choiceId);\n if (to === from || !choice) {\n return;\n }\n if (choice.categoryCount !== 0) {\n correctResponse = moveChoiceToCategory(choice.id, from, to, choiceIndex, correctResponse);\n correctResponse = verifyAllowMultiplePlacements(choice, to, correctResponse);\n } else if (choice.categoryCount === 0) {\n correctResponse = moveChoiceToCategory(choice.id, undefined, to, 0, correctResponse);\n }\n onModelChanged({ correctResponse });\n };\n\n changeRowLabel = (val, index) => {\n const { model } = this.props;\n const { rowLabels } = model;\n const newRowLabels = [...rowLabels];\n\n if (newRowLabels.length < index) {\n newRowLabels.push(val);\n } else {\n newRowLabels[index] = val;\n }\n\n this.props.onModelChanged({\n rowLabels: newRowLabels,\n });\n };\n\n render() {\n const {\n model,\n classes,\n className,\n categories,\n imageSupport,\n uploadSoundSupport,\n toolbarOpts,\n spellCheck,\n configuration,\n defaultImageMaxHeight,\n defaultImageMaxWidth,\n mathMlOptions = {}\n } = this.props;\n\n const { categoriesPerRow, rowLabels, errors } = model;\n const { associationError, categoriesError, categoriesErrors } = errors || {};\n const { maxCategories, maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n const holderStyle = {\n gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`,\n };\n\n const validationMessage = generateValidationMessage(configuration);\n\n return (\n <div className={classNames(classes.categories, className)}>\n <Header\n label=\"Categories\"\n buttonLabel=\"ADD A CATEGORY\"\n onAdd={this.add}\n info={\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '5px' }} />\n </Tooltip>\n }\n buttonDisabled={maxCategories && categories && maxCategories === categories.length}\n />\n\n <div className={classes.categoriesHolder} style={holderStyle}>\n {categories.map((category, index) => {\n const hasRowLabel = index % categoriesPerRow === 0;\n const rowIndex = index / categoriesPerRow;\n\n return (\n <React.Fragment key={index}>\n {hasRowLabel && (\n <RowLabel\n categoriesPerRow={categoriesPerRow}\n disabled={false}\n rowIndex={rowIndex}\n markup={rowLabels[rowIndex] || ''}\n onChange={(val) => this.changeRowLabel(val, rowIndex)}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n maxImageWidth={(maxImageWidth && maxImageWidth.rowLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rowLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n />\n )}\n\n <Category\n imageSupport={imageSupport}\n focusedEl={this.state.focusedEl}\n deleteFocusedEl={this.deleteFocusedEl}\n index={index}\n category={category}\n error={categoriesErrors && categoriesErrors[category.id]}\n onChange={this.change}\n onDelete={() => this.delete(category)}\n onAddChoice={this.addChoiceToCategory}\n onMoveChoice={(choiceId, from, to, choiceIndex) => this.moveChoice(choiceId, from, to, choiceIndex)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n onDeleteChoice={(choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex)}\n maxImageWidth={(maxImageWidth && maxImageWidth.categoryLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.categoryLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n </React.Fragment>\n );\n })}\n </div>\n\n {associationError && <div className={classes.errorText}>{associationError}</div>}\n {categoriesError && <div className={classes.errorText}>{categoriesError}</div>}\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(Categories);\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/design/categories/index.jsx"],"names":["styles","theme","categories","marginBottom","spacing","unit","categoriesHolder","display","gridRowGap","gridColumnGap","row","gridTemplateColumns","alignItems","width","marginTop","rowLabel","gridColumn","rowLabelHolder","tooltip","fontSize","typography","whiteSpace","maxWidth","errorText","color","palette","error","main","paddingTop","Categories","focusedEl","props","model","oldCategories","categoriesPerRow","id","utils","firstAvailableIndex","map","a","data","label","addRowLabel","length","rowLabels","push","setState","onModelChanged","concat","category","index","findIndex","splice","correctResponse","c","addedChoice","categoryId","choices","maxChoicesPerCategory","choice","find","undefined","categoryCount","maxCategoryChoices","choiceIndex","choiceId","from","to","val","newRowLabels","classes","className","imageSupport","uploadSoundSupport","toolbarOpts","spellCheck","configuration","defaultImageMaxHeight","defaultImageMaxWidth","mathMlOptions","errors","associationError","categoriesError","categoriesErrors","maxCategories","maxImageWidth","maxImageHeight","holderStyle","validationMessage","add","marginLeft","hasRowLabel","rowIndex","changeRowLabel","state","deleteFocusedEl","change","addChoiceToCategory","moveChoice","deleteChoiceFromCategory","categoryLabel","React","Component","PropTypes","number","shape","func","isRequired","object","string","array","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YAAY,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB;AADzB,KADa;AAIzBC,IAAAA,gBAAgB,EAAE;AAChBC,MAAAA,OAAO,EAAE,MADO;AAEhBC,MAAAA,UAAU,YAAKP,KAAK,CAACG,OAAN,CAAcC,IAAnB,OAFM;AAGh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G,EAAAA,UAAU,EAAEqG,sBAAUO,KAbL;AAcjB/D,EAAAA,cAAc,EAAEwD,sBAAUG,IAdT;AAejB1E,EAAAA,KAAK,EAAEuE,sBAAUK,MAAV,CAAiBD,UAfP;AAgBjB/B,EAAAA,aAAa,EAAE2B,sBAAUK,MAAV,CAAiBD,UAhBf;AAiBjBjC,EAAAA,WAAW,EAAE6B,sBAAUK,MAjBN;AAkBjBjC,EAAAA,UAAU,EAAE4B,sBAAUQ;AAlBL,C;;eA0ON,wBAAW/G,MAAX,EAAmB6B,UAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { choiceUtils as utils } from '@pie-lib/pie-toolbox/config-ui';\nimport classNames from 'classnames';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport {\n moveChoiceToCategory,\n removeCategory,\n removeChoiceFromCategory,\n verifyAllowMultiplePlacements,\n} from '@pie-lib/pie-toolbox/categorize';\n\nimport Category from './category';\nimport Header from '../header';\nimport { generateValidationMessage, getMaxCategoryChoices } from '../../utils';\nimport { RowLabel } from './RowLabel';\n\nconst styles = (theme) => ({\n categories: {\n marginBottom: theme.spacing.unit * 3,\n },\n categoriesHolder: {\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n },\n row: {\n display: 'grid',\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridColumnGap: `${theme.spacing.unit}px`,\n alignItems: 'baseline',\n width: '100%',\n marginTop: theme.spacing.unit,\n marginBottom: 2 * theme.spacing.unit,\n },\n rowLabel: {\n gridColumn: '1/3',\n },\n rowLabelHolder: {\n width: '100%',\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit / 2,\n },\n});\n\nexport class Categories extends React.Component {\n static propTypes = {\n defaultImageMaxHeight: PropTypes.number,\n defaultImageMaxWidth: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n categories: PropTypes.array,\n onModelChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n toolbarOpts: PropTypes.object,\n spellCheck: PropTypes.bool,\n };\n\n state = {\n focusedEl: null,\n };\n\n add = () => {\n const { model, categories: oldCategories } = this.props;\n const { categoriesPerRow } = model;\n const id = utils.firstAvailableIndex(\n model.categories.map((a) => a.id),\n 0,\n );\n const data = { id, label: 'Category ' + id };\n const addRowLabel = model.categories.length % categoriesPerRow === 0;\n const rowLabels = [...model.rowLabels];\n\n if (addRowLabel) {\n rowLabels.push('');\n }\n\n this.setState(\n {\n focusedEl: oldCategories.length,\n },\n () => {\n this.props.onModelChanged({\n rowLabels,\n categories: model.categories.concat([data]),\n });\n },\n );\n };\n\n deleteFocusedEl = () => {\n this.setState({\n focusedEl: null,\n });\n };\n\n delete = (category) => {\n const { model, onModelChanged } = this.props;\n const index = model.categories.findIndex((a) => a.id === category.id);\n\n if (index !== -1) {\n model.categories.splice(index, 1);\n model.correctResponse = removeCategory(category.id, model.correctResponse);\n onModelChanged(model);\n }\n };\n\n change = (c) => {\n const { categories } = this.props;\n const index = categories.findIndex((a) => a.id === c.id);\n\n if (index !== -1) {\n categories.splice(index, 1, c);\n this.props.onModelChanged({ categories });\n }\n };\n\n addChoiceToCategory = (addedChoice, categoryId) => {\n const { model, onModelChanged } = this.props;\n let { choices = [], correctResponse = [], maxChoicesPerCategory = 0 } = model || {};\n const choice = (choices || []).find((choice) => choice.id === addedChoice.id);\n correctResponse = moveChoiceToCategory(addedChoice.id, undefined, categoryId, 0, model.correctResponse);\n // if multiplePlacements not allowed, ensure the consistency in the other categories\n if (choice.categoryCount !== 0) {\n correctResponse = verifyAllowMultiplePlacements(addedChoice, categoryId, correctResponse);\n }\n const maxCategoryChoices = getMaxCategoryChoices(model);\n // when maxChoicesPerCategory is set to 0, there is no limit so it should not be updated\n onModelChanged({ correctResponse, maxChoicesPerCategory: maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices ? maxChoicesPerCategory + 1 : maxChoicesPerCategory });\n };\n\n deleteChoiceFromCategory = (category, choice, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n const correctResponse = removeChoiceFromCategory(choice.id, category.id, choiceIndex, model.correctResponse);\n\n onModelChanged({ correctResponse });\n };\n\n moveChoice = (choiceId, from, to, choiceIndex) => {\n const { model, onModelChanged } = this.props;\n let { choices, correctResponse = [], maxChoicesPerCategory = 0 } = model || {};\n const choice = (choices || []).find((choice) => choice.id === choiceId);\n if (to === from || !choice) {\n return;\n }\n if (choice.categoryCount !== 0) {\n correctResponse = moveChoiceToCategory(choice.id, from, to, choiceIndex, correctResponse);\n correctResponse = verifyAllowMultiplePlacements(choice, to, correctResponse);\n } else if (choice.categoryCount === 0) {\n correctResponse = moveChoiceToCategory(choice.id, undefined, to, 0, correctResponse);\n }\n const maxCategoryChoices = getMaxCategoryChoices(model);\n // when maxChoicesPerCategory is set to 0, there is no limit so it should not be updated\n onModelChanged({ correctResponse, maxChoicesPerCategory: maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices ? maxChoicesPerCategory + 1 : maxChoicesPerCategory });\n };\n\n changeRowLabel = (val, index) => {\n const { model } = this.props;\n const { rowLabels } = model;\n const newRowLabels = [...rowLabels];\n\n if (newRowLabels.length < index) {\n newRowLabels.push(val);\n } else {\n newRowLabels[index] = val;\n }\n\n this.props.onModelChanged({\n rowLabels: newRowLabels,\n });\n };\n\n render() {\n const {\n model,\n classes,\n className,\n categories,\n imageSupport,\n uploadSoundSupport,\n toolbarOpts,\n spellCheck,\n configuration,\n defaultImageMaxHeight,\n defaultImageMaxWidth,\n mathMlOptions = {}\n } = this.props;\n\n const { categoriesPerRow, rowLabels, errors } = model;\n const { associationError, categoriesError, categoriesErrors } = errors || {};\n const { maxCategories, maxImageWidth = {}, maxImageHeight = {} } = configuration || {};\n const holderStyle = {\n gridTemplateColumns: `repeat(${categoriesPerRow}, 1fr)`,\n };\n\n const validationMessage = generateValidationMessage(configuration);\n\n return (\n <div className={classNames(classes.categories, className)}>\n <Header\n label=\"Categories\"\n buttonLabel=\"ADD A CATEGORY\"\n onAdd={this.add}\n info={\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '5px' }} />\n </Tooltip>\n }\n buttonDisabled={maxCategories && categories && maxCategories === categories.length}\n />\n\n <div className={classes.categoriesHolder} style={holderStyle}>\n {categories.map((category, index) => {\n const hasRowLabel = index % categoriesPerRow === 0;\n const rowIndex = index / categoriesPerRow;\n\n return (\n <React.Fragment key={index}>\n {hasRowLabel && (\n <RowLabel\n categoriesPerRow={categoriesPerRow}\n disabled={false}\n rowIndex={rowIndex}\n markup={rowLabels[rowIndex] || ''}\n onChange={(val) => this.changeRowLabel(val, rowIndex)}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n maxImageWidth={(maxImageWidth && maxImageWidth.rowLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rowLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n />\n )}\n\n <Category\n imageSupport={imageSupport}\n focusedEl={this.state.focusedEl}\n deleteFocusedEl={this.deleteFocusedEl}\n index={index}\n category={category}\n error={categoriesErrors && categoriesErrors[category.id]}\n onChange={this.change}\n onDelete={() => this.delete(category)}\n onAddChoice={this.addChoiceToCategory}\n onMoveChoice={(choiceId, from, to, choiceIndex) => this.moveChoice(choiceId, from, to, choiceIndex)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheck}\n onDeleteChoice={(choice, choiceIndex) => this.deleteChoiceFromCategory(category, choice, choiceIndex)}\n maxImageWidth={(maxImageWidth && maxImageWidth.categoryLabel) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.categoryLabel) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n />\n </React.Fragment>\n );\n })}\n </div>\n\n {associationError && <div className={classes.errorText}>{associationError}</div>}\n {categoriesError && <div className={classes.errorText}>{categoriesError}</div>}\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(Categories);\n"],"file":"index.js"}
|
|
@@ -49,6 +49,8 @@ var _header = _interopRequireDefault(require("./header"));
|
|
|
49
49
|
|
|
50
50
|
var _utils = require("../utils");
|
|
51
51
|
|
|
52
|
+
var _translator = _interopRequireDefault(require("@pie-lib/pie-toolbox/translator"));
|
|
53
|
+
|
|
52
54
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
53
55
|
|
|
54
56
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -57,6 +59,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
57
59
|
|
|
58
60
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
59
61
|
|
|
62
|
+
var translator = _translator["default"].translator;
|
|
60
63
|
var dropdown = _configUi.settings.dropdown,
|
|
61
64
|
Panel = _configUi.settings.Panel,
|
|
62
65
|
toggle = _configUi.settings.toggle,
|
|
@@ -103,7 +106,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
103
106
|
content: h.content,
|
|
104
107
|
categoryCount: h.categoryCount
|
|
105
108
|
};
|
|
106
|
-
});
|
|
109
|
+
}); // ensure that maxChoicesPerCategory is reset if author switch back the corresponding switch (allowMaxChoicesPerCategory)
|
|
110
|
+
|
|
111
|
+
updatedModel.maxChoicesPerCategory = updatedModel.allowMaxChoicesPerCategory ? updatedModel.maxChoicesPerCategory : 0;
|
|
107
112
|
onChange(updatedModel);
|
|
108
113
|
});
|
|
109
114
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeRationale", function (rationale) {
|
|
@@ -171,6 +176,25 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
171
176
|
|
|
172
177
|
return c.categoryCount || 0;
|
|
173
178
|
});
|
|
179
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isAlertModalOpened", function () {
|
|
180
|
+
var model = _this.props.model;
|
|
181
|
+
|
|
182
|
+
var _ref = model || {},
|
|
183
|
+
_ref$maxChoicesPerCat = _ref.maxChoicesPerCategory,
|
|
184
|
+
maxChoicesPerCategory = _ref$maxChoicesPerCat === void 0 ? 0 : _ref$maxChoicesPerCat;
|
|
185
|
+
|
|
186
|
+
var maxChoices = (0, _utils.getMaxCategoryChoices)(model); // when maxChoicesPerCategory is set to 0, there is no limit so modal should not be opened
|
|
187
|
+
|
|
188
|
+
return maxChoicesPerCategory !== 0 ? maxChoices > maxChoicesPerCategory : false;
|
|
189
|
+
});
|
|
190
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAlertModalCancel", function () {
|
|
191
|
+
var model = _this.props.model;
|
|
192
|
+
var maxChoices = (0, _utils.getMaxCategoryChoices)(model);
|
|
193
|
+
|
|
194
|
+
_this.updateModel({
|
|
195
|
+
maxChoicesPerCategory: maxChoices
|
|
196
|
+
});
|
|
197
|
+
});
|
|
174
198
|
_this.uid = _props.uid || _drag.uid.generateId();
|
|
175
199
|
return _this;
|
|
176
200
|
}
|
|
@@ -188,59 +212,63 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
188
212
|
uploadSoundSupport = _this$props4.uploadSoundSupport,
|
|
189
213
|
onConfigurationChanged = _this$props4.onConfigurationChanged;
|
|
190
214
|
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
allowMultiplePlacements =
|
|
194
|
-
|
|
195
|
-
allowAlternate =
|
|
196
|
-
|
|
197
|
-
categoriesPerRow =
|
|
198
|
-
|
|
199
|
-
choicesPosition =
|
|
200
|
-
|
|
201
|
-
contentDimensions =
|
|
202
|
-
|
|
203
|
-
feedback =
|
|
204
|
-
|
|
205
|
-
lockChoiceOrder =
|
|
206
|
-
|
|
207
|
-
maxImageHeight =
|
|
208
|
-
|
|
209
|
-
maxImageWidth =
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
215
|
+
var _ref2 = configuration || {},
|
|
216
|
+
_ref2$allowMultiplePl = _ref2.allowMultiplePlacements,
|
|
217
|
+
allowMultiplePlacements = _ref2$allowMultiplePl === void 0 ? {} : _ref2$allowMultiplePl,
|
|
218
|
+
_ref2$allowAlternate = _ref2.allowAlternate,
|
|
219
|
+
allowAlternate = _ref2$allowAlternate === void 0 ? {} : _ref2$allowAlternate,
|
|
220
|
+
_ref2$categoriesPerRo = _ref2.categoriesPerRow,
|
|
221
|
+
categoriesPerRow = _ref2$categoriesPerRo === void 0 ? {} : _ref2$categoriesPerRo,
|
|
222
|
+
_ref2$choicesPosition = _ref2.choicesPosition,
|
|
223
|
+
choicesPosition = _ref2$choicesPosition === void 0 ? {} : _ref2$choicesPosition,
|
|
224
|
+
_ref2$contentDimensio = _ref2.contentDimensions,
|
|
225
|
+
contentDimensions = _ref2$contentDimensio === void 0 ? {} : _ref2$contentDimensio,
|
|
226
|
+
_ref2$feedback = _ref2.feedback,
|
|
227
|
+
feedback = _ref2$feedback === void 0 ? {} : _ref2$feedback,
|
|
228
|
+
_ref2$lockChoiceOrder = _ref2.lockChoiceOrder,
|
|
229
|
+
lockChoiceOrder = _ref2$lockChoiceOrder === void 0 ? {} : _ref2$lockChoiceOrder,
|
|
230
|
+
_ref2$maxImageHeight = _ref2.maxImageHeight,
|
|
231
|
+
maxImageHeight = _ref2$maxImageHeight === void 0 ? {} : _ref2$maxImageHeight,
|
|
232
|
+
_ref2$maxImageWidth = _ref2.maxImageWidth,
|
|
233
|
+
maxImageWidth = _ref2$maxImageWidth === void 0 ? {} : _ref2$maxImageWidth,
|
|
234
|
+
_ref2$maxPlacements = _ref2.maxPlacements,
|
|
235
|
+
maxPlacements = _ref2$maxPlacements === void 0 ? {} : _ref2$maxPlacements,
|
|
236
|
+
_ref2$minCategoriesPe = _ref2.minCategoriesPerRow,
|
|
237
|
+
minCategoriesPerRow = _ref2$minCategoriesPe === void 0 ? 1 : _ref2$minCategoriesPe,
|
|
238
|
+
_ref2$partialScoring = _ref2.partialScoring,
|
|
239
|
+
partialScoring = _ref2$partialScoring === void 0 ? {} : _ref2$partialScoring,
|
|
240
|
+
_ref2$prompt = _ref2.prompt,
|
|
241
|
+
prompt = _ref2$prompt === void 0 ? {} : _ref2$prompt,
|
|
242
|
+
_ref2$rationale = _ref2.rationale,
|
|
243
|
+
rationale = _ref2$rationale === void 0 ? {} : _ref2$rationale,
|
|
244
|
+
_ref2$scoringType = _ref2.scoringType,
|
|
245
|
+
scoringType = _ref2$scoringType === void 0 ? {} : _ref2$scoringType,
|
|
246
|
+
settingsPanelDisabled = _ref2.settingsPanelDisabled,
|
|
247
|
+
_ref2$spellCheck = _ref2.spellCheck,
|
|
248
|
+
spellCheck = _ref2$spellCheck === void 0 ? {} : _ref2$spellCheck,
|
|
249
|
+
_ref2$studentInstruct = _ref2.studentInstructions,
|
|
250
|
+
studentInstructions = _ref2$studentInstruct === void 0 ? {} : _ref2$studentInstruct,
|
|
251
|
+
_ref2$teacherInstruct = _ref2.teacherInstructions,
|
|
252
|
+
teacherInstructions = _ref2$teacherInstruct === void 0 ? {} : _ref2$teacherInstruct,
|
|
253
|
+
_ref2$withRubric = _ref2.withRubric,
|
|
254
|
+
withRubric = _ref2$withRubric === void 0 ? {} : _ref2$withRubric,
|
|
255
|
+
_ref2$mathMlOptions = _ref2.mathMlOptions,
|
|
256
|
+
mathMlOptions = _ref2$mathMlOptions === void 0 ? {} : _ref2$mathMlOptions,
|
|
257
|
+
_ref2$language = _ref2.language,
|
|
258
|
+
language = _ref2$language === void 0 ? {} : _ref2$language,
|
|
259
|
+
_ref2$languageChoices = _ref2.languageChoices,
|
|
260
|
+
languageChoices = _ref2$languageChoices === void 0 ? {} : _ref2$languageChoices;
|
|
261
|
+
|
|
262
|
+
var _ref3 = model || {},
|
|
263
|
+
allowAlternateEnabled = _ref3.allowAlternateEnabled,
|
|
264
|
+
allowMaxChoicesPerCategory = _ref3.allowMaxChoicesPerCategory,
|
|
265
|
+
feedbackEnabled = _ref3.feedbackEnabled,
|
|
266
|
+
maxChoicesPerCategory = _ref3.maxChoicesPerCategory,
|
|
267
|
+
promptEnabled = _ref3.promptEnabled,
|
|
268
|
+
rationaleEnabled = _ref3.rationaleEnabled,
|
|
269
|
+
spellCheckEnabled = _ref3.spellCheckEnabled,
|
|
270
|
+
teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled,
|
|
271
|
+
toolbarEditorPosition = _ref3.toolbarEditorPosition;
|
|
244
272
|
|
|
245
273
|
var toolbarOpts = {
|
|
246
274
|
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
@@ -268,6 +296,12 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
268
296
|
}),
|
|
269
297
|
choicesPosition: choicesPosition.settings && radio(choicesPosition.label, ['below', 'above', 'left', 'right']),
|
|
270
298
|
allowMultiplePlacementsEnabled: allowMultiplePlacements.settings && dropdown(allowMultiplePlacements.label, [_utils.multiplePlacements.enabled, _utils.multiplePlacements.disabled, _utils.multiplePlacements.perChoice]),
|
|
299
|
+
allowMaxChoicesPerCategory: maxPlacements.settings && toggle(maxPlacements.label),
|
|
300
|
+
maxChoicesPerCategory: allowMaxChoicesPerCategory === true && numberField(maxPlacements.label, {
|
|
301
|
+
label: '',
|
|
302
|
+
min: 0,
|
|
303
|
+
max: 30
|
|
304
|
+
}),
|
|
271
305
|
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
272
306
|
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
273
307
|
// PD-2960: deleted temporary from settings panel
|
|
@@ -283,6 +317,11 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
283
317
|
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
284
318
|
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
|
|
285
319
|
};
|
|
320
|
+
var isOpened = this.isAlertModalOpened();
|
|
321
|
+
var alertMaxChoicesMsg = translator.t('translation:categorize:maxChoicesPerCategoryRestriction', {
|
|
322
|
+
lng: model.language,
|
|
323
|
+
maxChoicesPerCategory: maxChoicesPerCategory
|
|
324
|
+
});
|
|
286
325
|
return /*#__PURE__*/_react["default"].createElement(IdProvider, {
|
|
287
326
|
value: this.uid
|
|
288
327
|
}, /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
@@ -296,7 +335,13 @@ var Design = /*#__PURE__*/function (_React$Component) {
|
|
|
296
335
|
groups: {
|
|
297
336
|
Settings: panelSettings,
|
|
298
337
|
Properties: panelProperties
|
|
299
|
-
}
|
|
338
|
+
},
|
|
339
|
+
modal: /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
|
|
340
|
+
title: 'Warning',
|
|
341
|
+
text: alertMaxChoicesMsg,
|
|
342
|
+
open: isOpened,
|
|
343
|
+
onClose: this.onAlertModalCancel
|
|
344
|
+
})
|
|
300
345
|
})
|
|
301
346
|
}, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
302
347
|
label: teacherInstructions.label,
|