@pie-element/rubric 1.7.1-next.0 → 1.7.5
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 +54 -0
- package/configure/CHANGELOG.md +25 -1
- package/configure/package.json +2 -2
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +1 -1
- package/module/configure.js +29179 -0
- package/module/controller.js +15 -0
- package/module/demo.js +33 -0
- package/module/element.js +219 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +71 -0
- package/module/print.html +18 -0
- package/module/print.js +236 -0
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var lib = {};
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(lib, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var model_1 = lib.model = model;
|
|
7
|
+
|
|
8
|
+
function model(model, session, env) {
|
|
9
|
+
return new Promise(function (resolve) {
|
|
10
|
+
var modelResult = !model ? {} : model;
|
|
11
|
+
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { lib as default, model_1 as model };
|
package/module/demo.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Configure from './configure.js';
|
|
2
|
+
import Element from './element.js';
|
|
3
|
+
import * as controller from './controller.js';
|
|
4
|
+
|
|
5
|
+
var generate = {};
|
|
6
|
+
|
|
7
|
+
generate.model = (id, element) => ({
|
|
8
|
+
id,
|
|
9
|
+
element,
|
|
10
|
+
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
11
|
+
sampleAnswers: [null, 'just right', 'not left', null],
|
|
12
|
+
maxPoints: 4,
|
|
13
|
+
excludeZero: false
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const { model } = generate;
|
|
17
|
+
|
|
18
|
+
var config = {
|
|
19
|
+
elements: {
|
|
20
|
+
'pie-rubric': '../..'
|
|
21
|
+
},
|
|
22
|
+
models: [model('1', 'pie-rubric')]
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//Note: demo-el is a custom element loaded in the markup.
|
|
26
|
+
customElements.whenDefined("demo-el").then(() => {
|
|
27
|
+
config.models.forEach((m) => {
|
|
28
|
+
const de = document.createElement("demo-el");
|
|
29
|
+
document.body.appendChild(de);
|
|
30
|
+
de.def = { tagName: m.element, Element, Configure, controller };
|
|
31
|
+
de.model = m;
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {_dll_react, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_prop_types, _dll_react_dom, _dll_debug} from "../../../@pie-lib/shared-module@^1.2.14/module/index.js";
|
|
2
|
+
const React$1 = _dll_react;
|
|
3
|
+
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
4
|
+
const {ListItem: ListItem} = _dll_material_ui__core;
|
|
5
|
+
const {List: List} = _dll_material_ui__core;
|
|
6
|
+
const {ListItemText: ListItemText} = _dll_material_ui__core;
|
|
7
|
+
const {Link: Link} = _dll_material_ui__core;
|
|
8
|
+
const {Collapse: Collapse} = _dll_material_ui__core;
|
|
9
|
+
const PropTypes = _dll_prop_types;
|
|
10
|
+
const _jsxFileName$1 = "/home/circleci/repo/packages/rubric/src/main.jsx";
|
|
11
|
+
const RubricType = PropTypes.shape({
|
|
12
|
+
excludeZero: PropTypes.bool,
|
|
13
|
+
points: PropTypes.arrayOf(PropTypes.string),
|
|
14
|
+
sampleAnswers: PropTypes.arrayOf(PropTypes.string)
|
|
15
|
+
});
|
|
16
|
+
class Rubric extends React$1.Component {
|
|
17
|
+
__init() {
|
|
18
|
+
this.dudUrl = 'javascript:;';
|
|
19
|
+
}
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
Rubric.prototype.__init.call(this);
|
|
23
|
+
Rubric.prototype.__init2.call(this);
|
|
24
|
+
this.state = {
|
|
25
|
+
rubricOpen: false,
|
|
26
|
+
linkPrefix: 'Show'
|
|
27
|
+
};
|
|
28
|
+
this.toggleRubric = this.toggleRubric.bind(this);
|
|
29
|
+
}
|
|
30
|
+
static __initStatic() {
|
|
31
|
+
this.propTypes = {
|
|
32
|
+
classes: PropTypes.object.isRequired,
|
|
33
|
+
animationsDisabled: PropTypes.bool,
|
|
34
|
+
value: RubricType
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
toggleRubric() {
|
|
38
|
+
this.setState({
|
|
39
|
+
rubricOpen: !this.state.rubricOpen
|
|
40
|
+
});
|
|
41
|
+
this.setState({
|
|
42
|
+
linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
__init2() {
|
|
46
|
+
this.shouldRenderPoint = (index, value) => {
|
|
47
|
+
if (!value.excludeZero) {
|
|
48
|
+
return true;
|
|
49
|
+
} else {
|
|
50
|
+
return index !== 0;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
render() {
|
|
55
|
+
const {value, classes, animationsDisabled} = this.props;
|
|
56
|
+
if (value && value.points) {
|
|
57
|
+
const {points, sampleAnswers} = value;
|
|
58
|
+
const rubricList = React$1.createElement(List, {
|
|
59
|
+
component: "nav",
|
|
60
|
+
__self: this,
|
|
61
|
+
__source: {
|
|
62
|
+
fileName: _jsxFileName$1,
|
|
63
|
+
lineNumber: 53
|
|
64
|
+
}
|
|
65
|
+
}, points.slice(0).reverse().map((desc, index) => {
|
|
66
|
+
index = points.length - index - 1;
|
|
67
|
+
return this.shouldRenderPoint(index, value) && React$1.createElement(React$1.Fragment, {
|
|
68
|
+
key: index,
|
|
69
|
+
__self: this,
|
|
70
|
+
__source: {
|
|
71
|
+
fileName: _jsxFileName$1,
|
|
72
|
+
lineNumber: 58
|
|
73
|
+
}
|
|
74
|
+
}, React$1.createElement(ListItem, {
|
|
75
|
+
key: `P${index}`,
|
|
76
|
+
__self: this,
|
|
77
|
+
__source: {
|
|
78
|
+
fileName: _jsxFileName$1,
|
|
79
|
+
lineNumber: 59
|
|
80
|
+
}
|
|
81
|
+
}, React$1.createElement(ListItemText, {
|
|
82
|
+
className: classes.rubricCol,
|
|
83
|
+
primary: index === 1 ? `${index} PT` : `${index} PTS`,
|
|
84
|
+
__self: this,
|
|
85
|
+
__source: {
|
|
86
|
+
fileName: _jsxFileName$1,
|
|
87
|
+
lineNumber: 60
|
|
88
|
+
}
|
|
89
|
+
}), React$1.createElement(ListItemText, {
|
|
90
|
+
primary: React$1.createElement('div', {
|
|
91
|
+
dangerouslySetInnerHTML: {
|
|
92
|
+
__html: desc
|
|
93
|
+
},
|
|
94
|
+
__self: this,
|
|
95
|
+
__source: {
|
|
96
|
+
fileName: _jsxFileName$1,
|
|
97
|
+
lineNumber: 66
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
__self: this,
|
|
101
|
+
__source: {
|
|
102
|
+
fileName: _jsxFileName$1,
|
|
103
|
+
lineNumber: 64
|
|
104
|
+
}
|
|
105
|
+
})), sampleAnswers && sampleAnswers[index] && React$1.createElement(ListItem, {
|
|
106
|
+
key: `S${index}`,
|
|
107
|
+
__self: this,
|
|
108
|
+
__source: {
|
|
109
|
+
fileName: _jsxFileName$1,
|
|
110
|
+
lineNumber: 71
|
|
111
|
+
}
|
|
112
|
+
}, React$1.createElement(ListItemText, {
|
|
113
|
+
className: classes.rubricCol,
|
|
114
|
+
style: {
|
|
115
|
+
marginLeft: '20px'
|
|
116
|
+
},
|
|
117
|
+
primary: 'Sample Answer',
|
|
118
|
+
__self: this,
|
|
119
|
+
__source: {
|
|
120
|
+
fileName: _jsxFileName$1,
|
|
121
|
+
lineNumber: 72
|
|
122
|
+
}
|
|
123
|
+
}), React$1.createElement(ListItemText, {
|
|
124
|
+
primary: React$1.createElement('div', {
|
|
125
|
+
dangerouslySetInnerHTML: {
|
|
126
|
+
__html: sampleAnswers[index]
|
|
127
|
+
},
|
|
128
|
+
__self: this,
|
|
129
|
+
__source: {
|
|
130
|
+
fileName: _jsxFileName$1,
|
|
131
|
+
lineNumber: 79
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
__self: this,
|
|
135
|
+
__source: {
|
|
136
|
+
fileName: _jsxFileName$1,
|
|
137
|
+
lineNumber: 77
|
|
138
|
+
}
|
|
139
|
+
})));
|
|
140
|
+
}));
|
|
141
|
+
return React$1.createElement('div', {
|
|
142
|
+
className: classes.root,
|
|
143
|
+
__self: this,
|
|
144
|
+
__source: {
|
|
145
|
+
fileName: _jsxFileName$1,
|
|
146
|
+
lineNumber: 90
|
|
147
|
+
}
|
|
148
|
+
}, !animationsDisabled ? React$1.createElement(React$1.Fragment, {
|
|
149
|
+
__self: this,
|
|
150
|
+
__source: {
|
|
151
|
+
fileName: _jsxFileName$1,
|
|
152
|
+
lineNumber: 92
|
|
153
|
+
}
|
|
154
|
+
}, React$1.createElement(Link, {
|
|
155
|
+
href: this.dudUrl,
|
|
156
|
+
onClick: this.toggleRubric,
|
|
157
|
+
__self: this,
|
|
158
|
+
__source: {
|
|
159
|
+
fileName: _jsxFileName$1,
|
|
160
|
+
lineNumber: 93
|
|
161
|
+
}
|
|
162
|
+
}, this.state.linkPrefix, " Rubric"), React$1.createElement(Collapse, {
|
|
163
|
+
in: this.state.rubricOpen,
|
|
164
|
+
timeout: "auto",
|
|
165
|
+
__self: this,
|
|
166
|
+
__source: {
|
|
167
|
+
fileName: _jsxFileName$1,
|
|
168
|
+
lineNumber: 96
|
|
169
|
+
}
|
|
170
|
+
}, rubricList)) : rubricList);
|
|
171
|
+
} else {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
Rubric.__initStatic();
|
|
177
|
+
const styles = () => ({
|
|
178
|
+
rubricCol: {
|
|
179
|
+
flex: '0 1 auto',
|
|
180
|
+
minWidth: 'fit-content'
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
var Rubric$1 = withStyles(styles)(Rubric);
|
|
184
|
+
const React = _dll_react;
|
|
185
|
+
const ReactDOM = _dll_react_dom;
|
|
186
|
+
const debug = _dll_debug;
|
|
187
|
+
const _jsxFileName = "/home/circleci/repo/packages/rubric/src/index.js";
|
|
188
|
+
class RubricRender extends HTMLElement {
|
|
189
|
+
constructor() {
|
|
190
|
+
super();
|
|
191
|
+
debug.log('constructor called');
|
|
192
|
+
this.onModelChanged = this.onModelChanged.bind(this);
|
|
193
|
+
}
|
|
194
|
+
set model(s) {
|
|
195
|
+
this._model = s;
|
|
196
|
+
this._render();
|
|
197
|
+
}
|
|
198
|
+
onModelChanged(m) {
|
|
199
|
+
this._model = m;
|
|
200
|
+
this._render();
|
|
201
|
+
}
|
|
202
|
+
connectedCallback() {
|
|
203
|
+
this._render();
|
|
204
|
+
}
|
|
205
|
+
_render() {
|
|
206
|
+
if (this._model) {
|
|
207
|
+
const el = React.createElement(Rubric$1, {
|
|
208
|
+
value: this._model,
|
|
209
|
+
__self: this,
|
|
210
|
+
__source: {
|
|
211
|
+
fileName: _jsxFileName,
|
|
212
|
+
lineNumber: 32
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
ReactDOM.render(el, this);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export {RubricRender as default};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<title>@pie-element/rubric@1.7.4</title>
|
|
6
|
+
<script
|
|
7
|
+
type="module"
|
|
8
|
+
src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
|
|
9
|
+
|
|
10
|
+
<link
|
|
11
|
+
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
12
|
+
rel="stylesheet"
|
|
13
|
+
/>
|
|
14
|
+
<style>
|
|
15
|
+
html, body {
|
|
16
|
+
font-family: 'Roboto', sans-serif;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
<script type="module" src="./demo.js"></script>
|
|
20
|
+
</head>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import PrintElement from './print.js';
|
|
2
|
+
|
|
3
|
+
var generate = {};
|
|
4
|
+
|
|
5
|
+
generate.model = (id, element) => ({
|
|
6
|
+
id,
|
|
7
|
+
element,
|
|
8
|
+
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
9
|
+
sampleAnswers: [null, 'just right', 'not left', null],
|
|
10
|
+
maxPoints: 4,
|
|
11
|
+
excludeZero: false
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const { model } = generate;
|
|
15
|
+
|
|
16
|
+
var config = {
|
|
17
|
+
elements: {
|
|
18
|
+
'pie-rubric': '../..'
|
|
19
|
+
},
|
|
20
|
+
models: [model('1', 'pie-rubric')]
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// new init - just shows off print!
|
|
24
|
+
|
|
25
|
+
const init = async () => {
|
|
26
|
+
console.log('define the element...');
|
|
27
|
+
await Promise.all(
|
|
28
|
+
config.models.map(async (m) => {
|
|
29
|
+
try {
|
|
30
|
+
const printTag = `${m.element}-print`;
|
|
31
|
+
if (customElements.get(printTag)) {
|
|
32
|
+
return true;
|
|
33
|
+
} else {
|
|
34
|
+
customElements.define(printTag, PrintElement);
|
|
35
|
+
await customElements.whenDefined(printTag);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
console.log('now apply the model...');
|
|
45
|
+
config.models.forEach((m) => {
|
|
46
|
+
const printTag = `${m.element}-print`;
|
|
47
|
+
const h3s = document.createElement('h3');
|
|
48
|
+
h3s.textContent = 'student mode';
|
|
49
|
+
document.body.appendChild(h3s);
|
|
50
|
+
const de = document.createElement(printTag);
|
|
51
|
+
document.body.appendChild(de);
|
|
52
|
+
de.options = {};
|
|
53
|
+
de.model = m;
|
|
54
|
+
|
|
55
|
+
const h3 = document.createElement('h3');
|
|
56
|
+
h3.textContent = 'instructor mode';
|
|
57
|
+
document.body.appendChild(h3);
|
|
58
|
+
const instr = document.createElement(printTag);
|
|
59
|
+
document.body.appendChild(instr);
|
|
60
|
+
instr.options = { mode: 'instructor' };
|
|
61
|
+
instr.model = JSON.parse(JSON.stringify(m));
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
init()
|
|
66
|
+
.then(() => {
|
|
67
|
+
console.log('ready');
|
|
68
|
+
})
|
|
69
|
+
.catch((e) => {
|
|
70
|
+
console.error(e);
|
|
71
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<title>@pie-element/rubric@1.7.4</title>
|
|
6
|
+
<link
|
|
7
|
+
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
/>
|
|
10
|
+
<style>
|
|
11
|
+
html, body {
|
|
12
|
+
font-family: 'Roboto', sans-serif;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
<script type="module" src="./print-demo.js"></script>
|
|
16
|
+
</head>
|
|
17
|
+
<body></body>
|
|
18
|
+
</html>
|
package/module/print.js
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {_dll_react, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_prop_types, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.2.14/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.17/module/index.js";
|
|
3
|
+
const React$1 = _dll_react;
|
|
4
|
+
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
5
|
+
const {ListItem: ListItem} = _dll_material_ui__core;
|
|
6
|
+
const {List: List} = _dll_material_ui__core;
|
|
7
|
+
const {ListItemText: ListItemText} = _dll_material_ui__core;
|
|
8
|
+
const {Link: Link} = _dll_material_ui__core;
|
|
9
|
+
const {Collapse: Collapse} = _dll_material_ui__core;
|
|
10
|
+
const PropTypes = _dll_prop_types;
|
|
11
|
+
const _jsxFileName = "/home/circleci/repo/packages/rubric/src/main.jsx";
|
|
12
|
+
const RubricType = PropTypes.shape({
|
|
13
|
+
excludeZero: PropTypes.bool,
|
|
14
|
+
points: PropTypes.arrayOf(PropTypes.string),
|
|
15
|
+
sampleAnswers: PropTypes.arrayOf(PropTypes.string)
|
|
16
|
+
});
|
|
17
|
+
class Rubric extends React$1.Component {
|
|
18
|
+
__init() {
|
|
19
|
+
this.dudUrl = 'javascript:;';
|
|
20
|
+
}
|
|
21
|
+
constructor(props) {
|
|
22
|
+
super(props);
|
|
23
|
+
Rubric.prototype.__init.call(this);
|
|
24
|
+
Rubric.prototype.__init2.call(this);
|
|
25
|
+
this.state = {
|
|
26
|
+
rubricOpen: false,
|
|
27
|
+
linkPrefix: 'Show'
|
|
28
|
+
};
|
|
29
|
+
this.toggleRubric = this.toggleRubric.bind(this);
|
|
30
|
+
}
|
|
31
|
+
static __initStatic() {
|
|
32
|
+
this.propTypes = {
|
|
33
|
+
classes: PropTypes.object.isRequired,
|
|
34
|
+
animationsDisabled: PropTypes.bool,
|
|
35
|
+
value: RubricType
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
toggleRubric() {
|
|
39
|
+
this.setState({
|
|
40
|
+
rubricOpen: !this.state.rubricOpen
|
|
41
|
+
});
|
|
42
|
+
this.setState({
|
|
43
|
+
linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
__init2() {
|
|
47
|
+
this.shouldRenderPoint = (index, value) => {
|
|
48
|
+
if (!value.excludeZero) {
|
|
49
|
+
return true;
|
|
50
|
+
} else {
|
|
51
|
+
return index !== 0;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
const {value, classes, animationsDisabled} = this.props;
|
|
57
|
+
if (value && value.points) {
|
|
58
|
+
const {points, sampleAnswers} = value;
|
|
59
|
+
const rubricList = React$1.createElement(List, {
|
|
60
|
+
component: "nav",
|
|
61
|
+
__self: this,
|
|
62
|
+
__source: {
|
|
63
|
+
fileName: _jsxFileName,
|
|
64
|
+
lineNumber: 53
|
|
65
|
+
}
|
|
66
|
+
}, points.slice(0).reverse().map((desc, index) => {
|
|
67
|
+
index = points.length - index - 1;
|
|
68
|
+
return this.shouldRenderPoint(index, value) && React$1.createElement(React$1.Fragment, {
|
|
69
|
+
key: index,
|
|
70
|
+
__self: this,
|
|
71
|
+
__source: {
|
|
72
|
+
fileName: _jsxFileName,
|
|
73
|
+
lineNumber: 58
|
|
74
|
+
}
|
|
75
|
+
}, React$1.createElement(ListItem, {
|
|
76
|
+
key: `P${index}`,
|
|
77
|
+
__self: this,
|
|
78
|
+
__source: {
|
|
79
|
+
fileName: _jsxFileName,
|
|
80
|
+
lineNumber: 59
|
|
81
|
+
}
|
|
82
|
+
}, React$1.createElement(ListItemText, {
|
|
83
|
+
className: classes.rubricCol,
|
|
84
|
+
primary: index === 1 ? `${index} PT` : `${index} PTS`,
|
|
85
|
+
__self: this,
|
|
86
|
+
__source: {
|
|
87
|
+
fileName: _jsxFileName,
|
|
88
|
+
lineNumber: 60
|
|
89
|
+
}
|
|
90
|
+
}), React$1.createElement(ListItemText, {
|
|
91
|
+
primary: React$1.createElement('div', {
|
|
92
|
+
dangerouslySetInnerHTML: {
|
|
93
|
+
__html: desc
|
|
94
|
+
},
|
|
95
|
+
__self: this,
|
|
96
|
+
__source: {
|
|
97
|
+
fileName: _jsxFileName,
|
|
98
|
+
lineNumber: 66
|
|
99
|
+
}
|
|
100
|
+
}),
|
|
101
|
+
__self: this,
|
|
102
|
+
__source: {
|
|
103
|
+
fileName: _jsxFileName,
|
|
104
|
+
lineNumber: 64
|
|
105
|
+
}
|
|
106
|
+
})), sampleAnswers && sampleAnswers[index] && React$1.createElement(ListItem, {
|
|
107
|
+
key: `S${index}`,
|
|
108
|
+
__self: this,
|
|
109
|
+
__source: {
|
|
110
|
+
fileName: _jsxFileName,
|
|
111
|
+
lineNumber: 71
|
|
112
|
+
}
|
|
113
|
+
}, React$1.createElement(ListItemText, {
|
|
114
|
+
className: classes.rubricCol,
|
|
115
|
+
style: {
|
|
116
|
+
marginLeft: '20px'
|
|
117
|
+
},
|
|
118
|
+
primary: 'Sample Answer',
|
|
119
|
+
__self: this,
|
|
120
|
+
__source: {
|
|
121
|
+
fileName: _jsxFileName,
|
|
122
|
+
lineNumber: 72
|
|
123
|
+
}
|
|
124
|
+
}), React$1.createElement(ListItemText, {
|
|
125
|
+
primary: React$1.createElement('div', {
|
|
126
|
+
dangerouslySetInnerHTML: {
|
|
127
|
+
__html: sampleAnswers[index]
|
|
128
|
+
},
|
|
129
|
+
__self: this,
|
|
130
|
+
__source: {
|
|
131
|
+
fileName: _jsxFileName,
|
|
132
|
+
lineNumber: 79
|
|
133
|
+
}
|
|
134
|
+
}),
|
|
135
|
+
__self: this,
|
|
136
|
+
__source: {
|
|
137
|
+
fileName: _jsxFileName,
|
|
138
|
+
lineNumber: 77
|
|
139
|
+
}
|
|
140
|
+
})));
|
|
141
|
+
}));
|
|
142
|
+
return React$1.createElement('div', {
|
|
143
|
+
className: classes.root,
|
|
144
|
+
__self: this,
|
|
145
|
+
__source: {
|
|
146
|
+
fileName: _jsxFileName,
|
|
147
|
+
lineNumber: 90
|
|
148
|
+
}
|
|
149
|
+
}, !animationsDisabled ? React$1.createElement(React$1.Fragment, {
|
|
150
|
+
__self: this,
|
|
151
|
+
__source: {
|
|
152
|
+
fileName: _jsxFileName,
|
|
153
|
+
lineNumber: 92
|
|
154
|
+
}
|
|
155
|
+
}, React$1.createElement(Link, {
|
|
156
|
+
href: this.dudUrl,
|
|
157
|
+
onClick: this.toggleRubric,
|
|
158
|
+
__self: this,
|
|
159
|
+
__source: {
|
|
160
|
+
fileName: _jsxFileName,
|
|
161
|
+
lineNumber: 93
|
|
162
|
+
}
|
|
163
|
+
}, this.state.linkPrefix, " Rubric"), React$1.createElement(Collapse, {
|
|
164
|
+
in: this.state.rubricOpen,
|
|
165
|
+
timeout: "auto",
|
|
166
|
+
__self: this,
|
|
167
|
+
__source: {
|
|
168
|
+
fileName: _jsxFileName,
|
|
169
|
+
lineNumber: 96
|
|
170
|
+
}
|
|
171
|
+
}, rubricList)) : rubricList);
|
|
172
|
+
} else {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
Rubric.__initStatic();
|
|
178
|
+
const styles = () => ({
|
|
179
|
+
rubricCol: {
|
|
180
|
+
flex: '0 1 auto',
|
|
181
|
+
minWidth: 'fit-content'
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
var Main = withStyles(styles)(Rubric);
|
|
185
|
+
const React = _dll_react;
|
|
186
|
+
const ReactDOM = _dll_react_dom;
|
|
187
|
+
const {debounce: debounce} = _dll_lodash;
|
|
188
|
+
const debug = _dll_debug;
|
|
189
|
+
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
190
|
+
const log = debug('pie-element:rubric:print');
|
|
191
|
+
const preparePrintModel = (model, opts) => {
|
|
192
|
+
const instr = opts.role === 'instructor';
|
|
193
|
+
if (!instr) {
|
|
194
|
+
return {};
|
|
195
|
+
}
|
|
196
|
+
model.value = {
|
|
197
|
+
...model
|
|
198
|
+
};
|
|
199
|
+
model.mode = 'evaluate';
|
|
200
|
+
model.animationsDisabled = true;
|
|
201
|
+
return model;
|
|
202
|
+
};
|
|
203
|
+
class RubricPrint extends HTMLElement {
|
|
204
|
+
constructor() {
|
|
205
|
+
super();
|
|
206
|
+
this._options = null;
|
|
207
|
+
this._model = null;
|
|
208
|
+
this._session = [];
|
|
209
|
+
this._rerender = debounce(() => {
|
|
210
|
+
if (this._model && this._session) {
|
|
211
|
+
const printModel = preparePrintModel(this._model, this._options);
|
|
212
|
+
const element = this._options && React.createElement(Main, {
|
|
213
|
+
...printModel
|
|
214
|
+
});
|
|
215
|
+
ReactDOM.render(element, this, () => {
|
|
216
|
+
log('render complete - render math');
|
|
217
|
+
renderMath(this);
|
|
218
|
+
});
|
|
219
|
+
} else {
|
|
220
|
+
log('skip');
|
|
221
|
+
}
|
|
222
|
+
}, 50, {
|
|
223
|
+
leading: false,
|
|
224
|
+
trailing: true
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
set options(o) {
|
|
228
|
+
this._options = o;
|
|
229
|
+
}
|
|
230
|
+
set model(s) {
|
|
231
|
+
this._model = s;
|
|
232
|
+
this._rerender();
|
|
233
|
+
}
|
|
234
|
+
connectedCallback() {}
|
|
235
|
+
}
|
|
236
|
+
export {RubricPrint as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"description": "Rubric Scoring Interaction",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"author": "pie framework developers",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "a1c13d49a8db2188145733261dd177cfb6b617fb",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"postpublish": "../../scripts/postpublish"
|
|
20
20
|
},
|