@pie-element/complex-rubric 3.8.4-next.12 → 3.8.4-next.14
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/module/configure.js +1 -1
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +4 -4
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +0 -2430
- package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +0 -5
- package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +0 -55
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +0 -2298
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +0 -584
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +0 -152
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +0 -223
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +0 -546
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +0 -361
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +0 -556
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +0 -380
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +0 -296
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +0 -118
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +0 -18
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +0 -1539
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +0 -19
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +0 -215
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +0 -13
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +0 -15
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +0 -1628
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +0 -1202
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +0 -8
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +0 -117
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +0 -6
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +0 -861
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +0 -614
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +0 -91
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +0 -164
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +0 -330
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +0 -103
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +0 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +0 -24
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +0 -2713
- package/configure/node_modules/@pie-element/rubric/LICENSE.md +0 -5
- package/configure/node_modules/@pie-element/rubric/README.md +0 -3
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +0 -197
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +0 -2506
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +0 -68
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +0 -197
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +0 -162
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +0 -573
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +0 -24
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +0 -172
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/configure/package.json +0 -18
- package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +0 -167
- package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +0 -42
- package/configure/node_modules/@pie-element/rubric/configure/src/index.js +0 -129
- package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +0 -89
- package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +0 -449
- package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +0 -9
- package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +0 -94
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +0 -17
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +0 -1532
- package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +0 -16
- package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +0 -59
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/controller/package.json +0 -13
- package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +0 -33
- package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +0 -8
- package/configure/node_modules/@pie-element/rubric/controller/src/index.js +0 -41
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +0 -712
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +0 -532
- package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +0 -8
- package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +0 -8
- package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +0 -2
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +0 -391
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +0 -281
- package/configure/node_modules/@pie-element/rubric/lib/index.js +0 -94
- package/configure/node_modules/@pie-element/rubric/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/lib/main.js +0 -270
- package/configure/node_modules/@pie-element/rubric/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/lib/print.js +0 -114
- package/configure/node_modules/@pie-element/rubric/lib/print.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/module/configure.js +0 -1
- package/configure/node_modules/@pie-element/rubric/module/controller.js +0 -113
- package/configure/node_modules/@pie-element/rubric/module/demo.js +0 -33
- package/configure/node_modules/@pie-element/rubric/module/element.js +0 -1
- package/configure/node_modules/@pie-element/rubric/module/index.html +0 -21
- package/configure/node_modules/@pie-element/rubric/module/manifest.json +0 -10
- package/configure/node_modules/@pie-element/rubric/module/print-demo.js +0 -71
- package/configure/node_modules/@pie-element/rubric/module/print.html +0 -18
- package/configure/node_modules/@pie-element/rubric/module/print.js +0 -1
- package/configure/node_modules/@pie-element/rubric/package.json +0 -26
- package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -1815
- package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +0 -49
- package/configure/node_modules/@pie-element/rubric/src/index.js +0 -37
- package/configure/node_modules/@pie-element/rubric/src/main.jsx +0 -219
- package/configure/node_modules/@pie-element/rubric/src/print.js +0 -63
package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx
DELETED
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import OutlinedInput from '@material-ui/core/OutlinedInput';
|
|
6
|
-
import InputLabel from '@material-ui/core/InputLabel';
|
|
7
|
-
import Select from '@material-ui/core/Select';
|
|
8
|
-
import FormControl from '@material-ui/core/FormControl';
|
|
9
|
-
import MenuItem from '@material-ui/core/MenuItem';
|
|
10
|
-
import times from 'lodash/times';
|
|
11
|
-
import Checkbox from '@material-ui/core/Checkbox';
|
|
12
|
-
import FormGroup from '@material-ui/core/FormGroup';
|
|
13
|
-
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
14
|
-
import grey from '@material-ui/core/colors/grey';
|
|
15
|
-
import Typography from '@material-ui/core/Typography';
|
|
16
|
-
import DragIndicator from '@material-ui/icons/DragIndicator';
|
|
17
|
-
import { EditableHtml } from '@pie-lib/pie-toolbox/editable-html';
|
|
18
|
-
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
19
|
-
import debug from 'debug';
|
|
20
|
-
import PointMenu from './point-menu';
|
|
21
|
-
|
|
22
|
-
import range from 'lodash/range';
|
|
23
|
-
import { InputContainer } from '@pie-lib/pie-toolbox/config-ui';
|
|
24
|
-
import { color } from '@pie-lib/pie-toolbox/render-ui';
|
|
25
|
-
|
|
26
|
-
const log = debug('pie-lib:rubric:authoring');
|
|
27
|
-
|
|
28
|
-
const reorder = (list, startIndex, endIndex) => {
|
|
29
|
-
const result = Array.from(list);
|
|
30
|
-
const [removed] = result.splice(startIndex, 1);
|
|
31
|
-
|
|
32
|
-
result.splice(endIndex, 0, removed);
|
|
33
|
-
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const RubricType = PropTypes.shape({
|
|
38
|
-
excludeZero: PropTypes.bool,
|
|
39
|
-
points: PropTypes.arrayOf(PropTypes.string),
|
|
40
|
-
sampleAnswers: PropTypes.arrayOf(PropTypes.string),
|
|
41
|
-
maxPoints: PropTypes.number,
|
|
42
|
-
rubriclessInstruction: PropTypes.string,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const MaxPoints = withStyles((theme) => ({
|
|
46
|
-
formControl: {
|
|
47
|
-
minWidth: '120px',
|
|
48
|
-
margin: theme.spacing.unit,
|
|
49
|
-
},
|
|
50
|
-
}))((props) => {
|
|
51
|
-
const { value, onChange, max, classes } = props;
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<FormControl className={classes.formControl} variant="outlined">
|
|
55
|
-
<InputLabel width={100} htmlFor="...">
|
|
56
|
-
Max Points
|
|
57
|
-
</InputLabel>
|
|
58
|
-
<Select value={value} onChange={(e) => onChange(e.target.value)} input={<OutlinedInput labelWidth={80} />}>
|
|
59
|
-
{range(1, max + 1).map((v) => (
|
|
60
|
-
<MenuItem key={`${v}`} value={v}>
|
|
61
|
-
{v}
|
|
62
|
-
</MenuItem>
|
|
63
|
-
))}
|
|
64
|
-
</Select>
|
|
65
|
-
</FormControl>
|
|
66
|
-
);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// if the value is null or 'null', the Sample Answer input field for that point will not be dispalyed
|
|
70
|
-
// if the value is '', the Sample Answer input field will be empty
|
|
71
|
-
const checkSampleAnswer = (sampleAnswer) => sampleAnswer === null || sampleAnswer === 'null';
|
|
72
|
-
|
|
73
|
-
export const PointConfig = withStyles((theme) => ({
|
|
74
|
-
pointConfig: {},
|
|
75
|
-
row: {
|
|
76
|
-
display: 'flex',
|
|
77
|
-
width: '100%',
|
|
78
|
-
position: 'relative',
|
|
79
|
-
},
|
|
80
|
-
editor: {
|
|
81
|
-
width: '100%',
|
|
82
|
-
backgroundColor: `${theme.palette.common.white} !important`,
|
|
83
|
-
},
|
|
84
|
-
dragIndicator: {
|
|
85
|
-
paddingTop: theme.spacing.unit,
|
|
86
|
-
color: grey[500],
|
|
87
|
-
},
|
|
88
|
-
pointsLabel: {
|
|
89
|
-
color: grey[500],
|
|
90
|
-
paddingBottom: theme.spacing.unit,
|
|
91
|
-
textTransform: 'uppercase',
|
|
92
|
-
},
|
|
93
|
-
sampleAnswersEditor: {
|
|
94
|
-
paddingLeft: theme.spacing.unit * 3,
|
|
95
|
-
},
|
|
96
|
-
pointMenu: {
|
|
97
|
-
position: 'absolute',
|
|
98
|
-
right: 0,
|
|
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
|
-
},
|
|
106
|
-
}))((props) => {
|
|
107
|
-
const {
|
|
108
|
-
points,
|
|
109
|
-
content,
|
|
110
|
-
classes,
|
|
111
|
-
sampleAnswer,
|
|
112
|
-
mathMlOptions = {},
|
|
113
|
-
error,
|
|
114
|
-
pluginOpts = {},
|
|
115
|
-
excludeZero,
|
|
116
|
-
imageSupport = {},
|
|
117
|
-
} = props;
|
|
118
|
-
const pointsCount = excludeZero ? points + 1 : points;
|
|
119
|
-
const pointsLabel = `${pointsCount} ${pointsCount === 1 ? 'pt' : 'pts'}`;
|
|
120
|
-
const showSampleAnswer = checkSampleAnswer(sampleAnswer);
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<div className={classes.pointConfig}>
|
|
124
|
-
<Typography variant="overline" className={classes.pointsLabel}>
|
|
125
|
-
{pointsLabel}
|
|
126
|
-
</Typography>
|
|
127
|
-
|
|
128
|
-
<div className={classes.row}>
|
|
129
|
-
<DragIndicator className={classes.dragIndicator} />
|
|
130
|
-
<EditableHtml
|
|
131
|
-
className={classes.editor}
|
|
132
|
-
error={error}
|
|
133
|
-
pluginProps={pluginOpts}
|
|
134
|
-
markup={content}
|
|
135
|
-
onChange={props.onChange}
|
|
136
|
-
mathMlOptions={mathMlOptions}
|
|
137
|
-
imageSupport={imageSupport}
|
|
138
|
-
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
139
|
-
/>
|
|
140
|
-
<PointMenu
|
|
141
|
-
classes={{
|
|
142
|
-
icon: classes.pointMenu,
|
|
143
|
-
}}
|
|
144
|
-
showSampleAnswer={showSampleAnswer}
|
|
145
|
-
onChange={props.onMenuChange}
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
{error && <div className={classes.errorText}>{error}</div>}
|
|
149
|
-
{!showSampleAnswer && (
|
|
150
|
-
<div className={classes.sampleAnswersEditor}>
|
|
151
|
-
<Typography variant="overline" className={classes.dragIndicator}>
|
|
152
|
-
Sample Response
|
|
153
|
-
</Typography>
|
|
154
|
-
<EditableHtml
|
|
155
|
-
className={classes.editor}
|
|
156
|
-
markup={sampleAnswer}
|
|
157
|
-
pluginProps={pluginOpts}
|
|
158
|
-
onChange={props.onSampleChange}
|
|
159
|
-
mathMlOptions={mathMlOptions}
|
|
160
|
-
imageSupport={imageSupport}
|
|
161
|
-
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
162
|
-
/>
|
|
163
|
-
</div>
|
|
164
|
-
)}
|
|
165
|
-
</div>
|
|
166
|
-
);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
export class RawAuthoring extends React.Component {
|
|
170
|
-
static propTypes = {
|
|
171
|
-
classes: PropTypes.object.isRequired,
|
|
172
|
-
className: PropTypes.string,
|
|
173
|
-
value: RubricType,
|
|
174
|
-
config: PropTypes.object,
|
|
175
|
-
pluginOpts: PropTypes.object,
|
|
176
|
-
rubricless: PropTypes.bool,
|
|
177
|
-
onChange: PropTypes.func,
|
|
178
|
-
imageSupport: PropTypes.shape({
|
|
179
|
-
add: PropTypes.func.isRequired,
|
|
180
|
-
delete: PropTypes.func.isRequired,
|
|
181
|
-
}),
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
static defaultProps = {};
|
|
185
|
-
|
|
186
|
-
dragEnd = (result) => {
|
|
187
|
-
if (!result.destination) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const { value, onChange } = this.props;
|
|
192
|
-
|
|
193
|
-
const points = reorder(value.points, result.source.index, result.destination.index);
|
|
194
|
-
const sampleAnswers = reorder(value.sampleAnswers, result.source.index, result.destination.index);
|
|
195
|
-
|
|
196
|
-
onChange({ ...value, points, sampleAnswers });
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
changeRubriclessInstruction = (input) => {
|
|
200
|
-
const { value, onChange } = this.props;
|
|
201
|
-
onChange({ ...value, rubriclessInstruction: input });
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
changeMaxPoints = (maxPoints) => {
|
|
205
|
-
const { value, onChange } = this.props;
|
|
206
|
-
// excludeZero should be false and disabled when maxPoints is 1
|
|
207
|
-
const excludeZero = maxPoints === 1 ? false : value.excludeZero;
|
|
208
|
-
|
|
209
|
-
onChange({ ...value, maxPoints, excludeZero });
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
changeContent = (index, content, type) => {
|
|
213
|
-
// type could be 'points' or 'sampleAnswers'
|
|
214
|
-
log(`changeModel[${type}]:`, index, content);
|
|
215
|
-
|
|
216
|
-
if (type !== 'points' && type !== 'sampleAnswers') {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const { value, onChange } = this.props;
|
|
221
|
-
const items = value[type] && Array.from(value[type]);
|
|
222
|
-
|
|
223
|
-
items.splice(index, 1, content);
|
|
224
|
-
log(`changeModel[${type}]:`, items);
|
|
225
|
-
|
|
226
|
-
onChange({ ...value, [type]: items });
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
excludeZeros = () => {
|
|
230
|
-
const { value, onChange } = this.props;
|
|
231
|
-
|
|
232
|
-
onChange({ ...value, excludeZero: !value.excludeZero });
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
onPointMenuChange = (index, clickedItem) => {
|
|
236
|
-
if (clickedItem === 'sample') {
|
|
237
|
-
const { value } = this.props;
|
|
238
|
-
const sampleAnswers = Array.from(value.sampleAnswers || []);
|
|
239
|
-
|
|
240
|
-
if (checkSampleAnswer(sampleAnswers[index])) {
|
|
241
|
-
// an empty string will display an empty Sample Answer input field
|
|
242
|
-
this.changeContent(index, '', 'sampleAnswers');
|
|
243
|
-
} else {
|
|
244
|
-
// when the content is null or 'null', the Sample Answer input field will not be displayed
|
|
245
|
-
this.changeContent(index, null, 'sampleAnswers');
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
render() {
|
|
251
|
-
const {
|
|
252
|
-
classes,
|
|
253
|
-
className,
|
|
254
|
-
value,
|
|
255
|
-
mathMlOptions = {},
|
|
256
|
-
config = {},
|
|
257
|
-
rubricless = false,
|
|
258
|
-
pluginOpts = {},
|
|
259
|
-
imageSupport = {},
|
|
260
|
-
} = this.props;
|
|
261
|
-
let {
|
|
262
|
-
excludeZeroEnabled = true,
|
|
263
|
-
maxPointsEnabled = true,
|
|
264
|
-
errors = {},
|
|
265
|
-
rubriclessInstructionEnabled = false,
|
|
266
|
-
maxPoints = 10,
|
|
267
|
-
} = value || {};
|
|
268
|
-
// rubric will contain a max value for maxPoints
|
|
269
|
-
const { rubriclessInstruction = {}, maxMaxPoints = 10 } = config || {};
|
|
270
|
-
const { pointsDescriptorsErrors } = errors || {};
|
|
271
|
-
if (value && Number.isFinite(value.maxPoints)) {
|
|
272
|
-
// eslint-disable-next-line no-console
|
|
273
|
-
console.warn('maxPoints is deprecated - remove from model');
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// for rubric value is computed based on points
|
|
277
|
-
const maxPointsValue = maxPoints;
|
|
278
|
-
|
|
279
|
-
return (
|
|
280
|
-
<div className={classNames(classes.class, className)}>
|
|
281
|
-
<Typography variant="h5" className={classes.rubricTitle}>
|
|
282
|
-
Rubric
|
|
283
|
-
</Typography>
|
|
284
|
-
<FormGroup row>
|
|
285
|
-
{maxPointsEnabled && (
|
|
286
|
-
<MaxPoints
|
|
287
|
-
max={maxMaxPoints < 100 ? maxMaxPoints : 100}
|
|
288
|
-
value={maxPointsValue}
|
|
289
|
-
onChange={this.changeMaxPoints}
|
|
290
|
-
pluginOpts={pluginOpts}
|
|
291
|
-
imageSupport={imageSupport}
|
|
292
|
-
/>
|
|
293
|
-
)}
|
|
294
|
-
{excludeZeroEnabled && (
|
|
295
|
-
<FormControlLabel
|
|
296
|
-
label="Exclude zeros"
|
|
297
|
-
control={
|
|
298
|
-
<Checkbox
|
|
299
|
-
className={classes.customColor}
|
|
300
|
-
checked={value.excludeZero}
|
|
301
|
-
onChange={this.excludeZeros}
|
|
302
|
-
disabled={maxPointsValue === 1}
|
|
303
|
-
/>
|
|
304
|
-
}
|
|
305
|
-
/>
|
|
306
|
-
)}
|
|
307
|
-
</FormGroup>
|
|
308
|
-
|
|
309
|
-
{rubriclessInstructionEnabled && rubricless && (
|
|
310
|
-
<InputContainer label={rubriclessInstruction.label} className={classes.inputContainer}>
|
|
311
|
-
<EditableHtml
|
|
312
|
-
className={classes.input}
|
|
313
|
-
markup={value.rubriclessInstruction || ''}
|
|
314
|
-
onChange={this.changeRubriclessInstruction}
|
|
315
|
-
pluginProps={pluginOpts}
|
|
316
|
-
nonEmpty={false}
|
|
317
|
-
disableUnderline
|
|
318
|
-
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
319
|
-
mathMlOptions={mathMlOptions}
|
|
320
|
-
imageSupport={imageSupport}
|
|
321
|
-
/>
|
|
322
|
-
</InputContainer>
|
|
323
|
-
)}
|
|
324
|
-
|
|
325
|
-
<div className={rubricless ? classes.rubricless : classes.container}>
|
|
326
|
-
<DragDropContext onDragEnd={this.dragEnd}>
|
|
327
|
-
<Droppable droppableId="droppable">
|
|
328
|
-
{(provided) => (
|
|
329
|
-
<div {...provided.droppableProps} ref={provided.innerRef}>
|
|
330
|
-
{value.points.map((p, index) => {
|
|
331
|
-
return (
|
|
332
|
-
<Draggable key={`${p.points}-${index}`} index={index} draggableId={index.toString()}>
|
|
333
|
-
{(provided) => (
|
|
334
|
-
<div
|
|
335
|
-
className={classes.configHolder}
|
|
336
|
-
ref={provided.innerRef}
|
|
337
|
-
{...provided.draggableProps}
|
|
338
|
-
{...provided.dragHandleProps}
|
|
339
|
-
>
|
|
340
|
-
<PointConfig
|
|
341
|
-
points={value.points.length - 1 - index}
|
|
342
|
-
content={p}
|
|
343
|
-
error={
|
|
344
|
-
pointsDescriptorsErrors && pointsDescriptorsErrors[value.points.length - 1 - index]
|
|
345
|
-
}
|
|
346
|
-
sampleAnswer={value.sampleAnswers && value.sampleAnswers[index]}
|
|
347
|
-
onChange={(content) => this.changeContent(index, content, 'points')}
|
|
348
|
-
onSampleChange={(content) => this.changeContent(index, content, 'sampleAnswers')}
|
|
349
|
-
onMenuChange={(clickedItem) => this.onPointMenuChange(index, clickedItem)}
|
|
350
|
-
mathMlOptions={mathMlOptions}
|
|
351
|
-
pluginOpts={pluginOpts}
|
|
352
|
-
imageSupport={imageSupport}
|
|
353
|
-
excludeZero={value.excludeZero}
|
|
354
|
-
/>
|
|
355
|
-
</div>
|
|
356
|
-
)}
|
|
357
|
-
</Draggable>
|
|
358
|
-
);
|
|
359
|
-
})}
|
|
360
|
-
{provided.placeholder}
|
|
361
|
-
</div>
|
|
362
|
-
)}
|
|
363
|
-
</Droppable>
|
|
364
|
-
</DragDropContext>
|
|
365
|
-
</div>
|
|
366
|
-
</div>
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const styles = (theme) => ({
|
|
372
|
-
container: {
|
|
373
|
-
backgroundColor: grey[200],
|
|
374
|
-
borderWidth: 1,
|
|
375
|
-
borderStyle: 'solid',
|
|
376
|
-
borderColor: grey[300],
|
|
377
|
-
padding: theme.spacing.unit * 2,
|
|
378
|
-
margin: theme.spacing.unit,
|
|
379
|
-
},
|
|
380
|
-
inputContainer: {
|
|
381
|
-
width: '100%',
|
|
382
|
-
paddingTop: theme.spacing.unit * 2,
|
|
383
|
-
marginBottom: theme.spacing.unit * 2,
|
|
384
|
-
},
|
|
385
|
-
rubricless: {
|
|
386
|
-
display: 'none',
|
|
387
|
-
},
|
|
388
|
-
configHolder: {
|
|
389
|
-
paddingTop: theme.spacing.unit,
|
|
390
|
-
paddingBottom: theme.spacing.unit,
|
|
391
|
-
},
|
|
392
|
-
rubricTitle: {
|
|
393
|
-
paddingLeft: theme.spacing.unit,
|
|
394
|
-
margin: theme.spacing.unit,
|
|
395
|
-
},
|
|
396
|
-
customColor: {
|
|
397
|
-
color: `${color.tertiary()} !important`,
|
|
398
|
-
},
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
const StyledRawAuthoring = withStyles(styles)(RawAuthoring);
|
|
402
|
-
|
|
403
|
-
const Reverse = (props) => {
|
|
404
|
-
const { rubricless = false, config = {}, pluginOpts = {}, imageSupport = {} } = props || {};
|
|
405
|
-
const points = Array.from(props.value.points || []).reverse();
|
|
406
|
-
let sampleAnswers = Array.from(props.value.sampleAnswers || []).reverse();
|
|
407
|
-
|
|
408
|
-
if (points.length > sampleAnswers.length) {
|
|
409
|
-
sampleAnswers = times(points.length - sampleAnswers.length)
|
|
410
|
-
.map(() => null)
|
|
411
|
-
.concat(sampleAnswers);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const value = { ...props.value, points, sampleAnswers };
|
|
415
|
-
|
|
416
|
-
const onChange = (value) => {
|
|
417
|
-
props.onChange({
|
|
418
|
-
...value,
|
|
419
|
-
points: Array.from(value.points || []).reverse(),
|
|
420
|
-
sampleAnswers: Array.from(value.sampleAnswers || []).reverse(),
|
|
421
|
-
});
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
return (
|
|
425
|
-
<StyledRawAuthoring
|
|
426
|
-
value={value}
|
|
427
|
-
config={config}
|
|
428
|
-
onChange={onChange}
|
|
429
|
-
rubricless={rubricless}
|
|
430
|
-
pluginOpts={pluginOpts}
|
|
431
|
-
imageSupport={imageSupport}
|
|
432
|
-
/>
|
|
433
|
-
);
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
Reverse.propTypes = {
|
|
437
|
-
value: RubricType,
|
|
438
|
-
config: PropTypes.object,
|
|
439
|
-
pluginOpts: PropTypes.object,
|
|
440
|
-
rubricless: PropTypes.bool,
|
|
441
|
-
getIndex: PropTypes.func,
|
|
442
|
-
onChange: PropTypes.func,
|
|
443
|
-
imageSupport: PropTypes.shape({
|
|
444
|
-
add: PropTypes.func.isRequired,
|
|
445
|
-
delete: PropTypes.func.isRequired,
|
|
446
|
-
}),
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
export default Reverse;
|
package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import Menu from '@material-ui/core/Menu';
|
|
2
|
-
import MenuItem from '@material-ui/core/MenuItem';
|
|
3
|
-
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
4
|
-
import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
|
|
5
|
-
import IconButton from '@material-ui/core/IconButton';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
export class IconMenu extends React.Component {
|
|
10
|
-
static propTypes = {
|
|
11
|
-
opts: PropTypes.object,
|
|
12
|
-
onClick: PropTypes.func.isRequired,
|
|
13
|
-
classes: PropTypes.object.isRequired,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
constructor(props) {
|
|
17
|
-
super(props);
|
|
18
|
-
this.state = {
|
|
19
|
-
anchorEl: undefined,
|
|
20
|
-
open: false,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
handleClick = (event) => this.setState({ open: true, anchorEl: event.currentTarget });
|
|
25
|
-
|
|
26
|
-
handleRequestClose = () => this.setState({ open: false });
|
|
27
|
-
|
|
28
|
-
render() {
|
|
29
|
-
const { opts, onClick, classes } = this.props;
|
|
30
|
-
const { open, anchorEl } = this.state;
|
|
31
|
-
const keys = Object.keys(opts) || [];
|
|
32
|
-
|
|
33
|
-
const handleMenuClick = (key) => () => {
|
|
34
|
-
onClick(key);
|
|
35
|
-
this.handleRequestClose();
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const iconColor = open ? 'inherit' : 'disabled';
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div>
|
|
42
|
-
<div onClick={this.handleClick}>
|
|
43
|
-
<IconButton className={classes.icon}>
|
|
44
|
-
{open ? <MoreVertIcon color={iconColor} /> : <MoreHorizIcon color={iconColor} />}
|
|
45
|
-
</IconButton>
|
|
46
|
-
</div>
|
|
47
|
-
<Menu
|
|
48
|
-
id="point-menu"
|
|
49
|
-
anchorEl={anchorEl}
|
|
50
|
-
open={open}
|
|
51
|
-
onClose={this.handleRequestClose}
|
|
52
|
-
style={{ transform: 'translate(-15px, -15px)' }}
|
|
53
|
-
transformOrigin={{
|
|
54
|
-
vertical: 'center',
|
|
55
|
-
horizontal: 'right',
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
{keys.map((k, index) => (
|
|
59
|
-
<MenuItem key={index} onClick={handleMenuClick(k)}>
|
|
60
|
-
{opts[k]}
|
|
61
|
-
</MenuItem>
|
|
62
|
-
))}
|
|
63
|
-
</Menu>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default class PointMenu extends React.Component {
|
|
70
|
-
static propTypes = {
|
|
71
|
-
onChange: PropTypes.func.isRequired,
|
|
72
|
-
classes: PropTypes.object.isRequired,
|
|
73
|
-
showSampleAnswer: PropTypes.bool.isRequired,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
static defaultProps = {
|
|
77
|
-
classes: {},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
render() {
|
|
81
|
-
const { onChange, classes, showSampleAnswer } = this.props;
|
|
82
|
-
const sampleText = showSampleAnswer ? 'Provide Sample Response' : 'Remove Sample Response';
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<IconMenu
|
|
86
|
-
onClick={(key) => onChange(key)}
|
|
87
|
-
opts={{
|
|
88
|
-
sample: sampleText,
|
|
89
|
-
}}
|
|
90
|
-
classes={classes}
|
|
91
|
-
/>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"type": "fix",
|
|
4
|
-
"scope": null,
|
|
5
|
-
"subject": "bump all packages to avoid tag conflict",
|
|
6
|
-
"merge": null,
|
|
7
|
-
"header": "fix: bump all packages to avoid tag conflict",
|
|
8
|
-
"body": null,
|
|
9
|
-
"footer": null,
|
|
10
|
-
"notes": [],
|
|
11
|
-
"hash": "d9ec9a8689f0a391594b5e2f4ea958c6dc9f6d7b",
|
|
12
|
-
"gitTags": " (develop)",
|
|
13
|
-
"committerDate": "2020-04-10 20:01:37 +0100",
|
|
14
|
-
"isTagged": true,
|
|
15
|
-
"tag": "@pie-element/rubric-controller@1.1.1"
|
|
16
|
-
}
|
|
17
|
-
]
|