@pie-element/multi-trait-rubric 6.3.4-next.3 → 7.0.0-beta.1
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 +0 -11
- package/configure/CHANGELOG.md +0 -11
- package/configure/lib/common.js +375 -534
- package/configure/lib/common.js.map +1 -1
- package/configure/lib/defaults.js +35 -6
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +96 -162
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +346 -437
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/modals.js +178 -333
- package/configure/lib/modals.js.map +1 -1
- package/configure/lib/scale.js +358 -463
- package/configure/lib/scale.js.map +1 -1
- package/configure/lib/trait.js +253 -358
- package/configure/lib/trait.js.map +1 -1
- package/configure/lib/traitsHeader.js +199 -264
- package/configure/lib/traitsHeader.js.map +1 -1
- package/configure/lib/utils.js +43 -74
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +12 -9
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +66 -123
- 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 +40 -77
- package/lib/index.js.map +1 -1
- package/lib/main.js +99 -140
- package/lib/main.js.map +1 -1
- package/lib/scale.js +217 -299
- package/lib/scale.js.map +1 -1
- package/lib/trait.js +51 -71
- package/lib/trait.js.map +1 -1
- package/package.json +10 -8
- package/esm/configure.js +0 -30404
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -176
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -11204
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
package/configure/lib/main.js
CHANGED
|
@@ -1,89 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
7
|
+
exports.default = exports.Main = void 0;
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
10
|
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
12
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
33
|
-
|
|
34
13
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
35
|
-
|
|
36
14
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
37
|
-
|
|
38
|
-
var _styles = require("@material-ui/core/styles");
|
|
39
|
-
|
|
40
|
-
var _drag = require("@pie-lib/drag");
|
|
41
|
-
|
|
15
|
+
var _styles = require("@mui/material/styles");
|
|
42
16
|
var _configUi = require("@pie-lib/config-ui");
|
|
43
|
-
|
|
44
17
|
var _scale = _interopRequireDefault(require("./scale"));
|
|
45
|
-
|
|
46
18
|
var _common = require("./common");
|
|
47
|
-
|
|
48
19
|
var _modals = require("./modals");
|
|
49
|
-
|
|
50
20
|
var _utils = require("./utils");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
var ShowModal = function ShowModal(_ref) {
|
|
74
|
-
var showExcludeZeroDialog = _ref.showExcludeZeroDialog,
|
|
75
|
-
excludeZero = _ref.excludeZero,
|
|
76
|
-
changeExcludeZero = _ref.changeExcludeZero,
|
|
77
|
-
cancel = _ref.cancel;
|
|
78
|
-
|
|
21
|
+
const {
|
|
22
|
+
Panel,
|
|
23
|
+
toggle
|
|
24
|
+
} = _configUi.settings;
|
|
25
|
+
const MIN_WIDTH = '650px';
|
|
26
|
+
const StyledDiv = (0, _styles.styled)('div')(({
|
|
27
|
+
theme
|
|
28
|
+
}) => ({
|
|
29
|
+
fontFamily: 'Cerebri Sans',
|
|
30
|
+
fontSize: theme.typography.fontSize,
|
|
31
|
+
padding: '16px 0'
|
|
32
|
+
}));
|
|
33
|
+
const ShowModal = ({
|
|
34
|
+
showExcludeZeroDialog,
|
|
35
|
+
excludeZero,
|
|
36
|
+
changeExcludeZero,
|
|
37
|
+
cancel
|
|
38
|
+
}) => {
|
|
79
39
|
if (showExcludeZeroDialog && !excludeZero) {
|
|
80
|
-
return /*#__PURE__*/_react
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_modals.ExcludeZeroDialog, {
|
|
81
41
|
open: showExcludeZeroDialog && !excludeZero,
|
|
82
42
|
changeExcludeZero: changeExcludeZero,
|
|
83
43
|
cancel: cancel
|
|
84
44
|
});
|
|
85
45
|
} else if (showExcludeZeroDialog && excludeZero) {
|
|
86
|
-
return /*#__PURE__*/_react
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_modals.IncludeZeroDialog, {
|
|
87
47
|
open: showExcludeZeroDialog && excludeZero,
|
|
88
48
|
changeExcludeZero: changeExcludeZero,
|
|
89
49
|
cancel: cancel
|
|
@@ -92,25 +52,16 @@ var ShowModal = function ShowModal(_ref) {
|
|
|
92
52
|
return null;
|
|
93
53
|
}
|
|
94
54
|
};
|
|
95
|
-
|
|
96
55
|
ShowModal.propTypes = {
|
|
97
|
-
showExcludeZeroDialog: _propTypes
|
|
98
|
-
excludeZero: _propTypes
|
|
99
|
-
changeExcludeZero: _propTypes
|
|
100
|
-
cancel: _propTypes
|
|
56
|
+
showExcludeZeroDialog: _propTypes.default.bool,
|
|
57
|
+
excludeZero: _propTypes.default.bool,
|
|
58
|
+
changeExcludeZero: _propTypes.default.func,
|
|
59
|
+
cancel: _propTypes.default.func
|
|
101
60
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var _super = _createSuper(Main);
|
|
107
|
-
|
|
108
|
-
function Main(props) {
|
|
109
|
-
var _this;
|
|
110
|
-
|
|
111
|
-
(0, _classCallCheck2["default"])(this, Main);
|
|
112
|
-
_this = _super.call(this, props);
|
|
113
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
61
|
+
class Main extends _react.default.Component {
|
|
62
|
+
constructor(props) {
|
|
63
|
+
super(props);
|
|
64
|
+
(0, _defineProperty2.default)(this, "state", {
|
|
114
65
|
showDecreaseMaxPointsDialog: false,
|
|
115
66
|
showDeleteScaleDialog: false,
|
|
116
67
|
showDeleteTraitDialog: false,
|
|
@@ -119,428 +70,386 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
119
70
|
infoDialogText: '',
|
|
120
71
|
adjustedWidth: MIN_WIDTH,
|
|
121
72
|
initialUpdateCompleted: false // flag to track the initial update of the div width
|
|
122
|
-
|
|
123
73
|
});
|
|
124
|
-
(0, _defineProperty2
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var _ref4 = configuration || '',
|
|
143
|
-
defaultTraitLabel = _ref4.defaultTraitLabel;
|
|
144
|
-
|
|
74
|
+
(0, _defineProperty2.default)(this, "updateDivWidthDebounced", (0, _debounce.default)(() => this.updateDivWidth(), 50));
|
|
75
|
+
(0, _defineProperty2.default)(this, "onScaleAdded", () => {
|
|
76
|
+
const {
|
|
77
|
+
model,
|
|
78
|
+
onModelChanged,
|
|
79
|
+
configuration
|
|
80
|
+
} = this.props;
|
|
81
|
+
let {
|
|
82
|
+
scales,
|
|
83
|
+
excludeZero
|
|
84
|
+
} = model || {};
|
|
85
|
+
const {
|
|
86
|
+
maxNoOfScales
|
|
87
|
+
} = configuration || {};
|
|
88
|
+
let {
|
|
89
|
+
defaultTraitLabel
|
|
90
|
+
} = configuration || '';
|
|
145
91
|
if (!scales.length) {
|
|
146
92
|
scales = [];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
defaultTraitLabel = typeof defaultTraitLabel === 'string' ? defaultTraitLabel : ((_scales$ = scales[0]) === null || _scales$ === void 0 ? void 0 : _scales$.traitLabel) || '';
|
|
93
|
+
}
|
|
151
94
|
|
|
95
|
+
// if no default trait label is defined, take the trait label of the first scale
|
|
96
|
+
defaultTraitLabel = typeof defaultTraitLabel === 'string' ? defaultTraitLabel : scales[0]?.traitLabel || '';
|
|
152
97
|
if (scales.length === maxNoOfScales) {
|
|
153
|
-
|
|
154
|
-
infoDialogText:
|
|
98
|
+
this.set({
|
|
99
|
+
infoDialogText: `There can't be more than ${maxNoOfScales} scales.`,
|
|
155
100
|
showInfoDialog: true
|
|
156
101
|
});
|
|
157
|
-
|
|
158
102
|
return false;
|
|
159
103
|
}
|
|
160
|
-
|
|
161
104
|
scales.push({
|
|
162
105
|
maxPoints: 1,
|
|
163
106
|
scorePointsLabels: excludeZero ? [''] : ['', ''],
|
|
164
107
|
traitLabel: defaultTraitLabel,
|
|
165
108
|
traits: []
|
|
166
109
|
});
|
|
167
|
-
onModelChanged(
|
|
168
|
-
|
|
169
|
-
|
|
110
|
+
onModelChanged({
|
|
111
|
+
...model,
|
|
112
|
+
scales
|
|
113
|
+
});
|
|
170
114
|
});
|
|
171
|
-
(0, _defineProperty2
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
115
|
+
(0, _defineProperty2.default)(this, "onScaleChanged", (scaleIndex, params) => {
|
|
116
|
+
const {
|
|
117
|
+
model,
|
|
118
|
+
onModelChanged
|
|
119
|
+
} = this.props;
|
|
120
|
+
let scales = (0, _cloneDeep.default)((model || {}).scales);
|
|
121
|
+
if (scaleIndex < 0 || scaleIndex >= scales.length || (0, _isEmpty.default)(params)) return false;
|
|
122
|
+
Object.keys(params).forEach(key => {
|
|
178
123
|
scales[scaleIndex][key] = params[key];
|
|
179
124
|
});
|
|
180
|
-
|
|
181
125
|
if (model.excludeZero && params.maxPoints === 1) {
|
|
182
126
|
// excludeZero should be false and disabled when maxPoints is 1 for any scale
|
|
183
127
|
model.excludeZero = false;
|
|
184
128
|
scales = (0, _utils.addOrRemoveScaleColumn)(scales, _modals.excludeZeroTypes.add0);
|
|
185
129
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
scales
|
|
189
|
-
})
|
|
130
|
+
onModelChanged({
|
|
131
|
+
...model,
|
|
132
|
+
scales
|
|
133
|
+
});
|
|
190
134
|
});
|
|
191
|
-
(0, _defineProperty2
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
135
|
+
(0, _defineProperty2.default)(this, "onScaleRemoved", scaleIndex => {
|
|
136
|
+
const {
|
|
137
|
+
model,
|
|
138
|
+
onModelChanged,
|
|
139
|
+
configuration
|
|
140
|
+
} = this.props;
|
|
141
|
+
let {
|
|
142
|
+
scales
|
|
143
|
+
} = model || {};
|
|
144
|
+
const {
|
|
145
|
+
minNoOfScales
|
|
146
|
+
} = configuration || {};
|
|
203
147
|
if (scaleIndex < 0 || scaleIndex >= scales.length) return false;
|
|
204
|
-
|
|
205
148
|
if (scales.length === minNoOfScales) {
|
|
206
|
-
|
|
207
|
-
infoDialogText:
|
|
149
|
+
this.set({
|
|
150
|
+
infoDialogText: `There can't be less than ${minNoOfScales} scales.`,
|
|
208
151
|
showInfoDialog: true
|
|
209
152
|
});
|
|
210
|
-
|
|
211
153
|
return false;
|
|
212
154
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
scales
|
|
217
|
-
})
|
|
155
|
+
scales = [...scales.slice(0, scaleIndex), ...scales.slice(scaleIndex + 1)];
|
|
156
|
+
onModelChanged({
|
|
157
|
+
...model,
|
|
158
|
+
scales
|
|
159
|
+
});
|
|
218
160
|
});
|
|
219
|
-
(0, _defineProperty2
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
onModelChanged(
|
|
161
|
+
(0, _defineProperty2.default)(this, "onHalfScoringChanged", () => {
|
|
162
|
+
const {
|
|
163
|
+
model,
|
|
164
|
+
onModelChanged
|
|
165
|
+
} = this.props;
|
|
166
|
+
let {
|
|
167
|
+
halfScoring
|
|
168
|
+
} = model || {};
|
|
169
|
+
onModelChanged({
|
|
170
|
+
...model,
|
|
228
171
|
halfScoring: !halfScoring
|
|
229
|
-
})
|
|
172
|
+
});
|
|
230
173
|
});
|
|
231
|
-
(0, _defineProperty2
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
onModelChanged(
|
|
174
|
+
(0, _defineProperty2.default)(this, "onVisibleToStudentChanged", () => {
|
|
175
|
+
const {
|
|
176
|
+
model,
|
|
177
|
+
onModelChanged
|
|
178
|
+
} = this.props;
|
|
179
|
+
let {
|
|
180
|
+
visibleToStudent
|
|
181
|
+
} = model || {};
|
|
182
|
+
onModelChanged({
|
|
183
|
+
...model,
|
|
240
184
|
visibleToStudent: !visibleToStudent
|
|
241
|
-
})
|
|
242
|
-
});
|
|
243
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "set", function (newState) {
|
|
244
|
-
return _this.setState(newState);
|
|
185
|
+
});
|
|
245
186
|
});
|
|
246
|
-
(0, _defineProperty2
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
187
|
+
(0, _defineProperty2.default)(this, "set", newState => this.setState(newState));
|
|
188
|
+
(0, _defineProperty2.default)(this, "changeShowScorePointLabels", () => {
|
|
189
|
+
const {
|
|
190
|
+
model,
|
|
191
|
+
onModelChanged
|
|
192
|
+
} = this.props || {};
|
|
193
|
+
let {
|
|
194
|
+
pointLabels
|
|
195
|
+
} = model || {};
|
|
254
196
|
pointLabels = !pointLabels;
|
|
255
|
-
onModelChanged(
|
|
256
|
-
|
|
257
|
-
|
|
197
|
+
onModelChanged({
|
|
198
|
+
...model,
|
|
199
|
+
pointLabels
|
|
200
|
+
});
|
|
258
201
|
});
|
|
259
|
-
(0, _defineProperty2
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
202
|
+
(0, _defineProperty2.default)(this, "changeShowDescription", () => {
|
|
203
|
+
const {
|
|
204
|
+
model,
|
|
205
|
+
onModelChanged
|
|
206
|
+
} = this.props || {};
|
|
207
|
+
let {
|
|
208
|
+
description
|
|
209
|
+
} = model || {};
|
|
267
210
|
description = !description;
|
|
268
|
-
onModelChanged(
|
|
269
|
-
|
|
270
|
-
|
|
211
|
+
onModelChanged({
|
|
212
|
+
...model,
|
|
213
|
+
description
|
|
214
|
+
});
|
|
271
215
|
});
|
|
272
|
-
(0, _defineProperty2
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
216
|
+
(0, _defineProperty2.default)(this, "changeShowStandards", () => {
|
|
217
|
+
const {
|
|
218
|
+
model,
|
|
219
|
+
onModelChanged
|
|
220
|
+
} = this.props || {};
|
|
221
|
+
let {
|
|
222
|
+
standards
|
|
223
|
+
} = model || {};
|
|
280
224
|
standards = !standards;
|
|
281
|
-
onModelChanged(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
});
|
|
285
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "showToggleExcludeZeroModal", function () {
|
|
286
|
-
return _this.set({
|
|
287
|
-
showExcludeZeroDialog: true
|
|
225
|
+
onModelChanged({
|
|
226
|
+
...model,
|
|
227
|
+
standards
|
|
288
228
|
});
|
|
289
229
|
});
|
|
290
|
-
|
|
291
|
-
|
|
230
|
+
// Exclude Zero
|
|
231
|
+
(0, _defineProperty2.default)(this, "showToggleExcludeZeroModal", () => this.set({
|
|
232
|
+
showExcludeZeroDialog: true
|
|
233
|
+
}));
|
|
234
|
+
(0, _defineProperty2.default)(this, "hideToggleExcludeZeroModal", () => {
|
|
235
|
+
this.set({
|
|
292
236
|
showExcludeZeroDialog: false
|
|
293
237
|
});
|
|
294
238
|
});
|
|
295
|
-
(0, _defineProperty2
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
excludeZero = _ref17.excludeZero;
|
|
310
|
-
|
|
239
|
+
(0, _defineProperty2.default)(this, "onCloseInfoDialog", () => this.set({
|
|
240
|
+
showInfoDialog: false
|
|
241
|
+
}));
|
|
242
|
+
(0, _defineProperty2.default)(this, "changeExcludeZero", excludeZeroType => {
|
|
243
|
+
const {
|
|
244
|
+
model,
|
|
245
|
+
onModelChanged
|
|
246
|
+
} = this.props || {};
|
|
247
|
+
const {
|
|
248
|
+
scales
|
|
249
|
+
} = model || {};
|
|
250
|
+
let {
|
|
251
|
+
excludeZero
|
|
252
|
+
} = model || {};
|
|
311
253
|
if (!scales || !scales.length) return;
|
|
312
254
|
excludeZero = !excludeZero;
|
|
313
|
-
|
|
314
|
-
onModelChanged(
|
|
255
|
+
const newScales = (0, _utils.addOrRemoveScaleColumn)(scales, excludeZeroType);
|
|
256
|
+
onModelChanged({
|
|
257
|
+
...model,
|
|
315
258
|
scales: newScales,
|
|
316
|
-
excludeZero
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
_this.hideToggleExcludeZeroModal();
|
|
259
|
+
excludeZero
|
|
260
|
+
});
|
|
261
|
+
this.hideToggleExcludeZeroModal();
|
|
320
262
|
});
|
|
321
|
-
(0, _defineProperty2
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
263
|
+
(0, _defineProperty2.default)(this, "onModelChanged", (updatedModel, updatedProperty) => {
|
|
264
|
+
const {
|
|
265
|
+
onModelChanged
|
|
266
|
+
} = this.props || {};
|
|
325
267
|
if (updatedProperty === 'excludeZero') {
|
|
326
|
-
|
|
268
|
+
this.showToggleExcludeZeroModal();
|
|
327
269
|
} else {
|
|
328
270
|
onModelChanged(updatedModel);
|
|
329
271
|
}
|
|
330
272
|
});
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return _this;
|
|
273
|
+
this.divRef = /*#__PURE__*/_react.default.createRef();
|
|
274
|
+
this.updateDivWidth = this.updateDivWidth.bind(this);
|
|
334
275
|
}
|
|
276
|
+
componentDidMount() {
|
|
277
|
+
window.addEventListener('resize', this.updateDivWidthDebounced);
|
|
278
|
+
window.addEventListener('load', this.updateDivWidth);
|
|
335
279
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
280
|
+
// delay updateDivWidth to avoid having this.divRef.current = null at first load
|
|
281
|
+
setTimeout(this.updateDivWidth, 0);
|
|
282
|
+
}
|
|
283
|
+
componentWillUnmount() {
|
|
284
|
+
window.removeEventListener('resize', this.updateDivWidthDebounced);
|
|
285
|
+
window.removeEventListener('load', this.updateDivWidth);
|
|
286
|
+
}
|
|
287
|
+
componentDidUpdate() {
|
|
288
|
+
if (!this.state.initialUpdateCompleted) {
|
|
289
|
+
this.updateDivWidth();
|
|
290
|
+
this.setState({
|
|
291
|
+
initialUpdateCompleted: true
|
|
292
|
+
});
|
|
349
293
|
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
this.
|
|
356
|
-
|
|
294
|
+
}
|
|
295
|
+
updateDivWidth() {
|
|
296
|
+
if (this.divRef && this.divRef.current) {
|
|
297
|
+
const divWidth = this.divRef.current.offsetWidth;
|
|
298
|
+
if (divWidth !== this.state.adjustedWidth) {
|
|
299
|
+
this.set({
|
|
300
|
+
adjustedWidth: divWidth
|
|
357
301
|
});
|
|
358
302
|
}
|
|
359
303
|
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
description: showDescription.settings && toggle(showDescription.label),
|
|
446
|
-
pointLabels: showScorePointLabels.settings && toggle(showScorePointLabels.label),
|
|
447
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
448
|
-
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
449
|
-
addScaleEnabled: addScale.settings && toggle(addScale.label)
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
var getPluginProps = function getPluginProps(props) {
|
|
453
|
-
return Object.assign(_objectSpread({}, baseInputConfiguration), props || {});
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
457
|
-
extraCSSRules: extraCSSRules,
|
|
458
|
-
dimensions: contentDimensions,
|
|
459
|
-
hideSettings: settingsPanelDisabled,
|
|
460
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
461
|
-
model: model,
|
|
462
|
-
onChangeModel: this.onModelChanged,
|
|
463
|
-
configuration: configuration,
|
|
464
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
465
|
-
groups: {
|
|
466
|
-
Settings: panelSettings,
|
|
467
|
-
Properties: panelProperties
|
|
468
|
-
},
|
|
469
|
-
modal: /*#__PURE__*/_react["default"].createElement(ShowModal, {
|
|
470
|
-
showExcludeZeroDialog: showExcludeZeroDialog,
|
|
471
|
-
excludeZero: excludeZero,
|
|
472
|
-
changeExcludeZero: this.changeExcludeZero,
|
|
473
|
-
cancel: this.hideToggleExcludeZeroModal
|
|
474
|
-
})
|
|
475
|
-
})
|
|
476
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
477
|
-
style: {
|
|
478
|
-
width: '100%'
|
|
304
|
+
}
|
|
305
|
+
render() {
|
|
306
|
+
const {
|
|
307
|
+
model,
|
|
308
|
+
configuration,
|
|
309
|
+
onConfigurationChanged,
|
|
310
|
+
uploadSoundSupport,
|
|
311
|
+
imageSupport
|
|
312
|
+
} = this.props || {};
|
|
313
|
+
const {
|
|
314
|
+
addScale,
|
|
315
|
+
baseInputConfiguration = {},
|
|
316
|
+
dragAndDrop,
|
|
317
|
+
contentDimensions = {},
|
|
318
|
+
showDescription,
|
|
319
|
+
showExcludeZero,
|
|
320
|
+
showLevelTagInput,
|
|
321
|
+
showStandards,
|
|
322
|
+
showHalfScoring,
|
|
323
|
+
showMaxPoint,
|
|
324
|
+
showScorePointLabels,
|
|
325
|
+
showVisibleToStudent,
|
|
326
|
+
spellCheck = {},
|
|
327
|
+
settingsPanelDisabled,
|
|
328
|
+
maxNoOfTraits,
|
|
329
|
+
minNoOfTraits,
|
|
330
|
+
width,
|
|
331
|
+
mathMlOptions = {},
|
|
332
|
+
maxMaxPoints,
|
|
333
|
+
expandedInput = {},
|
|
334
|
+
labelInput = {}
|
|
335
|
+
} = configuration || {};
|
|
336
|
+
const {
|
|
337
|
+
errors,
|
|
338
|
+
extraCSSRules,
|
|
339
|
+
scales,
|
|
340
|
+
excludeZero,
|
|
341
|
+
description,
|
|
342
|
+
pointLabels,
|
|
343
|
+
standards,
|
|
344
|
+
spellCheckEnabled,
|
|
345
|
+
maxPointsEnabled,
|
|
346
|
+
addScaleEnabled
|
|
347
|
+
} = model || {};
|
|
348
|
+
const {
|
|
349
|
+
showExcludeZeroDialog,
|
|
350
|
+
showInfoDialog,
|
|
351
|
+
infoDialogText,
|
|
352
|
+
adjustedWidth
|
|
353
|
+
} = this.state || {};
|
|
354
|
+
|
|
355
|
+
// excludeZero should be false and disabled when maxPoints is 1 for any scale
|
|
356
|
+
const disabledExcludeZero = scales?.some(scale => scale.maxPoints === 1);
|
|
357
|
+
const panelSettings = {
|
|
358
|
+
standards: showStandards.settings && toggle(showStandards.label),
|
|
359
|
+
'showLevelTagInput.enabled': showLevelTagInput.settings && toggle(showLevelTagInput.label, true),
|
|
360
|
+
visibleToStudent: showVisibleToStudent.settings && toggle(showVisibleToStudent.label),
|
|
361
|
+
excludeZero: showExcludeZero.settings && toggle(showExcludeZero.label, false, disabledExcludeZero),
|
|
362
|
+
halfScoring: showHalfScoring.settings && toggle(showHalfScoring.label),
|
|
363
|
+
'dragAndDrop.enabled': dragAndDrop.settings && toggle(dragAndDrop.label, true)
|
|
364
|
+
};
|
|
365
|
+
const panelProperties = {
|
|
366
|
+
description: showDescription.settings && toggle(showDescription.label),
|
|
367
|
+
pointLabels: showScorePointLabels.settings && toggle(showScorePointLabels.label),
|
|
368
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
369
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
370
|
+
addScaleEnabled: addScale.settings && toggle(addScale.label)
|
|
371
|
+
};
|
|
372
|
+
const getPluginProps = props => {
|
|
373
|
+
return Object.assign({
|
|
374
|
+
...baseInputConfiguration
|
|
375
|
+
}, props || {});
|
|
376
|
+
};
|
|
377
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
378
|
+
extraCSSRules: extraCSSRules,
|
|
379
|
+
dimensions: contentDimensions,
|
|
380
|
+
hideSettings: settingsPanelDisabled,
|
|
381
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
382
|
+
model: model,
|
|
383
|
+
onChangeModel: this.onModelChanged,
|
|
384
|
+
configuration: configuration,
|
|
385
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
386
|
+
groups: {
|
|
387
|
+
Settings: panelSettings,
|
|
388
|
+
Properties: panelProperties
|
|
479
389
|
},
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
style: {
|
|
483
|
-
width: width || adjustedWidth
|
|
484
|
-
}
|
|
485
|
-
}, (scales || []).map(function (scale, scaleIndex) {
|
|
486
|
-
return /*#__PURE__*/_react["default"].createElement(_scale["default"], (0, _extends2["default"])({
|
|
487
|
-
key: "scale-".concat(scaleIndex),
|
|
488
|
-
scale: scale,
|
|
489
|
-
scaleIndex: scaleIndex,
|
|
490
|
-
errors: errors,
|
|
491
|
-
onScaleRemoved: _this2.onScaleRemoved,
|
|
492
|
-
onScaleChanged: _this2.onScaleChanged,
|
|
493
|
-
showStandards: standards,
|
|
494
|
-
showScorePointLabels: pointLabels,
|
|
495
|
-
showDescription: description,
|
|
496
|
-
showLevelTagInput: showLevelTagInput.enabled,
|
|
390
|
+
modal: /*#__PURE__*/_react.default.createElement(ShowModal, {
|
|
391
|
+
showExcludeZeroDialog: showExcludeZeroDialog,
|
|
497
392
|
excludeZero: excludeZero,
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
393
|
+
changeExcludeZero: this.changeExcludeZero,
|
|
394
|
+
cancel: this.hideToggleExcludeZeroModal
|
|
395
|
+
})
|
|
396
|
+
})
|
|
397
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
398
|
+
style: {
|
|
399
|
+
width: '100%'
|
|
400
|
+
},
|
|
401
|
+
ref: this.divRef
|
|
402
|
+
}), /*#__PURE__*/_react.default.createElement(StyledDiv, {
|
|
403
|
+
style: {
|
|
404
|
+
width: width || adjustedWidth
|
|
405
|
+
}
|
|
406
|
+
}, (scales || []).map((scale, scaleIndex) => /*#__PURE__*/_react.default.createElement(_scale.default, (0, _extends2.default)({
|
|
407
|
+
key: `scale-${scaleIndex}`,
|
|
408
|
+
scale: scale,
|
|
409
|
+
scaleIndex: scaleIndex,
|
|
410
|
+
errors: errors,
|
|
411
|
+
onScaleRemoved: this.onScaleRemoved,
|
|
412
|
+
onScaleChanged: this.onScaleChanged,
|
|
413
|
+
showStandards: standards,
|
|
414
|
+
showScorePointLabels: pointLabels,
|
|
415
|
+
showDescription: description,
|
|
416
|
+
showLevelTagInput: showLevelTagInput.enabled,
|
|
417
|
+
excludeZero: excludeZero,
|
|
418
|
+
enableDragAndDrop: dragAndDrop.enabled,
|
|
419
|
+
spellCheck: spellCheckEnabled,
|
|
420
|
+
width: adjustedWidth,
|
|
421
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
422
|
+
maxPointsEnabled: maxPointsEnabled,
|
|
423
|
+
maxNoOfTraits: maxNoOfTraits,
|
|
424
|
+
minNoOfTraits: minNoOfTraits,
|
|
425
|
+
imageSupport: imageSupport
|
|
426
|
+
}, this.props, {
|
|
427
|
+
mathMlOptions: mathMlOptions,
|
|
428
|
+
maxMaxPoints: maxMaxPoints,
|
|
429
|
+
expandedPluginProps: getPluginProps(expandedInput?.inputConfiguration),
|
|
430
|
+
labelPluginProps: getPluginProps(labelInput?.inputConfiguration)
|
|
431
|
+
}))), addScaleEnabled && /*#__PURE__*/_react.default.createElement(_common.MultiTraitButton, {
|
|
432
|
+
onClick: this.onScaleAdded
|
|
433
|
+
}, "Add Scale")), /*#__PURE__*/_react.default.createElement(_modals.InfoDialog, {
|
|
434
|
+
open: showInfoDialog,
|
|
435
|
+
text: infoDialogText,
|
|
436
|
+
onClose: () => this.set({
|
|
437
|
+
showInfoDialog: false
|
|
438
|
+
})
|
|
439
|
+
}));
|
|
440
|
+
}
|
|
441
|
+
}
|
|
529
442
|
exports.Main = Main;
|
|
530
443
|
Main.propTypes = {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
"delete": _propTypes["default"].func.isRequired
|
|
444
|
+
model: _propTypes.default.object,
|
|
445
|
+
uploadSoundSupport: _propTypes.default.object,
|
|
446
|
+
configuration: _propTypes.default.object,
|
|
447
|
+
onModelChanged: _propTypes.default.func,
|
|
448
|
+
onConfigurationChanged: _propTypes.default.func,
|
|
449
|
+
imageSupport: _propTypes.default.shape({
|
|
450
|
+
add: _propTypes.default.func.isRequired,
|
|
451
|
+
delete: _propTypes.default.func.isRequired
|
|
540
452
|
})
|
|
541
453
|
};
|
|
542
|
-
|
|
543
|
-
var _default = (0, _drag.withDragContext)((0, _styles.withStyles)(styles)(Main));
|
|
544
|
-
|
|
545
|
-
exports["default"] = _default;
|
|
454
|
+
var _default = exports.default = Main;
|
|
546
455
|
//# sourceMappingURL=main.js.map
|