@pie-lib/rubric 0.3.6-next.6 → 0.3.7-next.110
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.json +15 -0
- package/CHANGELOG.md +12 -105
- package/lib/authoring.js +3 -3
- package/lib/authoring.js.map +1 -1
- package/package.json +3 -3
- package/src/authoring.jsx +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -388,5 +388,20 @@
|
|
|
388
388
|
"committerDate": "2021-04-09 17:15:38 +0300",
|
|
389
389
|
"isTagged": true,
|
|
390
390
|
"tag": "@pie-lib/rubric@0.3.0"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"type": "feat",
|
|
394
|
+
"scope": "rubric",
|
|
395
|
+
"subject": "Added Studio support: Treat 'null' as null value for sample answer PD-1313",
|
|
396
|
+
"merge": null,
|
|
397
|
+
"header": "feat(rubric): Added Studio support: Treat 'null' as null value for sample answer PD-1313",
|
|
398
|
+
"body": null,
|
|
399
|
+
"footer": null,
|
|
400
|
+
"notes": [],
|
|
401
|
+
"hash": "ce71c81a6cbd26ec104e7cb34fcda1f1d65a8bd2",
|
|
402
|
+
"gitTags": " (origin/fix/PD-1313)",
|
|
403
|
+
"committerDate": "2021-09-23 13:48:01 +0300",
|
|
404
|
+
"isTagged": true,
|
|
405
|
+
"tag": "@pie-lib/rubric@0.4.0"
|
|
391
406
|
}
|
|
392
407
|
]
|
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [0.3.
|
|
6
|
+
## [0.3.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.3.5...@pie-lib/rubric@0.3.6) (2021-08-30)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
## [0.3.
|
|
14
|
+
## [0.3.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.3.4...@pie-lib/rubric@0.3.5) (2021-08-04)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
## [0.3.
|
|
22
|
+
## [0.3.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.3.3...@pie-lib/rubric@0.3.4) (2021-07-27)
|
|
23
23
|
|
|
24
24
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
25
25
|
|
|
@@ -27,206 +27,113 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
## [0.3.
|
|
30
|
+
## [0.3.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.3.2...@pie-lib/rubric@0.3.3) (2021-07-23)
|
|
31
31
|
|
|
32
32
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
33
33
|
|
|
34
|
+
## [0.3.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.3.0...@pie-lib/rubric@0.3.2) (2021-06-25)
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
**Note:** Version bump only for package @pie-lib/rubric
|
|
37
37
|
|
|
38
38
|
# [0.3.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.110...@pie-lib/rubric@0.3.0) (2021-06-25)
|
|
39
39
|
|
|
40
|
-
|
|
41
40
|
### Features
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
- **rubric:** Add sample answers support ([5f0e337](https://github.com/pie-framework/pie-lib/commit/5f0e337))
|
|
43
|
+
- **rubric:** Added sanity checks ([f40fac6](https://github.com/pie-framework/pie-lib/commit/f40fac6))
|
|
44
|
+
- **rubric:** Added tests ([7d7a2bc](https://github.com/pie-framework/pie-lib/commit/7d7a2bc))
|
|
45
|
+
- **rubric:** Changed logic for displaying the sample answer ([4d5245c](https://github.com/pie-framework/pie-lib/commit/4d5245c))
|
|
46
|
+
- **rubric:** Refactoring ([81bcd07](https://github.com/pie-framework/pie-lib/commit/81bcd07))
|
|
47
|
+
- **rubric:** Removed 'use default text' tests ([37c18a7](https://github.com/pie-framework/pie-lib/commit/37c18a7))
|
|
53
48
|
|
|
54
49
|
## [0.2.110](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.109...@pie-lib/rubric@0.2.110) (2021-04-06)
|
|
55
50
|
|
|
56
51
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
53
|
## [0.2.109](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.108...@pie-lib/rubric@0.2.109) (2021-04-02)
|
|
63
54
|
|
|
64
55
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
65
56
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
57
|
## [0.2.108](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.107...@pie-lib/rubric@0.2.108) (2021-03-22)
|
|
71
58
|
|
|
72
59
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
73
60
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
61
|
## [0.2.107](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.106...@pie-lib/rubric@0.2.107) (2021-03-15)
|
|
79
62
|
|
|
80
63
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
81
64
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
65
|
## [0.2.106](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.105...@pie-lib/rubric@0.2.106) (2021-03-03)
|
|
87
66
|
|
|
88
67
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
89
68
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
69
|
## [0.2.105](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.104...@pie-lib/rubric@0.2.105) (2021-03-02)
|
|
95
70
|
|
|
96
71
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
97
72
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
73
|
## [0.2.104](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.103...@pie-lib/rubric@0.2.104) (2021-03-01)
|
|
103
74
|
|
|
104
75
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
105
76
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
77
|
## [0.2.103](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.102...@pie-lib/rubric@0.2.103) (2021-03-01)
|
|
111
78
|
|
|
112
79
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
113
80
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
81
|
## [0.2.102](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.101...@pie-lib/rubric@0.2.102) (2021-02-15)
|
|
119
82
|
|
|
120
83
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
121
84
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
85
|
## [0.2.101](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.99...@pie-lib/rubric@0.2.101) (2021-02-15)
|
|
127
86
|
|
|
128
87
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
129
88
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
89
|
## [0.2.99](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.98...@pie-lib/rubric@0.2.99) (2021-02-15)
|
|
135
90
|
|
|
136
91
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
137
92
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
93
|
## [0.2.98](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.97...@pie-lib/rubric@0.2.98) (2021-02-04)
|
|
143
94
|
|
|
144
95
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
145
96
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
97
|
## [0.2.97](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.96...@pie-lib/rubric@0.2.97) (2021-02-01)
|
|
151
98
|
|
|
152
99
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
153
100
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
101
|
## [0.2.96](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.95...@pie-lib/rubric@0.2.96) (2021-01-28)
|
|
159
102
|
|
|
160
103
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
161
104
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
105
|
## [0.2.95](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.94...@pie-lib/rubric@0.2.95) (2021-01-28)
|
|
167
106
|
|
|
168
107
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
169
108
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
109
|
## [0.2.94](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.93...@pie-lib/rubric@0.2.94) (2021-01-25)
|
|
175
110
|
|
|
176
111
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
177
112
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
113
|
## [0.2.93](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.92...@pie-lib/rubric@0.2.93) (2021-01-11)
|
|
183
114
|
|
|
184
115
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
185
116
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
117
|
## [0.2.92](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.91...@pie-lib/rubric@0.2.92) (2020-11-09)
|
|
191
118
|
|
|
192
119
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
193
120
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
121
|
## [0.2.91](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.90...@pie-lib/rubric@0.2.91) (2020-11-07)
|
|
199
122
|
|
|
200
123
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
201
124
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
125
|
## [0.2.90](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.89...@pie-lib/rubric@0.2.90) (2020-10-30)
|
|
207
126
|
|
|
208
127
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
209
128
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
129
|
## [0.2.89](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.88...@pie-lib/rubric@0.2.89) (2020-10-28)
|
|
215
130
|
|
|
216
131
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
217
132
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
133
|
## [0.2.88](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.87...@pie-lib/rubric@0.2.88) (2020-10-26)
|
|
223
134
|
|
|
224
135
|
**Note:** Version bump only for package @pie-lib/rubric
|
|
225
136
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
137
|
## [0.2.87](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.2.86...@pie-lib/rubric@0.2.87) (2020-10-26)
|
|
231
138
|
|
|
232
139
|
**Note:** Version bump only for package @pie-lib/rubric
|
package/lib/authoring.js
CHANGED
|
@@ -137,11 +137,11 @@ var MaxPoints = (0, _styles.withStyles)(function (theme) {
|
|
|
137
137
|
value: v
|
|
138
138
|
}, v);
|
|
139
139
|
})));
|
|
140
|
-
}); // if the value is null, the Sample Answer input field for that point will not be dispalyed
|
|
140
|
+
}); // if the value is null or 'null', the Sample Answer input field for that point will not be dispalyed
|
|
141
141
|
// if the value is '', the Sample Answer input field will be empty
|
|
142
142
|
|
|
143
143
|
var checkSampleAnswer = function checkSampleAnswer(sampleAnswer) {
|
|
144
|
-
return sampleAnswer === null;
|
|
144
|
+
return sampleAnswer === null || sampleAnswer === 'null';
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
var PointConfig = (0, _styles.withStyles)(function (theme) {
|
|
@@ -326,7 +326,7 @@ function (_React$Component) {
|
|
|
326
326
|
// an empty string will display an empty Sample Answer input field
|
|
327
327
|
_this.changeContent(index, '', 'sampleAnswers');
|
|
328
328
|
} else {
|
|
329
|
-
// when the content is null, the Sample Answer input field will not be displayed
|
|
329
|
+
// when the content is null or 'null', the Sample Answer input field will not be displayed
|
|
330
330
|
_this.changeContent(index, null, 'sampleAnswers');
|
|
331
331
|
}
|
|
332
332
|
}
|
package/lib/authoring.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/authoring.jsx"],"names":["log","reorder","list","startIndex","endIndex","result","Array","from","splice","removed","RubricType","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","MaxPoints","theme","formControl","minWidth","margin","spacing","unit","props","value","onChange","max","classes","e","target","map","v","checkSampleAnswer","sampleAnswer","PointConfig","pointConfig","row","display","width","position","editor","backgroundColor","dragIndicator","paddingTop","color","grey","pointsLabel","paddingBottom","textTransform","sampleAnswersEditor","paddingLeft","pointMenu","right","content","showSampleAnswer","icon","onMenuChange","onSampleChange","RawAuthoring","destination","source","index","maxPoints","currentMax","length","concat","type","items","clickedItem","changeContent","className","Number","isFinite","console","warn","rubricTitle","changeMaxPoints","excludeZeros","container","dragEnd","provided","droppableProps","innerRef","p","shouldRenderPoint","toString","configHolder","draggableProps","dragHandleProps","onPointMenuChange","placeholder","React","Component","object","isRequired","func","styles","borderWidth","borderStyle","borderColor","padding","StyledRawAuthoring","Reverse","reverse","propTypes","getIndex"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAMA,GAAG,GAAG,uBAAM,0BAAN,CAAZ;;AAEA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAmBC,QAAnB,EAAgC;AAC9C,MAAMC,MAAM,GAAGC,KAAK,CAACC,IAAN,CAAWL,IAAX,CAAf;;AAD8C,uBAE5BG,MAAM,CAACG,MAAP,CAAcL,UAAd,EAA0B,CAA1B,CAF4B;AAAA;AAAA,MAEvCM,OAFuC;;AAI9CJ,EAAAA,MAAM,CAACG,MAAP,CAAcJ,QAAd,EAAwB,CAAxB,EAA2BK,OAA3B;AAEA,SAAOJ,MAAP;AACD,CAPD;;AASO,IAAMK,UAAU,GAAGC,sBAAUC,KAAV,CAAgB;AACxCC,EAAAA,WAAW,EAA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AAbA;AAA7B,IAAX;;AAEA,MAAMU,QAAQ,GAAG,SAAXA,QAAW,CAAAD,KAAK,EAAI;AACxBD,IAAAA,KAAK,CAACE,QAAN,mBACKD,KADL;AAEEZ,MAAAA,MAAM,EAAET,KAAK,CAACC,IAAN,CAAWoB,KAAK,CAACZ,MAAN,IAAgB,EAA3B,EAA+B2F,OAA/B,EAFV;AAGExF,MAAAA,aAAa,EAAEZ,KAAK,CAACC,IAAN,CAAWoB,KAAK,CAACT,aAAN,IAAuB,EAAlC,EAAsCwF,OAAtC;AAHjB;AAKD,GAND;;AAQA,SAAO,gCAAC,kBAAD;AAAoB,IAAA,KAAK,EAAE/E,KAA3B;AAAkC,IAAA,QAAQ,EAAEC;AAA5C,IAAP;AACD,CArBD;;AAuBA6E,OAAO,CAACE,SAAR,GAAoB;AAClBhF,EAAAA,KAAK,EAAEjB,UADW;AAElBkG,EAAAA,QAAQ,EAAEjG,sBAAUuF,IAFF;AAGlBtE,EAAAA,QAAQ,EAAEjB,sBAAUuF;AAHF,CAApB;eAMeO,O","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Select from '@material-ui/core/Select';\nimport FormControl from '@material-ui/core/FormControl';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport times from 'lodash/times';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport grey from '@material-ui/core/colors/grey';\nimport Typography from '@material-ui/core/Typography';\nimport DragIndicator from '@material-ui/icons/DragIndicator';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';\nimport debug from 'debug';\nimport takeRight from 'lodash/takeRight';\nimport PointMenu from './point-menu';\n\nimport range from 'lodash/range';\nconst log = debug('pie-lib:rubric:authoring');\n\nconst reorder = (list, startIndex, endIndex) => {\n const result = Array.from(list);\n const [removed] = result.splice(startIndex, 1);\n\n result.splice(endIndex, 0, removed);\n\n return result;\n};\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string)\n});\n\nconst MaxPoints = withStyles(theme => ({\n formControl: {\n minWidth: '120px',\n margin: theme.spacing.unit\n }\n}))(props => {\n const { value, onChange, max, classes } = props;\n\n return (\n <FormControl className={classes.formControl} variant=\"outlined\">\n <InputLabel width={100} htmlFor=\"...\">\n Max Points\n </InputLabel>\n <Select\n value={value}\n onChange={e => onChange(e.target.value)}\n input={<OutlinedInput labelWidth={80} />}\n >\n {range(1, max).map(v => (\n <MenuItem key={`${v}`} value={v}>\n {v}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n});\n\n// if the value is null, the Sample Answer input field for that point will not be dispalyed\n// if the value is '', the Sample Answer input field will be empty\nconst checkSampleAnswer = sampleAnswer => sampleAnswer === null;\n\nexport const PointConfig = withStyles(theme => ({\n pointConfig: {},\n row: {\n display: 'flex',\n width: '100%',\n position: 'relative'\n },\n editor: {\n width: '100%',\n backgroundColor: 'white !important'\n },\n dragIndicator: {\n paddingTop: theme.spacing.unit,\n color: grey[500]\n },\n pointsLabel: {\n color: grey[500],\n paddingBottom: theme.spacing.unit,\n textTransform: 'uppercase'\n },\n sampleAnswersEditor: {\n paddingLeft: theme.spacing.unit * 3\n },\n pointMenu: {\n position: 'absolute',\n right: 0\n }\n}))(props => {\n const { points, content, classes, sampleAnswer } = props;\n const pointsLabel = `${points} ${points <= 1 ? 'pt' : 'pts'}`;\n const showSampleAnswer = checkSampleAnswer(sampleAnswer);\n\n return (\n <div className={classes.pointConfig}>\n <Typography variant=\"overline\" className={classes.pointsLabel}>\n {pointsLabel}\n </Typography>\n <div className={classes.row}>\n <DragIndicator className={classes.dragIndicator} />\n <EditableHtml className={classes.editor} markup={content} onChange={props.onChange} />\n <PointMenu\n classes={{\n icon: classes.pointMenu\n }}\n showSampleAnswer={showSampleAnswer}\n onChange={props.onMenuChange}\n />\n </div>\n {!showSampleAnswer && (\n <div className={classes.sampleAnswersEditor}>\n <Typography variant=\"overline\" className={classes.dragIndicator}>\n Sample Response\n </Typography>\n <EditableHtml\n className={classes.editor}\n markup={sampleAnswer}\n onChange={props.onSampleChange}\n />\n </div>\n )}\n </div>\n );\n});\n\nexport class RawAuthoring extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n value: RubricType,\n onChange: PropTypes.func\n };\n\n static defaultProps = {};\n\n dragEnd = result => {\n if (!result.destination) {\n return;\n }\n\n const { value, onChange } = this.props;\n\n const points = reorder(value.points, result.source.index, result.destination.index);\n const sampleAnswers = reorder(\n value.sampleAnswers,\n result.source.index,\n result.destination.index\n );\n\n onChange({ ...value, points, sampleAnswers });\n };\n\n changeMaxPoints = maxPoints => {\n const { value, onChange } = this.props;\n const currentMax = value.points.length - 1;\n\n log('current', currentMax, 'new: ', maxPoints);\n\n let points, sampleAnswers;\n if (maxPoints > currentMax) {\n points = times(maxPoints - currentMax)\n .map(() => '')\n .concat(value.points);\n sampleAnswers = times(maxPoints - currentMax)\n .map(() => null)\n .concat(value.sampleAnswers);\n }\n\n if (maxPoints < currentMax) {\n log('less than');\n points = takeRight(value.points, maxPoints + 1);\n sampleAnswers = takeRight(value.sampleAnswers, maxPoints + 1);\n }\n\n if (points) {\n onChange({ ...value, points, sampleAnswers });\n }\n };\n\n changeContent = (index, content, type) => {\n // type could be 'points' or 'sampleAnswers'\n log(`changeModel[${type}]:`, index, content);\n\n if (type !== 'points' && type !== 'sampleAnswers') {\n return;\n }\n\n const { value, onChange } = this.props;\n const items = value[type] && Array.from(value[type]);\n\n items.splice(index, 1, content);\n log(`changeModel[${type}]:`, items);\n\n onChange({ ...value, [type]: items });\n };\n\n excludeZeros = () => {\n const { value, onChange } = this.props;\n\n onChange({ ...value, excludeZero: !value.excludeZero });\n };\n\n shouldRenderPoint = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n if (index < value.points.length - 1) {\n return true;\n } else if (index === value.points.length - 1) {\n return false;\n }\n\n return true;\n }\n };\n\n onPointMenuChange = (index, clickedItem) => {\n if (clickedItem === 'sample') {\n const { value } = this.props;\n const sampleAnswers = Array.from(value.sampleAnswers || []);\n\n if (checkSampleAnswer(sampleAnswers[index])) {\n // an empty string will display an empty Sample Answer input field\n this.changeContent(index, '', 'sampleAnswers');\n } else {\n // when the content is null, the Sample Answer input field will not be displayed\n this.changeContent(index, null, 'sampleAnswers');\n }\n }\n };\n\n render() {\n const { classes, className, value } = this.props;\n\n if (value && Number.isFinite(value.maxPoints)) {\n // eslint-disable-next-line no-console\n console.warn('maxPoints is deprecated - remove from model');\n }\n\n return (\n <div className={classNames(classes.class, className)}>\n <Typography variant=\"h5\" className={classes.rubricTitle}>\n Rubric\n </Typography>\n <FormGroup row>\n <MaxPoints max={10} value={value.points.length - 1} onChange={this.changeMaxPoints} />\n <FormControlLabel\n label=\"Exclude zeros\"\n control={<Checkbox checked={value.excludeZero} onChange={this.excludeZeros} />}\n />\n </FormGroup>\n <div className={classes.container}>\n <DragDropContext onDragEnd={this.dragEnd}>\n <Droppable droppableId=\"droppable\">\n {provided => (\n <div {...provided.droppableProps} ref={provided.innerRef}>\n {value.points.map(\n (p, index) =>\n this.shouldRenderPoint(index, value) && (\n <Draggable\n key={`${p.points}-${index}`}\n index={index}\n draggableId={index.toString()}\n >\n {provided => (\n <div\n className={classes.configHolder}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n >\n <PointConfig\n points={value.points.length - 1 - index}\n content={p}\n sampleAnswer={value.sampleAnswers && value.sampleAnswers[index]}\n onChange={content => this.changeContent(index, content, 'points')}\n onSampleChange={content =>\n this.changeContent(index, content, 'sampleAnswers')\n }\n onMenuChange={clickedItem =>\n this.onPointMenuChange(index, clickedItem)\n }\n />\n </div>\n )}\n </Draggable>\n )\n )}\n {provided.placeholder}\n </div>\n )}\n </Droppable>\n </DragDropContext>\n </div>\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n container: {\n backgroundColor: grey[200],\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: grey[300],\n padding: theme.spacing.unit * 2,\n margin: theme.spacing.unit\n },\n configHolder: {\n paddingTop: theme.spacing.unit,\n paddingBottom: theme.spacing.unit\n },\n rubricTitle: {\n paddingLeft: theme.spacing.unit,\n margin: theme.spacing.unit\n }\n});\n\nconst StyledRawAuthoring = withStyles(styles)(RawAuthoring);\n\nconst Reverse = props => {\n const points = Array.from(props.value.points || []).reverse();\n let sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();\n\n if (points.length > sampleAnswers.length) {\n sampleAnswers = times(points.length - sampleAnswers.length)\n .map(() => null)\n .concat(sampleAnswers);\n }\n\n const value = { ...props.value, points, sampleAnswers };\n\n const onChange = value => {\n props.onChange({\n ...value,\n points: Array.from(value.points || []).reverse(),\n sampleAnswers: Array.from(value.sampleAnswers || []).reverse()\n });\n };\n\n return <StyledRawAuthoring value={value} onChange={onChange} />;\n};\n\nReverse.propTypes = {\n value: RubricType,\n getIndex: PropTypes.func,\n onChange: PropTypes.func\n};\n\nexport default Reverse;\n"],"file":"authoring.js"}
|
|
1
|
+
{"version":3,"sources":["../src/authoring.jsx"],"names":["log","reorder","list","startIndex","endIndex","result","Array","from","splice","removed","RubricType","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","MaxPoints","theme","formControl","minWidth","margin","spacing","unit","props","value","onChange","max","classes","e","target","map","v","checkSampleAnswer","sampleAnswer","PointConfig","pointConfig","row","display","width","position","editor","backgroundColor","dragIndicator","paddingTop","color","grey","pointsLabel","paddingBottom","textTransform","sampleAnswersEditor","paddingLeft","pointMenu","right","content","showSampleAnswer","icon","onMenuChange","onSampleChange","RawAuthoring","destination","source","index","maxPoints","currentMax","length","concat","type","items","clickedItem","changeContent","className","Number","isFinite","console","warn","rubricTitle","changeMaxPoints","excludeZeros","container","dragEnd","provided","droppableProps","innerRef","p","shouldRenderPoint","toString","configHolder","draggableProps","dragHandleProps","onPointMenuChange","placeholder","React","Component","object","isRequired","func","styles","borderWidth","borderStyle","borderColor","padding","StyledRawAuthoring","Reverse","reverse","propTypes","getIndex"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAMA,GAAG,GAAG,uBAAM,0BAAN,CAAZ;;AAEA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAmBC,QAAnB,EAAgC;AAC9C,MAAMC,MAAM,GAAGC,KAAK,CAACC,IAAN,CAAWL,IAAX,CAAf;;AAD8C,uBAE5BG,MAAM,CAACG,MAAP,CAAcL,UAAd,EAA0B,CAA1B,CAF4B;AAAA;AAAA,MAEvCM,OAFuC;;AAI9CJ,EAAAA,MAAM,CAACG,MAAP,CAAcJ,QAAd,EAAwB,CAAxB,EAA2BK,OAA3B;AAEA,SAAOJ,MAAP;AACD,CAPD;;AASO,IAAMK,UAAU,GAAGC,sBAAUC,KAAV,CAAgB;AACxCC,EAAAA,WAAW,EAAEF,sBAAUG,IADiB;AAExCC,EAAAA,MAAM,EAAEJ,sBAAUK,OAAV,CAAkBL,sBAAUM,MAA5B,CAFgC;AAGxCC,EAAAA,aAAa,EAAEP,sBAAUK,OAAV,CAAkBL,sBAAUM,MAA5B;AAHyB,CAAhB,CAAnB;;;AAMP,IAAME,SAAS,GAAG,wBAAW,UAAAC,KAAK;AAAA,SAAK;AACrCC,IAAAA,WAAW,EAAE;AACXC,MAAAA,QAAQ,EAAE,OADC;AAEXC,MAAAA,MA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oB,KAAK,CAACT,aAAN,IAAuB,EAAlC,EAAsCwF,OAAtC;AAHjB;AAKD,GAND;;AAQA,SAAO,gCAAC,kBAAD;AAAoB,IAAA,KAAK,EAAE/E,KAA3B;AAAkC,IAAA,QAAQ,EAAEC;AAA5C,IAAP;AACD,CArBD;;AAuBA6E,OAAO,CAACE,SAAR,GAAoB;AAClBhF,EAAAA,KAAK,EAAEjB,UADW;AAElBkG,EAAAA,QAAQ,EAAEjG,sBAAUuF,IAFF;AAGlBtE,EAAAA,QAAQ,EAAEjB,sBAAUuF;AAHF,CAApB;eAMeO,O","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Select from '@material-ui/core/Select';\nimport FormControl from '@material-ui/core/FormControl';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport times from 'lodash/times';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport grey from '@material-ui/core/colors/grey';\nimport Typography from '@material-ui/core/Typography';\nimport DragIndicator from '@material-ui/icons/DragIndicator';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';\nimport debug from 'debug';\nimport takeRight from 'lodash/takeRight';\nimport PointMenu from './point-menu';\n\nimport range from 'lodash/range';\nconst log = debug('pie-lib:rubric:authoring');\n\nconst reorder = (list, startIndex, endIndex) => {\n const result = Array.from(list);\n const [removed] = result.splice(startIndex, 1);\n\n result.splice(endIndex, 0, removed);\n\n return result;\n};\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string)\n});\n\nconst MaxPoints = withStyles(theme => ({\n formControl: {\n minWidth: '120px',\n margin: theme.spacing.unit\n }\n}))(props => {\n const { value, onChange, max, classes } = props;\n\n return (\n <FormControl className={classes.formControl} variant=\"outlined\">\n <InputLabel width={100} htmlFor=\"...\">\n Max Points\n </InputLabel>\n <Select\n value={value}\n onChange={e => onChange(e.target.value)}\n input={<OutlinedInput labelWidth={80} />}\n >\n {range(1, max).map(v => (\n <MenuItem key={`${v}`} value={v}>\n {v}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n});\n\n// if the value is null or 'null', the Sample Answer input field for that point will not be dispalyed\n// if the value is '', the Sample Answer input field will be empty\nconst checkSampleAnswer = sampleAnswer => sampleAnswer === null || sampleAnswer === 'null';\n\nexport const PointConfig = withStyles(theme => ({\n pointConfig: {},\n row: {\n display: 'flex',\n width: '100%',\n position: 'relative'\n },\n editor: {\n width: '100%',\n backgroundColor: 'white !important'\n },\n dragIndicator: {\n paddingTop: theme.spacing.unit,\n color: grey[500]\n },\n pointsLabel: {\n color: grey[500],\n paddingBottom: theme.spacing.unit,\n textTransform: 'uppercase'\n },\n sampleAnswersEditor: {\n paddingLeft: theme.spacing.unit * 3\n },\n pointMenu: {\n position: 'absolute',\n right: 0\n }\n}))(props => {\n const { points, content, classes, sampleAnswer } = props;\n const pointsLabel = `${points} ${points <= 1 ? 'pt' : 'pts'}`;\n const showSampleAnswer = checkSampleAnswer(sampleAnswer);\n\n return (\n <div className={classes.pointConfig}>\n <Typography variant=\"overline\" className={classes.pointsLabel}>\n {pointsLabel}\n </Typography>\n <div className={classes.row}>\n <DragIndicator className={classes.dragIndicator} />\n <EditableHtml className={classes.editor} markup={content} onChange={props.onChange} />\n <PointMenu\n classes={{\n icon: classes.pointMenu\n }}\n showSampleAnswer={showSampleAnswer}\n onChange={props.onMenuChange}\n />\n </div>\n {!showSampleAnswer && (\n <div className={classes.sampleAnswersEditor}>\n <Typography variant=\"overline\" className={classes.dragIndicator}>\n Sample Response\n </Typography>\n <EditableHtml\n className={classes.editor}\n markup={sampleAnswer}\n onChange={props.onSampleChange}\n />\n </div>\n )}\n </div>\n );\n});\n\nexport class RawAuthoring extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n value: RubricType,\n onChange: PropTypes.func\n };\n\n static defaultProps = {};\n\n dragEnd = result => {\n if (!result.destination) {\n return;\n }\n\n const { value, onChange } = this.props;\n\n const points = reorder(value.points, result.source.index, result.destination.index);\n const sampleAnswers = reorder(\n value.sampleAnswers,\n result.source.index,\n result.destination.index\n );\n\n onChange({ ...value, points, sampleAnswers });\n };\n\n changeMaxPoints = maxPoints => {\n const { value, onChange } = this.props;\n const currentMax = value.points.length - 1;\n\n log('current', currentMax, 'new: ', maxPoints);\n\n let points, sampleAnswers;\n if (maxPoints > currentMax) {\n points = times(maxPoints - currentMax)\n .map(() => '')\n .concat(value.points);\n sampleAnswers = times(maxPoints - currentMax)\n .map(() => null)\n .concat(value.sampleAnswers);\n }\n\n if (maxPoints < currentMax) {\n log('less than');\n points = takeRight(value.points, maxPoints + 1);\n sampleAnswers = takeRight(value.sampleAnswers, maxPoints + 1);\n }\n\n if (points) {\n onChange({ ...value, points, sampleAnswers });\n }\n };\n\n changeContent = (index, content, type) => {\n // type could be 'points' or 'sampleAnswers'\n log(`changeModel[${type}]:`, index, content);\n\n if (type !== 'points' && type !== 'sampleAnswers') {\n return;\n }\n\n const { value, onChange } = this.props;\n const items = value[type] && Array.from(value[type]);\n\n items.splice(index, 1, content);\n log(`changeModel[${type}]:`, items);\n\n onChange({ ...value, [type]: items });\n };\n\n excludeZeros = () => {\n const { value, onChange } = this.props;\n\n onChange({ ...value, excludeZero: !value.excludeZero });\n };\n\n shouldRenderPoint = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n if (index < value.points.length - 1) {\n return true;\n } else if (index === value.points.length - 1) {\n return false;\n }\n\n return true;\n }\n };\n\n onPointMenuChange = (index, clickedItem) => {\n if (clickedItem === 'sample') {\n const { value } = this.props;\n const sampleAnswers = Array.from(value.sampleAnswers || []);\n\n if (checkSampleAnswer(sampleAnswers[index])) {\n // an empty string will display an empty Sample Answer input field\n this.changeContent(index, '', 'sampleAnswers');\n } else {\n // when the content is null or 'null', the Sample Answer input field will not be displayed\n this.changeContent(index, null, 'sampleAnswers');\n }\n }\n };\n\n render() {\n const { classes, className, value } = this.props;\n\n if (value && Number.isFinite(value.maxPoints)) {\n // eslint-disable-next-line no-console\n console.warn('maxPoints is deprecated - remove from model');\n }\n\n return (\n <div className={classNames(classes.class, className)}>\n <Typography variant=\"h5\" className={classes.rubricTitle}>\n Rubric\n </Typography>\n <FormGroup row>\n <MaxPoints max={10} value={value.points.length - 1} onChange={this.changeMaxPoints} />\n <FormControlLabel\n label=\"Exclude zeros\"\n control={<Checkbox checked={value.excludeZero} onChange={this.excludeZeros} />}\n />\n </FormGroup>\n <div className={classes.container}>\n <DragDropContext onDragEnd={this.dragEnd}>\n <Droppable droppableId=\"droppable\">\n {provided => (\n <div {...provided.droppableProps} ref={provided.innerRef}>\n {value.points.map(\n (p, index) =>\n this.shouldRenderPoint(index, value) && (\n <Draggable\n key={`${p.points}-${index}`}\n index={index}\n draggableId={index.toString()}\n >\n {provided => (\n <div\n className={classes.configHolder}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n >\n <PointConfig\n points={value.points.length - 1 - index}\n content={p}\n sampleAnswer={value.sampleAnswers && value.sampleAnswers[index]}\n onChange={content => this.changeContent(index, content, 'points')}\n onSampleChange={content =>\n this.changeContent(index, content, 'sampleAnswers')\n }\n onMenuChange={clickedItem =>\n this.onPointMenuChange(index, clickedItem)\n }\n />\n </div>\n )}\n </Draggable>\n )\n )}\n {provided.placeholder}\n </div>\n )}\n </Droppable>\n </DragDropContext>\n </div>\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n container: {\n backgroundColor: grey[200],\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: grey[300],\n padding: theme.spacing.unit * 2,\n margin: theme.spacing.unit\n },\n configHolder: {\n paddingTop: theme.spacing.unit,\n paddingBottom: theme.spacing.unit\n },\n rubricTitle: {\n paddingLeft: theme.spacing.unit,\n margin: theme.spacing.unit\n }\n});\n\nconst StyledRawAuthoring = withStyles(styles)(RawAuthoring);\n\nconst Reverse = props => {\n const points = Array.from(props.value.points || []).reverse();\n let sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();\n\n if (points.length > sampleAnswers.length) {\n sampleAnswers = times(points.length - sampleAnswers.length)\n .map(() => null)\n .concat(sampleAnswers);\n }\n\n const value = { ...props.value, points, sampleAnswers };\n\n const onChange = value => {\n props.onChange({\n ...value,\n points: Array.from(value.points || []).reverse(),\n sampleAnswers: Array.from(value.sampleAnswers || []).reverse()\n });\n };\n\n return <StyledRawAuthoring value={value} onChange={onChange} />;\n};\n\nReverse.propTypes = {\n value: RubricType,\n getIndex: PropTypes.func,\n onChange: PropTypes.func\n};\n\nexport default Reverse;\n"],"file":"authoring.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/rubric",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7-next.110+3a8d861d",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.3",
|
|
11
11
|
"@material-ui/icons": "^3.0.2",
|
|
12
|
-
"@pie-lib/editable-html": "^7.17.
|
|
12
|
+
"@pie-lib/editable-html": "^7.17.4-next.110+3a8d861d",
|
|
13
13
|
"debug": "^4.1.1",
|
|
14
14
|
"lodash": "^4.17.11",
|
|
15
15
|
"prop-types": "^15.7.2",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"react-beautiful-dnd": "^11.0.2",
|
|
18
18
|
"react-dom": "^16.9.0"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "3a8d861db52422c3521bbf66ce340e528dd9c362"
|
|
21
21
|
}
|
package/src/authoring.jsx
CHANGED
|
@@ -66,9 +66,9 @@ const MaxPoints = withStyles(theme => ({
|
|
|
66
66
|
);
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
// if the value is null, the Sample Answer input field for that point will not be dispalyed
|
|
69
|
+
// if the value is null or 'null', the Sample Answer input field for that point will not be dispalyed
|
|
70
70
|
// if the value is '', the Sample Answer input field will be empty
|
|
71
|
-
const checkSampleAnswer = sampleAnswer => sampleAnswer === null;
|
|
71
|
+
const checkSampleAnswer = sampleAnswer => sampleAnswer === null || sampleAnswer === 'null';
|
|
72
72
|
|
|
73
73
|
export const PointConfig = withStyles(theme => ({
|
|
74
74
|
pointConfig: {},
|
|
@@ -234,7 +234,7 @@ export class RawAuthoring extends React.Component {
|
|
|
234
234
|
// an empty string will display an empty Sample Answer input field
|
|
235
235
|
this.changeContent(index, '', 'sampleAnswers');
|
|
236
236
|
} else {
|
|
237
|
-
// when the content is null, the Sample Answer input field will not be displayed
|
|
237
|
+
// when the content is null or 'null', the Sample Answer input field will not be displayed
|
|
238
238
|
this.changeContent(index, null, 'sampleAnswers');
|
|
239
239
|
}
|
|
240
240
|
}
|