@pie-lib/rubric 0.8.32-next.0 → 0.9.0-beta.2

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 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.8.31](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.30...@pie-lib/rubric@0.8.31) (2023-10-26)
6
+ # [0.9.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.31...@pie-lib/rubric@0.9.0-beta.2) (2025-07-20)
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.8.30](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.29...@pie-lib/rubric@0.8.30) (2023-10-16)
14
+ # [0.9.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.31...@pie-lib/rubric@0.9.0-beta.1) (2025-07-20)
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.8.29](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.28...@pie-lib/rubric@0.8.29) (2023-10-16)
22
+ # [0.9.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.31...@pie-lib/rubric@0.9.0-beta.1) (2025-07-20)
23
23
 
24
24
  **Note:** Version bump only for package @pie-lib/rubric
25
25
 
@@ -27,7 +27,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
27
27
 
28
28
 
29
29
 
30
- ## [0.8.28](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.27...@pie-lib/rubric@0.8.28) (2023-10-03)
30
+ # [0.9.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.31...@pie-lib/rubric@0.9.0-beta.0) (2025-07-20)
31
31
 
32
32
  **Note:** Version bump only for package @pie-lib/rubric
33
33
 
@@ -35,214 +35,130 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
35
35
 
36
36
 
37
37
 
38
- ## [0.8.27](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.26...@pie-lib/rubric@0.8.27) (2023-10-01)
38
+ # [0.10.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.31...@pie-lib/rubric@0.10.0-beta.0) (2025-07-15)
39
39
 
40
40
  **Note:** Version bump only for package @pie-lib/rubric
41
41
 
42
+ # [0.9.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.31...@pie-lib/rubric@0.9.0-beta.0) (2025-07-15)
42
43
 
44
+ **Note:** Version bump only for package @pie-lib/rubric
43
45
 
44
-
45
-
46
- ## [0.8.26](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.25...@pie-lib/rubric@0.8.26) (2023-09-27)
46
+ ## [0.8.30](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.29...@pie-lib/rubric@0.8.30) (2023-10-16)
47
47
 
48
48
  **Note:** Version bump only for package @pie-lib/rubric
49
49
 
50
+ ## [0.8.29](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.28...@pie-lib/rubric@0.8.29) (2023-10-16)
50
51
 
52
+ **Note:** Version bump only for package @pie-lib/rubric
51
53
 
54
+ ## [0.8.28](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.27...@pie-lib/rubric@0.8.28) (2023-10-03)
52
55
 
56
+ **Note:** Version bump only for package @pie-lib/rubric
53
57
 
54
- ## [0.8.25](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.24...@pie-lib/rubric@0.8.25) (2023-09-27)
58
+ ## [0.8.27](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.26...@pie-lib/rubric@0.8.27) (2023-10-01)
55
59
 
56
60
  **Note:** Version bump only for package @pie-lib/rubric
57
61
 
62
+ ## [0.8.26](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.25...@pie-lib/rubric@0.8.26) (2023-09-27)
58
63
 
64
+ **Note:** Version bump only for package @pie-lib/rubric
59
65
 
66
+ ## [0.8.25](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.24...@pie-lib/rubric@0.8.25) (2023-09-27)
60
67
 
68
+ **Note:** Version bump only for package @pie-lib/rubric
61
69
 
62
70
  ## [0.8.24](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.23...@pie-lib/rubric@0.8.24) (2023-09-27)
63
71
 
64
72
  **Note:** Version bump only for package @pie-lib/rubric
65
73
 
66
-
67
-
68
-
69
-
70
74
  ## [0.8.23](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.22...@pie-lib/rubric@0.8.23) (2023-09-26)
71
75
 
72
76
  **Note:** Version bump only for package @pie-lib/rubric
73
77
 
74
-
75
-
76
-
77
-
78
78
  ## [0.8.22](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.21...@pie-lib/rubric@0.8.22) (2023-09-25)
