@pie-element/multi-trait-rubric 8.2.2-beta.5 → 8.2.2-beta.6
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/CHANGELOG.md +4 -0
- package/configure/CHANGELOG.md +4 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +4 -0
- package/controller/package.json +1 -1
- package/package.json +2 -2
- package/configure/lib/common.js +0 -424
- package/configure/lib/common.js.map +0 -1
- package/configure/lib/defaults.js +0 -184
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -161
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -454
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/modals.js +0 -206
- package/configure/lib/modals.js.map +0 -1
- package/configure/lib/scale.js +0 -478
- package/configure/lib/scale.js.map +0 -1
- package/configure/lib/trait.js +0 -275
- package/configure/lib/trait.js.map +0 -1
- package/configure/lib/traitsHeader.js +0 -235
- package/configure/lib/traitsHeader.js.map +0 -1
- package/configure/lib/utils.js +0 -87
- package/configure/lib/utils.js.map +0 -1
- package/controller/lib/defaults.js +0 -18
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -158
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -11
- package/controller/lib/utils.js.map +0 -1
- package/lib/index.js +0 -96
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -123
- package/lib/main.js.map +0 -1
- package/lib/scale.js +0 -248
- package/lib/scale.js.map +0 -1
- package/lib/trait.js +0 -83
- package/lib/trait.js.map +0 -1
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = {
|
|
8
|
-
model: {
|
|
9
|
-
addScaleEnabled: true,
|
|
10
|
-
description: false,
|
|
11
|
-
excludeZero: false,
|
|
12
|
-
halfScoring: false,
|
|
13
|
-
maxPointsEnabled: true,
|
|
14
|
-
pointLabels: true,
|
|
15
|
-
scales: [],
|
|
16
|
-
standards: false,
|
|
17
|
-
visibleToStudent: true
|
|
18
|
-
},
|
|
19
|
-
configuration: {
|
|
20
|
-
baseInputConfiguration: {
|
|
21
|
-
h3: {
|
|
22
|
-
disabled: true
|
|
23
|
-
},
|
|
24
|
-
audio: {
|
|
25
|
-
disabled: false
|
|
26
|
-
},
|
|
27
|
-
video: {
|
|
28
|
-
disabled: false
|
|
29
|
-
},
|
|
30
|
-
image: {
|
|
31
|
-
disabled: false
|
|
32
|
-
},
|
|
33
|
-
textAlign: {
|
|
34
|
-
disabled: true
|
|
35
|
-
},
|
|
36
|
-
showParagraphs: {
|
|
37
|
-
disabled: false
|
|
38
|
-
},
|
|
39
|
-
separateParagraphs: {
|
|
40
|
-
disabled: true
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
expandedInput: {
|
|
44
|
-
inputConfiguration: {
|
|
45
|
-
math: {
|
|
46
|
-
disabled: true
|
|
47
|
-
},
|
|
48
|
-
audio: {
|
|
49
|
-
disabled: false
|
|
50
|
-
},
|
|
51
|
-
video: {
|
|
52
|
-
disabled: false
|
|
53
|
-
},
|
|
54
|
-
image: {
|
|
55
|
-
disabled: false
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
labelInput: {
|
|
60
|
-
inputConfiguration: {
|
|
61
|
-
math: {
|
|
62
|
-
disabled: true
|
|
63
|
-
},
|
|
64
|
-
audio: {
|
|
65
|
-
disabled: true
|
|
66
|
-
},
|
|
67
|
-
video: {
|
|
68
|
-
disabled: true
|
|
69
|
-
},
|
|
70
|
-
image: {
|
|
71
|
-
disabled: true
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
excludeZeroDialogBoxContent: {
|
|
76
|
-
title: 'Exclude 0 (Zero) from Score Point Values.',
|
|
77
|
-
text: `<div>
|
|
78
|
-
You are about to exclude 0 from score point values.
|
|
79
|
-
<br/>
|
|
80
|
-
Some of the existing data has to be changed.
|
|
81
|
-
<br/>
|
|
82
|
-
Please choose if you want to:
|
|
83
|
-
<ul>
|
|
84
|
-
<li>
|
|
85
|
-
shift Labels and Descriptions to the left
|
|
86
|
-
</li>
|
|
87
|
-
<li>
|
|
88
|
-
remove 0 column with its Label and Description
|
|
89
|
-
</li>
|
|
90
|
-
</ul>
|
|
91
|
-
</div>`
|
|
92
|
-
},
|
|
93
|
-
includeZeroDialogBoxContent: {
|
|
94
|
-
title: 'Include 0 (Zero) in Score Point Values.',
|
|
95
|
-
text: `<div>
|
|
96
|
-
You are about to include 0 in score point values.
|
|
97
|
-
<br/>
|
|
98
|
-
Some of the existing data has to be changed.
|
|
99
|
-
<br/>
|
|
100
|
-
Please choose if you want to:
|
|
101
|
-
<ul>
|
|
102
|
-
<li>
|
|
103
|
-
shift Labels and Descriptions to the right
|
|
104
|
-
</li>
|
|
105
|
-
<li>
|
|
106
|
-
add 0 column with empty Label and Descriptions
|
|
107
|
-
</li>
|
|
108
|
-
</ul>
|
|
109
|
-
</div>`
|
|
110
|
-
},
|
|
111
|
-
deleteScaleDialogBoxContent: {
|
|
112
|
-
title: 'Delete Scale',
|
|
113
|
-
text: 'Are you sure you want to delete this scale?'
|
|
114
|
-
},
|
|
115
|
-
maxPointsDialogBoxContent: {
|
|
116
|
-
title: 'Decreasing Max Points.',
|
|
117
|
-
text: ` You are about to decrease max score point value.
|
|
118
|
-
<br/>
|
|
119
|
-
All the Labels and Descriptions for scores above Max Point will be deleted.`
|
|
120
|
-
},
|
|
121
|
-
settingsPanelDisabled: false,
|
|
122
|
-
spellCheck: {
|
|
123
|
-
label: 'Spellcheck',
|
|
124
|
-
settings: false,
|
|
125
|
-
enabled: true
|
|
126
|
-
},
|
|
127
|
-
showExcludeZero: {
|
|
128
|
-
settings: true,
|
|
129
|
-
label: 'Exclude Zero'
|
|
130
|
-
},
|
|
131
|
-
showScorePointLabels: {
|
|
132
|
-
settings: true,
|
|
133
|
-
label: 'Show Score Point Labels'
|
|
134
|
-
},
|
|
135
|
-
showDescription: {
|
|
136
|
-
settings: true,
|
|
137
|
-
label: 'Show Description'
|
|
138
|
-
},
|
|
139
|
-
showVisibleToStudent: {
|
|
140
|
-
settings: true,
|
|
141
|
-
label: 'Visible to Student'
|
|
142
|
-
},
|
|
143
|
-
showHalfScoring: {
|
|
144
|
-
settings: true,
|
|
145
|
-
label: 'Half Scoring'
|
|
146
|
-
},
|
|
147
|
-
// commenting this in order to use the dynamic width if the width was not set by the client (PD-3203)
|
|
148
|
-
// width: '900px',
|
|
149
|
-
// these should not be set to true (should not be used) for now
|
|
150
|
-
showStandards: {
|
|
151
|
-
settings: false,
|
|
152
|
-
label: 'Show Standards'
|
|
153
|
-
},
|
|
154
|
-
showLevelTagInput: {
|
|
155
|
-
settings: false,
|
|
156
|
-
label: 'Show Level Tag Input',
|
|
157
|
-
enabled: false
|
|
158
|
-
},
|
|
159
|
-
dragAndDrop: {
|
|
160
|
-
settings: true,
|
|
161
|
-
label: 'Enable Drag and Drop',
|
|
162
|
-
enabled: false
|
|
163
|
-
},
|
|
164
|
-
showMaxPoint: {
|
|
165
|
-
settings: true,
|
|
166
|
-
label: 'Show Max Points Dropdown'
|
|
167
|
-
},
|
|
168
|
-
addScale: {
|
|
169
|
-
settings: true,
|
|
170
|
-
label: 'Add Scale Available'
|
|
171
|
-
},
|
|
172
|
-
minNoOfTraits: 1,
|
|
173
|
-
maxNoOfTraits: 10,
|
|
174
|
-
minNoOfScales: 1,
|
|
175
|
-
maxNoOfScales: 10,
|
|
176
|
-
defaultTraitLabel: 'Trait',
|
|
177
|
-
mathMlOptions: {
|
|
178
|
-
mmlOutput: false,
|
|
179
|
-
mmlEditing: false
|
|
180
|
-
},
|
|
181
|
-
maxMaxPoints: 10
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","names":["model","addScaleEnabled","description","excludeZero","halfScoring","maxPointsEnabled","pointLabels","scales","standards","visibleToStudent","configuration","baseInputConfiguration","h3","disabled","audio","video","image","textAlign","showParagraphs","separateParagraphs","expandedInput","inputConfiguration","math","labelInput","excludeZeroDialogBoxContent","title","text","includeZeroDialogBoxContent","deleteScaleDialogBoxContent","maxPointsDialogBoxContent","settingsPanelDisabled","spellCheck","label","settings","enabled","showExcludeZero","showScorePointLabels","showDescription","showVisibleToStudent","showHalfScoring","showStandards","showLevelTagInput","dragAndDrop","showMaxPoint","addScale","minNoOfTraits","maxNoOfTraits","minNoOfScales","maxNoOfScales","defaultTraitLabel","mathMlOptions","mmlOutput","mmlEditing","maxMaxPoints"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n model: {\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 configuration: {\n baseInputConfiguration: {\n h3: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n expandedInput: {\n inputConfiguration: {\n math: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n labelInput: {\n inputConfiguration: {\n math: { disabled: true },\n audio: { disabled: true },\n video: { disabled: true },\n image: { disabled: true },\n },\n },\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 // commenting this in order to use the dynamic width if the width was not set by the client (PD-3203)\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: 1,\n maxNoOfScales: 10,\n defaultTraitLabel: 'Trait',\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n maxMaxPoints: 10,\n },\n};\n"],"mappings":";;;;;;iCAAe;EACbA,KAAK,EAAE;IACLC,eAAe,EAAE,IAAI;IACrBC,WAAW,EAAE,KAAK;IAClBC,WAAW,EAAE,KAAK;IAClBC,WAAW,EAAE,KAAK;IAClBC,gBAAgB,EA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AAC;IAChBC,aAAa,EAAE,EAAE;IACjBC,aAAa,EAAE,CAAC;IAChBC,aAAa,EAAE,EAAE;IACjBC,iBAAiB,EAAE,OAAO;IAC1BC,aAAa,EAAE;MACbC,SAAS,EAAE,KAAK;MAChBC,UAAU,EAAE;IACd,CAAC;IACDC,YAAY,EAAE;EAChB;AACF,CAAC","ignoreList":[]}
|
package/configure/lib/index.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _pieConfigureEvents = require("@pie-framework/pie-configure-events");
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _client = require("react-dom/client");
|
|
12
|
-
var _main = _interopRequireDefault(require("./main"));
|
|
13
|
-
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
14
|
-
var _utils = require("./utils");
|
|
15
|
-
var _modals = require("./modals");
|
|
16
|
-
const modelWithDefaults = m => ({
|
|
17
|
-
..._defaults.default.model,
|
|
18
|
-
...m
|
|
19
|
-
});
|
|
20
|
-
const configurationWithDefaults = c => ({
|
|
21
|
-
..._defaults.default.configuration,
|
|
22
|
-
...c
|
|
23
|
-
});
|
|
24
|
-
class MultiTraitRubricElement extends HTMLElement {
|
|
25
|
-
constructor() {
|
|
26
|
-
super();
|
|
27
|
-
(0, _defineProperty2.default)(this, "updateModelAccordingToReceivedProps", m => {
|
|
28
|
-
const currentModel = {
|
|
29
|
-
...this._model
|
|
30
|
-
};
|
|
31
|
-
if (!m) {
|
|
32
|
-
return currentModel;
|
|
33
|
-
}
|
|
34
|
-
const validatedModel = {
|
|
35
|
-
...m
|
|
36
|
-
};
|
|
37
|
-
const {
|
|
38
|
-
scales,
|
|
39
|
-
excludeZero
|
|
40
|
-
} = validatedModel || {};
|
|
41
|
-
(scales || []).forEach(scale => {
|
|
42
|
-
if (!scale) {
|
|
43
|
-
scale = {
|
|
44
|
-
scorePointsLabels: [],
|
|
45
|
-
traits: []
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const {
|
|
49
|
-
maxPoints
|
|
50
|
-
} = scale || {};
|
|
51
|
-
scale.scorePointsLabels = [...(scale.scorePointsLabels || [])];
|
|
52
|
-
scale.traits = [...(scale.traits || [])];
|
|
53
|
-
const howManyScorePointLabelsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
|
|
54
|
-
const howManyScorePointLabelsItHas = scale.scorePointsLabels.length;
|
|
55
|
-
if (howManyScorePointLabelsItHas !== howManyScorePointLabelsShouldHave) {
|
|
56
|
-
if (howManyScorePointLabelsItHas < howManyScorePointLabelsShouldHave) {
|
|
57
|
-
for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointLabelsItHas; i++) {
|
|
58
|
-
scale.scorePointsLabels.push('');
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
scale.scorePointsLabels = scale.scorePointsLabels.slice(0, howManyScorePointLabelsShouldHave);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
(scale.traits || []).forEach(trait => {
|
|
65
|
-
if (!trait) {
|
|
66
|
-
trait = {
|
|
67
|
-
scorePointsDescriptors: []
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
trait.scorePointsDescriptors = [...(trait.scorePointsDescriptors || [])];
|
|
71
|
-
const howManyScorePointDescriptorsItHas = trait.scorePointsDescriptors.length;
|
|
72
|
-
if (howManyScorePointDescriptorsItHas !== howManyScorePointLabelsShouldHave) {
|
|
73
|
-
if (howManyScorePointDescriptorsItHas < howManyScorePointLabelsShouldHave) {
|
|
74
|
-
for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointDescriptorsItHas; i++) {
|
|
75
|
-
trait.scorePointsDescriptors.push('');
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
trait.scorePointsDescriptors = trait.scorePointsDescriptors.slice(0, howManyScorePointLabelsShouldHave);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
if (validatedModel.excludeZero) {
|
|
84
|
-
// check if any scale has maxPoints set to 1
|
|
85
|
-
const shouldAddColumn0 = validatedModel.scales.some(scale => scale.maxPoints === 1);
|
|
86
|
-
if (shouldAddColumn0) {
|
|
87
|
-
// excludeZero should be false and disabled when maxPoints is 1
|
|
88
|
-
validatedModel.excludeZero = false;
|
|
89
|
-
// add column 0 for all scales
|
|
90
|
-
validatedModel.scales = (0, _utils.addOrRemoveScaleColumn)(scales, _modals.excludeZeroTypes.add0);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return validatedModel;
|
|
94
|
-
});
|
|
95
|
-
(0, _defineProperty2.default)(this, "onModelChanged", m => {
|
|
96
|
-
this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
|
|
97
|
-
this._render();
|
|
98
|
-
this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, false));
|
|
99
|
-
});
|
|
100
|
-
(0, _defineProperty2.default)(this, "onConfigurationChanged", c => {
|
|
101
|
-
this._configuration = configurationWithDefaults(c);
|
|
102
|
-
this._render();
|
|
103
|
-
});
|
|
104
|
-
this._root = null;
|
|
105
|
-
this._model = modelWithDefaults();
|
|
106
|
-
this._configuration = configurationWithDefaults();
|
|
107
|
-
}
|
|
108
|
-
set model(m) {
|
|
109
|
-
this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
|
|
110
|
-
this._render();
|
|
111
|
-
}
|
|
112
|
-
set configuration(c) {
|
|
113
|
-
this._configuration = configurationWithDefaults(c);
|
|
114
|
-
this._render();
|
|
115
|
-
}
|
|
116
|
-
insertSound(handler) {
|
|
117
|
-
this.dispatchEvent(new _pieConfigureEvents.InsertSoundEvent(handler));
|
|
118
|
-
}
|
|
119
|
-
onDeleteSound(src, done) {
|
|
120
|
-
this.dispatchEvent(new _pieConfigureEvents.DeleteSoundEvent(src, done));
|
|
121
|
-
}
|
|
122
|
-
insertImage(handler) {
|
|
123
|
-
this.dispatchEvent(new _pieConfigureEvents.InsertImageEvent(handler));
|
|
124
|
-
}
|
|
125
|
-
onDeleteImage(src, done) {
|
|
126
|
-
this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
|
|
127
|
-
}
|
|
128
|
-
_render() {
|
|
129
|
-
if (this._model) {
|
|
130
|
-
let element = /*#__PURE__*/_react.default.createElement(_main.default, {
|
|
131
|
-
model: this._model,
|
|
132
|
-
configuration: this._configuration,
|
|
133
|
-
onModelChanged: this.onModelChanged,
|
|
134
|
-
onConfigurationChanged: this.onConfigurationChanged,
|
|
135
|
-
uploadSoundSupport: {
|
|
136
|
-
add: this.insertSound.bind(this),
|
|
137
|
-
delete: this.onDeleteSound.bind(this)
|
|
138
|
-
},
|
|
139
|
-
imageSupport: {
|
|
140
|
-
add: this.insertImage.bind(this),
|
|
141
|
-
delete: this.onDeleteImage.bind(this)
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
if (!this._root) {
|
|
145
|
-
this._root = (0, _client.createRoot)(this);
|
|
146
|
-
}
|
|
147
|
-
this._root.render(element);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
connectedCallback() {
|
|
151
|
-
this._render();
|
|
152
|
-
}
|
|
153
|
-
disconnectedCallback() {
|
|
154
|
-
if (this._root) {
|
|
155
|
-
this._root.unmount();
|
|
156
|
-
this._root = null;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.default = MultiTraitRubricElement;
|
|
161
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_pieConfigureEvents","require","_react","_interopRequireDefault","_client","_main","_defaults","_utils","_modals","modelWithDefaults","m","defaults","model","configurationWithDefaults","c","configuration","MultiTraitRubricElement","HTMLElement","constructor","_defineProperty2","default","currentModel","_model","validatedModel","scales","excludeZero","forEach","scale","scorePointsLabels","traits","maxPoints","howManyScorePointLabelsShouldHave","howManyScorePointLabelsItHas","length","i","push","slice","trait","scorePointsDescriptors","howManyScorePointDescriptorsItHas","shouldAddColumn0","some","addOrRemoveScaleColumn","excludeZeroTypes","add0","updateModelAccordingToReceivedProps","_render","dispatchEvent","ModelUpdatedEvent","_configuration","_root","insertSound","handler","InsertSoundEvent","onDeleteSound","src","done","DeleteSoundEvent","insertImage","InsertImageEvent","onDeleteImage","DeleteImageEvent","element","React","createElement","Main","onModelChanged","onConfigurationChanged","uploadSoundSupport","add","bind","delete","imageSupport","createRoot","render","connectedCallback","disconnectedCallback","unmount","exports"],"sources":["../src/index.js"],"sourcesContent":["import {\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n InsertImageEvent,\n DeleteImageEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport Main from './main';\nimport defaults from './defaults';\nimport { addOrRemoveScaleColumn } from './utils';\nimport { excludeZeroTypes } from './modals';\n\nconst modelWithDefaults = (m) => ({ ...defaults.model, ...m });\nconst configurationWithDefaults = (c) => ({ ...defaults.configuration, ...c });\n\nexport default class MultiTraitRubricElement extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._model = modelWithDefaults();\n this._configuration = configurationWithDefaults();\n }\n\n updateModelAccordingToReceivedProps = (m) => {\n const currentModel = { ...this._model };\n\n if (!m) {\n return currentModel;\n }\n\n const validatedModel = { ...m };\n const { scales, excludeZero } = validatedModel || {};\n\n (scales || []).forEach((scale) => {\n if (!scale) {\n scale = { scorePointsLabels: [], traits: [] };\n }\n\n const { maxPoints } = scale || {};\n\n scale.scorePointsLabels = [...(scale.scorePointsLabels || [])];\n scale.traits = [...(scale.traits || [])];\n\n const howManyScorePointLabelsShouldHave = excludeZero ? maxPoints : maxPoints + 1;\n const howManyScorePointLabelsItHas = scale.scorePointsLabels.length;\n\n if (howManyScorePointLabelsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointLabelsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointLabelsItHas; i++) {\n scale.scorePointsLabels.push('');\n }\n } else {\n scale.scorePointsLabels = scale.scorePointsLabels.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n\n (scale.traits || []).forEach((trait) => {\n if (!trait) {\n trait = { scorePointsDescriptors: [] };\n }\n\n trait.scorePointsDescriptors = [...(trait.scorePointsDescriptors || [])];\n\n const howManyScorePointDescriptorsItHas = trait.scorePointsDescriptors.length;\n\n if (howManyScorePointDescriptorsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointDescriptorsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointDescriptorsItHas; i++) {\n trait.scorePointsDescriptors.push('');\n }\n } else {\n trait.scorePointsDescriptors = trait.scorePointsDescriptors.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n });\n });\n\n if (validatedModel.excludeZero) {\n // check if any scale has maxPoints set to 1\n const shouldAddColumn0 = validatedModel.scales.some((scale) => scale.maxPoints === 1);\n\n if (shouldAddColumn0) {\n // excludeZero should be false and disabled when maxPoints is 1\n validatedModel.excludeZero = false;\n // add column 0 for all scales\n validatedModel.scales = addOrRemoveScaleColumn(scales, excludeZeroTypes.add0);\n }\n }\n\n return validatedModel;\n };\n\n set model(m) {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n }\n\n set configuration(c) {\n this._configuration = configurationWithDefaults(c);\n this._render();\n }\n\n onModelChanged = (m) => {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n };\n\n onConfigurationChanged = (c) => {\n this._configuration = configurationWithDefaults(c);\n\n this._render();\n };\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n _render() {\n if (this._model) {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n }\n\n connectedCallback() {\n this._render();\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,SAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,MAAMQ,iBAAiB,GAAIC,CAAC,KAAM;EAAE,GAAGC,iBAAQ,CAACC,KAAK;EAAE,GAAGF;AAAE,CAAC,CAAC;AAC9D,MAAMG,yBAAyB,GAAIC,CAAC,KAAM;EAAE,GAAGH,iBAAQ,CAACI,aAAa;EAAE,GAAGD;AAAE,CAAC,CAAC;AAE/D,MAAME,uBAAuB,SAASC,WAAW,CAAC;EAC/DC,WAAWA,CAAA,EAAG;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