@pie-element/rubric 2.0.10 → 2.0.12-next.173
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 +8 -0
- package/configure/CHANGELOG.md +8 -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 +96 -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 +34 -8
- package/configure/src/main.jsx +49 -0
- package/package.json +2 -2
package/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
|
+
## [2.0.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric@2.0.10...@pie-element/rubric@2.0.11) (2022-09-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/rubric
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.0.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric@2.0.9...@pie-element/rubric@2.0.10) (2022-09-14)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/rubric
|
package/configure/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
|
+
## [2.0.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-configure@2.0.10...@pie-element/rubric-configure@2.0.11) (2022-09-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/rubric-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.0.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/rubric-configure@2.0.9...@pie-element/rubric-configure@2.0.10) (2022-09-14)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/rubric-configure
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
model: {
|
|
9
|
+
points: ['', '', '', ''],
|
|
10
|
+
sampleAnswers: [null, null, null, null],
|
|
11
|
+
maxPoints: 4,
|
|
12
|
+
excludeZero: false,
|
|
13
|
+
excludeZeroEnabled: true,
|
|
14
|
+
maxPointsEnabled: true
|
|
15
|
+
},
|
|
16
|
+
configuration: {
|
|
17
|
+
showExcludeZero: {
|
|
18
|
+
settings: true,
|
|
19
|
+
label: 'Ability to exclude zero'
|
|
20
|
+
},
|
|
21
|
+
showMaxPoint: {
|
|
22
|
+
settings: true,
|
|
23
|
+
label: 'Show max points dropdown'
|
|
24
|
+
},
|
|
25
|
+
settingsPanelDisabled: false
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports["default"] = _default;
|
|
29
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","points","sampleAnswers","maxPoints","excludeZero","excludeZeroEnabled","maxPointsEnabled","configuration","showExcludeZero","settings","label","showMaxPoint","settingsPanelDisabled"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADH;AAELC,IAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFV;AAGLC,IAAAA,SAAS,EAAE,CAHN;AAILC,IAAAA,WAAW,EAAE,KAJR;AAKLC,IAAAA,kBAAkB,EAAE,IALf;AAMLC,IAAAA,gBAAgB,EAAE;AANb,GADM;AASbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,eAAe,EAAE;AACfC,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KADJ;AAKbC,IAAAA,YAAY,EAAE;AACZF,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KALD;AASbE,IAAAA,qBAAqB,EAAE;AATV;AATF,C","sourcesContent":["export default {\n model: {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 4,\n excludeZero: false,\n excludeZeroEnabled: true,\n maxPointsEnabled: true\n },\n configuration: {\n showExcludeZero: {\n settings: true,\n label: 'Ability to exclude zero',\n },\n showMaxPoint: {\n settings: true,\n label: 'Show max points dropdown'\n },\n settingsPanelDisabled: false\n }\n};\n"],"file":"defaults.js"}
|
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,CAAAC,CAAC;AAAA,yCAAUC,qBAASC,KAAnB,GAA6BF,CAA7B;AAAA,CAA3B;;AACA,IAAMG,yBAAyB,GAAG,SAA5BA,yBAA4B,CAAAC,CAAC;AAAA,yCAAUH,qBAASI,aAAnB,GAAqCD,CAArC;AAAA,CAAnC;;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,96 @@
|
|
|
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
|
+
var styles = {
|
|
35
|
+
design: {
|
|
36
|
+
fontFamily: 'Cerebri Sans',
|
|
37
|
+
fontSize: '14px'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var Main = /*#__PURE__*/function (_React$Component) {
|
|
42
|
+
(0, _inherits2["default"])(Main, _React$Component);
|
|
43
|
+
|
|
44
|
+
var _super = _createSuper(Main);
|
|
45
|
+
|
|
46
|
+
function Main() {
|
|
47
|
+
(0, _classCallCheck2["default"])(this, Main);
|
|
48
|
+
return _super.apply(this, arguments);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
(0, _createClass2["default"])(Main, [{
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
var _ref = this.props || {},
|
|
55
|
+
model = _ref.model,
|
|
56
|
+
classes = _ref.classes,
|
|
57
|
+
configuration = _ref.configuration,
|
|
58
|
+
onConfigurationChanged = _ref.onConfigurationChanged,
|
|
59
|
+
onModelChanged = _ref.onModelChanged;
|
|
60
|
+
|
|
61
|
+
var _ref2 = configuration || {},
|
|
62
|
+
settingsPanelDisabled = _ref2.settingsPanelDisabled,
|
|
63
|
+
showExcludeZero = _ref2.showExcludeZero,
|
|
64
|
+
showMaxPoint = _ref2.showMaxPoint;
|
|
65
|
+
|
|
66
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
67
|
+
className: classes.design
|
|
68
|
+
}, settingsPanelDisabled ? /*#__PURE__*/_react["default"].createElement(_rubric.Authoring, {
|
|
69
|
+
value: model,
|
|
70
|
+
onChange: onModelChanged
|
|
71
|
+
}) : /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
72
|
+
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
73
|
+
model: model,
|
|
74
|
+
onChangeModel: onModelChanged,
|
|
75
|
+
configuration: configuration,
|
|
76
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
77
|
+
groups: {
|
|
78
|
+
Properties: {
|
|
79
|
+
excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
|
|
80
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement(_rubric.Authoring, {
|
|
85
|
+
value: model,
|
|
86
|
+
onChange: onModelChanged
|
|
87
|
+
})));
|
|
88
|
+
}
|
|
89
|
+
}]);
|
|
90
|
+
return Main;
|
|
91
|
+
}(_react["default"].Component);
|
|
92
|
+
|
|
93
|
+
var _default = (0, _styles.withStyles)(styles)(Main);
|
|
94
|
+
|
|
95
|
+
exports["default"] = _default;
|
|
96
|
+
//# 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;;;;;;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 { 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": "2.0.
|
|
4
|
+
"version": "2.0.11",
|
|
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": "0.
|
|
9
|
+
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
10
|
+
"@pie-lib/rubric": "0.6.0",
|
|
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
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,49 @@
|
|
|
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 = {
|
|
9
|
+
design: {
|
|
10
|
+
fontFamily: 'Cerebri Sans',
|
|
11
|
+
fontSize: '14px',
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class Main extends React.Component {
|
|
16
|
+
render() {
|
|
17
|
+
const { model, classes, configuration, onConfigurationChanged, onModelChanged } = this.props || {};
|
|
18
|
+
const {
|
|
19
|
+
settingsPanelDisabled,
|
|
20
|
+
showExcludeZero,
|
|
21
|
+
showMaxPoint
|
|
22
|
+
} = configuration || {};
|
|
23
|
+
return (
|
|
24
|
+
<div className={classes.design}>
|
|
25
|
+
{settingsPanelDisabled ? <Authoring value={model} onChange={onModelChanged} /> :
|
|
26
|
+
<layout.ConfigLayout
|
|
27
|
+
settings={
|
|
28
|
+
<Panel
|
|
29
|
+
model={model}
|
|
30
|
+
onChangeModel={onModelChanged}
|
|
31
|
+
configuration={configuration}
|
|
32
|
+
onChangeConfiguration={onConfigurationChanged}
|
|
33
|
+
groups={{
|
|
34
|
+
Properties: {
|
|
35
|
+
excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
|
|
36
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
37
|
+
}
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
}
|
|
41
|
+
>
|
|
42
|
+
<Authoring value={model} onChange={onModelChanged} />
|
|
43
|
+
</layout.ConfigLayout>}
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default withStyles(styles)(Main);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12-next.173+d434ce108",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"description": "Rubric Scoring Interaction",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"author": "pie framework developers",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "d434ce108dd12cb05f72f676a79bbfba67944cb3",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"postpublish": "../../scripts/postpublish"
|
|
20
20
|
},
|