@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.
@@ -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["default"] = void 0;
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 _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
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 _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
51
-
52
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
53
-
54
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
55
-
56
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
57
-
58
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
59
-
60
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
61
-
62
- var log = (0, _debug["default"])('pie-elements:match:configure');
63
-
64
- var styles = function styles(theme) {
65
- return {
66
- container: {
67
- marginBottom: theme.spacing.unit * 2.5,
68
- display: 'flex',
69
- flexDirection: 'column'
70
- },
71
- rowContainer: {
72
- display: 'flex',
73
- alignItems: 'center',
74
- flex: 1,
75
- width: '100%',
76
- borderBottom: "2px solid ".concat(theme.palette.grey['A100']),
77
- paddingBottom: theme.spacing.unit * 2,
78
- marginTop: theme.spacing.unit * 2,
79
- marginBottom: theme.spacing.unit
80
- },
81
- rowItem: {
82
- flex: 1,
83
- display: 'flex',
84
- justifyContent: 'center',
85
- alignItems: 'center',
86
- flexDirection: 'column',
87
- '&> div': {
88
- width: '120px',
89
- padding: "0 ".concat(theme.spacing.unit, "px"),
90
- textAlign: 'center'
91
- }
92
- },
93
- deleteIcon: {
94
- flex: 0.5,
95
- minWidth: '45px',
96
- padding: "0 ".concat(theme.spacing.unit, "px")
97
- },
98
- questionText: {
99
- flex: 2,
100
- display: 'flex',
101
- justifyContent: 'flex-start',
102
- marginRight: theme.spacing.unit,
103
- '&> div': {
104
- width: '100%',
105
- padding: 0,
106
- maxWidth: 'unset',
107
- textAlign: 'left',
108
- minWidth: '200px'
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
- rowTable: {
112
- display: 'flex',
113
- flexDirection: 'column'
114
- },
115
- headerInput: {
116
- '&> div': {
117
- fontWeight: 'bold'
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
- marginBottom: {
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["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (name, isBoolean) {
183
- return function (_ref) {
184
- var target = _ref.target;
185
- var _this$props2 = _this.props,
186
- model = _this$props2.model,
187
- onChange = _this$props2.onChange;
188
- var value;
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
- (0, _createClass2["default"])(AnswerConfigBlock, [{
223
- key: "render",
224
- value: function render() {
225
- var _this2 = this;
226
-
227
- var _this$props4 = this.props,
228
- classes = _this$props4.classes,
229
- model = _this$props4.model,
230
- onAddRow = _this$props4.onAddRow,
231
- imageSupport = _this$props4.imageSupport,
232
- configuration = _this$props4.configuration,
233
- toolbarOpts = _this$props4.toolbarOpts,
234
- spellCheck = _this$props4.spellCheck,
235
- uploadSoundSupport = _this$props4.uploadSoundSupport;
236
-
237
- var _ref2 = configuration || {},
238
- _ref2$baseInputConfig = _ref2.baseInputConfiguration,
239
- baseInputConfiguration = _ref2$baseInputConfig === void 0 ? {} : _ref2$baseInputConfig,
240
- _ref2$headers = _ref2.headers,
241
- headers = _ref2$headers === void 0 ? {} : _ref2$headers,
242
- _ref2$rows = _ref2.rows,
243
- rows = _ref2$rows === void 0 ? {} : _ref2$rows,
244
- _ref2$maxImageWidth = _ref2.maxImageWidth,
245
- maxImageWidth = _ref2$maxImageWidth === void 0 ? {} : _ref2$maxImageWidth,
246
- _ref2$maxImageHeight = _ref2.maxImageHeight,
247
- maxImageHeight = _ref2$maxImageHeight === void 0 ? {} : _ref2$maxImageHeight,
248
- _ref2$mathMlOptions = _ref2.mathMlOptions,
249
- mathMlOptions = _ref2$mathMlOptions === void 0 ? {} : _ref2$mathMlOptions,
250
- minQuestions = _ref2.minQuestions;
251
-
252
- var _ref3 = model || {},
253
- errors = _ref3.errors;
254
-
255
- var _ref4 = errors || {},
256
- correctResponseError = _ref4.correctResponseError,
257
- rowsErrors = _ref4.rowsErrors,
258
- columnsErrors = _ref4.columnsErrors,
259
- noOfRowsError = _ref4.noOfRowsError,
260
- columnsLengthError = _ref4.columnsLengthError;
261
-
262
- var filteredDefaultPlugins = (_editableHtml.DEFAULT_PLUGINS || []).filter(function (p) {
263
- return p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list';
264
- });
265
- var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
266
- var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
267
- return /*#__PURE__*/React.createElement("div", {
268
- className: classes.container
269
- }, /*#__PURE__*/React.createElement(_Typography["default"], {
270
- type: "body1",
271
- component: "div"
272
- }, "Click on the labels to edit or remove. Set the correct answers by clicking each correct answer per row."), /*#__PURE__*/React.createElement("div", {
273
- className: classes.rowTable,
274
- style: configuration.width ? {
275
- width: configuration.width,
276
- overflow: 'scroll'
277
- } : {}
278
- }, /*#__PURE__*/React.createElement("div", {
279
- className: classes.rowContainer
280
- }, headers.settings && (model.headers || []).map(function (header, idx) {
281
- return /*#__PURE__*/React.createElement("div", {
282
- key: idx,
283
- className: (0, _classnames["default"])(classes.rowItem, (0, _defineProperty2["default"])({}, classes.questionText, idx === 0))
284
- }, /*#__PURE__*/React.createElement(_editableHtml["default"], {
285
- onChange: _this2.onHeaderChange(idx),
286
- markup: header,
287
- className: columnsErrors && !columnsErrors[idx] ? classes.marginBottom : classes.headerInput,
288
- label: 'column label',
289
- activePlugins: filteredDefaultPlugins,
290
- pluginProps: (0, _utils.getPluginProps)(headers === null || headers === void 0 ? void 0 : headers.inputConfiguration, baseInputConfiguration),
291
- autoWidthToolbar: true,
292
- spellCheck: spellCheck,
293
- uploadSoundSupport: uploadSoundSupport,
294
- languageCharactersProps: [{
295
- language: 'spanish'
296
- }, {
297
- language: 'special'
298
- }],
299
- error: columnsErrors && columnsErrors[idx]
300
- }), columnsErrors && columnsErrors[idx] && /*#__PURE__*/React.createElement("div", {
301
- className: classes.columnErrorText
302
- }, columnsErrors[idx]));
303
- }), /*#__PURE__*/React.createElement("div", {
304
- className: classes.deleteIcon
305
- })), model.rows.map(function (row, idx) {
306
- return /*#__PURE__*/React.createElement(_row["default"], {
307
- key: idx,
308
- model: model,
309
- row: row,
310
- idx: idx,
311
- onDeleteRow: _this2.props.onDeleteRow,
312
- onChange: _this2.props.onChange,
313
- onMoveRow: _this2.moveRow,
314
- imageSupport: imageSupport,
315
- toolbarOpts: toolbarOpts,
316
- spellCheck: spellCheck,
317
- error: rowsErrors === null || rowsErrors === void 0 ? void 0 : rowsErrors[row.id],
318
- maxImageWidth: maxImageWidth && maxImageWidth.rowTitles || defaultImageMaxWidth,
319
- maxImageHeight: maxImageHeight && maxImageHeight.rowTitles || defaultImageMaxHeight,
320
- uploadSoundSupport: uploadSoundSupport,
321
- mathMlOptions: mathMlOptions,
322
- minQuestions: minQuestions,
323
- inputConfiguration: (0, _utils.getPluginProps)(rows === null || rows === void 0 ? void 0 : rows.inputConfiguration, baseInputConfiguration)
324
- });
325
- }), correctResponseError && /*#__PURE__*/React.createElement("div", {
326
- className: classes.errorText
327
- }, correctResponseError), noOfRowsError && /*#__PURE__*/React.createElement("div", {
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["default"].shape({
351
- add: _propTypes["default"].func.isRequired,
352
- "delete": _propTypes["default"].func.isRequired
280
+ uploadSoundSupport: _propTypes.default.shape({
281
+ add: _propTypes.default.func.isRequired,
282
+ delete: _propTypes.default.func.isRequired
353
283
  }),
354
- toolbarOpts: _propTypes["default"].object,
355
- spellCheck: _propTypes["default"].bool
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