@pie-element/complex-rubric 0.0.2-next.4424 → 0.1.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.
Files changed (204) hide show
  1. package/dist/author/defaults.d.ts +232 -0
  2. package/dist/author/defaults.d.ts.map +1 -0
  3. package/dist/author/defaults.js +177 -0
  4. package/dist/author/index.d.ts +35 -0
  5. package/dist/author/index.d.ts.map +1 -0
  6. package/dist/author/index.js +86 -0
  7. package/dist/author/main.d.ts +24 -0
  8. package/dist/author/main.d.ts.map +1 -0
  9. package/dist/author/main.js +106 -0
  10. package/dist/controller/defaults.d.ts +40 -0
  11. package/dist/controller/defaults.d.ts.map +1 -0
  12. package/dist/controller/defaults.js +42 -0
  13. package/dist/controller/index.d.ts +26 -0
  14. package/dist/controller/index.d.ts.map +1 -0
  15. package/dist/controller/index.js +107 -0
  16. package/dist/controller/utils.d.ts +10 -0
  17. package/dist/controller/utils.d.ts.map +1 -0
  18. package/dist/controller/utils.js +4 -0
  19. package/dist/delivery/index.d.ts +24 -0
  20. package/dist/delivery/index.d.ts.map +1 -0
  21. package/dist/delivery/index.js +96 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.iife.d.ts +9 -0
  25. package/dist/index.iife.d.ts.map +1 -0
  26. package/dist/index.iife.js +145 -0
  27. package/dist/index.js +2 -0
  28. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  29. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
  30. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  31. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  32. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  33. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  34. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  35. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  36. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
  37. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
  38. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  39. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  40. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  41. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  42. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  43. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  44. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  45. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  46. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  47. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
  48. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  49. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  50. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  51. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  52. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  53. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
  54. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  55. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
  56. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
  57. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  58. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
  59. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +16 -0
  60. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  61. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
  62. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  63. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  64. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  65. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  66. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  67. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  68. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  69. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  70. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  71. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  72. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  73. package/dist/print/index.d.ts +25 -0
  74. package/dist/print/index.d.ts.map +1 -0
  75. package/dist/print/index.js +84 -0
  76. package/package.json +65 -16
  77. package/src/author/defaults.tsx +223 -0
  78. package/{configure/src/index.js → src/author/index.ts} +69 -28
  79. package/src/author/main.tsx +172 -0
  80. package/src/controller/defaults.ts +49 -0
  81. package/src/controller/index.ts +230 -0
  82. package/src/controller/utils.ts +13 -0
  83. package/src/{index.js → delivery/index.ts} +65 -9
  84. package/src/index.iife.ts +16 -0
  85. package/src/index.ts +1 -0
  86. package/src/print/index.ts +150 -0
  87. package/LICENSE.md +0 -5
  88. package/README.md +0 -3
  89. package/configure/lib/defaults.js +0 -99
  90. package/configure/lib/defaults.js.map +0 -1
  91. package/configure/lib/index.js +0 -232
  92. package/configure/lib/index.js.map +0 -1
  93. package/configure/lib/main.js +0 -165
  94. package/configure/lib/main.js.map +0 -1
  95. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +0 -1
  96. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +0 -376
  97. package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +0 -5
  98. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +0 -55
  99. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +0 -1
  100. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +0 -344
  101. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +0 -455
  102. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +0 -1
  103. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +0 -82
  104. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +0 -1
  105. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +0 -112
  106. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +0 -1
  107. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +0 -438
  108. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +0 -1
  109. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +0 -324
  110. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +0 -1
  111. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +0 -490
  112. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +0 -1
  113. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +0 -334
  114. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +0 -1
  115. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +0 -254
  116. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +0 -1
  117. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +0 -29
  118. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +0 -1
  119. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +0 -22
  120. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +0 -1
  121. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +0 -66
  122. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +0 -9
  123. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +0 -1
  124. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +0 -122
  125. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +0 -1
  126. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +0 -15
  127. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +0 -226
  128. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +0 -169
  129. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +0 -8
  130. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +0 -108
  131. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +0 -1
  132. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +0 -6
  133. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +0 -282
  134. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +0 -189
  135. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +0 -85
  136. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +0 -1
  137. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +0 -99
  138. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +0 -1
  139. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +0 -209
  140. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +0 -1
  141. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +0 -103
  142. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +0 -1
  143. package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +0 -24
  144. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
  145. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +0 -731
  146. package/configure/node_modules/@pie-element/rubric/LICENSE.md +0 -5
  147. package/configure/node_modules/@pie-element/rubric/README.md +0 -3
  148. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +0 -197
  149. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +0 -615
  150. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +0 -93
  151. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +0 -1
  152. package/configure/node_modules/@pie-element/rubric/configure/package.json +0 -16
  153. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +0 -38
  154. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +0 -17
  155. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +0 -105
  156. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +0 -14
  157. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +0 -1
  158. package/configure/node_modules/@pie-element/rubric/controller/package.json +0 -9
  159. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +0 -35
  160. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +0 -6
  161. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +0 -24
  162. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +0 -19
  163. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +0 -8
  164. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +0 -8
  165. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +0 -3
  166. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +0 -62
  167. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +0 -35
  168. package/configure/node_modules/@pie-element/rubric/lib/index.js +0 -88
  169. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +0 -1
  170. package/configure/node_modules/@pie-element/rubric/lib/main.js +0 -171
  171. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +0 -1
  172. package/configure/node_modules/@pie-element/rubric/lib/print.js +0 -114
  173. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +0 -1
  174. package/configure/node_modules/@pie-element/rubric/package.json +0 -25
  175. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -22767
  176. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +0 -48
  177. package/configure/node_modules/@pie-element/rubric/src/index.js +0 -38
  178. package/configure/node_modules/@pie-element/rubric/src/main.jsx +0 -117
  179. package/configure/node_modules/@pie-element/rubric/src/print.js +0 -63
  180. package/configure/package.json +0 -22
  181. package/configure/src/__tests__/__snapshots__/main.test.jsx.snap +0 -106
  182. package/configure/src/__tests__/index.test.js +0 -41
  183. package/configure/src/__tests__/main.test.jsx +0 -104
  184. package/configure/src/defaults.js +0 -122
  185. package/configure/src/main.jsx +0 -117
  186. package/controller/lib/defaults.js +0 -99
  187. package/controller/lib/defaults.js.map +0 -1
  188. package/controller/lib/index.js +0 -147
  189. package/controller/lib/index.js.map +0 -1
  190. package/controller/package.json +0 -12
  191. package/controller/src/__tests__/index.test.js +0 -58
  192. package/controller/src/defaults.js +0 -121
  193. package/controller/src/index.js +0 -81
  194. package/docs/config-schema.json +0 -427
  195. package/docs/config-schema.json.md +0 -315
  196. package/docs/demo/config.js +0 -8
  197. package/docs/demo/generate.js +0 -119
  198. package/docs/demo/index.html +0 -1
  199. package/docs/demo/session.js +0 -6
  200. package/docs/pie-schema.json +0 -994
  201. package/docs/pie-schema.json.md +0 -660
  202. package/lib/index.js +0 -176
  203. package/lib/index.js.map +0 -1
  204. package/src/__tests__/index.test.js +0 -166
