@pie-lib/config-ui 11.0.24-next.4 → 11.0.25
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 +16 -0
- package/lib/alert-dialog.js.map +1 -1
- package/lib/checkbox.js.map +1 -1
- package/lib/choice-configuration/feedback-menu.js.map +1 -1
- package/lib/choice-configuration/index.js.map +1 -1
- package/lib/choice-utils.js.map +1 -1
- package/lib/feedback-config/feedback-selector.js.map +1 -1
- package/lib/feedback-config/group.js.map +1 -1
- package/lib/feedback-config/index.js.map +1 -1
- package/lib/form-section.js.map +1 -1
- package/lib/help.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/input.js.map +1 -1
- package/lib/inputs.js.map +1 -1
- package/lib/langs.js.map +1 -1
- package/lib/layout/config-layout.js.map +1 -1
- package/lib/layout/layout-contents.js.map +1 -1
- package/lib/layout/settings-box.js.map +1 -1
- package/lib/mui-box/index.js.map +1 -1
- package/lib/number-text-field-custom.js.map +1 -1
- package/lib/number-text-field.js.map +1 -1
- package/lib/radio-with-label.js.map +1 -1
- package/lib/settings/display-size.js.map +1 -1
- package/lib/settings/index.js.map +1 -1
- package/lib/settings/panel.js.map +1 -1
- package/lib/settings/settings-radio-label.js.map +1 -1
- package/lib/settings/toggle.js.map +1 -1
- package/lib/tabs/index.js.map +1 -1
- package/lib/tags-input/index.js.map +1 -1
- package/lib/two-choice.js.map +1 -1
- package/lib/with-stateful-model.js.map +1 -1
- package/package.json +5 -5
- package/src/alert-dialog.jsx +2 -9
- package/src/checkbox.jsx +9 -9
- package/src/choice-configuration/feedback-menu.jsx +10 -20
- package/src/choice-configuration/index.jsx +33 -33
- package/src/choice-utils.js +1 -1
- package/src/feedback-config/feedback-selector.jsx +17 -19
- package/src/feedback-config/group.jsx +9 -9
- package/src/feedback-config/index.jsx +8 -8
- package/src/form-section.jsx +4 -4
- package/src/help.jsx +9 -13
- package/src/index.js +2 -5
- package/src/input.jsx +7 -7
- package/src/inputs.jsx +12 -17
- package/src/langs.jsx +24 -39
- package/src/layout/config-layout.jsx +6 -12
- package/src/layout/layout-contents.jsx +7 -11
- package/src/layout/settings-box.jsx +3 -3
- package/src/mui-box/index.jsx +9 -9
- package/src/number-text-field-custom.jsx +25 -25
- package/src/number-text-field.jsx +12 -12
- package/src/radio-with-label.jsx +2 -2
- package/src/settings/display-size.jsx +5 -5
- package/src/settings/index.js +11 -11
- package/src/settings/panel.jsx +30 -32
- package/src/settings/settings-radio-label.jsx +2 -2
- package/src/settings/toggle.jsx +6 -6
- package/src/tabs/index.jsx +5 -7
- package/src/tags-input/index.jsx +15 -17
- package/src/two-choice.jsx +8 -8
- package/src/with-stateful-model.jsx +4 -4
|
@@ -9,18 +9,18 @@ export class IconMenu extends React.Component {
|
|
|
9
9
|
static propTypes = {
|
|
10
10
|
opts: PropTypes.object,
|
|
11
11
|
onClick: PropTypes.func.isRequired,
|
|
12
|
-
iconButtonElement: PropTypes.any
|
|
12
|
+
iconButtonElement: PropTypes.any,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
constructor(props) {
|
|
16
16
|
super(props);
|
|
17
17
|
this.state = {
|
|
18
18
|
anchorEl: undefined,
|
|
19
|
-
open: false
|
|
19
|
+
open: false,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
handleClick = event => {
|
|
23
|
+
handleClick = (event) => {
|
|
24
24
|
this.setState({ open: true, anchorEl: event.currentTarget });
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -33,7 +33,7 @@ export class IconMenu extends React.Component {
|
|
|
33
33
|
|
|
34
34
|
const keys = Object.keys(opts);
|
|
35
35
|
|
|
36
|
-
const handleMenuClick = key => () => {
|
|
36
|
+
const handleMenuClick = (key) => () => {
|
|
37
37
|
onClick(key);
|
|
38
38
|
this.handleRequestClose();
|
|
39
39
|
};
|
|
@@ -41,12 +41,7 @@ export class IconMenu extends React.Component {
|
|
|
41
41
|
return (
|
|
42
42
|
<div>
|
|
43
43
|
<div onClick={this.handleClick}>{this.props.iconButtonElement}</div>
|
|
44
|
-
<Menu
|
|
45
|
-
id="simple-menu"
|
|
46
|
-
anchorEl={this.state.anchorEl}
|
|
47
|
-
open={this.state.open}
|
|
48
|
-
onClose={this.handleRequestClose}
|
|
49
|
-
>
|
|
44
|
+
<Menu id="simple-menu" anchorEl={this.state.anchorEl} open={this.state.open} onClose={this.handleRequestClose}>
|
|
50
45
|
{keys.map((k, index) => (
|
|
51
46
|
<MenuItem key={index} onClick={handleMenuClick(k)}>
|
|
52
47
|
{opts[k]}
|
|
@@ -62,11 +57,11 @@ export default class FeedbackMenu extends React.Component {
|
|
|
62
57
|
static propTypes = {
|
|
63
58
|
value: PropTypes.object,
|
|
64
59
|
onChange: PropTypes.func.isRequired,
|
|
65
|
-
classes: PropTypes.object.isRequired
|
|
60
|
+
classes: PropTypes.object.isRequired,
|
|
66
61
|
};
|
|
67
62
|
|
|
68
63
|
static defaultProps = {
|
|
69
|
-
classes: {}
|
|
64
|
+
classes: {},
|
|
70
65
|
};
|
|
71
66
|
|
|
72
67
|
render() {
|
|
@@ -75,12 +70,7 @@ export default class FeedbackMenu extends React.Component {
|
|
|
75
70
|
const t = value && value.type;
|
|
76
71
|
const iconColor = t === 'custom' || t === 'default' ? 'primary' : 'disabled';
|
|
77
72
|
|
|
78
|
-
const tooltip =
|
|
79
|
-
t === 'custom'
|
|
80
|
-
? 'Custom Feedback'
|
|
81
|
-
: t === 'default'
|
|
82
|
-
? 'Default Feedback'
|
|
83
|
-
: 'Feedback disabled';
|
|
73
|
+
const tooltip = t === 'custom' ? 'Custom Feedback' : t === 'default' ? 'Default Feedback' : 'Feedback disabled';
|
|
84
74
|
|
|
85
75
|
const icon = (
|
|
86
76
|
<IconButton className={classes.icon} aria-label={tooltip}>
|
|
@@ -91,11 +81,11 @@ export default class FeedbackMenu extends React.Component {
|
|
|
91
81
|
return (
|
|
92
82
|
<IconMenu
|
|
93
83
|
iconButtonElement={icon}
|
|
94
|
-
onClick={key => onChange(key)}
|
|
84
|
+
onClick={(key) => onChange(key)}
|
|
95
85
|
opts={{
|
|
96
86
|
none: 'No Feedback',
|
|
97
87
|
default: 'Default',
|
|
98
|
-
custom: 'Custom'
|
|
88
|
+
custom: 'Custom',
|
|
99
89
|
}}
|
|
100
90
|
/>
|
|
101
91
|
);
|
|
@@ -11,11 +11,11 @@ import ActionDelete from '@material-ui/icons/Delete';
|
|
|
11
11
|
import ArrowRight from '@material-ui/icons/SubdirectoryArrowRight';
|
|
12
12
|
import IconButton from '@material-ui/core/IconButton';
|
|
13
13
|
|
|
14
|
-
const EditableHtmlContainer = withStyles(theme => ({
|
|
14
|
+
const EditableHtmlContainer = withStyles((theme) => ({
|
|
15
15
|
labelContainer: {},
|
|
16
16
|
editorHolder: {
|
|
17
|
-
marginTop: theme.spacing.unit * 2
|
|
18
|
-
}
|
|
17
|
+
marginTop: theme.spacing.unit * 2,
|
|
18
|
+
},
|
|
19
19
|
}))(
|
|
20
20
|
({
|
|
21
21
|
label,
|
|
@@ -32,7 +32,7 @@ const EditableHtmlContainer = withStyles(theme => ({
|
|
|
32
32
|
error,
|
|
33
33
|
maxImageWidth,
|
|
34
34
|
maxImageHeight,
|
|
35
|
-
uploadSoundSupport
|
|
35
|
+
uploadSoundSupport,
|
|
36
36
|
}) => {
|
|
37
37
|
const names = classNames(classes.labelContainer, className);
|
|
38
38
|
|
|
@@ -58,22 +58,22 @@ const EditableHtmlContainer = withStyles(theme => ({
|
|
|
58
58
|
</div>
|
|
59
59
|
</InputContainer>
|
|
60
60
|
);
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
const Feedback = withStyles(() => ({
|
|
65
65
|
text: {
|
|
66
|
-
width: '100%'
|
|
66
|
+
width: '100%',
|
|
67
67
|
},
|
|
68
68
|
feedbackContainer: {
|
|
69
|
-
position: 'relative'
|
|
69
|
+
position: 'relative',
|
|
70
70
|
},
|
|
71
71
|
arrowIcon: {
|
|
72
72
|
fill: '#ccc',
|
|
73
73
|
left: -56,
|
|
74
74
|
position: 'absolute',
|
|
75
|
-
top: 20
|
|
76
|
-
}
|
|
75
|
+
top: 20,
|
|
76
|
+
},
|
|
77
77
|
}))(({ value, onChange, type, correct, classes, defaults, toolbarOpts }) => {
|
|
78
78
|
if (!type || type === 'none') {
|
|
79
79
|
return null;
|
|
@@ -120,20 +120,20 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
120
120
|
correct: PropTypes.bool,
|
|
121
121
|
feedback: PropTypes.shape({
|
|
122
122
|
type: PropTypes.string,
|
|
123
|
-
value: PropTypes.string
|
|
124
|
-
})
|
|
123
|
+
value: PropTypes.string,
|
|
124
|
+
}),
|
|
125
125
|
}),
|
|
126
126
|
onDelete: PropTypes.func,
|
|
127
127
|
onChange: PropTypes.func,
|
|
128
128
|
index: PropTypes.number,
|
|
129
129
|
imageSupport: PropTypes.shape({
|
|
130
130
|
add: PropTypes.func.isRequired,
|
|
131
|
-
delete: PropTypes.func.isRequired
|
|
131
|
+
delete: PropTypes.func.isRequired,
|
|
132
132
|
}),
|
|
133
133
|
disableImageAlignmentButtons: PropTypes.bool,
|
|
134
134
|
allowFeedBack: PropTypes.bool,
|
|
135
135
|
allowDelete: PropTypes.bool,
|
|
136
|
-
toolbarOpts: PropTypes.object
|
|
136
|
+
toolbarOpts: PropTypes.object,
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
static defaultProps = {
|
|
@@ -141,10 +141,10 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
141
141
|
noLabels: false,
|
|
142
142
|
useLetterOrdering: false,
|
|
143
143
|
allowFeedBack: true,
|
|
144
|
-
allowDelete: true
|
|
144
|
+
allowDelete: true,
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
_changeFn = key => update => {
|
|
147
|
+
_changeFn = (key) => (update) => {
|
|
148
148
|
const { data, onChange } = this.props;
|
|
149
149
|
if (onChange) {
|
|
150
150
|
onChange({ ...data, [key]: update });
|
|
@@ -153,7 +153,7 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
153
153
|
|
|
154
154
|
onLabelChange = this._changeFn('label');
|
|
155
155
|
|
|
156
|
-
onCheckedChange = event => {
|
|
156
|
+
onCheckedChange = (event) => {
|
|
157
157
|
const correct = event.target.checked;
|
|
158
158
|
const { data, onChange } = this.props;
|
|
159
159
|
|
|
@@ -162,7 +162,7 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
onFeedbackValueChange = v => {
|
|
165
|
+
onFeedbackValueChange = (v) => {
|
|
166
166
|
const { data, onChange } = this.props;
|
|
167
167
|
|
|
168
168
|
if (data.feedback.type !== 'custom') {
|
|
@@ -174,7 +174,7 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
174
174
|
if (onChange) onChange({ ...data, feedback: fb });
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
onFeedbackTypeChange = t => {
|
|
177
|
+
onFeedbackTypeChange = (t) => {
|
|
178
178
|
const { data, onChange } = this.props;
|
|
179
179
|
const fb = { ...data.feedback, type: t };
|
|
180
180
|
if (fb.type !== 'custom') {
|
|
@@ -205,7 +205,7 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
205
205
|
toolbarOpts,
|
|
206
206
|
error,
|
|
207
207
|
noCorrectAnswerError,
|
|
208
|
-
uploadSoundSupport
|
|
208
|
+
uploadSoundSupport,
|
|
209
209
|
} = this.props;
|
|
210
210
|
|
|
211
211
|
const InputToggle = mode === 'checkbox' ? InputCheckbox : InputRadio;
|
|
@@ -257,7 +257,7 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
257
257
|
onChange={this.onFeedbackTypeChange}
|
|
258
258
|
value={data.feedback}
|
|
259
259
|
classes={{
|
|
260
|
-
icon: classes.feedbackIcon
|
|
260
|
+
icon: classes.feedbackIcon,
|
|
261
261
|
}}
|
|
262
262
|
/>
|
|
263
263
|
</InputContainer>
|
|
@@ -275,55 +275,55 @@ export class ChoiceConfiguration extends React.Component {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
const styles = theme => ({
|
|
278
|
+
const styles = (theme) => ({
|
|
279
279
|
index: {
|
|
280
|
-
padding: '24px 10px 0 0'
|
|
280
|
+
padding: '24px 10px 0 0',
|
|
281
281
|
},
|
|
282
282
|
choiceConfiguration: {},
|
|
283
283
|
topRow: {
|
|
284
|
-
display: 'flex'
|
|
284
|
+
display: 'flex',
|
|
285
285
|
},
|
|
286
286
|
value: {
|
|
287
287
|
flex: '0.5',
|
|
288
|
-
paddingRight: theme.spacing.unit
|
|
288
|
+
paddingRight: theme.spacing.unit,
|
|
289
289
|
},
|
|
290
290
|
editorHolder: {
|
|
291
|
-
marginTop: theme.spacing.unit * 2
|
|
291
|
+
marginTop: theme.spacing.unit * 2,
|
|
292
292
|
},
|
|
293
293
|
toggle: {
|
|
294
|
-
flex: '0 1 auto'
|
|
294
|
+
flex: '0 1 auto',
|
|
295
295
|
},
|
|
296
296
|
feedback: {
|
|
297
297
|
flex: '0 1 auto',
|
|
298
298
|
paddingTop: theme.spacing.unit,
|
|
299
299
|
paddingLeft: 0,
|
|
300
300
|
marginLeft: 0,
|
|
301
|
-
paddingRight: theme.spacing.unit * 3
|
|
301
|
+
paddingRight: theme.spacing.unit * 3,
|
|
302
302
|
},
|
|
303
303
|
feedbackIcon: {
|
|
304
304
|
margin: 0,
|
|
305
305
|
paddingLeft: 0,
|
|
306
|
-
width: 'inherit'
|
|
306
|
+
width: 'inherit',
|
|
307
307
|
},
|
|
308
308
|
deleteIcon: {
|
|
309
309
|
margin: 0,
|
|
310
|
-
width: 'inherit'
|
|
310
|
+
width: 'inherit',
|
|
311
311
|
},
|
|
312
312
|
delete: {
|
|
313
313
|
flex: '0 1 auto',
|
|
314
314
|
paddingTop: theme.spacing.unit,
|
|
315
315
|
paddingLeft: 0,
|
|
316
|
-
marginLeft: 0
|
|
316
|
+
marginLeft: 0,
|
|
317
317
|
},
|
|
318
318
|
middleColumn: {
|
|
319
319
|
display: 'flex',
|
|
320
320
|
flex: 1,
|
|
321
|
-
flexDirection: 'column'
|
|
321
|
+
flexDirection: 'column',
|
|
322
322
|
},
|
|
323
323
|
errorText: {
|
|
324
324
|
fontSize: '12px',
|
|
325
|
-
color: 'red'
|
|
326
|
-
}
|
|
325
|
+
color: 'red',
|
|
326
|
+
},
|
|
327
327
|
});
|
|
328
328
|
|
|
329
329
|
export default withStyles(styles)(ChoiceConfiguration);
|
package/src/choice-utils.js
CHANGED
|
@@ -5,7 +5,7 @@ import includes from 'lodash/includes';
|
|
|
5
5
|
* @param {Object} model the model to normalize
|
|
6
6
|
* @return {Object} the updated model
|
|
7
7
|
*/
|
|
8
|
-
export const normalizeChoices = model => {
|
|
8
|
+
export const normalizeChoices = (model) => {
|
|
9
9
|
const choices = model.choices.map((c, index) => {
|
|
10
10
|
if (!c.value) {
|
|
11
11
|
c.value = `${index}`;
|
|
@@ -8,7 +8,7 @@ import Group from './group';
|
|
|
8
8
|
const feedbackLabels = {
|
|
9
9
|
default: 'Simple Feedback',
|
|
10
10
|
none: 'No Feedback',
|
|
11
|
-
custom: 'Customized Feedback'
|
|
11
|
+
custom: 'Customized Feedback',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const holder = (theme, extras) => ({
|
|
@@ -16,42 +16,42 @@ const holder = (theme, extras) => ({
|
|
|
16
16
|
background: '#e0dee0',
|
|
17
17
|
padding: theme.spacing.unit * 0.9,
|
|
18
18
|
marginBottom: theme.spacing.unit * 2,
|
|
19
|
-
...extras
|
|
19
|
+
...extras,
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
const style = theme => ({
|
|
22
|
+
const style = (theme) => ({
|
|
23
23
|
feedbackSelector: {
|
|
24
|
-
marginBottom: theme.spacing.unit
|
|
24
|
+
marginBottom: theme.spacing.unit,
|
|
25
25
|
},
|
|
26
26
|
label: {
|
|
27
|
-
cursor: 'pointer'
|
|
27
|
+
cursor: 'pointer',
|
|
28
28
|
},
|
|
29
29
|
inputContainerLabel: {
|
|
30
|
-
transform: 'translateY(-20%)'
|
|
30
|
+
transform: 'translateY(-20%)',
|
|
31
31
|
},
|
|
32
32
|
feedbackInputContainer: {
|
|
33
|
-
paddingBottom: 0
|
|
33
|
+
paddingBottom: 0,
|
|
34
34
|
},
|
|
35
35
|
customHolder: holder(theme, {
|
|
36
36
|
background: '#e0dee0',
|
|
37
|
-
padding: 0
|
|
37
|
+
padding: 0,
|
|
38
38
|
}),
|
|
39
39
|
defaultHolder: holder(theme, {
|
|
40
40
|
fontFamily: theme.typography.fontFamily,
|
|
41
|
-
cursor: 'default'
|
|
41
|
+
cursor: 'default',
|
|
42
42
|
}),
|
|
43
43
|
editor: {
|
|
44
|
-
fontFamily: theme.typography.fontFamily
|
|
44
|
+
fontFamily: theme.typography.fontFamily,
|
|
45
45
|
},
|
|
46
46
|
group: {
|
|
47
|
-
paddingTop: theme.spacing.unit
|
|
48
|
-
}
|
|
47
|
+
paddingTop: theme.spacing.unit,
|
|
48
|
+
},
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
export const FeedbackType = {
|
|
52
52
|
type: PropTypes.oneOf(['default', 'custom', 'none']),
|
|
53
53
|
default: PropTypes.string,
|
|
54
|
-
custom: PropTypes.string
|
|
54
|
+
custom: PropTypes.string,
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
export class FeedbackSelector extends React.Component {
|
|
@@ -61,15 +61,15 @@ export class FeedbackSelector extends React.Component {
|
|
|
61
61
|
label: PropTypes.string.isRequired,
|
|
62
62
|
feedback: PropTypes.shape(FeedbackType).isRequired,
|
|
63
63
|
onChange: PropTypes.func.isRequired,
|
|
64
|
-
toolbarOpts: PropTypes.object
|
|
64
|
+
toolbarOpts: PropTypes.object,
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
changeType = type => {
|
|
67
|
+
changeType = (type) => {
|
|
68
68
|
const { onChange, feedback } = this.props;
|
|
69
69
|
onChange({ ...feedback, type });
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
changeCustom = custom => {
|
|
72
|
+
changeCustom = (custom) => {
|
|
73
73
|
const { onChange, feedback } = this.props;
|
|
74
74
|
onChange({ ...feedback, type: 'custom', custom });
|
|
75
75
|
};
|
|
@@ -106,9 +106,7 @@ export class FeedbackSelector extends React.Component {
|
|
|
106
106
|
/>
|
|
107
107
|
</div>
|
|
108
108
|
)}
|
|
109
|
-
{feedback.type === 'default' &&
|
|
110
|
-
<div className={classes.defaultHolder}> {feedback.default}</div>
|
|
111
|
-
)}
|
|
109
|
+
{feedback.type === 'default' && <div className={classes.defaultHolder}> {feedback.default}</div>}
|
|
112
110
|
</div>
|
|
113
111
|
);
|
|
114
112
|
}
|
|
@@ -6,33 +6,33 @@ import classNames from 'classnames';
|
|
|
6
6
|
|
|
7
7
|
const styles = () => ({
|
|
8
8
|
radioLabel: {
|
|
9
|
-
fontSize: '12px'
|
|
9
|
+
fontSize: '12px',
|
|
10
10
|
},
|
|
11
11
|
choice: {
|
|
12
12
|
display: 'flex',
|
|
13
|
-
alignItems: 'center'
|
|
13
|
+
alignItems: 'center',
|
|
14
14
|
},
|
|
15
15
|
choiceHolder: {
|
|
16
16
|
display: 'flex',
|
|
17
|
-
alignItems: 'center'
|
|
18
|
-
}
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
},
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
const Group = props => {
|
|
21
|
+
const Group = (props) => {
|
|
22
22
|
const { feedbackLabels, value, classes, className, onChange, keys } = props;
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<div className={classNames(classes.choiceHolder, className)}>
|
|
26
|
-
{keys.map(key => {
|
|
26
|
+
{keys.map((key) => {
|
|
27
27
|
return (
|
|
28
28
|
<div className={classes.choice} key={key}>
|
|
29
29
|
<RadioWithLabel
|
|
30
30
|
value={key}
|
|
31
31
|
checked={value === key}
|
|
32
32
|
classes={{
|
|
33
|
-
label: classes.radioLabel
|
|
33
|
+
label: classes.radioLabel,
|
|
34
34
|
}}
|
|
35
|
-
onChange={e => onChange(e.currentTarget.value)}
|
|
35
|
+
onChange={(e) => onChange(e.currentTarget.value)}
|
|
36
36
|
label={feedbackLabels[key]}
|
|
37
37
|
/>
|
|
38
38
|
</div>
|
|
@@ -48,7 +48,7 @@ Group.propTypes = {
|
|
|
48
48
|
value: PropTypes.string.isRequired,
|
|
49
49
|
classes: PropTypes.object.isRequired,
|
|
50
50
|
keys: PropTypes.arrayOf(PropTypes.string),
|
|
51
|
-
onChange: PropTypes.func
|
|
51
|
+
onChange: PropTypes.func,
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export default withStyles(styles)(Group);
|
|
@@ -14,19 +14,19 @@ export { FeedbackSelector };
|
|
|
14
14
|
const style = {
|
|
15
15
|
feedbackContainer: {
|
|
16
16
|
display: 'flex',
|
|
17
|
-
flexDirection: 'column'
|
|
18
|
-
}
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export const buildDefaults = input => {
|
|
21
|
+
export const buildDefaults = (input) => {
|
|
22
22
|
return merge(
|
|
23
23
|
{},
|
|
24
24
|
{
|
|
25
25
|
correct: { type: 'default', default: 'Correct' },
|
|
26
26
|
incorrect: { type: 'default', default: 'Incorrect' },
|
|
27
|
-
partial: { type: 'default', default: 'Nearly' }
|
|
27
|
+
partial: { type: 'default', default: 'Nearly' },
|
|
28
28
|
},
|
|
29
|
-
input
|
|
29
|
+
input,
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -36,16 +36,16 @@ export class FeedbackConfig extends React.Component {
|
|
|
36
36
|
feedback: PropTypes.shape({
|
|
37
37
|
correct: PropTypes.shape(FeedbackType),
|
|
38
38
|
incorrect: PropTypes.shape(FeedbackType),
|
|
39
|
-
partial: PropTypes.shape(FeedbackType)
|
|
39
|
+
partial: PropTypes.shape(FeedbackType),
|
|
40
40
|
}),
|
|
41
41
|
onChange: PropTypes.func.isRequired,
|
|
42
42
|
classes: PropTypes.object.isRequired,
|
|
43
|
-
toolbarOpts: PropTypes.object
|
|
43
|
+
toolbarOpts: PropTypes.object,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
static defaultProps = {
|
|
47
47
|
allowPartial: true,
|
|
48
|
-
feedback: buildDefaults()
|
|
48
|
+
feedback: buildDefaults(),
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
onChange(key, config) {
|
package/src/form-section.jsx
CHANGED
|
@@ -3,14 +3,14 @@ import Typography from '@material-ui/core/Typography';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { withStyles } from '@material-ui/core/styles';
|
|
5
5
|
|
|
6
|
-
const styles = theme => ({
|
|
6
|
+
const styles = (theme) => ({
|
|
7
7
|
formSection: {
|
|
8
8
|
marginTop: theme.spacing.unit * 2,
|
|
9
|
-
marginBottom: theme.spacing.unit * 2
|
|
9
|
+
marginBottom: theme.spacing.unit * 2,
|
|
10
10
|
},
|
|
11
11
|
label: {
|
|
12
|
-
marginBottom: theme.spacing.unit
|
|
13
|
-
}
|
|
12
|
+
marginBottom: theme.spacing.unit,
|
|
13
|
+
},
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
export default withStyles(styles)(({ className, classes, label, children, labelExtraStyle }) => (
|
package/src/help.jsx
CHANGED
|
@@ -14,7 +14,7 @@ import { withStyles } from '@material-ui/core/styles';
|
|
|
14
14
|
const RawHelpButton = ({ onClick, classes }) => (
|
|
15
15
|
<IconButton
|
|
16
16
|
classes={{
|
|
17
|
-
label: classes.icon
|
|
17
|
+
label: classes.icon,
|
|
18
18
|
}}
|
|
19
19
|
onClick={onClick}
|
|
20
20
|
>
|
|
@@ -23,15 +23,15 @@ const RawHelpButton = ({ onClick, classes }) => (
|
|
|
23
23
|
);
|
|
24
24
|
RawHelpButton.propTypes = {
|
|
25
25
|
onClick: PropTypes.func,
|
|
26
|
-
classes: PropTypes.object.isRequired
|
|
26
|
+
classes: PropTypes.object.isRequired,
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const HelpButton = withStyles({
|
|
30
30
|
icon: {
|
|
31
31
|
'&:hover': {
|
|
32
|
-
color: '#ddd'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
32
|
+
color: '#ddd',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
35
|
})(RawHelpButton);
|
|
36
36
|
|
|
37
37
|
export const HelpDialog = ({ open, onClose, children, title }) => (
|
|
@@ -52,19 +52,19 @@ HelpDialog.propTypes = {
|
|
|
52
52
|
open: PropTypes.bool,
|
|
53
53
|
onClose: PropTypes.func,
|
|
54
54
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
55
|
-
title: PropTypes.string.isRequired
|
|
55
|
+
title: PropTypes.string.isRequired,
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
class Help extends React.Component {
|
|
59
59
|
static propTypes = {
|
|
60
60
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
61
|
-
title: PropTypes.string
|
|
61
|
+
title: PropTypes.string,
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
constructor(props) {
|
|
65
65
|
super(props);
|
|
66
66
|
this.state = {
|
|
67
|
-
open: false
|
|
67
|
+
open: false,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -73,11 +73,7 @@ class Help extends React.Component {
|
|
|
73
73
|
return (
|
|
74
74
|
<div>
|
|
75
75
|
<HelpButton color="accent" onClick={() => this.setState({ open: true })} />
|
|
76
|
-
<HelpDialog
|
|
77
|
-
open={this.state.open}
|
|
78
|
-
title={title}
|
|
79
|
-
onClose={() => this.setState({ open: false })}
|
|
80
|
-
>
|
|
76
|
+
<HelpDialog open={this.state.open} title={title} onClose={() => this.setState({ open: false })}>
|
|
81
77
|
{children}
|
|
82
78
|
</HelpDialog>
|
|
83
79
|
</div>
|
package/src/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import AlertDialog from './alert-dialog';
|
|
2
|
-
import FeedbackConfig, {
|
|
3
|
-
FeedbackSelector,
|
|
4
|
-
buildDefaults as feedbackConfigDefaults
|
|
5
|
-
} from './feedback-config';
|
|
2
|
+
import FeedbackConfig, { FeedbackSelector, buildDefaults as feedbackConfigDefaults } from './feedback-config';
|
|
6
3
|
import { InputCheckbox, InputSwitch, InputRadio } from './inputs';
|
|
7
4
|
import Langs, { LanguageControls } from './langs';
|
|
8
5
|
import Tabs from './tabs';
|
|
@@ -54,5 +51,5 @@ export {
|
|
|
54
51
|
withStatefulModel,
|
|
55
52
|
Toggle,
|
|
56
53
|
DisplaySize,
|
|
57
|
-
settings
|
|
54
|
+
settings,
|
|
58
55
|
};
|
package/src/input.jsx
CHANGED
|
@@ -10,42 +10,42 @@ export default class Input extends React.Component {
|
|
|
10
10
|
label: PropTypes.string,
|
|
11
11
|
type: PropTypes.string.isRequired,
|
|
12
12
|
error: PropTypes.func,
|
|
13
|
-
noModelUpdateOnError: PropTypes.bool
|
|
13
|
+
noModelUpdateOnError: PropTypes.bool,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
static defaultProps = {
|
|
17
17
|
type: 'text',
|
|
18
18
|
error: (value, type) => (type === 'number' ? !value || isNaN(value) : !value),
|
|
19
|
-
noModelUpdateOnError: false
|
|
19
|
+
noModelUpdateOnError: false,
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
24
|
|
|
25
25
|
this.state = {
|
|
26
|
-
value: props.value
|
|
26
|
+
value: props.value,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
componentWillReceiveProps(newProps) {
|
|
31
31
|
this.setState({
|
|
32
|
-
value: newProps.value
|
|
32
|
+
value: newProps.value,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
onChange = event => {
|
|
36
|
+
onChange = (event) => {
|
|
37
37
|
const { type, onChange, error } = this.props;
|
|
38
38
|
const value = event.target.value;
|
|
39
39
|
|
|
40
40
|
if (error(value, type)) {
|
|
41
41
|
this.setState({
|
|
42
42
|
error: true,
|
|
43
|
-
value: event.target.value
|
|
43
|
+
value: event.target.value,
|
|
44
44
|
});
|
|
45
45
|
} else {
|
|
46
46
|
this.setState({
|
|
47
47
|
error: false,
|
|
48
|
-
value: event.target.value
|
|
48
|
+
value: event.target.value,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
onChange(event);
|