@pie-element/complex-rubric 5.3.4-next.3 → 6.0.0-beta.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/lib/defaults.js +52 -24
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +103 -194
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +140 -199
- package/configure/lib/main.js.map +1 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +2491 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +2333 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +429 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +181 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +157 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +455 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +206 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +451 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +275 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +233 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +87 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +24 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +1571 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +18 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +158 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +11 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +14 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +1628 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +1202 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +117 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +861 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +614 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +54 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +123 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +248 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +83 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +32 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +2774 -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 +2541 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +67 -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 +135 -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 +103 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/package.json +24 -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 +139 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +87 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +1564 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +15 -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 +46 -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 +52 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js +210 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js +71 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/package.json +30 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +2641 -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 +48 -0
- package/configure/node_modules/@pie-element/rubric/src/main.jsx +226 -0
- package/configure/node_modules/@pie-element/rubric/src/print.js +74 -0
- package/configure/node_modules/clsx/clsx.d.ts +6 -0
- package/configure/node_modules/clsx/dist/clsx.js +1 -0
- package/configure/node_modules/clsx/dist/clsx.m.js +1 -0
- package/configure/node_modules/clsx/dist/clsx.min.js +1 -0
- package/configure/node_modules/clsx/license +9 -0
- package/configure/node_modules/clsx/package.json +37 -0
- package/configure/node_modules/clsx/readme.md +88 -0
- package/configure/package.json +12 -9
- package/configure/src/__tests__/index.test.js +30 -5
- package/configure/src/__tests__/main.test.jsx +39 -23
- package/configure/src/index.js +13 -6
- package/configure/src/main.jsx +16 -15
- package/controller/lib/defaults.js +11 -15
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +117 -180
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +1 -3
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/index.js +113 -204
- package/lib/index.js.map +1 -1
- package/lib/print.js +96 -190
- package/lib/print.js.map +1 -1
- package/package.json +10 -14
- package/src/__tests__/index.test.js +25 -7
- package/configure/src/__tests__/__snapshots__/main.test.jsx.snap +0 -193
- package/esm/configure.js +0 -15856
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -281
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -179
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
- package/esm/print.js +0 -163
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -262
- package/module/demo.js +0 -221
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -22
- package/module/print-demo.js +0 -259
- package/module/print.html +0 -18
- package/module/print.js +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = exports.default = {
|
|
8
|
+
addScaleEnabled: true,
|
|
9
|
+
description: false,
|
|
10
|
+
excludeZero: false,
|
|
11
|
+
halfScoring: false,
|
|
12
|
+
maxPointsEnabled: true,
|
|
13
|
+
pointLabels: true,
|
|
14
|
+
scales: [],
|
|
15
|
+
standards: false,
|
|
16
|
+
visibleToStudent: true
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["addScaleEnabled","description","excludeZero","halfScoring","maxPointsEnabled","pointLabels","scales","standards","visibleToStudent"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n addScaleEnabled: true,\n description: false,\n excludeZero: false,\n halfScoring: false,\n maxPointsEnabled: true,\n pointLabels: true,\n scales: [],\n standards: false,\n visibleToStudent: true,\n};\n"],"mappings":";;;;;;iCAAe;EACbA,eAAe,EAAE,IAAI;EACrBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,KAAK;EAClBC,gBAAgB,EAAE,IAAI;EACtBC,WAAW,EAAE,IAAI;EACjBC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE,KAAK;EAChBC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createCorrectResponseSession = void 0;
|
|
8
|
+
exports.createDefaultModel = createDefaultModel;
|
|
9
|
+
exports.getScore = void 0;
|
|
10
|
+
exports.model = model;
|
|
11
|
+
exports.normalize = void 0;
|
|
12
|
+
exports.outcome = outcome;
|
|
13
|
+
exports.validate = void 0;
|
|
14
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
15
|
+
var _utils = require("./utils");
|
|
16
|
+
function createDefaultModel(model = {}) {
|
|
17
|
+
return new Promise(resolve => resolve({
|
|
18
|
+
..._defaults.default,
|
|
19
|
+
...model
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
const normalize = question => ({
|
|
23
|
+
..._defaults.default,
|
|
24
|
+
...question
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {*} question
|
|
30
|
+
* @param {*} session
|
|
31
|
+
* @param {*} env
|
|
32
|
+
*/
|
|
33
|
+
exports.normalize = normalize;
|
|
34
|
+
async function model(question, session, env) {
|
|
35
|
+
const normalizedQuestion = normalize(question);
|
|
36
|
+
if (!env.role || env.role === 'student') {
|
|
37
|
+
normalizedQuestion.visible = normalizedQuestion.visibleToStudent;
|
|
38
|
+
} else {
|
|
39
|
+
normalizedQuestion.visible = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// todo update pie-ui instead of parsing this here:
|
|
43
|
+
const {
|
|
44
|
+
scales,
|
|
45
|
+
excludeZero
|
|
46
|
+
} = normalizedQuestion || {};
|
|
47
|
+
const parsedScales = (scales || []).map(scale => ({
|
|
48
|
+
...scale,
|
|
49
|
+
excludeZero
|
|
50
|
+
}));
|
|
51
|
+
return {
|
|
52
|
+
...normalizedQuestion,
|
|
53
|
+
scales: parsedScales
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const getScore = () => 0;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {Object} model - the main model
|
|
60
|
+
* @param {*} session
|
|
61
|
+
* @param {Object} env
|
|
62
|
+
*/
|
|
63
|
+
exports.getScore = getScore;
|
|
64
|
+
function outcome() {
|
|
65
|
+
return new Promise(resolve => resolve({
|
|
66
|
+
score: 0,
|
|
67
|
+
empty: true
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
const createCorrectResponseSession = (question, env) => {
|
|
71
|
+
return new Promise(resolve => {
|
|
72
|
+
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
73
|
+
resolve({
|
|
74
|
+
id: '1'
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
resolve(null);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.
|
|
83
|
+
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
84
|
+
const validate = (model, config) => {
|
|
85
|
+
const {
|
|
86
|
+
scales,
|
|
87
|
+
description = false,
|
|
88
|
+
pointLabels = false
|
|
89
|
+
} = model;
|
|
90
|
+
const errors = {};
|
|
91
|
+
const traitsErrors = {};
|
|
92
|
+
const scorePointsErrors = {};
|
|
93
|
+
(scales || []).forEach((scale, scaleIndex) => {
|
|
94
|
+
const {
|
|
95
|
+
traits = []
|
|
96
|
+
} = scale;
|
|
97
|
+
const {
|
|
98
|
+
scorePointsLabels = []
|
|
99
|
+
} = scale;
|
|
100
|
+
const scaleErrors = {};
|
|
101
|
+
const scorePointsLabelsErrors = {};
|
|
102
|
+
if (pointLabels) {
|
|
103
|
+
scorePointsLabels.forEach((scorePointLabel, scoreIndex) => {
|
|
104
|
+
if (!scorePointLabel || scorePointLabel === '<div></div>') {
|
|
105
|
+
scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';
|
|
106
|
+
} else {
|
|
107
|
+
const identicalScorePointLabel = scorePointsLabels.slice(scoreIndex + 1).some(s => (0, _utils.markupToText)(s) === (0, _utils.markupToText)(scorePointLabel));
|
|
108
|
+
if (identicalScorePointLabel) {
|
|
109
|
+
scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (Object.keys(scorePointsLabelsErrors).length > 0) {
|
|
115
|
+
scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;
|
|
116
|
+
}
|
|
117
|
+
traits.forEach((trait, traitIndex) => {
|
|
118
|
+
if (!trait.name || trait.name === '<div></div>') {
|
|
119
|
+
scaleErrors[traitIndex] = {
|
|
120
|
+
name: 'Trait names should not be empty.'
|
|
121
|
+
};
|
|
122
|
+
} else {
|
|
123
|
+
const identicalTraitName = traits.slice(traitIndex + 1).some(t => (0, _utils.markupToText)(t.name) === (0, _utils.markupToText)(trait.name));
|
|
124
|
+
if (identicalTraitName) {
|
|
125
|
+
scaleErrors[traitIndex] = {
|
|
126
|
+
name: 'Trait names should be unique.'
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (description && (!trait.description || trait.description === '<div></div>')) {
|
|
131
|
+
scaleErrors[traitIndex] = {
|
|
132
|
+
...scaleErrors[traitIndex],
|
|
133
|
+
description: 'Trait description should not be empty'
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
const identicalTraitDescr = traits.slice(traitIndex + 1).some(t => (0, _utils.markupToText)(t.description) === (0, _utils.markupToText)(trait.description));
|
|
137
|
+
if (description && identicalTraitDescr) {
|
|
138
|
+
scaleErrors[traitIndex] = {
|
|
139
|
+
...scaleErrors[traitIndex],
|
|
140
|
+
description: 'Trait descriptions should be unique.'
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
if (Object.keys(scaleErrors).length > 0) {
|
|
146
|
+
traitsErrors[scaleIndex] = scaleErrors;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
if (Object.keys(traitsErrors).length > 0) {
|
|
150
|
+
errors.traitsErrors = traitsErrors;
|
|
151
|
+
}
|
|
152
|
+
if (Object.keys(scorePointsErrors).length > 0) {
|
|
153
|
+
errors.scorePointsErrors = scorePointsErrors;
|
|
154
|
+
}
|
|
155
|
+
return errors;
|
|
156
|
+
};
|
|
157
|
+
exports.validate = validate;
|
|
158
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_defaults","_interopRequireDefault","require","_utils","createDefaultModel","model","Promise","resolve","defaults","normalize","question","exports","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","markupToText","Object","keys","length","trait","traitIndex","name","identicalTraitName","t","identicalTraitDescr"],"sources":["../src/index.js"],"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// 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\n .slice(scoreIndex + 1)\n .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 } else {\n const identicalTraitName = traits\n .slice(traitIndex + 1)\n .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 } else {\n const identicalTraitDescr = traits\n .slice(traitIndex + 1)\n .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 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"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,kBAAkBA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EAC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C,CAACzB,WAAW,CAAC,KAAK,IAAAiB,mBAAY,EAACI,KAAK,CAACrB,WAAW,CAAC,CAAC;QAE/E,IAAIA,WAAW,IAAI0B,mBAAmB,EAAE;UACtCjB,WAAW,CAACa,UAAU,CAAC,GAAG;YAAE,GAAGb,WAAW,CAACa,UAAU,CAAC;YAAEtB,WAAW,EAAE;UAAuC,CAAC;QAC/G;MACF;IACF,CAAC,CAAC;IACF,IAAIkB,MAAM,CAACC,IAAI,CAACV,WAAW,CAAC,CAACW,MAAM,GAAG,CAAC,EAAE;MACvCjB,YAAY,CAACG,UAAU,CAAC,GAAGG,WAAW;IACxC;EACF,CAAC,CAAC;EAEF,IAAIS,MAAM,CAACC,IAAI,CAAChB,YAAY,CAAC,CAACiB,MAAM,GAAG,CAAC,EAAE;IACxClB,MAAM,CAACC,YAAY,GAAGA,YAAY;EACpC;EAEA,IAAIe,MAAM,CAACC,IAAI,CAACf,iBAAiB,CAAC,CAACgB,MAAM,GAAG,CAAC,EAAE;IAC7ClB,MAAM,CAACE,iBAAiB,GAAGA,iBAAiB;EAC9C;EAEA,OAAOF,MAAM;AACf,CAAC;AAACvB,OAAA,CAAAmB,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.markupToText = void 0;
|
|
7
|
+
const markupToText = s => {
|
|
8
|
+
return (s || '').replace(/(<([^>]+)>)/ig, '');
|
|
9
|
+
};
|
|
10
|
+
exports.markupToText = markupToText;
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["markupToText","s","replace","exports"],"sources":["../src/utils.js"],"sourcesContent":["export const markupToText = (s) => {\n return (s || '').replace(/(<([^>]+)>)/ig, '');\n};\n"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAIC,CAAC,IAAK;EAC/B,OAAO,CAACA,CAAC,IAAI,EAAE,EAAEC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AACjD,CAAC;AAACC,OAAA,CAAAH,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-element/multi-trait-rubric-controller",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "4.1.1",
|
|
5
|
+
"description": "",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"module": "src/index.js",
|
|
8
|
+
"author": "",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"debug": "^3.1.0",
|
|
12
|
+
"lodash": "^4.17.15"
|
|
13
|
+
}
|
|
14
|
+
}
|