@pie-element/hotspot 9.3.4-next.0 → 10.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/DeleteWidget.js +30 -43
- package/configure/lib/DeleteWidget.js.map +1 -1
- package/configure/lib/button.js +26 -45
- package/configure/lib/button.js.map +1 -1
- package/configure/lib/buttons/circle.js +20 -27
- package/configure/lib/buttons/circle.js.map +1 -1
- package/configure/lib/buttons/polygon.js +26 -33
- package/configure/lib/buttons/polygon.js.map +1 -1
- package/configure/lib/buttons/rectangle.js +26 -33
- package/configure/lib/buttons/rectangle.js.map +1 -1
- package/configure/lib/defaults.js +2 -3
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/hotspot-circle.js +132 -198
- package/configure/lib/hotspot-circle.js.map +1 -1
- package/configure/lib/hotspot-container.js +250 -355
- package/configure/lib/hotspot-container.js.map +1 -1
- package/configure/lib/hotspot-drawable.js +360 -472
- package/configure/lib/hotspot-drawable.js.map +1 -1
- package/configure/lib/hotspot-palette.js +92 -139
- package/configure/lib/hotspot-palette.js.map +1 -1
- package/configure/lib/hotspot-polygon.js +212 -317
- package/configure/lib/hotspot-polygon.js.map +1 -1
- package/configure/lib/hotspot-rectangle.js +128 -192
- package/configure/lib/hotspot-rectangle.js.map +1 -1
- package/configure/lib/icons.js.map +1 -1
- package/configure/lib/image-konva.js +46 -86
- package/configure/lib/image-konva.js.map +1 -1
- package/configure/lib/index.js +162 -222
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +301 -393
- package/configure/lib/root.js.map +1 -1
- package/configure/lib/shapes/circle.js +69 -101
- package/configure/lib/shapes/circle.js.map +1 -1
- package/configure/lib/shapes/index.js +4 -12
- package/configure/lib/shapes/index.js.map +1 -1
- package/configure/lib/shapes/polygon.js +64 -96
- package/configure/lib/shapes/polygon.js.map +1 -1
- package/configure/lib/shapes/rectagle.js +69 -101
- package/configure/lib/shapes/rectagle.js.map +1 -1
- package/configure/lib/shapes/utils.js +2 -8
- package/configure/lib/shapes/utils.js.map +1 -1
- package/configure/lib/upload-control.js +25 -52
- package/configure/lib/upload-control.js.map +1 -1
- package/configure/lib/utils.js +84 -137
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +11 -10
- package/configure/src/__tests__/hotspot-container.test.js +50 -19
- package/configure/src/__tests__/hotspot-drawable.test.js +55 -34
- package/configure/src/__tests__/index.test.js +167 -5
- package/configure/src/__tests__/root.test.js +89 -63
- package/configure/src/button.jsx +12 -20
- package/configure/src/hotspot-circle.jsx +5 -18
- package/configure/src/hotspot-container.jsx +82 -98
- package/configure/src/hotspot-drawable.jsx +43 -45
- package/configure/src/hotspot-palette.jsx +45 -37
- package/configure/src/hotspot-polygon.jsx +4 -20
- package/configure/src/hotspot-rectangle.jsx +4 -17
- package/configure/src/index.js +12 -2
- package/configure/src/root.jsx +85 -79
- package/configure/src/upload-control.jsx +6 -16
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +151 -205
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +14 -34
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +2 -2
- package/lib/hotspot/circle.js +110 -169
- package/lib/hotspot/circle.js.map +1 -1
- package/lib/hotspot/container.js +174 -260
- package/lib/hotspot/container.js.map +1 -1
- package/lib/hotspot/icons.js.map +1 -1
- package/lib/hotspot/image-konva-tooltip.js +65 -112
- package/lib/hotspot/image-konva-tooltip.js.map +1 -1
- package/lib/hotspot/index.js +135 -198
- package/lib/hotspot/index.js.map +1 -1
- package/lib/hotspot/polygon.js +150 -214
- package/lib/hotspot/polygon.js.map +1 -1
- package/lib/hotspot/rectangle.js +128 -185
- package/lib/hotspot/rectangle.js.map +1 -1
- package/lib/index.js +187 -256
- package/lib/index.js.map +1 -1
- package/lib/session-updater.js +12 -18
- package/lib/session-updater.js.map +1 -1
- package/package.json +14 -11
- package/src/__tests__/container.test.jsx +27 -175
- package/src/__tests__/index.test.js +70 -30
- package/src/hotspot/circle.jsx +2 -13
- package/src/hotspot/container.jsx +35 -50
- package/src/hotspot/index.jsx +16 -28
- package/src/hotspot/polygon.jsx +4 -13
- package/src/hotspot/rectangle.jsx +5 -15
- package/src/index.js +21 -12
- package/configure/src/__tests__/DeleteWidget.test.js +0 -64
- package/configure/src/__tests__/__snapshots__/hotspot-container.test.js.snap +0 -192
- package/configure/src/__tests__/__snapshots__/hotspot-drawable.test.js.snap +0 -562
- package/configure/src/__tests__/__snapshots__/root.test.js.snap +0 -469
- package/src/__tests__/__snapshots__/container.test.jsx.snap +0 -264
- package/src/__tests__/__snapshots__/index.test.js.snap +0 -81
- package/src/__tests__/__snapshots__/polygon.test.jsx.snap +0 -192
- package/src/__tests__/__snapshots__/rectangle.test.jsx.snap +0 -127
- package/src/__tests__/polygon.test.jsx +0 -230
- package/src/__tests__/rectangle.test.jsx +0 -232
package/configure/lib/root.js
CHANGED
|
@@ -1,422 +1,330 @@
|
|
|
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.Root = void 0;
|
|
22
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
9
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
10
|
var _configUi = require("@pie-lib/config-ui");
|
|
27
|
-
|
|
28
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
-
|
|
30
12
|
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
37
|
-
|
|
38
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
39
|
-
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
15
|
+
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
16
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
40
17
|
var _hotspotPalette = _interopRequireDefault(require("./hotspot-palette"));
|
|
41
|
-
|
|
42
18
|
var _hotspotContainer = _interopRequireDefault(require("./hotspot-container"));
|
|
43
|
-
|
|
44
19
|
var _utils = require("./utils");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
20
|
+
const {
|
|
21
|
+
Panel,
|
|
22
|
+
toggle,
|
|
23
|
+
dropdown
|
|
24
|
+
} = _configUi.settings;
|
|
25
|
+
const DimensionsContainer = (0, _styles.styled)('div')(({
|
|
26
|
+
theme
|
|
27
|
+
}) => ({
|
|
28
|
+
display: 'flex',
|
|
29
|
+
marginBottom: theme.spacing(1.5)
|
|
30
|
+
}));
|
|
31
|
+
const FieldContainer = (0, _styles.styled)('div')({
|
|
32
|
+
flex: 1,
|
|
33
|
+
width: '90%'
|
|
34
|
+
});
|
|
35
|
+
const PromptContainer = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
36
|
+
theme
|
|
37
|
+
}) => ({
|
|
38
|
+
paddingTop: theme.spacing(1),
|
|
39
|
+
marginTop: theme.spacing(2),
|
|
40
|
+
marginBottom: theme.spacing(2),
|
|
41
|
+
width: '100%'
|
|
42
|
+
}));
|
|
43
|
+
const SubHeading = (0, _styles.styled)(_Typography.default)(({
|
|
44
|
+
theme
|
|
45
|
+
}) => ({
|
|
46
|
+
marginRight: theme.spacing(1)
|
|
47
|
+
}));
|
|
48
|
+
const FlexContainer = (0, _styles.styled)('div')({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center'
|
|
51
|
+
});
|
|
52
|
+
const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
|
|
53
|
+
theme
|
|
54
|
+
}) => ({
|
|
55
|
+
'& .MuiTooltip-tooltip': {
|
|
56
|
+
fontSize: theme.typography.fontSize - 2,
|
|
57
|
+
whiteSpace: 'pre',
|
|
58
|
+
maxWidth: '500px'
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
62
|
+
theme
|
|
63
|
+
}) => ({
|
|
64
|
+
fontSize: theme.typography.fontSize - 2,
|
|
65
|
+
color: theme.palette.error.main,
|
|
66
|
+
paddingTop: theme.spacing(1)
|
|
67
|
+
}));
|
|
68
|
+
class Root extends _react.default.Component {
|
|
69
|
+
constructor(...args) {
|
|
70
|
+
super(...args);
|
|
71
|
+
(0, _defineProperty2.default)(this, "handleColorChange", (fieldType, color) => {
|
|
72
|
+
const {
|
|
73
|
+
onColorChanged
|
|
74
|
+
} = this.props;
|
|
75
|
+
const cType = `${fieldType}Color`;
|
|
76
76
|
onColorChanged(cType, color);
|
|
77
77
|
});
|
|
78
|
-
(0, _defineProperty2
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
dimensions
|
|
82
|
-
shapes
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
(0, _defineProperty2.default)(this, "handleOnUpdateImageDimensions", (value, resizeType) => {
|
|
79
|
+
const {
|
|
80
|
+
model: {
|
|
81
|
+
dimensions,
|
|
82
|
+
shapes
|
|
83
|
+
},
|
|
84
|
+
configuration: {
|
|
85
|
+
preserveAspectRatio = {}
|
|
86
|
+
},
|
|
87
|
+
onUpdateImageDimension,
|
|
88
|
+
onUpdateShapes
|
|
89
|
+
} = this.props;
|
|
90
|
+
const nextImageDimensions = {
|
|
91
|
+
...dimensions,
|
|
92
|
+
[resizeType]: value
|
|
93
|
+
};
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
// if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept
|
|
96
|
+
const updatedDimensions = (0, _utils.updateImageDimensions)(dimensions, nextImageDimensions, preserveAspectRatio.enabled, resizeType);
|
|
97
|
+
// transform shapes map into shapes array
|
|
98
|
+
const shapesArray = (0, _utils.getAllShapes)(shapes);
|
|
99
|
+
// transform all the shapes to fit the re-sized image
|
|
100
|
+
const updatedShapes = (0, _utils.getUpdatedShapes)(dimensions, updatedDimensions, shapesArray);
|
|
101
|
+
// transform shapes array back into shapes map
|
|
96
102
|
|
|
97
103
|
onUpdateShapes((0, _utils.groupShapes)(updatedShapes));
|
|
98
104
|
onUpdateImageDimension(updatedDimensions);
|
|
99
105
|
});
|
|
100
|
-
return _this;
|
|
101
106
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
187
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
188
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
189
|
-
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
var getPluginProps = function getPluginProps() {
|
|
193
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
194
|
-
return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
198
|
-
extraCSSRules: extraCSSRules,
|
|
199
|
-
dimensions: contentDimensions,
|
|
200
|
-
hideSettings: settingsPanelDisabled,
|
|
201
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
202
|
-
model: model,
|
|
203
|
-
onChangeModel: onModelChangedByConfig,
|
|
204
|
-
configuration: configuration,
|
|
205
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
206
|
-
groups: {
|
|
207
|
-
Settings: panelSettings,
|
|
208
|
-
Properties: panelProperties
|
|
209
|
-
}
|
|
210
|
-
})
|
|
211
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
212
|
-
label: teacherInstructions.label,
|
|
213
|
-
className: classes.promptContainer
|
|
214
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
215
|
-
markup: model.teacherInstructions || '',
|
|
216
|
-
onChange: onTeacherInstructionsChanged,
|
|
217
|
-
imageSupport: imageSupport,
|
|
218
|
-
nonEmpty: false,
|
|
219
|
-
error: teacherInstructionsError,
|
|
220
|
-
toolbarOpts: toolbarOpts,
|
|
221
|
-
pluginProps: getPluginProps(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration),
|
|
222
|
-
spellCheck: spellCheckEnabled,
|
|
223
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
224
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
225
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
226
|
-
languageCharactersProps: [{
|
|
227
|
-
language: 'spanish'
|
|
228
|
-
}, {
|
|
229
|
-
language: 'special'
|
|
230
|
-
}],
|
|
231
|
-
mathMlOptions: mathMlOptions
|
|
232
|
-
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
233
|
-
className: classes.errorText
|
|
234
|
-
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
235
|
-
label: prompt.label,
|
|
236
|
-
className: classes.promptContainer
|
|
237
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
238
|
-
markup: model.prompt || '',
|
|
239
|
-
onChange: onPromptChanged,
|
|
240
|
-
imageSupport: imageSupport,
|
|
241
|
-
nonEmpty: false,
|
|
242
|
-
error: promptError,
|
|
243
|
-
toolbarOpts: toolbarOpts,
|
|
244
|
-
pluginProps: getPluginProps(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration),
|
|
245
|
-
spellCheck: spellCheckEnabled,
|
|
246
|
-
maxImageWidth: defaultImageMaxWidth,
|
|
247
|
-
maxImageHeight: defaultImageMaxHeight,
|
|
248
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
249
|
-
languageCharactersProps: [{
|
|
250
|
-
language: 'spanish'
|
|
251
|
-
}, {
|
|
252
|
-
language: 'special'
|
|
253
|
-
}],
|
|
254
|
-
mathMlOptions: mathMlOptions
|
|
255
|
-
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
256
|
-
className: classes.errorText
|
|
257
|
-
}, promptError)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
258
|
-
className: classes.flexContainer
|
|
259
|
-
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
260
|
-
className: classes.subheading,
|
|
261
|
-
variant: "subheading"
|
|
262
|
-
}, "Define Hotspot"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
263
|
-
classes: {
|
|
264
|
-
tooltip: classes.tooltip
|
|
265
|
-
},
|
|
266
|
-
disableFocusListener: true,
|
|
267
|
-
disableTouchListener: true,
|
|
268
|
-
placement: 'left',
|
|
269
|
-
title: validationMessage
|
|
270
|
-
}, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
|
|
271
|
-
fontSize: 'small',
|
|
272
|
-
color: 'primary',
|
|
273
|
-
style: {
|
|
274
|
-
"float": 'right'
|
|
275
|
-
}
|
|
276
|
-
}))), /*#__PURE__*/_react["default"].createElement(_hotspotPalette["default"], {
|
|
277
|
-
hotspotColor: model.hotspotColor,
|
|
278
|
-
hotspotList: model.hotspotList,
|
|
279
|
-
outlineColor: model.outlineColor,
|
|
280
|
-
outlineList: model.outlineList,
|
|
281
|
-
onHotspotColorChange: function onHotspotColorChange(color) {
|
|
282
|
-
return _this2.handleColorChange('hotspot', color);
|
|
283
|
-
},
|
|
284
|
-
onOutlineColorChange: function onOutlineColorChange(color) {
|
|
285
|
-
return _this2.handleColorChange('outline', color);
|
|
107
|
+
render() {
|
|
108
|
+
const {
|
|
109
|
+
configuration,
|
|
110
|
+
model,
|
|
111
|
+
imageSupport,
|
|
112
|
+
uploadSoundSupport,
|
|
113
|
+
onConfigurationChanged,
|
|
114
|
+
onImageUpload,
|
|
115
|
+
onModelChangedByConfig,
|
|
116
|
+
onPromptChanged,
|
|
117
|
+
onRationaleChanged,
|
|
118
|
+
onUpdateImageDimension,
|
|
119
|
+
onTeacherInstructionsChanged,
|
|
120
|
+
onUpdateShapes
|
|
121
|
+
} = this.props;
|
|
122
|
+
const {
|
|
123
|
+
baseInputConfiguration = {},
|
|
124
|
+
contentDimensions = {},
|
|
125
|
+
maxImageWidth = {},
|
|
126
|
+
maxImageHeight = {},
|
|
127
|
+
multipleCorrect = {},
|
|
128
|
+
partialScoring = {},
|
|
129
|
+
preserveAspectRatio = {},
|
|
130
|
+
prompt = {},
|
|
131
|
+
rationale = {},
|
|
132
|
+
settingsPanelDisabled,
|
|
133
|
+
spellCheck = {},
|
|
134
|
+
teacherInstructions = {},
|
|
135
|
+
withRubric = {},
|
|
136
|
+
mathMlOptions = {},
|
|
137
|
+
language = {},
|
|
138
|
+
languageChoices = {}
|
|
139
|
+
} = configuration || {};
|
|
140
|
+
const {
|
|
141
|
+
errors,
|
|
142
|
+
extraCSSRules,
|
|
143
|
+
promptEnabled,
|
|
144
|
+
rationaleEnabled,
|
|
145
|
+
spellCheckEnabled,
|
|
146
|
+
teacherInstructionsEnabled,
|
|
147
|
+
toolbarEditorPosition
|
|
148
|
+
} = model || {};
|
|
149
|
+
const {
|
|
150
|
+
prompt: promptError,
|
|
151
|
+
rationale: rationaleError,
|
|
152
|
+
shapes: shapesError,
|
|
153
|
+
selections: selectionsError,
|
|
154
|
+
teacherInstructions: teacherInstructionsError
|
|
155
|
+
} = errors || {};
|
|
156
|
+
const validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
157
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
158
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
159
|
+
const toolbarOpts = {
|
|
160
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
161
|
+
};
|
|
162
|
+
const panelSettings = {
|
|
163
|
+
multipleCorrect: multipleCorrect.settings && toggle(multipleCorrect.label),
|
|
164
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
165
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
166
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
167
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
168
|
+
};
|
|
169
|
+
const panelProperties = {
|
|
170
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
171
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
172
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
173
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
|
|
174
|
+
};
|
|
175
|
+
const getPluginProps = (props = {}) => ({
|
|
176
|
+
...baseInputConfiguration,
|
|
177
|
+
...props
|
|
178
|
+
});
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
180
|
+
extraCSSRules: extraCSSRules,
|
|
181
|
+
dimensions: contentDimensions,
|
|
182
|
+
hideSettings: settingsPanelDisabled,
|
|
183
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
184
|
+
model: model,
|
|
185
|
+
onChangeModel: onModelChangedByConfig,
|
|
186
|
+
configuration: configuration,
|
|
187
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
188
|
+
groups: {
|
|
189
|
+
Settings: panelSettings,
|
|
190
|
+
Properties: panelProperties
|
|
286
191
|
}
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
192
|
+
})
|
|
193
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
|
|
194
|
+
label: teacherInstructions.label
|
|
195
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
196
|
+
markup: model.teacherInstructions || '',
|
|
197
|
+
onChange: onTeacherInstructionsChanged,
|
|
198
|
+
imageSupport: imageSupport,
|
|
199
|
+
nonEmpty: false,
|
|
200
|
+
error: teacherInstructionsError,
|
|
201
|
+
toolbarOpts: toolbarOpts,
|
|
202
|
+
pluginProps: getPluginProps(teacherInstructions?.inputConfiguration),
|
|
203
|
+
spellCheck: spellCheckEnabled,
|
|
204
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
205
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
206
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
207
|
+
languageCharactersProps: [{
|
|
208
|
+
language: 'spanish'
|
|
209
|
+
}, {
|
|
210
|
+
language: 'special'
|
|
211
|
+
}],
|
|
212
|
+
mathMlOptions: mathMlOptions
|
|
213
|
+
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
|
|
214
|
+
label: prompt.label
|
|
215
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
216
|
+
markup: model.prompt || '',
|
|
217
|
+
onChange: onPromptChanged,
|
|
218
|
+
imageSupport: imageSupport,
|
|
219
|
+
nonEmpty: false,
|
|
220
|
+
error: promptError,
|
|
221
|
+
toolbarOpts: toolbarOpts,
|
|
222
|
+
pluginProps: getPluginProps(prompt?.inputConfiguration),
|
|
223
|
+
spellCheck: spellCheckEnabled,
|
|
224
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
225
|
+
maxImageHeight: defaultImageMaxHeight,
|
|
226
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
227
|
+
languageCharactersProps: [{
|
|
228
|
+
language: 'spanish'
|
|
229
|
+
}, {
|
|
230
|
+
language: 'special'
|
|
231
|
+
}],
|
|
232
|
+
mathMlOptions: mathMlOptions
|
|
233
|
+
}), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), /*#__PURE__*/_react.default.createElement(FlexContainer, null, /*#__PURE__*/_react.default.createElement(SubHeading, {
|
|
234
|
+
variant: "h6"
|
|
235
|
+
}, "Define Hotspot"), /*#__PURE__*/_react.default.createElement(StyledTooltip, {
|
|
236
|
+
disableFocusListener: true,
|
|
237
|
+
disableTouchListener: true,
|
|
238
|
+
placement: 'left',
|
|
239
|
+
title: validationMessage
|
|
240
|
+
}, /*#__PURE__*/_react.default.createElement(_Info.default, {
|
|
241
|
+
fontSize: 'small',
|
|
242
|
+
color: 'primary',
|
|
243
|
+
style: {
|
|
244
|
+
float: 'right'
|
|
245
|
+
}
|
|
246
|
+
}))), /*#__PURE__*/_react.default.createElement(_hotspotPalette.default, {
|
|
247
|
+
hotspotColor: model.hotspotColor,
|
|
248
|
+
hotspotList: model.hotspotList,
|
|
249
|
+
outlineColor: model.outlineColor,
|
|
250
|
+
outlineList: model.outlineList,
|
|
251
|
+
onHotspotColorChange: color => this.handleColorChange('hotspot', color),
|
|
252
|
+
onOutlineColorChange: color => this.handleColorChange('outline', color)
|
|
253
|
+
}), /*#__PURE__*/_react.default.createElement(_hotspotContainer.default, {
|
|
254
|
+
dimensions: model.dimensions,
|
|
255
|
+
imageUrl: model.imageUrl,
|
|
256
|
+
multipleCorrect: model.multipleCorrect,
|
|
257
|
+
hasErrors: !!shapesError || !!selectionsError,
|
|
258
|
+
hotspotColor: model.hotspotColor,
|
|
259
|
+
outlineColor: model.outlineColor,
|
|
260
|
+
selectedHotspotColor: model.selectedHotspotColor,
|
|
261
|
+
hoverOutlineColor: model.hoverOutlineColor,
|
|
262
|
+
onUpdateImageDimension: onUpdateImageDimension,
|
|
263
|
+
onUpdateShapes: onUpdateShapes,
|
|
264
|
+
onImageUpload: onImageUpload,
|
|
265
|
+
shapes: model.shapes,
|
|
266
|
+
strokeWidth: model.strokeWidth,
|
|
267
|
+
preserveAspectRatioEnabled: preserveAspectRatio.enabled,
|
|
268
|
+
insertImage: imageSupport && imageSupport.add
|
|
269
|
+
}), shapesError && /*#__PURE__*/_react.default.createElement(ErrorText, null, shapesError), selectionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, selectionsError), model.imageUrl && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
270
|
+
variant: "h6"
|
|
271
|
+
}, "Image Dimensions"), /*#__PURE__*/_react.default.createElement(DimensionsContainer, null, /*#__PURE__*/_react.default.createElement(FieldContainer, null, /*#__PURE__*/_react.default.createElement(_configUi.NumberTextField, {
|
|
272
|
+
key: "hotspot-manual-width",
|
|
273
|
+
label: "Width",
|
|
274
|
+
value: model.dimensions.width,
|
|
275
|
+
min: 0,
|
|
276
|
+
onChange: (e, value) => this.handleOnUpdateImageDimensions(value, 'width'),
|
|
277
|
+
showErrorWhenOutsideRange: true
|
|
278
|
+
})), /*#__PURE__*/_react.default.createElement(FieldContainer, null, /*#__PURE__*/_react.default.createElement(_configUi.NumberTextField, {
|
|
279
|
+
key: "hotspot-manual-height",
|
|
280
|
+
label: "Height",
|
|
281
|
+
value: model.dimensions.height,
|
|
282
|
+
min: 0,
|
|
283
|
+
onChange: (e, value) => this.handleOnUpdateImageDimensions(value, 'height'),
|
|
284
|
+
showErrorWhenOutsideRange: true
|
|
285
|
+
})))), rationaleEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
|
|
286
|
+
label: rationale.label
|
|
287
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
288
|
+
markup: model.rationale || '',
|
|
289
|
+
onChange: onRationaleChanged,
|
|
290
|
+
imageSupport: imageSupport,
|
|
291
|
+
error: rationaleError,
|
|
292
|
+
toolbarOpts: toolbarOpts,
|
|
293
|
+
pluginProps: getPluginProps(rationale?.inputConfiguration),
|
|
294
|
+
spellCheck: spellCheckEnabled,
|
|
295
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
296
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
297
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
298
|
+
languageCharactersProps: [{
|
|
299
|
+
language: 'spanish'
|
|
300
|
+
}, {
|
|
301
|
+
language: 'special'
|
|
302
|
+
}],
|
|
303
|
+
mathMlOptions: mathMlOptions
|
|
304
|
+
}), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
359
307
|
exports.Root = Root;
|
|
360
|
-
|
|
361
|
-
var styles = function styles(theme) {
|
|
362
|
-
return {
|
|
363
|
-
dimensions: {
|
|
364
|
-
display: 'flex',
|
|
365
|
-
marginBottom: theme.spacing.unit * 1.5
|
|
366
|
-
},
|
|
367
|
-
field: {
|
|
368
|
-
flex: 1,
|
|
369
|
-
width: '90%'
|
|
370
|
-
},
|
|
371
|
-
promptContainer: {
|
|
372
|
-
paddingTop: theme.spacing.unit * 2,
|
|
373
|
-
marginBottom: theme.spacing.unit * 2,
|
|
374
|
-
width: '100%'
|
|
375
|
-
},
|
|
376
|
-
subheading: {
|
|
377
|
-
marginRight: theme.spacing.unit
|
|
378
|
-
},
|
|
379
|
-
flexContainer: {
|
|
380
|
-
display: 'flex',
|
|
381
|
-
alignItems: 'center'
|
|
382
|
-
},
|
|
383
|
-
tooltip: {
|
|
384
|
-
fontSize: theme.typography.fontSize - 2,
|
|
385
|
-
whiteSpace: 'pre',
|
|
386
|
-
maxWidth: '500px'
|
|
387
|
-
},
|
|
388
|
-
errorText: {
|
|
389
|
-
fontSize: theme.typography.fontSize - 2,
|
|
390
|
-
color: theme.palette.error.main,
|
|
391
|
-
paddingTop: theme.spacing.unit
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
};
|
|
395
|
-
|
|
396
308
|
Root.propTypes = {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
"delete": _propTypes["default"].func
|
|
309
|
+
configuration: _propTypes.default.object,
|
|
310
|
+
model: _propTypes.default.object.isRequired,
|
|
311
|
+
imageSupport: _propTypes.default.shape({
|
|
312
|
+
add: _propTypes.default.func,
|
|
313
|
+
delete: _propTypes.default.func
|
|
403
314
|
}),
|
|
404
|
-
uploadSoundSupport: _propTypes
|
|
405
|
-
add: _propTypes
|
|
406
|
-
|
|
315
|
+
uploadSoundSupport: _propTypes.default.shape({
|
|
316
|
+
add: _propTypes.default.func,
|
|
317
|
+
delete: _propTypes.default.func
|
|
407
318
|
}),
|
|
408
|
-
onImageUpload: _propTypes
|
|
409
|
-
onColorChanged: _propTypes
|
|
410
|
-
onPromptChanged: _propTypes
|
|
411
|
-
onUpdateImageDimension: _propTypes
|
|
412
|
-
onUpdateShapes: _propTypes
|
|
413
|
-
onModelChangedByConfig: _propTypes
|
|
414
|
-
onRationaleChanged: _propTypes
|
|
415
|
-
onConfigurationChanged: _propTypes
|
|
416
|
-
onTeacherInstructionsChanged: _propTypes
|
|
319
|
+
onImageUpload: _propTypes.default.func.isRequired,
|
|
320
|
+
onColorChanged: _propTypes.default.func.isRequired,
|
|
321
|
+
onPromptChanged: _propTypes.default.func.isRequired,
|
|
322
|
+
onUpdateImageDimension: _propTypes.default.func.isRequired,
|
|
323
|
+
onUpdateShapes: _propTypes.default.func.isRequired,
|
|
324
|
+
onModelChangedByConfig: _propTypes.default.func.isRequired,
|
|
325
|
+
onRationaleChanged: _propTypes.default.func.isRequired,
|
|
326
|
+
onConfigurationChanged: _propTypes.default.func.isRequired,
|
|
327
|
+
onTeacherInstructionsChanged: _propTypes.default.func.isRequired
|
|
417
328
|
};
|
|
418
|
-
|
|
419
|
-
var _default = (0, _styles.withStyles)(styles)(Root);
|
|
420
|
-
|
|
421
|
-
exports["default"] = _default;
|
|
329
|
+
var _default = exports.default = Root;
|
|
422
330
|
//# sourceMappingURL=root.js.map
|