@pie-element/multiple-choice 5.9.3-next.499 → 5.9.3-next.510
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 +68 -15
- package/configure/CHANGELOG.md +47 -8
- package/configure/lib/defaults.js +3 -6
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/main.js +122 -21
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +1 -1
- package/controller/CHANGELOG.md +17 -0
- package/controller/package.json +1 -1
- package/docs/config-schema.json +10 -0
- package/docs/config-schema.json.md +8 -0
- package/module/configure.js +148 -41
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,17 +3,61 @@
|
|
|
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
|
+
## [6.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.8...@pie-element/multiple-choice@6.1.9) (2021-12-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [6.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.6...@pie-element/multiple-choice@6.1.7) (2021-12-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [6.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.3...@pie-element/multiple-choice@6.1.4) (2021-11-29)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [6.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.2...@pie-element/multiple-choice@6.1.3) (2021-11-11)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [6.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.1...@pie-element/multiple-choice@6.1.2) (2021-11-01)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [6.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.0...@pie-element/multiple-choice@6.1.1) (2021-10-04)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# [6.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.0.1...@pie-element/multiple-choice@6.1.0) (2021-09-20)
|
|
7
55
|
|
|
8
56
|
|
|
9
57
|
### Bug Fixes
|
|
10
58
|
|
|
11
|
-
* **multiple-choice-print, ecr-print:** fix toggle issue, change options.mode to options.role ([0b3f534](https://github.com/pie-framework/pie-elements/commit/0b3f534bb4d2f969e21528e74516345e84f18d72))
|
|
12
|
-
* pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
|
|
13
|
-
* show tick if available only in evaluate mode ([dddca13](https://github.com/pie-framework/pie-elements/commit/dddca137875221d3b52b17151163610f5eb1ea98))
|
|
14
|
-
* **multiple-choice-print:** remove feedback ([25cbac5](https://github.com/pie-framework/pie-elements/commit/25cbac5647afe8864bedd9c50cd98abe6b31ddb0))
|
|
15
59
|
* exports ([66ed4d2](https://github.com/pie-framework/pie-elements/commit/66ed4d2ae44df712b8b48849023e6849d6d69126))
|
|
16
|
-
*
|
|
60
|
+
* pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
|
|
17
61
|
* Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
|
|
18
62
|
* Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
|
|
19
63
|
|
|
@@ -21,17 +65,26 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
21
65
|
### Features
|
|
22
66
|
|
|
23
67
|
* print demo ([a7f9707](https://github.com/pie-framework/pie-elements/commit/a7f9707592e1ec89a55e9d61450b0600aea4d486))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## [6.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.0.0...@pie-element/multiple-choice@6.0.1) (2021-09-01)
|
|
74
|
+
|
|
75
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# [6.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@5.10.0...@pie-element/multiple-choice@6.0.0) (2021-08-09)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
24
86
|
* **ebsr:** Added choicesLayout support ([33fb7e7](https://github.com/pie-framework/pie-elements/commit/33fb7e765146a7343a58663f3667f4a5de472960))
|
|
25
87
|
* **ebsr:** Added choicesLayout support \n BREAKING CHANGE: removed vertical mode ([348fc00](https://github.com/pie-framework/pie-elements/commit/348fc0031536d458071a1105e742c3d19399a15e))
|
|
26
|
-
* **multiple-choice:** accessibility label - added aria label to checkbox and radio input types ([22514bb](https://github.com/pie-framework/pie-elements/commit/22514bb5e2476bc79a55756ff9a5c0c1e0642a29))
|
|
27
|
-
* **multiple-choice:** added possibility to change layout - vertical, grid, horizontal ([46e7681](https://github.com/pie-framework/pie-elements/commit/46e7681a178ff29c983db1c7b6206389b55e2a00))
|
|
28
|
-
* **multiple-choice:** grid layout - fix tests ([ab3c750](https://github.com/pie-framework/pie-elements/commit/ab3c750af03d9fbe0794f7ec53452c948b530ad8))
|
|
29
|
-
* **multiple-choice:** grid layout - review comments ([540073f](https://github.com/pie-framework/pie-elements/commit/540073faeae2b67645a63e8ca609e7682138c710))
|
|
30
|
-
* **multiple-choice:** toolbar editor position set to bottom ([08ee249](https://github.com/pie-framework/pie-elements/commit/08ee249d45fdaab2c93a32453d757ec3c79215cd))
|
|
31
|
-
* if there are no choices - do not show grid columns dropdown BREAKING CHANGE: removed verticalMode(boolean) from model & configuration - and replaced it with choicesLayout(string) ([1c36ae8](https://github.com/pie-framework/pie-elements/commit/1c36ae8b7f9369b2723a6a84e7350370e1186c50))
|
|
32
|
-
* **multiple-choice:** remove unused class name ([a7aa576](https://github.com/pie-framework/pie-elements/commit/a7aa576a32f5c44415994fe413491f3f3dd17b3f))
|
|
33
|
-
* **multiple-choice:** toolbar position ( bottom or top ) ([9af6cd9](https://github.com/pie-framework/pie-elements/commit/9af6cd9f6b893501e00640500a34e1c3404edc94))
|
|
34
|
-
* **multiple-choice:** update docs ([0843122](https://github.com/pie-framework/pie-elements/commit/084312288b501a7f1129b24a046f9ab19cf25f79))
|
|
35
88
|
|
|
36
89
|
|
|
37
90
|
### BREAKING CHANGES
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,27 +3,66 @@
|
|
|
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
|
+
## [4.0.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.8...@pie-element/multiple-choice-configure@4.0.9) (2021-12-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [4.0.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.6...@pie-element/multiple-choice-configure@4.0.7) (2021-12-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [4.0.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.3...@pie-element/multiple-choice-configure@4.0.4) (2021-11-29)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [4.0.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.2...@pie-element/multiple-choice-configure@4.0.3) (2021-10-04)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [4.0.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.1...@pie-element/multiple-choice-configure@4.0.2) (2021-09-20)
|
|
7
39
|
|
|
8
40
|
|
|
9
41
|
### Bug Fixes
|
|
10
42
|
|
|
11
|
-
* merge conflict ([01655ca](https://github.com/pie-framework/pie-elements/commit/01655caf59311cc1a7a6624a6243147b2819d76e))
|
|
12
43
|
* pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
|
|
13
44
|
* Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
|
|
14
45
|
* Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
|
|
15
46
|
|
|
16
47
|
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [4.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.0...@pie-element/multiple-choice-configure@4.0.1) (2021-09-01)
|
|
52
|
+
|
|
53
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@3.5.0...@pie-element/multiple-choice-configure@4.0.0) (2021-08-09)
|
|
60
|
+
|
|
61
|
+
|
|
17
62
|
### Features
|
|
18
63
|
|
|
19
64
|
* **ebsr:** Added choicesLayout support ([33fb7e7](https://github.com/pie-framework/pie-elements/commit/33fb7e765146a7343a58663f3667f4a5de472960))
|
|
20
65
|
* **ebsr:** Added choicesLayout support \n BREAKING CHANGE: removed vertical mode ([348fc00](https://github.com/pie-framework/pie-elements/commit/348fc0031536d458071a1105e742c3d19399a15e))
|
|
21
|
-
* **multiple-choice:** accessibility label - added aria label to checkbox and radio input types ([22514bb](https://github.com/pie-framework/pie-elements/commit/22514bb5e2476bc79a55756ff9a5c0c1e0642a29))
|
|
22
|
-
* if there are no choices - do not show grid columns dropdown BREAKING CHANGE: removed verticalMode(boolean) from model & configuration - and replaced it with choicesLayout(string) ([1c36ae8](https://github.com/pie-framework/pie-elements/commit/1c36ae8b7f9369b2723a6a84e7350370e1186c50))
|
|
23
|
-
* **multiple-choice:** added possibility to change layout - vertical, grid, horizontal ([46e7681](https://github.com/pie-framework/pie-elements/commit/46e7681a178ff29c983db1c7b6206389b55e2a00))
|
|
24
|
-
* **multiple-choice:** grid layout - fix tests ([ab3c750](https://github.com/pie-framework/pie-elements/commit/ab3c750af03d9fbe0794f7ec53452c948b530ad8))
|
|
25
|
-
* **multiple-choice:** toolbar position ( bottom or top ) ([9af6cd9](https://github.com/pie-framework/pie-elements/commit/9af6cd9f6b893501e00640500a34e1c3404edc94))
|
|
26
|
-
* **multiple-choice:** update docs ([0843122](https://github.com/pie-framework/pie-elements/commit/084312288b501a7f1129b24a046f9ab19cf25f79))
|
|
27
66
|
|
|
28
67
|
|
|
29
68
|
### BREAKING CHANGES
|
|
@@ -21,7 +21,6 @@ var _default = {
|
|
|
21
21
|
feedbackEnabled: true,
|
|
22
22
|
promptEnabled: true,
|
|
23
23
|
rationaleEnabled: true,
|
|
24
|
-
limitChoicesNumber: true,
|
|
25
24
|
teacherInstructionsEnabled: true,
|
|
26
25
|
studentInstructionsEnabled: true,
|
|
27
26
|
toolbarEditorPosition: 'bottom',
|
|
@@ -41,10 +40,6 @@ var _default = {
|
|
|
41
40
|
settings: true,
|
|
42
41
|
label: 'Add a Choice'
|
|
43
42
|
},
|
|
44
|
-
limitChoicesNumber: {
|
|
45
|
-
settings: true,
|
|
46
|
-
label: 'Limit choices to 9'
|
|
47
|
-
},
|
|
48
43
|
choiceMode: {
|
|
49
44
|
settings: true,
|
|
50
45
|
label: 'Response Type'
|
|
@@ -95,7 +90,9 @@ var _default = {
|
|
|
95
90
|
toolbarEditorPosition: {
|
|
96
91
|
settings: false,
|
|
97
92
|
label: 'Toolbar Editor Position'
|
|
98
|
-
}
|
|
93
|
+
},
|
|
94
|
+
minAnswerChoices: 2,
|
|
95
|
+
maxAnswerChoices: 5
|
|
99
96
|
}
|
|
100
97
|
};
|
|
101
98
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","choiceMode","choicePrefix","choices","prompt","lockChoiceOrder","partialScoring","scoringType","feedbackEnabled","promptEnabled","rationaleEnabled","
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","choiceMode","choicePrefix","choices","prompt","lockChoiceOrder","partialScoring","scoringType","feedbackEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","choicesLayout","gridColumns","configuration","settings","label","answerChoiceCount","addChoiceButton","deleteChoice","feedback","rationale","accessibility","studentInstructions","teacherInstructions","minAnswerChoices","maxAnswerChoices"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eACe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,UADP;AAELC,IAAAA,YAAY,EAAE,SAFT;AAGLC,IAAAA,OAAO,EAAE,EAHJ;AAILC,IAAAA,MAAM,EAAE,2BAJH;AAKLC,IAAAA,eAAe,EAAE,IALZ;AAMLC,IAAAA,cAAc,EAAE,IANX;AAOLC,IAAAA,WAAW,EAAE,MAPR;AAQLC,IAAAA,eAAe,EAAE,IARZ;AASLC,IAAAA,aAAa,EAAE,IATV;AAULC,IAAAA,gBAAgB,EAAE,IAVb;AAWLC,IAAAA,0BAA0B,EAAE,IAXvB;AAYLC,IAAAA,0BAA0B,EAAE,IAZvB;AAaLC,IAAAA,qBAAqB,EAAE,QAblB;AAcLC,IAAAA,aAAa,EAAE,UAdV;AAeLC,IAAAA,WAAW,EAAE;AAfR,GADM;AAkBbC,EAAAA,aAAa,EAAE;AACbF,IAAAA,aAAa,EAAE;AACbG,MAAAA,QAAQ,EAAE,KADG;AAEbC,MAAAA,KAAK,EAAE;AAFM,KADF;AAKbH,IAAAA,WAAW,EAAE;AACXG,MAAAA,KAAK,EAAE;AADI,KALA;AAQbC,IAAAA,iBAAiB,EAAE,CARN;AASbC,IAAAA,eAAe,EAAE;AACfH,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KATJ;AAabjB,IAAA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K,EAAE;AAFc,KA5DV;AAgEbS,IAAAA,gBAAgB,EAAE,CAhEL;AAiEbC,IAAAA,gBAAgB,EAAE;AAjEL;AAlBF,C","sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configure\n */\nexport default {\n model: {\n choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n prompt: 'Question Prompt goes here',\n lockChoiceOrder: true,\n partialScoring: true,\n scoringType: 'auto',\n feedbackEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n choicesLayout: 'vertical',\n gridColumns: '2',\n },\n configuration: {\n choicesLayout: {\n settings: false,\n label: 'Choices Layout',\n },\n gridColumns: {\n label: 'Grid columns',\n },\n answerChoiceCount: 0,\n addChoiceButton: {\n settings: true,\n label: 'Add a Choice',\n },\n choiceMode: {\n settings: true,\n label: 'Response Type',\n },\n choicePrefix: {\n settings: true,\n label: 'Choice Labels',\n },\n deleteChoice: {\n settings: true,\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n prompt: {\n settings: true,\n label: 'Prompt',\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n accessibility: {\n settings: false,\n label: 'Accessibility Label'\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\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 minAnswerChoices: 2,\n maxAnswerChoices: 5\n },\n};\n"],"file":"defaults.js"}
|
package/configure/lib/main.js
CHANGED
|
@@ -41,6 +41,12 @@ var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
|
41
41
|
|
|
42
42
|
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
43
43
|
|
|
44
|
+
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
45
|
+
|
|
46
|
+
var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
|
|
47
|
+
|
|
48
|
+
var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
|
|
49
|
+
|
|
44
50
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
45
51
|
|
|
46
52
|
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; } }
|
|
@@ -130,8 +136,6 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
130
136
|
prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
|
|
131
137
|
_ref$addChoiceButton = _ref.addChoiceButton,
|
|
132
138
|
addChoiceButton = _ref$addChoiceButton === void 0 ? {} : _ref$addChoiceButton,
|
|
133
|
-
_ref$limitChoicesNumb = _ref.limitChoicesNumber,
|
|
134
|
-
limitChoicesNumber = _ref$limitChoicesNumb === void 0 ? {} : _ref$limitChoicesNumb,
|
|
135
139
|
_ref$feedback = _ref.feedback,
|
|
136
140
|
feedback = _ref$feedback === void 0 ? {} : _ref$feedback,
|
|
137
141
|
_ref$deleteChoice = _ref.deleteChoice,
|
|
@@ -160,14 +164,17 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
160
164
|
choicesLayout = _ref.choicesLayout,
|
|
161
165
|
gridColumns = _ref.gridColumns;
|
|
162
166
|
|
|
163
|
-
var _ref2 =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
var _ref2 = configuration || {},
|
|
168
|
+
maxAnswerChoices = _ref2.maxAnswerChoices;
|
|
169
|
+
|
|
170
|
+
var _ref3 = model || {},
|
|
171
|
+
limitChoicesNumber = _ref3.limitChoicesNumber,
|
|
172
|
+
teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled,
|
|
173
|
+
rationaleEnabled = _ref3.rationaleEnabled,
|
|
174
|
+
accessibilityLabelsEnabled = _ref3.accessibilityLabelsEnabled,
|
|
175
|
+
feedbackEnabled = _ref3.feedbackEnabled,
|
|
176
|
+
promptEnabled = _ref3.promptEnabled,
|
|
177
|
+
choices = _ref3.choices;
|
|
171
178
|
|
|
172
179
|
var nrOfColumnsAvailable = choices && choices.length ? Array.from({
|
|
173
180
|
length: choices.length
|
|
@@ -192,6 +199,11 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
192
199
|
default:
|
|
193
200
|
toolbarOpts.position = 'bottom';
|
|
194
201
|
break;
|
|
202
|
+
} // if old property is used instead of maxAnswerChoices, set max to 9
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
if (limitChoicesNumber && !maxAnswerChoices) {
|
|
206
|
+
maxAnswerChoices = MAX_CHOICES;
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
var Content = /*#__PURE__*/_react["default"].createElement("div", null, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
@@ -269,13 +281,13 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
269
281
|
pluginProps: labelPlugins
|
|
270
282
|
})));
|
|
271
283
|
}), /*#__PURE__*/_react["default"].createElement("br", null), addChoiceButton.settings && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
272
|
-
title:
|
|
284
|
+
title: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? "Only ".concat(maxAnswerChoices, " allowed maximum") : '',
|
|
273
285
|
classes: {
|
|
274
286
|
tooltip: classes.tooltip
|
|
275
287
|
}
|
|
276
288
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
277
289
|
classes: {
|
|
278
|
-
root:
|
|
290
|
+
root: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? classes.disableButton : undefined
|
|
279
291
|
},
|
|
280
292
|
className: classes.addButton,
|
|
281
293
|
variant: "contained",
|
|
@@ -288,7 +300,6 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
288
300
|
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
289
301
|
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
290
302
|
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
291
|
-
limitChoicesNumber: limitChoicesNumber.settings && toggle(limitChoicesNumber.label),
|
|
292
303
|
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
293
304
|
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
294
305
|
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
@@ -317,6 +328,29 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
317
328
|
}, Content));
|
|
318
329
|
});
|
|
319
330
|
|
|
331
|
+
var InfoDialog = function InfoDialog(_ref4) {
|
|
332
|
+
var open = _ref4.open,
|
|
333
|
+
onCancel = _ref4.onCancel,
|
|
334
|
+
onOk = _ref4.onOk,
|
|
335
|
+
title = _ref4.title;
|
|
336
|
+
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
337
|
+
open: open
|
|
338
|
+
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, title), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, onOk && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
339
|
+
onClick: onOk,
|
|
340
|
+
color: "primary"
|
|
341
|
+
}, "OK"), onCancel && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
342
|
+
onClick: onCancel,
|
|
343
|
+
color: "primary"
|
|
344
|
+
}, "Cancel")));
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
InfoDialog.propTypes = {
|
|
348
|
+
open: _propTypes["default"].bool,
|
|
349
|
+
onCancel: _propTypes["default"].func,
|
|
350
|
+
onOk: _propTypes["default"].func,
|
|
351
|
+
title: _propTypes["default"].string
|
|
352
|
+
};
|
|
353
|
+
|
|
320
354
|
var Main = /*#__PURE__*/function (_React$Component) {
|
|
321
355
|
(0, _inherits2["default"])(Main, _React$Component);
|
|
322
356
|
|
|
@@ -332,16 +366,76 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
332
366
|
}
|
|
333
367
|
|
|
334
368
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
369
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
370
|
+
dialog: {
|
|
371
|
+
open: false
|
|
372
|
+
}
|
|
373
|
+
});
|
|
335
374
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRemoveChoice", function (index) {
|
|
336
|
-
var
|
|
337
|
-
|
|
375
|
+
var _this$props = _this.props,
|
|
376
|
+
model = _this$props.model,
|
|
377
|
+
configuration = _this$props.configuration;
|
|
378
|
+
|
|
379
|
+
var _ref5 = configuration || {},
|
|
380
|
+
minAnswerChoices = _ref5.minAnswerChoices;
|
|
381
|
+
|
|
382
|
+
if (minAnswerChoices && model.choices.length === minAnswerChoices) {
|
|
383
|
+
_this.setState({
|
|
384
|
+
dialog: {
|
|
385
|
+
open: true,
|
|
386
|
+
message: "There can't be less than ".concat(minAnswerChoices, " choices."),
|
|
387
|
+
onOk: function onOk() {
|
|
388
|
+
_this.setState({
|
|
389
|
+
dialog: {
|
|
390
|
+
open: false
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
onCancel: function onCancel() {
|
|
395
|
+
return _this.setState({
|
|
396
|
+
dialog: {
|
|
397
|
+
open: false
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
} else {
|
|
404
|
+
model.choices.splice(index, 1);
|
|
338
405
|
|
|
339
|
-
|
|
406
|
+
_this.props.onModelChanged(model);
|
|
407
|
+
}
|
|
340
408
|
});
|
|
341
409
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddChoice", function () {
|
|
342
|
-
var
|
|
343
|
-
|
|
344
|
-
|
|
410
|
+
var _this$props2 = _this.props,
|
|
411
|
+
model = _this$props2.model,
|
|
412
|
+
configuration = _this$props2.configuration;
|
|
413
|
+
|
|
414
|
+
var _ref6 = configuration || {},
|
|
415
|
+
maxAnswerChoices = _ref6.maxAnswerChoices;
|
|
416
|
+
|
|
417
|
+
if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {
|
|
418
|
+
_this.setState({
|
|
419
|
+
dialog: {
|
|
420
|
+
open: true,
|
|
421
|
+
message: "There can't be more than ".concat(maxAnswerChoices, " choices."),
|
|
422
|
+
onOk: function onOk() {
|
|
423
|
+
_this.setState({
|
|
424
|
+
dialog: {
|
|
425
|
+
open: false
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
},
|
|
429
|
+
onCancel: function onCancel() {
|
|
430
|
+
return _this.setState({
|
|
431
|
+
dialog: {
|
|
432
|
+
open: false
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
} else {
|
|
345
439
|
model.choices.push({
|
|
346
440
|
label: '',
|
|
347
441
|
value: _configUi.choiceUtils.firstAvailableIndex(model.choices.map(function (c) {
|
|
@@ -419,14 +513,20 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
419
513
|
(0, _createClass2["default"])(Main, [{
|
|
420
514
|
key: "render",
|
|
421
515
|
value: function render() {
|
|
422
|
-
|
|
516
|
+
var dialog = this.state.dialog;
|
|
517
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(InfoDialog, {
|
|
518
|
+
open: dialog.open,
|
|
519
|
+
title: dialog.message,
|
|
520
|
+
onCancel: dialog.onCancel,
|
|
521
|
+
onOk: dialog.onOk
|
|
522
|
+
}), /*#__PURE__*/_react["default"].createElement(Design, (0, _extends2["default"])({}, this.props, {
|
|
423
523
|
onChangeModel: this.onModelChanged,
|
|
424
524
|
onRemoveChoice: this.onRemoveChoice,
|
|
425
525
|
onChoiceChanged: this.onChoiceChanged,
|
|
426
526
|
onAddChoice: this.onAddChoice,
|
|
427
527
|
onPromptChanged: this.onPromptChanged,
|
|
428
528
|
onTeacherInstructionsChanged: this.onTeacherInstructionsChanged
|
|
429
|
-
}));
|
|
529
|
+
})));
|
|
430
530
|
}
|
|
431
531
|
}]);
|
|
432
532
|
return Main;
|
|
@@ -435,6 +535,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
435
535
|
exports.Main = Main;
|
|
436
536
|
(0, _defineProperty2["default"])(Main, "propTypes", {
|
|
437
537
|
model: _propTypes["default"].object.isRequired,
|
|
538
|
+
configuration: _propTypes["default"].object.isRequired,
|
|
438
539
|
disableSidePanel: _propTypes["default"].bool,
|
|
439
540
|
onModelChanged: _propTypes["default"].func.isRequired,
|
|
440
541
|
onConfigurationChanged: _propTypes["default"].func.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","MAX_CHOICES","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","rationaleHolder","accessibilityHolder","rationale","accessibility","design","choiceConfigurationHolder","display","flexDirection","alignItems","choiceConfiguration","switchElement","justifyContent","margin","addButton","disableButton","cursor","pointerEvents","backgroundColor","color","disabled","Design","props","classes","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","limitChoicesNumber","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","gridColumns","limitChoicesNumberModel","teacherInstructionsEnabled","rationaleEnabled","accessibilityLabelsEnabled","feedbackEnabled","promptEnabled","choices","nrOfColumnsAvailable","length","Array","from","_","i","labelPlugins","audio","video","toolbarOpts","toolbarEditorPosition","position","Content","label","map","choice","index","c","tooltip","root","undefined","settingsInPanel","Settings","Properties","studentInstructionsEnabled","Main","splice","onModelChanged","push","value","utils","firstAvailableIndex","type","correct","key","correctFound","React","Component","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,KAAR,GAA2CC,kBAA3C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA2CD,kBAA3C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA2CF,kBAA3C,CAAuBE,KAAvB;AAAA,IAA8BC,QAA9B,GAA2CH,kBAA3C,CAA8BG,QAA9B;AAEA,IAAMC,WAAW,GAAG,CAApB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEN,KAAK,CAACI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C,EAAAA,gBAAgB,EAAEH,sBAAUI,IAFX;AAGjBf,EAAAA,cAAc,EAAEW,sBAAUK,IAAV,CAAeH,UAHd;AAIjBhE,EAAAA,sBAAsB,EAAE8D,sBAAUK,IAAV,CAAeH,UAJtB;AAKjBzE,EAAAA,OAAO,EAAEuE,sBAAUC,MAAV,CAAiBC,UALT;AAMjBlE,EAAAA,YAAY,EAAEgE,sBAAUM,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB;AANG,C;AA4GrB,IAAMM,MAAM,GAAG,wBAAW/G,MAAX,EAAmB0F,IAAnB,CAAf;eAEeqB,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport {\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport merge from 'lodash/merge';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n rationaleHolder: {\n width: '70%'\n },\n accessibilityHolder: {\n width: '70%'\n },\n rationale: {\n paddingTop: theme.spacing.unit * 2\n },\n accessibility: {\n paddingTop: theme.spacing.unit * 2\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfigurationHolder: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n choiceConfiguration: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n disableButton: {\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n }\n }\n});\n\nconst Design = withStyles(styles)(props => {\n const {\n classes,\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged\n } = props;\n const {\n prompt = {},\n addChoiceButton = {},\n limitChoicesNumber = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n accessibility = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n gridColumns,\n } = configuration || {};\n const {\n limitChoicesNumber: limitChoicesNumberModel,\n teacherInstructionsEnabled,\n rationaleEnabled,\n accessibilityLabelsEnabled,\n feedbackEnabled,\n promptEnabled,\n choices\n } = model || {};\n\n const nrOfColumnsAvailable = (choices && choices.length)\n ? Array.from({length: choices.length}, (_, i) => (`${i + 1}`))\n : [];\n\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true }\n };\n\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n const Content = (\n <div>\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={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n {model.choices.map((choice, index) => (\n <div\n key={`choice-${index}`}\n className={classes.choiceConfigurationHolder}\n >\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n className={classes.choiceConfiguration}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n onDelete={() => onRemoveChoice(index)}\n onChange={c => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n toolbarOpts={toolbarOpts}\n />\n {rationaleEnabled && (\n <InputContainer\n key={`rationale-${index}`}\n label={rationale.label}\n className={classes.rationaleHolder}\n >\n <EditableHtml\n className={classes.rationale}\n markup={choice.rationale || ''}\n onChange={c =>\n onChoiceChanged(index, {\n ...choice,\n rationale: c\n })\n }\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={labelPlugins}\n />\n </InputContainer>\n )}\n {accessibilityLabelsEnabled && (\n <InputContainer\n key={`accessibility-${index}`}\n label={accessibility.label}\n className={classes.accessibilityHolder}\n >\n <EditableHtml\n className={classes.accessibility}\n markup={choice.accessibility || ''}\n onChange={c =>\n onChoiceChanged(index, {\n ...choice,\n accessibility: c\n })\n }\n imageSupport={imageSupport}\n pluginProps={labelPlugins}\n />\n </InputContainer>\n )}\n </div>\n ))}\n <br />\n {addChoiceButton.settings && (\n <Tooltip title={limitChoicesNumberModel && model.choices.length >= MAX_CHOICES ? `Only ${MAX_CHOICES} allowed maximum` : ''} classes={{ tooltip: classes.tooltip }}>\n <Button\n classes={{ root: limitChoicesNumberModel && model.choices.length >= MAX_CHOICES ? classes.disableButton : undefined }}\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </Button>\n </Tooltip>\n )}\n </div>\n );\n\n const settingsInPanel = {\n choiceMode:\n choiceMode.settings &&\n radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled':\n sequentialChoiceLabels.settings &&\n toggle(sequentialChoiceLabels.label, true),\n choicePrefix:\n choicePrefix.settings &&\n radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n limitChoicesNumber:\n limitChoicesNumber.settings && toggle(limitChoicesNumber.label),\n lockChoiceOrder:\n lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled:\n feedback.settings && toggle(feedback.label),\n choicesLayout:\n choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable)\n };\n\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? (\n Content\n ) : (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: settingsInPanel,\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n accessibilityLabelsEnabled:\n accessibility.settings && toggle(accessibility.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric'])\n }\n }}\n />\n }\n >\n {Content}\n </layout.ConfigLayout>\n )}\n </div>\n );\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n onRemoveChoice = index => {\n const { model } = this.props;\n\n model.choices.splice(index, 1);\n this.props.onModelChanged(model);\n };\n\n onAddChoice = () => {\n const { model } = this.props;\n\n if (!model.limitChoicesNumber || (model.limitChoicesNumber && model.choices.length < MAX_CHOICES)) {\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(model.choices.map(c => c.value), 0),\n feedback: {\n type: 'none'\n }\n });\n\n this.props.onModelChanged(model);\n }\n };\n\n onChoiceChanged = (index, choice) => {\n const { model } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map(c => {\n return merge({}, c, { correct: false });\n });\n }\n\n model.choices.splice(index, 1, choice);\n this.props.onModelChanged(model);\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map(c => {\n if (correctFound) {\n c.correct = false;\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n return c;\n });\n }\n onModelChanged(model, true);\n break;\n }\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n return (\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","MAX_CHOICES","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","rationaleHolder","accessibilityHolder","rationale","accessibility","design","choiceConfigurationHolder","display","flexDirection","alignItems","choiceConfiguration","switchElement","justifyContent","margin","addButton","disableButton","cursor","pointerEvents","backgroundColor","color","disabled","Design","props","classes","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","gridColumns","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","accessibilityLabelsEnabled","feedbackEnabled","promptEnabled","choices","nrOfColumnsAvailable","length","Array","from","_","i","labelPlugins","audio","video","toolbarOpts","toolbarEditorPosition","position","Content","label","map","choice","index","c","tooltip","root","undefined","settingsInPanel","Settings","Properties","studentInstructionsEnabled","InfoDialog","open","onCancel","onOk","title","propTypes","PropTypes","bool","func","string","Main","dialog","minAnswerChoices","setState","message","splice","onModelChanged","push","value","utils","firstAvailableIndex","type","correct","key","correctFound","state","React","Component","object","isRequired","disableSidePanel","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,KAAR,GAA2CC,kBAA3C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA2CD,kBAA3C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA2CF,kBAA3C,CAAuBE,KAAvB;AAAA,IAA8BC,QAA9B,GAA2CH,kBAA3C,CAA8BG,QAA9B;AAEA,IAAMC,WAAW,GAAG,CAApB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK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AAV,CAAiBC,UAFf;AAGjBC,EAAAA,gBAAgB,EAAExB,sBAAUC,IAHX;AAIjBS,EAAAA,cAAc,EAAEV,sBAAUE,IAAV,CAAeqB,UAJd;AAKjB9E,EAAAA,sBAAsB,EAAEuD,sBAAUE,IAAV,CAAeqB,UALtB;AAMjBvF,EAAAA,OAAO,EAAEgE,sBAAUsB,MAAV,CAAiBC,UANT;AAOjBhF,EAAAA,YAAY,EAAEyD,sBAAUyB,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAE1B,sBAAUE,IAAV,CAAeqB,UADQ;AAE5B,cAAQvB,sBAAUE,IAAV,CAAeqB;AAFK,GAAhB;AAPG,C;AA+KrB,IAAMI,MAAM,GAAG,wBAAW3H,MAAX,EAAmBoG,IAAnB,CAAf;eAEeuB,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport {\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport merge from 'lodash/merge';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n rationaleHolder: {\n width: '70%'\n },\n accessibilityHolder: {\n width: '70%'\n },\n rationale: {\n paddingTop: theme.spacing.unit * 2\n },\n accessibility: {\n paddingTop: theme.spacing.unit * 2\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfigurationHolder: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n choiceConfiguration: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n disableButton: {\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n }\n }\n});\n\nconst Design = withStyles(styles)(props => {\n const {\n classes,\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged\n } = props;\n const {\n prompt = {},\n addChoiceButton = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n accessibility = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n gridColumns,\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n accessibilityLabelsEnabled,\n feedbackEnabled,\n promptEnabled,\n choices\n } = model || {};\n\n const nrOfColumnsAvailable = (choices && choices.length)\n ? Array.from({length: choices.length}, (_, i) => (`${i + 1}`))\n : [];\n\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true }\n };\n\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n // if old property is used instead of maxAnswerChoices, set max to 9\n if (limitChoicesNumber && !maxAnswerChoices) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const Content = (\n <div>\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={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n {model.choices.map((choice, index) => (\n <div\n key={`choice-${index}`}\n className={classes.choiceConfigurationHolder}\n >\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n className={classes.choiceConfiguration}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n onDelete={() => onRemoveChoice(index)}\n onChange={c => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n toolbarOpts={toolbarOpts}\n />\n {rationaleEnabled && (\n <InputContainer\n key={`rationale-${index}`}\n label={rationale.label}\n className={classes.rationaleHolder}\n >\n <EditableHtml\n className={classes.rationale}\n markup={choice.rationale || ''}\n onChange={c =>\n onChoiceChanged(index, {\n ...choice,\n rationale: c\n })\n }\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={labelPlugins}\n />\n </InputContainer>\n )}\n {accessibilityLabelsEnabled && (\n <InputContainer\n key={`accessibility-${index}`}\n label={accessibility.label}\n className={classes.accessibilityHolder}\n >\n <EditableHtml\n className={classes.accessibility}\n markup={choice.accessibility || ''}\n onChange={c =>\n onChoiceChanged(index, {\n ...choice,\n accessibility: c\n })\n }\n imageSupport={imageSupport}\n pluginProps={labelPlugins}\n />\n </InputContainer>\n )}\n </div>\n ))}\n <br />\n {addChoiceButton.settings && (\n <Tooltip title={maxAnswerChoices && model.choices.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : ''} classes={{ tooltip: classes.tooltip }}>\n <Button\n classes={{ root: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? classes.disableButton : undefined }}\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </Button>\n </Tooltip>\n )}\n </div>\n );\n\n const settingsInPanel = {\n choiceMode:\n choiceMode.settings &&\n radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled':\n sequentialChoiceLabels.settings &&\n toggle(sequentialChoiceLabels.label, true),\n choicePrefix:\n choicePrefix.settings &&\n radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder:\n lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled:\n feedback.settings && toggle(feedback.label),\n choicesLayout:\n choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable)\n };\n\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? (\n Content\n ) : (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: settingsInPanel,\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n accessibilityLabelsEnabled:\n accessibility.settings && toggle(accessibility.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric'])\n }\n }}\n />\n }\n >\n {Content}\n </layout.ConfigLayout>\n )}\n </div>\n );\n});\n\nconst InfoDialog = ({ open, onCancel, onOk, title }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n {onCancel && (\n <Button onClick={onCancel} color=\"primary\">\n Cancel\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n open: PropTypes.bool,\n onCancel: PropTypes.func,\n onOk: PropTypes.func,\n title: PropTypes.string\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n state = {\n dialog: {\n open: false\n }\n };\n\n onRemoveChoice = index => {\n const { model, configuration } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message:\n `There can't be less than ${minAnswerChoices} choices.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false\n }\n },\n );\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false\n }\n })\n }\n });\n } else {\n model.choices.splice(index, 1);\n this.props.onModelChanged(model);\n }\n };\n\n onAddChoice = () => {\n const { model, configuration } = this.props;\n const { maxAnswerChoices } = configuration || {};\n\n if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message:\n `There can't be more than ${maxAnswerChoices} choices.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false\n }\n },\n );\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false\n }\n })\n }\n });\n } else {\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(model.choices.map(c => c.value), 0),\n feedback: {\n type: 'none'\n }\n });\n\n this.props.onModelChanged(model);\n }\n };\n\n onChoiceChanged = (index, choice) => {\n const { model } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map(c => {\n return merge({}, c, { correct: false });\n });\n }\n\n model.choices.splice(index, 1, choice);\n this.props.onModelChanged(model);\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map(c => {\n if (correctFound) {\n c.correct = false;\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n return c;\n });\n }\n onModelChanged(model, true);\n break;\n }\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { dialog} = this.state;\n\n return (\n <>\n <InfoDialog\n open={dialog.open}\n title={dialog.message}\n onCancel={dialog.onCancel}\n onOk={dialog.onOk}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|
package/configure/package.json
CHANGED
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.5.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.4.1...@pie-element/multiple-choice-controller@3.5.1) (2021-11-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-controller
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.5.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.3.3...@pie-element/multiple-choice-controller@3.5.0) (2021-11-11)
|
|
7
15
|
|
|
8
16
|
|
|
@@ -16,6 +24,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
16
24
|
|
|
17
25
|
|
|
18
26
|
|
|
27
|
+
|
|
28
|
+
## [3.4.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.4.0...@pie-element/multiple-choice-controller@3.4.1) (2021-09-01)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-controller
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
19
36
|
# [3.4.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.3.3...@pie-element/multiple-choice-controller@3.4.0) (2021-08-05)
|
|
20
37
|
|
|
21
38
|
|
package/controller/package.json
CHANGED
package/docs/config-schema.json
CHANGED
|
@@ -271,6 +271,16 @@
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
},
|
|
274
|
+
"minAnswerChoices": {
|
|
275
|
+
"description": "Minimum number of answer choices",
|
|
276
|
+
"type": "number",
|
|
277
|
+
"title": "minAnswerChoices"
|
|
278
|
+
},
|
|
279
|
+
"maxAnswerChoices": {
|
|
280
|
+
"description": "Maximum number of answer choices",
|
|
281
|
+
"type": "number",
|
|
282
|
+
"title": "maxAnswerChoices"
|
|
283
|
+
},
|
|
274
284
|
"showPrompt": {
|
|
275
285
|
"description": "Determines whether prompt field will be displayed or not",
|
|
276
286
|
"default": true,
|
|
@@ -209,6 +209,14 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
209
209
|
|
|
210
210
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
211
211
|
|
|
212
|
+
# `minAnswerChoices` (number)
|
|
213
|
+
|
|
214
|
+
Minimum number of answer choices
|
|
215
|
+
|
|
216
|
+
# `maxAnswerChoices` (number)
|
|
217
|
+
|
|
218
|
+
Maximum number of answer choices
|
|
219
|
+
|
|
212
220
|
# `showPrompt` (boolean)
|
|
213
221
|
|
|
214
222
|
Determines whether prompt field will be displayed or not
|
package/module/configure.js
CHANGED
|
@@ -52,6 +52,9 @@ const {color: color} = _dll_pie_lib__render_ui;
|
|
|
52
52
|
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
53
53
|
const {Button: Button} = _dll_material_ui__core;
|
|
54
54
|
const {Tooltip: Tooltip} = _dll_material_ui__core;
|
|
55
|
+
const {Dialog: Dialog} = _dll_material_ui__core;
|
|
56
|
+
const {DialogTitle: DialogTitle} = _dll_material_ui__core;
|
|
57
|
+
const {DialogActions: DialogActions} = _dll_material_ui__core;
|
|
55
58
|
const {merge: merge} = _dll_lodash;
|
|
56
59
|
const EditableHtml = _dll_pie_lib__editable_html;
|
|
57
60
|
const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
|
|
@@ -118,8 +121,9 @@ const styles = theme => ({
|
|
|
118
121
|
});
|
|
119
122
|
const Design = withStyles(styles)(props => {
|
|
120
123
|
const {classes, model, configuration, onPromptChanged, onChoiceChanged, onRemoveChoice, onAddChoice, imageSupport, onChangeModel, onConfigurationChanged, onTeacherInstructionsChanged} = props;
|
|
121
|
-
const {prompt = {}, addChoiceButton = {},
|
|
122
|
-
|
|
124
|
+
const {prompt = {}, addChoiceButton = {}, feedback = {}, deleteChoice = {}, choiceMode = {}, choicePrefix = {}, partialScoring = {}, lockChoiceOrder = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, accessibility = {}, scoringType = {}, sequentialChoiceLabels = {}, settingsPanelDisabled, choicesLayout, gridColumns} = configuration || ({});
|
|
125
|
+
let {maxAnswerChoices} = configuration || ({});
|
|
126
|
+
const {limitChoicesNumber, teacherInstructionsEnabled, rationaleEnabled, accessibilityLabelsEnabled, feedbackEnabled, promptEnabled, choices} = model || ({});
|
|
123
127
|
const nrOfColumnsAvailable = choices && choices.length ? Array.from({
|
|
124
128
|
length: choices.length
|
|
125
129
|
}, (_, i) => `${i + 1}`) : [];
|
|
@@ -140,11 +144,14 @@ const Design = withStyles(styles)(props => {
|
|
|
140
144
|
toolbarOpts.position = 'bottom';
|
|
141
145
|
break;
|
|
142
146
|
}
|
|
147
|
+
if (limitChoicesNumber && !maxAnswerChoices) {
|
|
148
|
+
maxAnswerChoices = MAX_CHOICES;
|
|
149
|
+
}
|
|
143
150
|
const Content = React$1.createElement('div', {
|
|
144
151
|
__self: undefined,
|
|
145
152
|
__source: {
|
|
146
153
|
fileName: _jsxFileName,
|
|
147
|
-
lineNumber:
|
|
154
|
+
lineNumber: 149
|
|
148
155
|
}
|
|
149
156
|
}, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
|
|
150
157
|
label: teacherInstructions.label,
|
|
@@ -152,7 +159,7 @@ const Design = withStyles(styles)(props => {
|
|
|
152
159
|
__self: undefined,
|
|
153
160
|
__source: {
|
|
154
161
|
fileName: _jsxFileName,
|
|
155
|
-
lineNumber:
|
|
162
|
+
lineNumber: 151
|
|
156
163
|
}
|
|
157
164
|
}, React$1.createElement(EditableHtml, {
|
|
158
165
|
className: classes.prompt,
|
|
@@ -164,7 +171,7 @@ const Design = withStyles(styles)(props => {
|
|
|
164
171
|
__self: undefined,
|
|
165
172
|
__source: {
|
|
166
173
|
fileName: _jsxFileName,
|
|
167
|
-
lineNumber:
|
|
174
|
+
lineNumber: 155
|
|
168
175
|
}
|
|
169
176
|
})), promptEnabled && React$1.createElement(InputContainer, {
|
|
170
177
|
label: prompt.label,
|
|
@@ -172,7 +179,7 @@ const Design = withStyles(styles)(props => {
|
|
|
172
179
|
__self: undefined,
|
|
173
180
|
__source: {
|
|
174
181
|
fileName: _jsxFileName,
|
|
175
|
-
lineNumber:
|
|
182
|
+
lineNumber: 167
|
|
176
183
|
}
|
|
177
184
|
}, React$1.createElement(EditableHtml, {
|
|
178
185
|
className: classes.prompt,
|
|
@@ -185,7 +192,7 @@ const Design = withStyles(styles)(props => {
|
|
|
185
192
|
__self: undefined,
|
|
186
193
|
__source: {
|
|
187
194
|
fileName: _jsxFileName,
|
|
188
|
-
lineNumber:
|
|
195
|
+
lineNumber: 168
|
|
189
196
|
}
|
|
190
197
|
})), model.choices.map((choice, index) => React$1.createElement('div', {
|
|
191
198
|
key: `choice-${index}`,
|
|
@@ -193,7 +200,7 @@ const Design = withStyles(styles)(props => {
|
|
|
193
200
|
__self: undefined,
|
|
194
201
|
__source: {
|
|
195
202
|
fileName: _jsxFileName,
|
|
196
|
-
lineNumber:
|
|
203
|
+
lineNumber: 180
|
|
197
204
|
}
|
|
198
205
|
}, React$1.createElement(ChoiceConfiguration, {
|
|
199
206
|
key: index,
|
|
@@ -213,7 +220,7 @@ const Design = withStyles(styles)(props => {
|
|
|
213
220
|
__self: undefined,
|
|
214
221
|
__source: {
|
|
215
222
|
fileName: _jsxFileName,
|
|
216
|
-
lineNumber:
|
|
223
|
+
lineNumber: 184
|
|
217
224
|
}
|
|
218
225
|
}), rationaleEnabled && React$1.createElement(InputContainer, {
|
|
219
226
|
key: `rationale-${index}`,
|
|
@@ -222,7 +229,7 @@ const Design = withStyles(styles)(props => {
|
|
|
222
229
|
__self: undefined,
|
|
223
230
|
__source: {
|
|
224
231
|
fileName: _jsxFileName,
|
|
225
|
-
lineNumber:
|
|
232
|
+
lineNumber: 201
|
|
226
233
|
}
|
|
227
234
|
}, React$1.createElement(EditableHtml, {
|
|
228
235
|
className: classes.rationale,
|
|
@@ -237,7 +244,7 @@ const Design = withStyles(styles)(props => {
|
|
|
237
244
|
__self: undefined,
|
|
238
245
|
__source: {
|
|
239
246
|
fileName: _jsxFileName,
|
|
240
|
-
lineNumber:
|
|
247
|
+
lineNumber: 206
|
|
241
248
|
}
|
|
242
249
|
})), accessibilityLabelsEnabled && React$1.createElement(InputContainer, {
|
|
243
250
|
key: `accessibility-${index}`,
|
|
@@ -246,7 +253,7 @@ const Design = withStyles(styles)(props => {
|
|
|
246
253
|
__self: undefined,
|
|
247
254
|
__source: {
|
|
248
255
|
fileName: _jsxFileName,
|
|
249
|
-
lineNumber:
|
|
256
|
+
lineNumber: 222
|
|
250
257
|
}
|
|
251
258
|
}, React$1.createElement(EditableHtml, {
|
|
252
259
|
className: classes.accessibility,
|
|
@@ -260,27 +267,27 @@ const Design = withStyles(styles)(props => {
|
|
|
260
267
|
__self: undefined,
|
|
261
268
|
__source: {
|
|
262
269
|
fileName: _jsxFileName,
|
|
263
|
-
lineNumber:
|
|
270
|
+
lineNumber: 227
|
|
264
271
|
}
|
|
265
272
|
})))), React$1.createElement('br', {
|
|
266
273
|
__self: undefined,
|
|
267
274
|
__source: {
|
|
268
275
|
fileName: _jsxFileName,
|
|
269
|
-
lineNumber:
|
|
276
|
+
lineNumber: 243
|
|
270
277
|
}
|
|
271
278
|
}), addChoiceButton.settings && React$1.createElement(Tooltip, {
|
|
272
|
-
title:
|
|
279
|
+
title: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '',
|
|
273
280
|
classes: {
|
|
274
281
|
tooltip: classes.tooltip
|
|
275
282
|
},
|
|
276
283
|
__self: undefined,
|
|
277
284
|
__source: {
|
|
278
285
|
fileName: _jsxFileName,
|
|
279
|
-
lineNumber:
|
|
286
|
+
lineNumber: 245
|
|
280
287
|
}
|
|
281
288
|
}, React$1.createElement(Button, {
|
|
282
289
|
classes: {
|
|
283
|
-
root:
|
|
290
|
+
root: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? classes.disableButton : undefined
|
|
284
291
|
},
|
|
285
292
|
className: classes.addButton,
|
|
286
293
|
variant: "contained",
|
|
@@ -289,7 +296,7 @@ const Design = withStyles(styles)(props => {
|
|
|
289
296
|
__self: undefined,
|
|
290
297
|
__source: {
|
|
291
298
|
fileName: _jsxFileName,
|
|
292
|
-
lineNumber:
|
|
299
|
+
lineNumber: 246
|
|
293
300
|
}
|
|
294
301
|
}, addChoiceButton.label)));
|
|
295
302
|
const settingsInPanel = {
|
|
@@ -297,7 +304,6 @@ const Design = withStyles(styles)(props => {
|
|
|
297
304
|
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
298
305
|
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
299
306
|
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
300
|
-
limitChoicesNumber: limitChoicesNumber.settings && toggle(limitChoicesNumber.label),
|
|
301
307
|
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
302
308
|
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
303
309
|
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
@@ -308,7 +314,7 @@ const Design = withStyles(styles)(props => {
|
|
|
308
314
|
__self: undefined,
|
|
309
315
|
__source: {
|
|
310
316
|
fileName: _jsxFileName,
|
|
311
|
-
lineNumber:
|
|
317
|
+
lineNumber: 284
|
|
312
318
|
}
|
|
313
319
|
}, settingsPanelDisabled ? Content : React$1.createElement(layout.ConfigLayout, {
|
|
314
320
|
settings: React$1.createElement(Panel, {
|
|
@@ -330,16 +336,58 @@ const Design = withStyles(styles)(props => {
|
|
|
330
336
|
__self: undefined,
|
|
331
337
|
__source: {
|
|
332
338
|
fileName: _jsxFileName,
|
|
333
|
-
lineNumber:
|
|
339
|
+
lineNumber: 290
|
|
334
340
|
}
|
|
335
341
|
}),
|
|
336
342
|
__self: undefined,
|
|
337
343
|
__source: {
|
|
338
344
|
fileName: _jsxFileName,
|
|
339
|
-
lineNumber:
|
|
345
|
+
lineNumber: 288
|
|
340
346
|
}
|
|
341
347
|
}, Content));
|
|
342
348
|
});
|
|
349
|
+
const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dialog, {
|
|
350
|
+
open: open,
|
|
351
|
+
__self: undefined,
|
|
352
|
+
__source: {
|
|
353
|
+
fileName: _jsxFileName,
|
|
354
|
+
lineNumber: 325
|
|
355
|
+
}
|
|
356
|
+
}, React$1.createElement(DialogTitle, {
|
|
357
|
+
__self: undefined,
|
|
358
|
+
__source: {
|
|
359
|
+
fileName: _jsxFileName,
|
|
360
|
+
lineNumber: 326
|
|
361
|
+
}
|
|
362
|
+
}, title), React$1.createElement(DialogActions, {
|
|
363
|
+
__self: undefined,
|
|
364
|
+
__source: {
|
|
365
|
+
fileName: _jsxFileName,
|
|
366
|
+
lineNumber: 327
|
|
367
|
+
}
|
|
368
|
+
}, onOk && React$1.createElement(Button, {
|
|
369
|
+
onClick: onOk,
|
|
370
|
+
color: "primary",
|
|
371
|
+
__self: undefined,
|
|
372
|
+
__source: {
|
|
373
|
+
fileName: _jsxFileName,
|
|
374
|
+
lineNumber: 329
|
|
375
|
+
}
|
|
376
|
+
}, "OK"), onCancel && React$1.createElement(Button, {
|
|
377
|
+
onClick: onCancel,
|
|
378
|
+
color: "primary",
|
|
379
|
+
__self: undefined,
|
|
380
|
+
__source: {
|
|
381
|
+
fileName: _jsxFileName,
|
|
382
|
+
lineNumber: 334
|
|
383
|
+
}
|
|
384
|
+
}, "Cancel")));
|
|
385
|
+
InfoDialog.propTypes = {
|
|
386
|
+
open: PropTypes.bool,
|
|
387
|
+
onCancel: PropTypes.func,
|
|
388
|
+
onOk: PropTypes.func,
|
|
389
|
+
title: PropTypes.string
|
|
390
|
+
};
|
|
343
391
|
class Main extends React$1.Component {
|
|
344
392
|
constructor(...args) {
|
|
345
393
|
super(...args);
|
|
@@ -349,10 +397,12 @@ class Main extends React$1.Component {
|
|
|
349
397
|
Main.prototype.__init4.call(this);
|
|
350
398
|
Main.prototype.__init5.call(this);
|
|
351
399
|
Main.prototype.__init6.call(this);
|
|
400
|
+
Main.prototype.__init7.call(this);
|
|
352
401
|
}
|
|
353
402
|
static __initStatic() {
|
|
354
403
|
this.propTypes = {
|
|
355
404
|
model: PropTypes.object.isRequired,
|
|
405
|
+
configuration: PropTypes.object.isRequired,
|
|
356
406
|
disableSidePanel: PropTypes.bool,
|
|
357
407
|
onModelChanged: PropTypes.func.isRequired,
|
|
358
408
|
onConfigurationChanged: PropTypes.func.isRequired,
|
|
@@ -364,16 +414,65 @@ class Main extends React$1.Component {
|
|
|
364
414
|
};
|
|
365
415
|
}
|
|
366
416
|
__init() {
|
|
367
|
-
this.
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
417
|
+
this.state = {
|
|
418
|
+
dialog: {
|
|
419
|
+
open: false
|
|
420
|
+
}
|
|
371
421
|
};
|
|
372
422
|
}
|
|
373
423
|
__init2() {
|
|
424
|
+
this.onRemoveChoice = index => {
|
|
425
|
+
const {model, configuration} = this.props;
|
|
426
|
+
const {minAnswerChoices} = configuration || ({});
|
|
427
|
+
if (minAnswerChoices && model.choices.length === minAnswerChoices) {
|
|
428
|
+
this.setState({
|
|
429
|
+
dialog: {
|
|
430
|
+
open: true,
|
|
431
|
+
message: `There can't be less than ${minAnswerChoices} choices.`,
|
|
432
|
+
onOk: () => {
|
|
433
|
+
this.setState({
|
|
434
|
+
dialog: {
|
|
435
|
+
open: false
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
},
|
|
439
|
+
onCancel: () => this.setState({
|
|
440
|
+
dialog: {
|
|
441
|
+
open: false
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
} else {
|
|
447
|
+
model.choices.splice(index, 1);
|
|
448
|
+
this.props.onModelChanged(model);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
__init3() {
|
|
374
453
|
this.onAddChoice = () => {
|
|
375
|
-
const {model} = this.props;
|
|
376
|
-
|
|
454
|
+
const {model, configuration} = this.props;
|
|
455
|
+
const {maxAnswerChoices} = configuration || ({});
|
|
456
|
+
if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {
|
|
457
|
+
this.setState({
|
|
458
|
+
dialog: {
|
|
459
|
+
open: true,
|
|
460
|
+
message: `There can't be more than ${maxAnswerChoices} choices.`,
|
|
461
|
+
onOk: () => {
|
|
462
|
+
this.setState({
|
|
463
|
+
dialog: {
|
|
464
|
+
open: false
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
},
|
|
468
|
+
onCancel: () => this.setState({
|
|
469
|
+
dialog: {
|
|
470
|
+
open: false
|
|
471
|
+
}
|
|
472
|
+
})
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
} else {
|
|
377
476
|
model.choices.push({
|
|
378
477
|
label: '',
|
|
379
478
|
value: utils$1.firstAvailableIndex(model.choices.map(c => c.value), 0),
|
|
@@ -385,7 +484,7 @@ class Main extends React$1.Component {
|
|
|
385
484
|
}
|
|
386
485
|
};
|
|
387
486
|
}
|
|
388
|
-
|
|
487
|
+
__init4() {
|
|
389
488
|
this.onChoiceChanged = (index, choice) => {
|
|
390
489
|
const {model} = this.props;
|
|
391
490
|
if (choice.correct && model.choiceMode === 'radio') {
|
|
@@ -399,7 +498,7 @@ class Main extends React$1.Component {
|
|
|
399
498
|
this.props.onModelChanged(model);
|
|
400
499
|
};
|
|
401
500
|
}
|
|
402
|
-
|
|
501
|
+
__init5() {
|
|
403
502
|
this.onPromptChanged = prompt => {
|
|
404
503
|
this.props.onModelChanged({
|
|
405
504
|
...this.props.model,
|
|
@@ -407,7 +506,7 @@ class Main extends React$1.Component {
|
|
|
407
506
|
});
|
|
408
507
|
};
|
|
409
508
|
}
|
|
410
|
-
|
|
509
|
+
__init6() {
|
|
411
510
|
this.onTeacherInstructionsChanged = teacherInstructions => {
|
|
412
511
|
this.props.onModelChanged({
|
|
413
512
|
...this.props.model,
|
|
@@ -415,7 +514,7 @@ class Main extends React$1.Component {
|
|
|
415
514
|
});
|
|
416
515
|
};
|
|
417
516
|
}
|
|
418
|
-
|
|
517
|
+
__init7() {
|
|
419
518
|
this.onModelChanged = (model, key) => {
|
|
420
519
|
const {onModelChanged} = this.props;
|
|
421
520
|
switch (key) {
|
|
@@ -445,7 +544,18 @@ class Main extends React$1.Component {
|
|
|
445
544
|
};
|
|
446
545
|
}
|
|
447
546
|
render() {
|
|
448
|
-
|
|
547
|
+
const {dialog} = this.state;
|
|
548
|
+
return React$1.createElement(React$1.Fragment, null, React$1.createElement(InfoDialog, {
|
|
549
|
+
open: dialog.open,
|
|
550
|
+
title: dialog.message,
|
|
551
|
+
onCancel: dialog.onCancel,
|
|
552
|
+
onOk: dialog.onOk,
|
|
553
|
+
__self: this,
|
|
554
|
+
__source: {
|
|
555
|
+
fileName: _jsxFileName,
|
|
556
|
+
lineNumber: 505
|
|
557
|
+
}
|
|
558
|
+
}), React$1.createElement(Design, {
|
|
449
559
|
...this.props,
|
|
450
560
|
onChangeModel: this.onModelChanged,
|
|
451
561
|
onRemoveChoice: this.onRemoveChoice,
|
|
@@ -456,9 +566,9 @@ class Main extends React$1.Component {
|
|
|
456
566
|
__self: this,
|
|
457
567
|
__source: {
|
|
458
568
|
fileName: _jsxFileName,
|
|
459
|
-
lineNumber:
|
|
569
|
+
lineNumber: 511
|
|
460
570
|
}
|
|
461
|
-
});
|
|
571
|
+
}));
|
|
462
572
|
}
|
|
463
573
|
}
|
|
464
574
|
Main.__initStatic();
|
|
@@ -475,7 +585,6 @@ var sensibleDefaults = {
|
|
|
475
585
|
feedbackEnabled: true,
|
|
476
586
|
promptEnabled: true,
|
|
477
587
|
rationaleEnabled: true,
|
|
478
|
-
limitChoicesNumber: true,
|
|
479
588
|
teacherInstructionsEnabled: true,
|
|
480
589
|
studentInstructionsEnabled: true,
|
|
481
590
|
toolbarEditorPosition: 'bottom',
|
|
@@ -495,10 +604,6 @@ var sensibleDefaults = {
|
|
|
495
604
|
settings: true,
|
|
496
605
|
label: 'Add a Choice'
|
|
497
606
|
},
|
|
498
|
-
limitChoicesNumber: {
|
|
499
|
-
settings: true,
|
|
500
|
-
label: 'Limit choices to 9'
|
|
501
|
-
},
|
|
502
607
|
choiceMode: {
|
|
503
608
|
settings: true,
|
|
504
609
|
label: 'Response Type'
|
|
@@ -549,7 +654,9 @@ var sensibleDefaults = {
|
|
|
549
654
|
toolbarEditorPosition: {
|
|
550
655
|
settings: false,
|
|
551
656
|
label: 'Toolbar Editor Position'
|
|
552
|
-
}
|
|
657
|
+
},
|
|
658
|
+
minAnswerChoices: 2,
|
|
659
|
+
maxAnswerChoices: 5
|
|
553
660
|
}
|
|
554
661
|
};
|
|
555
662
|
const React = _dll_react;
|
package/module/index.html
CHANGED
package/module/manifest.json
CHANGED
package/module/print.html
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "5.9.3-next.
|
|
4
|
+
"version": "5.9.3-next.510+0c1268378",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"react-test-renderer": "^16.3.2",
|
|
22
22
|
"react-transition-group": "^2.3.1"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "0c1268378bd302cb3f67636b752e9cd5d8495b34",
|
|
25
25
|
"scripts": {
|
|
26
26
|
"postpublish": "../../scripts/postpublish"
|
|
27
27
|
},
|