@pie-element/complex-rubric 2.0.2-next.13 → 2.0.2-next.15
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/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +978 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +869 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +502 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +98 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +126 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +553 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +361 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +552 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +371 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +270 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +29 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +18 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +210 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +94 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +161 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +13 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +15 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +272 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +206 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +180 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +298 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +201 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +85 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +161 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +330 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +103 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +24 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +1248 -0
- package/configure/node_modules/@pie-element/rubric/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/rubric/README.md +3 -0
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +1088 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +34 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +130 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +108 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/package.json +17 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +26 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/index.js +64 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +56 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +192 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +14 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/controller/package.json +13 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +31 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/index.js +6 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +160 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +127 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +2 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +96 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +65 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js +88 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js +188 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js +114 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/package.json +26 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +23003 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +46 -0
- package/configure/node_modules/@pie-element/rubric/src/index.js +34 -0
- package/configure/node_modules/@pie-element/rubric/src/main.jsx +136 -0
- package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
- package/configure/package.json +2 -2
- package/controller/package.json +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
describe('rubric viewer', () => {
|
|
7
|
+
const wrapper = (extras) => {
|
|
8
|
+
const props = {
|
|
9
|
+
value: {
|
|
10
|
+
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
11
|
+
sampleAnswers: [null, 'just right', 'not left', null],
|
|
12
|
+
excludeZero: false,
|
|
13
|
+
...extras,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return mount(<Rubric {...props} />);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('snapshot', () => {
|
|
21
|
+
it('renders', () => {
|
|
22
|
+
const w = wrapper();
|
|
23
|
+
expect(w).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('expanded snapshot', () => {
|
|
28
|
+
it('renders', () => {
|
|
29
|
+
const w = wrapper();
|
|
30
|
+
w.find(Link).simulate('click');
|
|
31
|
+
expect(w).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('exclude zeros', () => {
|
|
36
|
+
it('renders correctly with exluded zeroes', () => {
|
|
37
|
+
let w = wrapper({ excludeZero: true });
|
|
38
|
+
w.find(Link).simulate('click');
|
|
39
|
+
expect(w.find('li').length).toEqual(5);
|
|
40
|
+
|
|
41
|
+
w = wrapper({ excludeZero: false });
|
|
42
|
+
w.find(Link).simulate('click');
|
|
43
|
+
expect(w.find('li').length).toEqual(6);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Rubric from './main';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import debug from 'debug';
|
|
5
|
+
|
|
6
|
+
export default class RubricRender extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
debug.log('constructor called');
|
|
10
|
+
this.onModelChanged = this.onModelChanged.bind(this);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
set model(s) {
|
|
14
|
+
this._model = s;
|
|
15
|
+
this._render();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onModelChanged(m) {
|
|
19
|
+
this._model = m;
|
|
20
|
+
this._render();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
this._render();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_render() {
|
|
28
|
+
if (this._model) {
|
|
29
|
+
const el = <Rubric value={this._model} />;
|
|
30
|
+
|
|
31
|
+
ReactDOM.render(el, this);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
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 { color } from '@pie-lib/pie-toolbox/render-ui';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
|
|
11
|
+
export const RubricType = PropTypes.shape({
|
|
12
|
+
excludeZero: PropTypes.bool,
|
|
13
|
+
points: PropTypes.arrayOf(PropTypes.string),
|
|
14
|
+
sampleAnswers: PropTypes.arrayOf(PropTypes.string),
|
|
15
|
+
animationsDisabled: PropTypes.bool,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
class Rubric extends React.Component {
|
|
19
|
+
dudUrl = 'javascript:;';
|
|
20
|
+
|
|
21
|
+
constructor(props) {
|
|
22
|
+
super(props);
|
|
23
|
+
this.state = {
|
|
24
|
+
rubricOpen: false,
|
|
25
|
+
linkPrefix: 'Show',
|
|
26
|
+
};
|
|
27
|
+
this.toggleRubric = this.toggleRubric.bind(this);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static propTypes = {
|
|
31
|
+
classes: PropTypes.object.isRequired,
|
|
32
|
+
animationsDisabled: PropTypes.bool,
|
|
33
|
+
value: RubricType,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
toggleRubric() {
|
|
37
|
+
this.setState({ rubricOpen: !this.state.rubricOpen });
|
|
38
|
+
this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
shouldRenderPoint = (index, value) => {
|
|
42
|
+
if (!value.excludeZero) {
|
|
43
|
+
return true;
|
|
44
|
+
} else {
|
|
45
|
+
return index !== 0;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
const { value, classes } = this.props;
|
|
51
|
+
let { animationsDisabled } = this.props;
|
|
52
|
+
animationsDisabled = animationsDisabled || value.animationsDisabled;
|
|
53
|
+
|
|
54
|
+
if (value && value.points) {
|
|
55
|
+
const { points, sampleAnswers } = value;
|
|
56
|
+
|
|
57
|
+
const rubricList = (
|
|
58
|
+
<List component="nav">
|
|
59
|
+
{points
|
|
60
|
+
.slice(0)
|
|
61
|
+
.reverse()
|
|
62
|
+
.map((desc, index) => {
|
|
63
|
+
index = points.length - index - 1;
|
|
64
|
+
return (
|
|
65
|
+
this.shouldRenderPoint(index, value) && (
|
|
66
|
+
<React.Fragment key={index}>
|
|
67
|
+
<ListItem key={`P${index}`}>
|
|
68
|
+
<ListItemText
|
|
69
|
+
className={classes.rubricCol}
|
|
70
|
+
primary={<div className={classes.text}>{index === 1 ? `${index} PT` : `${index} PTS`}</div>}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
<ListItemText
|
|
74
|
+
primary={<div className={classes.text} dangerouslySetInnerHTML={{ __html: desc }} />}
|
|
75
|
+
/>
|
|
76
|
+
</ListItem>
|
|
77
|
+
|
|
78
|
+
{sampleAnswers && sampleAnswers[index] && (
|
|
79
|
+
<ListItem key={`S${index}`}>
|
|
80
|
+
<ListItemText
|
|
81
|
+
className={classes.rubricCol}
|
|
82
|
+
style={{ marginLeft: '20px' }}
|
|
83
|
+
primary={<div className={classes.text}>Sample Answer</div>}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<ListItemText
|
|
87
|
+
primary={
|
|
88
|
+
<div className={classes.text} dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />
|
|
89
|
+
}
|
|
90
|
+
/>
|
|
91
|
+
</ListItem>
|
|
92
|
+
)}
|
|
93
|
+
</React.Fragment>
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
97
|
+
</List>
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className={classes.root}>
|
|
102
|
+
{!animationsDisabled ? (
|
|
103
|
+
<React.Fragment>
|
|
104
|
+
<Link href={this.dudUrl} onClick={this.toggleRubric}>
|
|
105
|
+
{this.state.linkPrefix} Rubric
|
|
106
|
+
</Link>
|
|
107
|
+
<Collapse in={this.state.rubricOpen} timeout="auto">
|
|
108
|
+
{rubricList}
|
|
109
|
+
</Collapse>
|
|
110
|
+
</React.Fragment>
|
|
111
|
+
) : (
|
|
112
|
+
rubricList
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
} else {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const styles = () => ({
|
|
123
|
+
root: {
|
|
124
|
+
color: color.text(),
|
|
125
|
+
backgroundColor: color.background(),
|
|
126
|
+
},
|
|
127
|
+
rubricCol: {
|
|
128
|
+
flex: '0 1 auto',
|
|
129
|
+
minWidth: 'fit-content',
|
|
130
|
+
},
|
|
131
|
+
text: {
|
|
132
|
+
color: color.text(),
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export default withStyles(styles)(Rubric);
|
|
@@ -0,0 +1,63 @@
|
|
|
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/pie-toolbox/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
|
+
}
|
package/configure/package.json
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"author": "Pie Framework Authors",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
|
-
"@pie-element/multi-trait-rubric": "^3.0.
|
|
12
|
-
"@pie-element/rubric": "^3.0.
|
|
11
|
+
"@pie-element/multi-trait-rubric": "^3.0.2-next.14",
|
|
12
|
+
"@pie-element/rubric": "^3.0.2-next.14",
|
|
13
13
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
14
14
|
"@pie-lib/config-ui": "^11.9.24",
|
|
15
15
|
"@pie-lib/editable-html": "^11.1.1",
|
package/controller/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/complex-rubric",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "2.0.2-next.
|
|
4
|
+
"version": "2.0.2-next.15+eafc185e7",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@material-ui/core": "^3.9.2",
|
|
10
|
-
"@pie-element/multi-trait-rubric": "^3.0.2-next.
|
|
11
|
-
"@pie-element/rubric": "^3.0.2-next.
|
|
10
|
+
"@pie-element/multi-trait-rubric": "^3.0.2-next.14",
|
|
11
|
+
"@pie-element/rubric": "^3.0.2-next.14",
|
|
12
12
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
13
13
|
"classnames": "^2.2.5",
|
|
14
14
|
"debug": "^4.1.1",
|
|
15
15
|
"lodash": "^4.17.11",
|
|
16
16
|
"prop-types": "^15.7.2"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "eafc185e7bbe508f93f5c2e342354cbb8ee3c5c6",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|