@pie-lib/config-ui 11.30.2-next.0 → 11.31.0-mui-update.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/CHANGELOG.md +23 -8
- package/lib/alert-dialog.js +35 -42
- package/lib/alert-dialog.js.map +1 -1
- package/lib/checkbox.js +56 -71
- package/lib/checkbox.js.map +1 -1
- package/lib/choice-configuration/feedback-menu.js +29 -64
- package/lib/choice-configuration/feedback-menu.js.map +1 -1
- package/lib/choice-configuration/index.js +202 -260
- package/lib/choice-configuration/index.js.map +1 -1
- package/lib/choice-utils.js +6 -18
- package/lib/choice-utils.js.map +1 -1
- package/lib/feedback-config/feedback-selector.js +77 -114
- package/lib/feedback-config/feedback-selector.js.map +1 -1
- package/lib/feedback-config/group.js +26 -40
- package/lib/feedback-config/group.js.map +1 -1
- package/lib/feedback-config/index.js +38 -90
- package/lib/feedback-config/index.js.map +1 -1
- package/lib/form-section.js +24 -33
- package/lib/form-section.js.map +1 -1
- package/lib/help.js +39 -80
- package/lib/help.js.map +1 -1
- package/lib/index.js +1 -31
- package/lib/index.js.map +1 -1
- package/lib/input.js +21 -54
- package/lib/input.js.map +1 -1
- package/lib/inputs.js +61 -95
- package/lib/inputs.js.map +1 -1
- package/lib/langs.js +56 -100
- package/lib/langs.js.map +1 -1
- package/lib/layout/config-layout.js +61 -99
- package/lib/layout/config-layout.js.map +1 -1
- package/lib/layout/index.js +0 -3
- package/lib/layout/index.js.map +1 -1
- package/lib/layout/layout-contents.js +71 -101
- package/lib/layout/layout-contents.js.map +1 -1
- package/lib/layout/settings-box.js +27 -56
- package/lib/layout/settings-box.js.map +1 -1
- package/lib/mui-box/index.js +41 -57
- package/lib/mui-box/index.js.map +1 -1
- package/lib/number-text-field-custom.js +79 -161
- package/lib/number-text-field-custom.js.map +1 -1
- package/lib/number-text-field.js +57 -115
- package/lib/number-text-field.js.map +1 -1
- package/lib/radio-with-label.js +23 -31
- package/lib/radio-with-label.js.map +1 -1
- package/lib/settings/display-size.js +16 -32
- package/lib/settings/display-size.js.map +1 -1
- package/lib/settings/index.js +14 -47
- package/lib/settings/index.js.map +1 -1
- package/lib/settings/panel.js +151 -229
- package/lib/settings/panel.js.map +1 -1
- package/lib/settings/settings-radio-label.js +21 -30
- package/lib/settings/settings-radio-label.js.map +1 -1
- package/lib/settings/toggle.js +34 -46
- package/lib/settings/toggle.js.map +1 -1
- package/lib/tabs/index.js +22 -57
- package/lib/tabs/index.js.map +1 -1
- package/lib/tags-input/index.js +50 -99
- package/lib/tags-input/index.js.map +1 -1
- package/lib/two-choice.js +46 -90
- package/lib/two-choice.js.map +1 -1
- package/lib/with-stateful-model.js +8 -31
- package/lib/with-stateful-model.js.map +1 -1
- package/package.json +12 -10
- package/src/__tests__/number-text-field.test.jsx +1 -1
- package/src/alert-dialog.jsx +21 -19
- package/src/checkbox.jsx +42 -46
- package/src/choice-configuration/feedback-menu.jsx +6 -6
- package/src/choice-configuration/index.jsx +202 -195
- package/src/feedback-config/feedback-selector.jsx +51 -53
- package/src/feedback-config/group.jsx +21 -22
- package/src/feedback-config/index.jsx +27 -29
- package/src/form-section.jsx +18 -18
- package/src/help.jsx +20 -28
- package/src/input.jsx +1 -1
- package/src/inputs.jsx +34 -50
- package/src/langs.jsx +40 -46
- package/src/layout/config-layout.jsx +38 -36
- package/src/layout/layout-contents.jsx +34 -35
- package/src/layout/settings-box.jsx +16 -19
- package/src/mui-box/index.jsx +35 -43
- package/src/number-text-field-custom.jsx +30 -36
- package/src/number-text-field.jsx +22 -30
- package/src/radio-with-label.jsx +17 -13
- package/src/settings/display-size.jsx +12 -11
- package/src/settings/panel.jsx +86 -89
- package/src/settings/settings-radio-label.jsx +17 -13
- package/src/settings/toggle.jsx +29 -29
- package/src/tabs/index.jsx +8 -8
- package/src/tags-input/index.jsx +35 -38
- package/src/two-choice.jsx +15 -19
|
@@ -1,117 +1,179 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
import TextField from '@material
|
|
5
|
-
import ActionDelete from '@
|
|
6
|
-
import ArrowRight from '@
|
|
7
|
-
import IconButton from '@material
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import TextField from '@mui/material/TextField';
|
|
5
|
+
import ActionDelete from '@mui/icons-material/Delete';
|
|
6
|
+
import ArrowRight from '@mui/icons-material/SubdirectoryArrowRight';
|
|
7
|
+
import IconButton from '@mui/material/IconButton';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { InputContainer } from '@pie-lib/render-ui';
|
|
10
|
-
import EditableHtml from '@pie-lib/editable-html';
|
|
10
|
+
// import EditableHtml from '@pie-lib/editable-html';
|
|
11
11
|
import { InputCheckbox, InputRadio } from '../inputs';
|
|
12
12
|
import FeedbackMenu from './feedback-menu';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}))(
|
|
20
|
-
({
|
|
21
|
-
label,
|
|
22
|
-
classes,
|
|
23
|
-
onChange,
|
|
24
|
-
value,
|
|
25
|
-
className,
|
|
26
|
-
imageSupport,
|
|
27
|
-
disableImageAlignmentButtons,
|
|
28
|
-
disabled,
|
|
29
|
-
spellCheck,
|
|
30
|
-
nonEmpty,
|
|
31
|
-
pluginOpts,
|
|
32
|
-
toolbarOpts,
|
|
33
|
-
error,
|
|
34
|
-
maxImageWidth,
|
|
35
|
-
maxImageHeight,
|
|
36
|
-
uploadSoundSupport,
|
|
37
|
-
mathMlOptions = {},
|
|
38
|
-
}) => {
|
|
39
|
-
const names = classNames(classes.labelContainer, className);
|
|
14
|
+
// - mathquill error window not defined
|
|
15
|
+
let EditableHtml;
|
|
16
|
+
if (typeof window !== 'undefined') {
|
|
17
|
+
EditableHtml = require('@pie-lib/editable-html')['default'];
|
|
18
|
+
}
|
|
40
19
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
20
|
+
const StyledEditorHolder = styled('div')(({ theme }) => ({
|
|
21
|
+
marginTop: theme.spacing(2),
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
const EditableHtmlContainer = ({
|
|
25
|
+
label,
|
|
26
|
+
onChange,
|
|
27
|
+
value,
|
|
28
|
+
className,
|
|
29
|
+
imageSupport,
|
|
30
|
+
disableImageAlignmentButtons,
|
|
31
|
+
disabled,
|
|
32
|
+
spellCheck,
|
|
33
|
+
nonEmpty,
|
|
34
|
+
pluginOpts,
|
|
35
|
+
toolbarOpts,
|
|
36
|
+
error,
|
|
37
|
+
maxImageWidth,
|
|
38
|
+
maxImageHeight,
|
|
39
|
+
uploadSoundSupport,
|
|
40
|
+
mathMlOptions = {},
|
|
41
|
+
}) => {
|
|
42
|
+
const names = classNames(className);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<InputContainer label={label} className={names}>
|
|
46
|
+
<StyledEditorHolder>
|
|
47
|
+
<EditableHtml
|
|
48
|
+
markup={value || ''}
|
|
49
|
+
disabled={disabled}
|
|
50
|
+
spellCheck={spellCheck}
|
|
51
|
+
nonEmpty={nonEmpty}
|
|
52
|
+
onChange={onChange}
|
|
53
|
+
imageSupport={imageSupport}
|
|
54
|
+
disableImageAlignmentButtons={disableImageAlignmentButtons}
|
|
55
|
+
pluginProps={pluginOpts || {}}
|
|
56
|
+
toolbarOpts={toolbarOpts}
|
|
57
|
+
error={error}
|
|
58
|
+
maxImageWidth={maxImageWidth}
|
|
59
|
+
maxImageHeight={maxImageHeight}
|
|
60
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
61
|
+
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
62
|
+
mathMlOptions={mathMlOptions}
|
|
63
|
+
/>
|
|
64
|
+
</StyledEditorHolder>
|
|
65
|
+
</InputContainer>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const StyledFeedbackContainer = styled('div')(() => ({
|
|
70
|
+
position: 'relative',
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
const StyledArrowIcon = styled(ArrowRight)(({ theme }) => ({
|
|
74
|
+
fill: theme.palette.grey[400],
|
|
75
|
+
left: -56,
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
top: 40,
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
const StyledTextField = styled(TextField)(({ theme }) => ({
|
|
81
|
+
width: '100%',
|
|
82
|
+
marginTop: theme.spacing(2),
|
|
83
|
+
}));
|
|
84
|
+
|
|
85
|
+
const StyledEditableHtmlContainer = styled(EditableHtmlContainer)(({ theme }) => ({
|
|
86
|
+
width: '100%',
|
|
87
|
+
marginTop: theme.spacing(2),
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
const Feedback = ({ value, onChange, type, correct, defaults, toolbarOpts, mathMlOptions = {} }) => {
|
|
82
91
|
if (!type || type === 'none') {
|
|
83
92
|
return null;
|
|
84
93
|
} else if (type === 'default') {
|
|
85
94
|
return (
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
className={classes.text}
|
|
95
|
+
<StyledFeedbackContainer>
|
|
96
|
+
<StyledArrowIcon />
|
|
97
|
+
<StyledTextField
|
|
90
98
|
label="Feedback Text"
|
|
91
99
|
value={correct ? defaults.correct : defaults.incorrect}
|
|
100
|
+
variant="standard"
|
|
92
101
|
/>
|
|
93
|
-
</
|
|
102
|
+
</StyledFeedbackContainer>
|
|
94
103
|
);
|
|
95
104
|
} else {
|
|
96
105
|
return (
|
|
97
|
-
<
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
className={classes.text}
|
|
106
|
+
<StyledFeedbackContainer>
|
|
107
|
+
<StyledArrowIcon />
|
|
108
|
+
<StyledEditableHtmlContainer
|
|
101
109
|
label="Feedback Text"
|
|
102
110
|
value={value}
|
|
103
111
|
onChange={onChange}
|
|
104
112
|
toolbarOpts={toolbarOpts}
|
|
105
113
|
mathMlOptions={mathMlOptions}
|
|
106
114
|
/>
|
|
107
|
-
</
|
|
115
|
+
</StyledFeedbackContainer>
|
|
108
116
|
);
|
|
109
117
|
}
|
|
110
|
-
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const StyledIndex = styled('span')(({ theme }) => ({
|
|
121
|
+
paddingRight: theme.spacing(1),
|
|
122
|
+
paddingTop: theme.spacing(3),
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
const StyledTopRow = styled('div')(() => ({
|
|
126
|
+
display: 'flex',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
const StyledToggle = styled('div')(({ theme }) => ({
|
|
131
|
+
flex: '0 1 auto',
|
|
132
|
+
paddingTop: theme.spacing(0.5),
|
|
133
|
+
paddingBottom: 0,
|
|
134
|
+
marginRight: 0,
|
|
135
|
+
marginLeft: theme.spacing(1),
|
|
136
|
+
}));
|
|
137
|
+
|
|
138
|
+
const StyledFeedback = styled('div')(({ theme }) => ({
|
|
139
|
+
flex: '0 1 auto',
|
|
140
|
+
paddingTop: theme.spacing(2),
|
|
141
|
+
paddingLeft: 0,
|
|
142
|
+
marginLeft: 0,
|
|
143
|
+
marginRight: theme.spacing(1),
|
|
144
|
+
}));
|
|
145
|
+
|
|
146
|
+
const StyledFeedbackIcon = styled('div')(() => ({
|
|
147
|
+
margin: 0,
|
|
148
|
+
width: 'inherit',
|
|
149
|
+
}));
|
|
150
|
+
|
|
151
|
+
const StyledDeleteIcon = styled('div')(() => ({
|
|
152
|
+
margin: 0,
|
|
153
|
+
width: 'inherit',
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
const StyledDelete = styled('div')(({ theme }) => ({
|
|
157
|
+
flex: '0 1 auto',
|
|
158
|
+
paddingTop: theme.spacing(2),
|
|
159
|
+
paddingLeft: 0,
|
|
160
|
+
marginLeft: 0,
|
|
161
|
+
}));
|
|
162
|
+
|
|
163
|
+
const StyledMiddleColumn = styled('div')(({ theme }) => ({
|
|
164
|
+
display: 'flex',
|
|
165
|
+
flex: 1,
|
|
166
|
+
flexDirection: 'column',
|
|
167
|
+
marginRight: theme.spacing(1),
|
|
168
|
+
}));
|
|
169
|
+
|
|
170
|
+
const StyledErrorText = styled('div')(({ theme }) => ({
|
|
171
|
+
fontSize: theme.typography.fontSize - 2,
|
|
172
|
+
color: theme.palette.error.main,
|
|
173
|
+
}));
|
|
111
174
|
|
|
112
175
|
export class ChoiceConfiguration extends React.Component {
|
|
113
176
|
static propTypes = {
|
|
114
|
-
classes: PropTypes.object.isRequired,
|
|
115
177
|
noLabels: PropTypes.bool,
|
|
116
178
|
useLetterOrdering: PropTypes.bool,
|
|
117
179
|
className: PropTypes.string,
|
|
@@ -201,7 +263,6 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
201
263
|
render() {
|
|
202
264
|
const {
|
|
203
265
|
data,
|
|
204
|
-
classes,
|
|
205
266
|
mode,
|
|
206
267
|
onDelete,
|
|
207
268
|
defaultFeedback,
|
|
@@ -227,45 +288,43 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
227
288
|
} = this.props;
|
|
228
289
|
|
|
229
290
|
const InputToggle = mode === 'checkbox' ? InputCheckbox : InputRadio;
|
|
230
|
-
const names = classNames(classes.choiceConfiguration, className);
|
|
231
291
|
|
|
232
292
|
return (
|
|
233
|
-
|
|
234
|
-
<div className={classes.topRow}>
|
|
293
|
+
<StyledTopRow>
|
|
235
294
|
{index > 0 && (
|
|
236
|
-
<
|
|
295
|
+
<StyledIndex type="title">
|
|
237
296
|
{useLetterOrdering ? String.fromCharCode(96 + index).toUpperCase() : index}
|
|
238
|
-
</
|
|
297
|
+
</StyledIndex>
|
|
239
298
|
)}
|
|
240
299
|
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
/>
|
|
248
|
-
|
|
249
|
-
<div className={classes.middleColumn}>
|
|
250
|
-
<EditableHtmlContainer
|
|
251
|
-
className={classes.input}
|
|
252
|
-
label={!noLabels ? 'Label' : ''}
|
|
253
|
-
value={data.label}
|
|
254
|
-
onChange={this.onLabelChange}
|
|
255
|
-
imageSupport={imageSupport}
|
|
256
|
-
disableImageAlignmentButtons={disableImageAlignmentButtons}
|
|
257
|
-
disabled={disabled}
|
|
258
|
-
spellCheck={spellCheck}
|
|
259
|
-
nonEmpty={nonEmpty}
|
|
260
|
-
pluginOpts={pluginOpts}
|
|
261
|
-
toolbarOpts={toolbarOpts}
|
|
262
|
-
error={error}
|
|
263
|
-
uploadSoundSupport={uploadSoundSupport}
|
|
264
|
-
mathMlOptions={mathMlOptions}
|
|
265
|
-
maxImageWidth={maxImageWidth}
|
|
266
|
-
maxImageHeight={maxImageHeight}
|
|
300
|
+
<StyledToggle>
|
|
301
|
+
<InputToggle
|
|
302
|
+
onChange={this.onCheckedChange}
|
|
303
|
+
label={!noLabels ? 'Correct' : ''}
|
|
304
|
+
checked={!!data.correct}
|
|
305
|
+
error={noCorrectAnswerError}
|
|
267
306
|
/>
|
|
268
|
-
|
|
307
|
+
</StyledToggle>
|
|
308
|
+
|
|
309
|
+
<StyledMiddleColumn>
|
|
310
|
+
<EditableHtmlContainer
|
|
311
|
+
label={!noLabels ? 'Label' : ''}
|
|
312
|
+
value={data.label}
|
|
313
|
+
onChange={this.onLabelChange}
|
|
314
|
+
imageSupport={imageSupport}
|
|
315
|
+
disableImageAlignmentButtons={disableImageAlignmentButtons}
|
|
316
|
+
disabled={disabled}
|
|
317
|
+
spellCheck={spellCheck}
|
|
318
|
+
nonEmpty={nonEmpty}
|
|
319
|
+
pluginOpts={pluginOpts}
|
|
320
|
+
toolbarOpts={toolbarOpts}
|
|
321
|
+
error={error}
|
|
322
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
323
|
+
mathMlOptions={mathMlOptions}
|
|
324
|
+
maxImageWidth={maxImageWidth}
|
|
325
|
+
maxImageHeight={maxImageHeight}
|
|
326
|
+
/>
|
|
327
|
+
{error && <StyledErrorText>{error}</StyledErrorText>}
|
|
269
328
|
|
|
270
329
|
{allowFeedBack && (
|
|
271
330
|
<Feedback
|
|
@@ -276,90 +335,38 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
276
335
|
toolbarOpts={toolbarOpts}
|
|
277
336
|
/>
|
|
278
337
|
)}
|
|
279
|
-
</
|
|
338
|
+
</StyledMiddleColumn>
|
|
280
339
|
|
|
281
340
|
{allowFeedBack && (
|
|
282
|
-
<
|
|
283
|
-
<
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
341
|
+
<StyledFeedback>
|
|
342
|
+
<InputContainer label={!noLabels ? 'Feedback' : ''}>
|
|
343
|
+
<StyledFeedbackIcon>
|
|
344
|
+
<FeedbackMenu
|
|
345
|
+
onChange={this.onFeedbackTypeChange}
|
|
346
|
+
value={data.feedback}
|
|
347
|
+
/>
|
|
348
|
+
</StyledFeedbackIcon>
|
|
349
|
+
</InputContainer>
|
|
350
|
+
</StyledFeedback>
|
|
291
351
|
)}
|
|
292
352
|
|
|
293
353
|
{allowDelete && (
|
|
294
|
-
<
|
|
295
|
-
<
|
|
296
|
-
<
|
|
297
|
-
|
|
298
|
-
|
|
354
|
+
<StyledDelete>
|
|
355
|
+
<InputContainer label={!noLabels ? 'Delete' : ''}>
|
|
356
|
+
<StyledDeleteIcon>
|
|
357
|
+
<IconButton
|
|
358
|
+
aria-label="delete"
|
|
359
|
+
onClick={onDelete}
|
|
360
|
+
size="large">
|
|
361
|
+
<ActionDelete />
|
|
362
|
+
</IconButton>
|
|
363
|
+
</StyledDeleteIcon>
|
|
364
|
+
</InputContainer>
|
|
365
|
+
</StyledDelete>
|
|
299
366
|
)}
|
|
300
|
-
</
|
|
301
|
-
</div>
|
|
367
|
+
</StyledTopRow>
|
|
302
368
|
);
|
|
303
369
|
}
|
|
304
370
|
}
|
|
305
371
|
|
|
306
|
-
|
|
307
|
-
index: {
|
|
308
|
-
paddingRight: theme.spacing.unit,
|
|
309
|
-
paddingTop: theme.spacing.unit * 3.5,
|
|
310
|
-
},
|
|
311
|
-
choiceConfiguration: {},
|
|
312
|
-
topRow: {
|
|
313
|
-
display: 'flex',
|
|
314
|
-
},
|
|
315
|
-
value: {
|
|
316
|
-
flex: '0.5',
|
|
317
|
-
paddingRight: theme.spacing.unit,
|
|
318
|
-
},
|
|
319
|
-
editorHolder: {
|
|
320
|
-
marginTop: theme.spacing.unit * 2,
|
|
321
|
-
},
|
|
322
|
-
toggle: {
|
|
323
|
-
flex: '0 1 auto',
|
|
324
|
-
paddingTop: theme.spacing.unit / 2,
|
|
325
|
-
paddingBottom: 0,
|
|
326
|
-
marginRight: 0,
|
|
327
|
-
marginLeft: theme.spacing.unit,
|
|
328
|
-
},
|
|
329
|
-
feedback: {
|
|
330
|
-
flex: '0 1 auto',
|
|
331
|
-
paddingTop: theme.spacing.unit * 2,
|
|
332
|
-
paddingLeft: 0,
|
|
333
|
-
marginLeft: 0,
|
|
334
|
-
marginRight: theme.spacing.unit,
|
|
335
|
-
},
|
|
336
|
-
feedbackIcon: {
|
|
337
|
-
margin: 0,
|
|
338
|
-
width: 'inherit',
|
|
339
|
-
},
|
|
340
|
-
deleteIcon: {
|
|
341
|
-
margin: 0,
|
|
342
|
-
width: 'inherit',
|
|
343
|
-
},
|
|
344
|
-
delete: {
|
|
345
|
-
flex: '0 1 auto',
|
|
346
|
-
paddingTop: theme.spacing.unit * 2,
|
|
347
|
-
paddingLeft: 0,
|
|
348
|
-
marginLeft: 0,
|
|
349
|
-
},
|
|
350
|
-
middleColumn: {
|
|
351
|
-
display: 'flex',
|
|
352
|
-
flex: 1,
|
|
353
|
-
flexDirection: 'column',
|
|
354
|
-
marginRight: theme.spacing.unit,
|
|
355
|
-
},
|
|
356
|
-
input: {
|
|
357
|
-
marginRight: 0,
|
|
358
|
-
},
|
|
359
|
-
errorText: {
|
|
360
|
-
fontSize: theme.typography.fontSize - 2,
|
|
361
|
-
color: theme.palette.error.main,
|
|
362
|
-
},
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
export default withStyles(styles)(ChoiceConfiguration);
|
|
372
|
+
export default ChoiceConfiguration;
|
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
import EditableHTML from '@pie-lib/editable-html';
|
|
1
|
+
//import EditableHTML from '@pie-lib/editable-html';
|
|
2
2
|
import { InputContainer } from '@pie-lib/render-ui';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
6
|
import Group from './group';
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
// - mathquill error window not defined
|
|
10
|
+
let EditableHtml;
|
|
11
|
+
let StyledEditableHTML;
|
|
12
|
+
if (typeof window !== 'undefined') {
|
|
13
|
+
EditableHtml = require('@pie-lib/editable-html')['default'];
|
|
14
|
+
StyledEditableHTML = styled(EditableHtml)(({ theme }) => ({
|
|
15
|
+
fontFamily: theme.typography.fontFamily,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
const feedbackLabels = {
|
|
9
20
|
default: 'Simple Feedback',
|
|
10
21
|
none: 'No Feedback',
|
|
11
22
|
custom: 'Customized Feedback',
|
|
12
23
|
};
|
|
13
24
|
|
|
14
|
-
const
|
|
25
|
+
const StyledFeedbackSelector = styled('div')(({ theme }) => ({
|
|
26
|
+
marginBottom: theme.spacing(1),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
const StyledInputContainer = styled(InputContainer)(() => ({
|
|
30
|
+
paddingBottom: 0,
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
const StyledCustomHolder = styled('div')(({ theme }) => ({
|
|
15
34
|
marginTop: '0px',
|
|
16
35
|
background: theme.palette.grey[300],
|
|
17
|
-
padding:
|
|
18
|
-
marginBottom: theme.spacing
|
|
36
|
+
padding: 0,
|
|
37
|
+
marginBottom: theme.spacing(2),
|
|
19
38
|
borderRadius: '4px',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
customHolder: holder(theme, {
|
|
37
|
-
background: theme.palette.grey[300],
|
|
38
|
-
padding: 0,
|
|
39
|
-
}),
|
|
40
|
-
defaultHolder: holder(theme, {
|
|
41
|
-
fontFamily: theme.typography.fontFamily,
|
|
42
|
-
padding: theme.spacing.unit * 2,
|
|
43
|
-
cursor: 'default',
|
|
44
|
-
}),
|
|
45
|
-
editor: {
|
|
46
|
-
fontFamily: theme.typography.fontFamily,
|
|
47
|
-
},
|
|
48
|
-
group: {
|
|
49
|
-
paddingTop: theme.spacing.unit,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
const StyledDefaultHolder = styled('div')(({ theme }) => ({
|
|
42
|
+
marginTop: '0px',
|
|
43
|
+
background: theme.palette.grey[300],
|
|
44
|
+
padding: theme.spacing(2),
|
|
45
|
+
marginBottom: theme.spacing(2),
|
|
46
|
+
borderRadius: '4px',
|
|
47
|
+
fontFamily: theme.typography.fontFamily,
|
|
48
|
+
cursor: 'default',
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
const StyledGroup = styled(Group)(({ theme }) => ({
|
|
52
|
+
paddingTop: theme.spacing(1),
|
|
53
|
+
}));
|
|
52
54
|
|
|
53
55
|
export const FeedbackType = {
|
|
54
56
|
type: PropTypes.oneOf(['default', 'custom', 'none']),
|
|
@@ -59,7 +61,6 @@ export const FeedbackType = {
|
|
|
59
61
|
export class FeedbackSelector extends React.Component {
|
|
60
62
|
static propTypes = {
|
|
61
63
|
keys: PropTypes.arrayOf(PropTypes.string),
|
|
62
|
-
classes: PropTypes.object.isRequired,
|
|
63
64
|
label: PropTypes.string.isRequired,
|
|
64
65
|
feedback: PropTypes.shape(FeedbackType).isRequired,
|
|
65
66
|
onChange: PropTypes.func.isRequired,
|
|
@@ -79,44 +80,41 @@ export class FeedbackSelector extends React.Component {
|
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
render() {
|
|
82
|
-
const { keys,
|
|
83
|
+
const { keys, label, feedback, toolbarOpts, mathMlOptions = {} } = this.props;
|
|
83
84
|
|
|
84
85
|
const feedbackKeys = keys || Object.keys(feedbackLabels);
|
|
85
86
|
|
|
86
87
|
return (
|
|
87
|
-
<
|
|
88
|
-
<
|
|
88
|
+
<StyledFeedbackSelector>
|
|
89
|
+
<StyledInputContainer
|
|
89
90
|
label={label}
|
|
90
|
-
|
|
91
|
-
extraClasses={{ label: classes.inputContainerLabel }}
|
|
91
|
+
extraClasses={{ label: { transform: 'translateY(-20%)' } }}
|
|
92
92
|
>
|
|
93
|
-
<
|
|
94
|
-
className={classes.group}
|
|
93
|
+
<StyledGroup
|
|
95
94
|
keys={feedbackKeys}
|
|
96
95
|
label={label}
|
|
97
96
|
value={feedback.type}
|
|
98
97
|
onChange={this.changeType}
|
|
99
98
|
feedbackLabels={feedbackLabels}
|
|
100
99
|
/>
|
|
101
|
-
</
|
|
100
|
+
</StyledInputContainer>
|
|
102
101
|
|
|
103
102
|
{feedback.type === 'custom' && (
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
className={classes.editor}
|
|
103
|
+
<StyledCustomHolder>
|
|
104
|
+
<StyledEditableHTML
|
|
107
105
|
onChange={this.changeCustom}
|
|
108
106
|
markup={feedback.custom || ''}
|
|
109
107
|
toolbarOpts={toolbarOpts}
|
|
110
108
|
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
111
109
|
mathMlOptions={mathMlOptions}
|
|
112
110
|
/>
|
|
113
|
-
</
|
|
111
|
+
</StyledCustomHolder>
|
|
114
112
|
)}
|
|
115
113
|
|
|
116
|
-
{feedback.type === 'default' && <
|
|
117
|
-
</
|
|
114
|
+
{feedback.type === 'default' && <StyledDefaultHolder> {feedback.default}</StyledDefaultHolder>}
|
|
115
|
+
</StyledFeedbackSelector>
|
|
118
116
|
);
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
export default
|
|
120
|
+
export default FeedbackSelector;
|