@pie-element/select-text 11.3.4-next.3 → 12.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/defaultConfiguration.js +2 -3
- package/configure/lib/defaultConfiguration.js.map +1 -1
- package/configure/lib/design.js +359 -459
- package/configure/lib/design.js.map +1 -1
- package/configure/lib/index.js +104 -165
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +28 -52
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +10 -7
- package/controller/CHANGELOG.md +0 -11
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +104 -179
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +3 -3
- package/lib/index.js +84 -134
- package/lib/index.js.map +1 -1
- package/lib/main.js +163 -236
- package/lib/main.js.map +1 -1
- package/lib/print.js +38 -75
- package/lib/print.js.map +1 -1
- package/lib/utils.js +21 -45
- package/lib/utils.js.map +1 -1
- package/package.json +13 -14
- package/module/configure.js +0 -1
- package/module/controller.js +0 -1932
- package/module/demo.js +0 -301
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -339
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/configure/lib/design.js
CHANGED
|
@@ -1,507 +1,407 @@
|
|
|
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
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
7
|
+
exports.default = exports.Design = void 0;
|
|
22
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
9
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var _styles = require("@material-ui/core/styles");
|
|
31
|
-
|
|
11
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
32
13
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
33
|
-
|
|
34
14
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
35
|
-
|
|
36
15
|
var _textSelect = require("@pie-lib/text-select");
|
|
37
|
-
|
|
38
16
|
var _configUi = require("@pie-lib/config-ui");
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
43
|
-
|
|
17
|
+
var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
|
|
18
|
+
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
44
19
|
var _debug = _interopRequireDefault(require("debug"));
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
49
|
-
|
|
20
|
+
var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
|
|
21
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
50
22
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
23
|
+
const {
|
|
24
|
+
Panel,
|
|
25
|
+
toggle,
|
|
26
|
+
radio,
|
|
27
|
+
dropdown
|
|
28
|
+
} = _configUi.settings;
|
|
29
|
+
const StyledInputContainer = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
30
|
+
theme
|
|
31
|
+
}) => ({
|
|
32
|
+
width: '100%',
|
|
33
|
+
paddingTop: theme.spacing(2),
|
|
34
|
+
marginBottom: theme.spacing(2)
|
|
35
|
+
}));
|
|
36
|
+
const StyledEditableHtml = (0, _styles.styled)(_editableHtmlTipTap.default)({
|
|
37
|
+
width: '100%'
|
|
38
|
+
});
|
|
39
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
40
|
+
theme
|
|
41
|
+
}) => ({
|
|
42
|
+
fontSize: theme.typography.fontSize - 2,
|
|
43
|
+
color: theme.palette.error.main,
|
|
44
|
+
paddingTop: theme.spacing(1)
|
|
45
|
+
}));
|
|
46
|
+
const StyledTextField = (0, _styles.styled)(_TextField.default)({
|
|
47
|
+
width: '100%'
|
|
48
|
+
});
|
|
49
|
+
const TokenizerContainer = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
50
|
+
theme
|
|
51
|
+
}) => ({
|
|
52
|
+
paddingRight: 0,
|
|
53
|
+
marginRight: 0,
|
|
54
|
+
position: 'relative',
|
|
55
|
+
'&:after': {
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
bottom: 0,
|
|
58
|
+
left: 0,
|
|
59
|
+
right: 0,
|
|
60
|
+
height: '1px',
|
|
61
|
+
content: '""',
|
|
62
|
+
backgroundColor: theme.palette.primary.main
|
|
63
|
+
},
|
|
64
|
+
marginBottom: theme.spacing(1)
|
|
65
|
+
}));
|
|
66
|
+
const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
|
|
67
|
+
theme
|
|
68
|
+
}) => ({
|
|
69
|
+
'& .MuiTooltip-tooltip': {
|
|
70
|
+
fontSize: theme.typography.fontSize - 2,
|
|
71
|
+
whiteSpace: 'pre',
|
|
72
|
+
maxWidth: '500px'
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
const StyledTokenizer = (0, _styles.styled)(_textSelect.Tokenizer)(({
|
|
76
|
+
theme
|
|
77
|
+
}) => ({
|
|
78
|
+
marginTop: theme.spacing(2)
|
|
79
|
+
}));
|
|
80
|
+
const StyledChip = (0, _styles.styled)(_Chip.default)(({
|
|
81
|
+
theme
|
|
82
|
+
}) => ({
|
|
83
|
+
marginTop: theme.spacing(0.5),
|
|
84
|
+
marginRight: theme.spacing(2)
|
|
85
|
+
}));
|
|
86
|
+
const TokensDetails = (0, _styles.styled)('div')(({
|
|
87
|
+
theme
|
|
88
|
+
}) => ({
|
|
89
|
+
display: 'flex',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
flexWrap: 'wrap',
|
|
92
|
+
marginBottom: theme.spacing(2.5)
|
|
93
|
+
}));
|
|
94
|
+
const StyledNumberTextField = (0, _styles.styled)(_configUi.NumberTextField)(({
|
|
95
|
+
theme
|
|
96
|
+
}) => ({
|
|
97
|
+
width: '180px',
|
|
98
|
+
margin: `${theme.spacing(0.5)}px auto 0`
|
|
99
|
+
}));
|
|
100
|
+
const log = (0, _debug.default)('@pie-element:select-text:configure');
|
|
101
|
+
class Design extends _react.default.Component {
|
|
102
|
+
constructor(props) {
|
|
103
|
+
super(props);
|
|
104
|
+
(0, _defineProperty2.default)(this, "updateText", (0, _debounce.default)(val => {
|
|
105
|
+
this.apply(u => {
|
|
78
106
|
u.text = val;
|
|
79
107
|
u.tokens = [];
|
|
80
108
|
});
|
|
81
109
|
}, 200));
|
|
82
|
-
(0, _defineProperty2
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeTokens", function (tokens, mode) {
|
|
86
|
-
_this.apply(function (u) {
|
|
110
|
+
(0, _defineProperty2.default)(this, "changeText", event => this.updateText(event.target.value));
|
|
111
|
+
(0, _defineProperty2.default)(this, "changeTokens", (tokens, mode) => {
|
|
112
|
+
this.apply(u => {
|
|
87
113
|
u.tokens = tokens;
|
|
88
114
|
u.mode = mode;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}).length;
|
|
92
|
-
var max = isFinite(u.maxSelections) ? u.maxSelections : 0;
|
|
115
|
+
const correctTokenCount = tokens.filter(t => t.correct).length;
|
|
116
|
+
const max = isFinite(u.maxSelections) ? u.maxSelections : 0;
|
|
93
117
|
u.maxSelections = Math.max(max, correctTokenCount);
|
|
94
118
|
});
|
|
95
119
|
});
|
|
96
|
-
(0, _defineProperty2
|
|
97
|
-
|
|
98
|
-
return u.maxSelections = max;
|
|
99
|
-
});
|
|
120
|
+
(0, _defineProperty2.default)(this, "changeMaxSelections", (event, max) => {
|
|
121
|
+
this.apply(u => u.maxSelections = max);
|
|
100
122
|
});
|
|
101
|
-
(0, _defineProperty2
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
(0, _defineProperty2.default)(this, "apply", fn => {
|
|
124
|
+
const {
|
|
125
|
+
onModelChanged,
|
|
126
|
+
model
|
|
127
|
+
} = this.props;
|
|
128
|
+
const update = (0, _cloneDeep.default)(model);
|
|
106
129
|
fn(update);
|
|
107
130
|
onModelChanged(update);
|
|
108
131
|
});
|
|
109
|
-
(0, _defineProperty2
|
|
110
|
-
|
|
111
|
-
return u.feedback = feedback;
|
|
112
|
-
});
|
|
132
|
+
(0, _defineProperty2.default)(this, "changeFeedback", feedback => {
|
|
133
|
+
this.apply(u => u.feedback = feedback);
|
|
113
134
|
});
|
|
114
|
-
(0, _defineProperty2
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
135
|
+
(0, _defineProperty2.default)(this, "changePartialScoring", partialScoring => {
|
|
136
|
+
const {
|
|
137
|
+
onModelChanged,
|
|
138
|
+
model
|
|
139
|
+
} = this.props;
|
|
140
|
+
const update = (0, _cloneDeep.default)(model);
|
|
119
141
|
update.partialScoring = partialScoring;
|
|
120
142
|
onModelChanged(update);
|
|
121
143
|
});
|
|
122
|
-
(0, _defineProperty2
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
144
|
+
(0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
|
|
145
|
+
const {
|
|
146
|
+
onModelChanged,
|
|
147
|
+
model
|
|
148
|
+
} = this.props;
|
|
149
|
+
const update = (0, _cloneDeep.default)(model);
|
|
127
150
|
update.prompt = prompt;
|
|
128
151
|
onModelChanged(update);
|
|
129
152
|
});
|
|
130
|
-
(0, _defineProperty2
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
153
|
+
(0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
|
|
154
|
+
const {
|
|
155
|
+
onModelChanged,
|
|
156
|
+
model
|
|
157
|
+
} = this.props;
|
|
158
|
+
const update = (0, _cloneDeep.default)(model);
|
|
135
159
|
update.teacherInstructions = teacherInstructions;
|
|
136
160
|
onModelChanged(update);
|
|
137
161
|
});
|
|
138
|
-
(0, _defineProperty2
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
162
|
+
(0, _defineProperty2.default)(this, "onRationaleChanged", rationale => {
|
|
163
|
+
const {
|
|
164
|
+
onModelChanged,
|
|
165
|
+
model
|
|
166
|
+
} = this.props;
|
|
167
|
+
onModelChanged({
|
|
168
|
+
...model,
|
|
169
|
+
rationale
|
|
170
|
+
});
|
|
145
171
|
});
|
|
146
|
-
|
|
147
|
-
|
|
172
|
+
const {
|
|
173
|
+
model: _model
|
|
174
|
+
} = this.props;
|
|
175
|
+
this.state = {
|
|
148
176
|
text: _model && _model.text || ''
|
|
149
177
|
};
|
|
150
|
-
return _this;
|
|
151
178
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
text: model.text
|
|
161
|
-
});
|
|
162
|
-
}
|
|
179
|
+
UNSAFE_componentWillReceiveProps(nProps) {
|
|
180
|
+
const {
|
|
181
|
+
model
|
|
182
|
+
} = nProps;
|
|
183
|
+
if (model && model.text) {
|
|
184
|
+
this.setState({
|
|
185
|
+
text: model.text
|
|
186
|
+
});
|
|
163
187
|
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
264
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
265
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
266
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
267
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
268
|
-
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
var getPluginProps = function getPluginProps() {
|
|
272
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
273
|
-
return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
277
|
-
extraCSSRules: extraCSSRules,
|
|
278
|
-
dimensions: contentDimensions,
|
|
279
|
-
hideSettings: settingsPanelDisabled,
|
|
280
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
281
|
-
model: model,
|
|
282
|
-
configuration: configuration,
|
|
283
|
-
onChangeModel: function onChangeModel(model) {
|
|
284
|
-
return onModelChanged(model);
|
|
285
|
-
},
|
|
286
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
287
|
-
groups: {
|
|
288
|
-
Settings: panelSettings,
|
|
289
|
-
Properties: panelProperties
|
|
290
|
-
}
|
|
291
|
-
})
|
|
292
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
293
|
-
label: teacherInstructions.label,
|
|
294
|
-
className: classes.promptHolder
|
|
295
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
296
|
-
className: classes.prompt,
|
|
297
|
-
markup: model.teacherInstructions || '',
|
|
298
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
299
|
-
imageSupport: imageSupport,
|
|
300
|
-
nonEmpty: false,
|
|
301
|
-
error: teacherInstructionsError,
|
|
302
|
-
toolbarOpts: toolbarOpts,
|
|
303
|
-
pluginProps: getPluginProps(configuration === null || configuration === void 0 ? void 0 : (_configuration$teache = configuration.teacherInstructions) === null || _configuration$teache === void 0 ? void 0 : _configuration$teache.inputConfiguration),
|
|
304
|
-
spellCheck: spellCheckEnabled,
|
|
305
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
306
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
307
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
308
|
-
languageCharactersProps: [{
|
|
309
|
-
language: 'spanish'
|
|
310
|
-
}, {
|
|
311
|
-
language: 'special'
|
|
312
|
-
}],
|
|
313
|
-
mathMlOptions: mathMlOptions
|
|
314
|
-
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
315
|
-
className: classes.errorText
|
|
316
|
-
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
317
|
-
label: prompt.label || '',
|
|
318
|
-
className: classes.promptHolder
|
|
319
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
320
|
-
className: classes.prompt,
|
|
321
|
-
markup: model.prompt,
|
|
322
|
-
onChange: this.onPromptChanged,
|
|
323
|
-
imageSupport: imageSupport,
|
|
324
|
-
error: promptError,
|
|
325
|
-
toolbarOpts: toolbarOpts,
|
|
326
|
-
pluginProps: getPluginProps(configuration === null || configuration === void 0 ? void 0 : (_configuration$prompt = configuration.prompt) === null || _configuration$prompt === void 0 ? void 0 : _configuration$prompt.inputConfiguration),
|
|
327
|
-
spellCheck: spellCheckEnabled,
|
|
328
|
-
maxImageWidth: defaultImageMaxWidth,
|
|
329
|
-
maxImageHeight: defaultImageMaxHeight,
|
|
330
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
331
|
-
languageCharactersProps: [{
|
|
332
|
-
language: 'spanish'
|
|
333
|
-
}, {
|
|
334
|
-
language: 'special'
|
|
335
|
-
}],
|
|
336
|
-
mathMlOptions: mathMlOptions
|
|
337
|
-
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
338
|
-
className: classes.errorText
|
|
339
|
-
}, promptError)), text.settings && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
340
|
-
label: text.label || '',
|
|
341
|
-
className: classes.promptHolder
|
|
342
|
-
}, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
343
|
-
className: classes.input,
|
|
344
|
-
multiline: true,
|
|
345
|
-
defaultValue: textValue,
|
|
346
|
-
onChange: this.changeText,
|
|
347
|
-
spellCheck: spellCheckEnabled
|
|
348
|
-
})), tokens.settings && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
349
|
-
label: tokens.label || '',
|
|
350
|
-
className: classes.tokenizerContainer
|
|
351
|
-
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
352
|
-
classes: {
|
|
353
|
-
tooltip: classes.tooltip
|
|
354
|
-
},
|
|
355
|
-
disableFocusListener: true,
|
|
356
|
-
disableTouchListener: true,
|
|
357
|
-
placement: 'right',
|
|
358
|
-
title: validationMessage
|
|
359
|
-
}, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
|
|
360
|
-
fontSize: 'small',
|
|
361
|
-
color: 'primary',
|
|
362
|
-
style: {
|
|
363
|
-
position: 'absolute',
|
|
364
|
-
left: '48px',
|
|
365
|
-
top: '-3px'
|
|
188
|
+
}
|
|
189
|
+
render() {
|
|
190
|
+
const {
|
|
191
|
+
text: textValue
|
|
192
|
+
} = this.state;
|
|
193
|
+
const {
|
|
194
|
+
configuration,
|
|
195
|
+
imageSupport,
|
|
196
|
+
model,
|
|
197
|
+
onConfigurationChanged,
|
|
198
|
+
onModelChanged,
|
|
199
|
+
uploadSoundSupport
|
|
200
|
+
} = this.props;
|
|
201
|
+
const {
|
|
202
|
+
baseInputConfiguration = {},
|
|
203
|
+
correctAnswer = {},
|
|
204
|
+
contentDimensions = {},
|
|
205
|
+
feedback = {},
|
|
206
|
+
highlightChoices = {},
|
|
207
|
+
mode = {},
|
|
208
|
+
partialScoring = {},
|
|
209
|
+
prompt = {},
|
|
210
|
+
rationale = {},
|
|
211
|
+
selectionCount = {},
|
|
212
|
+
selections = {},
|
|
213
|
+
settingsPanelDisabled,
|
|
214
|
+
scoringType = {},
|
|
215
|
+
spellCheck = {},
|
|
216
|
+
studentInstructions = {},
|
|
217
|
+
teacherInstructions = {},
|
|
218
|
+
text = {},
|
|
219
|
+
tokens = {},
|
|
220
|
+
maxImageWidth = {},
|
|
221
|
+
maxImageHeight = {},
|
|
222
|
+
withRubric = {},
|
|
223
|
+
mathMlOptions = {},
|
|
224
|
+
language = {},
|
|
225
|
+
languageChoices = {}
|
|
226
|
+
} = configuration || {};
|
|
227
|
+
const {
|
|
228
|
+
errors,
|
|
229
|
+
extraCSSRules,
|
|
230
|
+
feedbackEnabled,
|
|
231
|
+
promptEnabled,
|
|
232
|
+
rationaleEnabled,
|
|
233
|
+
spellCheckEnabled,
|
|
234
|
+
teacherInstructionsEnabled,
|
|
235
|
+
toolbarEditorPosition
|
|
236
|
+
} = model || {};
|
|
237
|
+
const {
|
|
238
|
+
prompt: promptError,
|
|
239
|
+
rationale: rationaleError,
|
|
240
|
+
selectionsError,
|
|
241
|
+
teacherInstructions: teacherInstructionsError,
|
|
242
|
+
tokensError
|
|
243
|
+
} = errors || {};
|
|
244
|
+
const validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
245
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
246
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
247
|
+
let {
|
|
248
|
+
tokens: tokensModel
|
|
249
|
+
} = model;
|
|
250
|
+
tokensModel = tokensModel || [];
|
|
251
|
+
const toolbarOpts = {
|
|
252
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
253
|
+
};
|
|
254
|
+
log('[render] maxSelections:', model.maxSelections);
|
|
255
|
+
const panelSettings = {
|
|
256
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
257
|
+
highlightChoices: highlightChoices.settings && toggle(highlightChoices.label),
|
|
258
|
+
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
259
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
260
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
261
|
+
};
|
|
262
|
+
const panelProperties = {
|
|
263
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
264
|
+
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
265
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
266
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
267
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
268
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
269
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
|
|
270
|
+
};
|
|
271
|
+
const getPluginProps = (props = {}) => ({
|
|
272
|
+
...baseInputConfiguration,
|
|
273
|
+
...props
|
|
274
|
+
});
|
|
275
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
276
|
+
extraCSSRules: extraCSSRules,
|
|
277
|
+
dimensions: contentDimensions,
|
|
278
|
+
hideSettings: settingsPanelDisabled,
|
|
279
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
280
|
+
model: model,
|
|
281
|
+
configuration: configuration,
|
|
282
|
+
onChangeModel: model => onModelChanged(model),
|
|
283
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
284
|
+
groups: {
|
|
285
|
+
Settings: panelSettings,
|
|
286
|
+
Properties: panelProperties
|
|
366
287
|
}
|
|
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
|
-
|
|
288
|
+
})
|
|
289
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
290
|
+
label: teacherInstructions.label
|
|
291
|
+
}, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
|
|
292
|
+
markup: model.teacherInstructions || '',
|
|
293
|
+
onChange: this.onTeacherInstructionsChanged,
|
|
294
|
+
imageSupport: imageSupport,
|
|
295
|
+
nonEmpty: false,
|
|
296
|
+
error: teacherInstructionsError,
|
|
297
|
+
toolbarOpts: toolbarOpts,
|
|
298
|
+
pluginProps: getPluginProps(configuration?.teacherInstructions?.inputConfiguration),
|
|
299
|
+
spellCheck: spellCheckEnabled,
|
|
300
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
301
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
302
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
303
|
+
languageCharactersProps: [{
|
|
304
|
+
language: 'spanish'
|
|
305
|
+
}, {
|
|
306
|
+
language: 'special'
|
|
307
|
+
}],
|
|
308
|
+
mathMlOptions: mathMlOptions
|
|
309
|
+
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
310
|
+
label: prompt.label || ''
|
|
311
|
+
}, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
|
|
312
|
+
markup: model.prompt,
|
|
313
|
+
onChange: this.onPromptChanged,
|
|
314
|
+
imageSupport: imageSupport,
|
|
315
|
+
error: promptError,
|
|
316
|
+
toolbarOpts: toolbarOpts,
|
|
317
|
+
pluginProps: getPluginProps(configuration?.prompt?.inputConfiguration),
|
|
318
|
+
spellCheck: spellCheckEnabled,
|
|
319
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
320
|
+
maxImageHeight: defaultImageMaxHeight,
|
|
321
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
322
|
+
languageCharactersProps: [{
|
|
323
|
+
language: 'spanish'
|
|
324
|
+
}, {
|
|
325
|
+
language: 'special'
|
|
326
|
+
}],
|
|
327
|
+
mathMlOptions: mathMlOptions
|
|
328
|
+
}), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), text.settings && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
329
|
+
label: text.label || ''
|
|
330
|
+
}, /*#__PURE__*/_react.default.createElement(StyledTextField, {
|
|
331
|
+
variant: "standard",
|
|
332
|
+
multiline: true,
|
|
333
|
+
defaultValue: textValue,
|
|
334
|
+
onChange: this.changeText,
|
|
335
|
+
spellCheck: spellCheckEnabled
|
|
336
|
+
})), tokens.settings && /*#__PURE__*/_react.default.createElement(TokenizerContainer, {
|
|
337
|
+
label: tokens.label || ''
|
|
338
|
+
}, /*#__PURE__*/_react.default.createElement(StyledTooltip, {
|
|
339
|
+
disableFocusListener: true,
|
|
340
|
+
disableTouchListener: true,
|
|
341
|
+
placement: 'right',
|
|
342
|
+
title: validationMessage
|
|
343
|
+
}, /*#__PURE__*/_react.default.createElement(_Info.default, {
|
|
344
|
+
fontSize: 'small',
|
|
345
|
+
color: 'primary',
|
|
346
|
+
style: {
|
|
347
|
+
position: 'absolute',
|
|
348
|
+
left: '48px',
|
|
349
|
+
top: '-3px'
|
|
350
|
+
}
|
|
351
|
+
})), /*#__PURE__*/_react.default.createElement(StyledTokenizer, {
|
|
352
|
+
text: model.text,
|
|
353
|
+
tokens: tokensModel,
|
|
354
|
+
onChange: this.changeTokens
|
|
355
|
+
})), tokensError && /*#__PURE__*/_react.default.createElement(ErrorText, null, tokensError), selectionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, selectionsError), /*#__PURE__*/_react.default.createElement(TokensDetails, null, mode.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
|
|
356
|
+
label: `${mode.label}: ${model.mode ? model.mode : 'None'}`
|
|
357
|
+
}), selections.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
|
|
358
|
+
label: `${selections.label}: ${tokensModel.length}`
|
|
359
|
+
}), correctAnswer.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
|
|
360
|
+
label: `${correctAnswer.label}: ${tokensModel.filter(t => t.correct).length}`
|
|
361
|
+
}), selectionCount.settings && /*#__PURE__*/_react.default.createElement(StyledNumberTextField, {
|
|
362
|
+
min: tokensModel.filter(t => t.correct).length || 0,
|
|
363
|
+
label: `${selectionCount.label} (0:any)`,
|
|
364
|
+
max: tokensModel.length,
|
|
365
|
+
value: model.maxSelections,
|
|
366
|
+
onChange: this.changeMaxSelections
|
|
367
|
+
})), rationaleEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
368
|
+
label: rationale.label || ''
|
|
369
|
+
}, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
|
|
370
|
+
markup: model.rationale || '',
|
|
371
|
+
onChange: this.onRationaleChanged,
|
|
372
|
+
imageSupport: imageSupport,
|
|
373
|
+
error: rationaleError,
|
|
374
|
+
toolbarOpts: toolbarOpts,
|
|
375
|
+
pluginProps: getPluginProps(configuration?.rationale?.inputConfiguration),
|
|
376
|
+
spellCheck: spellCheckEnabled,
|
|
377
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
378
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
379
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
380
|
+
languageCharactersProps: [{
|
|
381
|
+
language: 'spanish'
|
|
382
|
+
}, {
|
|
383
|
+
language: 'special'
|
|
384
|
+
}],
|
|
385
|
+
mathMlOptions: mathMlOptions
|
|
386
|
+
}), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)), feedbackEnabled && /*#__PURE__*/_react.default.createElement(_configUi.FeedbackConfig, {
|
|
387
|
+
feedback: model.feedback,
|
|
388
|
+
onChange: this.changeFeedback,
|
|
389
|
+
toolbarOpts: toolbarOpts
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
431
393
|
exports.Design = Design;
|
|
432
|
-
(0, _defineProperty2
|
|
433
|
-
model: _propTypes
|
|
434
|
-
configuration: _propTypes
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
"delete": _propTypes["default"].func.isRequired
|
|
394
|
+
(0, _defineProperty2.default)(Design, "propTypes", {
|
|
395
|
+
model: _propTypes.default.object.isRequired,
|
|
396
|
+
configuration: _propTypes.default.object.isRequired,
|
|
397
|
+
onModelChanged: _propTypes.default.func.isRequired,
|
|
398
|
+
onConfigurationChanged: _propTypes.default.func.isRequired,
|
|
399
|
+
imageSupport: _propTypes.default.shape({
|
|
400
|
+
add: _propTypes.default.func.isRequired,
|
|
401
|
+
delete: _propTypes.default.func.isRequired
|
|
441
402
|
}),
|
|
442
|
-
uploadSoundSupport: _propTypes
|
|
403
|
+
uploadSoundSupport: _propTypes.default.object
|
|
443
404
|
});
|
|
444
|
-
(0, _defineProperty2
|
|
445
|
-
|
|
446
|
-
var _default = (0, _styles.withStyles)(function (theme) {
|
|
447
|
-
return {
|
|
448
|
-
tokenizerContainer: {
|
|
449
|
-
paddingRight: 0,
|
|
450
|
-
marginRight: 0,
|
|
451
|
-
'&:after': {
|
|
452
|
-
position: 'absolute',
|
|
453
|
-
bottom: 0,
|
|
454
|
-
left: 0,
|
|
455
|
-
right: 0,
|
|
456
|
-
height: '1px',
|
|
457
|
-
content: '""',
|
|
458
|
-
backgroundColor: theme.palette.primary.main
|
|
459
|
-
},
|
|
460
|
-
marginBottom: theme.spacing.unit
|
|
461
|
-
},
|
|
462
|
-
chip: {
|
|
463
|
-
marginTop: theme.spacing.unit / 2,
|
|
464
|
-
marginRight: theme.spacing.unit * 2
|
|
465
|
-
},
|
|
466
|
-
input: {
|
|
467
|
-
width: '100%'
|
|
468
|
-
},
|
|
469
|
-
tokenizer: {
|
|
470
|
-
marginTop: theme.spacing.unit * 2
|
|
471
|
-
},
|
|
472
|
-
mainOpts: {
|
|
473
|
-
width: '100%',
|
|
474
|
-
justifyContent: 'space-between',
|
|
475
|
-
display: 'flex',
|
|
476
|
-
alignItems: 'baseline'
|
|
477
|
-
},
|
|
478
|
-
promptHolder: {
|
|
479
|
-
width: '100%',
|
|
480
|
-
paddingTop: theme.spacing.unit * 2,
|
|
481
|
-
marginBottom: theme.spacing.unit * 2
|
|
482
|
-
},
|
|
483
|
-
tokensDetails: {
|
|
484
|
-
display: 'flex',
|
|
485
|
-
alignItems: 'center',
|
|
486
|
-
flexWrap: 'wrap',
|
|
487
|
-
marginBottom: theme.spacing.unit * 2.5
|
|
488
|
-
},
|
|
489
|
-
numberField: {
|
|
490
|
-
width: '180px',
|
|
491
|
-
margin: "".concat(theme.spacing.unit / 2, "px auto 0")
|
|
492
|
-
},
|
|
493
|
-
tooltip: {
|
|
494
|
-
fontSize: theme.typography.fontSize - 2,
|
|
495
|
-
whiteSpace: 'pre',
|
|
496
|
-
maxWidth: '500px'
|
|
497
|
-
},
|
|
498
|
-
errorText: {
|
|
499
|
-
fontSize: theme.typography.fontSize - 2,
|
|
500
|
-
color: theme.palette.error.main,
|
|
501
|
-
paddingTop: theme.spacing.unit
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
})(Design);
|
|
505
|
-
|
|
506
|
-
exports["default"] = _default;
|
|
405
|
+
(0, _defineProperty2.default)(Design, "defaultProps", {});
|
|
406
|
+
var _default = exports.default = Design;
|
|
507
407
|
//# sourceMappingURL=design.js.map
|