@pie-element/match 10.3.4-next.0 → 11.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/add-row.js +27 -73
- package/configure/lib/add-row.js.map +1 -1
- package/configure/lib/answer-config-block.js +260 -333
- package/configure/lib/answer-config-block.js.map +1 -1
- package/configure/lib/common.js +18 -33
- package/configure/lib/common.js.map +1 -1
- package/configure/lib/configure.js +329 -419
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/defaults.js +2 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/general-config-block.js +123 -190
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/index.js +116 -188
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/row.js +268 -376
- package/configure/lib/row.js.map +1 -1
- package/configure/lib/utils.js +4 -15
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +13 -11
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +172 -298
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +5 -5
- package/lib/answer-grid.js +142 -242
- package/lib/answer-grid.js.map +1 -1
- package/lib/index.js +59 -108
- package/lib/index.js.map +1 -1
- package/lib/main.js +123 -191
- package/lib/main.js.map +1 -1
- package/package.json +12 -9
|
@@ -1,361 +1,288 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
4
|
Object.defineProperty(exports, "__esModule", {
|
|
8
5
|
value: true
|
|
9
6
|
});
|
|
10
|
-
exports
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
7
|
+
exports.default = void 0;
|
|
26
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
9
|
var _utils = require("./utils");
|
|
29
|
-
|
|
30
10
|
var React = _interopRequireWildcard(require("react"));
|
|
31
|
-
|
|
32
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
|
|
34
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
var _styles = require("@material-ui/core/styles");
|
|
39
|
-
|
|
13
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
40
15
|
var _addRow = _interopRequireDefault(require("./add-row"));
|
|
41
|
-
|
|
42
16
|
var _row = _interopRequireDefault(require("./row"));
|
|
43
|
-
|
|
44
17
|
var _debug = _interopRequireDefault(require("debug"));
|
|
45
|
-
|
|
46
18
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
47
|
-
|
|
48
19
|
var _editableHtml = _interopRequireWildcard(require("@pie-lib/editable-html"));
|
|
49
|
-
|
|
50
|
-
function
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
20
|
+
var _drag = require("@pie-lib/drag");
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
22
|
+
const log = (0, _debug.default)('pie-elements:match:configure');
|
|
23
|
+
const Container = (0, _styles.styled)('div')(({
|
|
24
|
+
theme
|
|
25
|
+
}) => ({
|
|
26
|
+
marginBottom: theme.spacing(2.5),
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column'
|
|
29
|
+
}));
|
|
30
|
+
const RowContainer = (0, _styles.styled)('div')(({
|
|
31
|
+
theme
|
|
32
|
+
}) => ({
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
flex: 1,
|
|
36
|
+
width: '100%',
|
|
37
|
+
borderBottom: `2px solid ${theme.palette.grey['A100']}`,
|
|
38
|
+
paddingBottom: theme.spacing(2),
|
|
39
|
+
marginTop: theme.spacing(2),
|
|
40
|
+
marginBottom: theme.spacing(1)
|
|
41
|
+
}));
|
|
42
|
+
const RowItem = (0, _styles.styled)('div')(({
|
|
43
|
+
theme
|
|
44
|
+
}) => ({
|
|
45
|
+
flex: 1,
|
|
46
|
+
display: 'flex',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
'&> div': {
|
|
51
|
+
width: '120px',
|
|
52
|
+
padding: `0 ${theme.spacing(1)}`,
|
|
53
|
+
textAlign: 'center'
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
const DeleteIcon = (0, _styles.styled)('div')(({
|
|
57
|
+
theme
|
|
58
|
+
}) => ({
|
|
59
|
+
flex: 0.5,
|
|
60
|
+
minWidth: '45px',
|
|
61
|
+
padding: `0 ${theme.spacing(1)}`
|
|
62
|
+
}));
|
|
63
|
+
const RowTable = (0, _styles.styled)('div')({
|
|
64
|
+
display: 'flex',
|
|
65
|
+
flexDirection: 'column'
|
|
66
|
+
});
|
|
67
|
+
const ColumnErrorText = (0, _styles.styled)('div')(({
|
|
68
|
+
theme
|
|
69
|
+
}) => ({
|
|
70
|
+
fontSize: theme.typography.fontSize - 2,
|
|
71
|
+
color: theme.palette.error.main,
|
|
72
|
+
paddingTop: `${theme.spacing(1)} !important`,
|
|
73
|
+
width: 'fit-content !important'
|
|
74
|
+
}));
|
|
75
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
76
|
+
theme
|
|
77
|
+
}) => ({
|
|
78
|
+
fontSize: theme.typography.fontSize - 2,
|
|
79
|
+
color: theme.palette.error.main,
|
|
80
|
+
paddingBottom: theme.spacing(1)
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
// Global styles for EditableHtml components
|
|
84
|
+
const GlobalStyles = (0, _styles.styled)('div')(({
|
|
85
|
+
theme
|
|
86
|
+
}) => ({
|
|
87
|
+
'& .marginBottom': {
|
|
88
|
+
marginBottom: theme.typography.fontSize - 2 + theme.spacing(1)
|
|
89
|
+
},
|
|
90
|
+
'& .headerInput': {
|
|
91
|
+
'& > div': {
|
|
92
|
+
fontWeight: 'bold'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
class AnswerConfigBlock extends React.Component {
|
|
97
|
+
constructor(...args) {
|
|
98
|
+
super(...args);
|
|
99
|
+
(0, _defineProperty2.default)(this, "moveRow", event => {
|
|
100
|
+
const {
|
|
101
|
+
active,
|
|
102
|
+
over
|
|
103
|
+
} = event;
|
|
104
|
+
if (!over || !active) return;
|
|
105
|
+
const activeData = active.data.current;
|
|
106
|
+
const overData = over.data.current;
|
|
107
|
+
if (activeData?.type === 'row' && overData?.type === 'row') {
|
|
108
|
+
const from = activeData.index;
|
|
109
|
+
const to = overData.index;
|
|
110
|
+
const {
|
|
111
|
+
model,
|
|
112
|
+
onChange
|
|
113
|
+
} = this.props;
|
|
114
|
+
const newModel = {
|
|
115
|
+
...model
|
|
116
|
+
};
|
|
117
|
+
const rows = newModel.rows || [];
|
|
118
|
+
log('[moveRow]: ', from, to);
|
|
119
|
+
const {
|
|
120
|
+
movedRow,
|
|
121
|
+
remainingRows
|
|
122
|
+
} = rows.reduce((acc, item, index) => {
|
|
123
|
+
if (index === from) {
|
|
124
|
+
acc.movedRow = item;
|
|
125
|
+
} else {
|
|
126
|
+
acc.remainingRows.push(item);
|
|
127
|
+
}
|
|
128
|
+
return acc;
|
|
129
|
+
}, {
|
|
130
|
+
movedRow: null,
|
|
131
|
+
remainingRows: []
|
|
132
|
+
});
|
|
133
|
+
const update = [...remainingRows.slice(0, to), movedRow, ...remainingRows.slice(to)];
|
|
134
|
+
log('update: ', update);
|
|
135
|
+
newModel.rows = update;
|
|
136
|
+
onChange(newModel);
|
|
109
137
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
138
|
+
});
|
|
139
|
+
(0, _defineProperty2.default)(this, "onChange", (name, isBoolean) => ({
|
|
140
|
+
target
|
|
141
|
+
}) => {
|
|
142
|
+
const {
|
|
143
|
+
model,
|
|
144
|
+
onChange
|
|
145
|
+
} = this.props;
|
|
146
|
+
let value;
|
|
147
|
+
if (isBoolean) {
|
|
148
|
+
value = target.checked;
|
|
149
|
+
} else {
|
|
150
|
+
value = target.value;
|
|
118
151
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
marginBottom: theme.typography.fontSize - 2 + theme.spacing.unit
|
|
122
|
-
},
|
|
123
|
-
columnErrorText: {
|
|
124
|
-
fontSize: theme.typography.fontSize - 2,
|
|
125
|
-
color: theme.palette.error.main,
|
|
126
|
-
paddingTop: "".concat(theme.spacing.unit, "px !important"),
|
|
127
|
-
width: 'fit-content !important'
|
|
128
|
-
},
|
|
129
|
-
errorText: {
|
|
130
|
-
fontSize: theme.typography.fontSize - 2,
|
|
131
|
-
color: theme.palette.error.main,
|
|
132
|
-
paddingBottom: theme.spacing.unit
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
var AnswerConfigBlock = /*#__PURE__*/function (_React$Component) {
|
|
138
|
-
(0, _inherits2["default"])(AnswerConfigBlock, _React$Component);
|
|
139
|
-
|
|
140
|
-
var _super = _createSuper(AnswerConfigBlock);
|
|
141
|
-
|
|
142
|
-
function AnswerConfigBlock() {
|
|
143
|
-
var _this;
|
|
144
|
-
|
|
145
|
-
(0, _classCallCheck2["default"])(this, AnswerConfigBlock);
|
|
146
|
-
|
|
147
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
148
|
-
args[_key] = arguments[_key];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
152
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "moveRow", function (from, to) {
|
|
153
|
-
var _this$props = _this.props,
|
|
154
|
-
model = _this$props.model,
|
|
155
|
-
onChange = _this$props.onChange;
|
|
156
|
-
|
|
157
|
-
var newModel = _objectSpread({}, model);
|
|
158
|
-
|
|
159
|
-
var rows = newModel.rows || [];
|
|
160
|
-
log('[moveRow]: ', from, to);
|
|
161
|
-
|
|
162
|
-
var _rows$reduce = rows.reduce(function (acc, item, index) {
|
|
163
|
-
if (index === from) {
|
|
164
|
-
acc.movedRow = item;
|
|
165
|
-
} else {
|
|
166
|
-
acc.remainingRows.push(item);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return acc;
|
|
170
|
-
}, {
|
|
171
|
-
movedRow: null,
|
|
172
|
-
remainingRows: []
|
|
173
|
-
}),
|
|
174
|
-
movedRow = _rows$reduce.movedRow,
|
|
175
|
-
remainingRows = _rows$reduce.remainingRows;
|
|
176
|
-
|
|
177
|
-
var update = [].concat((0, _toConsumableArray2["default"])(remainingRows.slice(0, to)), [movedRow], (0, _toConsumableArray2["default"])(remainingRows.slice(to)));
|
|
178
|
-
log('update: ', update);
|
|
179
|
-
newModel.rows = update;
|
|
180
|
-
onChange(newModel);
|
|
152
|
+
_lodash.default.set(model, name, value);
|
|
153
|
+
onChange(model, name);
|
|
181
154
|
});
|
|
182
|
-
(0, _defineProperty2
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (isBoolean) {
|
|
191
|
-
value = target.checked;
|
|
192
|
-
} else {
|
|
193
|
-
value = target.value;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
_lodash["default"].set(model, name, value);
|
|
197
|
-
|
|
198
|
-
onChange(model, name);
|
|
155
|
+
(0, _defineProperty2.default)(this, "onHeaderChange", headerIndex => value => {
|
|
156
|
+
const {
|
|
157
|
+
model,
|
|
158
|
+
onChange
|
|
159
|
+
} = this.props;
|
|
160
|
+
const newModel = {
|
|
161
|
+
...model
|
|
199
162
|
};
|
|
200
|
-
|
|
201
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onHeaderChange", function (headerIndex) {
|
|
202
|
-
return function (value) {
|
|
203
|
-
var _this$props3 = _this.props,
|
|
204
|
-
model = _this$props3.model,
|
|
205
|
-
onChange = _this$props3.onChange;
|
|
206
|
-
|
|
207
|
-
var newModel = _objectSpread({}, model);
|
|
208
|
-
|
|
209
|
-
if (headerIndex === 0) {
|
|
210
|
-
newModel.headers[headerIndex] = value;
|
|
211
|
-
onChange(newModel);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
|
|
163
|
+
if (headerIndex === 0) {
|
|
215
164
|
newModel.headers[headerIndex] = value;
|
|
216
165
|
onChange(newModel);
|
|
217
|
-
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
newModel.headers[headerIndex] = value;
|
|
169
|
+
onChange(newModel);
|
|
218
170
|
});
|
|
219
|
-
return _this;
|
|
220
171
|
}
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
className: classes.errorText
|
|
329
|
-
}, noOfRowsError), columnsLengthError && /*#__PURE__*/React.createElement("div", {
|
|
330
|
-
className: classes.errorText
|
|
331
|
-
}, columnsLengthError), /*#__PURE__*/React.createElement(_addRow["default"], {
|
|
332
|
-
onAddClick: onAddRow
|
|
333
|
-
})));
|
|
334
|
-
}
|
|
335
|
-
}]);
|
|
336
|
-
return AnswerConfigBlock;
|
|
337
|
-
}(React.Component);
|
|
338
|
-
|
|
339
|
-
(0, _defineProperty2["default"])(AnswerConfigBlock, "propTypes", {
|
|
340
|
-
classes: _propTypes["default"].object.isRequired,
|
|
341
|
-
model: _propTypes["default"].object.isRequired,
|
|
342
|
-
configuration: _propTypes["default"].object.isRequired,
|
|
343
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
344
|
-
onDeleteRow: _propTypes["default"].func.isRequired,
|
|
345
|
-
onAddRow: _propTypes["default"].func.isRequired,
|
|
346
|
-
imageSupport: _propTypes["default"].shape({
|
|
347
|
-
add: _propTypes["default"].func.isRequired,
|
|
348
|
-
"delete": _propTypes["default"].func.isRequired
|
|
172
|
+
render() {
|
|
173
|
+
const {
|
|
174
|
+
model,
|
|
175
|
+
onAddRow,
|
|
176
|
+
imageSupport,
|
|
177
|
+
configuration,
|
|
178
|
+
toolbarOpts,
|
|
179
|
+
spellCheck,
|
|
180
|
+
uploadSoundSupport
|
|
181
|
+
} = this.props;
|
|
182
|
+
const {
|
|
183
|
+
baseInputConfiguration = {},
|
|
184
|
+
headers = {},
|
|
185
|
+
rows = {},
|
|
186
|
+
maxImageWidth = {},
|
|
187
|
+
maxImageHeight = {},
|
|
188
|
+
mathMlOptions = {},
|
|
189
|
+
minQuestions
|
|
190
|
+
} = configuration || {};
|
|
191
|
+
const {
|
|
192
|
+
errors
|
|
193
|
+
} = model || {};
|
|
194
|
+
const {
|
|
195
|
+
correctResponseError,
|
|
196
|
+
rowsErrors,
|
|
197
|
+
columnsErrors,
|
|
198
|
+
noOfRowsError,
|
|
199
|
+
columnsLengthError
|
|
200
|
+
} = errors || {};
|
|
201
|
+
const filteredDefaultPlugins = (_editableHtml.DEFAULT_PLUGINS || []).filter(p => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list');
|
|
202
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
203
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
204
|
+
return /*#__PURE__*/React.createElement(GlobalStyles, null, /*#__PURE__*/React.createElement(_drag.DragProvider, {
|
|
205
|
+
onDragEnd: this.moveRow
|
|
206
|
+
}, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(_Typography.default, {
|
|
207
|
+
type: "body1",
|
|
208
|
+
component: "div"
|
|
209
|
+
}, "Click on the labels to edit or remove. Set the correct answers by clicking each correct answer per row."), /*#__PURE__*/React.createElement(RowTable, {
|
|
210
|
+
style: configuration.width ? {
|
|
211
|
+
width: configuration.width,
|
|
212
|
+
overflow: 'scroll'
|
|
213
|
+
} : {}
|
|
214
|
+
}, /*#__PURE__*/React.createElement(RowContainer, null, headers.settings && (model.headers || []).map((header, idx) => /*#__PURE__*/React.createElement(RowItem, {
|
|
215
|
+
key: idx,
|
|
216
|
+
className: (0, _classnames.default)({
|
|
217
|
+
questionText: idx === 0
|
|
218
|
+
}),
|
|
219
|
+
sx: idx === 0 ? {
|
|
220
|
+
flex: 2,
|
|
221
|
+
display: 'flex',
|
|
222
|
+
justifyContent: 'flex-start',
|
|
223
|
+
marginRight: 1,
|
|
224
|
+
'&> div': {
|
|
225
|
+
width: '100%',
|
|
226
|
+
padding: 0,
|
|
227
|
+
maxWidth: 'unset',
|
|
228
|
+
textAlign: 'left',
|
|
229
|
+
minWidth: '200px'
|
|
230
|
+
}
|
|
231
|
+
} : {}
|
|
232
|
+
}, /*#__PURE__*/React.createElement(_editableHtml.default, {
|
|
233
|
+
onChange: this.onHeaderChange(idx),
|
|
234
|
+
markup: header,
|
|
235
|
+
className: columnsErrors && !columnsErrors[idx] ? 'marginBottom' : 'headerInput',
|
|
236
|
+
label: 'column label',
|
|
237
|
+
activePlugins: filteredDefaultPlugins,
|
|
238
|
+
pluginProps: (0, _utils.getPluginProps)(headers?.inputConfiguration, baseInputConfiguration),
|
|
239
|
+
autoWidthToolbar: true,
|
|
240
|
+
spellCheck: spellCheck,
|
|
241
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
242
|
+
languageCharactersProps: [{
|
|
243
|
+
language: 'spanish'
|
|
244
|
+
}, {
|
|
245
|
+
language: 'special'
|
|
246
|
+
}],
|
|
247
|
+
error: columnsErrors && columnsErrors[idx]
|
|
248
|
+
}), columnsErrors && columnsErrors[idx] && /*#__PURE__*/React.createElement(ColumnErrorText, null, columnsErrors[idx]))), /*#__PURE__*/React.createElement(DeleteIcon, null)), model.rows.map((row, idx) => /*#__PURE__*/React.createElement(_row.default, {
|
|
249
|
+
key: idx,
|
|
250
|
+
model: model,
|
|
251
|
+
row: row,
|
|
252
|
+
idx: idx,
|
|
253
|
+
onDeleteRow: this.props.onDeleteRow,
|
|
254
|
+
onChange: this.props.onChange,
|
|
255
|
+
imageSupport: imageSupport,
|
|
256
|
+
toolbarOpts: toolbarOpts,
|
|
257
|
+
spellCheck: spellCheck,
|
|
258
|
+
error: rowsErrors?.[row.id],
|
|
259
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rowTitles || defaultImageMaxWidth,
|
|
260
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rowTitles || defaultImageMaxHeight,
|
|
261
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
262
|
+
mathMlOptions: mathMlOptions,
|
|
263
|
+
minQuestions: minQuestions,
|
|
264
|
+
inputConfiguration: (0, _utils.getPluginProps)(rows?.inputConfiguration, baseInputConfiguration)
|
|
265
|
+
})), correctResponseError && /*#__PURE__*/React.createElement(ErrorText, null, correctResponseError), noOfRowsError && /*#__PURE__*/React.createElement(ErrorText, null, noOfRowsError), columnsLengthError && /*#__PURE__*/React.createElement(ErrorText, null, columnsLengthError), /*#__PURE__*/React.createElement(_addRow.default, {
|
|
266
|
+
onAddClick: onAddRow
|
|
267
|
+
})))));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
(0, _defineProperty2.default)(AnswerConfigBlock, "propTypes", {
|
|
271
|
+
model: _propTypes.default.object.isRequired,
|
|
272
|
+
configuration: _propTypes.default.object.isRequired,
|
|
273
|
+
onChange: _propTypes.default.func.isRequired,
|
|
274
|
+
onDeleteRow: _propTypes.default.func.isRequired,
|
|
275
|
+
onAddRow: _propTypes.default.func.isRequired,
|
|
276
|
+
imageSupport: _propTypes.default.shape({
|
|
277
|
+
add: _propTypes.default.func.isRequired,
|
|
278
|
+
delete: _propTypes.default.func.isRequired
|
|
349
279
|
}),
|
|
350
|
-
uploadSoundSupport: _propTypes
|
|
351
|
-
add: _propTypes
|
|
352
|
-
|
|
280
|
+
uploadSoundSupport: _propTypes.default.shape({
|
|
281
|
+
add: _propTypes.default.func.isRequired,
|
|
282
|
+
delete: _propTypes.default.func.isRequired
|
|
353
283
|
}),
|
|
354
|
-
toolbarOpts: _propTypes
|
|
355
|
-
spellCheck: _propTypes
|
|
284
|
+
toolbarOpts: _propTypes.default.object,
|
|
285
|
+
spellCheck: _propTypes.default.bool
|
|
356
286
|
});
|
|
357
|
-
|
|
358
|
-
var _default = (0, _styles.withStyles)(styles)(AnswerConfigBlock);
|
|
359
|
-
|
|
360
|
-
exports["default"] = _default;
|
|
287
|
+
var _default = exports.default = AnswerConfigBlock;
|
|
361
288
|
//# sourceMappingURL=answer-config-block.js.map
|