79
79
 
80
80
  **Note:** Version bump only for package @pie-lib/rubric
81
81
 
82
-
83
-
84
-
85
-
86
82
  ## [0.8.21](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.20...@pie-lib/rubric@0.8.21) (2023-09-20)
87
83
 
88
84
  **Note:** Version bump only for package @pie-lib/rubric
89
85
 
90
-
91
-
92
-
93
-
94
86
  ## [0.8.20](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.19...@pie-lib/rubric@0.8.20) (2023-09-20)
95
87
 
96
88
  **Note:** Version bump only for package @pie-lib/rubric
97
89
 
98
-
99
-
100
-
101
-
102
90
  ## [0.8.19](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.18...@pie-lib/rubric@0.8.19) (2023-09-18)
103
91
 
104
92
  **Note:** Version bump only for package @pie-lib/rubric
105
93
 
106
-
107
-
108
-
109
-
110
94
  ## [0.8.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.17...@pie-lib/rubric@0.8.18) (2023-09-14)
111
95
 
112
96
  **Note:** Version bump only for package @pie-lib/rubric
113
97
 
114
-
115
-
116
-
117
-
118
98
  ## [0.8.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.16...@pie-lib/rubric@0.8.17) (2023-09-14)
119
99
 
120
100
  **Note:** Version bump only for package @pie-lib/rubric
121
101
 
122
-
123
-
124
-
125
-
126
102
  ## [0.8.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.15...@pie-lib/rubric@0.8.16) (2023-09-14)
127
103
 
128
104
  **Note:** Version bump only for package @pie-lib/rubric
129
105
 
130
-
131
-
132
-
133
-
134
106
  ## [0.8.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.14...@pie-lib/rubric@0.8.15) (2023-09-05)
135
107
 
136
108
  **Note:** Version bump only for package @pie-lib/rubric
137
109
 
138
-
139
-
140
-
141
-
142
110
  ## [0.8.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.13...@pie-lib/rubric@0.8.14) (2023-09-02)
143
111
 
144
112
  **Note:** Version bump only for package @pie-lib/rubric
145
113
 
146
-
147
-
148
-
149
-
150
114
  ## [0.8.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.12...@pie-lib/rubric@0.8.13) (2023-09-02)
151
115
 
152
116
  **Note:** Version bump only for package @pie-lib/rubric
153
117
 
154
-
155
-
156
-
157
-
158
118
  ## [0.8.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.11...@pie-lib/rubric@0.8.12) (2023-08-30)
159
119
 
160
120
  **Note:** Version bump only for package @pie-lib/rubric
161
121
 
162
-
163
-
164
-
165
-
166
122
  ## [0.8.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.10...@pie-lib/rubric@0.8.11) (2023-08-21)
167
123
 
168
124
  **Note:** Version bump only for package @pie-lib/rubric
169
125
 
170
-
171
-
172
-
173
-
174
126
  ## [0.8.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.9...@pie-lib/rubric@0.8.10) (2023-08-21)
175
127
 
176
128
  **Note:** Version bump only for package @pie-lib/rubric
177
129
 
178
-
179
-
180
-
181
-
182
130
  ## [0.8.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.8...@pie-lib/rubric@0.8.9) (2023-08-15)
183
131
 
184
132
  **Note:** Version bump only for package @pie-lib/rubric
185
133
 
186
-
187
-
188
-
189
-
190
134
  ## [0.8.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.7...@pie-lib/rubric@0.8.8) (2023-08-07)
191
135
 
192
136
  **Note:** Version bump only for package @pie-lib/rubric
193
137
 
194
-
195
-
196
-
197
-
198
138
  ## [0.8.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.6...@pie-lib/rubric@0.8.7) (2023-07-31)
199
139
 
200
140
  **Note:** Version bump only for package @pie-lib/rubric
201
141
 
202
-
203
-
204
-
205
-
206
142
  ## [0.8.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.5...@pie-lib/rubric@0.8.6) (2023-07-24)
