@pie-element/complex-rubric 2.0.2-next.13 → 2.0.2-next.15

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.
Files changed (96) hide show
  1. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
  2. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +978 -0
  3. package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +5 -0
  4. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
  5. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
  6. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +869 -0
  7. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +502 -0
  8. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
  9. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +98 -0
  10. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
  11. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +126 -0
  12. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
  13. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +553 -0
  14. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
  15. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +361 -0
  16. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
  17. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +552 -0
  18. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
  19. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +371 -0
  20. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
  21. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +270 -0
  22. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
  23. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +29 -0
  24. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
  25. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +18 -0
  26. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
  27. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +210 -0
  28. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +94 -0
  29. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
  30. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +161 -0
  31. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
  32. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +13 -0
  33. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +1 -0
  34. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +15 -0
  35. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +272 -0
  36. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +206 -0
  37. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
  38. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +180 -0
  39. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
  40. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
  41. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +298 -0
  42. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +201 -0
  43. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +85 -0
  44. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
  45. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +161 -0
  46. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
  47. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +330 -0
  48. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
  49. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +103 -0
  50. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
  51. package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +24 -0
  52. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
  53. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +1248 -0
  54. package/configure/node_modules/@pie-element/rubric/LICENSE.md +5 -0
  55. package/configure/node_modules/@pie-element/rubric/README.md +3 -0
  56. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
  57. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +1088 -0
  58. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +34 -0
  59. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +1 -0
  60. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +130 -0
  61. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
  62. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +108 -0
  63. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
  64. package/configure/node_modules/@pie-element/rubric/configure/package.json +17 -0
  65. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +26 -0
  66. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +64 -0
  67. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +56 -0
  68. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
  69. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +192 -0
  70. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +14 -0
  71. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
  72. package/configure/node_modules/@pie-element/rubric/controller/package.json +13 -0
  73. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +31 -0
  74. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +6 -0
  75. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +160 -0
  76. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +127 -0
  77. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
  78. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
  79. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +2 -0
  80. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +96 -0
  81. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +65 -0
  82. package/configure/node_modules/@pie-element/rubric/lib/index.js +88 -0
  83. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
  84. package/configure/node_modules/@pie-element/rubric/lib/main.js +188 -0
  85. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
  86. package/configure/node_modules/@pie-element/rubric/lib/print.js +114 -0
  87. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
  88. package/configure/node_modules/@pie-element/rubric/package.json +26 -0
  89. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +23003 -0
  90. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +46 -0
  91. package/configure/node_modules/@pie-element/rubric/src/index.js +34 -0
  92. package/configure/node_modules/@pie-element/rubric/src/main.jsx +136 -0
  93. package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
  94. package/configure/package.json +2 -2
  95. package/controller/package.json +1 -1
  96. package/package.json +4 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","visibleToStudent","halfScoring","pointLabels","description","standards","scales","excludeZero","maxPointsEnabled","addScaleEnabled","configuration","excludeZeroDialogBoxContent","title","text","includeZeroDialogBoxContent","deleteScaleDialogBoxContent","maxPointsDialogBoxContent","settingsPanelDisabled","spellCheck","label","settings","enabled","showExcludeZero","showScorePointLabels","showDescription","showVisibleToStudent","showHalfScoring","width","showStandards","showLevelTagInput","dragAndDrop","showMaxPoint","addScale","minNoOfTraits","maxNoOfTraits","minNoOfScales","maxNoOfScales","defaultTraitLabel"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,gBAAgB,EAAE,IADb;AAELC,IAAAA,WAAW,EAAE,KAFR;AAGLC,IAAAA,WAAW,EAAE,IAHR;AAILC,IAAAA,WAAW,EAAE,KAJR;AAKLC,IAAAA,SAAS,EAAE,KALN;AAMLC,IAAAA,MAAM,EAAE,EANH;AAOLC,IAAAA,WAAW,EAAE,KAPR;AAQLC,IAAAA,gBAAgB,EAAE,IARb;AASLC,IAAAA,eAAe,EAAE;AATZ,GADM;AAYbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,2BAA2B,EAAE;AAC3BC,MAAAA,KAAK,EAAE,2CADoB;AAE3BC,MAAAA,IAAI;AAFuB,KADhB;AAmBbC,IAAAA,2BAA2B,EAAE;AAC3BF,MAAAA,KAAK,EAAE,yCADoB;AAE3BC,MAAAA,IAAI;AAFuB,KAnBhB;AAqCbE,IAAAA,2BAA2B,EAAE;AAC3BH,MAAAA,KAAK,EAAE,cADoB;AAE3BC,MAAAA,IAAI,EAAE;AAFqB,KArChB;AAyCbG,IAAAA,yBAAyB,EAAE;AACzBJ,MAAAA,KAAK,EAAE,wBADkB;AAEzBC,MAAAA,IAAI;AAFqB,KAzCd;AA+CbI,IAAAA,qBAAqB,EAAE,KA/CV;AAgDbC,IAAAA,UAAU,EAAE;AACVC,MAAAA,KAAK,EAAE,YADG;AAEVC,MAAAA,QAAQ,EAA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GF;AAmGbC,IAAAA,aAAa,EAAE,CAnGF;AAoGbC,IAAAA,aAAa,EAAE,EApGF;AAqGbC,IAAAA,iBAAiB,EAAE;AArGN;AAZF,C","sourcesContent":["export default {\n model: {\n visibleToStudent: true,\n halfScoring: false,\n pointLabels: true,\n description: false,\n standards: false,\n scales: [],\n excludeZero: false,\n maxPointsEnabled: true,\n addScaleEnabled: true,\n },\n configuration: {\n excludeZeroDialogBoxContent: {\n title: 'Exclude 0 (Zero) from Score Point Values.',\n text: `<div>\n You are about to exclude 0 from score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the left\n </li>\n <li>\n remove 0 column with its Label and Description\n </li>\n </ul>\n </div>`,\n },\n includeZeroDialogBoxContent: {\n title: 'Include 0 (Zero) in Score Point Values.',\n text: `<div>\n You are about to include 0 in score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the right\n </li>\n <li>\n add 0 column with empty Label and Descriptions\n </li>\n </ul>\n </div>`,\n },\n deleteScaleDialogBoxContent: {\n title: 'Delete Scale',\n text: 'Are you sure you want to delete this scale?',\n },\n maxPointsDialogBoxContent: {\n title: 'Decreasing Max Points.',\n text: ` You are about to decrease max score point value.\n <br/>\n All the Labels and Descriptions for scores above Max Point will be deleted.`,\n },\n settingsPanelDisabled: false,\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n showExcludeZero: {\n settings: true,\n label: 'Exclude Zero',\n },\n showScorePointLabels: {\n settings: true,\n label: 'Show Score Point Labels',\n },\n showDescription: {\n settings: true,\n label: 'Show Description',\n },\n showVisibleToStudent: {\n settings: true,\n label: 'Visible to Student',\n },\n showHalfScoring: {\n settings: true,\n label: 'Half Scoring',\n },\n width: '900px',\n // these should not be set to true (should not be used) for now\n showStandards: {\n settings: false,\n label: 'Show Standards',\n },\n showLevelTagInput: {\n settings: false,\n label: 'Show Level Tag Input',\n enabled: false,\n },\n dragAndDrop: {\n settings: true,\n label: 'Enable Drag and Drop',\n enabled: false,\n },\n showMaxPoint: {\n settings: true,\n label: 'Show Max Points Dropdown',\n },\n addScale: {\n settings: true,\n label: 'Add Scale Available',\n },\n minNoOfTraits: 1,\n maxNoOfTraits: 10,\n minNoOfScales: 2,\n maxNoOfScales: 10,\n defaultTraitLabel: 'Trait',\n },\n};\n"],"file":"defaults.js"}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createCorrectResponseSession = void 0;
