@pie-element/complex-rubric 1.1.1-next.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/configure/CHANGELOG.md +19 -0
- package/configure/package.json +1 -1
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +1 -1
- package/package.json +3 -3
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +0 -768
- 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 -652
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +0 -29
- 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 -130
- 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 -96
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.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/defaults.js +0 -21
- package/configure/node_modules/@pie-element/rubric/configure/src/index.js +0 -64
- package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +0 -49
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +0 -17
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +0 -105
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +0 -14
- 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 -9
- package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +0 -35
- package/configure/node_modules/@pie-element/rubric/controller/src/index.js +0 -6
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +0 -24
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +0 -19
- 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 -3
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +0 -62
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +0 -35
- package/configure/node_modules/@pie-element/rubric/lib/index.js +0 -88
- package/configure/node_modules/@pie-element/rubric/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/rubric/lib/main.js +0 -171
- 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/package.json +0 -25
- package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -22767
- package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +0 -48
- package/configure/node_modules/@pie-element/rubric/src/index.js +0 -38
- package/configure/node_modules/@pie-element/rubric/src/main.jsx +0 -117
- package/configure/node_modules/@pie-element/rubric/src/print.js +0 -63
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { shallow, mount } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Rubric from '../main';
|
|
4
|
-
import Link from '@material-ui/core/Link';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
describe('rubric viewer', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const wrapper = extras => {
|
|
11
|
-
const props = {value: {
|
|
12
|
-
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
13
|
-
sampleAnswers: [null, 'just right', 'not left', null],
|
|
14
|
-
excludeZero: false,
|
|
15
|
-
...extras
|
|
16
|
-
}};
|
|
17
|
-
|
|
18
|
-
return mount(<Rubric {...props} />);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
describe('snapshot', () => {
|
|
22
|
-
it('renders', () => {
|
|
23
|
-
const w = wrapper();
|
|
24
|
-
expect(w).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('expanded snapshot', () => {
|
|
29
|
-
it('renders', () => {
|
|
30
|
-
const w = wrapper();
|
|
31
|
-
w.find(Link).simulate('click');
|
|
32
|
-
expect(w).toMatchSnapshot();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe('exclude zeros', () => {
|
|
37
|
-
it('renders correctly with exluded zeroes', () => {
|
|
38
|
-
let w = wrapper({ excludeZero: true });
|
|
39
|
-
w.find(Link).simulate('click');
|
|
40
|
-
expect(w.find('li').length).toEqual(5);
|
|
41
|
-
|
|
42
|
-
w = wrapper({ excludeZero: false });
|
|
43
|
-
w.find(Link).simulate('click');
|
|
44
|
-
expect(w.find('li').length).toEqual(6);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import Rubric from './main';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import ReactDOM from 'react-dom';
|
|
4
|
-
import debug from 'debug';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export default class RubricRender extends HTMLElement {
|
|
8
|
-
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
debug.log('constructor called');
|
|
12
|
-
this.onModelChanged = this.onModelChanged.bind(this);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
set model(s) {
|
|
16
|
-
this._model = s;
|
|
17
|
-
this._render();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
onModelChanged(m) {
|
|
21
|
-
this._model = m;
|
|
22
|
-
this._render();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
connectedCallback() {
|
|
26
|
-
this._render();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_render() {
|
|
30
|
-
if (this._model) {
|
|
31
|
-
const el = (
|
|
32
|
-
<Rubric value={this._model} />
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
ReactDOM.render(el, this);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
-
import ListItem from '@material-ui/core/ListItem';
|
|
4
|
-
import List from '@material-ui/core/List';
|
|
5
|
-
import ListItemText from '@material-ui/core/ListItemText';
|
|
6
|
-
import Link from '@material-ui/core/Link';
|
|
7
|
-
import Collapse from '@material-ui/core/Collapse';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
|
|
10
|
-
export const RubricType = PropTypes.shape({
|
|
11
|
-
excludeZero: PropTypes.bool,
|
|
12
|
-
points: PropTypes.arrayOf(PropTypes.string),
|
|
13
|
-
sampleAnswers: PropTypes.arrayOf(PropTypes.string),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
class Rubric extends React.Component {
|
|
17
|
-
dudUrl = 'javascript:;';
|
|
18
|
-
|
|
19
|
-
constructor(props) {
|
|
20
|
-
super(props);
|
|
21
|
-
this.state = {
|
|
22
|
-
rubricOpen: false,
|
|
23
|
-
linkPrefix: 'Show',
|
|
24
|
-
};
|
|
25
|
-
this.toggleRubric = this.toggleRubric.bind(this);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static propTypes = {
|
|
29
|
-
classes: PropTypes.object.isRequired,
|
|
30
|
-
animationsDisabled: PropTypes.bool,
|
|
31
|
-
value: RubricType,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
toggleRubric() {
|
|
35
|
-
this.setState({ rubricOpen: !this.state.rubricOpen });
|
|
36
|
-
this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
shouldRenderPoint = (index, value) => {
|
|
40
|
-
if (!value.excludeZero) {
|
|
41
|
-
return true;
|
|
42
|
-
} else {
|
|
43
|
-
return index !== 0;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
render() {
|
|
48
|
-
const { value, classes, animationsDisabled } = this.props;
|
|
49
|
-
|
|
50
|
-
if (value && value.points) {
|
|
51
|
-
const { points, sampleAnswers } = value;
|
|
52
|
-
|
|
53
|
-
const rubricList = <List component="nav">
|
|
54
|
-
{points.slice(0).reverse().map(
|
|
55
|
-
(desc, index) => {
|
|
56
|
-
index = points.length - index - 1;
|
|
57
|
-
return this.shouldRenderPoint(index, value) && (
|
|
58
|
-
<React.Fragment key={index}>
|
|
59
|
-
<ListItem key={`P${index}`}>
|
|
60
|
-
<ListItemText
|
|
61
|
-
className={classes.rubricCol}
|
|
62
|
-
primary={index === 1 ? `${index} PT` : `${index} PTS`}
|
|
63
|
-
/>
|
|
64
|
-
<ListItemText
|
|
65
|
-
primary={
|
|
66
|
-
<div dangerouslySetInnerHTML={{ __html: desc }} />
|
|
67
|
-
}
|
|
68
|
-
/>
|
|
69
|
-
</ListItem>
|
|
70
|
-
{sampleAnswers && sampleAnswers[index] && (
|
|
71
|
-
<ListItem key={`S${index}`}>
|
|
72
|
-
<ListItemText
|
|
73
|
-
className={classes.rubricCol}
|
|
74
|
-
style={{marginLeft: '20px'}}
|
|
75
|
-
primary={'Sample Answer'}
|
|
76
|
-
/>
|
|
77
|
-
<ListItemText
|
|
78
|
-
primary={
|
|
79
|
-
<div dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />
|
|
80
|
-
}
|
|
81
|
-
/>
|
|
82
|
-
</ListItem>
|
|
83
|
-
)}
|
|
84
|
-
</React.Fragment>
|
|
85
|
-
)
|
|
86
|
-
})}
|
|
87
|
-
</List>;
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div className={classes.root}>
|
|
91
|
-
{!animationsDisabled ?
|
|
92
|
-
<React.Fragment>
|
|
93
|
-
<Link href={this.dudUrl} onClick={this.toggleRubric}>
|
|
94
|
-
{this.state.linkPrefix} Rubric
|
|
95
|
-
</Link>
|
|
96
|
-
<Collapse in={this.state.rubricOpen} timeout="auto">
|
|
97
|
-
{rubricList}
|
|
98
|
-
</Collapse>
|
|
99
|
-
</React.Fragment>
|
|
100
|
-
: rubricList
|
|
101
|
-
}
|
|
102
|
-
</div>
|
|
103
|
-
);
|
|
104
|
-
} else {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const styles = () => ({
|
|
111
|
-
rubricCol: {
|
|
112
|
-
flex: '0 1 auto',
|
|
113
|
-
minWidth: 'fit-content'
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
export default withStyles(styles)(Rubric);
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import debounce from 'lodash/debounce';
|
|
4
|
-
import Main from './main';
|
|
5
|
-
import { renderMath } from '@pie-lib/math-rendering';
|
|
6
|
-
import debug from 'debug';
|
|
7
|
-
|
|
8
|
-
const log = debug('pie-element:rubric:print');
|
|
9
|
-
|
|
10
|
-
const preparePrintModel = (model, opts) => {
|
|
11
|
-
const instr = opts.role === 'instructor';
|
|
12
|
-
|
|
13
|
-
if (!instr) {
|
|
14
|
-
return {};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
model.value = { ...model };
|
|
18
|
-
model.mode = 'evaluate';
|
|
19
|
-
model.animationsDisabled = true;
|
|
20
|
-
|
|
21
|
-
return model;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default class RubricPrint extends HTMLElement {
|
|
25
|
-
constructor() {
|
|
26
|
-
super();
|
|
27
|
-
this._options = null;
|
|
28
|
-
this._model = null;
|
|
29
|
-
this._session = [];
|
|
30
|
-
this._rerender = debounce(
|
|
31
|
-
() => {
|
|
32
|
-
if (this._model && this._session) {
|
|
33
|
-
const printModel = preparePrintModel(this._model, this._options);
|
|
34
|
-
|
|
35
|
-
const element =
|
|
36
|
-
this._options &&
|
|
37
|
-
React.createElement(Main, {
|
|
38
|
-
...printModel,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
ReactDOM.render(element, this, () => {
|
|
42
|
-
log('render complete - render math');
|
|
43
|
-
renderMath(this);
|
|
44
|
-
});
|
|
45
|
-
} else {
|
|
46
|
-
log('skip');
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
50,
|
|
50
|
-
{ leading: false, trailing: true }
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
set options(o) {
|
|
54
|
-
this._options = o;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
set model(s) {
|
|
58
|
-
this._model = s;
|
|
59
|
-
this._rerender();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
connectedCallback() {}
|
|
63
|
-
}
|