@pie-element/complex-rubric 3.8.1-next.10 → 3.8.1-next.9
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/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +2683 -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 +2484 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +68 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +197 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +162 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +573 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +24 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +172 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/package.json +20 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +178 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +42 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/index.js +129 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +89 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +449 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +9 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +94 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +1510 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +16 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +59 -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 +12 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +33 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +8 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/index.js +41 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +712 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +532 -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 +2 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +391 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +281 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js +94 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js +270 -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/module/configure.js +1 -0
- package/configure/node_modules/@pie-element/rubric/module/controller.js +113 -0
- package/configure/node_modules/@pie-element/rubric/module/demo.js +33 -0
- package/configure/node_modules/@pie-element/rubric/module/element.js +1 -0
- package/configure/node_modules/@pie-element/rubric/module/index.html +21 -0
- package/configure/node_modules/@pie-element/rubric/module/manifest.json +10 -0
- package/configure/node_modules/@pie-element/rubric/module/print-demo.js +71 -0
- package/configure/node_modules/@pie-element/rubric/module/print.html +18 -0
- package/configure/node_modules/@pie-element/rubric/module/print.js +1 -0
- package/configure/node_modules/@pie-element/rubric/package.json +27 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +1815 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +49 -0
- package/configure/node_modules/@pie-element/rubric/src/index.js +37 -0
- package/configure/node_modules/@pie-element/rubric/src/main.jsx +219 -0
- package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
- package/configure/package.json +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
points: ['', '', '', ''],
|
|
9
|
+
sampleAnswers: [null, null, null, null],
|
|
10
|
+
maxPoints: 3,
|
|
11
|
+
maxPointsEnabled: true,
|
|
12
|
+
excludeZero: false,
|
|
13
|
+
excludeZeroEnabled: true
|
|
14
|
+
};
|
|
15
|
+
exports["default"] = _default;
|
|
16
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["points","sampleAnswers","maxPoints","maxPointsEnabled","excludeZero","excludeZeroEnabled"],"mappings":";;;;;;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;AANP,C","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"],"file":"defaults.js"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.model = model;
|
|
9
|
+
exports.validate = validate;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
var normalize = function normalize(model) {
|
|
20
|
+
return _objectSpread(_objectSpread({}, _defaults["default"]), model);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function model(model, session, env) {
|
|
24
|
+
return new Promise(function (resolve) {
|
|
25
|
+
var modelResult = normalize(model || {});
|
|
26
|
+
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function markupToText(s) {
|
|
31
|
+
return (s || '').replace(/(<([^>]+)>)/gi, '');
|
|
32
|
+
} // IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function validate(model) {
|
|
36
|
+
var points = model.points;
|
|
37
|
+
var errors = {};
|
|
38
|
+
var pointsDescriptorsErrors = {};
|
|
39
|
+
(points || []).forEach(function (point, index) {
|
|
40
|
+
if (!point || point === '<div></div>') {
|
|
41
|
+
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
42
|
+
} else {
|
|
43
|
+
var identicalPointDescr = points.slice(index + 1).some(function (p) {
|
|
44
|
+
return markupToText(p) === markupToText(point);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (identicalPointDescr) {
|
|
48
|
+
pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (Object.keys(pointsDescriptorsErrors).length > 0) {
|
|
54
|
+
errors.pointsDescriptorsErrors = pointsDescriptorsErrors;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return errors;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["normalize","model","defaults","session","env","Promise","resolve","modelResult","role","markupToText","s","replace","validate","points","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length"],"mappings":";;;;;;;;;;;;AAAA;;;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;AAAA,yCAAiBC,oBAAjB,GAA8BD,KAA9B;AAAA,CAAlB;;AAEO,SAASA,KAAT,CAAeA,KAAf,EAAsBE,OAAtB,EAA+BC,GAA/B,EAAoC;AACzC,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9B,QAAMC,WAAW,GAAGP,SAAS,CAACC,KAAK,IAAI,EAAV,CAA7B;AAEAK,IAAAA,OAAO,CAACF,GAAG,IAAIA,GAAG,CAACI,IAAX,IAAmBJ,GAAG,CAACI,IAAJ,KAAa,YAAhC,GAA+CD,WAA/C,GAA6D,EAA9D,CAAP;AACD,GAJM,CAAP;AAKD;;AAED,SAASE,YAAT,CAAsBC,CAAtB,EAAyB;AACvB,SAAO,CAACA,CAAC,IAAI,EAAN,EAAUC,OAAV,CAAkB,eAAlB,EAAmC,EAAnC,CAAP;AACD,C,CAED;;;AACO,SAASC,QAAT,CAAkBX,KAAlB,EAAyB;AAC9B,MAAQY,MAAR,GAAmBZ,KAAnB,CAAQY,MAAR;AACA,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,uBAAuB,GAAG,EAAhC;AAEA,GAACF,MAAM,IAAI,EAAX,EAAeG,OAAf,CAAuB,UAACC,KAAD,EAAQC,KAAR,EAAkB;AAEvC,QAAI,CAACD,KAAD,IAAUA,KAAK,KAAK,aAAxB,EAAuC;AACrCF,MAAAA,uBAAuB,CAACG,KAAD,CAAvB,GAAiC,qCAAjC;AACD,KAFD,MAEO;AACL,UAAMC,mBAAmB,GAAGN,MAAM,CAACO,KAAP,CAAaF,KAAK,GAAG,CAArB,EAAwBG,IAAxB,CAA6B,UAACC,CAAD;AAAA,eAAOb,YAAY,CAACa,CAAD,CAAZ,KAAoBb,YAAY,CAACQ,KAAD,CAAvC;AAAA,OAA7B,CAA5B;;AAEA,UAAIE,mBAAJ,EAAyB;AACvBJ,QAAAA,uBAAuB,CAACG,KAAD,CAAvB,GAAiC,sCAAjC;AACD;AACF;AACF,GAXD;;AAaA,MAAIK,MAAM,CAACC,IAAP,CAAYT,uBAAZ,EAAqCU,MAArC,GAA8C,CAAlD,EAAqD;AACnDX,IAAAA,MAAM,CAACC,uBAAP,GAAiCA,uBAAjC;AACD;;AAED,SAAOD,MAAP;AACD","sourcesContent":["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"],"file":"index.js"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { model } from '../index';
|
|
2
|
+
|
|
3
|
+
describe('rubric model', () => {
|
|
4
|
+
let state = {
|
|
5
|
+
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
6
|
+
sampleAnswers: [null, 'just right', 'not left', null],
|
|
7
|
+
maxPoints: 4,
|
|
8
|
+
maxPointsEnabled: true,
|
|
9
|
+
excludeZero: false,
|
|
10
|
+
excludeZeroEnabled: true,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let session = {};
|
|
14
|
+
let env, result;
|
|
15
|
+
|
|
16
|
+
it('returns no model for gather', async () => {
|
|
17
|
+
env = { mode: 'gather' };
|
|
18
|
+
result = await model(state, session, env);
|
|
19
|
+
expect(result).toEqual({});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('returns no model for student role', async () => {
|
|
23
|
+
env = { mode: 'gather', role: 'student' };
|
|
24
|
+
result = await model(state, session, env);
|
|
25
|
+
expect(result).toEqual({});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('returns model for instructor role', async () => {
|
|
29
|
+
env = { mode: 'gather', role: 'instructor' };
|
|
30
|
+
result = await model(state, session, env);
|
|
31
|
+
expect(result).toEqual(state);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import defaults from './defaults';
|
|
2
|
+
|
|
3
|
+
const normalize = (model) => ({ ...defaults, ...model });
|
|
4
|
+
|
|
5
|
+
export function model(model, session, env) {
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
const modelResult = normalize(model || {});
|
|
8
|
+
|
|
9
|
+
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function markupToText(s) {
|
|
14
|
+
return (s || '').replace(/(<([^>]+)>)/gi, '');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.
|
|
18
|
+
export function validate(model) {
|
|
19
|
+
const { points } = model;
|
|
20
|
+
const errors = {};
|
|
21
|
+
const pointsDescriptorsErrors = {};
|
|
22
|
+
|
|
23
|
+
(points || []).forEach((point, index) => {
|
|
24
|
+
|
|
25
|
+
if (!point || point === '<div></div>') {
|
|
26
|
+
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
27
|
+
} else {
|
|
28
|
+
const identicalPointDescr = points.slice(index + 1).some((p) => markupToText(p) === markupToText(point));
|
|
29
|
+
|
|
30
|
+
if (identicalPointDescr) {
|
|
31
|
+
pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (Object.keys(pointsDescriptorsErrors).length > 0) {
|
|
37
|
+
errors.pointsDescriptorsErrors = pointsDescriptorsErrors;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return errors;
|
|
41
|
+
}
|