9
+ exports.createDefaultModel = createDefaultModel;
10
+ exports.getScore = void 0;
11
+ exports.model = model;
12
+ exports.normalize = void 0;
13
+ exports.outcome = outcome;
14
+ exports.validate = void 0;
15
+
16
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
17
+
18
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
+
20
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
+
22
+ var _defaults = _interopRequireDefault(require("./defaults"));
23
+
24
+ var _utils = require("./utils");
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+
30
+ function createDefaultModel() {
31
+ var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
+ return new Promise(function (resolve) {
33
+ return resolve(_objectSpread(_objectSpread({}, _defaults["default"]), model));
34
+ });
35
+ }
36
+
37
+ var normalize = function normalize(question) {
38
+ return _objectSpread(_objectSpread({}, _defaults["default"]), question);
39
+ };
40
+ /**
41
+ *
42
+ * @param {*} question
43
+ * @param {*} session
44
+ * @param {*} env
45
+ */
46
+
47
+
48
+ exports.normalize = normalize;
49
+
50
+ function model(_x, _x2, _x3) {
51
+ return _model.apply(this, arguments);
52
+ }
53
+
54
+ function _model() {
55
+ _model = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(question, session, env) {
56
+ var normalizedQuestion, _ref, scales, excludeZero, parsedScales;
57
+
58
+ return _regenerator["default"].wrap(function _callee$(_context) {
59
+ while (1) {
60
+ switch (_context.prev = _context.next) {
61
+ case 0:
62
+ normalizedQuestion = normalize(question);
63
+
64
+ if (!env.role || env.role === 'student') {
65
+ normalizedQuestion.visible = normalizedQuestion.visibleToStudent;
66
+ } else {
67
+ normalizedQuestion.visible = true;
68
+ } // todo update pie-ui instead of parsing this here:
69
+
70
+
71
+ _ref = normalizedQuestion || {}, scales = _ref.scales, excludeZero = _ref.excludeZero;
72
+ parsedScales = (scales || []).map(function (scale) {
73
+ return _objectSpread(_objectSpread({}, scale), {}, {
74
+ excludeZero: excludeZero
75
+ });
76
+ });
77
+ return _context.abrupt("return", _objectSpread(_objectSpread({}, normalizedQuestion), {}, {
78
+ scales: parsedScales
79
+ }));
80
+
81
+ case 5:
82
+ case "end":
83
+ return _context.stop();
84
+ }
85
+ }
86
+ }, _callee);
87
+ }));
88
+ return _model.apply(this, arguments);
89
+ }
90
+
91
+ var getScore = function getScore() {
92
+ return 0;
93
+ };
94
+ /**
95
+ * @param {Object} model - the main model
96
+ * @param {*} session
97
+ * @param {Object} env
98
+ */
99
+
100
+
101
+ exports.getScore = getScore;
102
+
103
+ function outcome() {
104
+ return new Promise(function (resolve) {
105
+ return resolve({
106
+ score: 0,
107
+ empty: true
108
+ });
109
+ });
110
+ }
111
+
112
+ var createCorrectResponseSession = function createCorrectResponseSession(question, env) {
113
+ return new Promise(function (resolve) {
114
+ if (env.mode !== 'evaluate' && env.role === 'instructor') {
115
+ resolve({
116
+ id: '1'
117
+ });
118
+ } else {
119
+ resolve(null);
120
+ }
121
+ });
122
+ };
123
+
124
+ exports.createCorrectResponseSession = createCorrectResponseSession;
125
+
126
+ var validate = function validate(model, config) {
127
+ var scales = model.scales;
128
+ var errors = {};
129
+ var traitsErrors = {};
130
+ (scales || []).forEach(function (scale, scaleIndex) {
131
+ var _scale$traits = scale.traits,
132
+ traits = _scale$traits === void 0 ? [] : _scale$traits;
133
+ var scaleErrors = {};
134
+ traits.forEach(function (trait, traitIndex) {
135
+ if (!trait.name || trait.name === '<div></div>') {
136
+ scaleErrors[traitIndex] = 'Trait names should not be empty.';
137
+ } else {
138
+ var identicalTraitName = traits.slice(traitIndex + 1).some(function (t) {
139
+ return (0, _utils.markupToText)(t.name) === (0, _utils.markupToText)(trait.name);
140
+ });
141
+
142
+ if (identicalTraitName) {
143
+ scaleErrors[traitIndex] = 'Trait names should be unique.';
144
+ }
145
+ }
146
+ });
147
+
148
+ if (Object.keys(scaleErrors).length > 0) {
149
+ traitsErrors[scaleIndex] = scaleErrors;
150
+ }
151
+ });
152
+
153
+ if (Object.keys(traitsErrors).length > 0) {
154
+ errors.traitsErrors = traitsErrors;
155
+ }
156
+
157
+ return errors;
158
+ };
159
+
160
+ exports.validate = validate;
161
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.js"],"names":["createDefaultModel","model","Promise","resolve","defaults","normalize","question","session","env","normalizedQuestion","role","visible","visibleToStudent","scales","excludeZero","parsedScales","map","scale","getScore","outcome","score","empty","createCorrectResponseSession","mode","id","validate","config","errors","traitsErrors","forEach","scaleIndex","traits","scaleErrors","trait","traitIndex","name","identicalTraitName","slice","some","t","Object","keys","length"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEO,SAASA,kBAAT,GAAwC;AAAA,MAAZC,KAAY,uEAAJ,EAAI;AAC7C,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD;AAAA,WAAaA,OAAO,iCAAMC,oBAAN,GAAmBH,KAAnB,EAApB;AAAA,GAAZ,CAAP;AACD;;AAEM,IAAMI,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA,yCAAoBF,oBAApB,GAAiCE,QAAjC;AAAA,CAAlB;AAEP;AACA;AACA;AACA;AACA;AACA;;;;;SACsBL,K;;;;;yFAAf,iBAAqBK,QAArB,EAA+BC,OAA/B,EAAwCC,GAAxC;AAAA;;AAAA;AAAA;AAAA;AAAA;AACCC,YAAAA,kBADD,GACsBJ,SAAS,CAACC,QAAD,CAD/B;;AAGL,gBAAI,CAACE,GAAG,CAACE,IAAL,IAAaF,GAAG,CAACE,IAAJ,KAAa,SAA9B,EAAyC;AACvCD,cAAAA,kBAAkB,CAACE,OAAnB,GAA6BF,kBAAkB,CAACG,gBAAhD;AACD,aAFD,MAEO;AACLH,cAAAA,kBAAkB,CAACE,OAAnB,GAA6B,IAA7B;AACD,aAPI,CASL;;;AATK,mBAU2BF,kBAAkB,IAAI,EAVjD,EAUGI,MAVH,QAUGA,MAVH,EAUWC,WAVX,QAUWA,WAVX;AAWCC,YAAAA,YAXD,GAWgB,CAACF,MAAM,IAAI,EAAX,EAAeG,GAAf,CAAmB,UAACC,KAAD;AAAA,qDAAiBA,KAAjB;AAAwBH,gBAAAA,WAAW,EAAXA;AAAxB;AAAA,aAAnB,CAXhB;AAAA,6EAcAL,kBAdA;AAeHI,cAAAA,MAAM,EAAEE;AAfL;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAmBA,IAAMG,QAAQ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X,GAA0B,kCAA1B;AACD,OAFD,MAGI;AACF,YAAME,kBAAkB,GAAGL,MAAM,CAACM,KAAP,CAAaH,UAAU,GAAG,CAA1B,EAA6BI,IAA7B,CAAkC,UAAAC,CAAC;AAAA,iBAAI,yBAAaA,CAAC,CAACJ,IAAf,MAAyB,yBAAaF,KAAK,CAACE,IAAnB,CAA7B;AAAA,SAAnC,CAA3B;;AAEA,YAAIC,kBAAJ,EAAwB;AACtBJ,UAAAA,WAAW,CAACE,UAAD,CAAX,GAA0B,+BAA1B;AACD;AACF;AACF,KAXD;;AAYA,QAAGM,MAAM,CAACC,IAAP,CAAYT,WAAZ,EAAyBU,MAAzB,GAAkC,CAArC,EAAuC;AACrCd,MAAAA,YAAY,CAACE,UAAD,CAAZ,GAA2BE,WAA3B;AACD;AACF,GAlBD;;AAmBA,MAAGQ,MAAM,CAACC,IAAP,CAAYb,YAAZ,EAA0Bc,MAA1B,GAAmC,CAAtC,EAAwC;AACtCf,IAAAA,MAAM,CAACC,YAAP,GAAsBA,YAAtB;AACD;;AAED,SAAOD,MAAP;AACD,CA7BM","sourcesContent":["import defaults from './defaults';\nimport { markupToText } from './utils';\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n\n if (!env.role || env.role === 'student') {\n normalizedQuestion.visible = normalizedQuestion.visibleToStudent;\n } else {\n normalizedQuestion.visible = true;\n }\n\n // todo update pie-ui instead of parsing this here:\n const { scales, excludeZero } = normalizedQuestion || {};\n const parsedScales = (scales || []).map((scale) => ({ ...scale, excludeZero }));\n\n return {\n ...normalizedQuestion,\n scales: parsedScales,\n };\n}\n\nexport const getScore = () => 0;\n\n/**\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome() {\n return new Promise((resolve) => resolve({ score: 0, empty: true }));\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({ id: '1' });\n } else {\n resolve(null);\n }\n });\n};\n\n\nexport const validate = (model, config) => {\n const { scales } = model;\n const errors = {};\n const traitsErrors = {};\n\n (scales || []).forEach((scale, scaleIndex) => {\n const { traits = [] } = scale;\n const scaleErrors = {};\n traits.forEach((trait, traitIndex) => {\n if(!trait.name || trait.name === '<div></div>') {\n scaleErrors[traitIndex] = 'Trait names should not be empty.';\n }\n else{\n const identicalTraitName = traits.slice(traitIndex + 1).some(t => markupToText(t.name) === markupToText(trait.name));\n\n if (identicalTraitName) {\n scaleErrors[traitIndex] = 'Trait names should be unique.';\n }\n }\n });\n if(Object.keys(scaleErrors).length > 0){\n traitsErrors[scaleIndex] = scaleErrors;\n }\n });\n if(Object.keys(traitsErrors).length > 0){\n errors.traitsErrors = traitsErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.markupToText = void 0;
7
+
8
+ var markupToText = function markupToText(s) {
9
+ return (s || '').replace(/(<([^>]+)>)/ig, '');
10
+ };
11
+
12
+ exports.markupToText = markupToText;
13
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.js"],"names":["markupToText","s","replace"],"mappings":";;;;;;;AAAO,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,CAAD,EAAO;AAC/B,SAAO,CAACA,CAAC,IAAI,EAAN,EAAUC,OAAV,CAAkB,eAAlB,EAAmC,EAAnC,CAAP;AACH,CAFM","sourcesContent":["export const markupToText = (s) => {\n return (s || '').replace(/(<([^>]+)>)/ig, '');\n};\n"],"file":"utils.js"}
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@pie-element/multi-trait-rubric-controller",
3
+ "private": true,
4
+ "version": "2.0.1",
5
+ "description": "",
6
+ "main": "lib/index.js",
7
+ "module": "src/index.js",
8
+ "author": "",
9
+ "license": "ISC",
10
+ "dependencies": {
11
+ "@pie-lib/pie-toolbox": "1.0.12-next.3",
12
+ "debug": "^3.1.0",
13
+ "lodash": "^4.17.15"
14
+ }
15
+ }
@@ -0,0 +1,272 @@
1
+ {
2
+ "description": "Config Object for @pie-elements/multi-trait-rubric",
3
+ "additionalProperties": false,
4
+ "type": "object",
5
+ "properties": {
6
+ "excludeZeroDialogBoxContent": {
7
+ "title": "DialogContent",
8
+ "type": "object",
9
+ "properties": {
10
+ "title": {
11
+ "description": "Dialog box title",
12
+ "type": "string",
13
+ "title": "title"
14
+ },
15
+ "text": {
16
+ "description": "Dialog box text",
17
+ "type": "string",
18
+ "title": "text"
19
+ }
20
+ }
21
+ },
22
+ "includeZeroDialogBoxContent": {
23
+ "title": "DialogContent",
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "description": "Dialog box title",
28
+ "type": "string",
29
+ "title": "title"
30
+ },
31
+ "text": {
32
+ "description": "Dialog box text",
33
+ "type": "string",
34
+ "title": "text"
35
+ }
36
+ }
37
+ },
38
+ "deleteScaleDialogBoxContent": {
39
+ "title": "DialogContent",
40
+ "type": "object",
41
+ "properties": {
42
+ "title": {
43
+ "description": "Dialog box title",
44
+ "type": "string",
45
+ "title": "title"
46
+ },
47
+ "text": {
48
+ "description": "Dialog box text",
49
+ "type": "string",
50
+ "title": "text"
51
+ }
52
+ }
53
+ },
54
+ "maxPointsDialogBoxContent": {
55
+ "title": "DialogContent",
56
+ "type": "object",
57
+ "properties": {
58
+ "title": {
59
+ "description": "Dialog box title",
60
+ "type": "string",
61
+ "title": "title"
62
+ },
63
+ "text": {
64
+ "description": "Dialog box text",
65
+ "type": "string",
66
+ "title": "text"
67
+ }
68
+ }
69
+ },
70
+ "settingsPanelDisabled": {
71
+ "description": "Indicates if the settings panel is not available",
72
+ "type": "boolean",
73
+ "title": "settingsPanelDisabled"
74
+ },
75
+ "showExcludeZero": {
76
+ "title": "ConfigureProp",
77
+ "type": "object",
78
+ "properties": {
79
+ "settings": {
80
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
81
+ "type": "boolean",
82
+ "title": "settings"
83
+ },
84
+ "label": {
85
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
86
+ "type": "string",
87
+ "title": "label"
88
+ }
89
+ }
90
+ },
91
+ "showScorePointLabels": {
92
+ "title": "ConfigureProp",
93
+ "type": "object",
94
+ "properties": {
95
+ "settings": {
96
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
97
+ "type": "boolean",
98
+ "title": "settings"
99
+ },
100
+ "label": {
101
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
102
+ "type": "string",
103
+ "title": "label"
104
+ }
105
+ }
106
+ },
107
+ "showDescription": {
108
+ "title": "ConfigureProp",
109
+ "type": "object",
110
+ "properties": {
111
+ "settings": {
112
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
113
+ "type": "boolean",
114
+ "title": "settings"
115
+ },
116
+ "label": {
117
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
118
+ "type": "string",
119
+ "title": "label"
120
+ }
121
+ }
122
+ },
123
+ "showVisibleToStudent": {
124
+ "title": "ConfigureProp",
125
+ "type": "object",
126
+ "properties": {
127
+ "settings": {
128
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
129
+ "type": "boolean",
130
+ "title": "settings"
131
+ },
132
+ "label": {
133
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
134
+ "type": "string",
135
+ "title": "label"
136
+ }
137
+ }
138
+ },
139
+ "showHalfScoring": {
140
+ "title": "ConfigureProp",
141
+ "type": "object",
142
+ "properties": {
143
+ "settings": {
144
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
145
+ "type": "boolean",
146
+ "title": "settings"
147
+ },
148
+ "label": {
149
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
150
+ "type": "string",
151
+ "title": "label"
152
+ }
153
+ }
154
+ },
155
+ "spellCheck": {
156
+ "title": "ConfigureProp",
157
+ "type": "object",
158
+ "properties": {
159
+ "settings": {
160
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
161
+ "type": "boolean",
162
+ "title": "settings"
163
+ },
164
+ "label": {
165
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
166
+ "type": "string",
167
+ "title": "label"
168
+ }
169
+ }
170
+ },
171
+ "width": {
172
+ "description": "How large (in px) should multi-trait-rubric be",
173
+ "type": "string",
174
+ "title": "width"
175
+ },
176
+ "minNoOfTraits": {
177
+ "description": "Minimum number of traits",
178
+ "type": "number",
179
+ "title": "minNoOfTraits"
180
+ },
181
+ "maxNoOfTraits": {
182
+ "description": "Maximum number of traits",
183
+ "type": "number",
184
+ "title": "maxNoOfTraits"
185
+ },
186
+ "minNoOfScales": {
187
+ "description": "Minimum number of scales",
188
+ "type": "number",
189
+ "title": "minNoOfScales"
190
+ },
191
+ "maxNoOfScales": {
192
+ "description": "Maximum number of scales",
193
+ "type": "number",
194
+ "title": "maxNoOfScales"
195
+ },
196
+ "defaultTraitLabel": {
197
+ "description": "The default trait label for new created scales.\nIf it's not defined, it will default to the label of the first trait.",
198
+ "type": "string",
199
+ "title": "defaultTraitLabel"
200
+ },
201
+ "mathMlOptions": {
202
+ "title": "ConfigureMathMLProp",
203
+ "type": "object",
204
+ "properties": {
205
+ "mmlOutput": {
206
+ "description": "Indicates if model should have mathML output instead of latex",
207
+ "type": "number",
208
+ "title": "mmlOutput"
209
+ },
210
+ "mmlEditing": {
211
+ "description": "Indicates if mathML that's already in model should be editable",
212
+ "type": "number",
213
+ "title": "mmlEditing"
214
+ }
215
+ }
216
+ }
217
+ },
218
+ "required": [
219
+ "width"
220
+ ],
221
+ "definitions": {
222
+ "DialogContent": {
223
+ "title": "DialogContent",
224
+ "type": "object",
225
+ "properties": {
226
+ "title": {
227
+ "description": "Dialog box title",
228
+ "type": "string",
229
+ "title": "title"
230
+ },
231
+ "text": {
232
+ "description": "Dialog box text",
233
+ "type": "string",
234
+ "title": "text"
235
+ }
236
+ }
237
+ },
238
+ "ConfigureProp": {
239
+ "title": "ConfigureProp",
240
+ "type": "object",
241
+ "properties": {
242
+ "settings": {
243
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
244
+ "type": "boolean",
245
+ "title": "settings"
246
+ },
247
+ "label": {
248
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
249
+ "type": "string",
250
+ "title": "label"
251
+ }
252
+ }
253
+ },
254
+ "ConfigureMathMLProp": {
255
+ "title": "ConfigureMathMLProp",
256
+ "type": "object",
257
+ "properties": {
258
+ "mmlOutput": {
259
+ "description": "Indicates if model should have mathML output instead of latex",
260
+ "type": "number",
261
+ "title": "mmlOutput"
262
+ },
263
+ "mmlEditing": {
264
+ "description": "Indicates if mathML that's already in model should be editable",
265
+ "type": "number",
266
+ "title": "mmlEditing"
267
+ }
268
+ }
269
+ }
270
+ },
271
+ "$schema": "http://json-schema.org/draft-07/schema#"
272
+ }