@pie-element/complex-rubric 2.10.1-next.11 → 2.10.1-next.12

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 (115) hide show
  1. package/configure/package.json +2 -2
  2. package/controller/package.json +1 -1
  3. package/module/configure.js +233613 -0
  4. package/module/controller.js +379 -0
  5. package/module/demo.js +221 -0
  6. package/module/element.js +231245 -0
  7. package/module/index.html +21 -0
  8. package/module/manifest.json +14 -0
  9. package/module/print-demo.js +259 -0
  10. package/module/print.html +18 -0
  11. package/module/print.js +231217 -0
  12. package/package.json +4 -4
  13. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +0 -1
  14. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +0 -1383
  15. package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +0 -5
  16. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +0 -55
  17. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +0 -1
  18. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +0 -1270
  19. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +0 -584
  20. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +0 -1
  21. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +0 -143
  22. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +0 -1
  23. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +0 -204
  24. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +0 -1
  25. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +0 -602
  26. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +0 -1
  27. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +0 -361
  28. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +0 -1
  29. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +0 -556
  30. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +0 -1
  31. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +0 -380
  32. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +0 -1
  33. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +0 -296
  34. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +0 -1
  35. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +0 -14
  36. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +0 -1
  37. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +0 -18
  38. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +0 -1
  39. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +0 -544
  40. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +0 -94
  41. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +0 -1
  42. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +0 -215
  43. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +0 -1
  44. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +0 -13
  45. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +0 -1
  46. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +0 -15
  47. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +0 -803
  48. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +0 -602
  49. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +0 -8
  50. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +0 -180
  51. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +0 -1
  52. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +0 -6
  53. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +0 -531
  54. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +0 -374
  55. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +0 -85
  56. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +0 -1
  57. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +0 -161
  58. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +0 -1
  59. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +0 -330
  60. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +0 -1
  61. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +0 -103
  62. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +0 -1
  63. package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +0 -24
  64. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
  65. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +0 -1640
  66. package/configure/node_modules/@pie-element/rubric/LICENSE.md +0 -5
  67. package/configure/node_modules/@pie-element/rubric/README.md +0 -3
  68. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +0 -197
  69. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +0 -1471
  70. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +0 -59
  71. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +0 -1
  72. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +0 -194
  73. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +0 -1
  74. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +0 -160
  75. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +0 -1
  76. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +0 -555
  77. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +0 -1
  78. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +0 -24
  79. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +0 -1
  80. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +0 -172
  81. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +0 -1
  82. package/configure/node_modules/@pie-element/rubric/configure/package.json +0 -17
  83. package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +0 -173
  84. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +0 -39
  85. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +0 -127
  86. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +0 -87
  87. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +0 -427
  88. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +0 -9
  89. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +0 -94
  90. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +0 -17
  91. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +0 -536
  92. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +0 -51
  93. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +0 -1
  94. package/configure/node_modules/@pie-element/rubric/controller/package.json +0 -13
  95. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +0 -31
  96. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +0 -42
  97. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +0 -382
  98. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +0 -292
  99. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +0 -8
  100. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +0 -8
  101. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +0 -2
  102. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +0 -226
  103. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +0 -161
  104. package/configure/node_modules/@pie-element/rubric/lib/index.js +0 -88
  105. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +0 -1
  106. package/configure/node_modules/@pie-element/rubric/lib/main.js +0 -187
  107. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +0 -1
  108. package/configure/node_modules/@pie-element/rubric/lib/print.js +0 -114
  109. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +0 -1
  110. package/configure/node_modules/@pie-element/rubric/package.json +0 -26
  111. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -23003
  112. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +0 -50
  113. package/configure/node_modules/@pie-element/rubric/src/index.js +0 -34
  114. package/configure/node_modules/@pie-element/rubric/src/main.jsx +0 -136
  115. package/configure/node_modules/@pie-element/rubric/src/print.js +0 -63