207
143
 
208
144
  **Note:** Version bump only for package @pie-lib/rubric
209
145
 
210
-
211
-
212
-
213
-
214
146
  ## [0.8.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.4...@pie-lib/rubric@0.8.5) (2023-07-04)
215
147
 
216
148
  **Note:** Version bump only for package @pie-lib/rubric
217
149
 
218
-
219
-
220
-
221
-
222
150
  ## [0.8.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.3...@pie-lib/rubric@0.8.4) (2023-06-24)
223
151
 
224
152
  **Note:** Version bump only for package @pie-lib/rubric
225
153
 
226
-
227
-
228
-
229
-
230
154
  ## [0.8.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.2...@pie-lib/rubric@0.8.3) (2023-06-23)
231
155
 
232
156
  **Note:** Version bump only for package @pie-lib/rubric
233
157
 
234
-
235
-
236
-
237
-
238
158
  ## [0.8.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.1...@pie-lib/rubric@0.8.2) (2023-06-13)
239
159
 
240
160
  **Note:** Version bump only for package @pie-lib/rubric
241
161
 
242
-
243
-
244
-
245
-
246
162
  ## [0.8.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/rubric@0.8.0...@pie-lib/rubric@0.8.1) (2023-06-12)
247
163
 
248
164
  **Note:** Version bump only for package @pie-lib/rubric
@@ -0,0 +1 @@
1
+ []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/rubric",
3
- "version": "0.8.32-next.0+30707508",
3
+ "version": "0.9.0-beta.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -9,7 +9,9 @@
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.3",
11
11
  "@material-ui/icons": "^3.0.2",
12
- "@pie-lib/editable-html": "^11.1.2-next.0+30707508",
12
+ "@pie-lib/config-ui": "beta",
13
+ "@pie-lib/editable-html": "beta",
14
+ "classnames": "^2.2.6",
13
15
  "debug": "^4.1.1",
14
16
  "editable-html": "npm:@pie-lib/editable-html@^7.21.0",
15
17
  "lodash": "^4.17.11",
@@ -18,5 +20,5 @@
18
20
  "react-beautiful-dnd": "^11.0.2",
19
21
  "react-dom": "^16.9.0"
20
22
  },
21
- "gitHead": "30707508d803994b5af7f1d82940c3442f3a3f89"
23
+ "gitHead": "e2aa3ddac60f49bcb8c2562370f496323642f453"
22
24
  }
