@pie-element/complex-rubric 3.7.8-next.77 → 3.7.8-next.80
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/{rubric → multi-trait-rubric}/CHANGELOG.md +402 -676
- 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/{rubric → multi-trait-rubric}/configure/CHANGELOG.md +366 -574
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +584 -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 +152 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/configure/lib/index.js +89 -63
- 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 +546 -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 +556 -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 +380 -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 +296 -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 +118 -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/{rubric → multi-trait-rubric}/controller/CHANGELOG.md +172 -165
- package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/controller/lib/defaults.js +8 -5
- 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 +215 -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 +1628 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +1202 -0
- package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/docs/demo/config.js +2 -2
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +117 -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 +861 -0
- package/configure/node_modules/@pie-element/{rubric/docs/config-schema.json.md → multi-trait-rubric/docs/pie-schema.json.md} +284 -202
- package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/lib/index.js +27 -30
- 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 +164 -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/{rubric → multi-trait-rubric}/package.json +10 -12
- package/configure/package.json +5 -5
- package/module/configure.js +1 -1
- package/module/element.js +1 -1
- package/module/manifest.json +4 -4
- package/module/print.js +1 -1
- package/package.json +4 -4
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
- 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/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.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 -17
- 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/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/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.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 -42661
- 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 -7980
- package/configure/node_modules/@pie-element/rubric/module/index.html +0 -21
- package/configure/node_modules/@pie-element/rubric/module/manifest.json +0 -14
- 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 -7993
- 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 -196
- package/configure/node_modules/@pie-element/rubric/src/print.js +0 -63
- /package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/LICENSE.md +0 -0
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { mount } from 'enzyme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Rubric from '../main';
|
|
4
|
-
|
|
5
|
-
describe('rubric viewer', () => {
|
|
6
|
-
const wrapper = (extras) => {
|
|
7
|
-
const props = {
|
|
8
|
-
value: {
|
|
9
|
-
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
10
|
-
sampleAnswers: [null, 'just right', 'not left', null],
|
|
11
|
-
excludeZero: false,
|
|
12
|
-
...extras,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return mount(<Rubric {...props} />);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
describe('snapshot', () => {
|
|
20
|
-
it('renders', () => {
|
|
21
|
-
const w = wrapper();
|
|
22
|
-
expect(w).toMatchSnapshot();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('expanded snapshot', () => {
|
|
27
|
-
it('renders', () => {
|
|
28
|
-
const w = wrapper();
|
|
29
|
-
w.find('#rubric-toggle').simulate('click');
|
|
30
|
-
expect(w).toMatchSnapshot();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('exclude zeros', () => {
|
|
35
|
-
it('renders correctly with excluded zeroes', () => {
|
|
36
|
-
let w = wrapper({
|
|
37
|
-
excludeZero: true,
|
|
38
|
-
points: ['a teeny bit right', 'mostly right', 'bingo'],
|
|
39
|
-
sampleAnswers: ['just right', 'not left', null]
|
|
40
|
-
});
|
|
41
|
-
w.find('#rubric-toggle').simulate('click');
|
|
42
|
-
expect(w.find('li').length).toEqual(5);
|
|
43
|
-
|
|
44
|
-
w = wrapper({excludeZero: false});
|
|
45
|
-
w.find('#rubric-toggle').simulate('click');
|
|
46
|
-
expect(w.find('li').length).toEqual(6);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import Rubric from './main';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import ReactDOM from 'react-dom';
|
|
4
|
-
import debug from 'debug';
|
|
5
|
-
import { renderMath } from '@pie-lib/pie-toolbox/math-rendering';
|
|
6
|
-
|
|
7
|
-
export default class RubricRender extends HTMLElement {
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
debug.log('constructor called');
|
|
11
|
-
this.onModelChanged = this.onModelChanged.bind(this);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
set model(s) {
|
|
15
|
-
this._model = s;
|
|
16
|
-
this._render();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
onModelChanged(m) {
|
|
20
|
-
this._model = m;
|
|
21
|
-
this._render();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
connectedCallback() {
|
|
25
|
-
this._render();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
_render() {
|
|
29
|
-
if (this._model) {
|
|
30
|
-
const el = <Rubric value={this._model} />;
|
|
31
|
-
|
|
32
|
-
ReactDOM.render(el, this, () => {
|
|
33
|
-
renderMath(this);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,196 +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 Collapse from '@material-ui/core/Collapse';
|
|
6
|
-
import { color, UiLayout } from '@pie-lib/pie-toolbox/render-ui';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
export const RubricType = PropTypes.shape({
|
|
10
|
-
excludeZero: PropTypes.bool,
|
|
11
|
-
points: PropTypes.arrayOf(PropTypes.string),
|
|
12
|
-
sampleAnswers: PropTypes.arrayOf(PropTypes.string),
|
|
13
|
-
animationsDisabled: PropTypes.bool,
|
|
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
|
-
model: PropTypes.object.isRequired,
|
|
31
|
-
animationsDisabled: PropTypes.bool,
|
|
32
|
-
value: RubricType,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
toggleRubric() {
|
|
36
|
-
this.setState({ rubricOpen: !this.state.rubricOpen });
|
|
37
|
-
this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
shouldRenderPoint = (index, value) => {
|
|
41
|
-
if (!value.excludeZero) {
|
|
42
|
-
return true;
|
|
43
|
-
} else {
|
|
44
|
-
return index !== 0;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
render() {
|
|
49
|
-
const { model, value, classes } = this.props;
|
|
50
|
-
let { animationsDisabled } = this.props;
|
|
51
|
-
animationsDisabled = animationsDisabled || value.animationsDisabled;
|
|
52
|
-
|
|
53
|
-
if (value && value.points) {
|
|
54
|
-
const { extraCSSRules } = model || {};
|
|
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
|
-
const pointsLabel = value.excludeZero ? index + 1 : index;
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<React.Fragment key={index}>
|
|
68
|
-
<ListItem key={`P${index}`} className={classes.listColumn}>
|
|
69
|
-
<h3 className={classes.titleText}>{pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}</h3>
|
|
70
|
-
<div className={classes.text} dangerouslySetInnerHTML={{ __html: desc }} />
|
|
71
|
-
</ListItem>
|
|
72
|
-
|
|
73
|
-
{sampleAnswers && sampleAnswers[index] && (
|
|
74
|
-
<ListItem key={`S${index}`} className={classes.listColumn}>
|
|
75
|
-
<h4 className={classes.titleText} style={{ fontWeight: 'normal' }}>Sample Answer</h4>
|
|
76
|
-
<div className={classes.text} dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />
|
|
77
|
-
</ListItem>
|
|
78
|
-
)}
|
|
79
|
-
</React.Fragment>
|
|
80
|
-
);
|
|
81
|
-
})}
|
|
82
|
-
</List>
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<UiLayout extraCSSRules={extraCSSRules} className={classes.root}>
|
|
87
|
-
{/* screen reader only heading for navigation as per PD-5057 */}
|
|
88
|
-
<h2 className={classes.hiddenScreenReader}>Rubric</h2>
|
|
89
|
-
{!animationsDisabled ? (
|
|
90
|
-
<React.Fragment>
|
|
91
|
-
<h2
|
|
92
|
-
id={'rubric-toggle'}
|
|
93
|
-
className={classes.rubricToggle}
|
|
94
|
-
tabIndex={0}
|
|
95
|
-
role="button"
|
|
96
|
-
aria-expanded={this.state.rubricOpen}
|
|
97
|
-
onClick={this.toggleRubric}
|
|
98
|
-
onKeyPress={e => {
|
|
99
|
-
if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
{this.state.linkPrefix} Rubric
|
|
103
|
-
<span
|
|
104
|
-
className={classes.chevronStyle}
|
|
105
|
-
aria-hidden="true"
|
|
106
|
-
>
|
|
107
|
-
{this.state.rubricOpen ? (
|
|
108
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="18 15 12 9 6 15"></polyline></svg>
|
|
109
|
-
) : (
|
|
110
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>
|
|
111
|
-
)}
|
|
112
|
-
</span>
|
|
113
|
-
</h2>
|
|
114
|
-
<Collapse in={this.state.rubricOpen} timeout="auto">
|
|
115
|
-
{rubricList}
|
|
116
|
-
</Collapse>
|
|
117
|
-
</React.Fragment>
|
|
118
|
-
) : (
|
|
119
|
-
rubricList
|
|
120
|
-
)}
|
|
121
|
-
</UiLayout>
|
|
122
|
-
);
|
|
123
|
-
} else {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const styles = (theme) => ({
|
|
130
|
-
root: {
|
|
131
|
-
color: color.text(),
|
|
132
|
-
backgroundColor: color.background(),
|
|
133
|
-
// apply styles to tables to match the rest of the UI
|
|
134
|
-
'&:not(.MathJax) table': {
|
|
135
|
-
borderCollapse: 'collapse',
|
|
136
|
-
},
|
|
137
|
-
'&:not(.MathJax) table td, &:not(.MathJax) table th': {
|
|
138
|
-
padding: '8px 12px',
|
|
139
|
-
textAlign: 'left',
|
|
140
|
-
},
|
|
141
|
-
// reset paragraph margins and line-height inside lists to override client styles
|
|
142
|
-
'& ul p, & ol p': {
|
|
143
|
-
marginBottom: 0,
|
|
144
|
-
marginTop: 0,
|
|
145
|
-
lineHeight: 'normal',
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
listColumn: {
|
|
149
|
-
display: 'flex',
|
|
150
|
-
flexDirection: 'column',
|
|
151
|
-
alignItems: 'flex-start',
|
|
152
|
-
padding: '12px 0px',
|
|
153
|
-
},
|
|
154
|
-
listColumnItem: {
|
|
155
|
-
padding: 0,
|
|
156
|
-
},
|
|
157
|
-
text: {
|
|
158
|
-
color: color.text(),
|
|
159
|
-
},
|
|
160
|
-
titleText: {
|
|
161
|
-
color: color.text(),
|
|
162
|
-
fontSize: '16px',
|
|
163
|
-
fontWeight: '700',
|
|
164
|
-
margin: 0,
|
|
165
|
-
paddingBottom: '6px',
|
|
166
|
-
},
|
|
167
|
-
rubricToggle: {
|
|
168
|
-
display: 'flex',
|
|
169
|
-
alignItems: 'center',
|
|
170
|
-
cursor: 'pointer',
|
|
171
|
-
userSelect: 'none',
|
|
172
|
-
fontSize: theme.typography.fontSize,
|
|
173
|
-
fontWeight: '500',
|
|
174
|
-
color: color.tertiary(),
|
|
175
|
-
margin: 0
|
|
176
|
-
},
|
|
177
|
-
chevronStyle: {
|
|
178
|
-
display: 'inline-flex',
|
|
179
|
-
transition: 'transform 0.2s',
|
|
180
|
-
marginLeft: 2,
|
|
181
|
-
alignSelf: 'center',
|
|
182
|
-
},
|
|
183
|
-
hiddenScreenReader: {
|
|
184
|
-
position: 'absolute',
|
|
185
|
-
width: '1px',
|
|
186
|
-
height: '1px',
|
|
187
|
-
padding: 0,
|
|
188
|
-
margin: '-1px',
|
|
189
|
-
overflow: 'hidden',
|
|
190
|
-
clip: 'rect(0,0,0,0)',
|
|
191
|
-
border: 0,
|
|
192
|
-
whiteSpace: 'nowrap',
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
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/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
|
-
}
|
|
File without changes
|