@@ -1,215 +0,0 @@
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
- }; // IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.
123
-
124
-
125
- exports.createCorrectResponseSession = createCorrectResponseSession;
126
-
127
- var validate = function validate(model, config) {
128
- var scales = model.scales,
129
- _model$description = model.description,
130
- description = _model$description === void 0 ? false : _model$description,
131
- _model$pointLabels = model.pointLabels,
132
- pointLabels = _model$pointLabels === void 0 ? false : _model$pointLabels;
133
- var errors = {};
134
- var traitsErrors = {};
135
- var scorePointsErrors = {};
136
- (scales || []).forEach(function (scale, scaleIndex) {
137
- var _scale$traits = scale.traits,
138
- traits = _scale$traits === void 0 ? [] : _scale$traits;
139
- var _scale$scorePointsLab = scale.scorePointsLabels,
140
- scorePointsLabels = _scale$scorePointsLab === void 0 ? [] : _scale$scorePointsLab;
141
- var scaleErrors = {};
142
- var scorePointsLabelsErrors = {};
143
-
144
- if (pointLabels) {
145
- scorePointsLabels.forEach(function (scorePointLabel, scoreIndex) {
146
- if (!scorePointLabel || scorePointLabel === '<div></div>') {
147
- scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';
148
- } else {
149
- var identicalScorePointLabel = scorePointsLabels.slice(scoreIndex + 1).some(function (s) {
150
- return (0, _utils.markupToText)(s) === (0, _utils.markupToText)(scorePointLabel);
151
- });
152
-
153
- if (identicalScorePointLabel) {
154
- scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';
155
- }
156
- }
157
- });
158
- }
159
-
160
- if (Object.keys(scorePointsLabelsErrors).length > 0) {
161
- scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;
162
- }
163
-
164
- traits.forEach(function (trait, traitIndex) {
165
- if (!trait.name || trait.name === '<div></div>') {
166
- scaleErrors[traitIndex] = {
167
- name: 'Trait names should not be empty.'
168
- };
169
- } else {
170
- var identicalTraitName = traits.slice(traitIndex + 1).some(function (t) {
171
- return (0, _utils.markupToText)(t.name) === (0, _utils.markupToText)(trait.name);
172
- });
173
-
174
- if (identicalTraitName) {
175
- scaleErrors[traitIndex] = {
176
- name: 'Trait names should be unique.'
177
- };
178
- }
179
- }
180
-
181
- if (description && (!trait.description || trait.description === '<div></div>')) {
182
- scaleErrors[traitIndex] = _objectSpread(_objectSpread({}, scaleErrors[traitIndex]), {}, {
183
- description: 'Trait description should not be empty'
184
- });
185
- } else {
186
- var identicalTraitDescr = traits.slice(traitIndex + 1).some(function (t) {
187
- return (0, _utils.markupToText)(t.description) === (0, _utils.markupToText)(trait.description);
188
- });
189
-
190
- if (description && identicalTraitDescr) {
191
- scaleErrors[traitIndex] = _objectSpread(_objectSpread({}, scaleErrors[traitIndex]), {}, {
192
- description: 'Trait descriptions should be unique.'
193
- });
194
- }
195
- }
196
- });
197
-
198
- if (Object.keys(scaleErrors).length > 0) {
199
- traitsErrors[scaleIndex] = scaleErrors;
200
- }
201
- });
202
-
203
- if (Object.keys(traitsErrors).length > 0) {
204
- errors.traitsErrors = traitsErrors;
205
- }
206
-
207
- if (Object.keys(scorePointsErrors).length > 0) {
208
- errors.scorePointsErrors = scorePointsErrors;
209
- }
210
-
211
- return errors;
212
- };
213
-
214
- exports.validate = validate;
215
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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","description","pointLabels","errors","traitsErrors","scorePointsErrors","forEach","scaleIndex","traits","scorePointsLabels","scaleErrors","scorePointsLabelsErrors","scorePointLabel","scoreIndex","identicalScorePointLabel","slice","some","s","Object","keys","length","trait","traitIndex","name","identicalTraitName","t","identicalTraitDescr"],"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;AAC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F,KAtBD;;AAuBA,QAAGiB,MAAM,CAACC,IAAP,CAAYT,WAAZ,EAAyBU,MAAzB,GAAkC,CAArC,EAAuC;AACrChB,MAAAA,YAAY,CAACG,UAAD,CAAZ,GAA2BG,WAA3B;AACD;AACF,GAlDD;;AAoDA,MAAGQ,MAAM,CAACC,IAAP,CAAYf,YAAZ,EAA0BgB,MAA1B,GAAmC,CAAtC,EAAwC;AACtCjB,IAAAA,MAAM,CAACC,YAAP,GAAsBA,YAAtB;AACD;;AAED,MAAGc,MAAM,CAACC,IAAP,CAAYd,iBAAZ,EAA+Be,MAA/B,GAAwC,CAA3C,EAA6C;AAC3CjB,IAAAA,MAAM,CAACE,iBAAP,GAA2BA,iBAA3B;AACD;;AAED,SAAOF,MAAP;AACD,CAnEM","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\n// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.\nexport const validate = (model, config) => {\n const { scales, description = false, pointLabels = false } = model;\n const errors = {};\n const traitsErrors = {};\n const scorePointsErrors = {};\n\n (scales || []).forEach((scale, scaleIndex) => {\n const { traits = [] } = scale;\n const { scorePointsLabels = [] } = scale;\n const scaleErrors = {};\n const scorePointsLabelsErrors = {};\n\n if(pointLabels) {\n scorePointsLabels.forEach((scorePointLabel, scoreIndex) => {\n if (!scorePointLabel || scorePointLabel === '<div></div>') {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';\n } else {\n const identicalScorePointLabel = scorePointsLabels.slice(scoreIndex + 1).some(s => markupToText(s) === markupToText(scorePointLabel));\n\n if (identicalScorePointLabel) {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';\n }\n }\n })\n }\n\n if(Object.keys(scorePointsLabelsErrors).length > 0){\n scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;\n }\n\n traits.forEach((trait, traitIndex) => {\n if(!trait.name || trait.name === '<div></div>') {\n scaleErrors[traitIndex] = {name: '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] = {name: 'Trait names should be unique.'};\n }\n }\n if(description && (!trait.description || trait.description === '<div></div>')) {\n scaleErrors[traitIndex] = {... scaleErrors[traitIndex], description: 'Trait description should not be empty'};\n }\n else{\n const identicalTraitDescr = traits.slice(traitIndex + 1).some(t => markupToText(t.description) === markupToText(trait.description));\n\n if (description && identicalTraitDescr) {\n scaleErrors[traitIndex] = {... scaleErrors[traitIndex], description: 'Trait descriptions should be unique.'};\n }\n }\n\n });\n if(Object.keys(scaleErrors).length > 0){\n traitsErrors[scaleIndex] = scaleErrors;\n }\n });\n\n if(Object.keys(traitsErrors).length > 0){\n errors.traitsErrors = traitsErrors;\n }\n\n if(Object.keys(scorePointsErrors).length > 0){\n errors.scorePointsErrors = scorePointsErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
@@ -1,13 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,15 +0,0 @@
1
- {
2
- "name": "@pie-element/multi-trait-rubric-controller",
3
- "private": true,
4
- "version": "2.9.0",
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.16.1-next.28",
12
- "debug": "^3.1.0",
13
- "lodash": "^4.17.15"
14
- }
15
- }