@pie-element/rubric 1.7.8 → 1.8.1-beta.1443
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 +323 -0
- package/configure/CHANGELOG.md +309 -0
- package/configure/lib/defaults.js +29 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +45 -8
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +100 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/package.json +5 -3
- package/configure/src/defaults.js +21 -0
- package/configure/src/index.js +34 -8
- package/configure/src/main.jsx +48 -0
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/controller/src/__tests__/index.test.js +1 -5
- package/controller/src/index.js +2 -2
- package/docs/config-schema.json +55 -0
- package/docs/config-schema.json.md +47 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +1 -1
- package/docs/demo/index.html +1 -2
- package/docs/pie-schema.json +18 -0
- package/docs/pie-schema.json.md +19 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js.map +1 -1
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/rubric-view.test.jsx +9 -11
- package/src/index.js +2 -5
- package/src/main.jsx +38 -39
- package/src/print.js +1 -1
- package/module/configure.js +0 -29179
- package/module/controller.js +0 -15
- package/module/demo.js +0 -33
- package/module/element.js +0 -219
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -71
- package/module/print.html +0 -18
- package/module/print.js +0 -236
package/configure/lib/index.js
CHANGED
|
@@ -21,20 +21,36 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
23
23
|
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
24
26
|
var _pieConfigureEvents = require("@pie-framework/pie-configure-events");
|
|
25
27
|
|
|
26
28
|
var _react = _interopRequireDefault(require("react"));
|
|
27
29
|
|
|
28
30
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
29
31
|
|
|
30
|
-
var _rubric = require("@pie-lib/rubric");
|
|
31
|
-
|
|
32
32
|
var _debug = _interopRequireDefault(require("debug"));
|
|
33
33
|
|
|
34
|
+
var _main = _interopRequireDefault(require("./main"));
|
|
35
|
+
|
|
36
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
37
|
+
|
|
34
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); }; }
|
|
35
39
|
|
|
36
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; } }
|
|
37
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 modelWithDefaults = function modelWithDefaults(m) {
|
|
47
|
+
return _objectSpread(_objectSpread({}, _defaults["default"].model), m);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var configurationWithDefaults = function configurationWithDefaults(c) {
|
|
51
|
+
return _objectSpread(_objectSpread({}, _defaults["default"].configuration), c);
|
|
52
|
+
};
|
|
53
|
+
|
|
38
54
|
var RubricElement = /*#__PURE__*/function (_HTMLElement) {
|
|
39
55
|
(0, _inherits2["default"])(RubricElement, _HTMLElement);
|
|
40
56
|
|
|
@@ -45,17 +61,36 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
|
|
|
45
61
|
|
|
46
62
|
(0, _classCallCheck2["default"])(this, RubricElement);
|
|
47
63
|
_this = _super.call(this);
|
|
64
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onConfigurationChanged", function (c) {
|
|
65
|
+
_this._configuration = configurationWithDefaults(c);
|
|
66
|
+
|
|
67
|
+
if (_this._model) {
|
|
68
|
+
_this.onModelChanged(_this._model);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_this._render();
|
|
72
|
+
});
|
|
48
73
|
|
|
49
74
|
_debug["default"].log('constructor called');
|
|
50
75
|
|
|
76
|
+
_this._model = modelWithDefaults();
|
|
77
|
+
_this._configuration = configurationWithDefaults();
|
|
51
78
|
_this.onModelChanged = _this.onModelChanged.bind((0, _assertThisInitialized2["default"])(_this));
|
|
79
|
+
_this.onConfigurationChanged = _this.onConfigurationChanged.bind((0, _assertThisInitialized2["default"])(_this));
|
|
52
80
|
return _this;
|
|
53
81
|
}
|
|
54
82
|
|
|
55
83
|
(0, _createClass2["default"])(RubricElement, [{
|
|
56
84
|
key: "model",
|
|
57
|
-
set: function set(
|
|
58
|
-
this._model =
|
|
85
|
+
set: function set(m) {
|
|
86
|
+
this._model = modelWithDefaults(m);
|
|
87
|
+
|
|
88
|
+
this._render();
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "configuration",
|
|
92
|
+
set: function set(c) {
|
|
93
|
+
this._configuration = configurationWithDefaults(c);
|
|
59
94
|
|
|
60
95
|
this._render();
|
|
61
96
|
}
|
|
@@ -77,12 +112,14 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
|
|
|
77
112
|
key: "_render",
|
|
78
113
|
value: function _render() {
|
|
79
114
|
if (this._model) {
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
115
|
+
var element = /*#__PURE__*/_react["default"].createElement(_main["default"], {
|
|
116
|
+
model: this._model,
|
|
117
|
+
configuration: this._configuration,
|
|
118
|
+
onModelChanged: this.onModelChanged,
|
|
119
|
+
onConfigurationChanged: this.onConfigurationChanged
|
|
83
120
|
});
|
|
84
121
|
|
|
85
|
-
_reactDom["default"].render(
|
|
122
|
+
_reactDom["default"].render(element, this);
|
|
86
123
|
}
|
|
87
124
|
}
|
|
88
125
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["modelWithDefaults","m","defaults","model","configurationWithDefaults","c","configuration","RubricElement","_configuration","_model","onModelChanged","_render","debug","log","bind","onConfigurationChanged","dispatchEvent","ModelUpdatedEvent","element","React","createElement","Main","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,CAAD;AAAA,yCAAaC,qBAASC,KAAtB,GAAgCF,CAAhC;AAAA,CAA1B;;AACA,IAAMG,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,CAAD;AAAA,yCAAaH,qBAASI,aAAtB,GAAwCD,CAAxC;AAAA,CAAlC;;IAEqBE,a;;;;;AACnB,2BAAc;AAAA;;AAAA;AACZ;AADY,+GAyBW,UAACF,CAAD,EAAO;AAC9B,YAAKG,cAAL,GAAsBJ,yBAAyB,CAACC,CAAD,CAA/C;;AAEA,UAAI,MAAKI,MAAT,EAAiB;AACf,cAAKC,cAAL,CAAoB,MAAKD,MAAzB;AACD;;AAED,YAAKE,OAAL;AACD,KAjCa;;AAEZC,sBAAMC,GAAN,CAAU,oBAAV;;AACA,UAAKJ,MAAL,GAAcT,iBAAiB,EAA/B;AACA,UAAKQ,cAAL,GAAsBJ,yBAAyB,EAA/C;AACA,UAAKM,cAAL,GAAsB,MAAKA,cAAL,CAAoBI,IAApB,gDAAtB;AACA,UAAKC,sBAAL,GAA8B,MAAKA,sBAAL,CAA4BD,IAA5B,gDAA9B;AANY;AAOb;;;;SAED,aAAUb,CAAV,EAAa;AACX,WAAKQ,MAAL,GAAcT,iBAAiB,CAACC,CAAD,CAA/B;;AACA,WAAKU,OAAL;AACD;;;SAED,aAAkBN,CAAlB,EAAqB;AACnB,WAAKG,cAAL,GAAsBJ,yBAAyB,CAACC,CAAD,CAA/C;;AACA,WAAKM,OAAL;AACD;;;WAED,wBAAeV,CAAf,EAAkB;AAChB,WAAKQ,MAAL,GAAcR,CAAd;;AACA,WAAKU,OAAL;;AACA,WAAKK,aAAL,CAAmB,IAAIC,qCAAJ,CAAsB,KAAKR,MAA3B,EAAmC,KAAnC,CAAnB;AACD;;;WAYD,6BAAoB;AAClB,WAAKE,OAAL;AACD;;;WAED,mBAAU;AACR,UAAI,KAAKF,MAAT,EAAiB;AACf,YAAIS,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACtClB,UAAAA,KAAK,EAAE,KAAKM,MAD0B;AAEtCH,UAAAA,aAAa,EAAE,KAAKE,cAFkB;AAGtCE,UAAAA,cAAc,EAAE,KAAKA,cAHiB;AAItCK,UAAAA,sBAAsB,EAAE,KAAKA;AAJS,SAA1B,CAAd;;AAOAO,6BAASC,MAAT,CAAgBL,OAAhB,EAAyB,IAAzB;AACD;AACF;;;kDAnDwCM,W","sourcesContent":["import { ModelUpdatedEvent } from '@pie-framework/pie-configure-events';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\n\nimport Main from './main';\nimport defaults from './defaults';\n\nconst modelWithDefaults = (m) => ({ ...defaults.model, ...m });\nconst configurationWithDefaults = (c) => ({ ...defaults.configuration, ...c });\n\nexport default class RubricElement extends HTMLElement {\n constructor() {\n super();\n debug.log('constructor called');\n this._model = modelWithDefaults();\n this._configuration = configurationWithDefaults();\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(m) {\n this._model = modelWithDefaults(m);\n this._render();\n }\n\n set configuration(c) {\n this._configuration = configurationWithDefaults(c);\n this._render();\n }\n\n onModelChanged(m) {\n this._model = m;\n this._render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n }\n\n onConfigurationChanged = (c) => {\n this._configuration = configurationWithDefaults(c);\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n };\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (this._model) {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n });\n\n ReactDOM.render(element, this);\n }\n }\n}\n"],"file":"index.js"}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 _rubric = require("@pie-lib/rubric");
|
|
23
|
+
|
|
24
|
+
var _styles = require("@material-ui/core/styles");
|
|
25
|
+
|
|
26
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
27
|
+
|
|
28
|
+
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); }; }
|
|
29
|
+
|
|
30
|
+
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; } }
|
|
31
|
+
|
|
32
|
+
var Panel = _configUi.settings.Panel,
|
|
33
|
+
toggle = _configUi.settings.toggle;
|
|
34
|
+
|
|
35
|
+
var styles = function styles(theme) {
|
|
36
|
+
return {
|
|
37
|
+
design: {
|
|
38
|
+
fontFamily: 'Cerebri Sans',
|
|
39
|
+
fontSize: theme.typography.fontSize
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var Main = /*#__PURE__*/function (_React$Component) {
|
|
45
|
+
(0, _inherits2["default"])(Main, _React$Component);
|
|
46
|
+
|
|
47
|
+
var _super = _createSuper(Main);
|
|
48
|
+
|
|
49
|
+
function Main() {
|
|
50
|
+
(0, _classCallCheck2["default"])(this, Main);
|
|
51
|
+
return _super.apply(this, arguments);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
(0, _createClass2["default"])(Main, [{
|
|
55
|
+
key: "render",
|
|
56
|
+
value: function render() {
|
|
57
|
+
var _ref = this.props || {},
|
|
58
|
+
model = _ref.model,
|
|
59
|
+
classes = _ref.classes,
|
|
60
|
+
configuration = _ref.configuration,
|
|
61
|
+
onConfigurationChanged = _ref.onConfigurationChanged,
|
|
62
|
+
onModelChanged = _ref.onModelChanged;
|
|
63
|
+
|
|
64
|
+
var _ref2 = configuration || {},
|
|
65
|
+
settingsPanelDisabled = _ref2.settingsPanelDisabled,
|
|
66
|
+
_ref2$showExcludeZero = _ref2.showExcludeZero,
|
|
67
|
+
showExcludeZero = _ref2$showExcludeZero === void 0 ? {} : _ref2$showExcludeZero,
|
|
68
|
+
_ref2$showMaxPoint = _ref2.showMaxPoint,
|
|
69
|
+
showMaxPoint = _ref2$showMaxPoint === void 0 ? {} : _ref2$showMaxPoint;
|
|
70
|
+
|
|
71
|
+
var panelProperties = {
|
|
72
|
+
excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
|
|
73
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label)
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
76
|
+
className: classes.design
|
|
77
|
+
}, /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
78
|
+
hideSettings: settingsPanelDisabled,
|
|
79
|
+
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
80
|
+
model: model,
|
|
81
|
+
onChangeModel: onModelChanged,
|
|
82
|
+
configuration: configuration,
|
|
83
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
84
|
+
groups: {
|
|
85
|
+
Properties: panelProperties
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement(_rubric.Authoring, {
|
|
89
|
+
value: model,
|
|
90
|
+
onChange: onModelChanged
|
|
91
|
+
})));
|
|
92
|
+
}
|
|
93
|
+
}]);
|
|
94
|
+
return Main;
|
|
95
|
+
}(_react["default"].Component);
|
|
96
|
+
|
|
97
|
+
var _default = (0, _styles.withStyles)(styles)(Main);
|
|
98
|
+
|
|
99
|
+
exports["default"] = _default;
|
|
100
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","styles","theme","design","fontFamily","fontSize","typography","Main","props","model","classes","configuration","onConfigurationChanged","onModelChanged","settingsPanelDisabled","showExcludeZero","showMaxPoint","panelProperties","excludeZeroEnabled","label","maxPointsEnabled","Properties","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAQA,KAAR,GAA0BC,kBAA1B,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA0BD,kBAA1B,CAAeC,MAAf;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAE,cADN;AAENC,MAAAA,QAAQ,EAAEH,KAAK,CAACI,UAAN,CAAiBD;AAFrB;AADiB,GAAZ;AAAA,CAAf;;IAOME,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,kBAA2EF,aAAa,IAAI,EAA5F;AAAA,UAAQG,qBAAR,SAAQA,qBAAR;AAAA,wCAA+BC,eAA/B;AAAA,UAA+BA,eAA/B,sCAAiD,EAAjD;AAAA,qCAAqDC,YAArD;AAAA,UAAqDA,YAArD,mCAAoE,EAApE;;AAEA,UAAMC,eAAe,GAAG;AACtBC,QAAAA,kBAAkB,EAAEH,eAAe,CAAChB,QAAhB,IAA4BC,MAAM,CAACe,eAAe,CAACI,KAAjB,CADhC;AAEtBC,QAAAA,gBAAgB,EAAEJ,YAAY,CAACjB,QAAb,IAAyBC,MAAM,CAACgB,YAAY,CAACG,KAAd;AAF3B,OAAxB;AAKA,0BACE;AAAK,QAAA,SAAS,EAAET,OAAO,CAACP;AAAxB,sBACE,gCAAC,gBAAD,CAAQ,YAAR;AACE,QAAA,YAAY,EAAEW,qBADhB;AAEE,QAAA,QAAQ,eACN,gCAAC,KAAD;AACE,UAAA,KAAK,EAAEL,KADT;AAEE,UAAA,aAAa,EAAEI,cAFjB;AAGE,UAAA,aAAa,EAAEF,aAHjB;AAIE,UAAA,qBAAqB,EAAEC,sBAJzB;AAKE,UAAA,MAAM,EAAE;AACNS,YAAAA,UAAU,EAAEJ;AADN;AALV;AAHJ,sBAcE,gCAAC,iBAAD;AAAW,QAAA,KAAK,EAAER,KAAlB;AAAyB,QAAA,QAAQ,EAAEI;AAAnC,QAdF,CADF,CADF;AAoBD;;;EA9BgBS,kBAAMC,S;;eAiCV,wBAAWtB,MAAX,EAAmBM,IAAnB,C","sourcesContent":["import React from 'react';\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 = (theme) => ({\n design: {\n fontFamily: 'Cerebri Sans',\n fontSize: theme.typography.fontSize,\n },\n});\n\nclass Main extends React.Component {\n render() {\n const { model, classes, configuration, onConfigurationChanged, onModelChanged } = this.props || {};\n const { settingsPanelDisabled, showExcludeZero = {}, showMaxPoint = {} } = configuration || {};\n\n const panelProperties = {\n excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),\n maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),\n };\n\n return (\n <div className={classes.design}>\n <layout.ConfigLayout\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Properties: panelProperties,\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,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"description": "Rubric authoring view",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"author": "Pie Framework Authors",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@
|
|
10
|
-
"@pie-
|
|
9
|
+
"@material-ui/core": "^3.9.2",
|
|
10
|
+
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
11
|
+
"@pie-lib/config-ui": "12.0.0-beta.2",
|
|
12
|
+
"@pie-lib/rubric": "1.0.0-beta.1",
|
|
11
13
|
"debug": "^4.1.1",
|
|
12
14
|
"react": "^16.8.6",
|
|
13
15
|
"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
1
|
import { ModelUpdatedEvent } from '@pie-framework/pie-configure-events';
|
|
2
|
-
|
|
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,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Authoring } from '@pie-lib/rubric';
|
|
3
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
4
|
+
import { layout, settings } from '@pie-lib/config-ui';
|
|
5
|
+
|
|
6
|
+
const { Panel, toggle } = settings;
|
|
7
|
+
|
|
8
|
+
const styles = (theme) => ({
|
|
9
|
+
design: {
|
|
10
|
+
fontFamily: 'Cerebri Sans',
|
|
11
|
+
fontSize: theme.typography.fontSize,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
class Main extends React.Component {
|
|
16
|
+
render() {
|
|
17
|
+
const { model, classes, configuration, onConfigurationChanged, onModelChanged } = this.props || {};
|
|
18
|
+
const { settingsPanelDisabled, showExcludeZero = {}, showMaxPoint = {} } = configuration || {};
|
|
19
|
+
|
|
20
|
+
const panelProperties = {
|
|
21
|
+
excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
|
|
22
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={classes.design}>
|
|
27
|
+
<layout.ConfigLayout
|
|
28
|
+
hideSettings={settingsPanelDisabled}
|
|
29
|
+
settings={
|
|
30
|
+
<Panel
|
|
31
|
+
model={model}
|
|
32
|
+
onChangeModel={onModelChanged}
|
|
33
|
+
configuration={configuration}
|
|
34
|
+
onChangeConfiguration={onConfigurationChanged}
|
|
35
|
+
groups={{
|
|
36
|
+
Properties: panelProperties,
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
<Authoring value={model} onChange={onModelChanged} />
|
|
42
|
+
</layout.ConfigLayout>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default withStyles(styles)(Main);
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-controller@1.2.7...@pie-element/rubric-controller@1.2.8) (2022-12-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/rubric-controller
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [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
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/rubric-controller
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["model","session","env","Promise","resolve","modelResult","role"],"mappings":";;;;;;;AAAO,SAASA,KAAT,CAAeA,KAAf,EAAsBC,OAAtB,EAA+BC,GAA/B,EAAoC;AACzC,SAAO,IAAIC,OAAJ,CAAY,
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["model","session","env","Promise","resolve","modelResult","role"],"mappings":";;;;;;;AAAO,SAASA,KAAT,CAAeA,KAAf,EAAsBC,OAAtB,EAA+BC,GAA/B,EAAoC;AACzC,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9B,QAAMC,WAAW,GAAG,CAACL,KAAD,GAAS,EAAT,GAAcA,KAAlC;AACAI,IAAAA,OAAO,CAACF,GAAG,IAAIA,GAAG,CAACI,IAAX,IAAmBJ,GAAG,CAACI,IAAJ,KAAa,YAAhC,GAA+CD,WAA/C,GAA6D,EAA9D,CAAP;AACD,GAHM,CAAP;AAID","sourcesContent":["export function model(model, session, env) {\n return new Promise((resolve) => {\n const modelResult = !model ? {} : model;\n resolve(env && env.role && env.role === 'instructor' ? modelResult : {});\n });\n}\n"],"file":"index.js"}
|
package/controller/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { model } from '../index';
|
|
2
2
|
|
|
3
3
|
describe('rubric model', () => {
|
|
4
|
-
|
|
5
4
|
let state = {
|
|
6
5
|
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
7
6
|
sampleAnswers: [null, 'just right', 'not left', null],
|
|
8
7
|
maxPoints: 4,
|
|
9
|
-
excludeZero: false
|
|
8
|
+
excludeZero: false,
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
let session = {};
|
|
@@ -29,7 +28,4 @@ describe('rubric model', () => {
|
|
|
29
28
|
result = await model(state, session, env);
|
|
30
29
|
expect(result).toEqual(state);
|
|
31
30
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
31
|
});
|
package/controller/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function model(model, session, env) {
|
|
2
|
-
return new Promise(resolve => {
|
|
2
|
+
return new Promise((resolve) => {
|
|
3
3
|
const modelResult = !model ? {} : model;
|
|
4
|
-
resolve(
|
|
4
|
+
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
5
5
|
});
|
|
6
6
|
}
|
package/docs/config-schema.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "object",
|
|
3
3
|
"properties": {
|
|
4
|
+
"settingsPanelDisabled": {
|
|
5
|
+
"description": "Indicates if the settings panel is not available",
|
|
6
|
+
"type": "boolean",
|
|
7
|
+
"title": "settingsPanelDisabled"
|
|
8
|
+
},
|
|
9
|
+
"showExcludeZero": {
|
|
10
|
+
"title": "ConfigureProp",
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"settings": {
|
|
14
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"title": "settings"
|
|
17
|
+
},
|
|
18
|
+
"label": {
|
|
19
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"title": "label"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"showMaxPoint": {
|
|
26
|
+
"title": "ConfigureProp",
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"settings": {
|
|
30
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"title": "settings"
|
|
33
|
+
},
|
|
34
|
+
"label": {
|
|
35
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"title": "label"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
4
41
|
"showPrompt": {
|
|
5
42
|
"description": "Determines whether prompt field will be displayed or not",
|
|
6
43
|
"default": true,
|
|
@@ -20,5 +57,23 @@
|
|
|
20
57
|
"title": "settingsPartialScoring"
|
|
21
58
|
}
|
|
22
59
|
},
|
|
60
|
+
"definitions": {
|
|
61
|
+
"ConfigureProp": {
|
|
62
|
+
"title": "ConfigureProp",
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"settings": {
|
|
66
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"title": "settings"
|
|
69
|
+
},
|
|
70
|
+
"label": {
|
|
71
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"title": "label"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
23
78
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
24
79
|
}
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
The schema defines the following properties:
|
|
2
2
|
|
|
3
|
+
# `settingsPanelDisabled` (boolean)
|
|
4
|
+
|
|
5
|
+
Indicates if the settings panel is not available
|
|
6
|
+
|
|
7
|
+
# `showExcludeZero` (object)
|
|
8
|
+
|
|
9
|
+
Properties of the `showExcludeZero` object:
|
|
10
|
+
|
|
11
|
+
## `settings` (boolean)
|
|
12
|
+
|
|
13
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
14
|
+
|
|
15
|
+
## `label` (string)
|
|
16
|
+
|
|
17
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
18
|
+
|
|
19
|
+
# `showMaxPoint` (object)
|
|
20
|
+
|
|
21
|
+
Properties of the `showMaxPoint` object:
|
|
22
|
+
|
|
23
|
+
## `settings` (boolean)
|
|
24
|
+
|
|
25
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
26
|
+
|
|
27
|
+
## `label` (string)
|
|
28
|
+
|
|
29
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
30
|
+
|
|
3
31
|
# `showPrompt` (boolean)
|
|
4
32
|
|
|
5
33
|
Determines whether prompt field will be displayed or not
|
|
@@ -16,4 +44,22 @@ Default: `"Item Stemm"`
|
|
|
16
44
|
|
|
17
45
|
Indicates whether the settings panel wil allow the author to modify settings for partial scoring
|
|
18
46
|
|
|
19
|
-
Default: `true`
|
|
47
|
+
Default: `true`
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
# Sub Schemas
|
|
52
|
+
|
|
53
|
+
The schema defines the following additional types:
|
|
54
|
+
|
|
55
|
+
## `ConfigureProp` (object)
|
|
56
|
+
|
|
57
|
+
Properties of the `ConfigureProp` object:
|
|
58
|
+
|
|
59
|
+
### `settings` (boolean)
|
|
60
|
+
|
|
61
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
62
|
+
|
|
63
|
+
### `label` (string)
|
|
64
|
+
|
|
65
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
package/docs/demo/config.js
CHANGED
package/docs/demo/generate.js
CHANGED
package/docs/demo/index.html
CHANGED
package/docs/pie-schema.json
CHANGED
|
@@ -58,5 +58,23 @@
|
|
|
58
58
|
"element",
|
|
59
59
|
"id"
|
|
60
60
|
],
|
|
61
|
+
"definitions": {
|
|
62
|
+
"ConfigureProp": {
|
|
63
|
+
"title": "ConfigureProp",
|
|
64
|
+
"type": "object",
|
|
65
|
+
"properties": {
|
|
66
|
+
"settings": {
|
|
67
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
68
|
+
"type": "boolean",
|
|
69
|
+
"title": "settings"
|
|
70
|
+
},
|
|
71
|
+
"label": {
|
|
72
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
73
|
+
"type": "string",
|
|
74
|
+
"title": "label"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
61
79
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
62
80
|
}
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -32,4 +32,22 @@ Identifier to identify the Pie Element in html markup, Must be unique within a p
|
|
|
32
32
|
|
|
33
33
|
# `element` (string, required)
|
|
34
34
|
|
|
35
|
-
The html Element tag name
|
|
35
|
+
The html Element tag name
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# Sub Schemas
|
|
40
|
+
|
|
41
|
+
The schema defines the following additional types:
|
|
42
|
+
|
|
43
|
+
## `ConfigureProp` (object)
|
|
44
|
+
|
|
45
|
+
Properties of the `ConfigureProp` object:
|
|
46
|
+
|
|
47
|
+
### `settings` (boolean)
|
|
48
|
+
|
|
49
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
50
|
+
|
|
51
|
+
### `label` (string)
|
|
52
|
+
|
|
53
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|