@@ -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
- }
@@ -1,22 +0,0 @@
1
- {
2
- "name": "@pie-element/complex-rubric-configure",
3
- "private": true,
4
- "version": "0.0.1",
5
- "description": "Complex Rubric authoring view",
6
- "main": "lib/index.js",
7
- "module": "src/index.js",
8
- "author": "Pie Framework Authors",
9
- "dependencies": {
10
- "@pie-framework/pie-configure-events": "^1.2.0",
11
- "@pie-element/multi-trait-rubric": "^2.0.7",
12
- "@pie-element/rubric": "^2.0.7",
13
- "@pie-lib/rubric": "^0.4.39",
14
- "@material-ui/core": "^3.9.2",
15
- "debug": "^4.1.1",
16
- "react": "^16.8.6",
17
- "react-dom": "^16.8.6",
18
- "prop-types": "^15.6.2",
19
- "lodash": "^4.17.15"
20
- },
21
- "license": "ISC"
22
- }
@@ -1,106 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Main snapshot renders 1`] = `
4
- <div>
5
- <div>
6
- <div>
7
- <RadioGroup
8
- aria-label="rubric-type"
9
- defaultValue="simpleRubric"
10
- name="rubricType"
11
- onChange={[Function]}
12
- value="simpleRubric"
13
- >
14
- <WithStyles(WithFormControlContext(FormControlLabel))
15
- checked={true}
16
- control={<WithStyles(Radio) />}
17
- label="Simple Rubric"
18
- value="simpleRubric"
19
- />
20
- <WithStyles(WithFormControlContext(FormControlLabel))
21
- checked={false}
22
- control={<WithStyles(Radio) />}
23
- label="Multi Trait Rubric"
24
- value="multiTraitRubric"
25
- />
26
- </RadioGroup>
27
- </div>
28
- <div>
29
- <rubric-configure
30
- id="simpleRubric"
31
- key="simple-rubric"
32
- />
33
- </div>
34
- </div>
35
- </div>
36
- `;
37
-
38
- exports[`Main snapshot renders multi trait rubric 1`] = `
39
- <div>
40
- <div>
41
- <div>
42
- <RadioGroup
43
- aria-label="rubric-type"
44
- defaultValue="simpleRubric"
45
- name="rubricType"
46
- onChange={[Function]}
47
- value="multiTraitRubric"
48
- >
49
- <WithStyles(WithFormControlContext(FormControlLabel))
50
- checked={false}
51
- control={<WithStyles(Radio) />}
52
- label="Simple Rubric"
53
- value="simpleRubric"
54
- />
55
- <WithStyles(WithFormControlContext(FormControlLabel))
56
- checked={true}
57
- control={<WithStyles(Radio) />}
58
- label="Multi Trait Rubric"
59
- value="multiTraitRubric"
60
- />
61
- </RadioGroup>
62
- </div>
63
- <div>
64
- <multi-trait-rubric-configure
65
- id="multiTraitRubric"
66
- key="multi-trait-rubric"
67
- />
68
- </div>
69
- </div>
70
- </div>
71
- `;
72
-
73
- exports[`Main snapshot renders simple rubric 1`] = `
74
- <div>
75
- <div>
76
- <div>
77
- <RadioGroup
78
- aria-label="rubric-type"
79
- defaultValue="simpleRubric"
80
- name="rubricType"
81
- onChange={[Function]}
82
- value="simpleRubric"
83
- >
84
- <WithStyles(WithFormControlContext(FormControlLabel))
85
- checked={true}
86
- control={<WithStyles(Radio) />}
87
- label="Simple Rubric"
88
- value="simpleRubric"
89
- />
90
- <WithStyles(WithFormControlContext(FormControlLabel))
91
- checked={false}
92
- control={<WithStyles(Radio) />}
93
- label="Multi Trait Rubric"
94
- value="multiTraitRubric"
95
- />
96
- </RadioGroup>
97
- </div>
98
- <div>
99
- <rubric-configure
100
- id="simpleRubric"
101
- key="simple-rubric"
102
- />
103
- </div>
104
- </div>
105
- </div>
106
- `;
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
-
4
- import defaults from '../defaults';
5
-
6
- jest.mock('@pie-lib/config-ui', () => ({
7
- settings: {
8
- Panel: props => <div {...props} />,
9
- toggle: jest.fn(),
10
- radio: jest.fn()
11
- }
12
- }));
13
-
14
- const model = () => ({ ...defaults.model });
15
-
16
- jest.mock('react-dom', () => ({
17
- render: jest.fn()
18
- }));
19
-
20
- describe('index', () => {
21
- let Def;
22
- let el;
23
- let onModelChanged = jest.fn();
24
- let initialModel = model();
25
-
26
- beforeAll(() => {
27
- Def = require('../index').default;
28
- });
29
-
30
- beforeEach(() => {
31
- el = new Def();
32
- el.model = initialModel;
33
- el.onModelChanged = onModelChanged;
34
- });
35
-
36
- describe('set model', () => {
37
- it('calls ReactDOM.render', () => {
38
- expect(ReactDOM.render).toHaveBeenCalled();
39
- });
40
- });
41
- });
@@ -1,104 +0,0 @@
1
- import { shallow } from 'enzyme';
2
- import React from 'react';
3
- import { Main } from '@pie-element/complex-rubric-configure/src/main';
4
-
5
- import defaults from '../defaults';
6
-
7
- jest.mock('@pie-lib/rubric', () => ({
8
- RUBRIC_TYPES: {
9
- SIMPLE_RUBRIC: 'simpleRubric',
10
- MULTI_TRAIT_RUBRIC: 'multiTraitRubric'
11
- }
12
- }));
13
-
14
- const model = (extras) => ({
15
- id: '1',
16
- element: 'complex-rubric',
17
- ...defaults.model,
18
- ...extras
19
- });
20
-
21
- describe('Main', () => {
22
- let initialModel = model();
23
- let onModelChanged = jest.fn();
24
- let onConfigurationChanged = jest.fn();
25
-
26
- const wrapper = extras => {
27
- const defaults = {
28
- onModelChanged,
29
- onConfigurationChanged,
30
- classes: {},
31
- model: model(extras),
32
- configuration: {
33
- multiTraitrubric: {
34
- showStandards: {
35
- settings: false,
36
- label: 'Show Standards',
37
- enabled: false
38
- },
39
- showExcludeZero: {
40
- settings: true,
41
- label: 'Exclude Zero',
42
- enabled: false
43
- },
44
- showScorePointLabels: {
45
- settings: true,
46
- label: 'Show Score Point Labels',
47
- enabled: false
48
- },
49
- showLevelTagInput: {
50
- settings: true,
51
- label: 'Show Level Tag Input',
52
- enabled: false
53
- },
54
- showDescription: {
55
- settings: true,
56
- label: 'Show Description',
57
- enabled: false
58
- },
59
- showVisibleToStudent: {
60
- settings: true,
61
- label: 'Visible to Student',
62
- enabled: false
63
- },
64
- showHalfScoring: {
65
- settings: true,
66
- label: 'Half Scoring',
67
- enabled: false
68
- },
69
- dragAndDrop: {
70
- settings: false,
71
- label: 'Enable Drag and Drop',
72
- enabled: false,
73
- }
74
- }
75
- },
76
- };
77
- const props = { ...defaults };
78
-
79
- return shallow(<Main {...props} />);
80
- };
81
-
82
- describe('snapshot', () => {
83
- it('renders', () => {
84
- const w = wrapper();
85
- expect(w).toMatchSnapshot();
86
- });
87
-
88
- it('renders simple rubric', () => {
89
- const w = wrapper({ rubricType: 'simpleRubric' });
90
- expect(w).toMatchSnapshot();
91
- });
92
-
93
- it('renders multi trait rubric', () => {
94
- const w = wrapper({ rubricType: 'multiTraitRubric' });
95
- expect(w).toMatchSnapshot();
96
- });
97
-
98
- it('calls onModelChange when changing rubric type', () => {
99
- const w = wrapper();
100
- w.instance().onChangeRubricType({ target: { value: 'multiTraitRubric' } });
101
- expect(onModelChanged).toBeCalledWith({ ...initialModel, rubricType: 'multiTraitRubric' });
102
- });
103
- });
104
- });
@@ -1,122 +0,0 @@
1
- const multiTraitDefaultModel = {
2
- visibleToStudent: true,
3
- halfScoring: false,
4
- pointLabels: true,
5
- description: false,
6
- standards: false,
7
- scales: [],
8
- excludeZero: false,
9
- };
10
-
11
- const rubricDefaultModel = {
12
- points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
13
- sampleAnswers: [null, 'just right', 'not left', null],
14
- maxPoints: 4,
15
- excludeZero: false
16
- };
17
-
18
- const multiTraitDefaultConfiguration = {
19
- settingsPanelDisabled: true,
20
- excludeZeroDialogBoxContent: {
21
- title: 'Exclude 0 (Zero) from Score Point Values.',
22
- text: `<div>
23
- You are about to exclude 0 from score point values.
24
- <br/>
25
- Some of the existing data has to be changed.
26
- <br/>
27
- Please choose if you want to:
28
- <ul>
29
- <li>
30
- shift Labels and Descriptions to the left
31
- </li>
32
- <li>
33
- remove 0 column with its Label and Description
34
- </li>
35
- </ul>
36
- </div>`
37
- },
38
- includeZeroDialogBoxContent: {
39
- title: 'Include 0 (Zero) in Score Point Values.',
40
- text: `<div>
41
- You are about to include 0 in score point values.
42
- <br/>
43
- Some of the existing data has to be changed.
44
- <br/>
45
- Please choose if you want to:
46
- <ul>
47
- <li>
48
- shift Labels and Descriptions to the right
49
- </li>
50
- <li>
51
- add 0 column with empty Label and Descriptions
52
- </li>
53
- </ul>
54
- </div>`
55
- },
56
- deleteTraitDialogBoxContent: {
57
- title: 'Delete Trait',
58
- text: 'Are you sure you want to delete this trait?'
59
- },
60
- deleteScaleDialogBoxContent: {
61
- title: 'Delete Scale',
62
- text: 'Are you sure you want to delete this scale?'
63
- },
64
- maxPointsDialogBoxContent: {
65
- title: 'Decreasing Max Points.',
66
- text: ` You are about to decrease max score point value.
67
- <br/>
68
- All the Labels and Descriptions for scores above Max Point will be deleted.`
69
- },
70
- spellCheck: {
71
- label: 'Spellcheck',
72
- settings: false,
73
- enabled: true
74
- },
75
- showExcludeZero: {
76
- settings: true,
77
- label: 'Exclude Zero',
78
- },
79
- showScorePointLabels: {
80
- settings: true,
81
- label: 'Show Score Point Labels',
82
- },
83
- showDescription: {
84
- settings: true,
85
- label: 'Show Description',
86
- },
87
- showVisibleToStudent: {
88
- settings: true,
89
- label: 'Visible to Student',
90
- },
91
- showHalfScoring: {
92
- settings: true,
93
- label: 'Half Scoring',
94
- },
95
- width: '900px',
96
- // these should not be set to true (should not be used) for now
97
- showStandards: {
98
- settings: false,
99
- label: 'Show Standards',
100
- },
101
- showLevelTagInput: {
102
- settings: false,
103
- label: 'Show Level Tag Input',
104
- enabled: false
105
- },
106
- dragAndDrop: {
107
- settings: true,
108
- label: 'Enable Drag and Drop',
109
- enabled: false,
110
- }
111
- };
112
-
113
- export default {
114
- model: {
115
- rubricType: 'simpleRubric',
116
- rubrics: { simpleRubric: rubricDefaultModel, multiTraitRubric: multiTraitDefaultModel }
117
- },
118
- configuration: {
119
- multiTraitRubric: multiTraitDefaultConfiguration
120
- }
121
- };
122
-