@pie-element/rubric 1.6.3-next.135 → 1.6.3-next.1357
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 +250 -0
- package/configure/CHANGELOG.md +201 -0
- package/configure/lib/defaults.js +29 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +46 -9
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +98 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/package.json +3 -3
- package/configure/src/defaults.js +21 -0
- package/configure/src/index.js +35 -9
- package/configure/src/main.jsx +50 -0
- package/controller/CHANGELOG.md +38 -0
- package/controller/package.json +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js +22 -15
- package/lib/main.js.map +1 -1
- package/lib/print.js +114 -0
- package/lib/print.js.map +1 -0
- package/package.json +6 -2
- package/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +72 -72
- package/src/index.js +2 -1
- package/src/main.jsx +51 -40
- package/src/print.js +63 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireDefault(require("react"));
|
|
21
|
+
|
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
+
|
|
24
|
+
var _rubric = require("@pie-lib/rubric");
|
|
25
|
+
|
|
26
|
+
var _styles = require("@material-ui/core/styles");
|
|
27
|
+
|
|
28
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
29
|
+
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
31
|
+
|
|
32
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
|
+
|
|
34
|
+
var Panel = _configUi.settings.Panel,
|
|
35
|
+
toggle = _configUi.settings.toggle;
|
|
36
|
+
var styles = {
|
|
37
|
+
design: {
|
|
38
|
+
fontFamily: 'Cerebri Sans',
|
|
39
|
+
fontSize: '14px'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var Main = /*#__PURE__*/function (_React$Component) {
|
|
44
|
+
(0, _inherits2["default"])(Main, _React$Component);
|
|
45
|
+
|
|
46
|
+
var _super = _createSuper(Main);
|
|
47
|
+
|
|
48
|
+
function Main() {
|
|
49
|
+
(0, _classCallCheck2["default"])(this, Main);
|
|
50
|
+
return _super.apply(this, arguments);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
(0, _createClass2["default"])(Main, [{
|
|
54
|
+
key: "render",
|
|
55
|
+
value: function render() {
|
|
56
|
+
var _ref = this.props || {},
|
|
57
|
+
model = _ref.model,
|
|
58
|
+
classes = _ref.classes,
|
|
59
|
+
configuration = _ref.configuration,
|
|
60
|
+
onConfigurationChanged = _ref.onConfigurationChanged,
|
|
61
|
+
onModelChanged = _ref.onModelChanged;
|
|
62
|
+
|
|
63
|
+
var _ref2 = configuration || {},
|
|
64
|
+
settingsPanelDisabled = _ref2.settingsPanelDisabled,
|
|
65
|
+
showExcludeZero = _ref2.showExcludeZero,
|
|
66
|
+
showMaxPoint = _ref2.showMaxPoint;
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
|
+
className: classes.design
|
|
70
|
+
}, settingsPanelDisabled ? /*#__PURE__*/_react["default"].createElement(_rubric.Authoring, {
|
|
71
|
+
value: model,
|
|
72
|
+
onChange: onModelChanged
|
|
73
|
+
}) : /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
74
|
+
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
75
|
+
model: model,
|
|
76
|
+
onChangeModel: onModelChanged,
|
|
77
|
+
configuration: configuration,
|
|
78
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
79
|
+
groups: {
|
|
80
|
+
Properties: {
|
|
81
|
+
excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
|
|
82
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}, /*#__PURE__*/_react["default"].createElement(_rubric.Authoring, {
|
|
87
|
+
value: model,
|
|
88
|
+
onChange: onModelChanged
|
|
89
|
+
})));
|
|
90
|
+
}
|
|
91
|
+
}]);
|
|
92
|
+
return Main;
|
|
93
|
+
}(_react["default"].Component);
|
|
94
|
+
|
|
95
|
+
var _default = (0, _styles.withStyles)(styles)(Main);
|
|
96
|
+
|
|
97
|
+
exports["default"] = _default;
|
|
98
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","styles","design","fontFamily","fontSize","Main","props","model","classes","configuration","onConfigurationChanged","onModelChanged","settingsPanelDisabled","showExcludeZero","showMaxPoint","Properties","excludeZeroEnabled","label","maxPointsEnabled","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAQA,KAAR,GAA0BC,kBAA1B,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA0BD,kBAA1B,CAAeC,MAAf;AAEA,IAAMC,MAAM,GAAG;AACbC,EAAAA,MAAM,EAAE;AACNC,IAAAA,UAAU,EAAE,cADN;AAENC,IAAAA,QAAQ,EAAE;AAFJ;AADK,CAAf;;IAOMC,I;;;;;;;;;;;;WACJ,kBAAS;AACP,iBAAkF,KAAKC,KAAL,IAAc,EAAhG;AAAA,UAAQC,KAAR,QAAQA,KAAR;AAAA,UAAeC,OAAf,QAAeA,OAAf;AAAA,UAAwBC,aAAxB,QAAwBA,aAAxB;AAAA,UAAuCC,sBAAvC,QAAuCA,sBAAvC;AAAA,UAA+DC,cAA/D,QAA+DA,cAA/D;;AACA,kBAIIF,aAAa,IAAI,EAJrB;AAAA,UACEG,qBADF,SACEA,qBADF;AAAA,UAEEC,eAFF,SAEEA,eAFF;AAAA,UAGEC,YAHF,SAGEA,YAHF;;AAKA,0BACE;AAAK,QAAA,SAAS,EAAEN,OAAO,CAACN;AAAxB,SACGU,qBAAqB,gBAAG,gCAAC,iBAAD;AAAW,QAAA,KAAK,EAAEL,KAAlB;AAAyB,QAAA,QAAQ,EAAEI;AAAnC,QAAH,gBACpB,gCAAC,gBAAD,CAAQ,YAAR;AACE,QAAA,QAAQ,eACN,gCAAC,KAAD;AACE,UAAA,KAAK,EAAEJ,KADT;AAEE,UAAA,aAAa,EAAEI,cAFjB;AAGE,UAAA,aAAa,EAAEF,aAHjB;AAIE,UAAA,qBAAqB,EAAEC,sBAJzB;AAKE,UAAA,MAAM,EAAE;AACNK,YAAAA,UAAU,EAAE;AACVC,cAAAA,kBAAkB,EAAEH,eAAe,CAACd,QAAhB,IAA4BC,MAAM,CAACa,eAAe,CAACI,KAAjB,CAD5C;AAEVC,cAAAA,gBAAgB,EAAEJ,YAAY,CAACf,QAAb,IAAyBC,MAAM,CAACc,YAAY,CAACG,KAAd;AAFvC;AADN;AALV;AAFJ,sBAgBE,gCAAC,iBAAD;AAAW,QAAA,KAAK,EAAEV,KAAlB;AAAyB,QAAA,QAAQ,EAAEI;AAAnC,QAhBF,CAFJ,CADF;AAuBD;;;EA/BgBQ,kBAAMC,S;;eAkCV,wBAAWnB,MAAX,EAAmBI,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Authoring } from '@pie-lib/rubric';\nimport { withStyles } from '@material-ui/core/styles';\nimport { layout, settings } from '@pie-lib/config-ui';\n\nconst { Panel, toggle } = settings;\n\nconst styles = {\n design: {\n fontFamily: 'Cerebri Sans',\n fontSize: '14px',\n }\n};\n\nclass Main extends React.Component {\n render() {\n const { model, classes, configuration, onConfigurationChanged, onModelChanged } = this.props || {};\n const {\n settingsPanelDisabled,\n showExcludeZero,\n showMaxPoint\n } = configuration || {};\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? <Authoring value={model} onChange={onModelChanged} /> :\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Properties: {\n excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),\n maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),\n }\n }}\n />\n }\n >\n <Authoring value={model} onChange={onModelChanged} />\n </layout.ConfigLayout>}\n </div>\n )\n }\n}\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "Rubric authoring view",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"author": "Pie Framework Authors",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@pie-framework/pie-configure-events": "^1.
|
|
10
|
-
"@pie-lib/rubric": "
|
|
9
|
+
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
10
|
+
"@pie-lib/rubric": "0.5.4",
|
|
11
11
|
"debug": "^4.1.1",
|
|
12
12
|
"react": "^16.8.6",
|
|
13
13
|
"react-dom": "^16.8.6"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
model: {
|
|
3
|
+
points: ['', '', '', ''],
|
|
4
|
+
sampleAnswers: [null, null, null, null],
|
|
5
|
+
maxPoints: 4,
|
|
6
|
+
excludeZero: false,
|
|
7
|
+
excludeZeroEnabled: true,
|
|
8
|
+
maxPointsEnabled: true
|
|
9
|
+
},
|
|
10
|
+
configuration: {
|
|
11
|
+
showExcludeZero: {
|
|
12
|
+
settings: true,
|
|
13
|
+
label: 'Ability to exclude zero',
|
|
14
|
+
},
|
|
15
|
+
showMaxPoint: {
|
|
16
|
+
settings: true,
|
|
17
|
+
label: 'Show max points dropdown'
|
|
18
|
+
},
|
|
19
|
+
settingsPanelDisabled: false
|
|
20
|
+
}
|
|
21
|
+
};
|
package/configure/src/index.js
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
import { ModelUpdatedEvent } from '@pie-framework/pie-configure-events';
|
|
2
|
-
|
|
1
|
+
import { DeleteSoundEvent, InsertSoundEvent, ModelUpdatedEvent } from '@pie-framework/pie-configure-events';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import ReactDOM from 'react-dom';
|
|
5
|
-
import { Authoring } from '@pie-lib/rubric';
|
|
6
4
|
import debug from 'debug';
|
|
7
5
|
|
|
6
|
+
import Main from './main';
|
|
7
|
+
import defaults from './defaults';
|
|
8
|
+
|
|
9
|
+
const modelWithDefaults = m => ({ ...defaults.model, ...m });
|
|
10
|
+
const configurationWithDefaults = c => ({ ...defaults.configuration, ...c });
|
|
11
|
+
|
|
8
12
|
export default class RubricElement extends HTMLElement {
|
|
9
13
|
constructor() {
|
|
10
14
|
super();
|
|
11
15
|
debug.log('constructor called');
|
|
16
|
+
this._model = modelWithDefaults();
|
|
17
|
+
this._configuration = configurationWithDefaults();
|
|
12
18
|
this.onModelChanged = this.onModelChanged.bind(this);
|
|
19
|
+
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
13
20
|
}
|
|
14
21
|
|
|
15
|
-
set model(
|
|
16
|
-
this._model =
|
|
22
|
+
set model(m) {
|
|
23
|
+
this._model = modelWithDefaults(m);
|
|
24
|
+
this._render();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
set configuration(c) {
|
|
28
|
+
this._configuration = configurationWithDefaults(c);
|
|
17
29
|
this._render();
|
|
18
30
|
}
|
|
19
31
|
|
|
@@ -23,16 +35,30 @@ export default class RubricElement extends HTMLElement {
|
|
|
23
35
|
this.dispatchEvent(new ModelUpdatedEvent(this._model, false));
|
|
24
36
|
}
|
|
25
37
|
|
|
38
|
+
onConfigurationChanged = (c) => {
|
|
39
|
+
this._configuration = configurationWithDefaults(c);
|
|
40
|
+
|
|
41
|
+
if (this._model) {
|
|
42
|
+
this.onModelChanged(this._model);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this._render();
|
|
46
|
+
}
|
|
47
|
+
|
|
26
48
|
connectedCallback() {
|
|
27
49
|
this._render();
|
|
28
50
|
}
|
|
29
51
|
|
|
30
52
|
_render() {
|
|
31
53
|
if (this._model) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
54
|
+
let element = React.createElement(Main, {
|
|
55
|
+
model: this._model,
|
|
56
|
+
configuration: this._configuration,
|
|
57
|
+
onModelChanged: this.onModelChanged,
|
|
58
|
+
onConfigurationChanged: this.onConfigurationChanged,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
ReactDOM.render(element, this);
|
|
36
62
|
}
|
|
37
63
|
}
|
|
38
64
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Authoring } from '@pie-lib/rubric';
|
|
4
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
5
|
+
import { layout, settings } from '@pie-lib/config-ui';
|
|
6
|
+
|
|
7
|
+
const { Panel, toggle } = settings;
|
|
8
|
+
|
|
9
|
+
const styles = {
|
|
10
|
+
design: {
|
|
11
|
+
fontFamily: 'Cerebri Sans',
|
|
12
|
+
fontSize: '14px',
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class Main extends React.Component {
|
|
17
|
+
render() {
|
|
18
|
+
const { model, classes, configuration, onConfigurationChanged, onModelChanged } = this.props || {};
|
|
19
|
+
const {
|
|
20
|
+
settingsPanelDisabled,
|
|
21
|
+
showExcludeZero,
|
|
22
|
+
showMaxPoint
|
|
23
|
+
} = configuration || {};
|
|
24
|
+
return (
|
|
25
|
+
<div className={classes.design}>
|
|
26
|
+
{settingsPanelDisabled ? <Authoring value={model} onChange={onModelChanged} /> :
|
|
27
|
+
<layout.ConfigLayout
|
|
28
|
+
settings={
|
|
29
|
+
<Panel
|
|
30
|
+
model={model}
|
|
31
|
+
onChangeModel={onModelChanged}
|
|
32
|
+
configuration={configuration}
|
|
33
|
+
onChangeConfiguration={onConfigurationChanged}
|
|
34
|
+
groups={{
|
|
35
|
+
Properties: {
|
|
36
|
+
excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
|
|
37
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
38
|
+
}
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
<Authoring value={model} onChange={onModelChanged} />
|
|
44
|
+
</layout.ConfigLayout>}
|
|
45
|
+
</div>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default withStyles(styles)(Main);
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-controller@1.2.2...@pie-element/rubric-controller@1.2.4) (2021-11-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/rubric-controller
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-controller@1.2.2...@pie-element/rubric-controller@1.2.3) (2021-11-11)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/rubric-controller
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-controller@1.2.0...@pie-element/rubric-controller@1.2.2) (2021-08-05)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* force bump ([5ea7295](https://github.com/pie-framework/pie-elements/commit/5ea7295e4755fbc492a76e7ec69e5fc35b196919))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [1.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-controller@1.1.8...@pie-element/rubric-controller@1.2.0) (2021-06-29)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **rubric:** Added sample answers to the model - PD-621 ([#559](https://github.com/pie-framework/pie-elements/issues/559)) ([d436b47](https://github.com/pie-framework/pie-elements/commit/d436b47b1cb8dd7cfbd82dbd2de4dd5eab36905c))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
6
44
|
## [1.1.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-controller@1.1.6...@pie-element/rubric-controller@1.1.8) (2021-03-03)
|
|
7
45
|
|
|
8
46
|
**Note:** Version bump only for package @pie-element/rubric-controller
|
package/controller/package.json
CHANGED
package/lib/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
31
31
|
|
|
32
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
33
33
|
|
|
34
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
35
|
|
|
36
36
|
var RubricRender = /*#__PURE__*/function (_HTMLElement) {
|
|
37
37
|
(0, _inherits2["default"])(RubricRender, _HTMLElement);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["RubricRender","debug","log","onModelChanged","bind","s","_model","_render","m","el","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;IAGqBA,Y;;;;;AAEnB,0BAAc;AAAA;;AAAA;AACZ;;AACAC,sBAAMC,GAAN,CAAU,oBAAV;;AACA,UAAKC,cAAL,GAAsB,MAAKA,cAAL,CAAoBC,IAApB,gDAAtB;AAHY;AAIb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKE,OAAL;AACD;;;WAED,wBAAeC,CAAf,EAAkB;AAChB,WAAKF,MAAL,GAAcE,CAAd;;AACA,WAAKD,OAAL;AACD;;;WAED,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAED,mBAAU;AACR,UAAI,KAAKD,MAAT,EAAiB;AACf,YAAMG,EAAE,gBACN,gCAAC,gBAAD;AAAQ,UAAA,KAAK,EAAE,KAAKH;AAApB,UADF;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["RubricRender","debug","log","onModelChanged","bind","s","_model","_render","m","el","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;IAGqBA,Y;;;;;AAEnB,0BAAc;AAAA;;AAAA;AACZ;;AACAC,sBAAMC,GAAN,CAAU,oBAAV;;AACA,UAAKC,cAAL,GAAsB,MAAKA,cAAL,CAAoBC,IAApB,gDAAtB;AAHY;AAIb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKE,OAAL;AACD;;;WAED,wBAAeC,CAAf,EAAkB;AAChB,WAAKF,MAAL,GAAcE,CAAd;;AACA,WAAKD,OAAL;AACD;;;WAED,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAED,mBAAU;AACR,UAAI,KAAKD,MAAT,EAAiB;AACf,YAAMG,EAAE,gBACN,gCAAC,gBAAD;AAAQ,UAAA,KAAK,EAAE,KAAKH;AAApB,UADF;;AAIAI,6BAASC,MAAT,CAAgBF,EAAhB,EAAoB,IAApB;AACD;AACF;;;kDA9BuCG,W","sourcesContent":["import Rubric from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\n\n\nexport default class RubricRender extends HTMLElement {\n\n constructor() {\n super();\n debug.log('constructor called');\n this.onModelChanged = this.onModelChanged.bind(this);\n }\n\n set model(s) {\n this._model = s;\n this._render();\n }\n\n onModelChanged(m) {\n this._model = m;\n this._render();\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (this._model) {\n const el = (\n <Rubric value={this._model} />\n );\n\n ReactDOM.render(el, this);\n }\n }\n}\n"],"file":"index.js"}
|
package/lib/main.js
CHANGED
|
@@ -39,7 +39,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
39
39
|
|
|
40
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
41
|
|
|
42
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
43
|
|
|
44
44
|
var RubricType = _propTypes["default"].shape({
|
|
45
45
|
excludeZero: _propTypes["default"].bool,
|
|
@@ -92,29 +92,24 @@ var Rubric = /*#__PURE__*/function (_React$Component) {
|
|
|
92
92
|
|
|
93
93
|
var _this$props = this.props,
|
|
94
94
|
value = _this$props.value,
|
|
95
|
-
classes = _this$props.classes
|
|
95
|
+
classes = _this$props.classes,
|
|
96
|
+
animationsDisabled = _this$props.animationsDisabled;
|
|
96
97
|
|
|
97
98
|
if (value && value.points) {
|
|
98
99
|
var points = value.points,
|
|
99
100
|
sampleAnswers = value.sampleAnswers;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
103
|
-
href: this.dudUrl,
|
|
104
|
-
onClick: this.toggleRubric
|
|
105
|
-
}, this.state.linkPrefix, " Rubric"), /*#__PURE__*/_react["default"].createElement(_Collapse["default"], {
|
|
106
|
-
"in": this.state.rubricOpen,
|
|
107
|
-
timeout: "auto"
|
|
108
|
-
}, /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
101
|
+
|
|
102
|
+
var rubricList = /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
109
103
|
component: "nav"
|
|
110
|
-
}, points.map(function (desc, index) {
|
|
104
|
+
}, points.slice(0).reverse().map(function (desc, index) {
|
|
105
|
+
index = points.length - index - 1;
|
|
111
106
|
return _this2.shouldRenderPoint(index, value) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
112
107
|
key: index
|
|
113
108
|
}, /*#__PURE__*/_react["default"].createElement(_ListItem["default"], {
|
|
114
109
|
key: "P".concat(index)
|
|
115
110
|
}, /*#__PURE__*/_react["default"].createElement(_ListItemText["default"], {
|
|
116
111
|
className: classes.rubricCol,
|
|
117
|
-
primary: "".concat(index, " PTS")
|
|
112
|
+
primary: index === 1 ? "".concat(index, " PT") : "".concat(index, " PTS")
|
|
118
113
|
}), /*#__PURE__*/_react["default"].createElement(_ListItemText["default"], {
|
|
119
114
|
primary: /*#__PURE__*/_react["default"].createElement("div", {
|
|
120
115
|
dangerouslySetInnerHTML: {
|
|
@@ -136,7 +131,17 @@ var Rubric = /*#__PURE__*/function (_React$Component) {
|
|
|
136
131
|
}
|
|
137
132
|
})
|
|
138
133
|
})));
|
|
139
|
-
}))
|
|
134
|
+
}));
|
|
135
|
+
|
|
136
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
137
|
+
className: classes.root
|
|
138
|
+
}, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
139
|
+
href: this.dudUrl,
|
|
140
|
+
onClick: this.toggleRubric
|
|
141
|
+
}, this.state.linkPrefix, " Rubric"), /*#__PURE__*/_react["default"].createElement(_Collapse["default"], {
|
|
142
|
+
"in": this.state.rubricOpen,
|
|
143
|
+
timeout: "auto"
|
|
144
|
+
}, rubricList)) : rubricList);
|
|
140
145
|
} else {
|
|
141
146
|
return null;
|
|
142
147
|
}
|
|
@@ -147,13 +152,15 @@ var Rubric = /*#__PURE__*/function (_React$Component) {
|
|
|
147
152
|
|
|
148
153
|
(0, _defineProperty2["default"])(Rubric, "propTypes", {
|
|
149
154
|
classes: _propTypes["default"].object.isRequired,
|
|
155
|
+
animationsDisabled: _propTypes["default"].bool,
|
|
150
156
|
value: RubricType
|
|
151
157
|
});
|
|
152
158
|
|
|
153
159
|
var styles = function styles() {
|
|
154
160
|
return {
|
|
155
161
|
rubricCol: {
|
|
156
|
-
flex: '0 1 auto'
|
|
162
|
+
flex: '0 1 auto',
|
|
163
|
+
minWidth: 'fit-content'
|
|
157
164
|
}
|
|
158
165
|
};
|
|
159
166
|
};
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["RubricType","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","Rubric","props","index","value","state","rubricOpen","linkPrefix","toggleRubric","bind","setState","classes","
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["RubricType","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","Rubric","props","index","value","state","rubricOpen","linkPrefix","toggleRubric","bind","setState","classes","animationsDisabled","rubricList","slice","reverse","map","desc","length","shouldRenderPoint","rubricCol","__html","marginLeft","root","dudUrl","React","Component","object","isRequired","styles","flex","minWidth"],"mappings":"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","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport ListItem from '@material-ui/core/ListItem';\nimport List from '@material-ui/core/List';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Link from '@material-ui/core/Link';\nimport Collapse from '@material-ui/core/Collapse';\nimport PropTypes from 'prop-types';\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n});\n\nclass Rubric extends React.Component {\n dudUrl = 'javascript:;';\n\n constructor(props) {\n super(props);\n this.state = {\n rubricOpen: false,\n linkPrefix: 'Show',\n };\n this.toggleRubric = this.toggleRubric.bind(this);\n }\n\n static propTypes = {\n classes: PropTypes.object.isRequired,\n animationsDisabled: PropTypes.bool,\n value: RubricType,\n };\n\n toggleRubric() {\n this.setState({ rubricOpen: !this.state.rubricOpen });\n this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });\n }\n\n shouldRenderPoint = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n return index !== 0;\n }\n };\n\n render() {\n const { value, classes, animationsDisabled } = this.props;\n\n if (value && value.points) {\n const { points, sampleAnswers } = value;\n\n const rubricList = <List component=\"nav\">\n {points.slice(0).reverse().map(\n (desc, index) => {\n index = points.length - index - 1;\n return this.shouldRenderPoint(index, value) && (\n <React.Fragment key={index}>\n <ListItem key={`P${index}`}>\n <ListItemText\n className={classes.rubricCol}\n primary={index === 1 ? `${index} PT` : `${index} PTS`}\n />\n <ListItemText\n primary={\n <div dangerouslySetInnerHTML={{ __html: desc }} />\n }\n />\n </ListItem>\n {sampleAnswers && sampleAnswers[index] && (\n <ListItem key={`S${index}`}>\n <ListItemText\n className={classes.rubricCol}\n style={{marginLeft: '20px'}}\n primary={'Sample Answer'}\n />\n <ListItemText\n primary={\n <div dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />\n }\n />\n </ListItem>\n )}\n </React.Fragment>\n )\n })}\n </List>;\n\n return (\n <div className={classes.root}>\n {!animationsDisabled ?\n <React.Fragment>\n <Link href={this.dudUrl} onClick={this.toggleRubric}>\n {this.state.linkPrefix} Rubric\n </Link>\n <Collapse in={this.state.rubricOpen} timeout=\"auto\">\n {rubricList}\n </Collapse>\n </React.Fragment>\n : rubricList\n }\n </div>\n );\n } else {\n return null;\n }\n }\n}\n\nconst styles = () => ({\n rubricCol: {\n flex: '0 1 auto',\n minWidth: 'fit-content'\n },\n});\n\nexport default withStyles(styles)(Rubric);\n"],"file":"main.js"}
|
package/lib/print.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
29
|
+
|
|
30
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
31
|
+
|
|
32
|
+
var _main = _interopRequireDefault(require("./main"));
|
|
33
|
+
|
|
34
|
+
var _mathRendering = require("@pie-lib/math-rendering");
|
|
35
|
+
|
|
36
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
37
|
+
|
|
38
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
39
|
+
|
|
40
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
|
+
|
|
42
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
43
|
+
|
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
45
|
+
|
|
46
|
+
var log = (0, _debug["default"])('pie-element:rubric:print');
|
|
47
|
+
|
|
48
|
+
var preparePrintModel = function preparePrintModel(model, opts) {
|
|
49
|
+
var instr = opts.role === 'instructor';
|
|
50
|
+
|
|
51
|
+
if (!instr) {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
model.value = _objectSpread({}, model);
|
|
56
|
+
model.mode = 'evaluate';
|
|
57
|
+
model.animationsDisabled = true;
|
|
58
|
+
return model;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var RubricPrint = /*#__PURE__*/function (_HTMLElement) {
|
|
62
|
+
(0, _inherits2["default"])(RubricPrint, _HTMLElement);
|
|
63
|
+
|
|
64
|
+
var _super = _createSuper(RubricPrint);
|
|
65
|
+
|
|
66
|
+
function RubricPrint() {
|
|
67
|
+
var _this;
|
|
68
|
+
|
|
69
|
+
(0, _classCallCheck2["default"])(this, RubricPrint);
|
|
70
|
+
_this = _super.call(this);
|
|
71
|
+
_this._options = null;
|
|
72
|
+
_this._model = null;
|
|
73
|
+
_this._session = [];
|
|
74
|
+
_this._rerender = (0, _debounce["default"])(function () {
|
|
75
|
+
if (_this._model && _this._session) {
|
|
76
|
+
var printModel = preparePrintModel(_this._model, _this._options);
|
|
77
|
+
|
|
78
|
+
var element = _this._options && /*#__PURE__*/_react["default"].createElement(_main["default"], _objectSpread({}, printModel));
|
|
79
|
+
|
|
80
|
+
_reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this), function () {
|
|
81
|
+
log('render complete - render math');
|
|
82
|
+
(0, _mathRendering.renderMath)((0, _assertThisInitialized2["default"])(_this));
|
|
83
|
+
});
|
|
84
|
+
} else {
|
|
85
|
+
log('skip');
|
|
86
|
+
}
|
|
87
|
+
}, 50, {
|
|
88
|
+
leading: false,
|
|
89
|
+
trailing: true
|
|
90
|
+
});
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
(0, _createClass2["default"])(RubricPrint, [{
|
|
95
|
+
key: "options",
|
|
96
|
+
set: function set(o) {
|
|
97
|
+
this._options = o;
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "model",
|
|
101
|
+
set: function set(s) {
|
|
102
|
+
this._model = s;
|
|
103
|
+
|
|
104
|
+
this._rerender();
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "connectedCallback",
|
|
108
|
+
value: function connectedCallback() {}
|
|
109
|
+
}]);
|
|
110
|
+
return RubricPrint;
|
|
111
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
112
|
+
|
|
113
|
+
exports["default"] = RubricPrint;
|
|
114
|
+
//# sourceMappingURL=print.js.map
|
package/lib/print.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","value","mode","animationsDisabled","RubricPrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0BAAN,CAAZ;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;;AAEA,MAAI,CAACD,KAAL,EAAY;AACV,WAAO,EAAP;AACD;;AAEDF,EAAAA,KAAK,CAACI,KAAN,qBAAmBJ,KAAnB;AACAA,EAAAA,KAAK,CAACK,IAAN,GAAa,UAAb;AACAL,EAAAA,KAAK,CAACM,kBAAN,GAA2B,IAA3B;AAEA,SAAON,KAAP;AACD,CAZD;;IAcqBO,W;;;;;AACnB,yBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AACA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAGb,iBAAiB,CAAC,MAAKU,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,oBACKJ,UADL,EAFF;;AAMAK,6BAASC,MAAT,CAAgBL,OAAhB,kDAA+B,YAAM;AACnCf,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAbD,MAaO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAlBc,EAmBf,EAnBe,EAoBf;AAAEqB,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KApBe,CAAjB;AALY;AA2Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKb,QAAL,GAAgBa,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKb,MAAL,GAAca,CAAd;;AACA,WAAKX,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAtCiBY,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true }\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric",
|
|
3
|
-
"version": "1.6.3-next.
|
|
3
|
+
"version": "1.6.3-next.1357+42d700e42",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"description": "Rubric Scoring Interaction",
|
|
@@ -14,8 +14,12 @@
|
|
|
14
14
|
},
|
|
15
15
|
"author": "pie framework developers",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "42d700e42127ea8ccd3e7b4f069d918abb490f15",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"postpublish": "../../scripts/postpublish"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": "./src/index.js",
|
|
23
|
+
"./print": "./src/print.js"
|
|
20
24
|
}
|
|
21
25
|
}
|