@pie-element/match 11.0.5-esm.1 → 11.1.0-next.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 +63 -0
- package/configure/CHANGELOG.md +63 -0
- package/configure/lib/add-row.js +27 -73
- package/configure/lib/add-row.js.map +1 -1
- package/configure/lib/answer-config-block.js +262 -335
- 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 +330 -420
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/defaults.js +5 -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 +117 -190
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/row.js +269 -377
- 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 +15 -14
- package/controller/CHANGELOG.md +49 -0
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +173 -301
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +6 -6
- 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 +18 -29
- package/esm/configure.js +0 -3936
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -428
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -472
- package/esm/element.js.map +0 -1
package/esm/configure.js
DELETED
|
@@ -1,3936 +0,0 @@
|
|
|
1
|
-
import lodash, { isEmpty, set } from 'lodash';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import React__default, { createContext, isValidElement, cloneElement, createRef, Component } from 'react';
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
6
|
-
import { InputContainer, NumberTextField, Checkbox, AlertDialog, layout, FeedbackConfig, settings } from '@pie-lib/config-ui';
|
|
7
|
-
import EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html';
|
|
8
|
-
import { withDragContext } from '@pie-lib/drag';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import debug from 'debug';
|
|
11
|
-
import Select from '@material-ui/core/Select';
|
|
12
|
-
import MenuItem from '@material-ui/core/MenuItem';
|
|
13
|
-
import Typography from '@material-ui/core/Typography';
|
|
14
|
-
import require$$3 from '@material-ui/core/SvgIcon';
|
|
15
|
-
import Tooltip from '@material-ui/core/Tooltip';
|
|
16
|
-
import classNames from 'classnames';
|
|
17
|
-
import Button from '@material-ui/core/Button';
|
|
18
|
-
import Radio from '@material-ui/core/Radio';
|
|
19
|
-
import IconButton from '@material-ui/core/IconButton';
|
|
20
|
-
import { color } from '@pie-lib/render-ui';
|
|
21
|
-
import { jsx } from 'react/jsx-runtime';
|
|
22
|
-
import { ModelUpdatedEvent, InsertImageEvent, DeleteImageEvent, InsertSoundEvent, DeleteSoundEvent } from '@pie-framework/pie-configure-events';
|
|
23
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
24
|
-
|
|
25
|
-
function _extends() {
|
|
26
|
-
_extends = Object.assign || function (target) {
|
|
27
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
28
|
-
var source = arguments[i];
|
|
29
|
-
|
|
30
|
-
for (var key in source) {
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
32
|
-
target[key] = source[key];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return target;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return _extends.apply(this, arguments);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const getPluginProps = (props = {}, baseInputConfiguration = {}) => _extends({}, baseInputConfiguration, props);
|
|
44
|
-
|
|
45
|
-
var Info = {};
|
|
46
|
-
|
|
47
|
-
var interopRequireDefault = {exports: {}};
|
|
48
|
-
|
|
49
|
-
(function (module) {
|
|
50
|
-
function _interopRequireDefault(obj) {
|
|
51
|
-
return obj && obj.__esModule ? obj : {
|
|
52
|
-
"default": obj
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
57
|
-
}(interopRequireDefault));
|
|
58
|
-
|
|
59
|
-
var createSvgIcon$1 = {};
|
|
60
|
-
|
|
61
|
-
var pure$1 = {};
|
|
62
|
-
|
|
63
|
-
var shouldUpdate$1 = {};
|
|
64
|
-
|
|
65
|
-
var inheritsLoose = {exports: {}};
|
|
66
|
-
|
|
67
|
-
var setPrototypeOf = {exports: {}};
|
|
68
|
-
|
|
69
|
-
(function (module) {
|
|
70
|
-
function _setPrototypeOf(o, p) {
|
|
71
|
-
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
72
|
-
o.__proto__ = p;
|
|
73
|
-
return o;
|
|
74
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
75
|
-
return _setPrototypeOf(o, p);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
79
|
-
}(setPrototypeOf));
|
|
80
|
-
|
|
81
|
-
(function (module) {
|
|
82
|
-
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
83
|
-
|
|
84
|
-
function _inheritsLoose(subClass, superClass) {
|
|
85
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
86
|
-
subClass.prototype.constructor = subClass;
|
|
87
|
-
setPrototypeOf$1(subClass, superClass);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
91
|
-
}(inheritsLoose));
|
|
92
|
-
|
|
93
|
-
var setDisplayName$1 = {};
|
|
94
|
-
|
|
95
|
-
var setStatic$1 = {};
|
|
96
|
-
|
|
97
|
-
setStatic$1.__esModule = true;
|
|
98
|
-
setStatic$1.default = void 0;
|
|
99
|
-
|
|
100
|
-
var setStatic = function setStatic(key, value) {
|
|
101
|
-
return function (BaseComponent) {
|
|
102
|
-
/* eslint-disable no-param-reassign */
|
|
103
|
-
BaseComponent[key] = value;
|
|
104
|
-
/* eslint-enable no-param-reassign */
|
|
105
|
-
|
|
106
|
-
return BaseComponent;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
var _default$b = setStatic;
|
|
111
|
-
setStatic$1.default = _default$b;
|
|
112
|
-
|
|
113
|
-
var _interopRequireDefault$9 = interopRequireDefault.exports;
|
|
114
|
-
|
|
115
|
-
setDisplayName$1.__esModule = true;
|
|
116
|
-
setDisplayName$1.default = void 0;
|
|
117
|
-
|
|
118
|
-
var _setStatic = _interopRequireDefault$9(setStatic$1);
|
|
119
|
-
|
|
120
|
-
var setDisplayName = function setDisplayName(displayName) {
|
|
121
|
-
return (0, _setStatic.default)('displayName', displayName);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
var _default$a = setDisplayName;
|
|
125
|
-
setDisplayName$1.default = _default$a;
|
|
126
|
-
|
|
127
|
-
var wrapDisplayName$1 = {};
|
|
128
|
-
|
|
129
|
-
var getDisplayName$1 = {};
|
|
130
|
-
|
|
131
|
-
getDisplayName$1.__esModule = true;
|
|
132
|
-
getDisplayName$1.default = void 0;
|
|
133
|
-
|
|
134
|
-
var getDisplayName = function getDisplayName(Component) {
|
|
135
|
-
if (typeof Component === 'string') {
|
|
136
|
-
return Component;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (!Component) {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return Component.displayName || Component.name || 'Component';
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
var _default$9 = getDisplayName;
|
|
147
|
-
getDisplayName$1.default = _default$9;
|
|
148
|
-
|
|
149
|
-
var _interopRequireDefault$8 = interopRequireDefault.exports;
|
|
150
|
-
|
|
151
|
-
wrapDisplayName$1.__esModule = true;
|
|
152
|
-
wrapDisplayName$1.default = void 0;
|
|
153
|
-
|
|
154
|
-
var _getDisplayName = _interopRequireDefault$8(getDisplayName$1);
|
|
155
|
-
|
|
156
|
-
var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
|
|
157
|
-
return hocName + "(" + (0, _getDisplayName.default)(BaseComponent) + ")";
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
var _default$8 = wrapDisplayName;
|
|
161
|
-
wrapDisplayName$1.default = _default$8;
|
|
162
|
-
|
|
163
|
-
var _interopRequireDefault$7 = interopRequireDefault.exports;
|
|
164
|
-
|
|
165
|
-
shouldUpdate$1.__esModule = true;
|
|
166
|
-
shouldUpdate$1.default = void 0;
|
|
167
|
-
|
|
168
|
-
var _inheritsLoose2 = _interopRequireDefault$7(inheritsLoose.exports);
|
|
169
|
-
|
|
170
|
-
var _react$5 = React__default;
|
|
171
|
-
|
|
172
|
-
var _setDisplayName$1 = _interopRequireDefault$7(setDisplayName$1);
|
|
173
|
-
|
|
174
|
-
var _wrapDisplayName$1 = _interopRequireDefault$7(wrapDisplayName$1);
|
|
175
|
-
|
|
176
|
-
var shouldUpdate = function shouldUpdate(test) {
|
|
177
|
-
return function (BaseComponent) {
|
|
178
|
-
var factory = (0, _react$5.createFactory)(BaseComponent);
|
|
179
|
-
|
|
180
|
-
var ShouldUpdate =
|
|
181
|
-
/*#__PURE__*/
|
|
182
|
-
function (_Component) {
|
|
183
|
-
(0, _inheritsLoose2.default)(ShouldUpdate, _Component);
|
|
184
|
-
|
|
185
|
-
function ShouldUpdate() {
|
|
186
|
-
return _Component.apply(this, arguments) || this;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
var _proto = ShouldUpdate.prototype;
|
|
190
|
-
|
|
191
|
-
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
|
|
192
|
-
return test(this.props, nextProps);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
_proto.render = function render() {
|
|
196
|
-
return factory(this.props);
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
return ShouldUpdate;
|
|
200
|
-
}(_react$5.Component);
|
|
201
|
-
|
|
202
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
203
|
-
return (0, _setDisplayName$1.default)((0, _wrapDisplayName$1.default)(BaseComponent, 'shouldUpdate'))(ShouldUpdate);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return ShouldUpdate;
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
var _default$7 = shouldUpdate;
|
|
211
|
-
shouldUpdate$1.default = _default$7;
|
|
212
|
-
|
|
213
|
-
var shallowEqual$2 = {};
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the MIT license found in the
|
|
219
|
-
* LICENSE file in the root directory of this source tree.
|
|
220
|
-
*
|
|
221
|
-
* @typechecks
|
|
222
|
-
*
|
|
223
|
-
*/
|
|
224
|
-
|
|
225
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
229
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
230
|
-
*/
|
|
231
|
-
function is(x, y) {
|
|
232
|
-
// SameValue algorithm
|
|
233
|
-
if (x === y) {
|
|
234
|
-
// Steps 1-5, 7-10
|
|
235
|
-
// Steps 6.b-6.e: +0 != -0
|
|
236
|
-
// Added the nonzero y check to make Flow happy, but it is redundant
|
|
237
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
238
|
-
} else {
|
|
239
|
-
// Step 6.a: NaN == NaN
|
|
240
|
-
return x !== x && y !== y;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Performs equality by iterating through keys on an object and returning false
|
|
246
|
-
* when any key has values which are not strictly equal between the arguments.
|
|
247
|
-
* Returns true when the values of all keys are strictly equal.
|
|
248
|
-
*/
|
|
249
|
-
function shallowEqual$1(objA, objB) {
|
|
250
|
-
if (is(objA, objB)) {
|
|
251
|
-
return true;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
var keysA = Object.keys(objA);
|
|
259
|
-
var keysB = Object.keys(objB);
|
|
260
|
-
|
|
261
|
-
if (keysA.length !== keysB.length) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Test for A's keys different from B.
|
|
266
|
-
for (var i = 0; i < keysA.length; i++) {
|
|
267
|
-
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return true;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
var shallowEqual_1 = shallowEqual$1;
|
|
276
|
-
|
|
277
|
-
var _interopRequireDefault$6 = interopRequireDefault.exports;
|
|
278
|
-
|
|
279
|
-
shallowEqual$2.__esModule = true;
|
|
280
|
-
shallowEqual$2.default = void 0;
|
|
281
|
-
|
|
282
|
-
var _shallowEqual$1 = _interopRequireDefault$6(shallowEqual_1);
|
|
283
|
-
|
|
284
|
-
var _default$6 = _shallowEqual$1.default;
|
|
285
|
-
shallowEqual$2.default = _default$6;
|
|
286
|
-
|
|
287
|
-
var _interopRequireDefault$5 = interopRequireDefault.exports;
|
|
288
|
-
|
|
289
|
-
pure$1.__esModule = true;
|
|
290
|
-
pure$1.default = void 0;
|
|
291
|
-
|
|
292
|
-
var _shouldUpdate = _interopRequireDefault$5(shouldUpdate$1);
|
|
293
|
-
|
|
294
|
-
var _shallowEqual = _interopRequireDefault$5(shallowEqual$2);
|
|
295
|
-
|
|
296
|
-
var _setDisplayName = _interopRequireDefault$5(setDisplayName$1);
|
|
297
|
-
|
|
298
|
-
var _wrapDisplayName = _interopRequireDefault$5(wrapDisplayName$1);
|
|
299
|
-
|
|
300
|
-
var pure = function pure(BaseComponent) {
|
|
301
|
-
var hoc = (0, _shouldUpdate.default)(function (props, nextProps) {
|
|
302
|
-
return !(0, _shallowEqual.default)(props, nextProps);
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
306
|
-
return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return hoc(BaseComponent);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
var _default$5 = pure;
|
|
313
|
-
pure$1.default = _default$5;
|
|
314
|
-
|
|
315
|
-
var _interopRequireDefault$4 = interopRequireDefault.exports;
|
|
316
|
-
|
|
317
|
-
Object.defineProperty(createSvgIcon$1, "__esModule", {
|
|
318
|
-
value: true
|
|
319
|
-
});
|
|
320
|
-
createSvgIcon$1.default = void 0;
|
|
321
|
-
|
|
322
|
-
var _react$4 = _interopRequireDefault$4(React__default);
|
|
323
|
-
|
|
324
|
-
var _pure = _interopRequireDefault$4(pure$1);
|
|
325
|
-
|
|
326
|
-
var _SvgIcon = _interopRequireDefault$4(require$$3);
|
|
327
|
-
|
|
328
|
-
function createSvgIcon(path, displayName) {
|
|
329
|
-
var Icon = function Icon(props) {
|
|
330
|
-
return _react$4.default.createElement(_SvgIcon.default, props, path);
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
Icon.displayName = "".concat(displayName, "Icon");
|
|
334
|
-
Icon = (0, _pure.default)(Icon);
|
|
335
|
-
Icon.muiName = 'SvgIcon';
|
|
336
|
-
return Icon;
|
|
337
|
-
}
|
|
338
|
-
var _default$4 = createSvgIcon;
|
|
339
|
-
createSvgIcon$1.default = _default$4;
|
|
340
|
-
|
|
341
|
-
var _interopRequireDefault$3 = interopRequireDefault.exports;
|
|
342
|
-
|
|
343
|
-
Object.defineProperty(Info, "__esModule", {
|
|
344
|
-
value: true
|
|
345
|
-
});
|
|
346
|
-
var default_1$3 = Info.default = void 0;
|
|
347
|
-
|
|
348
|
-
var _react$3 = _interopRequireDefault$3(React__default);
|
|
349
|
-
|
|
350
|
-
var _createSvgIcon$3 = _interopRequireDefault$3(createSvgIcon$1);
|
|
351
|
-
|
|
352
|
-
var _default$3 = (0, _createSvgIcon$3.default)(_react$3.default.createElement(_react$3.default.Fragment, null, _react$3.default.createElement("path", {
|
|
353
|
-
fill: "none",
|
|
354
|
-
d: "M0 0h24v24H0z"
|
|
355
|
-
}), _react$3.default.createElement("path", {
|
|
356
|
-
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
357
|
-
})), 'Info');
|
|
358
|
-
|
|
359
|
-
default_1$3 = Info.default = _default$3;
|
|
360
|
-
|
|
361
|
-
const generateValidationMessage = (model, configuration) => {
|
|
362
|
-
const {
|
|
363
|
-
choiceMode
|
|
364
|
-
} = model;
|
|
365
|
-
const {
|
|
366
|
-
minQuestions,
|
|
367
|
-
maxQuestions,
|
|
368
|
-
maxAnswers
|
|
369
|
-
} = configuration;
|
|
370
|
-
const baselineValidationMessage = `\nThere should be at least ${minQuestions}` + (maxQuestions ? ` and at most ${maxQuestions}` : '') + ' question row' + (minQuestions > 1 || maxQuestions ? 's.' : '.') + '\nRow and column headings should be non-blank and unique. \nFirst column heading is excluded from validation.' + (maxAnswers ? `\nThere should be at most ${maxAnswers} answer choices.` : '');
|
|
371
|
-
const correctResponseMessage = choiceMode === 'radio' ? '\nThere should be a correct response defined for every row.' : '\nThere should be at least one correct response defined for every row.';
|
|
372
|
-
return 'Validation requirements:' + baselineValidationMessage + correctResponseMessage;
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
const styles$4 = theme => ({
|
|
376
|
-
container: {
|
|
377
|
-
marginTop: theme.spacing.unit * 2,
|
|
378
|
-
display: 'flex'
|
|
379
|
-
},
|
|
380
|
-
input: {
|
|
381
|
-
flex: 1
|
|
382
|
-
},
|
|
383
|
-
numberTextField: {
|
|
384
|
-
flexDirection: 'unset'
|
|
385
|
-
},
|
|
386
|
-
inputContainer: {
|
|
387
|
-
width: '65%'
|
|
388
|
-
},
|
|
389
|
-
flexContainer: {
|
|
390
|
-
display: 'flex',
|
|
391
|
-
alignItems: 'center'
|
|
392
|
-
},
|
|
393
|
-
titleText: {
|
|
394
|
-
fontSize: theme.typography.fontSize + 2,
|
|
395
|
-
marginRight: theme.spacing.unit
|
|
396
|
-
},
|
|
397
|
-
tooltip: {
|
|
398
|
-
fontSize: theme.typography.fontSize - 2,
|
|
399
|
-
whiteSpace: 'pre',
|
|
400
|
-
maxWidth: '500px'
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
class GeneralConfigBlock extends React.Component {
|
|
405
|
-
constructor(...args) {
|
|
406
|
-
super(...args);
|
|
407
|
-
|
|
408
|
-
this.onChangeResponseType = name => event => {
|
|
409
|
-
const {
|
|
410
|
-
model,
|
|
411
|
-
onResponseTypeChange
|
|
412
|
-
} = this.props;
|
|
413
|
-
|
|
414
|
-
const newModel = _extends({}, model);
|
|
415
|
-
|
|
416
|
-
newModel[name] = event.target.value;
|
|
417
|
-
onResponseTypeChange(newModel[name]);
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
this.onChangeColumns = (name, value) => {
|
|
421
|
-
const {
|
|
422
|
-
model,
|
|
423
|
-
onLayoutChange
|
|
424
|
-
} = this.props;
|
|
425
|
-
|
|
426
|
-
const newModel = _extends({}, model);
|
|
427
|
-
|
|
428
|
-
newModel[name] = value;
|
|
429
|
-
onLayoutChange(newModel[name]);
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
render() {
|
|
434
|
-
const {
|
|
435
|
-
classes,
|
|
436
|
-
model,
|
|
437
|
-
configuration
|
|
438
|
-
} = this.props;
|
|
439
|
-
const {
|
|
440
|
-
layout = {},
|
|
441
|
-
choiceMode = {},
|
|
442
|
-
maxAnswers
|
|
443
|
-
} = configuration || {};
|
|
444
|
-
const validationMessage = generateValidationMessage(model, configuration);
|
|
445
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
446
|
-
className: classes.flexContainer
|
|
447
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
448
|
-
className: classes.titleText,
|
|
449
|
-
component: 'div'
|
|
450
|
-
}, "Define questions"), /*#__PURE__*/React.createElement(Tooltip, {
|
|
451
|
-
classes: {
|
|
452
|
-
tooltip: classes.tooltip
|
|
453
|
-
},
|
|
454
|
-
disableFocusListener: true,
|
|
455
|
-
disableTouchListener: true,
|
|
456
|
-
placement: 'right',
|
|
457
|
-
title: validationMessage
|
|
458
|
-
}, /*#__PURE__*/React.createElement(default_1$3, {
|
|
459
|
-
fontSize: 'small',
|
|
460
|
-
color: 'primary'
|
|
461
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
462
|
-
className: classes.container
|
|
463
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
464
|
-
className: classes.input
|
|
465
|
-
}, layout.settings && /*#__PURE__*/React.createElement(InputContainer, {
|
|
466
|
-
label: layout.label,
|
|
467
|
-
className: classes.inputContainer
|
|
468
|
-
}, /*#__PURE__*/React.createElement(NumberTextField, {
|
|
469
|
-
type: "number",
|
|
470
|
-
min: 3,
|
|
471
|
-
max: maxAnswers || 10,
|
|
472
|
-
value: model.layout,
|
|
473
|
-
onChange: (e, v) => this.onChangeColumns('layout', v),
|
|
474
|
-
suffix: 'Columns',
|
|
475
|
-
className: classes.numberTextField
|
|
476
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
477
|
-
className: classes.input
|
|
478
|
-
}, choiceMode.settings && /*#__PURE__*/React.createElement(InputContainer, {
|
|
479
|
-
label: choiceMode.label,
|
|
480
|
-
className: classes.inputContainer
|
|
481
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
482
|
-
onChange: this.onChangeResponseType('choiceMode'),
|
|
483
|
-
value: model.choiceMode
|
|
484
|
-
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
485
|
-
value: "radio"
|
|
486
|
-
}, "Radio - One Answer"), /*#__PURE__*/React.createElement(MenuItem, {
|
|
487
|
-
value: "checkbox"
|
|
488
|
-
}, "Checkbox - Multiple Answers"))))));
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
GeneralConfigBlock.propTypes = {
|
|
494
|
-
classes: PropTypes.object.isRequired,
|
|
495
|
-
model: PropTypes.object.isRequired,
|
|
496
|
-
configuration: PropTypes.object.isRequired,
|
|
497
|
-
onResponseTypeChange: PropTypes.func.isRequired,
|
|
498
|
-
onLayoutChange: PropTypes.func.isRequired
|
|
499
|
-
};
|
|
500
|
-
var GeneralConfigBlock$1 = withStyles(styles$4)(GeneralConfigBlock);
|
|
501
|
-
|
|
502
|
-
var Add = {};
|
|
503
|
-
|
|
504
|
-
var _interopRequireDefault$2 = interopRequireDefault.exports;
|
|
505
|
-
|
|
506
|
-
Object.defineProperty(Add, "__esModule", {
|
|
507
|
-
value: true
|
|
508
|
-
});
|
|
509
|
-
var default_1$2 = Add.default = void 0;
|
|
510
|
-
|
|
511
|
-
var _react$2 = _interopRequireDefault$2(React__default);
|
|
512
|
-
|
|
513
|
-
var _createSvgIcon$2 = _interopRequireDefault$2(createSvgIcon$1);
|
|
514
|
-
|
|
515
|
-
var _default$2 = (0, _createSvgIcon$2.default)(_react$2.default.createElement(_react$2.default.Fragment, null, _react$2.default.createElement("path", {
|
|
516
|
-
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
|
|
517
|
-
}), _react$2.default.createElement("path", {
|
|
518
|
-
fill: "none",
|
|
519
|
-
d: "M0 0h24v24H0z"
|
|
520
|
-
})), 'Add');
|
|
521
|
-
|
|
522
|
-
default_1$2 = Add.default = _default$2;
|
|
523
|
-
|
|
524
|
-
class AddRowButton extends React__default.Component {
|
|
525
|
-
render() {
|
|
526
|
-
const {
|
|
527
|
-
classes,
|
|
528
|
-
onAddClick
|
|
529
|
-
} = this.props;
|
|
530
|
-
return /*#__PURE__*/React__default.createElement(Button, {
|
|
531
|
-
className: classes.button,
|
|
532
|
-
disabled: false,
|
|
533
|
-
onClick: onAddClick
|
|
534
|
-
}, /*#__PURE__*/React__default.createElement(default_1$2, {
|
|
535
|
-
className: classes.icon
|
|
536
|
-
}), "Add Another Row");
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
AddRowButton.propTypes = {
|
|
541
|
-
classes: PropTypes.object.isRequired,
|
|
542
|
-
onAddClick: PropTypes.func.isRequired
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
const styles$3 = theme => ({
|
|
546
|
-
button: {
|
|
547
|
-
display: 'flex',
|
|
548
|
-
alignSelf: 'flex-start',
|
|
549
|
-
margin: 0
|
|
550
|
-
},
|
|
551
|
-
icon: {
|
|
552
|
-
marginRight: theme.spacing.unit / 2
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
|
|
556
|
-
var AddRow = withStyles(styles$3)(AddRowButton);
|
|
557
|
-
|
|
558
|
-
var DragHandle = {};
|
|
559
|
-
|
|
560
|
-
var _interopRequireDefault$1 = interopRequireDefault.exports;
|
|
561
|
-
|
|
562
|
-
Object.defineProperty(DragHandle, "__esModule", {
|
|
563
|
-
value: true
|
|
564
|
-
});
|
|
565
|
-
var default_1$1 = DragHandle.default = void 0;
|
|
566
|
-
|
|
567
|
-
var _react$1 = _interopRequireDefault$1(React__default);
|
|
568
|
-
|
|
569
|
-
var _createSvgIcon$1 = _interopRequireDefault$1(createSvgIcon$1);
|
|
570
|
-
|
|
571
|
-
var _default$1 = (0, _createSvgIcon$1.default)(_react$1.default.createElement(_react$1.default.Fragment, null, _react$1.default.createElement("defs", null, _react$1.default.createElement("path", {
|
|
572
|
-
id: "a",
|
|
573
|
-
d: "M0 0h24v24H0V0z"
|
|
574
|
-
})), _react$1.default.createElement("path", {
|
|
575
|
-
d: "M20 9H4v2h16V9zM4 15h16v-2H4v2z"
|
|
576
|
-
})), 'DragHandle');
|
|
577
|
-
|
|
578
|
-
default_1$1 = DragHandle.default = _default$1;
|
|
579
|
-
|
|
580
|
-
var Delete = {};
|
|
581
|
-
|
|
582
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
583
|
-
|
|
584
|
-
Object.defineProperty(Delete, "__esModule", {
|
|
585
|
-
value: true
|
|
586
|
-
});
|
|
587
|
-
var default_1 = Delete.default = void 0;
|
|
588
|
-
|
|
589
|
-
var _react = _interopRequireDefault(React__default);
|
|
590
|
-
|
|
591
|
-
var _createSvgIcon = _interopRequireDefault(createSvgIcon$1);
|
|
592
|
-
|
|
593
|
-
var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
|
|
594
|
-
d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
595
|
-
}), _react.default.createElement("path", {
|
|
596
|
-
fill: "none",
|
|
597
|
-
d: "M0 0h24v24H0z"
|
|
598
|
-
})), 'Delete');
|
|
599
|
-
|
|
600
|
-
default_1 = Delete.default = _default;
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Create the React Context
|
|
604
|
-
*/
|
|
605
|
-
|
|
606
|
-
var DndContext = createContext({
|
|
607
|
-
dragDropManager: undefined
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* Use invariant() to assert state which your program assumes to be true.
|
|
612
|
-
*
|
|
613
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
614
|
-
* to provide information about what broke and what you were
|
|
615
|
-
* expecting.
|
|
616
|
-
*
|
|
617
|
-
* The invariant message will be stripped in production, but the invariant
|
|
618
|
-
* will remain to ensure logic does not differ in production.
|
|
619
|
-
*/
|
|
620
|
-
function invariant(condition, format) {
|
|
621
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
622
|
-
args[_key - 2] = arguments[_key];
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
626
|
-
if (format === undefined) {
|
|
627
|
-
throw new Error('invariant requires an error message argument');
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
if (!condition) {
|
|
632
|
-
var error;
|
|
633
|
-
|
|
634
|
-
if (format === undefined) {
|
|
635
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
636
|
-
} else {
|
|
637
|
-
var argIndex = 0;
|
|
638
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
639
|
-
return args[argIndex++];
|
|
640
|
-
}));
|
|
641
|
-
error.name = 'Invariant Violation';
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
645
|
-
|
|
646
|
-
throw error;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
function _classCallCheck$7(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
651
|
-
|
|
652
|
-
function _defineProperties$7(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
653
|
-
|
|
654
|
-
function _createClass$7(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$7(Constructor.prototype, protoProps); if (staticProps) _defineProperties$7(Constructor, staticProps); return Constructor; }
|
|
655
|
-
|
|
656
|
-
function _defineProperty$7(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
657
|
-
var isCallingCanDrag = false;
|
|
658
|
-
var isCallingIsDragging = false;
|
|
659
|
-
var DragSourceMonitorImpl = /*#__PURE__*/function () {
|
|
660
|
-
function DragSourceMonitorImpl(manager) {
|
|
661
|
-
_classCallCheck$7(this, DragSourceMonitorImpl);
|
|
662
|
-
|
|
663
|
-
_defineProperty$7(this, "internalMonitor", void 0);
|
|
664
|
-
|
|
665
|
-
_defineProperty$7(this, "sourceId", null);
|
|
666
|
-
|
|
667
|
-
this.internalMonitor = manager.getMonitor();
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
_createClass$7(DragSourceMonitorImpl, [{
|
|
671
|
-
key: "receiveHandlerId",
|
|
672
|
-
value: function receiveHandlerId(sourceId) {
|
|
673
|
-
this.sourceId = sourceId;
|
|
674
|
-
}
|
|
675
|
-
}, {
|
|
676
|
-
key: "getHandlerId",
|
|
677
|
-
value: function getHandlerId() {
|
|
678
|
-
return this.sourceId;
|
|
679
|
-
}
|
|
680
|
-
}, {
|
|
681
|
-
key: "canDrag",
|
|
682
|
-
value: function canDrag() {
|
|
683
|
-
invariant(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
|
684
|
-
|
|
685
|
-
try {
|
|
686
|
-
isCallingCanDrag = true;
|
|
687
|
-
return this.internalMonitor.canDragSource(this.sourceId);
|
|
688
|
-
} finally {
|
|
689
|
-
isCallingCanDrag = false;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}, {
|
|
693
|
-
key: "isDragging",
|
|
694
|
-
value: function isDragging() {
|
|
695
|
-
if (!this.sourceId) {
|
|
696
|
-
return false;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
invariant(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
|
700
|
-
|
|
701
|
-
try {
|
|
702
|
-
isCallingIsDragging = true;
|
|
703
|
-
return this.internalMonitor.isDraggingSource(this.sourceId);
|
|
704
|
-
} finally {
|
|
705
|
-
isCallingIsDragging = false;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
}, {
|
|
709
|
-
key: "subscribeToStateChange",
|
|
710
|
-
value: function subscribeToStateChange(listener, options) {
|
|
711
|
-
return this.internalMonitor.subscribeToStateChange(listener, options);
|
|
712
|
-
}
|
|
713
|
-
}, {
|
|
714
|
-
key: "isDraggingSource",
|
|
715
|
-
value: function isDraggingSource(sourceId) {
|
|
716
|
-
return this.internalMonitor.isDraggingSource(sourceId);
|
|
717
|
-
}
|
|
718
|
-
}, {
|
|
719
|
-
key: "isOverTarget",
|
|
720
|
-
value: function isOverTarget(targetId, options) {
|
|
721
|
-
return this.internalMonitor.isOverTarget(targetId, options);
|
|
722
|
-
}
|
|
723
|
-
}, {
|
|
724
|
-
key: "getTargetIds",
|
|
725
|
-
value: function getTargetIds() {
|
|
726
|
-
return this.internalMonitor.getTargetIds();
|
|
727
|
-
}
|
|
728
|
-
}, {
|
|
729
|
-
key: "isSourcePublic",
|
|
730
|
-
value: function isSourcePublic() {
|
|
731
|
-
return this.internalMonitor.isSourcePublic();
|
|
732
|
-
}
|
|
733
|
-
}, {
|
|
734
|
-
key: "getSourceId",
|
|
735
|
-
value: function getSourceId() {
|
|
736
|
-
return this.internalMonitor.getSourceId();
|
|
737
|
-
}
|
|
738
|
-
}, {
|
|
739
|
-
key: "subscribeToOffsetChange",
|
|
740
|
-
value: function subscribeToOffsetChange(listener) {
|
|
741
|
-
return this.internalMonitor.subscribeToOffsetChange(listener);
|
|
742
|
-
}
|
|
743
|
-
}, {
|
|
744
|
-
key: "canDragSource",
|
|
745
|
-
value: function canDragSource(sourceId) {
|
|
746
|
-
return this.internalMonitor.canDragSource(sourceId);
|
|
747
|
-
}
|
|
748
|
-
}, {
|
|
749
|
-
key: "canDropOnTarget",
|
|
750
|
-
value: function canDropOnTarget(targetId) {
|
|
751
|
-
return this.internalMonitor.canDropOnTarget(targetId);
|
|
752
|
-
}
|
|
753
|
-
}, {
|
|
754
|
-
key: "getItemType",
|
|
755
|
-
value: function getItemType() {
|
|
756
|
-
return this.internalMonitor.getItemType();
|
|
757
|
-
}
|
|
758
|
-
}, {
|
|
759
|
-
key: "getItem",
|
|
760
|
-
value: function getItem() {
|
|
761
|
-
return this.internalMonitor.getItem();
|
|
762
|
-
}
|
|
763
|
-
}, {
|
|
764
|
-
key: "getDropResult",
|
|
765
|
-
value: function getDropResult() {
|
|
766
|
-
return this.internalMonitor.getDropResult();
|
|
767
|
-
}
|
|
768
|
-
}, {
|
|
769
|
-
key: "didDrop",
|
|
770
|
-
value: function didDrop() {
|
|
771
|
-
return this.internalMonitor.didDrop();
|
|
772
|
-
}
|
|
773
|
-
}, {
|
|
774
|
-
key: "getInitialClientOffset",
|
|
775
|
-
value: function getInitialClientOffset() {
|
|
776
|
-
return this.internalMonitor.getInitialClientOffset();
|
|
777
|
-
}
|
|
778
|
-
}, {
|
|
779
|
-
key: "getInitialSourceClientOffset",
|
|
780
|
-
value: function getInitialSourceClientOffset() {
|
|
781
|
-
return this.internalMonitor.getInitialSourceClientOffset();
|
|
782
|
-
}
|
|
783
|
-
}, {
|
|
784
|
-
key: "getSourceClientOffset",
|
|
785
|
-
value: function getSourceClientOffset() {
|
|
786
|
-
return this.internalMonitor.getSourceClientOffset();
|
|
787
|
-
}
|
|
788
|
-
}, {
|
|
789
|
-
key: "getClientOffset",
|
|
790
|
-
value: function getClientOffset() {
|
|
791
|
-
return this.internalMonitor.getClientOffset();
|
|
792
|
-
}
|
|
793
|
-
}, {
|
|
794
|
-
key: "getDifferenceFromInitialOffset",
|
|
795
|
-
value: function getDifferenceFromInitialOffset() {
|
|
796
|
-
return this.internalMonitor.getDifferenceFromInitialOffset();
|
|
797
|
-
}
|
|
798
|
-
}]);
|
|
799
|
-
|
|
800
|
-
return DragSourceMonitorImpl;
|
|
801
|
-
}();
|
|
802
|
-
|
|
803
|
-
function _classCallCheck$6(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
804
|
-
|
|
805
|
-
function _defineProperties$6(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
806
|
-
|
|
807
|
-
function _createClass$6(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$6(Constructor.prototype, protoProps); if (staticProps) _defineProperties$6(Constructor, staticProps); return Constructor; }
|
|
808
|
-
|
|
809
|
-
function _defineProperty$6(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
810
|
-
var isCallingCanDrop = false;
|
|
811
|
-
var DropTargetMonitorImpl = /*#__PURE__*/function () {
|
|
812
|
-
function DropTargetMonitorImpl(manager) {
|
|
813
|
-
_classCallCheck$6(this, DropTargetMonitorImpl);
|
|
814
|
-
|
|
815
|
-
_defineProperty$6(this, "internalMonitor", void 0);
|
|
816
|
-
|
|
817
|
-
_defineProperty$6(this, "targetId", null);
|
|
818
|
-
|
|
819
|
-
this.internalMonitor = manager.getMonitor();
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
_createClass$6(DropTargetMonitorImpl, [{
|
|
823
|
-
key: "receiveHandlerId",
|
|
824
|
-
value: function receiveHandlerId(targetId) {
|
|
825
|
-
this.targetId = targetId;
|
|
826
|
-
}
|
|
827
|
-
}, {
|
|
828
|
-
key: "getHandlerId",
|
|
829
|
-
value: function getHandlerId() {
|
|
830
|
-
return this.targetId;
|
|
831
|
-
}
|
|
832
|
-
}, {
|
|
833
|
-
key: "subscribeToStateChange",
|
|
834
|
-
value: function subscribeToStateChange(listener, options) {
|
|
835
|
-
return this.internalMonitor.subscribeToStateChange(listener, options);
|
|
836
|
-
}
|
|
837
|
-
}, {
|
|
838
|
-
key: "canDrop",
|
|
839
|
-
value: function canDrop() {
|
|
840
|
-
// Cut out early if the target id has not been set. This should prevent errors
|
|
841
|
-
// where the user has an older version of dnd-core like in
|
|
842
|
-
// https://github.com/react-dnd/react-dnd/issues/1310
|
|
843
|
-
if (!this.targetId) {
|
|
844
|
-
return false;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');
|
|
848
|
-
|
|
849
|
-
try {
|
|
850
|
-
isCallingCanDrop = true;
|
|
851
|
-
return this.internalMonitor.canDropOnTarget(this.targetId);
|
|
852
|
-
} finally {
|
|
853
|
-
isCallingCanDrop = false;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}, {
|
|
857
|
-
key: "isOver",
|
|
858
|
-
value: function isOver(options) {
|
|
859
|
-
if (!this.targetId) {
|
|
860
|
-
return false;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
return this.internalMonitor.isOverTarget(this.targetId, options);
|
|
864
|
-
}
|
|
865
|
-
}, {
|
|
866
|
-
key: "getItemType",
|
|
867
|
-
value: function getItemType() {
|
|
868
|
-
return this.internalMonitor.getItemType();
|
|
869
|
-
}
|
|
870
|
-
}, {
|
|
871
|
-
key: "getItem",
|
|
872
|
-
value: function getItem() {
|
|
873
|
-
return this.internalMonitor.getItem();
|
|
874
|
-
}
|
|
875
|
-
}, {
|
|
876
|
-
key: "getDropResult",
|
|
877
|
-
value: function getDropResult() {
|
|
878
|
-
return this.internalMonitor.getDropResult();
|
|
879
|
-
}
|
|
880
|
-
}, {
|
|
881
|
-
key: "didDrop",
|
|
882
|
-
value: function didDrop() {
|
|
883
|
-
return this.internalMonitor.didDrop();
|
|
884
|
-
}
|
|
885
|
-
}, {
|
|
886
|
-
key: "getInitialClientOffset",
|
|
887
|
-
value: function getInitialClientOffset() {
|
|
888
|
-
return this.internalMonitor.getInitialClientOffset();
|
|
889
|
-
}
|
|
890
|
-
}, {
|
|
891
|
-
key: "getInitialSourceClientOffset",
|
|
892
|
-
value: function getInitialSourceClientOffset() {
|
|
893
|
-
return this.internalMonitor.getInitialSourceClientOffset();
|
|
894
|
-
}
|
|
895
|
-
}, {
|
|
896
|
-
key: "getSourceClientOffset",
|
|
897
|
-
value: function getSourceClientOffset() {
|
|
898
|
-
return this.internalMonitor.getSourceClientOffset();
|
|
899
|
-
}
|
|
900
|
-
}, {
|
|
901
|
-
key: "getClientOffset",
|
|
902
|
-
value: function getClientOffset() {
|
|
903
|
-
return this.internalMonitor.getClientOffset();
|
|
904
|
-
}
|
|
905
|
-
}, {
|
|
906
|
-
key: "getDifferenceFromInitialOffset",
|
|
907
|
-
value: function getDifferenceFromInitialOffset() {
|
|
908
|
-
return this.internalMonitor.getDifferenceFromInitialOffset();
|
|
909
|
-
}
|
|
910
|
-
}]);
|
|
911
|
-
|
|
912
|
-
return DropTargetMonitorImpl;
|
|
913
|
-
}();
|
|
914
|
-
|
|
915
|
-
function throwIfCompositeComponentElement(element) {
|
|
916
|
-
// Custom components can no longer be wrapped directly in React DnD 2.0
|
|
917
|
-
// so that we don't need to depend on findDOMNode() from react-dom.
|
|
918
|
-
if (typeof element.type === 'string') {
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
var displayName = element.type.displayName || element.type.name || 'the component';
|
|
923
|
-
throw new Error('Only native element nodes can now be passed to React DnD connectors.' + "You can either wrap ".concat(displayName, " into a <div>, or turn it into a ") + 'drag source or a drop target itself.');
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
function wrapHookToRecognizeElement(hook) {
|
|
927
|
-
return function () {
|
|
928
|
-
var elementOrNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
929
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
930
|
-
|
|
931
|
-
// When passed a node, call the hook straight away.
|
|
932
|
-
if (!isValidElement(elementOrNode)) {
|
|
933
|
-
var node = elementOrNode;
|
|
934
|
-
hook(node, options); // return the node so it can be chained (e.g. when within callback refs
|
|
935
|
-
// <div ref={node => connectDragSource(connectDropTarget(node))}/>
|
|
936
|
-
|
|
937
|
-
return node;
|
|
938
|
-
} // If passed a ReactElement, clone it and attach this function as a ref.
|
|
939
|
-
// This helps us achieve a neat API where user doesn't even know that refs
|
|
940
|
-
// are being used under the hood.
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
var element = elementOrNode;
|
|
944
|
-
throwIfCompositeComponentElement(element); // When no options are passed, use the hook directly
|
|
945
|
-
|
|
946
|
-
var ref = options ? function (node) {
|
|
947
|
-
return hook(node, options);
|
|
948
|
-
} : hook;
|
|
949
|
-
return cloneWithRef(element, ref);
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
function wrapConnectorHooks(hooks) {
|
|
954
|
-
var wrappedHooks = {};
|
|
955
|
-
Object.keys(hooks).forEach(function (key) {
|
|
956
|
-
var hook = hooks[key]; // ref objects should be passed straight through without wrapping
|
|
957
|
-
|
|
958
|
-
if (key.endsWith('Ref')) {
|
|
959
|
-
wrappedHooks[key] = hooks[key];
|
|
960
|
-
} else {
|
|
961
|
-
var wrappedHook = wrapHookToRecognizeElement(hook);
|
|
962
|
-
|
|
963
|
-
wrappedHooks[key] = function () {
|
|
964
|
-
return wrappedHook;
|
|
965
|
-
};
|
|
966
|
-
}
|
|
967
|
-
});
|
|
968
|
-
return wrappedHooks;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
function setRef(ref, node) {
|
|
972
|
-
if (typeof ref === 'function') {
|
|
973
|
-
ref(node);
|
|
974
|
-
} else {
|
|
975
|
-
ref.current = node;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
function cloneWithRef(element, newRef) {
|
|
980
|
-
var previousRef = element.ref;
|
|
981
|
-
invariant(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + 'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' + 'Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs');
|
|
982
|
-
|
|
983
|
-
if (!previousRef) {
|
|
984
|
-
// When there is no ref on the element, use the new ref directly
|
|
985
|
-
return cloneElement(element, {
|
|
986
|
-
ref: newRef
|
|
987
|
-
});
|
|
988
|
-
} else {
|
|
989
|
-
return cloneElement(element, {
|
|
990
|
-
ref: function ref(node) {
|
|
991
|
-
setRef(previousRef, node);
|
|
992
|
-
setRef(newRef, node);
|
|
993
|
-
}
|
|
994
|
-
});
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
|
|
999
|
-
|
|
1000
|
-
function isRef(obj) {
|
|
1001
|
-
return (// eslint-disable-next-line no-prototype-builtins
|
|
1002
|
-
obj !== null && _typeof$2(obj) === 'object' && Object.prototype.hasOwnProperty.call(obj, 'current')
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
function shallowEqual(objA, objB, compare, compareContext) {
|
|
1007
|
-
var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
|
|
1008
|
-
|
|
1009
|
-
if (compareResult !== void 0) {
|
|
1010
|
-
return !!compareResult;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
if (objA === objB) {
|
|
1014
|
-
return true;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
|
|
1018
|
-
return false;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
var keysA = Object.keys(objA);
|
|
1022
|
-
var keysB = Object.keys(objB);
|
|
1023
|
-
|
|
1024
|
-
if (keysA.length !== keysB.length) {
|
|
1025
|
-
return false;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
|
|
1029
|
-
|
|
1030
|
-
for (var idx = 0; idx < keysA.length; idx++) {
|
|
1031
|
-
var key = keysA[idx];
|
|
1032
|
-
|
|
1033
|
-
if (!bHasOwnProperty(key)) {
|
|
1034
|
-
return false;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
var valueA = objA[key];
|
|
1038
|
-
var valueB = objB[key];
|
|
1039
|
-
compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
|
1040
|
-
|
|
1041
|
-
if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
|
|
1042
|
-
return false;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
return true;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1050
|
-
|
|
1051
|
-
function _defineProperties$5(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1052
|
-
|
|
1053
|
-
function _createClass$5(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$5(Constructor.prototype, protoProps); if (staticProps) _defineProperties$5(Constructor, staticProps); return Constructor; }
|
|
1054
|
-
|
|
1055
|
-
function _defineProperty$5(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1056
|
-
var SourceConnector = /*#__PURE__*/function () {
|
|
1057
|
-
// The drop target may either be attached via ref or connect function
|
|
1058
|
-
// The drag preview may either be attached via ref or connect function
|
|
1059
|
-
function SourceConnector(backend) {
|
|
1060
|
-
var _this = this;
|
|
1061
|
-
|
|
1062
|
-
_classCallCheck$5(this, SourceConnector);
|
|
1063
|
-
|
|
1064
|
-
_defineProperty$5(this, "hooks", wrapConnectorHooks({
|
|
1065
|
-
dragSource: function dragSource(node, options) {
|
|
1066
|
-
_this.clearDragSource();
|
|
1067
|
-
|
|
1068
|
-
_this.dragSourceOptions = options || null;
|
|
1069
|
-
|
|
1070
|
-
if (isRef(node)) {
|
|
1071
|
-
_this.dragSourceRef = node;
|
|
1072
|
-
} else {
|
|
1073
|
-
_this.dragSourceNode = node;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
_this.reconnectDragSource();
|
|
1077
|
-
},
|
|
1078
|
-
dragPreview: function dragPreview(node, options) {
|
|
1079
|
-
_this.clearDragPreview();
|
|
1080
|
-
|
|
1081
|
-
_this.dragPreviewOptions = options || null;
|
|
1082
|
-
|
|
1083
|
-
if (isRef(node)) {
|
|
1084
|
-
_this.dragPreviewRef = node;
|
|
1085
|
-
} else {
|
|
1086
|
-
_this.dragPreviewNode = node;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
_this.reconnectDragPreview();
|
|
1090
|
-
}
|
|
1091
|
-
}));
|
|
1092
|
-
|
|
1093
|
-
_defineProperty$5(this, "handlerId", null);
|
|
1094
|
-
|
|
1095
|
-
_defineProperty$5(this, "dragSourceRef", null);
|
|
1096
|
-
|
|
1097
|
-
_defineProperty$5(this, "dragSourceNode", void 0);
|
|
1098
|
-
|
|
1099
|
-
_defineProperty$5(this, "dragSourceOptionsInternal", null);
|
|
1100
|
-
|
|
1101
|
-
_defineProperty$5(this, "dragSourceUnsubscribe", void 0);
|
|
1102
|
-
|
|
1103
|
-
_defineProperty$5(this, "dragPreviewRef", null);
|
|
1104
|
-
|
|
1105
|
-
_defineProperty$5(this, "dragPreviewNode", void 0);
|
|
1106
|
-
|
|
1107
|
-
_defineProperty$5(this, "dragPreviewOptionsInternal", null);
|
|
1108
|
-
|
|
1109
|
-
_defineProperty$5(this, "dragPreviewUnsubscribe", void 0);
|
|
1110
|
-
|
|
1111
|
-
_defineProperty$5(this, "lastConnectedHandlerId", null);
|
|
1112
|
-
|
|
1113
|
-
_defineProperty$5(this, "lastConnectedDragSource", null);
|
|
1114
|
-
|
|
1115
|
-
_defineProperty$5(this, "lastConnectedDragSourceOptions", null);
|
|
1116
|
-
|
|
1117
|
-
_defineProperty$5(this, "lastConnectedDragPreview", null);
|
|
1118
|
-
|
|
1119
|
-
_defineProperty$5(this, "lastConnectedDragPreviewOptions", null);
|
|
1120
|
-
|
|
1121
|
-
_defineProperty$5(this, "backend", void 0);
|
|
1122
|
-
|
|
1123
|
-
this.backend = backend;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
_createClass$5(SourceConnector, [{
|
|
1127
|
-
key: "receiveHandlerId",
|
|
1128
|
-
value: function receiveHandlerId(newHandlerId) {
|
|
1129
|
-
if (this.handlerId === newHandlerId) {
|
|
1130
|
-
return;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
this.handlerId = newHandlerId;
|
|
1134
|
-
this.reconnect();
|
|
1135
|
-
}
|
|
1136
|
-
}, {
|
|
1137
|
-
key: "connectTarget",
|
|
1138
|
-
get: function get() {
|
|
1139
|
-
return this.dragSource;
|
|
1140
|
-
}
|
|
1141
|
-
}, {
|
|
1142
|
-
key: "dragSourceOptions",
|
|
1143
|
-
get: function get() {
|
|
1144
|
-
return this.dragSourceOptionsInternal;
|
|
1145
|
-
},
|
|
1146
|
-
set: function set(options) {
|
|
1147
|
-
this.dragSourceOptionsInternal = options;
|
|
1148
|
-
}
|
|
1149
|
-
}, {
|
|
1150
|
-
key: "dragPreviewOptions",
|
|
1151
|
-
get: function get() {
|
|
1152
|
-
return this.dragPreviewOptionsInternal;
|
|
1153
|
-
},
|
|
1154
|
-
set: function set(options) {
|
|
1155
|
-
this.dragPreviewOptionsInternal = options;
|
|
1156
|
-
}
|
|
1157
|
-
}, {
|
|
1158
|
-
key: "reconnect",
|
|
1159
|
-
value: function reconnect() {
|
|
1160
|
-
this.reconnectDragSource();
|
|
1161
|
-
this.reconnectDragPreview();
|
|
1162
|
-
}
|
|
1163
|
-
}, {
|
|
1164
|
-
key: "reconnectDragSource",
|
|
1165
|
-
value: function reconnectDragSource() {
|
|
1166
|
-
var dragSource = this.dragSource; // if nothing has changed then don't resubscribe
|
|
1167
|
-
|
|
1168
|
-
var didChange = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange();
|
|
1169
|
-
|
|
1170
|
-
if (didChange) {
|
|
1171
|
-
this.disconnectDragSource();
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
if (!this.handlerId) {
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
if (!dragSource) {
|
|
1179
|
-
this.lastConnectedDragSource = dragSource;
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
if (didChange) {
|
|
1184
|
-
this.lastConnectedHandlerId = this.handlerId;
|
|
1185
|
-
this.lastConnectedDragSource = dragSource;
|
|
1186
|
-
this.lastConnectedDragSourceOptions = this.dragSourceOptions;
|
|
1187
|
-
this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions);
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
}, {
|
|
1191
|
-
key: "reconnectDragPreview",
|
|
1192
|
-
value: function reconnectDragPreview() {
|
|
1193
|
-
var dragPreview = this.dragPreview; // if nothing has changed then don't resubscribe
|
|
1194
|
-
|
|
1195
|
-
var didChange = this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange();
|
|
1196
|
-
|
|
1197
|
-
if (didChange) {
|
|
1198
|
-
this.disconnectDragPreview();
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
if (!this.handlerId) {
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
if (!dragPreview) {
|
|
1206
|
-
this.lastConnectedDragPreview = dragPreview;
|
|
1207
|
-
return;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
if (didChange) {
|
|
1211
|
-
this.lastConnectedHandlerId = this.handlerId;
|
|
1212
|
-
this.lastConnectedDragPreview = dragPreview;
|
|
1213
|
-
this.lastConnectedDragPreviewOptions = this.dragPreviewOptions;
|
|
1214
|
-
this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions);
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
}, {
|
|
1218
|
-
key: "didHandlerIdChange",
|
|
1219
|
-
value: function didHandlerIdChange() {
|
|
1220
|
-
return this.lastConnectedHandlerId !== this.handlerId;
|
|
1221
|
-
}
|
|
1222
|
-
}, {
|
|
1223
|
-
key: "didConnectedDragSourceChange",
|
|
1224
|
-
value: function didConnectedDragSourceChange() {
|
|
1225
|
-
return this.lastConnectedDragSource !== this.dragSource;
|
|
1226
|
-
}
|
|
1227
|
-
}, {
|
|
1228
|
-
key: "didConnectedDragPreviewChange",
|
|
1229
|
-
value: function didConnectedDragPreviewChange() {
|
|
1230
|
-
return this.lastConnectedDragPreview !== this.dragPreview;
|
|
1231
|
-
}
|
|
1232
|
-
}, {
|
|
1233
|
-
key: "didDragSourceOptionsChange",
|
|
1234
|
-
value: function didDragSourceOptionsChange() {
|
|
1235
|
-
return !shallowEqual(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
|
|
1236
|
-
}
|
|
1237
|
-
}, {
|
|
1238
|
-
key: "didDragPreviewOptionsChange",
|
|
1239
|
-
value: function didDragPreviewOptionsChange() {
|
|
1240
|
-
return !shallowEqual(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
|
|
1241
|
-
}
|
|
1242
|
-
}, {
|
|
1243
|
-
key: "disconnectDragSource",
|
|
1244
|
-
value: function disconnectDragSource() {
|
|
1245
|
-
if (this.dragSourceUnsubscribe) {
|
|
1246
|
-
this.dragSourceUnsubscribe();
|
|
1247
|
-
this.dragSourceUnsubscribe = undefined;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
}, {
|
|
1251
|
-
key: "disconnectDragPreview",
|
|
1252
|
-
value: function disconnectDragPreview() {
|
|
1253
|
-
if (this.dragPreviewUnsubscribe) {
|
|
1254
|
-
this.dragPreviewUnsubscribe();
|
|
1255
|
-
this.dragPreviewUnsubscribe = undefined;
|
|
1256
|
-
this.dragPreviewNode = null;
|
|
1257
|
-
this.dragPreviewRef = null;
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}, {
|
|
1261
|
-
key: "dragSource",
|
|
1262
|
-
get: function get() {
|
|
1263
|
-
return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current;
|
|
1264
|
-
}
|
|
1265
|
-
}, {
|
|
1266
|
-
key: "dragPreview",
|
|
1267
|
-
get: function get() {
|
|
1268
|
-
return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current;
|
|
1269
|
-
}
|
|
1270
|
-
}, {
|
|
1271
|
-
key: "clearDragSource",
|
|
1272
|
-
value: function clearDragSource() {
|
|
1273
|
-
this.dragSourceNode = null;
|
|
1274
|
-
this.dragSourceRef = null;
|
|
1275
|
-
}
|
|
1276
|
-
}, {
|
|
1277
|
-
key: "clearDragPreview",
|
|
1278
|
-
value: function clearDragPreview() {
|
|
1279
|
-
this.dragPreviewNode = null;
|
|
1280
|
-
this.dragPreviewRef = null;
|
|
1281
|
-
}
|
|
1282
|
-
}]);
|
|
1283
|
-
|
|
1284
|
-
return SourceConnector;
|
|
1285
|
-
}();
|
|
1286
|
-
|
|
1287
|
-
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1288
|
-
|
|
1289
|
-
function _defineProperties$4(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1290
|
-
|
|
1291
|
-
function _createClass$4(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); if (staticProps) _defineProperties$4(Constructor, staticProps); return Constructor; }
|
|
1292
|
-
|
|
1293
|
-
function _defineProperty$4(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1294
|
-
var TargetConnector = /*#__PURE__*/function () {
|
|
1295
|
-
// The drop target may either be attached via ref or connect function
|
|
1296
|
-
function TargetConnector(backend) {
|
|
1297
|
-
var _this = this;
|
|
1298
|
-
|
|
1299
|
-
_classCallCheck$4(this, TargetConnector);
|
|
1300
|
-
|
|
1301
|
-
_defineProperty$4(this, "hooks", wrapConnectorHooks({
|
|
1302
|
-
dropTarget: function dropTarget(node, options) {
|
|
1303
|
-
_this.clearDropTarget();
|
|
1304
|
-
|
|
1305
|
-
_this.dropTargetOptions = options;
|
|
1306
|
-
|
|
1307
|
-
if (isRef(node)) {
|
|
1308
|
-
_this.dropTargetRef = node;
|
|
1309
|
-
} else {
|
|
1310
|
-
_this.dropTargetNode = node;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
_this.reconnect();
|
|
1314
|
-
}
|
|
1315
|
-
}));
|
|
1316
|
-
|
|
1317
|
-
_defineProperty$4(this, "handlerId", null);
|
|
1318
|
-
|
|
1319
|
-
_defineProperty$4(this, "dropTargetRef", null);
|
|
1320
|
-
|
|
1321
|
-
_defineProperty$4(this, "dropTargetNode", void 0);
|
|
1322
|
-
|
|
1323
|
-
_defineProperty$4(this, "dropTargetOptionsInternal", null);
|
|
1324
|
-
|
|
1325
|
-
_defineProperty$4(this, "unsubscribeDropTarget", void 0);
|
|
1326
|
-
|
|
1327
|
-
_defineProperty$4(this, "lastConnectedHandlerId", null);
|
|
1328
|
-
|
|
1329
|
-
_defineProperty$4(this, "lastConnectedDropTarget", null);
|
|
1330
|
-
|
|
1331
|
-
_defineProperty$4(this, "lastConnectedDropTargetOptions", null);
|
|
1332
|
-
|
|
1333
|
-
_defineProperty$4(this, "backend", void 0);
|
|
1334
|
-
|
|
1335
|
-
this.backend = backend;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
_createClass$4(TargetConnector, [{
|
|
1339
|
-
key: "connectTarget",
|
|
1340
|
-
get: function get() {
|
|
1341
|
-
return this.dropTarget;
|
|
1342
|
-
}
|
|
1343
|
-
}, {
|
|
1344
|
-
key: "reconnect",
|
|
1345
|
-
value: function reconnect() {
|
|
1346
|
-
// if nothing has changed then don't resubscribe
|
|
1347
|
-
var didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();
|
|
1348
|
-
|
|
1349
|
-
if (didChange) {
|
|
1350
|
-
this.disconnectDropTarget();
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
var dropTarget = this.dropTarget;
|
|
1354
|
-
|
|
1355
|
-
if (!this.handlerId) {
|
|
1356
|
-
return;
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
if (!dropTarget) {
|
|
1360
|
-
this.lastConnectedDropTarget = dropTarget;
|
|
1361
|
-
return;
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
if (didChange) {
|
|
1365
|
-
this.lastConnectedHandlerId = this.handlerId;
|
|
1366
|
-
this.lastConnectedDropTarget = dropTarget;
|
|
1367
|
-
this.lastConnectedDropTargetOptions = this.dropTargetOptions;
|
|
1368
|
-
this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
}, {
|
|
1372
|
-
key: "receiveHandlerId",
|
|
1373
|
-
value: function receiveHandlerId(newHandlerId) {
|
|
1374
|
-
if (newHandlerId === this.handlerId) {
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
this.handlerId = newHandlerId;
|
|
1379
|
-
this.reconnect();
|
|
1380
|
-
}
|
|
1381
|
-
}, {
|
|
1382
|
-
key: "dropTargetOptions",
|
|
1383
|
-
get: function get() {
|
|
1384
|
-
return this.dropTargetOptionsInternal;
|
|
1385
|
-
},
|
|
1386
|
-
set: function set(options) {
|
|
1387
|
-
this.dropTargetOptionsInternal = options;
|
|
1388
|
-
}
|
|
1389
|
-
}, {
|
|
1390
|
-
key: "didHandlerIdChange",
|
|
1391
|
-
value: function didHandlerIdChange() {
|
|
1392
|
-
return this.lastConnectedHandlerId !== this.handlerId;
|
|
1393
|
-
}
|
|
1394
|
-
}, {
|
|
1395
|
-
key: "didDropTargetChange",
|
|
1396
|
-
value: function didDropTargetChange() {
|
|
1397
|
-
return this.lastConnectedDropTarget !== this.dropTarget;
|
|
1398
|
-
}
|
|
1399
|
-
}, {
|
|
1400
|
-
key: "didOptionsChange",
|
|
1401
|
-
value: function didOptionsChange() {
|
|
1402
|
-
return !shallowEqual(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
|
|
1403
|
-
}
|
|
1404
|
-
}, {
|
|
1405
|
-
key: "disconnectDropTarget",
|
|
1406
|
-
value: function disconnectDropTarget() {
|
|
1407
|
-
if (this.unsubscribeDropTarget) {
|
|
1408
|
-
this.unsubscribeDropTarget();
|
|
1409
|
-
this.unsubscribeDropTarget = undefined;
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
}, {
|
|
1413
|
-
key: "dropTarget",
|
|
1414
|
-
get: function get() {
|
|
1415
|
-
return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;
|
|
1416
|
-
}
|
|
1417
|
-
}, {
|
|
1418
|
-
key: "clearDropTarget",
|
|
1419
|
-
value: function clearDropTarget() {
|
|
1420
|
-
this.dropTargetRef = null;
|
|
1421
|
-
this.dropTargetNode = null;
|
|
1422
|
-
}
|
|
1423
|
-
}]);
|
|
1424
|
-
|
|
1425
|
-
return TargetConnector;
|
|
1426
|
-
}();
|
|
1427
|
-
|
|
1428
|
-
function registerTarget(type, target, manager) {
|
|
1429
|
-
var registry = manager.getRegistry();
|
|
1430
|
-
var targetId = registry.addTarget(type, target);
|
|
1431
|
-
return [targetId, function () {
|
|
1432
|
-
return registry.removeTarget(targetId);
|
|
1433
|
-
}];
|
|
1434
|
-
}
|
|
1435
|
-
function registerSource(type, source, manager) {
|
|
1436
|
-
var registry = manager.getRegistry();
|
|
1437
|
-
var sourceId = registry.addSource(type, source);
|
|
1438
|
-
return [sourceId, function () {
|
|
1439
|
-
return registry.removeSource(sourceId);
|
|
1440
|
-
}];
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
|
|
1444
|
-
|
|
1445
|
-
function getDecoratedComponent(instanceRef) {
|
|
1446
|
-
var currentRef = instanceRef.current;
|
|
1447
|
-
|
|
1448
|
-
if (currentRef == null) {
|
|
1449
|
-
return null;
|
|
1450
|
-
} else if (currentRef.decoratedRef) {
|
|
1451
|
-
// go through the private field in decorateHandler to avoid the invariant hit
|
|
1452
|
-
return currentRef.decoratedRef.current;
|
|
1453
|
-
} else {
|
|
1454
|
-
return currentRef;
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
function isClassComponent(Component) {
|
|
1458
|
-
return Component && Component.prototype && typeof Component.prototype.render === 'function';
|
|
1459
|
-
}
|
|
1460
|
-
function isRefForwardingComponent(C) {
|
|
1461
|
-
var _item$$$typeof;
|
|
1462
|
-
|
|
1463
|
-
var item = C;
|
|
1464
|
-
return (item === null || item === void 0 ? void 0 : (_item$$$typeof = item.$$typeof) === null || _item$$$typeof === void 0 ? void 0 : _item$$$typeof.toString()) === 'Symbol(react.forward_ref)';
|
|
1465
|
-
}
|
|
1466
|
-
function isRefable(C) {
|
|
1467
|
-
return isClassComponent(C) || isRefForwardingComponent(C);
|
|
1468
|
-
}
|
|
1469
|
-
function checkDecoratorArguments(functionName, signature) {
|
|
1470
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1471
|
-
for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) {
|
|
1472
|
-
var arg = i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2];
|
|
1473
|
-
|
|
1474
|
-
if (arg && arg.prototype && arg.prototype.render) {
|
|
1475
|
-
// eslint-disable-next-line no-console
|
|
1476
|
-
console.error('You seem to be applying the arguments in the wrong order. ' + "It should be ".concat(functionName, "(").concat(signature, ")(Component), not the other way around. ") + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#you-seem-to-be-applying-the-arguments-in-the-wrong-order');
|
|
1477
|
-
return;
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
function isFunction(input) {
|
|
1483
|
-
return typeof input === 'function';
|
|
1484
|
-
}
|
|
1485
|
-
function noop() {// noop
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
function isObjectLike(input) {
|
|
1489
|
-
return _typeof$1(input) === 'object' && input !== null;
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
function isPlainObject(input) {
|
|
1493
|
-
if (!isObjectLike(input)) {
|
|
1494
|
-
return false;
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
1498
|
-
return true;
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
var proto = input;
|
|
1502
|
-
|
|
1503
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
1504
|
-
proto = Object.getPrototypeOf(proto);
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
return Object.getPrototypeOf(input) === proto;
|
|
1508
|
-
}
|
|
1509
|
-
function isValidType(type, allowArray) {
|
|
1510
|
-
return typeof type === 'string' || _typeof$1(type) === 'symbol' || !!allowArray && Array.isArray(type) && type.every(function (t) {
|
|
1511
|
-
return isValidType(t, false);
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1516
|
-
|
|
1517
|
-
function _defineProperties$3(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1518
|
-
|
|
1519
|
-
function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); if (staticProps) _defineProperties$3(Constructor, staticProps); return Constructor; }
|
|
1520
|
-
|
|
1521
|
-
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1522
|
-
/**
|
|
1523
|
-
* Provides a set of static methods for creating Disposables.
|
|
1524
|
-
* @param {Function} action Action to run during the first call to dispose.
|
|
1525
|
-
* The action is guaranteed to be run at most once.
|
|
1526
|
-
*/
|
|
1527
|
-
|
|
1528
|
-
var Disposable = /*#__PURE__*/function () {
|
|
1529
|
-
function Disposable(action) {
|
|
1530
|
-
_classCallCheck$3(this, Disposable);
|
|
1531
|
-
|
|
1532
|
-
_defineProperty$3(this, "isDisposed", false);
|
|
1533
|
-
|
|
1534
|
-
_defineProperty$3(this, "action", void 0);
|
|
1535
|
-
|
|
1536
|
-
this.action = isFunction(action) ? action : noop;
|
|
1537
|
-
}
|
|
1538
|
-
/** Performs the task of cleaning up resources. */
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
_createClass$3(Disposable, [{
|
|
1542
|
-
key: "dispose",
|
|
1543
|
-
value: function dispose() {
|
|
1544
|
-
if (!this.isDisposed) {
|
|
1545
|
-
this.action();
|
|
1546
|
-
this.isDisposed = true;
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
}], [{
|
|
1550
|
-
key: "isDisposable",
|
|
1551
|
-
value:
|
|
1552
|
-
/**
|
|
1553
|
-
* Gets the disposable that does nothing when disposed.
|
|
1554
|
-
*/
|
|
1555
|
-
|
|
1556
|
-
/**
|
|
1557
|
-
* Validates whether the given object is a disposable
|
|
1558
|
-
* @param {Object} Object to test whether it has a dispose method
|
|
1559
|
-
* @returns {Boolean} true if a disposable object, else false.
|
|
1560
|
-
*/
|
|
1561
|
-
function isDisposable(d) {
|
|
1562
|
-
return Boolean(d && isFunction(d.dispose));
|
|
1563
|
-
}
|
|
1564
|
-
}, {
|
|
1565
|
-
key: "_fixup",
|
|
1566
|
-
value: function _fixup(result) {
|
|
1567
|
-
return Disposable.isDisposable(result) ? result : Disposable.empty;
|
|
1568
|
-
}
|
|
1569
|
-
/**
|
|
1570
|
-
* Creates a disposable object that invokes the specified action when disposed.
|
|
1571
|
-
* @param {Function} dispose Action to run during the first call to dispose.
|
|
1572
|
-
* The action is guaranteed to be run at most once.
|
|
1573
|
-
* @return {Disposable} The disposable object that runs the given action upon disposal.
|
|
1574
|
-
*/
|
|
1575
|
-
|
|
1576
|
-
}, {
|
|
1577
|
-
key: "create",
|
|
1578
|
-
value: function create(action) {
|
|
1579
|
-
return new Disposable(action);
|
|
1580
|
-
}
|
|
1581
|
-
}]);
|
|
1582
|
-
|
|
1583
|
-
return Disposable;
|
|
1584
|
-
}();
|
|
1585
|
-
/**
|
|
1586
|
-
* Represents a group of disposable resources that are disposed together.
|
|
1587
|
-
* @constructor
|
|
1588
|
-
*/
|
|
1589
|
-
|
|
1590
|
-
_defineProperty$3(Disposable, "empty", {
|
|
1591
|
-
dispose: noop
|
|
1592
|
-
});
|
|
1593
|
-
|
|
1594
|
-
var CompositeDisposable = /*#__PURE__*/function () {
|
|
1595
|
-
function CompositeDisposable() {
|
|
1596
|
-
_classCallCheck$3(this, CompositeDisposable);
|
|
1597
|
-
|
|
1598
|
-
_defineProperty$3(this, "isDisposed", false);
|
|
1599
|
-
|
|
1600
|
-
_defineProperty$3(this, "disposables", void 0);
|
|
1601
|
-
|
|
1602
|
-
for (var _len = arguments.length, disposables = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1603
|
-
disposables[_key] = arguments[_key];
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
this.disposables = disposables;
|
|
1607
|
-
}
|
|
1608
|
-
/**
|
|
1609
|
-
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
|
|
1610
|
-
* @param {Any} item Disposable to add.
|
|
1611
|
-
*/
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
_createClass$3(CompositeDisposable, [{
|
|
1615
|
-
key: "add",
|
|
1616
|
-
value: function add(item) {
|
|
1617
|
-
if (this.isDisposed) {
|
|
1618
|
-
item.dispose();
|
|
1619
|
-
} else {
|
|
1620
|
-
this.disposables.push(item);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
/**
|
|
1624
|
-
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
|
|
1625
|
-
* @param {Any} item Disposable to remove.
|
|
1626
|
-
* @returns {Boolean} true if found; false otherwise.
|
|
1627
|
-
*/
|
|
1628
|
-
|
|
1629
|
-
}, {
|
|
1630
|
-
key: "remove",
|
|
1631
|
-
value: function remove(item) {
|
|
1632
|
-
var shouldDispose = false;
|
|
1633
|
-
|
|
1634
|
-
if (!this.isDisposed) {
|
|
1635
|
-
var idx = this.disposables.indexOf(item);
|
|
1636
|
-
|
|
1637
|
-
if (idx !== -1) {
|
|
1638
|
-
shouldDispose = true;
|
|
1639
|
-
this.disposables.splice(idx, 1);
|
|
1640
|
-
item.dispose();
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
return shouldDispose;
|
|
1645
|
-
}
|
|
1646
|
-
/**
|
|
1647
|
-
* Disposes all disposables in the group and removes them from the group but
|
|
1648
|
-
* does not dispose the CompositeDisposable.
|
|
1649
|
-
*/
|
|
1650
|
-
|
|
1651
|
-
}, {
|
|
1652
|
-
key: "clear",
|
|
1653
|
-
value: function clear() {
|
|
1654
|
-
if (!this.isDisposed) {
|
|
1655
|
-
var len = this.disposables.length;
|
|
1656
|
-
var currentDisposables = new Array(len);
|
|
1657
|
-
|
|
1658
|
-
for (var i = 0; i < len; i++) {
|
|
1659
|
-
currentDisposables[i] = this.disposables[i];
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
this.disposables = [];
|
|
1663
|
-
|
|
1664
|
-
for (var _i = 0; _i < len; _i++) {
|
|
1665
|
-
currentDisposables[_i].dispose();
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
/**
|
|
1670
|
-
* Disposes all disposables in the group and removes them from the group.
|
|
1671
|
-
*/
|
|
1672
|
-
|
|
1673
|
-
}, {
|
|
1674
|
-
key: "dispose",
|
|
1675
|
-
value: function dispose() {
|
|
1676
|
-
if (!this.isDisposed) {
|
|
1677
|
-
this.isDisposed = true;
|
|
1678
|
-
var len = this.disposables.length;
|
|
1679
|
-
var currentDisposables = new Array(len);
|
|
1680
|
-
|
|
1681
|
-
for (var i = 0; i < len; i++) {
|
|
1682
|
-
currentDisposables[i] = this.disposables[i];
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
this.disposables = [];
|
|
1686
|
-
|
|
1687
|
-
for (var _i2 = 0; _i2 < len; _i2++) {
|
|
1688
|
-
currentDisposables[_i2].dispose();
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
}]);
|
|
1693
|
-
|
|
1694
|
-
return CompositeDisposable;
|
|
1695
|
-
}();
|
|
1696
|
-
/**
|
|
1697
|
-
* Represents a disposable resource whose underlying disposable resource can
|
|
1698
|
-
* be replaced by another disposable resource, causing automatic disposal of
|
|
1699
|
-
* the previous underlying disposable resource.
|
|
1700
|
-
*/
|
|
1701
|
-
|
|
1702
|
-
var SerialDisposable = /*#__PURE__*/function () {
|
|
1703
|
-
function SerialDisposable() {
|
|
1704
|
-
_classCallCheck$3(this, SerialDisposable);
|
|
1705
|
-
|
|
1706
|
-
_defineProperty$3(this, "isDisposed", false);
|
|
1707
|
-
|
|
1708
|
-
_defineProperty$3(this, "current", void 0);
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
_createClass$3(SerialDisposable, [{
|
|
1712
|
-
key: "getDisposable",
|
|
1713
|
-
value:
|
|
1714
|
-
/**
|
|
1715
|
-
* Gets the underlying disposable.
|
|
1716
|
-
* @returns {Any} the underlying disposable.
|
|
1717
|
-
*/
|
|
1718
|
-
function getDisposable() {
|
|
1719
|
-
return this.current;
|
|
1720
|
-
}
|
|
1721
|
-
}, {
|
|
1722
|
-
key: "setDisposable",
|
|
1723
|
-
value: function setDisposable(value) {
|
|
1724
|
-
var shouldDispose = this.isDisposed;
|
|
1725
|
-
|
|
1726
|
-
if (!shouldDispose) {
|
|
1727
|
-
var old = this.current;
|
|
1728
|
-
this.current = value;
|
|
1729
|
-
|
|
1730
|
-
if (old) {
|
|
1731
|
-
old.dispose();
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
if (shouldDispose && value) {
|
|
1736
|
-
value.dispose();
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
/** Performs the task of cleaning up resources. */
|
|
1740
|
-
|
|
1741
|
-
}, {
|
|
1742
|
-
key: "dispose",
|
|
1743
|
-
value: function dispose() {
|
|
1744
|
-
if (!this.isDisposed) {
|
|
1745
|
-
this.isDisposed = true;
|
|
1746
|
-
var old = this.current;
|
|
1747
|
-
this.current = undefined;
|
|
1748
|
-
|
|
1749
|
-
if (old) {
|
|
1750
|
-
old.dispose();
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
}]);
|
|
1755
|
-
|
|
1756
|
-
return SerialDisposable;
|
|
1757
|
-
}();
|
|
1758
|
-
|
|
1759
|
-
var reactIs$1 = {exports: {}};
|
|
1760
|
-
|
|
1761
|
-
var reactIs_production_min = {};
|
|
1762
|
-
|
|
1763
|
-
/** @license React v16.13.1
|
|
1764
|
-
* react-is.production.min.js
|
|
1765
|
-
*
|
|
1766
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1767
|
-
*
|
|
1768
|
-
* This source code is licensed under the MIT license found in the
|
|
1769
|
-
* LICENSE file in the root directory of this source tree.
|
|
1770
|
-
*/
|
|
1771
|
-
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
1772
|
-
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
1773
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
1774
|
-
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
1775
|
-
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
1776
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
1777
|
-
|
|
1778
|
-
var reactIs_development = {};
|
|
1779
|
-
|
|
1780
|
-
/** @license React v16.13.1
|
|
1781
|
-
* react-is.development.js
|
|
1782
|
-
*
|
|
1783
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1784
|
-
*
|
|
1785
|
-
* This source code is licensed under the MIT license found in the
|
|
1786
|
-
* LICENSE file in the root directory of this source tree.
|
|
1787
|
-
*/
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1792
|
-
(function() {
|
|
1793
|
-
|
|
1794
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
1795
|
-
// nor polyfill, then a plain number is used for performance.
|
|
1796
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
1797
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
1798
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
1799
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
1800
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
1801
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
1802
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
1803
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
1804
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
1805
|
-
|
|
1806
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
1807
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
1808
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
1809
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
1810
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
1811
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
1812
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
1813
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
1814
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
1815
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
1816
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
1817
|
-
|
|
1818
|
-
function isValidElementType(type) {
|
|
1819
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1820
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
function typeOf(object) {
|
|
1824
|
-
if (typeof object === 'object' && object !== null) {
|
|
1825
|
-
var $$typeof = object.$$typeof;
|
|
1826
|
-
|
|
1827
|
-
switch ($$typeof) {
|
|
1828
|
-
case REACT_ELEMENT_TYPE:
|
|
1829
|
-
var type = object.type;
|
|
1830
|
-
|
|
1831
|
-
switch (type) {
|
|
1832
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
1833
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
1834
|
-
case REACT_FRAGMENT_TYPE:
|
|
1835
|
-
case REACT_PROFILER_TYPE:
|
|
1836
|
-
case REACT_STRICT_MODE_TYPE:
|
|
1837
|
-
case REACT_SUSPENSE_TYPE:
|
|
1838
|
-
return type;
|
|
1839
|
-
|
|
1840
|
-
default:
|
|
1841
|
-
var $$typeofType = type && type.$$typeof;
|
|
1842
|
-
|
|
1843
|
-
switch ($$typeofType) {
|
|
1844
|
-
case REACT_CONTEXT_TYPE:
|
|
1845
|
-
case REACT_FORWARD_REF_TYPE:
|
|
1846
|
-
case REACT_LAZY_TYPE:
|
|
1847
|
-
case REACT_MEMO_TYPE:
|
|
1848
|
-
case REACT_PROVIDER_TYPE:
|
|
1849
|
-
return $$typeofType;
|
|
1850
|
-
|
|
1851
|
-
default:
|
|
1852
|
-
return $$typeof;
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
case REACT_PORTAL_TYPE:
|
|
1858
|
-
return $$typeof;
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
return undefined;
|
|
1863
|
-
} // AsyncMode is deprecated along with isAsyncMode
|
|
1864
|
-
|
|
1865
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
1866
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
1867
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
1868
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
1869
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
1870
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
1871
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
1872
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
1873
|
-
var Memo = REACT_MEMO_TYPE;
|
|
1874
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
1875
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
1876
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1877
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
1878
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
1879
|
-
|
|
1880
|
-
function isAsyncMode(object) {
|
|
1881
|
-
{
|
|
1882
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
1883
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1884
|
-
|
|
1885
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
1890
|
-
}
|
|
1891
|
-
function isConcurrentMode(object) {
|
|
1892
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
1893
|
-
}
|
|
1894
|
-
function isContextConsumer(object) {
|
|
1895
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
1896
|
-
}
|
|
1897
|
-
function isContextProvider(object) {
|
|
1898
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
1899
|
-
}
|
|
1900
|
-
function isElement(object) {
|
|
1901
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1902
|
-
}
|
|
1903
|
-
function isForwardRef(object) {
|
|
1904
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
1905
|
-
}
|
|
1906
|
-
function isFragment(object) {
|
|
1907
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
1908
|
-
}
|
|
1909
|
-
function isLazy(object) {
|
|
1910
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
1911
|
-
}
|
|
1912
|
-
function isMemo(object) {
|
|
1913
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
1914
|
-
}
|
|
1915
|
-
function isPortal(object) {
|
|
1916
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
1917
|
-
}
|
|
1918
|
-
function isProfiler(object) {
|
|
1919
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
1920
|
-
}
|
|
1921
|
-
function isStrictMode(object) {
|
|
1922
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
1923
|
-
}
|
|
1924
|
-
function isSuspense(object) {
|
|
1925
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
1929
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
1930
|
-
reactIs_development.ContextConsumer = ContextConsumer;
|
|
1931
|
-
reactIs_development.ContextProvider = ContextProvider;
|
|
1932
|
-
reactIs_development.Element = Element;
|
|
1933
|
-
reactIs_development.ForwardRef = ForwardRef;
|
|
1934
|
-
reactIs_development.Fragment = Fragment;
|
|
1935
|
-
reactIs_development.Lazy = Lazy;
|
|
1936
|
-
reactIs_development.Memo = Memo;
|
|
1937
|
-
reactIs_development.Portal = Portal;
|
|
1938
|
-
reactIs_development.Profiler = Profiler;
|
|
1939
|
-
reactIs_development.StrictMode = StrictMode;
|
|
1940
|
-
reactIs_development.Suspense = Suspense;
|
|
1941
|
-
reactIs_development.isAsyncMode = isAsyncMode;
|
|
1942
|
-
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
1943
|
-
reactIs_development.isContextConsumer = isContextConsumer;
|
|
1944
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
1945
|
-
reactIs_development.isElement = isElement;
|
|
1946
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
1947
|
-
reactIs_development.isFragment = isFragment;
|
|
1948
|
-
reactIs_development.isLazy = isLazy;
|
|
1949
|
-
reactIs_development.isMemo = isMemo;
|
|
1950
|
-
reactIs_development.isPortal = isPortal;
|
|
1951
|
-
reactIs_development.isProfiler = isProfiler;
|
|
1952
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
1953
|
-
reactIs_development.isSuspense = isSuspense;
|
|
1954
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
1955
|
-
reactIs_development.typeOf = typeOf;
|
|
1956
|
-
})();
|
|
1957
|
-
}
|
|
1958
|
-
|
|
1959
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1960
|
-
reactIs$1.exports = reactIs_production_min;
|
|
1961
|
-
} else {
|
|
1962
|
-
reactIs$1.exports = reactIs_development;
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
var reactIs = reactIs$1.exports;
|
|
1966
|
-
|
|
1967
|
-
/**
|
|
1968
|
-
* Copyright 2015, Yahoo! Inc.
|
|
1969
|
-
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
1970
|
-
*/
|
|
1971
|
-
var REACT_STATICS = {
|
|
1972
|
-
childContextTypes: true,
|
|
1973
|
-
contextType: true,
|
|
1974
|
-
contextTypes: true,
|
|
1975
|
-
defaultProps: true,
|
|
1976
|
-
displayName: true,
|
|
1977
|
-
getDefaultProps: true,
|
|
1978
|
-
getDerivedStateFromError: true,
|
|
1979
|
-
getDerivedStateFromProps: true,
|
|
1980
|
-
mixins: true,
|
|
1981
|
-
propTypes: true,
|
|
1982
|
-
type: true
|
|
1983
|
-
};
|
|
1984
|
-
var KNOWN_STATICS = {
|
|
1985
|
-
name: true,
|
|
1986
|
-
length: true,
|
|
1987
|
-
prototype: true,
|
|
1988
|
-
caller: true,
|
|
1989
|
-
callee: true,
|
|
1990
|
-
arguments: true,
|
|
1991
|
-
arity: true
|
|
1992
|
-
};
|
|
1993
|
-
var FORWARD_REF_STATICS = {
|
|
1994
|
-
'$$typeof': true,
|
|
1995
|
-
render: true,
|
|
1996
|
-
defaultProps: true,
|
|
1997
|
-
displayName: true,
|
|
1998
|
-
propTypes: true
|
|
1999
|
-
};
|
|
2000
|
-
var MEMO_STATICS = {
|
|
2001
|
-
'$$typeof': true,
|
|
2002
|
-
compare: true,
|
|
2003
|
-
defaultProps: true,
|
|
2004
|
-
displayName: true,
|
|
2005
|
-
propTypes: true,
|
|
2006
|
-
type: true
|
|
2007
|
-
};
|
|
2008
|
-
var TYPE_STATICS = {};
|
|
2009
|
-
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
2010
|
-
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
2011
|
-
|
|
2012
|
-
function getStatics(component) {
|
|
2013
|
-
// React v16.11 and below
|
|
2014
|
-
if (reactIs.isMemo(component)) {
|
|
2015
|
-
return MEMO_STATICS;
|
|
2016
|
-
} // React v16.12 and above
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
var defineProperty = Object.defineProperty;
|
|
2023
|
-
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
2024
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2025
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
2026
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
|
2027
|
-
var objectPrototype = Object.prototype;
|
|
2028
|
-
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
2029
|
-
if (typeof sourceComponent !== 'string') {
|
|
2030
|
-
// don't hoist over string (html) components
|
|
2031
|
-
if (objectPrototype) {
|
|
2032
|
-
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
2033
|
-
|
|
2034
|
-
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
2035
|
-
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
var keys = getOwnPropertyNames(sourceComponent);
|
|
2040
|
-
|
|
2041
|
-
if (getOwnPropertySymbols) {
|
|
2042
|
-
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
var targetStatics = getStatics(targetComponent);
|
|
2046
|
-
var sourceStatics = getStatics(sourceComponent);
|
|
2047
|
-
|
|
2048
|
-
for (var i = 0; i < keys.length; ++i) {
|
|
2049
|
-
var key = keys[i];
|
|
2050
|
-
|
|
2051
|
-
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
2052
|
-
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
2053
|
-
|
|
2054
|
-
try {
|
|
2055
|
-
// Avoid failures from read-only properties
|
|
2056
|
-
defineProperty(targetComponent, key, descriptor);
|
|
2057
|
-
} catch (e) {}
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
return targetComponent;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
var hoistNonReactStatics_cjs = hoistNonReactStatics;
|
|
2066
|
-
|
|
2067
|
-
var hoistStatics = hoistNonReactStatics_cjs;
|
|
2068
|
-
|
|
2069
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2070
|
-
|
|
2071
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2072
|
-
|
|
2073
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2074
|
-
|
|
2075
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
2076
|
-
|
|
2077
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
2078
|
-
|
|
2079
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
2080
|
-
|
|
2081
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2082
|
-
|
|
2083
|
-
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2084
|
-
|
|
2085
|
-
function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2086
|
-
|
|
2087
|
-
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); return Constructor; }
|
|
2088
|
-
|
|
2089
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
2090
|
-
|
|
2091
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
2092
|
-
|
|
2093
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2094
|
-
|
|
2095
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
2096
|
-
|
|
2097
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2098
|
-
|
|
2099
|
-
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; } }
|
|
2100
|
-
|
|
2101
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
2102
|
-
|
|
2103
|
-
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2104
|
-
function decorateHandler(_ref) {
|
|
2105
|
-
var DecoratedComponent = _ref.DecoratedComponent,
|
|
2106
|
-
createHandler = _ref.createHandler,
|
|
2107
|
-
createMonitor = _ref.createMonitor,
|
|
2108
|
-
createConnector = _ref.createConnector,
|
|
2109
|
-
registerHandler = _ref.registerHandler,
|
|
2110
|
-
containerDisplayName = _ref.containerDisplayName,
|
|
2111
|
-
getType = _ref.getType,
|
|
2112
|
-
collect = _ref.collect,
|
|
2113
|
-
options = _ref.options;
|
|
2114
|
-
var _options$arePropsEqua = options.arePropsEqual,
|
|
2115
|
-
arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;
|
|
2116
|
-
var Decorated = DecoratedComponent;
|
|
2117
|
-
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
|
|
2118
|
-
|
|
2119
|
-
var DragDropContainer = /*#__PURE__*/function (_Component) {
|
|
2120
|
-
_inherits(DragDropContainer, _Component);
|
|
2121
|
-
|
|
2122
|
-
var _super = _createSuper(DragDropContainer);
|
|
2123
|
-
|
|
2124
|
-
function DragDropContainer(props) {
|
|
2125
|
-
var _this;
|
|
2126
|
-
|
|
2127
|
-
_classCallCheck$2(this, DragDropContainer);
|
|
2128
|
-
|
|
2129
|
-
_this = _super.call(this, props);
|
|
2130
|
-
|
|
2131
|
-
_defineProperty$2(_assertThisInitialized(_this), "decoratedRef", createRef());
|
|
2132
|
-
|
|
2133
|
-
_defineProperty$2(_assertThisInitialized(_this), "handlerId", void 0);
|
|
2134
|
-
|
|
2135
|
-
_defineProperty$2(_assertThisInitialized(_this), "manager", void 0);
|
|
2136
|
-
|
|
2137
|
-
_defineProperty$2(_assertThisInitialized(_this), "handlerMonitor", void 0);
|
|
2138
|
-
|
|
2139
|
-
_defineProperty$2(_assertThisInitialized(_this), "handlerConnector", void 0);
|
|
2140
|
-
|
|
2141
|
-
_defineProperty$2(_assertThisInitialized(_this), "handler", void 0);
|
|
2142
|
-
|
|
2143
|
-
_defineProperty$2(_assertThisInitialized(_this), "disposable", void 0);
|
|
2144
|
-
|
|
2145
|
-
_defineProperty$2(_assertThisInitialized(_this), "currentType", void 0);
|
|
2146
|
-
|
|
2147
|
-
_defineProperty$2(_assertThisInitialized(_this), "handleChange", function () {
|
|
2148
|
-
var nextState = _this.getCurrentState();
|
|
2149
|
-
|
|
2150
|
-
if (!shallowEqual(nextState, _this.state)) {
|
|
2151
|
-
_this.setState(nextState);
|
|
2152
|
-
}
|
|
2153
|
-
});
|
|
2154
|
-
|
|
2155
|
-
_this.disposable = new SerialDisposable();
|
|
2156
|
-
|
|
2157
|
-
_this.receiveProps(props);
|
|
2158
|
-
|
|
2159
|
-
_this.dispose();
|
|
2160
|
-
|
|
2161
|
-
return _this;
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
_createClass$2(DragDropContainer, [{
|
|
2165
|
-
key: "getHandlerId",
|
|
2166
|
-
value: function getHandlerId() {
|
|
2167
|
-
return this.handlerId;
|
|
2168
|
-
}
|
|
2169
|
-
}, {
|
|
2170
|
-
key: "getDecoratedComponentInstance",
|
|
2171
|
-
value: function getDecoratedComponentInstance() {
|
|
2172
|
-
invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
|
|
2173
|
-
return this.decoratedRef.current;
|
|
2174
|
-
}
|
|
2175
|
-
}, {
|
|
2176
|
-
key: "shouldComponentUpdate",
|
|
2177
|
-
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
2178
|
-
return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);
|
|
2179
|
-
}
|
|
2180
|
-
}, {
|
|
2181
|
-
key: "componentDidMount",
|
|
2182
|
-
value: function componentDidMount() {
|
|
2183
|
-
this.disposable = new SerialDisposable();
|
|
2184
|
-
this.currentType = undefined;
|
|
2185
|
-
this.receiveProps(this.props);
|
|
2186
|
-
this.handleChange();
|
|
2187
|
-
}
|
|
2188
|
-
}, {
|
|
2189
|
-
key: "componentDidUpdate",
|
|
2190
|
-
value: function componentDidUpdate(prevProps) {
|
|
2191
|
-
if (!arePropsEqual(this.props, prevProps)) {
|
|
2192
|
-
this.receiveProps(this.props);
|
|
2193
|
-
this.handleChange();
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
}, {
|
|
2197
|
-
key: "componentWillUnmount",
|
|
2198
|
-
value: function componentWillUnmount() {
|
|
2199
|
-
this.dispose();
|
|
2200
|
-
}
|
|
2201
|
-
}, {
|
|
2202
|
-
key: "receiveProps",
|
|
2203
|
-
value: function receiveProps(props) {
|
|
2204
|
-
if (!this.handler) {
|
|
2205
|
-
return;
|
|
2206
|
-
}
|
|
2207
|
-
|
|
2208
|
-
this.handler.receiveProps(props);
|
|
2209
|
-
this.receiveType(getType(props));
|
|
2210
|
-
}
|
|
2211
|
-
}, {
|
|
2212
|
-
key: "receiveType",
|
|
2213
|
-
value: function receiveType(type) {
|
|
2214
|
-
if (!this.handlerMonitor || !this.manager || !this.handlerConnector) {
|
|
2215
|
-
return;
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
if (type === this.currentType) {
|
|
2219
|
-
return;
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
this.currentType = type;
|
|
2223
|
-
|
|
2224
|
-
var _registerHandler = registerHandler(type, this.handler, this.manager),
|
|
2225
|
-
_registerHandler2 = _slicedToArray(_registerHandler, 2),
|
|
2226
|
-
handlerId = _registerHandler2[0],
|
|
2227
|
-
unregister = _registerHandler2[1];
|
|
2228
|
-
|
|
2229
|
-
this.handlerId = handlerId;
|
|
2230
|
-
this.handlerMonitor.receiveHandlerId(handlerId);
|
|
2231
|
-
this.handlerConnector.receiveHandlerId(handlerId);
|
|
2232
|
-
var globalMonitor = this.manager.getMonitor();
|
|
2233
|
-
var unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, {
|
|
2234
|
-
handlerIds: [handlerId]
|
|
2235
|
-
});
|
|
2236
|
-
this.disposable.setDisposable(new CompositeDisposable(new Disposable(unsubscribe), new Disposable(unregister)));
|
|
2237
|
-
}
|
|
2238
|
-
}, {
|
|
2239
|
-
key: "dispose",
|
|
2240
|
-
value: function dispose() {
|
|
2241
|
-
this.disposable.dispose();
|
|
2242
|
-
|
|
2243
|
-
if (this.handlerConnector) {
|
|
2244
|
-
this.handlerConnector.receiveHandlerId(null);
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
}, {
|
|
2248
|
-
key: "getCurrentState",
|
|
2249
|
-
value: function getCurrentState() {
|
|
2250
|
-
if (!this.handlerConnector) {
|
|
2251
|
-
return {};
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
|
-
var nextState = collect(this.handlerConnector.hooks, this.handlerMonitor, this.props);
|
|
2255
|
-
|
|
2256
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2257
|
-
invariant(isPlainObject(nextState), 'Expected `collect` specified as the second argument to ' + '%s for %s to return a plain object of props to inject. ' + 'Instead, received %s.', containerDisplayName, displayName, nextState);
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
return nextState;
|
|
2261
|
-
}
|
|
2262
|
-
}, {
|
|
2263
|
-
key: "render",
|
|
2264
|
-
value: function render() {
|
|
2265
|
-
var _this2 = this;
|
|
2266
|
-
|
|
2267
|
-
return jsx(DndContext.Consumer, {
|
|
2268
|
-
children: function children(_ref2) {
|
|
2269
|
-
var dragDropManager = _ref2.dragDropManager;
|
|
2270
|
-
|
|
2271
|
-
_this2.receiveDragDropManager(dragDropManager);
|
|
2272
|
-
|
|
2273
|
-
if (typeof requestAnimationFrame !== 'undefined') {
|
|
2274
|
-
requestAnimationFrame(function () {
|
|
2275
|
-
var _this2$handlerConnect;
|
|
2276
|
-
|
|
2277
|
-
return (_this2$handlerConnect = _this2.handlerConnector) === null || _this2$handlerConnect === void 0 ? void 0 : _this2$handlerConnect.reconnect();
|
|
2278
|
-
});
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
return jsx(Decorated, Object.assign({}, _this2.props, _this2.getCurrentState(), {
|
|
2282
|
-
// NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.
|
|
2283
|
-
ref: isRefable(Decorated) ? _this2.decoratedRef : null
|
|
2284
|
-
}), void 0);
|
|
2285
|
-
}
|
|
2286
|
-
}, void 0);
|
|
2287
|
-
}
|
|
2288
|
-
}, {
|
|
2289
|
-
key: "receiveDragDropManager",
|
|
2290
|
-
value: function receiveDragDropManager(dragDropManager) {
|
|
2291
|
-
if (this.manager !== undefined) {
|
|
2292
|
-
return;
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
invariant(dragDropManager !== undefined, 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
|
|
2296
|
-
|
|
2297
|
-
if (dragDropManager === undefined) {
|
|
2298
|
-
return;
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
|
-
this.manager = dragDropManager;
|
|
2302
|
-
this.handlerMonitor = createMonitor(dragDropManager);
|
|
2303
|
-
this.handlerConnector = createConnector(dragDropManager.getBackend());
|
|
2304
|
-
this.handler = createHandler(this.handlerMonitor, this.decoratedRef);
|
|
2305
|
-
}
|
|
2306
|
-
}]);
|
|
2307
|
-
|
|
2308
|
-
return DragDropContainer;
|
|
2309
|
-
}(Component);
|
|
2310
|
-
|
|
2311
|
-
_defineProperty$2(DragDropContainer, "DecoratedComponent", DecoratedComponent);
|
|
2312
|
-
|
|
2313
|
-
_defineProperty$2(DragDropContainer, "displayName", "".concat(containerDisplayName, "(").concat(displayName, ")"));
|
|
2314
|
-
|
|
2315
|
-
return hoistStatics(DragDropContainer, DecoratedComponent);
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2319
|
-
|
|
2320
|
-
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2321
|
-
|
|
2322
|
-
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
|
2323
|
-
|
|
2324
|
-
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2325
|
-
var ALLOWED_SPEC_METHODS$1 = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];
|
|
2326
|
-
var REQUIRED_SPEC_METHODS = ['beginDrag'];
|
|
2327
|
-
|
|
2328
|
-
var SourceImpl = /*#__PURE__*/function () {
|
|
2329
|
-
function SourceImpl(spec, monitor, ref) {
|
|
2330
|
-
var _this = this;
|
|
2331
|
-
|
|
2332
|
-
_classCallCheck$1(this, SourceImpl);
|
|
2333
|
-
|
|
2334
|
-
_defineProperty$1(this, "props", null);
|
|
2335
|
-
|
|
2336
|
-
_defineProperty$1(this, "spec", void 0);
|
|
2337
|
-
|
|
2338
|
-
_defineProperty$1(this, "monitor", void 0);
|
|
2339
|
-
|
|
2340
|
-
_defineProperty$1(this, "ref", void 0);
|
|
2341
|
-
|
|
2342
|
-
_defineProperty$1(this, "beginDrag", function () {
|
|
2343
|
-
if (!_this.props) {
|
|
2344
|
-
return;
|
|
2345
|
-
}
|
|
2346
|
-
|
|
2347
|
-
var item = _this.spec.beginDrag(_this.props, _this.monitor, _this.ref.current);
|
|
2348
|
-
|
|
2349
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2350
|
-
invariant(isPlainObject(item), 'beginDrag() must return a plain object that represents the dragged item. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', item);
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
return item;
|
|
2354
|
-
});
|
|
2355
|
-
|
|
2356
|
-
this.spec = spec;
|
|
2357
|
-
this.monitor = monitor;
|
|
2358
|
-
this.ref = ref;
|
|
2359
|
-
}
|
|
2360
|
-
|
|
2361
|
-
_createClass$1(SourceImpl, [{
|
|
2362
|
-
key: "receiveProps",
|
|
2363
|
-
value: function receiveProps(props) {
|
|
2364
|
-
this.props = props;
|
|
2365
|
-
}
|
|
2366
|
-
}, {
|
|
2367
|
-
key: "canDrag",
|
|
2368
|
-
value: function canDrag() {
|
|
2369
|
-
if (!this.props) {
|
|
2370
|
-
return false;
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
if (!this.spec.canDrag) {
|
|
2374
|
-
return true;
|
|
2375
|
-
}
|
|
2376
|
-
|
|
2377
|
-
return this.spec.canDrag(this.props, this.monitor);
|
|
2378
|
-
}
|
|
2379
|
-
}, {
|
|
2380
|
-
key: "isDragging",
|
|
2381
|
-
value: function isDragging(globalMonitor, sourceId) {
|
|
2382
|
-
if (!this.props) {
|
|
2383
|
-
return false;
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
if (!this.spec.isDragging) {
|
|
2387
|
-
return sourceId === globalMonitor.getSourceId();
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
return this.spec.isDragging(this.props, this.monitor);
|
|
2391
|
-
}
|
|
2392
|
-
}, {
|
|
2393
|
-
key: "endDrag",
|
|
2394
|
-
value: function endDrag() {
|
|
2395
|
-
if (!this.props) {
|
|
2396
|
-
return;
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
if (!this.spec.endDrag) {
|
|
2400
|
-
return;
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
this.spec.endDrag(this.props, this.monitor, getDecoratedComponent(this.ref));
|
|
2404
|
-
}
|
|
2405
|
-
}]);
|
|
2406
|
-
|
|
2407
|
-
return SourceImpl;
|
|
2408
|
-
}();
|
|
2409
|
-
|
|
2410
|
-
function createSourceFactory(spec) {
|
|
2411
|
-
Object.keys(spec).forEach(function (key) {
|
|
2412
|
-
invariant(ALLOWED_SPEC_METHODS$1.indexOf(key) > -1, 'Expected the drag source specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', ALLOWED_SPEC_METHODS$1.join(', '), key);
|
|
2413
|
-
invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);
|
|
2414
|
-
});
|
|
2415
|
-
REQUIRED_SPEC_METHODS.forEach(function (key) {
|
|
2416
|
-
invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);
|
|
2417
|
-
});
|
|
2418
|
-
return function createSource(monitor, ref) {
|
|
2419
|
-
return new SourceImpl(spec, monitor, ref);
|
|
2420
|
-
};
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
|
-
/**
|
|
2424
|
-
* Decorates a component as a dragsource
|
|
2425
|
-
* @param type The dragsource type
|
|
2426
|
-
* @param spec The drag source specification
|
|
2427
|
-
* @param collect The props collector function
|
|
2428
|
-
* @param options DnD options
|
|
2429
|
-
*/
|
|
2430
|
-
|
|
2431
|
-
function DragSource(type, spec, collect) {
|
|
2432
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
2433
|
-
checkDecoratorArguments('DragSource', 'type, spec, collect[, options]', type, spec, collect, options);
|
|
2434
|
-
var getType = type;
|
|
2435
|
-
|
|
2436
|
-
if (typeof type !== 'function') {
|
|
2437
|
-
invariant(isValidType(type), 'Expected "type" provided as the first argument to DragSource to be ' + 'a string, or a function that returns a string given the current props. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', type);
|
|
2438
|
-
|
|
2439
|
-
getType = function getType() {
|
|
2440
|
-
return type;
|
|
2441
|
-
};
|
|
2442
|
-
}
|
|
2443
|
-
|
|
2444
|
-
invariant(isPlainObject(spec), 'Expected "spec" provided as the second argument to DragSource to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', spec);
|
|
2445
|
-
var createSource = createSourceFactory(spec);
|
|
2446
|
-
invariant(typeof collect === 'function', 'Expected "collect" provided as the third argument to DragSource to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);
|
|
2447
|
-
invariant(isPlainObject(options), 'Expected "options" provided as the fourth argument to DragSource to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);
|
|
2448
|
-
return function decorateSource(DecoratedComponent) {
|
|
2449
|
-
return decorateHandler({
|
|
2450
|
-
containerDisplayName: 'DragSource',
|
|
2451
|
-
createHandler: createSource,
|
|
2452
|
-
registerHandler: registerSource,
|
|
2453
|
-
createConnector: function createConnector(backend) {
|
|
2454
|
-
return new SourceConnector(backend);
|
|
2455
|
-
},
|
|
2456
|
-
createMonitor: function createMonitor(manager) {
|
|
2457
|
-
return new DragSourceMonitorImpl(manager);
|
|
2458
|
-
},
|
|
2459
|
-
DecoratedComponent: DecoratedComponent,
|
|
2460
|
-
getType: getType,
|
|
2461
|
-
collect: collect,
|
|
2462
|
-
options: options
|
|
2463
|
-
});
|
|
2464
|
-
};
|
|
2465
|
-
}
|
|
2466
|
-
|
|
2467
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2468
|
-
|
|
2469
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2470
|
-
|
|
2471
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
2472
|
-
|
|
2473
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2474
|
-
var ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];
|
|
2475
|
-
|
|
2476
|
-
var TargetImpl = /*#__PURE__*/function () {
|
|
2477
|
-
function TargetImpl(spec, monitor, ref) {
|
|
2478
|
-
_classCallCheck(this, TargetImpl);
|
|
2479
|
-
|
|
2480
|
-
_defineProperty(this, "props", null);
|
|
2481
|
-
|
|
2482
|
-
_defineProperty(this, "spec", void 0);
|
|
2483
|
-
|
|
2484
|
-
_defineProperty(this, "monitor", void 0);
|
|
2485
|
-
|
|
2486
|
-
_defineProperty(this, "ref", void 0);
|
|
2487
|
-
|
|
2488
|
-
this.spec = spec;
|
|
2489
|
-
this.monitor = monitor;
|
|
2490
|
-
this.ref = ref;
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
|
-
_createClass(TargetImpl, [{
|
|
2494
|
-
key: "receiveProps",
|
|
2495
|
-
value: function receiveProps(props) {
|
|
2496
|
-
this.props = props;
|
|
2497
|
-
}
|
|
2498
|
-
}, {
|
|
2499
|
-
key: "receiveMonitor",
|
|
2500
|
-
value: function receiveMonitor(monitor) {
|
|
2501
|
-
this.monitor = monitor;
|
|
2502
|
-
}
|
|
2503
|
-
}, {
|
|
2504
|
-
key: "canDrop",
|
|
2505
|
-
value: function canDrop() {
|
|
2506
|
-
if (!this.spec.canDrop) {
|
|
2507
|
-
return true;
|
|
2508
|
-
}
|
|
2509
|
-
|
|
2510
|
-
return this.spec.canDrop(this.props, this.monitor);
|
|
2511
|
-
}
|
|
2512
|
-
}, {
|
|
2513
|
-
key: "hover",
|
|
2514
|
-
value: function hover() {
|
|
2515
|
-
if (!this.spec.hover || !this.props) {
|
|
2516
|
-
return;
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
|
-
this.spec.hover(this.props, this.monitor, getDecoratedComponent(this.ref));
|
|
2520
|
-
}
|
|
2521
|
-
}, {
|
|
2522
|
-
key: "drop",
|
|
2523
|
-
value: function drop() {
|
|
2524
|
-
if (!this.spec.drop) {
|
|
2525
|
-
return undefined;
|
|
2526
|
-
}
|
|
2527
|
-
|
|
2528
|
-
var dropResult = this.spec.drop(this.props, this.monitor, this.ref.current);
|
|
2529
|
-
|
|
2530
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2531
|
-
invariant(typeof dropResult === 'undefined' || isPlainObject(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', dropResult);
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
return dropResult;
|
|
2535
|
-
}
|
|
2536
|
-
}]);
|
|
2537
|
-
|
|
2538
|
-
return TargetImpl;
|
|
2539
|
-
}();
|
|
2540
|
-
|
|
2541
|
-
function createTargetFactory(spec) {
|
|
2542
|
-
Object.keys(spec).forEach(function (key) {
|
|
2543
|
-
invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', ALLOWED_SPEC_METHODS.join(', '), key);
|
|
2544
|
-
invariant(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', key, key, spec[key]);
|
|
2545
|
-
});
|
|
2546
|
-
return function createTarget(monitor, ref) {
|
|
2547
|
-
return new TargetImpl(spec, monitor, ref);
|
|
2548
|
-
};
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2551
|
-
/**
|
|
2552
|
-
* @param type The accepted target type
|
|
2553
|
-
* @param spec The DropTarget specification
|
|
2554
|
-
* @param collect The props collector function
|
|
2555
|
-
* @param options Options
|
|
2556
|
-
*/
|
|
2557
|
-
|
|
2558
|
-
function DropTarget(type, spec, collect) {
|
|
2559
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
2560
|
-
checkDecoratorArguments('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);
|
|
2561
|
-
var getType = type;
|
|
2562
|
-
|
|
2563
|
-
if (typeof type !== 'function') {
|
|
2564
|
-
invariant(isValidType(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' + 'a string, an array of strings, or a function that returns either given ' + 'the current props. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', type);
|
|
2565
|
-
|
|
2566
|
-
getType = function getType() {
|
|
2567
|
-
return type;
|
|
2568
|
-
};
|
|
2569
|
-
}
|
|
2570
|
-
|
|
2571
|
-
invariant(isPlainObject(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', spec);
|
|
2572
|
-
var createTarget = createTargetFactory(spec);
|
|
2573
|
-
invariant(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
|
|
2574
|
-
invariant(isPlainObject(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
|
|
2575
|
-
return function decorateTarget(DecoratedComponent) {
|
|
2576
|
-
return decorateHandler({
|
|
2577
|
-
containerDisplayName: 'DropTarget',
|
|
2578
|
-
createHandler: createTarget,
|
|
2579
|
-
registerHandler: registerTarget,
|
|
2580
|
-
createMonitor: function createMonitor(manager) {
|
|
2581
|
-
return new DropTargetMonitorImpl(manager);
|
|
2582
|
-
},
|
|
2583
|
-
createConnector: function createConnector(backend) {
|
|
2584
|
-
return new TargetConnector(backend);
|
|
2585
|
-
},
|
|
2586
|
-
DecoratedComponent: DecoratedComponent,
|
|
2587
|
-
getType: getType,
|
|
2588
|
-
collect: collect,
|
|
2589
|
-
options: options
|
|
2590
|
-
});
|
|
2591
|
-
};
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
const log$3 = debug('@pie-element:categorize:configure:choice');
|
|
2595
|
-
let canDrag = false;
|
|
2596
|
-
class Row extends React__default.Component {
|
|
2597
|
-
constructor(...args) {
|
|
2598
|
-
super(...args);
|
|
2599
|
-
this.state = {
|
|
2600
|
-
dialog: {
|
|
2601
|
-
open: false,
|
|
2602
|
-
text: ''
|
|
2603
|
-
}
|
|
2604
|
-
};
|
|
2605
|
-
|
|
2606
|
-
this.onRowTitleChange = rowIndex => value => {
|
|
2607
|
-
const {
|
|
2608
|
-
model,
|
|
2609
|
-
onChange
|
|
2610
|
-
} = this.props;
|
|
2611
|
-
|
|
2612
|
-
const newModel = _extends({}, model);
|
|
2613
|
-
|
|
2614
|
-
newModel.rows[rowIndex].title = value;
|
|
2615
|
-
onChange(newModel);
|
|
2616
|
-
};
|
|
2617
|
-
|
|
2618
|
-
this.onRowValueChange = (rowIndex, rowValueIndex) => event => {
|
|
2619
|
-
const {
|
|
2620
|
-
model,
|
|
2621
|
-
onChange
|
|
2622
|
-
} = this.props;
|
|
2623
|
-
|
|
2624
|
-
const newModel = _extends({}, model);
|
|
2625
|
-
|
|
2626
|
-
if (model.choiceMode === 'radio') {
|
|
2627
|
-
for (let i = 0; i < newModel.rows[rowIndex].values.length; i++) {
|
|
2628
|
-
newModel.rows[rowIndex].values[i] = false;
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
|
|
2632
|
-
newModel.rows[rowIndex].values[rowValueIndex] = event.target.checked;
|
|
2633
|
-
onChange(newModel);
|
|
2634
|
-
};
|
|
2635
|
-
|
|
2636
|
-
this.onDeleteRow = idx => () => {
|
|
2637
|
-
const {
|
|
2638
|
-
model,
|
|
2639
|
-
onDeleteRow,
|
|
2640
|
-
minQuestions
|
|
2641
|
-
} = this.props;
|
|
2642
|
-
|
|
2643
|
-
if (model.rows && model.rows.length === minQuestions) {
|
|
2644
|
-
this.setState({
|
|
2645
|
-
dialog: {
|
|
2646
|
-
open: true,
|
|
2647
|
-
text: `There should be at least ${minQuestions} question row` + (minQuestions > 1 ? 's' : '') + '.'
|
|
2648
|
-
}
|
|
2649
|
-
});
|
|
2650
|
-
} else {
|
|
2651
|
-
onDeleteRow(idx);
|
|
2652
|
-
}
|
|
2653
|
-
};
|
|
2654
|
-
|
|
2655
|
-
this.onMouseDownOnHandle = () => {
|
|
2656
|
-
canDrag = true;
|
|
2657
|
-
};
|
|
2658
|
-
|
|
2659
|
-
this.onMouseUpOnHandle = () => {
|
|
2660
|
-
canDrag = false;
|
|
2661
|
-
};
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
componentDidMount() {
|
|
2665
|
-
document.addEventListener('mouseup', this.onMouseUpOnHandle);
|
|
2666
|
-
}
|
|
2667
|
-
|
|
2668
|
-
render() {
|
|
2669
|
-
const {
|
|
2670
|
-
classes,
|
|
2671
|
-
imageSupport,
|
|
2672
|
-
connectDragSource,
|
|
2673
|
-
connectDropTarget,
|
|
2674
|
-
isDragging,
|
|
2675
|
-
model,
|
|
2676
|
-
row,
|
|
2677
|
-
idx,
|
|
2678
|
-
inputConfiguration = {},
|
|
2679
|
-
toolbarOpts,
|
|
2680
|
-
spellCheck,
|
|
2681
|
-
error,
|
|
2682
|
-
maxImageWidth,
|
|
2683
|
-
maxImageHeight,
|
|
2684
|
-
uploadSoundSupport,
|
|
2685
|
-
mathMlOptions = {}
|
|
2686
|
-
} = this.props;
|
|
2687
|
-
const {
|
|
2688
|
-
dialog
|
|
2689
|
-
} = this.state;
|
|
2690
|
-
const opacity = isDragging ? 0 : 1;
|
|
2691
|
-
const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(p => p !== 'bulleted-list' && p !== 'numbered-list');
|
|
2692
|
-
const content = /*#__PURE__*/React__default.createElement("div", {
|
|
2693
|
-
style: {
|
|
2694
|
-
opacity: opacity,
|
|
2695
|
-
width: '100%'
|
|
2696
|
-
}
|
|
2697
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2698
|
-
itemID: 'handle',
|
|
2699
|
-
className: classes.dragHandle,
|
|
2700
|
-
onMouseDown: this.onMouseDownOnHandle
|
|
2701
|
-
}, /*#__PURE__*/React__default.createElement(default_1$1, {
|
|
2702
|
-
color: 'primary'
|
|
2703
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
2704
|
-
className: classes.rowContainer
|
|
2705
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2706
|
-
className: classNames(classes.rowItem, classes.questionText)
|
|
2707
|
-
}, /*#__PURE__*/React__default.createElement(EditableHtml, {
|
|
2708
|
-
imageSupport: imageSupport,
|
|
2709
|
-
autoWidthToolbar: true,
|
|
2710
|
-
disableUnderline: true,
|
|
2711
|
-
label: 'label',
|
|
2712
|
-
markup: row.title,
|
|
2713
|
-
onChange: this.onRowTitleChange(idx),
|
|
2714
|
-
className: classes.editor,
|
|
2715
|
-
pluginProps: inputConfiguration,
|
|
2716
|
-
toolbarOpts: toolbarOpts,
|
|
2717
|
-
activePlugins: filteredDefaultPlugins,
|
|
2718
|
-
spellCheck: spellCheck,
|
|
2719
|
-
maxImageWidth: maxImageWidth,
|
|
2720
|
-
maxImageHeight: maxImageHeight,
|
|
2721
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
2722
|
-
languageCharactersProps: [{
|
|
2723
|
-
language: 'spanish'
|
|
2724
|
-
}, {
|
|
2725
|
-
language: 'special'
|
|
2726
|
-
}],
|
|
2727
|
-
error: error && error !== 'No correct response defined.',
|
|
2728
|
-
mathMlOptions: mathMlOptions
|
|
2729
|
-
})), row.values.map((rowValue, rowIdx) => /*#__PURE__*/React__default.createElement("div", {
|
|
2730
|
-
key: rowIdx,
|
|
2731
|
-
className: classes.rowItem
|
|
2732
|
-
}, model.choiceMode === 'radio' ? /*#__PURE__*/React__default.createElement(Radio, {
|
|
2733
|
-
className: classNames(classes.radioButton, classes.customColor, {
|
|
2734
|
-
[classes.errorResponse]: error == null ? void 0 : error.includes('No correct response defined.')
|
|
2735
|
-
}),
|
|
2736
|
-
onChange: this.onRowValueChange(idx, rowIdx),
|
|
2737
|
-
checked: rowValue === true
|
|
2738
|
-
}) : /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
2739
|
-
onChange: this.onRowValueChange(idx, rowIdx),
|
|
2740
|
-
checked: rowValue === true,
|
|
2741
|
-
label: '',
|
|
2742
|
-
error: error == null ? void 0 : error.includes('No correct response defined.')
|
|
2743
|
-
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
2744
|
-
className: classes.deleteIcon
|
|
2745
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2746
|
-
onClick: this.onDeleteRow(idx),
|
|
2747
|
-
"aria-label": "Delete"
|
|
2748
|
-
}, /*#__PURE__*/React__default.createElement(default_1, null)))), error && /*#__PURE__*/React__default.createElement("div", {
|
|
2749
|
-
className: classes.errorText
|
|
2750
|
-
}, error), /*#__PURE__*/React__default.createElement("hr", {
|
|
2751
|
-
className: classes.separator
|
|
2752
|
-
}), /*#__PURE__*/React__default.createElement(AlertDialog, {
|
|
2753
|
-
open: dialog.open,
|
|
2754
|
-
title: "Warning",
|
|
2755
|
-
text: dialog.text,
|
|
2756
|
-
onConfirm: () => this.setState({
|
|
2757
|
-
dialog: {
|
|
2758
|
-
open: false
|
|
2759
|
-
}
|
|
2760
|
-
})
|
|
2761
|
-
}));
|
|
2762
|
-
return connectDragSource(connectDropTarget(content));
|
|
2763
|
-
}
|
|
2764
|
-
|
|
2765
|
-
}
|
|
2766
|
-
Row.propTypes = {
|
|
2767
|
-
classes: PropTypes.object.isRequired,
|
|
2768
|
-
model: PropTypes.object.isRequired,
|
|
2769
|
-
row: PropTypes.object.isRequired,
|
|
2770
|
-
idx: PropTypes.number.isRequired,
|
|
2771
|
-
isDragging: PropTypes.bool.isRequired,
|
|
2772
|
-
maxImageWidth: PropTypes.object,
|
|
2773
|
-
maxImageHeight: PropTypes.object,
|
|
2774
|
-
onDeleteRow: PropTypes.func.isRequired,
|
|
2775
|
-
onChange: PropTypes.func.isRequired,
|
|
2776
|
-
connectDragSource: PropTypes.func.isRequired,
|
|
2777
|
-
connectDropTarget: PropTypes.func.isRequired,
|
|
2778
|
-
onMoveRow: PropTypes.func.isRequired,
|
|
2779
|
-
imageSupport: PropTypes.shape({
|
|
2780
|
-
add: PropTypes.func.isRequired,
|
|
2781
|
-
delete: PropTypes.func.isRequired
|
|
2782
|
-
}),
|
|
2783
|
-
uploadSoundSupport: PropTypes.shape({
|
|
2784
|
-
add: PropTypes.func.isRequired,
|
|
2785
|
-
delete: PropTypes.func.isRequired
|
|
2786
|
-
}),
|
|
2787
|
-
inputConfiguration: PropTypes.object,
|
|
2788
|
-
toolbarOpts: PropTypes.object,
|
|
2789
|
-
error: PropTypes.string,
|
|
2790
|
-
spellCheck: PropTypes.bool,
|
|
2791
|
-
minQuestions: PropTypes.number
|
|
2792
|
-
};
|
|
2793
|
-
Row.defaultProps = {};
|
|
2794
|
-
|
|
2795
|
-
const styles$2 = theme => ({
|
|
2796
|
-
actions: {
|
|
2797
|
-
padding: 0,
|
|
2798
|
-
justifyContent: 'space-between'
|
|
2799
|
-
},
|
|
2800
|
-
choice: {
|
|
2801
|
-
padding: theme.spacing.unit,
|
|
2802
|
-
overflow: 'visible'
|
|
2803
|
-
},
|
|
2804
|
-
dragHandle: {
|
|
2805
|
-
cursor: 'move'
|
|
2806
|
-
},
|
|
2807
|
-
dragDisabled: {
|
|
2808
|
-
cursor: 'inherit'
|
|
2809
|
-
},
|
|
2810
|
-
container: {
|
|
2811
|
-
marginTop: theme.spacing.unit * 2,
|
|
2812
|
-
display: 'flex',
|
|
2813
|
-
flexDirection: 'column'
|
|
2814
|
-
},
|
|
2815
|
-
rowContainer: {
|
|
2816
|
-
marginTop: theme.spacing.unit * 2,
|
|
2817
|
-
display: 'flex',
|
|
2818
|
-
alignItems: 'center',
|
|
2819
|
-
flex: 1
|
|
2820
|
-
},
|
|
2821
|
-
rowItem: {
|
|
2822
|
-
flex: 1,
|
|
2823
|
-
display: 'flex',
|
|
2824
|
-
justifyContent: 'center',
|
|
2825
|
-
alignItems: 'center',
|
|
2826
|
-
minWidth: '120px',
|
|
2827
|
-
padding: `0 ${theme.spacing.unit}px`
|
|
2828
|
-
},
|
|
2829
|
-
radioButton: {
|
|
2830
|
-
'& input': {
|
|
2831
|
-
width: '100% !important'
|
|
2832
|
-
}
|
|
2833
|
-
},
|
|
2834
|
-
customColor: {
|
|
2835
|
-
color: `${color.tertiary()} !important`
|
|
2836
|
-
},
|
|
2837
|
-
deleteIcon: {
|
|
2838
|
-
flex: 0.5,
|
|
2839
|
-
display: 'flex',
|
|
2840
|
-
justifyContent: 'center',
|
|
2841
|
-
minWidth: '45px',
|
|
2842
|
-
padding: `0 ${theme.spacing.unit}px`
|
|
2843
|
-
},
|
|
2844
|
-
questionText: {
|
|
2845
|
-
flex: 2,
|
|
2846
|
-
display: 'flex',
|
|
2847
|
-
justifyContent: 'flex-start',
|
|
2848
|
-
padding: 0,
|
|
2849
|
-
maxWidth: 'unset',
|
|
2850
|
-
textAlign: 'left',
|
|
2851
|
-
minWidth: '200px',
|
|
2852
|
-
marginRight: theme.spacing.unit,
|
|
2853
|
-
'&> div': {
|
|
2854
|
-
width: '100%'
|
|
2855
|
-
}
|
|
2856
|
-
},
|
|
2857
|
-
separator: {
|
|
2858
|
-
marginTop: theme.spacing.unit * 2,
|
|
2859
|
-
border: 0,
|
|
2860
|
-
borderTop: `2px solid ${theme.palette.grey['A100']}`,
|
|
2861
|
-
width: '100%'
|
|
2862
|
-
},
|
|
2863
|
-
errorText: {
|
|
2864
|
-
fontSize: theme.typography.fontSize - 2,
|
|
2865
|
-
color: theme.palette.error.main,
|
|
2866
|
-
paddingTop: theme.spacing.unit
|
|
2867
|
-
},
|
|
2868
|
-
errorResponse: {
|
|
2869
|
-
color: theme.palette.error.main
|
|
2870
|
-
}
|
|
2871
|
-
});
|
|
2872
|
-
|
|
2873
|
-
const StyledRow = withStyles(styles$2)(Row);
|
|
2874
|
-
const NAME = 'row-config';
|
|
2875
|
-
const choiceSource = {
|
|
2876
|
-
canDrag() {
|
|
2877
|
-
return canDrag;
|
|
2878
|
-
},
|
|
2879
|
-
|
|
2880
|
-
beginDrag(props) {
|
|
2881
|
-
return {
|
|
2882
|
-
id: props.row.id,
|
|
2883
|
-
index: props.idx
|
|
2884
|
-
};
|
|
2885
|
-
}
|
|
2886
|
-
|
|
2887
|
-
};
|
|
2888
|
-
const StyledSource = DragSource(NAME, choiceSource, (connect, monitor) => ({
|
|
2889
|
-
connectDragSource: connect.dragSource(),
|
|
2890
|
-
isDragging: monitor.isDragging()
|
|
2891
|
-
}))(StyledRow);
|
|
2892
|
-
const choiceTarget = {
|
|
2893
|
-
hover() {
|
|
2894
|
-
log$3('[hover]');
|
|
2895
|
-
},
|
|
2896
|
-
|
|
2897
|
-
drop(props, monitor) {
|
|
2898
|
-
const item = monitor.getItem();
|
|
2899
|
-
log$3('[drop] item: ', item, 'didDrop?', monitor.didDrop());
|
|
2900
|
-
props.onMoveRow(item.index, props.idx);
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
};
|
|
2904
|
-
const StyledSourceAndTarget = DropTarget(NAME, choiceTarget, connect => ({
|
|
2905
|
-
connectDropTarget: connect.dropTarget()
|
|
2906
|
-
}))(StyledSource);
|
|
2907
|
-
|
|
2908
|
-
const log$2 = debug('pie-elements:match:configure');
|
|
2909
|
-
|
|
2910
|
-
const styles$1 = theme => ({
|
|
2911
|
-
container: {
|
|
2912
|
-
marginBottom: theme.spacing.unit * 2.5,
|
|
2913
|
-
display: 'flex',
|
|
2914
|
-
flexDirection: 'column'
|
|
2915
|
-
},
|
|
2916
|
-
rowContainer: {
|
|
2917
|
-
display: 'flex',
|
|
2918
|
-
alignItems: 'center',
|
|
2919
|
-
flex: 1,
|
|
2920
|
-
width: '100%',
|
|
2921
|
-
borderBottom: `2px solid ${theme.palette.grey['A100']}`,
|
|
2922
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
2923
|
-
marginTop: theme.spacing.unit * 2,
|
|
2924
|
-
marginBottom: theme.spacing.unit
|
|
2925
|
-
},
|
|
2926
|
-
rowItem: {
|
|
2927
|
-
flex: 1,
|
|
2928
|
-
display: 'flex',
|
|
2929
|
-
justifyContent: 'center',
|
|
2930
|
-
alignItems: 'center',
|
|
2931
|
-
flexDirection: 'column',
|
|
2932
|
-
'&> div': {
|
|
2933
|
-
width: '120px',
|
|
2934
|
-
padding: `0 ${theme.spacing.unit}px`,
|
|
2935
|
-
textAlign: 'center'
|
|
2936
|
-
}
|
|
2937
|
-
},
|
|
2938
|
-
deleteIcon: {
|
|
2939
|
-
flex: 0.5,
|
|
2940
|
-
minWidth: '45px',
|
|
2941
|
-
padding: `0 ${theme.spacing.unit}px`
|
|
2942
|
-
},
|
|
2943
|
-
questionText: {
|
|
2944
|
-
flex: 2,
|
|
2945
|
-
display: 'flex',
|
|
2946
|
-
justifyContent: 'flex-start',
|
|
2947
|
-
marginRight: theme.spacing.unit,
|
|
2948
|
-
'&> div': {
|
|
2949
|
-
width: '100%',
|
|
2950
|
-
padding: 0,
|
|
2951
|
-
maxWidth: 'unset',
|
|
2952
|
-
textAlign: 'left',
|
|
2953
|
-
minWidth: '200px'
|
|
2954
|
-
}
|
|
2955
|
-
},
|
|
2956
|
-
rowTable: {
|
|
2957
|
-
display: 'flex',
|
|
2958
|
-
flexDirection: 'column'
|
|
2959
|
-
},
|
|
2960
|
-
headerInput: {
|
|
2961
|
-
'&> div': {
|
|
2962
|
-
fontWeight: 'bold'
|
|
2963
|
-
}
|
|
2964
|
-
},
|
|
2965
|
-
marginBottom: {
|
|
2966
|
-
marginBottom: theme.typography.fontSize - 2 + theme.spacing.unit
|
|
2967
|
-
},
|
|
2968
|
-
columnErrorText: {
|
|
2969
|
-
fontSize: theme.typography.fontSize - 2,
|
|
2970
|
-
color: theme.palette.error.main,
|
|
2971
|
-
paddingTop: `${theme.spacing.unit}px !important`,
|
|
2972
|
-
width: 'fit-content !important'
|
|
2973
|
-
},
|
|
2974
|
-
errorText: {
|
|
2975
|
-
fontSize: theme.typography.fontSize - 2,
|
|
2976
|
-
color: theme.palette.error.main,
|
|
2977
|
-
paddingBottom: theme.spacing.unit
|
|
2978
|
-
}
|
|
2979
|
-
});
|
|
2980
|
-
|
|
2981
|
-
class AnswerConfigBlock extends React.Component {
|
|
2982
|
-
constructor(...args) {
|
|
2983
|
-
super(...args);
|
|
2984
|
-
|
|
2985
|
-
this.moveRow = (from, to) => {
|
|
2986
|
-
const {
|
|
2987
|
-
model,
|
|
2988
|
-
onChange
|
|
2989
|
-
} = this.props;
|
|
2990
|
-
|
|
2991
|
-
const newModel = _extends({}, model);
|
|
2992
|
-
|
|
2993
|
-
const rows = newModel.rows || [];
|
|
2994
|
-
log$2('[moveRow]: ', from, to);
|
|
2995
|
-
const {
|
|
2996
|
-
movedRow,
|
|
2997
|
-
remainingRows
|
|
2998
|
-
} = rows.reduce((acc, item, index) => {
|
|
2999
|
-
if (index === from) {
|
|
3000
|
-
acc.movedRow = item;
|
|
3001
|
-
} else {
|
|
3002
|
-
acc.remainingRows.push(item);
|
|
3003
|
-
}
|
|
3004
|
-
|
|
3005
|
-
return acc;
|
|
3006
|
-
}, {
|
|
3007
|
-
movedRow: null,
|
|
3008
|
-
remainingRows: []
|
|
3009
|
-
});
|
|
3010
|
-
const update = [...remainingRows.slice(0, to), movedRow, ...remainingRows.slice(to)];
|
|
3011
|
-
log$2('update: ', update);
|
|
3012
|
-
newModel.rows = update;
|
|
3013
|
-
onChange(newModel);
|
|
3014
|
-
};
|
|
3015
|
-
|
|
3016
|
-
this.onChange = (name, isBoolean) => ({
|
|
3017
|
-
target
|
|
3018
|
-
}) => {
|
|
3019
|
-
const {
|
|
3020
|
-
model,
|
|
3021
|
-
onChange
|
|
3022
|
-
} = this.props;
|
|
3023
|
-
let value;
|
|
3024
|
-
|
|
3025
|
-
if (isBoolean) {
|
|
3026
|
-
value = target.checked;
|
|
3027
|
-
} else {
|
|
3028
|
-
value = target.value;
|
|
3029
|
-
}
|
|
3030
|
-
|
|
3031
|
-
lodash.set(model, name, value);
|
|
3032
|
-
onChange(model, name);
|
|
3033
|
-
};
|
|
3034
|
-
|
|
3035
|
-
this.onHeaderChange = headerIndex => value => {
|
|
3036
|
-
const {
|
|
3037
|
-
model,
|
|
3038
|
-
onChange
|
|
3039
|
-
} = this.props;
|
|
3040
|
-
|
|
3041
|
-
const newModel = _extends({}, model);
|
|
3042
|
-
|
|
3043
|
-
if (headerIndex === 0) {
|
|
3044
|
-
newModel.headers[headerIndex] = value;
|
|
3045
|
-
onChange(newModel);
|
|
3046
|
-
return;
|
|
3047
|
-
}
|
|
3048
|
-
|
|
3049
|
-
newModel.headers[headerIndex] = value;
|
|
3050
|
-
onChange(newModel);
|
|
3051
|
-
};
|
|
3052
|
-
}
|
|
3053
|
-
|
|
3054
|
-
render() {
|
|
3055
|
-
const {
|
|
3056
|
-
classes,
|
|
3057
|
-
model,
|
|
3058
|
-
onAddRow,
|
|
3059
|
-
imageSupport,
|
|
3060
|
-
configuration,
|
|
3061
|
-
toolbarOpts,
|
|
3062
|
-
spellCheck,
|
|
3063
|
-
uploadSoundSupport
|
|
3064
|
-
} = this.props;
|
|
3065
|
-
const {
|
|
3066
|
-
baseInputConfiguration = {},
|
|
3067
|
-
headers = {},
|
|
3068
|
-
rows = {},
|
|
3069
|
-
maxImageWidth = {},
|
|
3070
|
-
maxImageHeight = {},
|
|
3071
|
-
mathMlOptions = {},
|
|
3072
|
-
minQuestions
|
|
3073
|
-
} = configuration || {};
|
|
3074
|
-
const {
|
|
3075
|
-
errors
|
|
3076
|
-
} = model || {};
|
|
3077
|
-
const {
|
|
3078
|
-
correctResponseError,
|
|
3079
|
-
rowsErrors,
|
|
3080
|
-
columnsErrors,
|
|
3081
|
-
noOfRowsError,
|
|
3082
|
-
columnsLengthError
|
|
3083
|
-
} = errors || {};
|
|
3084
|
-
const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(p => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list');
|
|
3085
|
-
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
3086
|
-
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
3087
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
3088
|
-
className: classes.container
|
|
3089
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
3090
|
-
type: "body1",
|
|
3091
|
-
component: "div"
|
|
3092
|
-
}, "Click on the labels to edit or remove. Set the correct answers by clicking each correct answer per row."), /*#__PURE__*/React.createElement("div", {
|
|
3093
|
-
className: classes.rowTable,
|
|
3094
|
-
style: configuration.width ? {
|
|
3095
|
-
width: configuration.width,
|
|
3096
|
-
overflow: 'scroll'
|
|
3097
|
-
} : {}
|
|
3098
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3099
|
-
className: classes.rowContainer
|
|
3100
|
-
}, headers.settings && (model.headers || []).map((header, idx) => /*#__PURE__*/React.createElement("div", {
|
|
3101
|
-
key: idx,
|
|
3102
|
-
className: classNames(classes.rowItem, {
|
|
3103
|
-
[classes.questionText]: idx === 0
|
|
3104
|
-
})
|
|
3105
|
-
}, /*#__PURE__*/React.createElement(EditableHtml, {
|
|
3106
|
-
onChange: this.onHeaderChange(idx),
|
|
3107
|
-
markup: header,
|
|
3108
|
-
className: columnsErrors && !columnsErrors[idx] ? classes.marginBottom : classes.headerInput,
|
|
3109
|
-
label: 'column label',
|
|
3110
|
-
activePlugins: filteredDefaultPlugins,
|
|
3111
|
-
pluginProps: getPluginProps(headers == null ? void 0 : headers.inputConfiguration, baseInputConfiguration),
|
|
3112
|
-
autoWidthToolbar: true,
|
|
3113
|
-
spellCheck: spellCheck,
|
|
3114
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3115
|
-
languageCharactersProps: [{
|
|
3116
|
-
language: 'spanish'
|
|
3117
|
-
}, {
|
|
3118
|
-
language: 'special'
|
|
3119
|
-
}],
|
|
3120
|
-
error: columnsErrors && columnsErrors[idx]
|
|
3121
|
-
}), columnsErrors && columnsErrors[idx] && /*#__PURE__*/React.createElement("div", {
|
|
3122
|
-
className: classes.columnErrorText
|
|
3123
|
-
}, columnsErrors[idx]))), /*#__PURE__*/React.createElement("div", {
|
|
3124
|
-
className: classes.deleteIcon
|
|
3125
|
-
})), model.rows.map((row, idx) => /*#__PURE__*/React.createElement(StyledSourceAndTarget, {
|
|
3126
|
-
key: idx,
|
|
3127
|
-
model: model,
|
|
3128
|
-
row: row,
|
|
3129
|
-
idx: idx,
|
|
3130
|
-
onDeleteRow: this.props.onDeleteRow,
|
|
3131
|
-
onChange: this.props.onChange,
|
|
3132
|
-
onMoveRow: this.moveRow,
|
|
3133
|
-
imageSupport: imageSupport,
|
|
3134
|
-
toolbarOpts: toolbarOpts,
|
|
3135
|
-
spellCheck: spellCheck,
|
|
3136
|
-
error: rowsErrors == null ? void 0 : rowsErrors[row.id],
|
|
3137
|
-
maxImageWidth: maxImageWidth && maxImageWidth.rowTitles || defaultImageMaxWidth,
|
|
3138
|
-
maxImageHeight: maxImageHeight && maxImageHeight.rowTitles || defaultImageMaxHeight,
|
|
3139
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3140
|
-
mathMlOptions: mathMlOptions,
|
|
3141
|
-
minQuestions: minQuestions,
|
|
3142
|
-
inputConfiguration: getPluginProps(rows == null ? void 0 : rows.inputConfiguration, baseInputConfiguration)
|
|
3143
|
-
})), correctResponseError && /*#__PURE__*/React.createElement("div", {
|
|
3144
|
-
className: classes.errorText
|
|
3145
|
-
}, correctResponseError), noOfRowsError && /*#__PURE__*/React.createElement("div", {
|
|
3146
|
-
className: classes.errorText
|
|
3147
|
-
}, noOfRowsError), columnsLengthError && /*#__PURE__*/React.createElement("div", {
|
|
3148
|
-
className: classes.errorText
|
|
3149
|
-
}, columnsLengthError), /*#__PURE__*/React.createElement(AddRow, {
|
|
3150
|
-
onAddClick: onAddRow
|
|
3151
|
-
})));
|
|
3152
|
-
}
|
|
3153
|
-
|
|
3154
|
-
}
|
|
3155
|
-
|
|
3156
|
-
AnswerConfigBlock.propTypes = {
|
|
3157
|
-
classes: PropTypes.object.isRequired,
|
|
3158
|
-
model: PropTypes.object.isRequired,
|
|
3159
|
-
configuration: PropTypes.object.isRequired,
|
|
3160
|
-
onChange: PropTypes.func.isRequired,
|
|
3161
|
-
onDeleteRow: PropTypes.func.isRequired,
|
|
3162
|
-
onAddRow: PropTypes.func.isRequired,
|
|
3163
|
-
imageSupport: PropTypes.shape({
|
|
3164
|
-
add: PropTypes.func.isRequired,
|
|
3165
|
-
delete: PropTypes.func.isRequired
|
|
3166
|
-
}),
|
|
3167
|
-
uploadSoundSupport: PropTypes.shape({
|
|
3168
|
-
add: PropTypes.func.isRequired,
|
|
3169
|
-
delete: PropTypes.func.isRequired
|
|
3170
|
-
}),
|
|
3171
|
-
toolbarOpts: PropTypes.object,
|
|
3172
|
-
spellCheck: PropTypes.bool
|
|
3173
|
-
};
|
|
3174
|
-
var AnswerConfigBlock$1 = withStyles(styles$1)(AnswerConfigBlock);
|
|
3175
|
-
|
|
3176
|
-
const log$1 = debug('@pie-element:match:configure');
|
|
3177
|
-
const {
|
|
3178
|
-
Panel,
|
|
3179
|
-
toggle,
|
|
3180
|
-
radio,
|
|
3181
|
-
dropdown
|
|
3182
|
-
} = settings;
|
|
3183
|
-
|
|
3184
|
-
const styles = theme => ({
|
|
3185
|
-
promptHolder: {
|
|
3186
|
-
width: '100%',
|
|
3187
|
-
paddingTop: theme.spacing.unit * 2,
|
|
3188
|
-
marginBottom: theme.spacing.unit * 2
|
|
3189
|
-
},
|
|
3190
|
-
errorText: {
|
|
3191
|
-
fontSize: theme.typography.fontSize - 2,
|
|
3192
|
-
color: theme.palette.error.main,
|
|
3193
|
-
paddingTop: theme.spacing.unit
|
|
3194
|
-
}
|
|
3195
|
-
});
|
|
3196
|
-
|
|
3197
|
-
class Configure extends React__default.Component {
|
|
3198
|
-
constructor(props) {
|
|
3199
|
-
super(props);
|
|
3200
|
-
|
|
3201
|
-
this.onTabChange = (event, value) => {
|
|
3202
|
-
this.setState({
|
|
3203
|
-
activeTab: value
|
|
3204
|
-
});
|
|
3205
|
-
};
|
|
3206
|
-
|
|
3207
|
-
this.onChangeTabIndex = index => {
|
|
3208
|
-
this.setState({
|
|
3209
|
-
activeTab: index
|
|
3210
|
-
});
|
|
3211
|
-
};
|
|
3212
|
-
|
|
3213
|
-
this.onChange = model => {
|
|
3214
|
-
this.props.onModelChanged(model);
|
|
3215
|
-
};
|
|
3216
|
-
|
|
3217
|
-
this.onFeedbackChange = feedback => {
|
|
3218
|
-
const {
|
|
3219
|
-
model,
|
|
3220
|
-
onModelChanged
|
|
3221
|
-
} = this.props;
|
|
3222
|
-
model.feedback = feedback;
|
|
3223
|
-
onModelChanged(model);
|
|
3224
|
-
};
|
|
3225
|
-
|
|
3226
|
-
this.onDeleteRow = rowIndex => {
|
|
3227
|
-
const {
|
|
3228
|
-
model
|
|
3229
|
-
} = this.props;
|
|
3230
|
-
|
|
3231
|
-
const newModel = _extends({}, model);
|
|
3232
|
-
|
|
3233
|
-
newModel.rows.splice(rowIndex, 1);
|
|
3234
|
-
this.onChange(newModel);
|
|
3235
|
-
};
|
|
3236
|
-
|
|
3237
|
-
this.onAddRow = () => {
|
|
3238
|
-
const {
|
|
3239
|
-
model,
|
|
3240
|
-
configuration
|
|
3241
|
-
} = this.props;
|
|
3242
|
-
|
|
3243
|
-
const newModel = _extends({}, model);
|
|
3244
|
-
|
|
3245
|
-
const {
|
|
3246
|
-
maxQuestions
|
|
3247
|
-
} = configuration || {};
|
|
3248
|
-
|
|
3249
|
-
if (maxQuestions && (newModel.rows || []).length >= maxQuestions) {
|
|
3250
|
-
this.setState({
|
|
3251
|
-
dialog: {
|
|
3252
|
-
open: true,
|
|
3253
|
-
text: `There can be maximum ${maxQuestions} question row` + (maxQuestions > 1 ? 's' : '') + '.'
|
|
3254
|
-
}
|
|
3255
|
-
});
|
|
3256
|
-
return;
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
newModel.rows = newModel.rows.concat({
|
|
3260
|
-
id: this.rowIdCounter + 1,
|
|
3261
|
-
title: `Question Text ${(newModel.rows || []).length + 1}`,
|
|
3262
|
-
values: new Array(model.layout - 1).fill(false)
|
|
3263
|
-
});
|
|
3264
|
-
this.rowIdCounter += 1;
|
|
3265
|
-
this.onChange(newModel);
|
|
3266
|
-
};
|
|
3267
|
-
|
|
3268
|
-
this.onLayoutChange = newLayout => {
|
|
3269
|
-
const {
|
|
3270
|
-
model
|
|
3271
|
-
} = this.props;
|
|
3272
|
-
const oldLayout = model.layout;
|
|
3273
|
-
|
|
3274
|
-
const newModel = _extends({}, model);
|
|
3275
|
-
|
|
3276
|
-
if (newLayout > oldLayout) {
|
|
3277
|
-
for (let i = 0; i < newLayout - oldLayout; i++) {
|
|
3278
|
-
newModel.headers.push(`Column ${newModel.headers.length + 1}`);
|
|
3279
|
-
}
|
|
3280
|
-
|
|
3281
|
-
newModel.rows.forEach(row => {
|
|
3282
|
-
for (let i = 0; i < newLayout - oldLayout; i++) {
|
|
3283
|
-
row.values.push(false);
|
|
3284
|
-
}
|
|
3285
|
-
});
|
|
3286
|
-
} else if (newLayout < oldLayout) {
|
|
3287
|
-
newModel.headers.splice(newLayout);
|
|
3288
|
-
newModel.rows.forEach(row => {
|
|
3289
|
-
row.values.splice(newLayout - 1);
|
|
3290
|
-
});
|
|
3291
|
-
}
|
|
3292
|
-
|
|
3293
|
-
newModel.layout = newLayout;
|
|
3294
|
-
this.onChange(newModel);
|
|
3295
|
-
};
|
|
3296
|
-
|
|
3297
|
-
this.onResponseTypeChange = newChoiceMode => {
|
|
3298
|
-
const {
|
|
3299
|
-
model
|
|
3300
|
-
} = this.props;
|
|
3301
|
-
|
|
3302
|
-
const newModel = _extends({}, model); // if we're switching to radio and we have more than one true, reset
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
if (newChoiceMode === 'radio') {
|
|
3306
|
-
newModel.rows.forEach(row => {
|
|
3307
|
-
const trueCount = row.values.reduce((total, current) => current === true ? total + 1 : total);
|
|
3308
|
-
|
|
3309
|
-
if (trueCount > 1) {
|
|
3310
|
-
row.values = new Array(model.layout - 1).fill(false);
|
|
3311
|
-
}
|
|
3312
|
-
});
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
|
-
newModel.choiceMode = newChoiceMode;
|
|
3316
|
-
this.onChange(newModel);
|
|
3317
|
-
};
|
|
3318
|
-
|
|
3319
|
-
this.onPartialScoringChange = partialScoring => {
|
|
3320
|
-
this.props.model.partialScoring = partialScoring;
|
|
3321
|
-
this.props.onModelChanged(this.props.model);
|
|
3322
|
-
};
|
|
3323
|
-
|
|
3324
|
-
this.onPromptChanged = prompt => {
|
|
3325
|
-
this.props.onModelChanged(_extends({}, this.props.model, {
|
|
3326
|
-
prompt
|
|
3327
|
-
}));
|
|
3328
|
-
};
|
|
3329
|
-
|
|
3330
|
-
this.onTeacherInstructionsChanged = teacherInstructions => {
|
|
3331
|
-
this.props.onModelChanged(_extends({}, this.props.model, {
|
|
3332
|
-
teacherInstructions
|
|
3333
|
-
}));
|
|
3334
|
-
};
|
|
3335
|
-
|
|
3336
|
-
this.onRationaleChanged = rationale => {
|
|
3337
|
-
this.props.onModelChanged(_extends({}, this.props.model, {
|
|
3338
|
-
rationale
|
|
3339
|
-
}));
|
|
3340
|
-
};
|
|
3341
|
-
|
|
3342
|
-
let maxId = 0;
|
|
3343
|
-
|
|
3344
|
-
if (props.model.rows && props.model.rows.length > 0) {
|
|
3345
|
-
maxId = Math.max(...props.model.rows.map(row => row.id));
|
|
3346
|
-
}
|
|
3347
|
-
|
|
3348
|
-
this.rowIdCounter = maxId + 1;
|
|
3349
|
-
this.state = {
|
|
3350
|
-
activeTab: 0,
|
|
3351
|
-
dialog: {
|
|
3352
|
-
open: false,
|
|
3353
|
-
text: ''
|
|
3354
|
-
}
|
|
3355
|
-
};
|
|
3356
|
-
}
|
|
3357
|
-
|
|
3358
|
-
componentDidMount() {
|
|
3359
|
-
const {
|
|
3360
|
-
updatedRows,
|
|
3361
|
-
wasChanged
|
|
3362
|
-
} = this.validateRowsID(this.props.model.rows);
|
|
3363
|
-
|
|
3364
|
-
if (wasChanged) {
|
|
3365
|
-
const newModel = _extends({}, this.props.model, {
|
|
3366
|
-
rows: updatedRows
|
|
3367
|
-
});
|
|
3368
|
-
|
|
3369
|
-
this.props.onModelChanged(newModel);
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
|
|
3373
|
-
validateRowsID(rows) {
|
|
3374
|
-
let wasChanged = false;
|
|
3375
|
-
const updatedRows = (rows || []).map((row, index) => {
|
|
3376
|
-
if (row.id !== index + 1) {
|
|
3377
|
-
wasChanged = true;
|
|
3378
|
-
return _extends({}, row, {
|
|
3379
|
-
id: index + 1
|
|
3380
|
-
});
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
|
-
return row;
|
|
3384
|
-
});
|
|
3385
|
-
return {
|
|
3386
|
-
updatedRows,
|
|
3387
|
-
wasChanged
|
|
3388
|
-
};
|
|
3389
|
-
}
|
|
3390
|
-
|
|
3391
|
-
render() {
|
|
3392
|
-
const {
|
|
3393
|
-
classes,
|
|
3394
|
-
model,
|
|
3395
|
-
imageSupport,
|
|
3396
|
-
onModelChanged,
|
|
3397
|
-
configuration,
|
|
3398
|
-
onConfigurationChanged,
|
|
3399
|
-
uploadSoundSupport
|
|
3400
|
-
} = this.props;
|
|
3401
|
-
const {
|
|
3402
|
-
baseInputConfiguration = {},
|
|
3403
|
-
contentDimensions = {},
|
|
3404
|
-
feedback = {},
|
|
3405
|
-
lockChoiceOrder = {},
|
|
3406
|
-
maxImageWidth = {},
|
|
3407
|
-
maxImageHeight = {},
|
|
3408
|
-
partialScoring = {},
|
|
3409
|
-
prompt = {},
|
|
3410
|
-
rationale = {},
|
|
3411
|
-
settingsPanelDisabled,
|
|
3412
|
-
scoringType = {},
|
|
3413
|
-
spellCheck = {},
|
|
3414
|
-
studentInstructions = {},
|
|
3415
|
-
teacherInstructions = {},
|
|
3416
|
-
withRubric = {},
|
|
3417
|
-
language = {},
|
|
3418
|
-
languageChoices = {}
|
|
3419
|
-
} = configuration || {};
|
|
3420
|
-
const {
|
|
3421
|
-
errors,
|
|
3422
|
-
extraCSSRules,
|
|
3423
|
-
feedbackEnabled,
|
|
3424
|
-
promptEnabled,
|
|
3425
|
-
rationaleEnabled,
|
|
3426
|
-
spellCheckEnabled,
|
|
3427
|
-
teacherInstructionsEnabled,
|
|
3428
|
-
toolbarEditorPosition
|
|
3429
|
-
} = model || {};
|
|
3430
|
-
const {
|
|
3431
|
-
prompt: promptError,
|
|
3432
|
-
rationale: rationaleError,
|
|
3433
|
-
teacherInstructions: teacherInstructionsError
|
|
3434
|
-
} = errors || {};
|
|
3435
|
-
const {
|
|
3436
|
-
dialog
|
|
3437
|
-
} = this.state;
|
|
3438
|
-
const toolbarOpts = {
|
|
3439
|
-
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
3440
|
-
};
|
|
3441
|
-
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
3442
|
-
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
3443
|
-
const panelSettings = {
|
|
3444
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
3445
|
-
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
3446
|
-
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
3447
|
-
'language.enabled': language.settings && toggle(language.label, true),
|
|
3448
|
-
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
3449
|
-
};
|
|
3450
|
-
const panelProperties = {
|
|
3451
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
3452
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
3453
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
3454
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
3455
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
3456
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
3457
|
-
rubricEnabled: (withRubric == null ? void 0 : withRubric.settings) && toggle(withRubric == null ? void 0 : withRubric.label)
|
|
3458
|
-
};
|
|
3459
|
-
log$1('[render] model', model);
|
|
3460
|
-
return /*#__PURE__*/React__default.createElement(layout.ConfigLayout, {
|
|
3461
|
-
extraCSSRules: extraCSSRules,
|
|
3462
|
-
dimensions: contentDimensions,
|
|
3463
|
-
hideSettings: settingsPanelDisabled,
|
|
3464
|
-
settings: /*#__PURE__*/React__default.createElement(Panel, {
|
|
3465
|
-
model: model,
|
|
3466
|
-
configuration: configuration,
|
|
3467
|
-
onChangeModel: model => onModelChanged(model),
|
|
3468
|
-
onChangeConfiguration: config => onConfigurationChanged(config),
|
|
3469
|
-
groups: {
|
|
3470
|
-
Settings: panelSettings,
|
|
3471
|
-
Properties: panelProperties
|
|
3472
|
-
}
|
|
3473
|
-
})
|
|
3474
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/React__default.createElement(InputContainer, {
|
|
3475
|
-
label: teacherInstructions.label,
|
|
3476
|
-
className: classes.promptHolder
|
|
3477
|
-
}, /*#__PURE__*/React__default.createElement(EditableHtml, {
|
|
3478
|
-
className: classes.prompt,
|
|
3479
|
-
markup: model.teacherInstructions || '',
|
|
3480
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
3481
|
-
imageSupport: imageSupport,
|
|
3482
|
-
error: teacherInstructionsError,
|
|
3483
|
-
nonEmpty: false,
|
|
3484
|
-
toolbarOpts: toolbarOpts,
|
|
3485
|
-
pluginProps: getPluginProps(teacherInstructions == null ? void 0 : teacherInstructions.inputConfiguration, baseInputConfiguration),
|
|
3486
|
-
spellCheck: spellCheckEnabled,
|
|
3487
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
3488
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
3489
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3490
|
-
languageCharactersProps: [{
|
|
3491
|
-
language: 'spanish'
|
|
3492
|
-
}, {
|
|
3493
|
-
language: 'special'
|
|
3494
|
-
}]
|
|
3495
|
-
}), teacherInstructionsError && /*#__PURE__*/React__default.createElement("div", {
|
|
3496
|
-
className: classes.errorText
|
|
3497
|
-
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/React__default.createElement(InputContainer, {
|
|
3498
|
-
label: prompt.label,
|
|
3499
|
-
className: classes.promptHolder
|
|
3500
|
-
}, /*#__PURE__*/React__default.createElement(EditableHtml, {
|
|
3501
|
-
className: classes.prompt,
|
|
3502
|
-
markup: model.prompt,
|
|
3503
|
-
onChange: this.onPromptChanged,
|
|
3504
|
-
imageSupport: imageSupport,
|
|
3505
|
-
error: promptError,
|
|
3506
|
-
nonEmpty: false,
|
|
3507
|
-
disableUnderline: true,
|
|
3508
|
-
toolbarOpts: toolbarOpts,
|
|
3509
|
-
pluginProps: getPluginProps(prompt == null ? void 0 : prompt.inputConfiguration, baseInputConfiguration),
|
|
3510
|
-
spellCheck: spellCheckEnabled,
|
|
3511
|
-
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
3512
|
-
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
3513
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3514
|
-
languageCharactersProps: [{
|
|
3515
|
-
language: 'spanish'
|
|
3516
|
-
}, {
|
|
3517
|
-
language: 'special'
|
|
3518
|
-
}]
|
|
3519
|
-
}), promptError && /*#__PURE__*/React__default.createElement("div", {
|
|
3520
|
-
className: classes.errorText
|
|
3521
|
-
}, promptError)), /*#__PURE__*/React__default.createElement(GeneralConfigBlock$1, {
|
|
3522
|
-
model: model,
|
|
3523
|
-
configuration: configuration,
|
|
3524
|
-
onResponseTypeChange: this.onResponseTypeChange,
|
|
3525
|
-
onLayoutChange: this.onLayoutChange
|
|
3526
|
-
}), /*#__PURE__*/React__default.createElement(AnswerConfigBlock$1, {
|
|
3527
|
-
model: model,
|
|
3528
|
-
configuration: configuration,
|
|
3529
|
-
imageSupport: imageSupport,
|
|
3530
|
-
onChange: this.onChange,
|
|
3531
|
-
onAddRow: this.onAddRow,
|
|
3532
|
-
onDeleteRow: this.onDeleteRow,
|
|
3533
|
-
toolbarOpts: toolbarOpts,
|
|
3534
|
-
spellCheck: spellCheckEnabled,
|
|
3535
|
-
uploadSoundSupport: uploadSoundSupport
|
|
3536
|
-
}), rationaleEnabled && /*#__PURE__*/React__default.createElement(InputContainer, {
|
|
3537
|
-
label: rationale.label,
|
|
3538
|
-
className: classes.promptHolder
|
|
3539
|
-
}, /*#__PURE__*/React__default.createElement(EditableHtml, {
|
|
3540
|
-
className: classes.prompt,
|
|
3541
|
-
markup: model.rationale || '',
|
|
3542
|
-
onChange: this.onRationaleChanged,
|
|
3543
|
-
imageSupport: imageSupport,
|
|
3544
|
-
error: rationaleError,
|
|
3545
|
-
toolbarOpts: toolbarOpts,
|
|
3546
|
-
pluginProps: getPluginProps(rationale == null ? void 0 : rationale.inputConfiguration, baseInputConfiguration),
|
|
3547
|
-
spellCheck: spellCheckEnabled,
|
|
3548
|
-
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
3549
|
-
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
3550
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3551
|
-
languageCharactersProps: [{
|
|
3552
|
-
language: 'spanish'
|
|
3553
|
-
}, {
|
|
3554
|
-
language: 'special'
|
|
3555
|
-
}]
|
|
3556
|
-
}), rationaleError && /*#__PURE__*/React__default.createElement("div", {
|
|
3557
|
-
className: classes.errorText
|
|
3558
|
-
}, rationaleError)), feedbackEnabled && /*#__PURE__*/React__default.createElement(FeedbackConfig, {
|
|
3559
|
-
feedback: model.feedback,
|
|
3560
|
-
onChange: this.onFeedbackChange,
|
|
3561
|
-
toolbarOpts: toolbarOpts
|
|
3562
|
-
}), /*#__PURE__*/React__default.createElement(AlertDialog, {
|
|
3563
|
-
open: dialog.open,
|
|
3564
|
-
title: "Warning",
|
|
3565
|
-
text: dialog.text,
|
|
3566
|
-
onConfirm: () => this.setState({
|
|
3567
|
-
dialog: {
|
|
3568
|
-
open: false
|
|
3569
|
-
}
|
|
3570
|
-
})
|
|
3571
|
-
}));
|
|
3572
|
-
}
|
|
3573
|
-
|
|
3574
|
-
}
|
|
3575
|
-
|
|
3576
|
-
Configure.propTypes = {
|
|
3577
|
-
onModelChanged: PropTypes.func,
|
|
3578
|
-
onConfigurationChanged: PropTypes.func,
|
|
3579
|
-
classes: PropTypes.object,
|
|
3580
|
-
model: PropTypes.object.isRequired,
|
|
3581
|
-
configuration: PropTypes.object.isRequired,
|
|
3582
|
-
imageSupport: PropTypes.shape({
|
|
3583
|
-
add: PropTypes.func.isRequired,
|
|
3584
|
-
delete: PropTypes.func.isRequired
|
|
3585
|
-
}),
|
|
3586
|
-
uploadSoundSupport: PropTypes.shape({
|
|
3587
|
-
add: PropTypes.func.isRequired,
|
|
3588
|
-
delete: PropTypes.func.isRequired
|
|
3589
|
-
})
|
|
3590
|
-
};
|
|
3591
|
-
Configure.defaultProps = {
|
|
3592
|
-
classes: {}
|
|
3593
|
-
};
|
|
3594
|
-
var Configure$1 = withDragContext(withStyles(styles)(Configure));
|
|
3595
|
-
|
|
3596
|
-
/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType
|
|
3597
|
-
* functionalities are not defined yet - the value for those can belong to
|
|
3598
|
-
* model or to configuration
|
|
3599
|
-
*/
|
|
3600
|
-
var defaultValues = {
|
|
3601
|
-
model: {
|
|
3602
|
-
choiceMode: 'radio',
|
|
3603
|
-
feedbackEnabled: false,
|
|
3604
|
-
headers: ['Column 1', 'Column 2', 'Column 3'],
|
|
3605
|
-
layout: 3,
|
|
3606
|
-
lockChoiceOrder: true,
|
|
3607
|
-
partialScoring: false,
|
|
3608
|
-
prompt: '',
|
|
3609
|
-
promptEnabled: true,
|
|
3610
|
-
rationale: '',
|
|
3611
|
-
rationaleEnabled: true,
|
|
3612
|
-
rows: [],
|
|
3613
|
-
scoringType: 'auto',
|
|
3614
|
-
studentInstructionsEnabled: true,
|
|
3615
|
-
teacherInstructions: '',
|
|
3616
|
-
teacherInstructionsEnabled: true,
|
|
3617
|
-
toolbarEditorPosition: 'bottom'
|
|
3618
|
-
},
|
|
3619
|
-
configuration: {
|
|
3620
|
-
baseInputConfiguration: {
|
|
3621
|
-
audio: {
|
|
3622
|
-
disabled: false
|
|
3623
|
-
},
|
|
3624
|
-
video: {
|
|
3625
|
-
disabled: false
|
|
3626
|
-
},
|
|
3627
|
-
image: {
|
|
3628
|
-
disabled: false
|
|
3629
|
-
},
|
|
3630
|
-
textAlign: {
|
|
3631
|
-
disabled: true
|
|
3632
|
-
},
|
|
3633
|
-
showParagraphs: {
|
|
3634
|
-
disabled: false
|
|
3635
|
-
},
|
|
3636
|
-
separateParagraphs: {
|
|
3637
|
-
disabled: true
|
|
3638
|
-
}
|
|
3639
|
-
},
|
|
3640
|
-
rows: {
|
|
3641
|
-
inputConfiguration: {
|
|
3642
|
-
audio: {
|
|
3643
|
-
disabled: true
|
|
3644
|
-
},
|
|
3645
|
-
video: {
|
|
3646
|
-
disabled: true
|
|
3647
|
-
},
|
|
3648
|
-
image: {
|
|
3649
|
-
disabled: false
|
|
3650
|
-
}
|
|
3651
|
-
}
|
|
3652
|
-
},
|
|
3653
|
-
feedback: {
|
|
3654
|
-
settings: true,
|
|
3655
|
-
label: 'Feedback',
|
|
3656
|
-
enabled: true
|
|
3657
|
-
},
|
|
3658
|
-
headers: {
|
|
3659
|
-
settings: true,
|
|
3660
|
-
inputConfiguration: {
|
|
3661
|
-
audio: {
|
|
3662
|
-
disabled: true
|
|
3663
|
-
},
|
|
3664
|
-
video: {
|
|
3665
|
-
disabled: true
|
|
3666
|
-
},
|
|
3667
|
-
image: {
|
|
3668
|
-
disabled: false
|
|
3669
|
-
}
|
|
3670
|
-
}
|
|
3671
|
-
},
|
|
3672
|
-
layout: {
|
|
3673
|
-
settings: true,
|
|
3674
|
-
label: 'Layout'
|
|
3675
|
-
},
|
|
3676
|
-
lockChoiceOrder: {
|
|
3677
|
-
settings: false,
|
|
3678
|
-
label: 'Lock Choice Order'
|
|
3679
|
-
},
|
|
3680
|
-
partialScoring: {
|
|
3681
|
-
settings: false,
|
|
3682
|
-
label: 'Allow Partial Scoring'
|
|
3683
|
-
},
|
|
3684
|
-
choiceMode: {
|
|
3685
|
-
settings: true,
|
|
3686
|
-
label: 'Response Type'
|
|
3687
|
-
},
|
|
3688
|
-
prompt: {
|
|
3689
|
-
settings: true,
|
|
3690
|
-
label: 'Prompt',
|
|
3691
|
-
inputConfiguration: {
|
|
3692
|
-
audio: {
|
|
3693
|
-
disabled: false
|
|
3694
|
-
},
|
|
3695
|
-
video: {
|
|
3696
|
-
disabled: false
|
|
3697
|
-
},
|
|
3698
|
-
image: {
|
|
3699
|
-
disabled: false
|
|
3700
|
-
}
|
|
3701
|
-
},
|
|
3702
|
-
required: false
|
|
3703
|
-
},
|
|
3704
|
-
rationale: {
|
|
3705
|
-
settings: true,
|
|
3706
|
-
label: 'Rationale',
|
|
3707
|
-
inputConfiguration: {
|
|
3708
|
-
audio: {
|
|
3709
|
-
disabled: false
|
|
3710
|
-
},
|
|
3711
|
-
video: {
|
|
3712
|
-
disabled: false
|
|
3713
|
-
},
|
|
3714
|
-
image: {
|
|
3715
|
-
disabled: false
|
|
3716
|
-
}
|
|
3717
|
-
},
|
|
3718
|
-
required: false
|
|
3719
|
-
},
|
|
3720
|
-
settingsPanelDisabled: false,
|
|
3721
|
-
spellCheck: {
|
|
3722
|
-
label: 'Spellcheck',
|
|
3723
|
-
settings: false,
|
|
3724
|
-
enabled: true
|
|
3725
|
-
},
|
|
3726
|
-
scoringType: {
|
|
3727
|
-
settings: false,
|
|
3728
|
-
label: 'Scoring Type'
|
|
3729
|
-
},
|
|
3730
|
-
studentInstructions: {
|
|
3731
|
-
settings: false,
|
|
3732
|
-
label: 'Student Instructions'
|
|
3733
|
-
},
|
|
3734
|
-
teacherInstructions: {
|
|
3735
|
-
settings: true,
|
|
3736
|
-
label: 'Teacher Instructions',
|
|
3737
|
-
inputConfiguration: {
|
|
3738
|
-
audio: {
|
|
3739
|
-
disabled: false
|
|
3740
|
-
},
|
|
3741
|
-
video: {
|
|
3742
|
-
disabled: false
|
|
3743
|
-
},
|
|
3744
|
-
image: {
|
|
3745
|
-
disabled: false
|
|
3746
|
-
}
|
|
3747
|
-
},
|
|
3748
|
-
required: false
|
|
3749
|
-
},
|
|
3750
|
-
maxImageWidth: {
|
|
3751
|
-
teacherInstructions: 300,
|
|
3752
|
-
prompt: 300,
|
|
3753
|
-
rationale: 300,
|
|
3754
|
-
rowTitles: 300
|
|
3755
|
-
},
|
|
3756
|
-
maxImageHeight: {
|
|
3757
|
-
teacherInstructions: 300,
|
|
3758
|
-
prompt: 300,
|
|
3759
|
-
rationale: 300,
|
|
3760
|
-
rowTitles: 150
|
|
3761
|
-
},
|
|
3762
|
-
withRubric: {
|
|
3763
|
-
settings: false,
|
|
3764
|
-
label: 'Add Rubric'
|
|
3765
|
-
},
|
|
3766
|
-
minQuestions: 2,
|
|
3767
|
-
maxQuestions: 5,
|
|
3768
|
-
maxLengthQuestionsHeading: 100,
|
|
3769
|
-
maxAnswers: 5,
|
|
3770
|
-
maxLengthAnswers: 100,
|
|
3771
|
-
maxLengthFirstColumnHeading: 100,
|
|
3772
|
-
mathMlOptions: {
|
|
3773
|
-
mmlOutput: false,
|
|
3774
|
-
mmlEditing: false
|
|
3775
|
-
},
|
|
3776
|
-
language: {
|
|
3777
|
-
settings: false,
|
|
3778
|
-
label: 'Specify Language',
|
|
3779
|
-
enabled: false
|
|
3780
|
-
},
|
|
3781
|
-
languageChoices: {
|
|
3782
|
-
label: 'Language Choices',
|
|
3783
|
-
options: []
|
|
3784
|
-
}
|
|
3785
|
-
}
|
|
3786
|
-
};
|
|
3787
|
-
|
|
3788
|
-
const log = debug('pie-elements:match:configure');
|
|
3789
|
-
class MatchConfigure extends HTMLElement {
|
|
3790
|
-
constructor() {
|
|
3791
|
-
super();
|
|
3792
|
-
|
|
3793
|
-
this.resetModelAfterConfigurationIsSet = () => {
|
|
3794
|
-
// In environments that use pie-player-components, model is set before configuration.
|
|
3795
|
-
// This is the reason why sometimes the model gets altered non-reversible
|
|
3796
|
-
// (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)
|
|
3797
|
-
// Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset
|
|
3798
|
-
// the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called
|
|
3799
|
-
const pieAuthors = document.querySelectorAll('pie-author');
|
|
3800
|
-
this.hasPlayerAsParent = Array.from(pieAuthors).some(author => author.contains(this));
|
|
3801
|
-
|
|
3802
|
-
if (this.hasPlayerAsParent) {
|
|
3803
|
-
if (this._modelCopy) {
|
|
3804
|
-
this._model = this._modelCopy;
|
|
3805
|
-
} else {
|
|
3806
|
-
delete this._modelCopy;
|
|
3807
|
-
}
|
|
3808
|
-
}
|
|
3809
|
-
};
|
|
3810
|
-
|
|
3811
|
-
this._model = MatchConfigure.createDefaultModel();
|
|
3812
|
-
this._configuration = defaultValues.configuration;
|
|
3813
|
-
}
|
|
3814
|
-
|
|
3815
|
-
set model(m) {
|
|
3816
|
-
this._model = MatchConfigure.createDefaultModel(m);
|
|
3817
|
-
this._modelCopy = cloneDeep(this._model);
|
|
3818
|
-
|
|
3819
|
-
this._render();
|
|
3820
|
-
}
|
|
3821
|
-
|
|
3822
|
-
set configuration(c) {
|
|
3823
|
-
var _newConfiguration$lan, _c$rows;
|
|
3824
|
-
|
|
3825
|
-
const newConfiguration = _extends({}, defaultValues.configuration, c);
|
|
3826
|
-
|
|
3827
|
-
this._configuration = newConfiguration;
|
|
3828
|
-
this.resetModelAfterConfigurationIsSet(); // if language:enabled is true, then the corresponding default item model should include a language value;
|
|
3829
|
-
// if it is false, then the language field should be omitted from the item model.
|
|
3830
|
-
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
3831
|
-
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
3832
|
-
|
|
3833
|
-
if (newConfiguration != null && (_newConfiguration$lan = newConfiguration.language) != null && _newConfiguration$lan.enabled) {
|
|
3834
|
-
var _newConfiguration$lan2, _newConfiguration$lan3;
|
|
3835
|
-
|
|
3836
|
-
if (newConfiguration != null && (_newConfiguration$lan2 = newConfiguration.languageChoices) != null && (_newConfiguration$lan3 = _newConfiguration$lan2.options) != null && _newConfiguration$lan3.length) {
|
|
3837
|
-
this._model.language = newConfiguration == null ? void 0 : newConfiguration.languageChoices.options[0].value;
|
|
3838
|
-
}
|
|
3839
|
-
} else if (newConfiguration.language.settings && this._model.language) {
|
|
3840
|
-
this._configuration.language.enabled = true;
|
|
3841
|
-
|
|
3842
|
-
if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
|
|
3843
|
-
this._configuration.languageChoices.options = [];
|
|
3844
|
-
} // check if the language is already included in the languageChoices.options array
|
|
3845
|
-
// and if not, then add it.
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {
|
|
3849
|
-
this._configuration.languageChoices.options.push({
|
|
3850
|
-
value: this._model.language,
|
|
3851
|
-
label: this._model.language
|
|
3852
|
-
});
|
|
3853
|
-
}
|
|
3854
|
-
} else {
|
|
3855
|
-
delete this._model.language;
|
|
3856
|
-
}
|
|
3857
|
-
/**
|
|
3858
|
-
* @Deprecated we added rows.inputConfiguration to handle the plugins in the editable html fields
|
|
3859
|
-
* if rows.inputConfiguration is not defined we try to default to the old enableImages flag
|
|
3860
|
-
* This flag 'enableImages' will be removed in the future
|
|
3861
|
-
*/
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
if (isEmpty(c == null ? void 0 : (_c$rows = c.rows) == null ? void 0 : _c$rows.inputConfiguration)) {
|
|
3865
|
-
var _this$_model;
|
|
3866
|
-
|
|
3867
|
-
set(this._configuration.rows, 'inputConfiguration.image.disabled', !((_this$_model = this._model) != null && _this$_model.enableImages));
|
|
3868
|
-
set(this._configuration.rows, 'inputConfiguration.video.disabled', true);
|
|
3869
|
-
set(this._configuration.rows, 'inputConfiguration.audio.disabled', true);
|
|
3870
|
-
}
|
|
3871
|
-
|
|
3872
|
-
this._render();
|
|
3873
|
-
}
|
|
3874
|
-
|
|
3875
|
-
onModelChanged(model) {
|
|
3876
|
-
this._model = model;
|
|
3877
|
-
log('[onModelChanged]: ', this._model);
|
|
3878
|
-
|
|
3879
|
-
this._render();
|
|
3880
|
-
|
|
3881
|
-
this.dispatchEvent(new ModelUpdatedEvent(this._model));
|
|
3882
|
-
}
|
|
3883
|
-
|
|
3884
|
-
onConfigurationChanged(config) {
|
|
3885
|
-
this._configuration = config;
|
|
3886
|
-
|
|
3887
|
-
this._render();
|
|
3888
|
-
}
|
|
3889
|
-
/**
|
|
3890
|
-
*
|
|
3891
|
-
* @param {done, progress, file} handler
|
|
3892
|
-
*/
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
insertImage(handler) {
|
|
3896
|
-
this.dispatchEvent(new InsertImageEvent(handler));
|
|
3897
|
-
}
|
|
3898
|
-
|
|
3899
|
-
onDeleteImage(src, done) {
|
|
3900
|
-
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
3901
|
-
}
|
|
3902
|
-
|
|
3903
|
-
insertSound(handler) {
|
|
3904
|
-
this.dispatchEvent(new InsertSoundEvent(handler));
|
|
3905
|
-
}
|
|
3906
|
-
|
|
3907
|
-
onDeleteSound(src, done) {
|
|
3908
|
-
this.dispatchEvent(new DeleteSoundEvent(src, done));
|
|
3909
|
-
}
|
|
3910
|
-
|
|
3911
|
-
_render() {
|
|
3912
|
-
if (this._model) {
|
|
3913
|
-
const el = /*#__PURE__*/React__default.createElement(Configure$1, {
|
|
3914
|
-
onModelChanged: this.onModelChanged.bind(this),
|
|
3915
|
-
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
3916
|
-
model: this._model,
|
|
3917
|
-
configuration: this._configuration,
|
|
3918
|
-
imageSupport: {
|
|
3919
|
-
add: this.insertImage.bind(this),
|
|
3920
|
-
delete: this.onDeleteImage.bind(this)
|
|
3921
|
-
},
|
|
3922
|
-
uploadSoundSupport: {
|
|
3923
|
-
add: this.insertSound.bind(this),
|
|
3924
|
-
delete: this.onDeleteSound.bind(this)
|
|
3925
|
-
}
|
|
3926
|
-
});
|
|
3927
|
-
ReactDOM.render(el, this);
|
|
3928
|
-
}
|
|
3929
|
-
}
|
|
3930
|
-
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
MatchConfigure.createDefaultModel = (model = {}) => _extends({}, defaultValues.model, model);
|
|
3934
|
-
|
|
3935
|
-
export { MatchConfigure as default };
|
|
3936
|
-
//# sourceMappingURL=configure.js.map
|