@pie-element/complex-rubric 0.0.2-next.4424
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/LICENSE.md +5 -0
- package/README.md +3 -0
- package/configure/lib/defaults.js +99 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +232 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +165 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +376 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +344 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +455 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +82 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +112 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +438 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +324 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +490 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +334 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +254 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +29 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +22 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +66 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +9 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +122 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +15 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +226 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +169 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +108 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +282 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +189 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +85 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +99 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +209 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +103 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +24 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +731 -0
- package/configure/node_modules/@pie-element/rubric/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/rubric/README.md +3 -0
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +615 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +93 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/package.json +16 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/index.js +38 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +105 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +14 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/controller/package.json +9 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +35 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/index.js +6 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +24 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +19 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +3 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +62 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +35 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js +88 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js +171 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js +114 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/package.json +25 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +22767 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +48 -0
- package/configure/node_modules/@pie-element/rubric/src/index.js +38 -0
- package/configure/node_modules/@pie-element/rubric/src/main.jsx +117 -0
- package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
- package/configure/package.json +22 -0
- package/configure/src/__tests__/__snapshots__/main.test.jsx.snap +106 -0
- package/configure/src/__tests__/index.test.js +41 -0
- package/configure/src/__tests__/main.test.jsx +104 -0
- package/configure/src/defaults.js +122 -0
- package/configure/src/index.js +138 -0
- package/configure/src/main.jsx +117 -0
- package/controller/lib/defaults.js +99 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +147 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +12 -0
- package/controller/src/__tests__/index.test.js +58 -0
- package/controller/src/defaults.js +121 -0
- package/controller/src/index.js +81 -0
- package/docs/config-schema.json +427 -0
- package/docs/config-schema.json.md +315 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +119 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +6 -0
- package/docs/pie-schema.json +994 -0
- package/docs/pie-schema.json.md +660 -0
- package/lib/index.js +176 -0
- package/lib/index.js.map +1 -0
- package/package.json +25 -0
- package/src/__tests__/index.test.js +166 -0
- package/src/index.js +106 -0
|
@@ -0,0 +1,99 @@
|
|
|
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 _scale = _interopRequireDefault(require("./scale"));
|
|
25
|
+
|
|
26
|
+
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); }; }
|
|
27
|
+
|
|
28
|
+
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; } }
|
|
29
|
+
|
|
30
|
+
var Main = /*#__PURE__*/function (_React$Component) {
|
|
31
|
+
(0, _inherits2["default"])(Main, _React$Component);
|
|
32
|
+
|
|
33
|
+
var _super = _createSuper(Main);
|
|
34
|
+
|
|
35
|
+
function Main() {
|
|
36
|
+
(0, _classCallCheck2["default"])(this, Main);
|
|
37
|
+
return _super.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
(0, _createClass2["default"])(Main, [{
|
|
41
|
+
key: "render",
|
|
42
|
+
value: function render() {
|
|
43
|
+
var model = this.props.model;
|
|
44
|
+
|
|
45
|
+
var _ref = model || {},
|
|
46
|
+
halfScoring = _ref.halfScoring,
|
|
47
|
+
scales = _ref.scales,
|
|
48
|
+
visible = _ref.visible,
|
|
49
|
+
pointLabels = _ref.pointLabels,
|
|
50
|
+
description = _ref.description,
|
|
51
|
+
standards = _ref.standards;
|
|
52
|
+
|
|
53
|
+
if (!scales || !visible) {
|
|
54
|
+
return /*#__PURE__*/_react["default"].createElement("div", null);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
58
|
+
style: {
|
|
59
|
+
fontFamily: 'Cerebri Sans'
|
|
60
|
+
}
|
|
61
|
+
}, halfScoring ? /*#__PURE__*/_react["default"].createElement("p", null, "* Half-point or in-between scores are permitted under this rubric.") : null, scales.map(function (scale, scaleIndex) {
|
|
62
|
+
return /*#__PURE__*/_react["default"].createElement(_scale["default"], {
|
|
63
|
+
key: "scale_".concat(scaleIndex),
|
|
64
|
+
scale: scale,
|
|
65
|
+
scaleIndex: scaleIndex,
|
|
66
|
+
showPointsLabels: pointLabels,
|
|
67
|
+
showDescription: description,
|
|
68
|
+
showStandards: standards
|
|
69
|
+
});
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
}]);
|
|
73
|
+
return Main;
|
|
74
|
+
}(_react["default"].Component);
|
|
75
|
+
|
|
76
|
+
Main.propTypes = {
|
|
77
|
+
model: _propTypes["default"].shape({
|
|
78
|
+
halfScoring: _propTypes["default"].bool,
|
|
79
|
+
scales: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
80
|
+
excludeZero: _propTypes["default"].bool,
|
|
81
|
+
maxPoints: _propTypes["default"].number,
|
|
82
|
+
scorePointsLabels: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
83
|
+
traitLabel: _propTypes["default"].string,
|
|
84
|
+
traits: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
85
|
+
name: _propTypes["default"].string,
|
|
86
|
+
description: _propTypes["default"].string,
|
|
87
|
+
scorePointsDescriptors: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
88
|
+
standards: _propTypes["default"].arrayOf(_propTypes["default"].string)
|
|
89
|
+
}))
|
|
90
|
+
})),
|
|
91
|
+
visible: _propTypes["default"].bool,
|
|
92
|
+
pointLabels: _propTypes["default"].bool,
|
|
93
|
+
description: _propTypes["default"].bool,
|
|
94
|
+
standards: _propTypes["default"].bool
|
|
95
|
+
})
|
|
96
|
+
};
|
|
97
|
+
var _default = Main;
|
|
98
|
+
exports["default"] = _default;
|
|
99
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Main","model","props","halfScoring","scales","visible","pointLabels","description","standards","fontFamily","map","scale","scaleIndex","React","Component","propTypes","PropTypes","shape","bool","arrayOf","excludeZero","maxPoints","number","scorePointsLabels","string","traitLabel","traits","name","scorePointsDescriptors"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;;;;;IAGMA,I;;;;;;;;;;;;WACJ,kBAAS;AACP,UAAOC,KAAP,GAAgB,KAAKC,KAArB,CAAOD,KAAP;;AACA,iBAA4EA,KAAK,IAAI,EAArF;AAAA,UAAOE,WAAP,QAAOA,W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ADwB;AAExCjB,QAAAA,WAAW,EAAES,sBAAUQ,MAFiB;AAGxCI,QAAAA,sBAAsB,EAAEZ,sBAAUG,OAAV,CAAkBH,sBAAUQ,MAA5B,CAHgB;AAIxChB,QAAAA,SAAS,EAAEQ,sBAAUG,OAAV,CAAkBH,sBAAUQ,MAA5B;AAJ6B,OAAhB,CAAlB;AALgC,KAAhB,CAAlB,CAFa;AAcrBnB,IAAAA,OAAO,EAAEW,sBAAUE,IAdE;AAerBZ,IAAAA,WAAW,EAAEU,sBAAUE,IAfF;AAgBrBX,IAAAA,WAAW,EAAES,sBAAUE,IAhBF;AAiBrBV,IAAAA,SAAS,EAAEQ,sBAAUE;AAjBA,GAAhB;AADQ,CAAjB;eAsBelB,I","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport Scale from './scale';\n\n\nclass Main extends React.Component {\n render() {\n const {model} = this.props;\n const {halfScoring, scales, visible, pointLabels, description, standards} = model || {};\n\n if (!scales || !visible) {\n return <div/>;\n }\n\n return (\n <div style={{fontFamily: 'Cerebri Sans'}}>\n {halfScoring ? <p>* Half-point or in-between scores are permitted under this rubric.</p> : null}\n {scales.map((scale, scaleIndex) => (\n <Scale\n key={`scale_${scaleIndex}`}\n scale={scale}\n scaleIndex={scaleIndex}\n showPointsLabels={pointLabels}\n showDescription={description}\n showStandards={standards}\n />\n ))}\n </div>\n );\n }\n}\n\nMain.propTypes = {\n model: PropTypes.shape({\n halfScoring: PropTypes.bool,\n scales: PropTypes.arrayOf(PropTypes.shape({\n excludeZero: PropTypes.bool,\n maxPoints: PropTypes.number,\n scorePointsLabels: PropTypes.arrayOf(PropTypes.string),\n traitLabel: PropTypes.string,\n traits: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string,\n description: PropTypes.string,\n scorePointsDescriptors: PropTypes.arrayOf(PropTypes.string),\n standards: PropTypes.arrayOf(PropTypes.string),\n }))\n })),\n visible: PropTypes.bool,\n pointLabels: PropTypes.bool,\n description: PropTypes.bool,\n standards: PropTypes.bool,\n })\n};\n\nexport default Main;\n"],"file":"main.js"}
|
|
@@ -0,0 +1,209 @@
|
|
|
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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
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 _react = _interopRequireDefault(require("react"));
|
|
23
|
+
|
|
24
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
+
|
|
26
|
+
var _styles = require("@material-ui/core/styles");
|
|
27
|
+
|
|
28
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
29
|
+
|
|
30
|
+
var _trait = _interopRequireDefault(require("./trait"));
|
|
31
|
+
|
|
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
|
+
|
|
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
|
+
|
|
36
|
+
var styles = function styles() {
|
|
37
|
+
return {
|
|
38
|
+
table: {
|
|
39
|
+
borderSpacing: 0,
|
|
40
|
+
marginBottom: '16px',
|
|
41
|
+
borderRadius: '4px',
|
|
42
|
+
color: _renderUi.color.text(),
|
|
43
|
+
fontSize: '14px',
|
|
44
|
+
lineHeight: '16px',
|
|
45
|
+
'& ul, ol': {
|
|
46
|
+
marginBlockStart: 0,
|
|
47
|
+
paddingInlineStart: '16px'
|
|
48
|
+
},
|
|
49
|
+
'& th': {
|
|
50
|
+
padding: '16px',
|
|
51
|
+
textAlign: 'left',
|
|
52
|
+
backgroundColor: _renderUi.color.secondaryBackground(),
|
|
53
|
+
verticalAlign: 'bottom'
|
|
54
|
+
},
|
|
55
|
+
'& th div': {
|
|
56
|
+
width: '200px'
|
|
57
|
+
},
|
|
58
|
+
'& td': {
|
|
59
|
+
width: '200px',
|
|
60
|
+
padding: '16px 8px',
|
|
61
|
+
verticalAlign: 'top'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
scorePointHeader: {
|
|
65
|
+
'& td': {
|
|
66
|
+
border: 0,
|
|
67
|
+
padding: 0,
|
|
68
|
+
textAlign: 'center',
|
|
69
|
+
minWidth: '200px'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
pointLabel: {
|
|
73
|
+
marginBottom: '4px'
|
|
74
|
+
},
|
|
75
|
+
scorePointValue: {
|
|
76
|
+
fontWeight: 'normal'
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var Scale = /*#__PURE__*/function (_React$Component) {
|
|
82
|
+
(0, _inherits2["default"])(Scale, _React$Component);
|
|
83
|
+
|
|
84
|
+
var _super = _createSuper(Scale);
|
|
85
|
+
|
|
86
|
+
function Scale() {
|
|
87
|
+
(0, _classCallCheck2["default"])(this, Scale);
|
|
88
|
+
return _super.apply(this, arguments);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
(0, _createClass2["default"])(Scale, [{
|
|
92
|
+
key: "render",
|
|
93
|
+
value: function render() {
|
|
94
|
+
var _this$props = this.props,
|
|
95
|
+
classes = _this$props.classes,
|
|
96
|
+
scale = _this$props.scale,
|
|
97
|
+
scaleIndex = _this$props.scaleIndex,
|
|
98
|
+
showDescription = _this$props.showDescription,
|
|
99
|
+
showPointsLabels = _this$props.showPointsLabels,
|
|
100
|
+
showStandards = _this$props.showStandards;
|
|
101
|
+
|
|
102
|
+
var _ref = scale || {},
|
|
103
|
+
excludeZero = _ref.excludeZero,
|
|
104
|
+
maxPoints = _ref.maxPoints,
|
|
105
|
+
traitLabel = _ref.traitLabel,
|
|
106
|
+
traits = _ref.traits,
|
|
107
|
+
scorePointsLabels = _ref.scorePointsLabels;
|
|
108
|
+
|
|
109
|
+
var scorePointsValues = [];
|
|
110
|
+
var descriptions;
|
|
111
|
+
var pointsLabels;
|
|
112
|
+
var standards;
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
// determining the score points values
|
|
116
|
+
for (var pointValue = maxPoints; pointValue >= excludeZero ? 1 : 0; pointValue -= 1) {
|
|
117
|
+
scorePointsValues.push(pointValue);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var _traits$reduce = traits.reduce(function (tcc, trait) {
|
|
121
|
+
return {
|
|
122
|
+
traitStandards: [].concat((0, _toConsumableArray2["default"])(tcc.traitStandards), (0, _toConsumableArray2["default"])(trait.standards || [])),
|
|
123
|
+
traitDescriptions: [].concat((0, _toConsumableArray2["default"])(tcc.traitDescriptions), (0, _toConsumableArray2["default"])(trait.description || []))
|
|
124
|
+
};
|
|
125
|
+
}, {
|
|
126
|
+
traitStandards: [],
|
|
127
|
+
traitDescriptions: []
|
|
128
|
+
}),
|
|
129
|
+
traitStandards = _traits$reduce.traitStandards,
|
|
130
|
+
traitDescriptions = _traits$reduce.traitDescriptions;
|
|
131
|
+
|
|
132
|
+
descriptions = showDescription && traitDescriptions.length;
|
|
133
|
+
pointsLabels = showPointsLabels && scorePointsLabels.length;
|
|
134
|
+
standards = showStandards && traitStandards.length;
|
|
135
|
+
} catch (e) {
|
|
136
|
+
descriptions = false;
|
|
137
|
+
pointsLabels = false;
|
|
138
|
+
standards = false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return /*#__PURE__*/_react["default"].createElement("table", {
|
|
142
|
+
key: "scale-".concat(scaleIndex),
|
|
143
|
+
className: classes.table
|
|
144
|
+
}, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
145
|
+
dangerouslySetInnerHTML: {
|
|
146
|
+
__html: traitLabel
|
|
147
|
+
}
|
|
148
|
+
})), standards ? /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("div", null, "Standard(s)")) : null, descriptions ? /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("div", null, "Description")) : null, scorePointsValues && scorePointsValues.map(function (scorePointValue, index) {
|
|
149
|
+
var pointLabel = ''; // to handle the case when there aren't enough labels
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
pointLabel = scorePointsLabels[scorePointsValues.length - index - 1] || '';
|
|
153
|
+
} catch (e) {
|
|
154
|
+
pointLabel = '';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
158
|
+
key: "table-header-".concat(index)
|
|
159
|
+
}, /*#__PURE__*/_react["default"].createElement("table", {
|
|
160
|
+
className: classes.scorePointHeader
|
|
161
|
+
}, /*#__PURE__*/_react["default"].createElement("thead", null, pointsLabels ? /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
162
|
+
className: classes.pointLabel,
|
|
163
|
+
dangerouslySetInnerHTML: {
|
|
164
|
+
__html: pointLabel
|
|
165
|
+
}
|
|
166
|
+
}))) : null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", {
|
|
167
|
+
className: classes.scorePointValue
|
|
168
|
+
}, scorePointValue === 1 ? "".concat(scorePointValue, " point") : "".concat(scorePointValue, " points"))))));
|
|
169
|
+
}))), /*#__PURE__*/_react["default"].createElement("tbody", null, traits && traits.map(function (trait, traitIndex) {
|
|
170
|
+
return /*#__PURE__*/_react["default"].createElement(_trait["default"], {
|
|
171
|
+
key: "trait_".concat(scaleIndex, "_").concat(traitIndex),
|
|
172
|
+
trait: trait,
|
|
173
|
+
traitIndex: traitIndex,
|
|
174
|
+
showDescription: !!descriptions,
|
|
175
|
+
showStandards: !!standards,
|
|
176
|
+
scaleIndex: scaleIndex,
|
|
177
|
+
scorePointsValues: scorePointsValues,
|
|
178
|
+
excludeZero: excludeZero
|
|
179
|
+
});
|
|
180
|
+
})));
|
|
181
|
+
}
|
|
182
|
+
}]);
|
|
183
|
+
return Scale;
|
|
184
|
+
}(_react["default"].Component);
|
|
185
|
+
|
|
186
|
+
Scale.propTypes = {
|
|
187
|
+
classes: _propTypes["default"].object,
|
|
188
|
+
scaleIndex: _propTypes["default"].number,
|
|
189
|
+
scale: _propTypes["default"].shape({
|
|
190
|
+
excludeZero: _propTypes["default"].bool,
|
|
191
|
+
maxPoints: _propTypes["default"].number,
|
|
192
|
+
scorePointsLabels: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
193
|
+
traitLabel: _propTypes["default"].string,
|
|
194
|
+
traits: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
195
|
+
name: _propTypes["default"].string,
|
|
196
|
+
standards: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
197
|
+
scorePointsDescriptors: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
198
|
+
description: _propTypes["default"].string
|
|
199
|
+
}))
|
|
200
|
+
}),
|
|
201
|
+
showPointsLabels: _propTypes["default"].bool,
|
|
202
|
+
showDescription: _propTypes["default"].bool,
|
|
203
|
+
showStandards: _propTypes["default"].bool
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
var _default = (0, _styles.withStyles)(styles)(Scale);
|
|
207
|
+
|
|
208
|
+
exports["default"] = _default;
|
|
209
|
+
//# sourceMappingURL=scale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scale.jsx"],"names":["styles","table","borderSpacing","marginBottom","borderRadius","color","text","fontSize","lineHeight","marginBlockStart","paddingInlineStart","padding","textAlign","backgroundColor","secondaryBackground","verticalAlign","width","scorePointHeader","border","minWidth","pointLabel","scorePointValue","fontWeight","Scale","props","classes","scale","scaleIndex","showDescription","showPointsLabels","showStandards","excludeZero","maxPoints","traitLabel","traits","scorePointsLabels","scorePointsValues","descriptions","pointsLabels","standards","pointValue","push","reduce","tcc","trait","traitStandards","traitDescriptions","description","length","e","__html","map","index","traitIndex","React","Component","propTypes","PropTypes","object","number","shape","bool","arrayOf","string","name","scorePointsDescriptors"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,aAAa,EAAE,CADV;AAELC,MAAAA,YAAY,EAAE,MAFT;AAGLC,MAAAA,YAAY,EAAE,KAHT;AAILC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EAJF;AAKLC,MAAAA,QAAQ,EAAE,MALL;AAMLC,MAAAA,UAAU,EAAE,MANP;AAQL,kBAAY;AACVC,QAAAA,gBAAgB,EAAE,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E,SALnB;AAME,UAAA,UAAU,EAAEZ,UANd;AAOE,UAAA,iBAAiB,EAAES,iBAPrB;AAQE,UAAA,WAAW,EAAEL;AARf,UADmB;AAAA,OAAX,CAFZ,CA1DF,CADF;AA6ED;;;EAhHiBuB,kBAAMC,S;;AAmH1BhC,KAAK,CAACiC,SAAN,GAAkB;AAChB/B,EAAAA,OAAO,EAAEgC,sBAAUC,MADH;AAEhB/B,EAAAA,UAAU,EAAE8B,sBAAUE,MAFN;AAGhBjC,EAAAA,KAAK,EAAE+B,sBAAUG,KAAV,CAAgB;AACrB7B,IAAAA,WAAW,EAAE0B,sBAAUI,IADF;AAErB7B,IAAAA,SAAS,EAAEyB,sBAAUE,MAFA;AAGrBxB,IAAAA,iBAAiB,EAAEsB,sBAAUK,OAAV,CAAkBL,sBAAUM,MAA5B,CAHE;AAIrB9B,IAAAA,UAAU,EAAEwB,sBAAUM,MAJD;AAKrB7B,IAAAA,MAAM,EAAEuB,sBAAUK,OAAV,CAAkBL,sBAAUG,KAAV,CAAgB;AACxCI,MAAAA,IAAI,EAAEP,sBAAUM,MADwB;AAExCxB,MAAAA,SAAS,EAAEkB,sBAAUK,OAAV,CAAkBL,sBAAUM,MAA5B,CAF6B;AAGxCE,MAAAA,sBAAsB,EAAER,sBAAUK,OAAV,CAAkBL,sBAAUM,MAA5B,CAHgB;AAIxChB,MAAAA,WAAW,EAAEU,sBAAUM;AAJiB,KAAhB,CAAlB;AALa,GAAhB,CAHS;AAehBlC,EAAAA,gBAAgB,EAAE4B,sBAAUI,IAfZ;AAgBhBjC,EAAAA,eAAe,EAAE6B,sBAAUI,IAhBX;AAiBhB/B,EAAAA,aAAa,EAAE2B,sBAAUI;AAjBT,CAAlB;;eAoBe,wBAAW7D,MAAX,EAAmBuB,KAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {withStyles} from '@material-ui/core/styles';\nimport {color} from '@pie-lib/render-ui';\nimport Trait from './trait';\n\n\nconst styles = () => ({\n table: {\n borderSpacing: 0,\n marginBottom: '16px',\n borderRadius: '4px',\n color: color.text(),\n fontSize: '14px',\n lineHeight: '16px',\n\n '& ul, ol': {\n marginBlockStart: 0,\n paddingInlineStart: '16px'\n },\n\n '& th': {\n padding: '16px',\n textAlign: 'left',\n backgroundColor: color.secondaryBackground(),\n verticalAlign: 'bottom'\n },\n\n '& th div': {\n width: '200px',\n },\n\n '& td': {\n width: '200px',\n padding: '16px 8px',\n verticalAlign: 'top'\n }\n },\n scorePointHeader: {\n '& td': {\n border: 0,\n padding: 0,\n textAlign: 'center',\n minWidth: '200px'\n }\n },\n pointLabel: {\n marginBottom: '4px'\n },\n scorePointValue: {\n fontWeight: 'normal',\n }\n});\n\nclass Scale extends React.Component {\n render() {\n const {classes, scale, scaleIndex, showDescription, showPointsLabels, showStandards} = this.props;\n const {excludeZero, maxPoints, traitLabel, traits, scorePointsLabels} = scale || {};\n\n let scorePointsValues = [];\n let descriptions;\n let pointsLabels;\n let standards;\n try {\n // determining the score points values\n for (let pointValue = maxPoints; pointValue >= excludeZero ? 1 : 0; pointValue -= 1) {\n scorePointsValues.push(pointValue);\n }\n\n const {traitStandards, traitDescriptions} = traits.reduce(\n (tcc, trait) => ({\n traitStandards: [...tcc.traitStandards, ...(trait.standards || [])],\n traitDescriptions: [...tcc.traitDescriptions, ...(trait.description || [])],\n }),\n {\n traitStandards: [],\n traitDescriptions: [],\n }\n );\n\n descriptions = showDescription && traitDescriptions.length;\n pointsLabels = showPointsLabels && scorePointsLabels.length;\n standards = showStandards && traitStandards.length;\n } catch (e) {\n descriptions = false;\n pointsLabels = false;\n standards = false;\n }\n\n return (\n <table\n key={`scale-${scaleIndex}`}\n className={classes.table}\n >\n <thead>\n <tr>\n <th>\n <div dangerouslySetInnerHTML={{__html: traitLabel}}/>\n </th>\n\n {standards ? <th>\n <div>Standard(s)</div>\n </th> : null}\n\n {descriptions ? <th>\n <div>Description</div>\n </th> : null}\n\n {\n scorePointsValues && scorePointsValues.map((scorePointValue, index) => {\n let pointLabel = '';\n\n // to handle the case when there aren't enough labels\n try {\n pointLabel = scorePointsLabels[scorePointsValues.length - index - 1] || '';\n } catch (e) {\n pointLabel = '';\n }\n\n return (\n <th key={`table-header-${index}`}>\n <table className={classes.scorePointHeader}>\n <thead>\n {pointsLabels\n ? (\n <tr>\n <td>\n <div className={classes.pointLabel} dangerouslySetInnerHTML={{__html: pointLabel}}/>\n </td>\n </tr>\n )\n : null\n }\n <tr>\n <td className={classes.scorePointValue}>\n {scorePointValue === 1 ? `${scorePointValue} point` : `${scorePointValue} points`}\n </td>\n </tr>\n </thead>\n </table>\n </th>\n );\n })\n }\n\n </tr>\n </thead>\n\n <tbody>\n {\n traits && traits.map((trait, traitIndex) => (\n <Trait\n key={`trait_${scaleIndex}_${traitIndex}`}\n trait={trait}\n traitIndex={traitIndex}\n showDescription={!!descriptions}\n showStandards={!!standards}\n scaleIndex={scaleIndex}\n scorePointsValues={scorePointsValues}\n excludeZero={excludeZero}\n />\n ))\n }\n </tbody>\n </table>\n )\n }\n}\n\nScale.propTypes = {\n classes: PropTypes.object,\n scaleIndex: PropTypes.number,\n scale: PropTypes.shape({\n excludeZero: PropTypes.bool,\n maxPoints: PropTypes.number,\n scorePointsLabels: PropTypes.arrayOf(PropTypes.string),\n traitLabel: PropTypes.string,\n traits: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string,\n standards: PropTypes.arrayOf(PropTypes.string),\n scorePointsDescriptors: PropTypes.arrayOf(PropTypes.string),\n description: PropTypes.string,\n }))\n }),\n showPointsLabels: PropTypes.bool,\n showDescription: PropTypes.bool,\n showStandards: PropTypes.bool,\n};\n\nexport default withStyles(styles)(Scale);\n"],"file":"scale.js"}
|
|
@@ -0,0 +1,103 @@
|
|
|
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 _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _styles = require("@material-ui/core/styles");
|
|
15
|
+
|
|
16
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
17
|
+
|
|
18
|
+
var styles = function styles() {
|
|
19
|
+
return {
|
|
20
|
+
trait: {
|
|
21
|
+
'&$traitName': {
|
|
22
|
+
color: _renderUi.color.primaryDark(),
|
|
23
|
+
verticalAlign: 'middle'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
noDescription: {
|
|
27
|
+
color: _renderUi.color.secondaryBackground(),
|
|
28
|
+
textAlign: 'center'
|
|
29
|
+
},
|
|
30
|
+
traitName: {}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var Trait = function Trait(props) {
|
|
35
|
+
var trait = props.trait,
|
|
36
|
+
traitIndex = props.traitIndex,
|
|
37
|
+
scaleIndex = props.scaleIndex,
|
|
38
|
+
showStandards = props.showStandards,
|
|
39
|
+
showDescription = props.showDescription,
|
|
40
|
+
scorePointsValues = props.scorePointsValues,
|
|
41
|
+
classes = props.classes;
|
|
42
|
+
|
|
43
|
+
var _ref = trait || {},
|
|
44
|
+
name = _ref.name,
|
|
45
|
+
standards = _ref.standards,
|
|
46
|
+
scorePointsDescriptors = _ref.scorePointsDescriptors,
|
|
47
|
+
description = _ref.description;
|
|
48
|
+
|
|
49
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
50
|
+
key: "scale-".concat(scaleIndex, "-trait-").concat(traitIndex)
|
|
51
|
+
}, /*#__PURE__*/_react["default"].createElement("td", {
|
|
52
|
+
className: "".concat(classes.trait, " ").concat(classes.traitName)
|
|
53
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
54
|
+
dangerouslySetInnerHTML: {
|
|
55
|
+
__html: name
|
|
56
|
+
}
|
|
57
|
+
})), showStandards ? /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
58
|
+
dangerouslySetInnerHTML: {
|
|
59
|
+
__html: standards.join(',')
|
|
60
|
+
}
|
|
61
|
+
})) : null, showDescription ? /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
62
|
+
dangerouslySetInnerHTML: {
|
|
63
|
+
__html: description
|
|
64
|
+
}
|
|
65
|
+
})) : null, scorePointsValues && scorePointsValues.map(function (scorePointValue, index) {
|
|
66
|
+
var scoreDescriptor;
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
scoreDescriptor = scorePointsDescriptors[scorePointsValues.length - index - 1] || '';
|
|
70
|
+
} catch (e) {
|
|
71
|
+
scoreDescriptor = '';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
75
|
+
key: "table-cell-".concat(index)
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
77
|
+
className: !scoreDescriptor ? classes.noDescription : '',
|
|
78
|
+
dangerouslySetInnerHTML: {
|
|
79
|
+
__html: scoreDescriptor || 'No Description'
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
Trait.propTypes = {
|
|
86
|
+
classes: _propTypes["default"].object,
|
|
87
|
+
showStandards: _propTypes["default"].bool,
|
|
88
|
+
showDescription: _propTypes["default"].bool,
|
|
89
|
+
scorePointsValues: _propTypes["default"].arrayOf(_propTypes["default"].number),
|
|
90
|
+
scaleIndex: _propTypes["default"].number,
|
|
91
|
+
traitIndex: _propTypes["default"].number,
|
|
92
|
+
trait: _propTypes["default"].shape({
|
|
93
|
+
name: _propTypes["default"].string,
|
|
94
|
+
standards: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
95
|
+
scorePointsDescriptors: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
96
|
+
description: _propTypes["default"].string
|
|
97
|
+
})
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var _default = (0, _styles.withStyles)(styles)(Trait);
|
|
101
|
+
|
|
102
|
+
exports["default"] = _default;
|
|
103
|
+
//# sourceMappingURL=trait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/trait.jsx"],"names":["styles","trait","color","primaryDark","verticalAlign","noDescription","secondaryBackground","textAlign","traitName","Trait","props","traitIndex","scaleIndex","showStandards","showDescription","scorePointsValues","classes","name","standards","scorePointsDescriptors","description","__html","join","map","scorePointValue","index","scoreDescriptor","length","e","propTypes","PropTypes","object","bool","arrayOf","number","shape","string"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBC,IAAAA,KAAK,EAAE;AACL,qBAAe;AACbC,QAAAA,KAAK,EAAEA,gBAAMC,WAAN,EADM;AAEbC,QAAAA,aAAa,EAAE;AAFF;AADV,KADa;AAOpBC,IAAAA,aAAa,EAAE;AACbH,MAAAA,KAAK,EAAEA,gBAAMI,mBAAN,EADM;AAEbC,MAAAA,SAAS,EAAE;AAFE,KAPK;AAWpBC,IAAAA,SAAS,EAAE;AAXS,GAAP;AAAA,CAAf;;AAcA,IAAMC,KAAK,GAAG,SAARA,KAAQ,CAACC,KAAD,EAAW;AACvB,MAAOT,KAAP,GAAoGS,KAApG,CAAOT,KAAP;AAAA,MAAcU,UAAd,GAAoGD,KAApG,CAAcC,UAAd;AAAA,MAA0BC,UAA1B,GAAoGF,KAApG,CAA0BE,UAA1B;AAAA,MAAsCC,aAAtC,GAAoGH,KAApG,CAAsCG,aAAtC;AAAA,MAAqDC,eAArD,GAAoGJ,KAApG,CAAqDI,eAArD;AAAA,MAAsEC,iBAAtE,GAAoGL,KAApG,CAAsEK,iBAAtE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AAe,IAAI;AAA5B;AAD9B,MADF,CADF;AAOD,GAhBoB,CAtBzB,CADF;AA2CD,CA/CD;;AAiDAjB,KAAK,CAACoB,SAAN,GAAkB;AAChBb,EAAAA,OAAO,EAAEc,sBAAUC,MADH;AAEhBlB,EAAAA,aAAa,EAAEiB,sBAAUE,IAFT;AAGhBlB,EAAAA,eAAe,EAAEgB,sBAAUE,IAHX;AAIhBjB,EAAAA,iBAAiB,EAAEe,sBAAUG,OAAV,CAAkBH,sBAAUI,MAA5B,CAJH;AAKhBtB,EAAAA,UAAU,EAAEkB,sBAAUI,MALN;AAMhBvB,EAAAA,UAAU,EAAEmB,sBAAUI,MANN;AAOhBjC,EAAAA,KAAK,EAAE6B,sBAAUK,KAAV,CAAgB;AACrBlB,IAAAA,IAAI,EAAEa,sBAAUM,MADK;AAErBlB,IAAAA,SAAS,EAAEY,sBAAUG,OAAV,CAAkBH,sBAAUM,MAA5B,CAFU;AAGrBjB,IAAAA,sBAAsB,EAAEW,sBAAUG,OAAV,CAAkBH,sBAAUM,MAA5B,CAHH;AAIrBhB,IAAAA,WAAW,EAAEU,sBAAUM;AAJF,GAAhB;AAPS,CAAlB;;eAee,wBAAWpC,MAAX,EAAmBS,KAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {withStyles} from '@material-ui/core/styles';\nimport {color} from '@pie-lib/render-ui';\n\nconst styles = () => ({\n trait: {\n '&$traitName': {\n color: color.primaryDark(),\n verticalAlign: 'middle'\n }\n },\n noDescription: {\n color: color.secondaryBackground(),\n textAlign: 'center'\n },\n traitName: {}\n});\n\nconst Trait = (props) => {\n const {trait, traitIndex, scaleIndex, showStandards, showDescription, scorePointsValues, classes} = props;\n const {name, standards, scorePointsDescriptors, description} = trait || {};\n\n return (\n <tr key={`scale-${scaleIndex}-trait-${traitIndex}`}>\n <td className={`${classes.trait} ${classes.traitName}`}>\n <div dangerouslySetInnerHTML={{__html: name}}/>\n </td>\n\n {showStandards\n ?\n <td>\n <div dangerouslySetInnerHTML={{__html: standards.join(',')}}/>\n </td>\n : null\n }\n\n {showDescription\n ?\n <td>\n <div dangerouslySetInnerHTML={{__html: description}}/>\n </td>\n : null\n }\n\n {\n scorePointsValues && scorePointsValues.map((scorePointValue, index) => {\n let scoreDescriptor;\n\n try {\n scoreDescriptor = scorePointsDescriptors[scorePointsValues.length - index - 1] || '';\n } catch (e) {\n scoreDescriptor = '';\n }\n\n return (\n <td key={`table-cell-${index}`}>\n <div className={!scoreDescriptor ? classes.noDescription : ''}\n dangerouslySetInnerHTML={{__html: scoreDescriptor || 'No Description'}}\n />\n </td>\n );\n })\n }\n </tr>\n );\n};\n\nTrait.propTypes = {\n classes: PropTypes.object,\n showStandards: PropTypes.bool,\n showDescription: PropTypes.bool,\n scorePointsValues: PropTypes.arrayOf(PropTypes.number),\n scaleIndex: PropTypes.number,\n traitIndex: PropTypes.number,\n trait: PropTypes.shape({\n name: PropTypes.string,\n standards: PropTypes.arrayOf(PropTypes.string),\n scorePointsDescriptors: PropTypes.arrayOf(PropTypes.string),\n description: PropTypes.string,\n })\n};\n\nexport default withStyles(styles)(Trait);\n"],"file":"trait.js"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-element/multi-trait-rubric",
|
|
3
|
+
"repository": "pie-framework/pie-elements",
|
|
4
|
+
"version": "2.0.10",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@material-ui/core": "^3.9.2",
|
|
10
|
+
"@pie-framework/pie-player-events": "^0.1.0",
|
|
11
|
+
"@pie-lib/render-ui": "^4.13.5",
|
|
12
|
+
"clsx": "^1.1.1",
|
|
13
|
+
"enzyme-to-json": "^3.3.5",
|
|
14
|
+
"prop-types": "^15.6.1",
|
|
15
|
+
"react": "^16.8.1",
|
|
16
|
+
"react-dom": "^16.8.1"
|
|
17
|
+
},
|
|
18
|
+
"gitHead": "dec027da9b944f8ee4286ab27e27fb888f657155",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"postpublish": "../../scripts/postpublish"
|
|
21
|
+
},
|
|
22
|
+
"main": "lib/index.js",
|
|
23
|
+
"module": "src/index.js"
|
|
24
|
+
}
|