@@ -0,0 +1,48 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Rubric render snapshot 1`] = `
4
+ <div
5
+ className="className"
6
+ >
7
+ <WithStyles(Typography)
8
+ variant="h5"
9
+ >
10
+ Rubric
11
+ </WithStyles(Typography)>
12
+ <WithStyles(FormGroup)
13
+ row={true}
14
+ >
15
+ <WithStyles(Component)
16
+ max={10}
17
+ onChange={[Function]}
18
+ pluginOpts={Object {}}
19
+ value={3}
20
+ />
21
+ <WithStyles(WithFormControlContext(FormControlLabel))
22
+ control={
23
+ <WithStyles(Checkbox)
24
+ checked={false}
25
+ onChange={[Function]}
26
+ />
27
+ }
28
+ label="Exclude zeros"
29
+ />
30
+ </WithStyles(FormGroup)>
31
+ <div>
32
+ <DragDropContext
33
+ onDragEnd={[Function]}
34
+ >
35
+ <Connect(Droppable)
36
+ direction="vertical"
37
+ droppableId="droppable"
38
+ ignoreContainerClipping={false}
39
+ isCombineEnabled={false}
40
+ isDropDisabled={false}
41
+ type="DEFAULT"
42
+ >
43
+ <Component />
44
+ </Connect(Droppable)>
45
+ </DragDropContext>
46
+ </div>
47
+ </div>
48
+ `;
@@ -0,0 +1,91 @@
1
+ import { shallow, mount } from 'enzyme';
2
+ import React from 'react';
3
+ import { RawAuthoring } from '../authoring';
4
+ import { Draggable } from 'react-beautiful-dnd';
5
+ import _ from 'lodash';
6
+
7
+ jest.mock('@pie-lib/editable-html', () => () => <div />);
8
+
9
+ describe('Rubric', () => {
10
+ let w;
11
+
12
+ const points = ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'];
13
+ const sampleAnswers = [null, 'just right', 'not left', null];
14
+ const wrapper = (value, opts) => {
15
+ const props = {
16
+ classes: {},
17
+ onChange: jest.fn(),
18
+ className: 'className',
19
+ value: {
20
+ excludeZero: false,
21
+ points,
22
+ sampleAnswers,
23
+ ...value,
24
+ },
25
+ };
26
+ const fn = opts && opts.mount ? mount : shallow;
27
+ return fn(<RawAuthoring {...props} />, opts);
28
+ };
29
+
30
+ describe('render', () => {
31
+ it('snapshot', () => {
32
+ w = wrapper();
33
+ expect(w).toMatchSnapshot();
34
+ });
35
+
36
+ describe('draggable', () => {
37
+ it('renders correctly for excluded zeroes', () => {
38
+ let w = wrapper({ excludeZero: true }, { mount: true });
39
+ expect(w.find(Draggable).length).toEqual(3);
40
+ });
41
+ it('renders correctly for excluded zeroes', () => {
42
+ let w = wrapper({ excludeZero: false }, { mount: true });
43
+ expect(w.find(Draggable).length).toEqual(4);
44
+ });
45
+ });
46
+ });
47
+
48
+ describe('logic', () => {
49
+ describe('rendering', () => {});
50
+
51
+ describe('changeMaxPoints', () => {
52
+ const assertChangeMax = (points, excludeZero, expectedPoints, expectedSampleAnswers) => {
53
+ it(`${points} calls onChange with: ${expectedPoints} and ${expectedSampleAnswers}`, () => {
54
+ let w = wrapper({ excludeZero });
55
+ w.instance().changeMaxPoints(points);
56
+ expect(w.instance().props.onChange).toHaveBeenCalledWith({
57
+ excludeZero,
58
+ points: expectedPoints,
59
+ sampleAnswers: expectedSampleAnswers,
60
+ maxPoints: expectedPoints.length - 1,
61
+ });
62
+ });
63
+ };
64
+
65
+ assertChangeMax(1, false, _.takeRight(points, 2), _.takeRight(sampleAnswers, 2));
66
+ assertChangeMax(1, true, _.takeRight(points, 2), _.takeRight(sampleAnswers, 2));
67
+ assertChangeMax(2, true, _.takeRight(points, 3), _.takeRight(sampleAnswers, 3));
68
+ assertChangeMax(2, false, _.takeRight(points, 3), _.takeRight(sampleAnswers, 3));
69
+ assertChangeMax(5, false, ['', ''].concat(points), [null, null].concat(sampleAnswers));
70
+ });
71
+
72
+ describe('changeSampleResponse', () => {
73
+ const assertChangeSample = (index, clickedItem, excludeZero, expectedPoints, expectedSampleAnswers) => {
74
+ it(`Point ${index} calls onChange with: ${expectedPoints} and ${expectedSampleAnswers}`, () => {
75
+ let w = wrapper({ excludeZero });
76
+ w.instance().onPointMenuChange(index, clickedItem);
77
+ expect(w.instance().props.onChange).toHaveBeenCalledWith({
78
+ excludeZero,
79
+ points: expectedPoints,
80
+ sampleAnswers: expectedSampleAnswers,
81
+ });
82
+ });
83
+ };
84
+
85
+ assertChangeSample(0, 'sample', false, points, ['', 'just right', 'not left', null]);
86
+ assertChangeSample(3, 'sample', false, points, [null, 'just right', 'not left', '']);
87
+ assertChangeSample(1, 'sample', true, points, [null, null, 'not left', null]);
88
+ assertChangeSample(3, 'sample', true, points, [null, 'just right', 'not left', '']);
89
+ });
90
+ });
91
+ });
package/src/authoring.jsx CHANGED
@@ -21,6 +21,8 @@ import takeRight from 'lodash/takeRight';
21
21
  import PointMenu from './point-menu';
22
22
 
23
23
  import range from 'lodash/range';
24
+ import { InputContainer } from '@pie-lib/config-ui';
25
+
24
26
  const log = debug('pie-lib:rubric:authoring');
25
27
 
26
28
  const reorder = (list, startIndex, endIndex) => {
@@ -37,6 +39,7 @@ export const RubricType = PropTypes.shape({
37
39
  points: PropTypes.arrayOf(PropTypes.string),
38
40
  sampleAnswers: PropTypes.arrayOf(PropTypes.string),
39
41
  maxPoints: PropTypes.number,
42
+ rubriclessInstruction: PropTypes.string,
40
43
  });
41
44
 
42
45
  const MaxPoints = withStyles((theme) => ({
@@ -53,7 +56,7 @@ const MaxPoints = withStyles((theme) => ({
53
56
  Max Points
54
57
  </InputLabel>
55
58
  <Select value={value} onChange={(e) => onChange(e.target.value)} input={<OutlinedInput labelWidth={80} />}>
56
- {range(1, max).map((v) => (
59
+ {range(1, max + 1).map((v) => (
57
60
  <MenuItem key={`${v}`} value={v}>
58
61
  {v}
59
62
  </MenuItem>
@@ -94,8 +97,14 @@ export const PointConfig = withStyles((theme) => ({
94
97
  position: 'absolute',
95
98
  right: 0,
96
99
  },
100
+ errorText: {
101
+ fontSize: theme.typography.fontSize - 2,
102
+ color: theme.palette.error.main,
103
+ paddingLeft: theme.spacing.unit * 3,
104
+ paddingTop: theme.spacing.unit,
105
+ },
97
106
  }))((props) => {
98
- const { points, content, classes, sampleAnswer, mathMlOptions = {} } = props;
107
+ const { points, content, classes, sampleAnswer, mathMlOptions = {}, error, pluginOpts = {} } = props;
99
108
  const pointsLabel = `${points} ${points <= 1 ? 'pt' : 'pts'}`;
100
109
  const showSampleAnswer = checkSampleAnswer(sampleAnswer);
101
110
 
@@ -109,6 +118,8 @@ export const PointConfig = withStyles((theme) => ({
109
118
  <DragIndicator className={classes.dragIndicator} />
110
119
  <EditableHtml
111
120
  className={classes.editor}
121
+ error={error}
122
+ pluginProps={pluginOpts}
112
123
  markup={content}
113
124
  onChange={props.onChange}
114
125
  mathMlOptions={mathMlOptions}
@@ -121,7 +132,7 @@ export const PointConfig = withStyles((theme) => ({
121
132
  onChange={props.onMenuChange}
122
133
  />
123
134
  </div>
124
-
135
+ {error && <div className={classes.errorText}>{error}</div>}
125
136
  {!showSampleAnswer && (
126
137
  <div className={classes.sampleAnswersEditor}>
127
138
  <Typography variant="overline" className={classes.dragIndicator}>
@@ -130,6 +141,7 @@ export const PointConfig = withStyles((theme) => ({
130
141
  <EditableHtml
131
142
  className={classes.editor}
132
143
  markup={sampleAnswer}
144
+ pluginProps={pluginOpts}
133
145
  onChange={props.onSampleChange}
134
146
  mathMlOptions={mathMlOptions}
135
147
  />
@@ -144,6 +156,9 @@ export class RawAuthoring extends React.Component {
144
156
  classes: PropTypes.object.isRequired,
145
157
  className: PropTypes.string,
146
158
  value: RubricType,
159
+ config: PropTypes.object,
160
+ pluginOpts: PropTypes.object,
161
+ rubricless: PropTypes.bool,
147
162
  onChange: PropTypes.func,
148
163
  };
149
164
 
@@ -162,8 +177,13 @@ export class RawAuthoring extends React.Component {
162
177
  onChange({ ...value, points, sampleAnswers });
163
178
  };
164
179
 
165
- changeMaxPoints = (maxPoints) => {
180
+ changeRubriclessInstruction = (input) => {
166
181
  const { value, onChange } = this.props;
182
+ onChange({ ...value, rubriclessInstruction: input });
183
+ };
184
+
185
+ changeMaxPoints = (maxPoints) => {
186
+ const { value, onChange, rubricless } = this.props;
167
187
  const currentMax = value.points.length - 1;
168
188
 
169
189
  log('current', currentMax, 'new: ', maxPoints);
@@ -184,8 +204,10 @@ export class RawAuthoring extends React.Component {
184
204
  sampleAnswers = takeRight(value.sampleAnswers, maxPoints + 1);
185
205
  }
186
206
 
187
- if (points) {
188
- onChange({ ...value, points, sampleAnswers });
207
+ if (points && !rubricless) {
208
+ onChange({ ...value, points, sampleAnswers, maxPoints });
209
+ } else {
210
+ onChange({ ...value, maxPoints });
189
211
  }
190
212
  };
191
213
 
@@ -242,21 +264,47 @@ export class RawAuthoring extends React.Component {
242
264
  };
243
265
 
244
266
  render() {
245
- const { classes, className, value, mathMlOptions = {} } = this.props;
246
- let { excludeZeroEnabled = true, maxPointsEnabled = true } = value || {};
247
-
267
+ const {
268
+ classes,
269
+ className,
270
+ value,
271
+ mathMlOptions = {},
272
+ config = {},
273
+ rubricless = false,
274
+ pluginOpts = {},
275
+ } = this.props;
276
+ let {
277
+ excludeZeroEnabled = true,
278
+ maxPointsEnabled = true,
279
+ errors = {},
280
+ rubriclessInstructionEnabled = false,
281
+ maxPoints = 10,
282
+ } = value || {};
283
+ // rubric will contain a max value for maxPoints
284
+ const { rubriclessInstruction = {}, maxMaxPoints = 10 } = config || {};
285
+ const { pointsDescriptorsErrors } = errors || {};
248
286
  if (value && Number.isFinite(value.maxPoints)) {
249
287
  // eslint-disable-next-line no-console
250
288
  console.warn('maxPoints is deprecated - remove from model');
251
289
  }
252
290
 
291
+ // for rubric value is computed based on points
292
+ const maxPointsValue = !rubricless ? value.points.length - 1 : maxPoints;
293
+
253
294
  return (
254
295
  <div className={classNames(classes.class, className)}>
255
296
  <Typography variant="h5" className={classes.rubricTitle}>
256
297
  Rubric
257
298
  </Typography>
258
299
  <FormGroup row>
259
- {maxPointsEnabled && <MaxPoints max={10} value={value.points.length - 1} onChange={this.changeMaxPoints} />}
300
+ {maxPointsEnabled && (
301
+ <MaxPoints
302
+ max={maxMaxPoints < 100 ? maxMaxPoints : 100}
303
+ value={maxPointsValue}
304
+ onChange={this.changeMaxPoints}
305
+ pluginOpts={pluginOpts}
306
+ />
307
+ )}
260
308
  {excludeZeroEnabled && (
261
309
  <FormControlLabel
262
310
  label="Exclude zeros"
@@ -265,7 +313,22 @@ export class RawAuthoring extends React.Component {
265
313
  )}
266
314
  </FormGroup>
267
315
 
268
- <div className={classes.container}>
316
+ {rubriclessInstructionEnabled && rubricless && (
317
+ <InputContainer label={rubriclessInstruction.label} className={classes.inputContainer}>
318
+ <EditableHtml
319
+ className={classes.input}
320
+ markup={value.rubriclessInstruction || ''}
321
+ onChange={this.changeRubriclessInstruction}
322
+ pluginProps={pluginOpts}
323
+ nonEmpty={false}
324
+ disableUnderline
325
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
326
+ mathMlOptions={mathMlOptions}
327
+ />
328
+ </InputContainer>
329
+ )}
330
+
331
+ <div className={rubricless ? classes.rubricless : classes.container}>
269
332
  <DragDropContext onDragEnd={this.dragEnd}>
270
333
  <Droppable droppableId="droppable">
271
334
  {(provided) => (
@@ -284,11 +347,15 @@ export class RawAuthoring extends React.Component {
284
347
  <PointConfig
285
348
  points={value.points.length - 1 - index}
286
349
  content={p}
350
+ error={
351
+ pointsDescriptorsErrors && pointsDescriptorsErrors[value.points.length - 1 - index]
352
+ }
287
353
  sampleAnswer={value.sampleAnswers && value.sampleAnswers[index]}
288
354
  onChange={(content) => this.changeContent(index, content, 'points')}
289
355
  onSampleChange={(content) => this.changeContent(index, content, 'sampleAnswers')}
290
356
  onMenuChange={(clickedItem) => this.onPointMenuChange(index, clickedItem)}
291
357
  mathMlOptions={mathMlOptions}
358
+ pluginOpts={pluginOpts}
292
359
  />
293
360
  </div>
294
361
  )}
@@ -315,6 +382,14 @@ const styles = (theme) => ({
315
382
  padding: theme.spacing.unit * 2,
316
383
  margin: theme.spacing.unit,
317
384
  },
385
+ inputContainer: {
386
+ width: '100%',
387
+ paddingTop: theme.spacing.unit * 2,
388
+ marginBottom: theme.spacing.unit * 2,
389
+ },
390
+ rubricless: {
391
+ display: 'none',
392
+ },
318
393
  configHolder: {
319
394
  paddingTop: theme.spacing.unit,
320
395
  paddingBottom: theme.spacing.unit,
@@ -328,6 +403,7 @@ const styles = (theme) => ({
328
403
  const StyledRawAuthoring = withStyles(styles)(RawAuthoring);
329
404
 
330
405
  const Reverse = (props) => {
406
+ const { rubricless = false, config = {}, pluginOpts = {} } = props || {};
331
407
  const points = Array.from(props.value.points || []).reverse();
332
408
  let sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();
333
409
 
@@ -347,11 +423,22 @@ const Reverse = (props) => {
347
423
  });
348
424
  };
349
425
 
350
- return <StyledRawAuthoring value={value} onChange={onChange} />;
426
+ return (
427
+ <StyledRawAuthoring
428
+ value={value}
429
+ config={config}
430
+ onChange={onChange}
431
+ rubricless={rubricless}
432
+ pluginOpts={pluginOpts}
433
+ />
434
+ );
351
435
  };
352
436
 
353
437
  Reverse.propTypes = {
354
438
  value: RubricType,
439
+ config: PropTypes.object,
440
+ pluginOpts: PropTypes.object,
441
+ rubricless: PropTypes.bool,
355
442
  getIndex: PropTypes.func,
356
443
  onChange: PropTypes.func,
357
444
  };
package/src/index.js CHANGED
@@ -3,6 +3,7 @@ import Authoring from './authoring';
3
3
  const RUBRIC_TYPES = {
4
4
  SIMPLE_RUBRIC: 'simpleRubric',
5
5
  MULTI_TRAIT_RUBRIC: 'multiTraitRubric',
6
+ RUBRICLESS: 'rubricless',
6
7
  };
7
8
 
8
9
  export { Authoring, RUBRIC_TYPES };