@pie-element/rubric 6.0.1 → 11.0.3-esm.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/package.json +4 -4
- package/controller/package.json +1 -1
- package/esm/configure.css +847 -0
- package/esm/configure.js +1888 -21726
- package/esm/configure.js.map +1 -1
- package/esm/controller.css +847 -0
- package/esm/controller.js +21 -22
- package/esm/controller.js.map +1 -1
- package/esm/element.css +847 -0
- package/esm/element.js +32 -11027
- package/esm/element.js.map +1 -1
- package/esm/print.css +847 -0
- package/esm/print.js +47 -11027
- package/esm/print.js.map +1 -1
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +4 -4
package/esm/controller.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
function _extends() {
|
|
2
|
+
_extends = Object.assign || function (target) {
|
|
3
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
4
|
+
var source = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var key in source) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
8
|
+
target[key] = source[key];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
return target;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return _extends.apply(this, arguments);
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
var defaults = {
|
|
@@ -22,15 +25,11 @@ var defaults = {
|
|
|
22
25
|
excludeZeroEnabled: true
|
|
23
26
|
};
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
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) { _defineProperty(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; }
|
|
28
|
-
|
|
29
|
-
var normalize = model => _objectSpread(_objectSpread({}, defaults), model);
|
|
28
|
+
const normalize = model => _extends({}, defaults, model);
|
|
30
29
|
|
|
31
30
|
function model(model, session, env) {
|
|
32
31
|
return new Promise(resolve => {
|
|
33
|
-
|
|
32
|
+
const modelResult = normalize(model || {});
|
|
34
33
|
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
35
34
|
});
|
|
36
35
|
}
|
|
@@ -41,16 +40,16 @@ function markupToText(s) {
|
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
function validate(model) {
|
|
44
|
-
|
|
43
|
+
const {
|
|
45
44
|
points
|
|
46
45
|
} = model;
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const errors = {};
|
|
47
|
+
const pointsDescriptorsErrors = {};
|
|
49
48
|
(points || []).forEach((point, index) => {
|
|
50
49
|
if (!point || point === '<div></div>') {
|
|
51
50
|
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
52
51
|
} else {
|
|
53
|
-
|
|
52
|
+
const identicalPointDescr = points.slice(index + 1).some(p => markupToText(p) === markupToText(point));
|
|
54
53
|
|
|
55
54
|
if (identicalPointDescr) {
|
|
56
55
|
pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';
|
package/esm/controller.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sources":["
|
|
1
|
+
{"version":3,"file":"controller.js","sources":["../controller/src/defaults.js","../controller/src/index.js"],"sourcesContent":["export default {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n maxPointsEnabled: true,\n excludeZero: false,\n excludeZeroEnabled: true,\n};\n","import defaults from './defaults';\n\nconst normalize = (model) => ({ ...defaults, ...model });\n\nexport function model(model, session, env) {\n return new Promise((resolve) => {\n const modelResult = normalize(model || {});\n\n resolve(env && env.role && env.role === 'instructor' ? modelResult : {});\n });\n}\n\nfunction markupToText(s) {\n return (s || '').replace(/(<([^>]+)>)/gi, '');\n}\n\n// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.\nexport function validate(model) {\n const { points } = model;\n const errors = {};\n const pointsDescriptorsErrors = {};\n\n (points || []).forEach((point, index) => {\n\n if (!point || point === '<div></div>') {\n pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';\n } else {\n const identicalPointDescr = points.slice(index + 1).some((p) => markupToText(p) === markupToText(point));\n\n if (identicalPointDescr) {\n pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';\n }\n }\n });\n\n if (Object.keys(pointsDescriptorsErrors).length > 0) {\n errors.pointsDescriptorsErrors = pointsDescriptorsErrors;\n }\n\n return errors;\n}\n"],"names":["points","sampleAnswers","maxPoints","maxPointsEnabled","excludeZero","excludeZeroEnabled","normalize","model","defaults","session","env","Promise","resolve","modelResult","role","markupToText","s","replace","validate","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,eAAe;AACbA,EAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADK;AAEbC,EAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFF;AAGbC,EAAAA,SAAS,EAAE,CAHE;AAIbC,EAAAA,gBAAgB,EAAE,IAJL;AAKbC,EAAAA,WAAW,EAAE,KALA;AAMbC,EAAAA,kBAAkB,EAAE,IAAA;AANP,CAAf;;ACEA,MAAMC,SAAS,GAAIC,KAAD,iBA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