@pie-element/multi-trait-rubric 6.0.2-esm.0 → 6.2.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 +19 -0
- package/configure/CHANGELOG.md +19 -0
- package/configure/package.json +5 -5
- package/controller/CHANGELOG.md +16 -0
- package/controller/package.json +1 -1
- package/package.json +5 -22
- package/esm/configure.css +0 -847
- package/esm/configure.js +0 -4679
- package/esm/configure.js.map +0 -1
- package/esm/controller.css +0 -847
- package/esm/controller.js +0 -176
- package/esm/controller.js.map +0 -1
- package/esm/element.css +0 -847
- package/esm/element.js +0 -521
- package/esm/element.js.map +0 -1
package/esm/configure.js
DELETED
|
@@ -1,4679 +0,0 @@
|
|
|
1
|
-
import { ModelUpdatedEvent, InsertSoundEvent, DeleteSoundEvent, InsertImageEvent, DeleteImageEvent } from '@pie-framework/pie-configure-events';
|
|
2
|
-
import React, { createContext, isValidElement, cloneElement, createRef, Component } from 'react';
|
|
3
|
-
import ReactDOM from 'react-dom';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
6
|
-
import isEmpty from 'lodash/isEmpty';
|
|
7
|
-
import debounce from 'lodash/debounce';
|
|
8
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
9
|
-
import { withDragContext } from '@pie-lib/drag';
|
|
10
|
-
import { layout, settings } from '@pie-lib/config-ui';
|
|
11
|
-
import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
|
|
12
|
-
import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
|
|
13
|
-
import { color } from '@pie-lib/render-ui';
|
|
14
|
-
import IconButton from '@material-ui/core/IconButton';
|
|
15
|
-
import Menu from '@material-ui/core/Menu';
|
|
16
|
-
import MenuItem from '@material-ui/core/MenuItem';
|
|
17
|
-
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
18
|
-
import classnames from 'classnames';
|
|
19
|
-
import EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html';
|
|
20
|
-
import FormControl from '@material-ui/core/FormControl';
|
|
21
|
-
import InputLabel from '@material-ui/core/InputLabel';
|
|
22
|
-
import Select from '@material-ui/core/Select';
|
|
23
|
-
import InputBase from '@material-ui/core/InputBase';
|
|
24
|
-
import grey from '@material-ui/core/colors/grey';
|
|
25
|
-
import Dialog from '@material-ui/core/Dialog';
|
|
26
|
-
import DialogTitle from '@material-ui/core/DialogTitle';
|
|
27
|
-
import DialogActions from '@material-ui/core/DialogActions';
|
|
28
|
-
import DialogContent from '@material-ui/core/DialogContent';
|
|
29
|
-
import DialogContentText from '@material-ui/core/DialogContentText';
|
|
30
|
-
import Button from '@material-ui/core/Button';
|
|
31
|
-
import debug from 'debug';
|
|
32
|
-
import DragIndicatorIcon from '@material-ui/icons/DragIndicator';
|
|
33
|
-
import { jsx } from 'react/jsx-runtime';
|
|
34
|
-
|
|
35
|
-
function _extends() {
|
|
36
|
-
_extends = Object.assign || function (target) {
|
|
37
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
38
|
-
var source = arguments[i];
|
|
39
|
-
|
|
40
|
-
for (var key in source) {
|
|
41
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
42
|
-
target[key] = source[key];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return target;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return _extends.apply(this, arguments);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
54
|
-
if (source == null) return {};
|
|
55
|
-
var target = {};
|
|
56
|
-
var sourceKeys = Object.keys(source);
|
|
57
|
-
var key, i;
|
|
58
|
-
|
|
59
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
60
|
-
key = sourceKeys[i];
|
|
61
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
62
|
-
target[key] = source[key];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return target;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var defaults = {
|
|
69
|
-
model: {
|
|
70
|
-
addScaleEnabled: true,
|
|
71
|
-
description: false,
|
|
72
|
-
excludeZero: false,
|
|
73
|
-
halfScoring: false,
|
|
74
|
-
maxPointsEnabled: true,
|
|
75
|
-
pointLabels: true,
|
|
76
|
-
scales: [],
|
|
77
|
-
standards: false,
|
|
78
|
-
visibleToStudent: true
|
|
79
|
-
},
|
|
80
|
-
configuration: {
|
|
81
|
-
baseInputConfiguration: {
|
|
82
|
-
audio: {
|
|
83
|
-
disabled: false
|
|
84
|
-
},
|
|
85
|
-
video: {
|
|
86
|
-
disabled: false
|
|
87
|
-
},
|
|
88
|
-
image: {
|
|
89
|
-
disabled: false
|
|
90
|
-
},
|
|
91
|
-
textAlign: {
|
|
92
|
-
disabled: true
|
|
93
|
-
},
|
|
94
|
-
showParagraphs: {
|
|
95
|
-
disabled: false
|
|
96
|
-
},
|
|
97
|
-
separateParagraphs: {
|
|
98
|
-
disabled: true
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
expandedInput: {
|
|
102
|
-
inputConfiguration: {
|
|
103
|
-
math: {
|
|
104
|
-
disabled: true
|
|
105
|
-
},
|
|
106
|
-
audio: {
|
|
107
|
-
disabled: false
|
|
108
|
-
},
|
|
109
|
-
video: {
|
|
110
|
-
disabled: false
|
|
111
|
-
},
|
|
112
|
-
image: {
|
|
113
|
-
disabled: false
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
labelInput: {
|
|
118
|
-
inputConfiguration: {
|
|
119
|
-
math: {
|
|
120
|
-
disabled: true
|
|
121
|
-
},
|
|
122
|
-
audio: {
|
|
123
|
-
disabled: true
|
|
124
|
-
},
|
|
125
|
-
video: {
|
|
126
|
-
disabled: true
|
|
127
|
-
},
|
|
128
|
-
image: {
|
|
129
|
-
disabled: true
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
excludeZeroDialogBoxContent: {
|
|
134
|
-
title: 'Exclude 0 (Zero) from Score Point Values.',
|
|
135
|
-
text: `<div>
|
|
136
|
-
You are about to exclude 0 from score point values.
|
|
137
|
-
<br/>
|
|
138
|
-
Some of the existing data has to be changed.
|
|
139
|
-
<br/>
|
|
140
|
-
Please choose if you want to:
|
|
141
|
-
<ul>
|
|
142
|
-
<li>
|
|
143
|
-
shift Labels and Descriptions to the left
|
|
144
|
-
</li>
|
|
145
|
-
<li>
|
|
146
|
-
remove 0 column with its Label and Description
|
|
147
|
-
</li>
|
|
148
|
-
</ul>
|
|
149
|
-
</div>`
|
|
150
|
-
},
|
|
151
|
-
includeZeroDialogBoxContent: {
|
|
152
|
-
title: 'Include 0 (Zero) in Score Point Values.',
|
|
153
|
-
text: `<div>
|
|
154
|
-
You are about to include 0 in score point values.
|
|
155
|
-
<br/>
|
|
156
|
-
Some of the existing data has to be changed.
|
|
157
|
-
<br/>
|
|
158
|
-
Please choose if you want to:
|
|
159
|
-
<ul>
|
|
160
|
-
<li>
|
|
161
|
-
shift Labels and Descriptions to the right
|
|
162
|
-
</li>
|
|
163
|
-
<li>
|
|
164
|
-
add 0 column with empty Label and Descriptions
|
|
165
|
-
</li>
|
|
166
|
-
</ul>
|
|
167
|
-
</div>`
|
|
168
|
-
},
|
|
169
|
-
deleteScaleDialogBoxContent: {
|
|
170
|
-
title: 'Delete Scale',
|
|
171
|
-
text: 'Are you sure you want to delete this scale?'
|
|
172
|
-
},
|
|
173
|
-
maxPointsDialogBoxContent: {
|
|
174
|
-
title: 'Decreasing Max Points.',
|
|
175
|
-
text: ` You are about to decrease max score point value.
|
|
176
|
-
<br/>
|
|
177
|
-
All the Labels and Descriptions for scores above Max Point will be deleted.`
|
|
178
|
-
},
|
|
179
|
-
settingsPanelDisabled: false,
|
|
180
|
-
spellCheck: {
|
|
181
|
-
label: 'Spellcheck',
|
|
182
|
-
settings: false,
|
|
183
|
-
enabled: true
|
|
184
|
-
},
|
|
185
|
-
showExcludeZero: {
|
|
186
|
-
settings: true,
|
|
187
|
-
label: 'Exclude Zero'
|
|
188
|
-
},
|
|
189
|
-
showScorePointLabels: {
|
|
190
|
-
settings: true,
|
|
191
|
-
label: 'Show Score Point Labels'
|
|
192
|
-
},
|
|
193
|
-
showDescription: {
|
|
194
|
-
settings: true,
|
|
195
|
-
label: 'Show Description'
|
|
196
|
-
},
|
|
197
|
-
showVisibleToStudent: {
|
|
198
|
-
settings: true,
|
|
199
|
-
label: 'Visible to Student'
|
|
200
|
-
},
|
|
201
|
-
showHalfScoring: {
|
|
202
|
-
settings: true,
|
|
203
|
-
label: 'Half Scoring'
|
|
204
|
-
},
|
|
205
|
-
// commenting this in order to use the dynamic width if the width was not set by the client (PD-3203)
|
|
206
|
-
// width: '900px',
|
|
207
|
-
// these should not be set to true (should not be used) for now
|
|
208
|
-
showStandards: {
|
|
209
|
-
settings: false,
|
|
210
|
-
label: 'Show Standards'
|
|
211
|
-
},
|
|
212
|
-
showLevelTagInput: {
|
|
213
|
-
settings: false,
|
|
214
|
-
label: 'Show Level Tag Input',
|
|
215
|
-
enabled: false
|
|
216
|
-
},
|
|
217
|
-
dragAndDrop: {
|
|
218
|
-
settings: true,
|
|
219
|
-
label: 'Enable Drag and Drop',
|
|
220
|
-
enabled: false
|
|
221
|
-
},
|
|
222
|
-
showMaxPoint: {
|
|
223
|
-
settings: true,
|
|
224
|
-
label: 'Show Max Points Dropdown'
|
|
225
|
-
},
|
|
226
|
-
addScale: {
|
|
227
|
-
settings: true,
|
|
228
|
-
label: 'Add Scale Available'
|
|
229
|
-
},
|
|
230
|
-
minNoOfTraits: 1,
|
|
231
|
-
maxNoOfTraits: 10,
|
|
232
|
-
minNoOfScales: 1,
|
|
233
|
-
maxNoOfScales: 10,
|
|
234
|
-
defaultTraitLabel: 'Trait',
|
|
235
|
-
mathMlOptions: {
|
|
236
|
-
mmlOutput: false,
|
|
237
|
-
mmlEditing: false
|
|
238
|
-
},
|
|
239
|
-
maxMaxPoints: 10
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
const {
|
|
244
|
-
configuration: {
|
|
245
|
-
excludeZeroDialogBoxContent,
|
|
246
|
-
includeZeroDialogBoxContent,
|
|
247
|
-
deleteScaleDialogBoxContent,
|
|
248
|
-
maxPointsDialogBoxContent
|
|
249
|
-
}
|
|
250
|
-
} = defaults;
|
|
251
|
-
const excludeZeroTypes = {
|
|
252
|
-
remove0: 'remove0',
|
|
253
|
-
add0: 'add0',
|
|
254
|
-
shiftLeft: 'shiftLeft',
|
|
255
|
-
shiftRight: 'shiftRight'
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const styles$4 = theme => ({
|
|
259
|
-
root: {
|
|
260
|
-
padding: theme.spacing.unit * 2.5
|
|
261
|
-
},
|
|
262
|
-
title: {
|
|
263
|
-
padding: `0 0 ${theme.spacing.unit * 2}px 0`,
|
|
264
|
-
'& h2': {
|
|
265
|
-
fontSize: '20px',
|
|
266
|
-
lineHeight: '23px',
|
|
267
|
-
fontFamily: 'Cerebri Sans',
|
|
268
|
-
color: color.text()
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
text: {
|
|
272
|
-
paddingLeft: '0',
|
|
273
|
-
'& p': {
|
|
274
|
-
fontSize: theme.typography.fontSize + 2,
|
|
275
|
-
fontFamily: 'Cerebri Sans',
|
|
276
|
-
color: color.text()
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
button: {
|
|
280
|
-
padding: `${theme.spacing.unit * 1.5}px ${theme.spacing.unit * 2}px`,
|
|
281
|
-
borderRadius: '4px',
|
|
282
|
-
fontSize: theme.typography.fontSize,
|
|
283
|
-
fontFamily: 'Cerebri Sans',
|
|
284
|
-
lineHeight: '14px',
|
|
285
|
-
textTransform: 'none',
|
|
286
|
-
background: color.primary(),
|
|
287
|
-
color: theme.palette.common.white
|
|
288
|
-
},
|
|
289
|
-
cancelButton: {
|
|
290
|
-
background: color.secondaryBackground(),
|
|
291
|
-
color: color.text()
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
const RawExcludeZeroDialog = ({
|
|
296
|
-
open,
|
|
297
|
-
changeExcludeZero,
|
|
298
|
-
cancel,
|
|
299
|
-
classes
|
|
300
|
-
}) => /*#__PURE__*/React.createElement(Dialog, {
|
|
301
|
-
open: open,
|
|
302
|
-
classes: {
|
|
303
|
-
paper: classes.root
|
|
304
|
-
}
|
|
305
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, {
|
|
306
|
-
classes: {
|
|
307
|
-
root: classes.title
|
|
308
|
-
}
|
|
309
|
-
}, excludeZeroDialogBoxContent.title), /*#__PURE__*/React.createElement(DialogContent, {
|
|
310
|
-
classes: {
|
|
311
|
-
root: classes.text
|
|
312
|
-
}
|
|
313
|
-
}, /*#__PURE__*/React.createElement(DialogContentText, null, /*#__PURE__*/React.createElement("div", {
|
|
314
|
-
dangerouslySetInnerHTML: {
|
|
315
|
-
__html: excludeZeroDialogBoxContent.text
|
|
316
|
-
}
|
|
317
|
-
}))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
318
|
-
classes: {
|
|
319
|
-
root: `${classes.button} ${classes.cancelButton}`
|
|
320
|
-
},
|
|
321
|
-
onClick: () => cancel()
|
|
322
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
323
|
-
classes: {
|
|
324
|
-
root: classes.button
|
|
325
|
-
},
|
|
326
|
-
onClick: () => changeExcludeZero(excludeZeroTypes.shiftLeft)
|
|
327
|
-
}, "Shift to Left"), /*#__PURE__*/React.createElement(Button, {
|
|
328
|
-
classes: {
|
|
329
|
-
root: classes.button
|
|
330
|
-
},
|
|
331
|
-
onClick: () => changeExcludeZero(excludeZeroTypes.remove0)
|
|
332
|
-
}, "Remove 0 column")));
|
|
333
|
-
|
|
334
|
-
RawExcludeZeroDialog.propTypes = {
|
|
335
|
-
classes: PropTypes.object,
|
|
336
|
-
open: PropTypes.bool,
|
|
337
|
-
changeExcludeZero: PropTypes.func,
|
|
338
|
-
cancel: PropTypes.func
|
|
339
|
-
};
|
|
340
|
-
const ExcludeZeroDialog = withStyles(styles$4)(RawExcludeZeroDialog);
|
|
341
|
-
|
|
342
|
-
const RawIncludeZeroDialog = ({
|
|
343
|
-
open,
|
|
344
|
-
changeExcludeZero,
|
|
345
|
-
cancel,
|
|
346
|
-
classes
|
|
347
|
-
}) => /*#__PURE__*/React.createElement(Dialog, {
|
|
348
|
-
open: open,
|
|
349
|
-
classes: {
|
|
350
|
-
paper: classes.root
|
|
351
|
-
}
|
|
352
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, {
|
|
353
|
-
classes: {
|
|
354
|
-
root: classes.title
|
|
355
|
-
}
|
|
356
|
-
}, includeZeroDialogBoxContent.title), /*#__PURE__*/React.createElement(DialogContent, {
|
|
357
|
-
classes: {
|
|
358
|
-
root: classes.text
|
|
359
|
-
}
|
|
360
|
-
}, /*#__PURE__*/React.createElement(DialogContentText, null, /*#__PURE__*/React.createElement("div", {
|
|
361
|
-
dangerouslySetInnerHTML: {
|
|
362
|
-
__html: includeZeroDialogBoxContent.text
|
|
363
|
-
}
|
|
364
|
-
}))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
365
|
-
classes: {
|
|
366
|
-
root: `${classes.button} ${classes.cancelButton}`
|
|
367
|
-
},
|
|
368
|
-
onClick: () => cancel()
|
|
369
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
370
|
-
classes: {
|
|
371
|
-
root: classes.button
|
|
372
|
-
},
|
|
373
|
-
onClick: () => changeExcludeZero(excludeZeroTypes.shiftRight)
|
|
374
|
-
}, "Shift to Right"), /*#__PURE__*/React.createElement(Button, {
|
|
375
|
-
classes: {
|
|
376
|
-
root: classes.button
|
|
377
|
-
},
|
|
378
|
-
onClick: () => changeExcludeZero(excludeZeroTypes.add0)
|
|
379
|
-
}, "Add 0 column")));
|
|
380
|
-
|
|
381
|
-
RawIncludeZeroDialog.propTypes = {
|
|
382
|
-
classes: PropTypes.object,
|
|
383
|
-
open: PropTypes.bool,
|
|
384
|
-
changeExcludeZero: PropTypes.func,
|
|
385
|
-
cancel: PropTypes.func
|
|
386
|
-
};
|
|
387
|
-
const IncludeZeroDialog = withStyles(styles$4)(RawIncludeZeroDialog);
|
|
388
|
-
|
|
389
|
-
const RawDecreaseMaxPoints = ({
|
|
390
|
-
open,
|
|
391
|
-
deleteScorePoints,
|
|
392
|
-
cancel,
|
|
393
|
-
classes
|
|
394
|
-
}) => /*#__PURE__*/React.createElement(Dialog, {
|
|
395
|
-
open: open,
|
|
396
|
-
classes: {
|
|
397
|
-
paper: classes.root
|
|
398
|
-
}
|
|
399
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, {
|
|
400
|
-
classes: {
|
|
401
|
-
root: classes.title
|
|
402
|
-
}
|
|
403
|
-
}, maxPointsDialogBoxContent.title), /*#__PURE__*/React.createElement(DialogContent, {
|
|
404
|
-
classes: {
|
|
405
|
-
root: classes.text
|
|
406
|
-
}
|
|
407
|
-
}, /*#__PURE__*/React.createElement(DialogContentText, null, /*#__PURE__*/React.createElement("div", {
|
|
408
|
-
dangerouslySetInnerHTML: {
|
|
409
|
-
__html: maxPointsDialogBoxContent.text
|
|
410
|
-
}
|
|
411
|
-
}))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
412
|
-
classes: {
|
|
413
|
-
root: `${classes.button} ${classes.cancelButton}`
|
|
414
|
-
},
|
|
415
|
-
onClick: cancel
|
|
416
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
417
|
-
classes: {
|
|
418
|
-
root: classes.button
|
|
419
|
-
},
|
|
420
|
-
onClick: deleteScorePoints
|
|
421
|
-
}, "Confirm")));
|
|
422
|
-
|
|
423
|
-
RawDecreaseMaxPoints.propTypes = {
|
|
424
|
-
classes: PropTypes.object,
|
|
425
|
-
open: PropTypes.bool,
|
|
426
|
-
deleteScorePoints: PropTypes.func,
|
|
427
|
-
cancel: PropTypes.func
|
|
428
|
-
};
|
|
429
|
-
const DecreaseMaxPoints = withStyles(styles$4)(RawDecreaseMaxPoints);
|
|
430
|
-
|
|
431
|
-
const RawDeleteScale = ({
|
|
432
|
-
open,
|
|
433
|
-
scaleIndex,
|
|
434
|
-
deleteScale,
|
|
435
|
-
cancel,
|
|
436
|
-
classes
|
|
437
|
-
}) => /*#__PURE__*/React.createElement(Dialog, {
|
|
438
|
-
open: open,
|
|
439
|
-
classes: {
|
|
440
|
-
paper: classes.root
|
|
441
|
-
}
|
|
442
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, {
|
|
443
|
-
classes: {
|
|
444
|
-
root: classes.title
|
|
445
|
-
}
|
|
446
|
-
}, `${deleteScaleDialogBoxContent.title} #${scaleIndex + 1}`), /*#__PURE__*/React.createElement(DialogContent, {
|
|
447
|
-
classes: {
|
|
448
|
-
root: classes.text
|
|
449
|
-
}
|
|
450
|
-
}, /*#__PURE__*/React.createElement(DialogContentText, null, /*#__PURE__*/React.createElement("div", {
|
|
451
|
-
dangerouslySetInnerHTML: {
|
|
452
|
-
__html: deleteScaleDialogBoxContent.text
|
|
453
|
-
}
|
|
454
|
-
}))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
455
|
-
classes: {
|
|
456
|
-
root: `${classes.button} ${classes.cancelButton}`
|
|
457
|
-
},
|
|
458
|
-
onClick: cancel
|
|
459
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
460
|
-
classes: {
|
|
461
|
-
root: classes.button
|
|
462
|
-
},
|
|
463
|
-
onClick: deleteScale
|
|
464
|
-
}, "Delete")));
|
|
465
|
-
|
|
466
|
-
RawDeleteScale.propTypes = {
|
|
467
|
-
classes: PropTypes.object,
|
|
468
|
-
open: PropTypes.bool,
|
|
469
|
-
scaleIndex: PropTypes.number,
|
|
470
|
-
deleteScale: PropTypes.func,
|
|
471
|
-
cancel: PropTypes.func
|
|
472
|
-
};
|
|
473
|
-
const DeleteScale = withStyles(styles$4)(RawDeleteScale);
|
|
474
|
-
|
|
475
|
-
const RawDeleteTrait = ({
|
|
476
|
-
open,
|
|
477
|
-
deleteTrait,
|
|
478
|
-
cancel,
|
|
479
|
-
classes,
|
|
480
|
-
traitLabel
|
|
481
|
-
}) => /*#__PURE__*/React.createElement(Dialog, {
|
|
482
|
-
open: open,
|
|
483
|
-
classes: {
|
|
484
|
-
paper: classes.root
|
|
485
|
-
}
|
|
486
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, {
|
|
487
|
-
classes: {
|
|
488
|
-
root: classes.title
|
|
489
|
-
}
|
|
490
|
-
}, "Delete ", traitLabel), /*#__PURE__*/React.createElement(DialogContent, {
|
|
491
|
-
classes: {
|
|
492
|
-
root: classes.text
|
|
493
|
-
}
|
|
494
|
-
}, /*#__PURE__*/React.createElement(DialogContentText, null, /*#__PURE__*/React.createElement("div", {
|
|
495
|
-
dangerouslySetInnerHTML: {
|
|
496
|
-
__html: `Are you sure you want to delete this ${traitLabel}?`
|
|
497
|
-
}
|
|
498
|
-
}))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
499
|
-
classes: {
|
|
500
|
-
root: `${classes.button} ${classes.cancelButton}`
|
|
501
|
-
},
|
|
502
|
-
onClick: cancel
|
|
503
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
504
|
-
classes: {
|
|
505
|
-
root: classes.button
|
|
506
|
-
},
|
|
507
|
-
onClick: deleteTrait
|
|
508
|
-
}, "Delete")));
|
|
509
|
-
|
|
510
|
-
RawDeleteTrait.propTypes = {
|
|
511
|
-
classes: PropTypes.object,
|
|
512
|
-
open: PropTypes.bool,
|
|
513
|
-
deleteTrait: PropTypes.func,
|
|
514
|
-
cancel: PropTypes.func,
|
|
515
|
-
traitLabel: PropTypes.string
|
|
516
|
-
};
|
|
517
|
-
const DeleteTrait = withStyles(styles$4)(RawDeleteTrait);
|
|
518
|
-
|
|
519
|
-
const RawInfoDialog = ({
|
|
520
|
-
classes,
|
|
521
|
-
open,
|
|
522
|
-
text,
|
|
523
|
-
onClose
|
|
524
|
-
}) => /*#__PURE__*/React.createElement(Dialog, {
|
|
525
|
-
open: open,
|
|
526
|
-
classes: {
|
|
527
|
-
paper: classes.root
|
|
528
|
-
}
|
|
529
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, {
|
|
530
|
-
classes: {
|
|
531
|
-
root: classes.title
|
|
532
|
-
}
|
|
533
|
-
}, text), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
534
|
-
classes: {
|
|
535
|
-
root: classes.button
|
|
536
|
-
},
|
|
537
|
-
onClick: onClose
|
|
538
|
-
}, "OK")));
|
|
539
|
-
|
|
540
|
-
RawInfoDialog.propTypes = {
|
|
541
|
-
classes: PropTypes.object,
|
|
542
|
-
open: PropTypes.bool,
|
|
543
|
-
text: PropTypes.string,
|
|
544
|
-
cancel: PropTypes.func,
|
|
545
|
-
onClose: PropTypes.func
|
|
546
|
-
};
|
|
547
|
-
const InfoDialog = withStyles(styles$4)(RawInfoDialog);
|
|
548
|
-
|
|
549
|
-
const _excluded = ["scorePointsDescriptors"],
|
|
550
|
-
_excluded2 = ["scorePointsDescriptors"],
|
|
551
|
-
_excluded3 = ["scorePointsDescriptors"],
|
|
552
|
-
_excluded4 = ["scorePointsDescriptors"];
|
|
553
|
-
const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(p => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list');
|
|
554
|
-
const addOrRemoveScaleColumn = (scales, excludeZeroType) => {
|
|
555
|
-
if (!scales || !scales.length) {
|
|
556
|
-
return [];
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
return scales.reduce((acc, scale) => {
|
|
560
|
-
let {
|
|
561
|
-
scorePointsLabels,
|
|
562
|
-
traits
|
|
563
|
-
} = scale || {};
|
|
564
|
-
|
|
565
|
-
if (scorePointsLabels.length < 1) {
|
|
566
|
-
return acc;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
switch (excludeZeroType) {
|
|
570
|
-
case excludeZeroTypes.remove0:
|
|
571
|
-
{
|
|
572
|
-
// removes column 0
|
|
573
|
-
scorePointsLabels = scorePointsLabels.slice(1);
|
|
574
|
-
traits = traits.map(_ref => {
|
|
575
|
-
let {
|
|
576
|
-
scorePointsDescriptors
|
|
577
|
-
} = _ref,
|
|
578
|
-
trait = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
579
|
-
|
|
580
|
-
return _extends({}, trait, {
|
|
581
|
-
scorePointsDescriptors: scorePointsDescriptors.slice(1)
|
|
582
|
-
});
|
|
583
|
-
});
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
case excludeZeroTypes.add0:
|
|
588
|
-
{
|
|
589
|
-
// adds empty column at start
|
|
590
|
-
scorePointsLabels = ['', ...scorePointsLabels];
|
|
591
|
-
traits = traits.map(_ref2 => {
|
|
592
|
-
let {
|
|
593
|
-
scorePointsDescriptors
|
|
594
|
-
} = _ref2,
|
|
595
|
-
trait = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
596
|
-
|
|
597
|
-
return _extends({}, trait, {
|
|
598
|
-
scorePointsDescriptors: ['', ...scorePointsDescriptors]
|
|
599
|
-
});
|
|
600
|
-
});
|
|
601
|
-
break;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
case excludeZeroTypes.shiftLeft:
|
|
605
|
-
{
|
|
606
|
-
// removes last column
|
|
607
|
-
scorePointsLabels = scorePointsLabels.slice(0, -1);
|
|
608
|
-
traits = traits.map(_ref3 => {
|
|
609
|
-
let {
|
|
610
|
-
scorePointsDescriptors
|
|
611
|
-
} = _ref3,
|
|
612
|
-
trait = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
613
|
-
|
|
614
|
-
return _extends({}, trait, {
|
|
615
|
-
scorePointsDescriptors: scorePointsDescriptors.slice(0, -1)
|
|
616
|
-
});
|
|
617
|
-
});
|
|
618
|
-
break;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
case excludeZeroTypes.shiftRight:
|
|
622
|
-
{
|
|
623
|
-
// adds empty column at end
|
|
624
|
-
scorePointsLabels = [...scorePointsLabels, ''];
|
|
625
|
-
traits = traits.map(_ref4 => {
|
|
626
|
-
let {
|
|
627
|
-
scorePointsDescriptors
|
|
628
|
-
} = _ref4,
|
|
629
|
-
trait = _objectWithoutPropertiesLoose(_ref4, _excluded4);
|
|
630
|
-
|
|
631
|
-
return _extends({}, trait, {
|
|
632
|
-
scorePointsDescriptors: [...scorePointsDescriptors, '']
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
break;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
acc.push(_extends({}, scale, {
|
|
640
|
-
scorePointsLabels,
|
|
641
|
-
traits
|
|
642
|
-
}));
|
|
643
|
-
return acc;
|
|
644
|
-
}, []);
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
const BlockWidth = 200;
|
|
648
|
-
const PrimaryBlockWidth = 200;
|
|
649
|
-
const DragHandleSpace = 32;
|
|
650
|
-
const HeaderHeight = '100px';
|
|
651
|
-
const HeaderHeightLarge = '160px';
|
|
652
|
-
const InputHeight = '120px';
|
|
653
|
-
const greyBorder = `solid 1px ${grey[400]}`;
|
|
654
|
-
const Padding = '8px 4px';
|
|
655
|
-
const MultiTraitButton = withStyles(theme => ({
|
|
656
|
-
button: {
|
|
657
|
-
fontSize: theme.typography.fontSize + 2,
|
|
658
|
-
textAlign: 'right',
|
|
659
|
-
display: 'flex',
|
|
660
|
-
flexDirection: 'row',
|
|
661
|
-
alignItems: 'flex-start',
|
|
662
|
-
padding: `${theme.spacing.unit * 1.5}px ${theme.spacing.unit * 2}px`,
|
|
663
|
-
width: '114px',
|
|
664
|
-
background: color.secondaryBackground(),
|
|
665
|
-
borderRadius: '4px',
|
|
666
|
-
justifyContent: 'space-around',
|
|
667
|
-
color: color.text(),
|
|
668
|
-
cursor: 'pointer'
|
|
669
|
-
}
|
|
670
|
-
}))(({
|
|
671
|
-
classes,
|
|
672
|
-
children,
|
|
673
|
-
onClick
|
|
674
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
675
|
-
className: classes.button,
|
|
676
|
-
onClick: onClick
|
|
677
|
-
}, /*#__PURE__*/React.createElement("strong", null, "+"), /*#__PURE__*/React.createElement("div", null, children)));
|
|
678
|
-
const PrimaryBlock = withStyles({
|
|
679
|
-
primaryBlock: {
|
|
680
|
-
width: `${PrimaryBlockWidth}px`,
|
|
681
|
-
minWidth: `${PrimaryBlockWidth}px`,
|
|
682
|
-
position: 'relative',
|
|
683
|
-
padding: '0 10px',
|
|
684
|
-
boxSizing: 'border-box'
|
|
685
|
-
}
|
|
686
|
-
})(({
|
|
687
|
-
classes,
|
|
688
|
-
children,
|
|
689
|
-
className
|
|
690
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
691
|
-
className: classnames(classes.primaryBlock, className)
|
|
692
|
-
}, children));
|
|
693
|
-
const Block = withStyles(theme => ({
|
|
694
|
-
block: {
|
|
695
|
-
width: `${BlockWidth}px`,
|
|
696
|
-
minWidth: `${BlockWidth}px`,
|
|
697
|
-
'& ul, ol': {
|
|
698
|
-
marginBlockStart: 0,
|
|
699
|
-
paddingInlineStart: theme.spacing.unit * 2
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
}))(({
|
|
703
|
-
classes,
|
|
704
|
-
children
|
|
705
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
706
|
-
className: classes.block
|
|
707
|
-
}, children));
|
|
708
|
-
const SecondaryBlock = withStyles({
|
|
709
|
-
secondaryBlock: {
|
|
710
|
-
display: 'flex',
|
|
711
|
-
overflowX: 'hidden',
|
|
712
|
-
alignItems: 'flex-end',
|
|
713
|
-
// this is needed to show the editor toolbar!!!
|
|
714
|
-
paddingBottom: '30px'
|
|
715
|
-
}
|
|
716
|
-
})(({
|
|
717
|
-
classes,
|
|
718
|
-
children,
|
|
719
|
-
setRef,
|
|
720
|
-
width
|
|
721
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
722
|
-
className: classes.secondaryBlock,
|
|
723
|
-
style: {
|
|
724
|
-
width: width
|
|
725
|
-
},
|
|
726
|
-
ref: setRef
|
|
727
|
-
}, children));
|
|
728
|
-
const Row = withStyles({
|
|
729
|
-
row: {
|
|
730
|
-
display: 'flex'
|
|
731
|
-
}
|
|
732
|
-
})(({
|
|
733
|
-
classes,
|
|
734
|
-
children,
|
|
735
|
-
className,
|
|
736
|
-
height
|
|
737
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
738
|
-
className: classnames(classes.row, className),
|
|
739
|
-
style: {
|
|
740
|
-
height
|
|
741
|
-
}
|
|
742
|
-
}, children));
|
|
743
|
-
|
|
744
|
-
const ScorePoint = withStyles(theme => ({
|
|
745
|
-
scorePointBoxWrapper: {
|
|
746
|
-
padding: '0 10px'
|
|
747
|
-
},
|
|
748
|
-
scorePointBox: {
|
|
749
|
-
display: 'flex',
|
|
750
|
-
borderRadius: '4px',
|
|
751
|
-
background: 'white',
|
|
752
|
-
flexDirection: 'row',
|
|
753
|
-
alignItems: 'center',
|
|
754
|
-
justifyContent: 'space-between',
|
|
755
|
-
border: greyBorder
|
|
756
|
-
},
|
|
757
|
-
scorePointBoxDisabled: {
|
|
758
|
-
background: 'none',
|
|
759
|
-
justifyContent: 'center',
|
|
760
|
-
border: '0'
|
|
761
|
-
},
|
|
762
|
-
subLabel: {
|
|
763
|
-
width: '24px',
|
|
764
|
-
textAlign: 'center'
|
|
765
|
-
},
|
|
766
|
-
editableLabel: {
|
|
767
|
-
textAlign: 'left',
|
|
768
|
-
flex: 1,
|
|
769
|
-
border: 'none',
|
|
770
|
-
'& div': {
|
|
771
|
-
padding: 0
|
|
772
|
-
},
|
|
773
|
-
'& > div': {
|
|
774
|
-
border: 'none',
|
|
775
|
-
borderLeft: greyBorder,
|
|
776
|
-
borderRadius: 0,
|
|
777
|
-
padding: Padding
|
|
778
|
-
}
|
|
779
|
-
},
|
|
780
|
-
slateEditor: {
|
|
781
|
-
fontFamily: 'Cerebri'
|
|
782
|
-
},
|
|
783
|
-
errorText: {
|
|
784
|
-
fontSize: theme.typography.fontSize - 2,
|
|
785
|
-
color: theme.palette.error.main,
|
|
786
|
-
paddingBottom: theme.spacing.unit
|
|
787
|
-
}
|
|
788
|
-
}))(({
|
|
789
|
-
classes,
|
|
790
|
-
error: _error = '',
|
|
791
|
-
scorePointsValue,
|
|
792
|
-
scoreDescriptor,
|
|
793
|
-
pluginProps,
|
|
794
|
-
onChange,
|
|
795
|
-
showScorePointLabels,
|
|
796
|
-
alignToRight,
|
|
797
|
-
spellCheck,
|
|
798
|
-
uploadSoundSupport,
|
|
799
|
-
imageSupport: _imageSupport = {},
|
|
800
|
-
mathMlOptions: _mathMlOptions = {}
|
|
801
|
-
}) => {
|
|
802
|
-
const scoreBoxClasses = showScorePointLabels ? classes.scorePointBox : `${classes.scorePointBox} ${classes.scorePointBoxDisabled}`;
|
|
803
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
804
|
-
className: classes.scorePointBoxWrapper
|
|
805
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
806
|
-
className: scoreBoxClasses
|
|
807
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
808
|
-
className: classes.subLabel
|
|
809
|
-
}, scorePointsValue), showScorePointLabels ? /*#__PURE__*/React.createElement(EditableHtml, {
|
|
810
|
-
className: classes.editableLabel,
|
|
811
|
-
classes: {
|
|
812
|
-
slateEditor: classes.slateEditor
|
|
813
|
-
},
|
|
814
|
-
error: _error,
|
|
815
|
-
markup: scoreDescriptor,
|
|
816
|
-
placeholder: " Enter Label",
|
|
817
|
-
onChange: onChange,
|
|
818
|
-
pluginProps: pluginProps,
|
|
819
|
-
activePlugins: filteredDefaultPlugins,
|
|
820
|
-
spellCheck: spellCheck,
|
|
821
|
-
toolbarOpts: alignToRight ? {
|
|
822
|
-
alignment: 'right'
|
|
823
|
-
} : {},
|
|
824
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
825
|
-
languageCharactersProps: [{
|
|
826
|
-
language: 'spanish'
|
|
827
|
-
}, {
|
|
828
|
-
language: 'special'
|
|
829
|
-
}],
|
|
830
|
-
mathMlOptions: _mathMlOptions,
|
|
831
|
-
imageSupport: _imageSupport
|
|
832
|
-
}) : null));
|
|
833
|
-
});
|
|
834
|
-
|
|
835
|
-
const inputStyles = theme => ({
|
|
836
|
-
root: {
|
|
837
|
-
background: theme.palette.common.white,
|
|
838
|
-
'label + &': {
|
|
839
|
-
marginTop: theme.spacing.unit * 2.5,
|
|
840
|
-
marginBottom: 0,
|
|
841
|
-
width: '80px'
|
|
842
|
-
}
|
|
843
|
-
},
|
|
844
|
-
input: {
|
|
845
|
-
borderRadius: '4px',
|
|
846
|
-
position: 'relative',
|
|
847
|
-
border: greyBorder,
|
|
848
|
-
fontSize: theme.typography.fontSize,
|
|
849
|
-
fontFamily: 'Cerebri Sans',
|
|
850
|
-
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 1.5}px`,
|
|
851
|
-
'&:focus': {
|
|
852
|
-
borderRadius: '4px'
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
});
|
|
856
|
-
|
|
857
|
-
const BootstrapInput = withStyles(inputStyles)(InputBase);
|
|
858
|
-
|
|
859
|
-
const createMaxScoreOptions = maxMaxPoints => Array.from({
|
|
860
|
-
length: maxMaxPoints
|
|
861
|
-
}, (_, i) => i + 1);
|
|
862
|
-
|
|
863
|
-
const MaxPointsPicker = withStyles({})(({
|
|
864
|
-
maxPoints,
|
|
865
|
-
onChange,
|
|
866
|
-
maxMaxPoints
|
|
867
|
-
}) => /*#__PURE__*/React.createElement(FormControl, null, /*#__PURE__*/React.createElement(InputLabel, null, "Max Points"), /*#__PURE__*/React.createElement(Select, {
|
|
868
|
-
value: maxPoints,
|
|
869
|
-
onChange: onChange,
|
|
870
|
-
input: /*#__PURE__*/React.createElement(BootstrapInput, null)
|
|
871
|
-
}, createMaxScoreOptions(maxMaxPoints).map(maxScore => /*#__PURE__*/React.createElement(MenuItem, {
|
|
872
|
-
key: `menu-item-${maxScore}`,
|
|
873
|
-
value: maxScore
|
|
874
|
-
}, maxScore)))));
|
|
875
|
-
const SimpleInput = withStyles(theme => ({
|
|
876
|
-
simpleInput: {
|
|
877
|
-
display: 'flex',
|
|
878
|
-
justifyContent: 'space-between',
|
|
879
|
-
alignItems: 'center',
|
|
880
|
-
margin: `${theme.spacing.unit * 1.5}px 0`
|
|
881
|
-
},
|
|
882
|
-
editableLevel: {
|
|
883
|
-
background: theme.palette.common.white,
|
|
884
|
-
width: '60%'
|
|
885
|
-
},
|
|
886
|
-
slateEditor: {
|
|
887
|
-
fontFamily: 'Cerebri'
|
|
888
|
-
}
|
|
889
|
-
}))(({
|
|
890
|
-
classes,
|
|
891
|
-
markup,
|
|
892
|
-
onChange,
|
|
893
|
-
pluginProps,
|
|
894
|
-
label,
|
|
895
|
-
spellCheck,
|
|
896
|
-
uploadSoundSupport,
|
|
897
|
-
mathMlOptions: _mathMlOptions2 = {},
|
|
898
|
-
imageSupport: _imageSupport2 = {}
|
|
899
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
900
|
-
className: classes.simpleInput
|
|
901
|
-
}, label && /*#__PURE__*/React.createElement("div", null, label), /*#__PURE__*/React.createElement(EditableHtml, {
|
|
902
|
-
className: classes.editableLevel,
|
|
903
|
-
classes: {
|
|
904
|
-
slateEditor: classes.slateEditor
|
|
905
|
-
},
|
|
906
|
-
markup: markup,
|
|
907
|
-
onChange: onChange,
|
|
908
|
-
placeholder: "Trait Label",
|
|
909
|
-
pluginProps: pluginProps,
|
|
910
|
-
activePlugins: filteredDefaultPlugins,
|
|
911
|
-
spellCheck: spellCheck,
|
|
912
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
913
|
-
languageCharactersProps: [{
|
|
914
|
-
language: 'spanish'
|
|
915
|
-
}, {
|
|
916
|
-
language: 'special'
|
|
917
|
-
}],
|
|
918
|
-
mathMlOptions: _mathMlOptions2,
|
|
919
|
-
imageSupport: _imageSupport2
|
|
920
|
-
})));
|
|
921
|
-
const UnderlinedInput = withStyles(theme => ({
|
|
922
|
-
underlinedInputWrapper: {
|
|
923
|
-
width: '100%',
|
|
924
|
-
display: 'flex',
|
|
925
|
-
justifyContent: 'center',
|
|
926
|
-
alignItems: 'center'
|
|
927
|
-
},
|
|
928
|
-
editableLevel: {
|
|
929
|
-
background: theme.palette.common.white,
|
|
930
|
-
width: '100%',
|
|
931
|
-
'& div': {
|
|
932
|
-
padding: 0
|
|
933
|
-
},
|
|
934
|
-
'& > div': {
|
|
935
|
-
border: 'none',
|
|
936
|
-
borderBottom: greyBorder,
|
|
937
|
-
borderRadius: 0,
|
|
938
|
-
padding: Padding
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
slateEditor: {
|
|
942
|
-
fontFamily: 'Cerebri'
|
|
943
|
-
}
|
|
944
|
-
}))(({
|
|
945
|
-
classes,
|
|
946
|
-
error,
|
|
947
|
-
markup,
|
|
948
|
-
onChange,
|
|
949
|
-
pluginProps,
|
|
950
|
-
label,
|
|
951
|
-
placeholder,
|
|
952
|
-
spellCheck,
|
|
953
|
-
uploadSoundSupport,
|
|
954
|
-
imageSupport: _imageSupport3 = {},
|
|
955
|
-
mathMlOptions: _mathMlOptions3 = {}
|
|
956
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
957
|
-
className: classes.underlinedInputWrapper
|
|
958
|
-
}, label && /*#__PURE__*/React.createElement("div", null, label), /*#__PURE__*/React.createElement(EditableHtml, {
|
|
959
|
-
className: classes.editableLevel,
|
|
960
|
-
classes: {
|
|
961
|
-
slateEditor: classes.slateEditor
|
|
962
|
-
},
|
|
963
|
-
error: error,
|
|
964
|
-
markup: markup,
|
|
965
|
-
onChange: onChange,
|
|
966
|
-
placeholder: placeholder,
|
|
967
|
-
pluginProps: pluginProps,
|
|
968
|
-
activePlugins: filteredDefaultPlugins,
|
|
969
|
-
spellCheck: spellCheck,
|
|
970
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
971
|
-
languageCharactersProps: [{
|
|
972
|
-
language: 'spanish'
|
|
973
|
-
}, {
|
|
974
|
-
language: 'special'
|
|
975
|
-
}],
|
|
976
|
-
mathMlOptions: _mathMlOptions3,
|
|
977
|
-
imageSupport: _imageSupport3
|
|
978
|
-
})));
|
|
979
|
-
const ExpandedInput = withStyles({
|
|
980
|
-
slateEditor: {
|
|
981
|
-
fontFamily: 'Cerebri',
|
|
982
|
-
height: InputHeight,
|
|
983
|
-
padding: 0
|
|
984
|
-
},
|
|
985
|
-
prompt: {
|
|
986
|
-
border: 'none',
|
|
987
|
-
margin: '10px',
|
|
988
|
-
marginTop: 0
|
|
989
|
-
}
|
|
990
|
-
})(({
|
|
991
|
-
classes,
|
|
992
|
-
error,
|
|
993
|
-
markup,
|
|
994
|
-
onChange,
|
|
995
|
-
pluginProps,
|
|
996
|
-
placeholder,
|
|
997
|
-
alignToRight,
|
|
998
|
-
spellCheck,
|
|
999
|
-
uploadSoundSupport,
|
|
1000
|
-
mathMlOptions: _mathMlOptions4 = {},
|
|
1001
|
-
imageSupport: _imageSupport4 = {}
|
|
1002
|
-
}) => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(EditableHtml, {
|
|
1003
|
-
className: classes.prompt,
|
|
1004
|
-
classes: {
|
|
1005
|
-
slateEditor: classes.slateEditor
|
|
1006
|
-
},
|
|
1007
|
-
error: error,
|
|
1008
|
-
markup: markup,
|
|
1009
|
-
onChange: onChange,
|
|
1010
|
-
placeholder: placeholder,
|
|
1011
|
-
pluginProps: pluginProps,
|
|
1012
|
-
toolbarOpts: alignToRight ? {
|
|
1013
|
-
alignment: 'right'
|
|
1014
|
-
} : {},
|
|
1015
|
-
spellCheck: spellCheck,
|
|
1016
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
1017
|
-
languageCharactersProps: [{
|
|
1018
|
-
language: 'spanish'
|
|
1019
|
-
}, {
|
|
1020
|
-
language: 'special'
|
|
1021
|
-
}],
|
|
1022
|
-
autoWidthToolbar: true,
|
|
1023
|
-
mathMlOptions: _mathMlOptions4,
|
|
1024
|
-
imageSupport: _imageSupport4
|
|
1025
|
-
})));
|
|
1026
|
-
const ScaleSettings = withStyles({
|
|
1027
|
-
scaleSettings: {
|
|
1028
|
-
display: 'flex',
|
|
1029
|
-
justifyContent: 'space-between',
|
|
1030
|
-
alignItems: 'flex-end'
|
|
1031
|
-
}
|
|
1032
|
-
})(({
|
|
1033
|
-
classes,
|
|
1034
|
-
children
|
|
1035
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
1036
|
-
className: classes.scaleSettings
|
|
1037
|
-
}, children));
|
|
1038
|
-
const Arrow = withStyles(theme => ({
|
|
1039
|
-
arrow: {
|
|
1040
|
-
position: 'absolute',
|
|
1041
|
-
zIndex: 10,
|
|
1042
|
-
cursor: 'pointer',
|
|
1043
|
-
right: 0,
|
|
1044
|
-
alignItems: 'flex-start',
|
|
1045
|
-
justifyContent: 'center',
|
|
1046
|
-
background: `linear-gradient(to left, ${theme.palette.common.white}, ${color.background()})`,
|
|
1047
|
-
boxSizing: 'border-box'
|
|
1048
|
-
},
|
|
1049
|
-
innerGrey: {
|
|
1050
|
-
position: 'absolute',
|
|
1051
|
-
zIndex: 11,
|
|
1052
|
-
cursor: 'pointer',
|
|
1053
|
-
right: 0,
|
|
1054
|
-
alignItems: 'flex-start',
|
|
1055
|
-
justifyContent: 'center',
|
|
1056
|
-
background: `linear-gradient(to left, ${theme.palette.common.white}, ${color.background()})`,
|
|
1057
|
-
boxSizing: 'border-box',
|
|
1058
|
-
'& svg': {
|
|
1059
|
-
position: 'absolute',
|
|
1060
|
-
bottom: '-24px'
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}))(({
|
|
1064
|
-
classes,
|
|
1065
|
-
children,
|
|
1066
|
-
className,
|
|
1067
|
-
show,
|
|
1068
|
-
width,
|
|
1069
|
-
onClick,
|
|
1070
|
-
left,
|
|
1071
|
-
showLevelTagInput
|
|
1072
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
1073
|
-
className: classnames(classes.arrow, className),
|
|
1074
|
-
style: {
|
|
1075
|
-
height: '-webkit-fill-available',
|
|
1076
|
-
display: show ? 'flex' : 'none',
|
|
1077
|
-
width: width,
|
|
1078
|
-
left: left,
|
|
1079
|
-
background: left ? `linear-gradient(to right, white, ${color.background()})` : undefined
|
|
1080
|
-
},
|
|
1081
|
-
onClick: onClick
|
|
1082
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1083
|
-
className: classnames(classes.innerGrey, className),
|
|
1084
|
-
style: {
|
|
1085
|
-
display: show ? 'flex' : 'none',
|
|
1086
|
-
width: width,
|
|
1087
|
-
height: showLevelTagInput ? HeaderHeightLarge : HeaderHeight,
|
|
1088
|
-
left: 0,
|
|
1089
|
-
background: left ? `linear-gradient(to right, ${color.secondaryBackground()}, ${color.background()})` : undefined
|
|
1090
|
-
},
|
|
1091
|
-
onClick: onClick
|
|
1092
|
-
}, children)));
|
|
1093
|
-
|
|
1094
|
-
const styles$3 = theme => ({
|
|
1095
|
-
label: {
|
|
1096
|
-
textAlign: 'center',
|
|
1097
|
-
width: '140px',
|
|
1098
|
-
border: 'none',
|
|
1099
|
-
margin: theme.spacing.unit,
|
|
1100
|
-
padding: '10px 0',
|
|
1101
|
-
display: 'flex',
|
|
1102
|
-
alignItems: 'center',
|
|
1103
|
-
justifyContent: 'space-around'
|
|
1104
|
-
},
|
|
1105
|
-
greyHeader: {
|
|
1106
|
-
background: color.secondaryBackground(),
|
|
1107
|
-
borderRadius: '4px',
|
|
1108
|
-
position: 'relative',
|
|
1109
|
-
marginBottom: theme.spacing.unit * 2
|
|
1110
|
-
},
|
|
1111
|
-
primaryBlockGreyHeader: {
|
|
1112
|
-
paddingTop: theme.spacing.unit * 1.5
|
|
1113
|
-
},
|
|
1114
|
-
scorePointErrorText: {
|
|
1115
|
-
position: 'absolute',
|
|
1116
|
-
fontSize: theme.typography.fontSize - 2,
|
|
1117
|
-
color: theme.palette.error.main,
|
|
1118
|
-
paddingTop: theme.spacing.unit / 2
|
|
1119
|
-
}
|
|
1120
|
-
});
|
|
1121
|
-
|
|
1122
|
-
class TraitsHeaderTile extends React.Component {
|
|
1123
|
-
constructor(...args) {
|
|
1124
|
-
super(...args);
|
|
1125
|
-
this.state = {
|
|
1126
|
-
anchorEl: null
|
|
1127
|
-
};
|
|
1128
|
-
|
|
1129
|
-
this.onScorePointLabelChange = ({
|
|
1130
|
-
scorePointLabel,
|
|
1131
|
-
value
|
|
1132
|
-
}) => {
|
|
1133
|
-
const {
|
|
1134
|
-
scorePointsLabels,
|
|
1135
|
-
onScaleChange
|
|
1136
|
-
} = this.props;
|
|
1137
|
-
if (value < 0 || value >= scorePointsLabels.length) return;
|
|
1138
|
-
scorePointsLabels[value] = scorePointLabel;
|
|
1139
|
-
onScaleChange({
|
|
1140
|
-
scorePointsLabels
|
|
1141
|
-
});
|
|
1142
|
-
};
|
|
1143
|
-
|
|
1144
|
-
this.handleClick = event => this.setState({
|
|
1145
|
-
anchorEl: event.currentTarget
|
|
1146
|
-
});
|
|
1147
|
-
|
|
1148
|
-
this.handleClose = () => this.setState({
|
|
1149
|
-
anchorEl: null
|
|
1150
|
-
});
|
|
1151
|
-
|
|
1152
|
-
this.scrollToPosition = position => this.secondaryBlock.scrollTo({
|
|
1153
|
-
left: position
|
|
1154
|
-
});
|
|
1155
|
-
|
|
1156
|
-
this.openMenu = () => {
|
|
1157
|
-
this.props.showDeleteScaleModal();
|
|
1158
|
-
this.handleClose();
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
1163
|
-
if (nextProps.currentPosition !== this.props.currentPosition) {
|
|
1164
|
-
this.scrollToPosition(nextProps.currentPosition);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
render() {
|
|
1169
|
-
const {
|
|
1170
|
-
scorePointsValues,
|
|
1171
|
-
scorePointsLabels,
|
|
1172
|
-
traitLabel,
|
|
1173
|
-
classes,
|
|
1174
|
-
currentPosition,
|
|
1175
|
-
showStandards,
|
|
1176
|
-
onTraitLabelChange,
|
|
1177
|
-
showDescription,
|
|
1178
|
-
showLevelTagInput,
|
|
1179
|
-
maxPoints,
|
|
1180
|
-
updateMaxPointsFieldValue,
|
|
1181
|
-
scaleIndex,
|
|
1182
|
-
showScorePointLabels,
|
|
1183
|
-
secondaryBlockWidth,
|
|
1184
|
-
setSecondaryBlockRef,
|
|
1185
|
-
spellCheck,
|
|
1186
|
-
uploadSoundSupport,
|
|
1187
|
-
maxPointsEnabled,
|
|
1188
|
-
mathMlOptions = {},
|
|
1189
|
-
errors = {},
|
|
1190
|
-
maxMaxPoints,
|
|
1191
|
-
labelPluginProps = {},
|
|
1192
|
-
imageSupport = {}
|
|
1193
|
-
} = this.props;
|
|
1194
|
-
const {
|
|
1195
|
-
anchorEl
|
|
1196
|
-
} = this.state;
|
|
1197
|
-
return /*#__PURE__*/React.createElement(Row, {
|
|
1198
|
-
className: classes.greyHeader,
|
|
1199
|
-
height: showLevelTagInput ? HeaderHeightLarge : HeaderHeight
|
|
1200
|
-
}, /*#__PURE__*/React.createElement(PrimaryBlock, {
|
|
1201
|
-
className: classes.primaryBlockGreyHeader
|
|
1202
|
-
}, showLevelTagInput && /*#__PURE__*/React.createElement(SimpleInput, {
|
|
1203
|
-
markup: traitLabel || 'Trait',
|
|
1204
|
-
onChange: onTraitLabelChange,
|
|
1205
|
-
pluginProps: labelPluginProps,
|
|
1206
|
-
spellCheck: spellCheck,
|
|
1207
|
-
label: "Level Label",
|
|
1208
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
1209
|
-
mathMlOptions: mathMlOptions,
|
|
1210
|
-
imageSupport: imageSupport
|
|
1211
|
-
}), /*#__PURE__*/React.createElement(ScaleSettings, null, /*#__PURE__*/React.createElement("div", null, "Scale ", scaleIndex + 1), maxPointsEnabled && /*#__PURE__*/React.createElement(MaxPointsPicker, {
|
|
1212
|
-
maxPoints: maxPoints,
|
|
1213
|
-
maxMaxPoints: maxMaxPoints,
|
|
1214
|
-
onChange: updateMaxPointsFieldValue
|
|
1215
|
-
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconButton, {
|
|
1216
|
-
"aria-label": "more",
|
|
1217
|
-
"aria-controls": "long-menu",
|
|
1218
|
-
"aria-haspopup": "true",
|
|
1219
|
-
onClick: this.handleClick
|
|
1220
|
-
}, /*#__PURE__*/React.createElement(MoreVertIcon, null)), /*#__PURE__*/React.createElement(Menu, {
|
|
1221
|
-
id: "long-menu",
|
|
1222
|
-
anchorEl: anchorEl,
|
|
1223
|
-
keepMounted: true,
|
|
1224
|
-
open: !!anchorEl,
|
|
1225
|
-
onClose: this.handleClose
|
|
1226
|
-
}, ['Remove Scale'].map(option => /*#__PURE__*/React.createElement(MenuItem, {
|
|
1227
|
-
key: option,
|
|
1228
|
-
onClick: this.openMenu
|
|
1229
|
-
}, option)))))), /*#__PURE__*/React.createElement(SecondaryBlock, {
|
|
1230
|
-
setRef: ref => {
|
|
1231
|
-
if (ref) {
|
|
1232
|
-
this.secondaryBlock = ref;
|
|
1233
|
-
setSecondaryBlockRef(ref);
|
|
1234
|
-
}
|
|
1235
|
-
},
|
|
1236
|
-
width: `${secondaryBlockWidth}px`
|
|
1237
|
-
}, showStandards && /*#__PURE__*/React.createElement(Block, null, /*#__PURE__*/React.createElement("div", {
|
|
1238
|
-
className: classes.label
|
|
1239
|
-
}, "Standard(s)")), showDescription && /*#__PURE__*/React.createElement(Block, null, /*#__PURE__*/React.createElement("div", {
|
|
1240
|
-
className: classes.label
|
|
1241
|
-
}, "Description")), scorePointsValues.map((scorePointsValue, index) => {
|
|
1242
|
-
const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding
|
|
1243
|
-
|
|
1244
|
-
const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 128;
|
|
1245
|
-
const value = scorePointsValues.length - index - 1;
|
|
1246
|
-
let scoreDescriptor;
|
|
1247
|
-
let error;
|
|
1248
|
-
|
|
1249
|
-
try {
|
|
1250
|
-
scoreDescriptor = scorePointsLabels[value] || '';
|
|
1251
|
-
error = errors[value] || '';
|
|
1252
|
-
} catch (e) {
|
|
1253
|
-
scoreDescriptor = '';
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
return /*#__PURE__*/React.createElement(Block, {
|
|
1257
|
-
key: `secondary-block-part-${index}`
|
|
1258
|
-
}, /*#__PURE__*/React.createElement(ScorePoint, {
|
|
1259
|
-
scorePointsValue: scorePointsValue,
|
|
1260
|
-
error: error,
|
|
1261
|
-
scoreDescriptor: scoreDescriptor,
|
|
1262
|
-
pluginProps: labelPluginProps,
|
|
1263
|
-
showScorePointLabels: showScorePointLabels,
|
|
1264
|
-
onChange: scorePointLabel => this.onScorePointLabelChange({
|
|
1265
|
-
scorePointLabel,
|
|
1266
|
-
value
|
|
1267
|
-
}),
|
|
1268
|
-
alignToRight: remainingSpace < 296 && scorePointsValue < maxPoints // 296 is the space required for the toolbar
|
|
1269
|
-
,
|
|
1270
|
-
spellCheck: spellCheck,
|
|
1271
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
1272
|
-
mathMlOptions: mathMlOptions,
|
|
1273
|
-
imageSupport: imageSupport
|
|
1274
|
-
}), error && /*#__PURE__*/React.createElement("div", {
|
|
1275
|
-
className: classes.scorePointErrorText
|
|
1276
|
-
}, error));
|
|
1277
|
-
})));
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
}
|
|
1281
|
-
TraitsHeaderTile.propTypes = {
|
|
1282
|
-
maxPointsEnabled: PropTypes.bool,
|
|
1283
|
-
spellCheck: PropTypes.bool,
|
|
1284
|
-
errors: PropTypes.object
|
|
1285
|
-
};
|
|
1286
|
-
TraitsHeaderTile.propTypes = {
|
|
1287
|
-
classes: PropTypes.object.isRequired,
|
|
1288
|
-
onTraitLabelChange: PropTypes.func,
|
|
1289
|
-
onScaleChange: PropTypes.func,
|
|
1290
|
-
scorePointsValues: PropTypes.arrayOf(PropTypes.number),
|
|
1291
|
-
scorePointsLabels: PropTypes.arrayOf(PropTypes.string),
|
|
1292
|
-
traitLabel: PropTypes.string,
|
|
1293
|
-
showStandards: PropTypes.bool,
|
|
1294
|
-
showLevelTagInput: PropTypes.bool,
|
|
1295
|
-
showDescription: PropTypes.bool,
|
|
1296
|
-
maxPoints: PropTypes.number,
|
|
1297
|
-
updateMaxPointsFieldValue: PropTypes.func,
|
|
1298
|
-
scaleIndex: PropTypes.number,
|
|
1299
|
-
currentPosition: PropTypes.number,
|
|
1300
|
-
secondaryBlockWidth: PropTypes.number,
|
|
1301
|
-
showDeleteScaleModal: PropTypes.func,
|
|
1302
|
-
showScorePointLabels: PropTypes.bool,
|
|
1303
|
-
setSecondaryBlockRef: PropTypes.func,
|
|
1304
|
-
uploadSoundSupport: PropTypes.object,
|
|
1305
|
-
maxMaxPoints: PropTypes.number,
|
|
1306
|
-
labelPluginProps: PropTypes.object,
|
|
1307
|
-
imageSupport: PropTypes.shape({
|
|
1308
|
-
add: PropTypes.func.isRequired,
|
|
1309
|
-
delete: PropTypes.func.isRequired
|
|
1310
|
-
})
|
|
1311
|
-
};
|
|
1312
|
-
var TraitsHeader = withStyles(styles$3)(TraitsHeaderTile);
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* Create the React Context
|
|
1316
|
-
*/
|
|
1317
|
-
|
|
1318
|
-
var DndContext = createContext({
|
|
1319
|
-
dragDropManager: undefined
|
|
1320
|
-
});
|
|
1321
|
-
|
|
1322
|
-
/**
|
|
1323
|
-
* Use invariant() to assert state which your program assumes to be true.
|
|
1324
|
-
*
|
|
1325
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
1326
|
-
* to provide information about what broke and what you were
|
|
1327
|
-
* expecting.
|
|
1328
|
-
*
|
|
1329
|
-
* The invariant message will be stripped in production, but the invariant
|
|
1330
|
-
* will remain to ensure logic does not differ in production.
|
|
1331
|
-
*/
|
|
1332
|
-
function invariant(condition, format) {
|
|
1333
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1334
|
-
args[_key - 2] = arguments[_key];
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1338
|
-
if (format === undefined) {
|
|
1339
|
-
throw new Error('invariant requires an error message argument');
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
if (!condition) {
|
|
1344
|
-
var error;
|
|
1345
|
-
|
|
1346
|
-
if (format === undefined) {
|
|
1347
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
1348
|
-
} else {
|
|
1349
|
-
var argIndex = 0;
|
|
1350
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
1351
|
-
return args[argIndex++];
|
|
1352
|
-
}));
|
|
1353
|
-
error.name = 'Invariant Violation';
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
1357
|
-
|
|
1358
|
-
throw error;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
function _classCallCheck$7(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1363
|
-
|
|
1364
|
-
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); } }
|
|
1365
|
-
|
|
1366
|
-
function _createClass$7(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$7(Constructor.prototype, protoProps); if (staticProps) _defineProperties$7(Constructor, staticProps); return Constructor; }
|
|
1367
|
-
|
|
1368
|
-
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; }
|
|
1369
|
-
var isCallingCanDrag = false;
|
|
1370
|
-
var isCallingIsDragging = false;
|
|
1371
|
-
var DragSourceMonitorImpl = /*#__PURE__*/function () {
|
|
1372
|
-
function DragSourceMonitorImpl(manager) {
|
|
1373
|
-
_classCallCheck$7(this, DragSourceMonitorImpl);
|
|
1374
|
-
|
|
1375
|
-
_defineProperty$7(this, "internalMonitor", void 0);
|
|
1376
|
-
|
|
1377
|
-
_defineProperty$7(this, "sourceId", null);
|
|
1378
|
-
|
|
1379
|
-
this.internalMonitor = manager.getMonitor();
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
_createClass$7(DragSourceMonitorImpl, [{
|
|
1383
|
-
key: "receiveHandlerId",
|
|
1384
|
-
value: function receiveHandlerId(sourceId) {
|
|
1385
|
-
this.sourceId = sourceId;
|
|
1386
|
-
}
|
|
1387
|
-
}, {
|
|
1388
|
-
key: "getHandlerId",
|
|
1389
|
-
value: function getHandlerId() {
|
|
1390
|
-
return this.sourceId;
|
|
1391
|
-
}
|
|
1392
|
-
}, {
|
|
1393
|
-
key: "canDrag",
|
|
1394
|
-
value: function canDrag() {
|
|
1395
|
-
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');
|
|
1396
|
-
|
|
1397
|
-
try {
|
|
1398
|
-
isCallingCanDrag = true;
|
|
1399
|
-
return this.internalMonitor.canDragSource(this.sourceId);
|
|
1400
|
-
} finally {
|
|
1401
|
-
isCallingCanDrag = false;
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
}, {
|
|
1405
|
-
key: "isDragging",
|
|
1406
|
-
value: function isDragging() {
|
|
1407
|
-
if (!this.sourceId) {
|
|
1408
|
-
return false;
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
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');
|
|
1412
|
-
|
|
1413
|
-
try {
|
|
1414
|
-
isCallingIsDragging = true;
|
|
1415
|
-
return this.internalMonitor.isDraggingSource(this.sourceId);
|
|
1416
|
-
} finally {
|
|
1417
|
-
isCallingIsDragging = false;
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
}, {
|
|
1421
|
-
key: "subscribeToStateChange",
|
|
1422
|
-
value: function subscribeToStateChange(listener, options) {
|
|
1423
|
-
return this.internalMonitor.subscribeToStateChange(listener, options);
|
|
1424
|
-
}
|
|
1425
|
-
}, {
|
|
1426
|
-
key: "isDraggingSource",
|
|
1427
|
-
value: function isDraggingSource(sourceId) {
|
|
1428
|
-
return this.internalMonitor.isDraggingSource(sourceId);
|
|
1429
|
-
}
|
|
1430
|
-
}, {
|
|
1431
|
-
key: "isOverTarget",
|
|
1432
|
-
value: function isOverTarget(targetId, options) {
|
|
1433
|
-
return this.internalMonitor.isOverTarget(targetId, options);
|
|
1434
|
-
}
|
|
1435
|
-
}, {
|
|
1436
|
-
key: "getTargetIds",
|
|
1437
|
-
value: function getTargetIds() {
|
|
1438
|
-
return this.internalMonitor.getTargetIds();
|
|
1439
|
-
}
|
|
1440
|
-
}, {
|
|
1441
|
-
key: "isSourcePublic",
|
|
1442
|
-
value: function isSourcePublic() {
|
|
1443
|
-
return this.internalMonitor.isSourcePublic();
|
|
1444
|
-
}
|
|
1445
|
-
}, {
|
|
1446
|
-
key: "getSourceId",
|
|
1447
|
-
value: function getSourceId() {
|
|
1448
|
-
return this.internalMonitor.getSourceId();
|
|
1449
|
-
}
|
|
1450
|
-
}, {
|
|
1451
|
-
key: "subscribeToOffsetChange",
|
|
1452
|
-
value: function subscribeToOffsetChange(listener) {
|
|
1453
|
-
return this.internalMonitor.subscribeToOffsetChange(listener);
|
|
1454
|
-
}
|
|
1455
|
-
}, {
|
|
1456
|
-
key: "canDragSource",
|
|
1457
|
-
value: function canDragSource(sourceId) {
|
|
1458
|
-
return this.internalMonitor.canDragSource(sourceId);
|
|
1459
|
-
}
|
|
1460
|
-
}, {
|
|
1461
|
-
key: "canDropOnTarget",
|
|
1462
|
-
value: function canDropOnTarget(targetId) {
|
|
1463
|
-
return this.internalMonitor.canDropOnTarget(targetId);
|
|
1464
|
-
}
|
|
1465
|
-
}, {
|
|
1466
|
-
key: "getItemType",
|
|
1467
|
-
value: function getItemType() {
|
|
1468
|
-
return this.internalMonitor.getItemType();
|
|
1469
|
-
}
|
|
1470
|
-
}, {
|
|
1471
|
-
key: "getItem",
|
|
1472
|
-
value: function getItem() {
|
|
1473
|
-
return this.internalMonitor.getItem();
|
|
1474
|
-
}
|
|
1475
|
-
}, {
|
|
1476
|
-
key: "getDropResult",
|
|
1477
|
-
value: function getDropResult() {
|
|
1478
|
-
return this.internalMonitor.getDropResult();
|
|
1479
|
-
}
|
|
1480
|
-
}, {
|
|
1481
|
-
key: "didDrop",
|
|
1482
|
-
value: function didDrop() {
|
|
1483
|
-
return this.internalMonitor.didDrop();
|
|
1484
|
-
}
|
|
1485
|
-
}, {
|
|
1486
|
-
key: "getInitialClientOffset",
|
|
1487
|
-
value: function getInitialClientOffset() {
|
|
1488
|
-
return this.internalMonitor.getInitialClientOffset();
|
|
1489
|
-
}
|
|
1490
|
-
}, {
|
|
1491
|
-
key: "getInitialSourceClientOffset",
|
|
1492
|
-
value: function getInitialSourceClientOffset() {
|
|
1493
|
-
return this.internalMonitor.getInitialSourceClientOffset();
|
|
1494
|
-
}
|
|
1495
|
-
}, {
|
|
1496
|
-
key: "getSourceClientOffset",
|
|
1497
|
-
value: function getSourceClientOffset() {
|
|
1498
|
-
return this.internalMonitor.getSourceClientOffset();
|
|
1499
|
-
}
|
|
1500
|
-
}, {
|
|
1501
|
-
key: "getClientOffset",
|
|
1502
|
-
value: function getClientOffset() {
|
|
1503
|
-
return this.internalMonitor.getClientOffset();
|
|
1504
|
-
}
|
|
1505
|
-
}, {
|
|
1506
|
-
key: "getDifferenceFromInitialOffset",
|
|
1507
|
-
value: function getDifferenceFromInitialOffset() {
|
|
1508
|
-
return this.internalMonitor.getDifferenceFromInitialOffset();
|
|
1509
|
-
}
|
|
1510
|
-
}]);
|
|
1511
|
-
|
|
1512
|
-
return DragSourceMonitorImpl;
|
|
1513
|
-
}();
|
|
1514
|
-
|
|
1515
|
-
function _classCallCheck$6(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1516
|
-
|
|
1517
|
-
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); } }
|
|
1518
|
-
|
|
1519
|
-
function _createClass$6(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$6(Constructor.prototype, protoProps); if (staticProps) _defineProperties$6(Constructor, staticProps); return Constructor; }
|
|
1520
|
-
|
|
1521
|
-
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; }
|
|
1522
|
-
var isCallingCanDrop = false;
|
|
1523
|
-
var DropTargetMonitorImpl = /*#__PURE__*/function () {
|
|
1524
|
-
function DropTargetMonitorImpl(manager) {
|
|
1525
|
-
_classCallCheck$6(this, DropTargetMonitorImpl);
|
|
1526
|
-
|
|
1527
|
-
_defineProperty$6(this, "internalMonitor", void 0);
|
|
1528
|
-
|
|
1529
|
-
_defineProperty$6(this, "targetId", null);
|
|
1530
|
-
|
|
1531
|
-
this.internalMonitor = manager.getMonitor();
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
_createClass$6(DropTargetMonitorImpl, [{
|
|
1535
|
-
key: "receiveHandlerId",
|
|
1536
|
-
value: function receiveHandlerId(targetId) {
|
|
1537
|
-
this.targetId = targetId;
|
|
1538
|
-
}
|
|
1539
|
-
}, {
|
|
1540
|
-
key: "getHandlerId",
|
|
1541
|
-
value: function getHandlerId() {
|
|
1542
|
-
return this.targetId;
|
|
1543
|
-
}
|
|
1544
|
-
}, {
|
|
1545
|
-
key: "subscribeToStateChange",
|
|
1546
|
-
value: function subscribeToStateChange(listener, options) {
|
|
1547
|
-
return this.internalMonitor.subscribeToStateChange(listener, options);
|
|
1548
|
-
}
|
|
1549
|
-
}, {
|
|
1550
|
-
key: "canDrop",
|
|
1551
|
-
value: function canDrop() {
|
|
1552
|
-
// Cut out early if the target id has not been set. This should prevent errors
|
|
1553
|
-
// where the user has an older version of dnd-core like in
|
|
1554
|
-
// https://github.com/react-dnd/react-dnd/issues/1310
|
|
1555
|
-
if (!this.targetId) {
|
|
1556
|
-
return false;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
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');
|
|
1560
|
-
|
|
1561
|
-
try {
|
|
1562
|
-
isCallingCanDrop = true;
|
|
1563
|
-
return this.internalMonitor.canDropOnTarget(this.targetId);
|
|
1564
|
-
} finally {
|
|
1565
|
-
isCallingCanDrop = false;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
}, {
|
|
1569
|
-
key: "isOver",
|
|
1570
|
-
value: function isOver(options) {
|
|
1571
|
-
if (!this.targetId) {
|
|
1572
|
-
return false;
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
return this.internalMonitor.isOverTarget(this.targetId, options);
|
|
1576
|
-
}
|
|
1577
|
-
}, {
|
|
1578
|
-
key: "getItemType",
|
|
1579
|
-
value: function getItemType() {
|
|
1580
|
-
return this.internalMonitor.getItemType();
|
|
1581
|
-
}
|
|
1582
|
-
}, {
|
|
1583
|
-
key: "getItem",
|
|
1584
|
-
value: function getItem() {
|
|
1585
|
-
return this.internalMonitor.getItem();
|
|
1586
|
-
}
|
|
1587
|
-
}, {
|
|
1588
|
-
key: "getDropResult",
|
|
1589
|
-
value: function getDropResult() {
|
|
1590
|
-
return this.internalMonitor.getDropResult();
|
|
1591
|
-
}
|
|
1592
|
-
}, {
|
|
1593
|
-
key: "didDrop",
|
|
1594
|
-
value: function didDrop() {
|
|
1595
|
-
return this.internalMonitor.didDrop();
|
|
1596
|
-
}
|
|
1597
|
-
}, {
|
|
1598
|
-
key: "getInitialClientOffset",
|
|
1599
|
-
value: function getInitialClientOffset() {
|
|
1600
|
-
return this.internalMonitor.getInitialClientOffset();
|
|
1601
|
-
}
|
|
1602
|
-
}, {
|
|
1603
|
-
key: "getInitialSourceClientOffset",
|
|
1604
|
-
value: function getInitialSourceClientOffset() {
|
|
1605
|
-
return this.internalMonitor.getInitialSourceClientOffset();
|
|
1606
|
-
}
|
|
1607
|
-
}, {
|
|
1608
|
-
key: "getSourceClientOffset",
|
|
1609
|
-
value: function getSourceClientOffset() {
|
|
1610
|
-
return this.internalMonitor.getSourceClientOffset();
|
|
1611
|
-
}
|
|
1612
|
-
}, {
|
|
1613
|
-
key: "getClientOffset",
|
|
1614
|
-
value: function getClientOffset() {
|
|
1615
|
-
return this.internalMonitor.getClientOffset();
|
|
1616
|
-
}
|
|
1617
|
-
}, {
|
|
1618
|
-
key: "getDifferenceFromInitialOffset",
|
|
1619
|
-
value: function getDifferenceFromInitialOffset() {
|
|
1620
|
-
return this.internalMonitor.getDifferenceFromInitialOffset();
|
|
1621
|
-
}
|
|
1622
|
-
}]);
|
|
1623
|
-
|
|
1624
|
-
return DropTargetMonitorImpl;
|
|
1625
|
-
}();
|
|
1626
|
-
|
|
1627
|
-
function throwIfCompositeComponentElement(element) {
|
|
1628
|
-
// Custom components can no longer be wrapped directly in React DnD 2.0
|
|
1629
|
-
// so that we don't need to depend on findDOMNode() from react-dom.
|
|
1630
|
-
if (typeof element.type === 'string') {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
var displayName = element.type.displayName || element.type.name || 'the component';
|
|
1635
|
-
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.');
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
function wrapHookToRecognizeElement(hook) {
|
|
1639
|
-
return function () {
|
|
1640
|
-
var elementOrNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1641
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1642
|
-
|
|
1643
|
-
// When passed a node, call the hook straight away.
|
|
1644
|
-
if (!isValidElement(elementOrNode)) {
|
|
1645
|
-
var node = elementOrNode;
|
|
1646
|
-
hook(node, options); // return the node so it can be chained (e.g. when within callback refs
|
|
1647
|
-
// <div ref={node => connectDragSource(connectDropTarget(node))}/>
|
|
1648
|
-
|
|
1649
|
-
return node;
|
|
1650
|
-
} // If passed a ReactElement, clone it and attach this function as a ref.
|
|
1651
|
-
// This helps us achieve a neat API where user doesn't even know that refs
|
|
1652
|
-
// are being used under the hood.
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
var element = elementOrNode;
|
|
1656
|
-
throwIfCompositeComponentElement(element); // When no options are passed, use the hook directly
|
|
1657
|
-
|
|
1658
|
-
var ref = options ? function (node) {
|
|
1659
|
-
return hook(node, options);
|
|
1660
|
-
} : hook;
|
|
1661
|
-
return cloneWithRef(element, ref);
|
|
1662
|
-
};
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
function wrapConnectorHooks(hooks) {
|
|
1666
|
-
var wrappedHooks = {};
|
|
1667
|
-
Object.keys(hooks).forEach(function (key) {
|
|
1668
|
-
var hook = hooks[key]; // ref objects should be passed straight through without wrapping
|
|
1669
|
-
|
|
1670
|
-
if (key.endsWith('Ref')) {
|
|
1671
|
-
wrappedHooks[key] = hooks[key];
|
|
1672
|
-
} else {
|
|
1673
|
-
var wrappedHook = wrapHookToRecognizeElement(hook);
|
|
1674
|
-
|
|
1675
|
-
wrappedHooks[key] = function () {
|
|
1676
|
-
return wrappedHook;
|
|
1677
|
-
};
|
|
1678
|
-
}
|
|
1679
|
-
});
|
|
1680
|
-
return wrappedHooks;
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
function setRef(ref, node) {
|
|
1684
|
-
if (typeof ref === 'function') {
|
|
1685
|
-
ref(node);
|
|
1686
|
-
} else {
|
|
1687
|
-
ref.current = node;
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
function cloneWithRef(element, newRef) {
|
|
1692
|
-
var previousRef = element.ref;
|
|
1693
|
-
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');
|
|
1694
|
-
|
|
1695
|
-
if (!previousRef) {
|
|
1696
|
-
// When there is no ref on the element, use the new ref directly
|
|
1697
|
-
return cloneElement(element, {
|
|
1698
|
-
ref: newRef
|
|
1699
|
-
});
|
|
1700
|
-
} else {
|
|
1701
|
-
return cloneElement(element, {
|
|
1702
|
-
ref: function ref(node) {
|
|
1703
|
-
setRef(previousRef, node);
|
|
1704
|
-
setRef(newRef, node);
|
|
1705
|
-
}
|
|
1706
|
-
});
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
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); }
|
|
1711
|
-
|
|
1712
|
-
function isRef(obj) {
|
|
1713
|
-
return (// eslint-disable-next-line no-prototype-builtins
|
|
1714
|
-
obj !== null && _typeof$2(obj) === 'object' && Object.prototype.hasOwnProperty.call(obj, 'current')
|
|
1715
|
-
);
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
function shallowEqual(objA, objB, compare, compareContext) {
|
|
1719
|
-
var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
|
|
1720
|
-
|
|
1721
|
-
if (compareResult !== void 0) {
|
|
1722
|
-
return !!compareResult;
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
if (objA === objB) {
|
|
1726
|
-
return true;
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
|
|
1730
|
-
return false;
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
var keysA = Object.keys(objA);
|
|
1734
|
-
var keysB = Object.keys(objB);
|
|
1735
|
-
|
|
1736
|
-
if (keysA.length !== keysB.length) {
|
|
1737
|
-
return false;
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
|
|
1741
|
-
|
|
1742
|
-
for (var idx = 0; idx < keysA.length; idx++) {
|
|
1743
|
-
var key = keysA[idx];
|
|
1744
|
-
|
|
1745
|
-
if (!bHasOwnProperty(key)) {
|
|
1746
|
-
return false;
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
var valueA = objA[key];
|
|
1750
|
-
var valueB = objB[key];
|
|
1751
|
-
compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
|
1752
|
-
|
|
1753
|
-
if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
|
|
1754
|
-
return false;
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
return true;
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1762
|
-
|
|
1763
|
-
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); } }
|
|
1764
|
-
|
|
1765
|
-
function _createClass$5(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$5(Constructor.prototype, protoProps); if (staticProps) _defineProperties$5(Constructor, staticProps); return Constructor; }
|
|
1766
|
-
|
|
1767
|
-
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; }
|
|
1768
|
-
var SourceConnector = /*#__PURE__*/function () {
|
|
1769
|
-
// The drop target may either be attached via ref or connect function
|
|
1770
|
-
// The drag preview may either be attached via ref or connect function
|
|
1771
|
-
function SourceConnector(backend) {
|
|
1772
|
-
var _this = this;
|
|
1773
|
-
|
|
1774
|
-
_classCallCheck$5(this, SourceConnector);
|
|
1775
|
-
|
|
1776
|
-
_defineProperty$5(this, "hooks", wrapConnectorHooks({
|
|
1777
|
-
dragSource: function dragSource(node, options) {
|
|
1778
|
-
_this.clearDragSource();
|
|
1779
|
-
|
|
1780
|
-
_this.dragSourceOptions = options || null;
|
|
1781
|
-
|
|
1782
|
-
if (isRef(node)) {
|
|
1783
|
-
_this.dragSourceRef = node;
|
|
1784
|
-
} else {
|
|
1785
|
-
_this.dragSourceNode = node;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
_this.reconnectDragSource();
|
|
1789
|
-
},
|
|
1790
|
-
dragPreview: function dragPreview(node, options) {
|
|
1791
|
-
_this.clearDragPreview();
|
|
1792
|
-
|
|
1793
|
-
_this.dragPreviewOptions = options || null;
|
|
1794
|
-
|
|
1795
|
-
if (isRef(node)) {
|
|
1796
|
-
_this.dragPreviewRef = node;
|
|
1797
|
-
} else {
|
|
1798
|
-
_this.dragPreviewNode = node;
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
_this.reconnectDragPreview();
|
|
1802
|
-
}
|
|
1803
|
-
}));
|
|
1804
|
-
|
|
1805
|
-
_defineProperty$5(this, "handlerId", null);
|
|
1806
|
-
|
|
1807
|
-
_defineProperty$5(this, "dragSourceRef", null);
|
|
1808
|
-
|
|
1809
|
-
_defineProperty$5(this, "dragSourceNode", void 0);
|
|
1810
|
-
|
|
1811
|
-
_defineProperty$5(this, "dragSourceOptionsInternal", null);
|
|
1812
|
-
|
|
1813
|
-
_defineProperty$5(this, "dragSourceUnsubscribe", void 0);
|
|
1814
|
-
|
|
1815
|
-
_defineProperty$5(this, "dragPreviewRef", null);
|
|
1816
|
-
|
|
1817
|
-
_defineProperty$5(this, "dragPreviewNode", void 0);
|
|
1818
|
-
|
|
1819
|
-
_defineProperty$5(this, "dragPreviewOptionsInternal", null);
|
|
1820
|
-
|
|
1821
|
-
_defineProperty$5(this, "dragPreviewUnsubscribe", void 0);
|
|
1822
|
-
|
|
1823
|
-
_defineProperty$5(this, "lastConnectedHandlerId", null);
|
|
1824
|
-
|
|
1825
|
-
_defineProperty$5(this, "lastConnectedDragSource", null);
|
|
1826
|
-
|
|
1827
|
-
_defineProperty$5(this, "lastConnectedDragSourceOptions", null);
|
|
1828
|
-
|
|
1829
|
-
_defineProperty$5(this, "lastConnectedDragPreview", null);
|
|
1830
|
-
|
|
1831
|
-
_defineProperty$5(this, "lastConnectedDragPreviewOptions", null);
|
|
1832
|
-
|
|
1833
|
-
_defineProperty$5(this, "backend", void 0);
|
|
1834
|
-
|
|
1835
|
-
this.backend = backend;
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
_createClass$5(SourceConnector, [{
|
|
1839
|
-
key: "receiveHandlerId",
|
|
1840
|
-
value: function receiveHandlerId(newHandlerId) {
|
|
1841
|
-
if (this.handlerId === newHandlerId) {
|
|
1842
|
-
return;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
this.handlerId = newHandlerId;
|
|
1846
|
-
this.reconnect();
|
|
1847
|
-
}
|
|
1848
|
-
}, {
|
|
1849
|
-
key: "connectTarget",
|
|
1850
|
-
get: function get() {
|
|
1851
|
-
return this.dragSource;
|
|
1852
|
-
}
|
|
1853
|
-
}, {
|
|
1854
|
-
key: "dragSourceOptions",
|
|
1855
|
-
get: function get() {
|
|
1856
|
-
return this.dragSourceOptionsInternal;
|
|
1857
|
-
},
|
|
1858
|
-
set: function set(options) {
|
|
1859
|
-
this.dragSourceOptionsInternal = options;
|
|
1860
|
-
}
|
|
1861
|
-
}, {
|
|
1862
|
-
key: "dragPreviewOptions",
|
|
1863
|
-
get: function get() {
|
|
1864
|
-
return this.dragPreviewOptionsInternal;
|
|
1865
|
-
},
|
|
1866
|
-
set: function set(options) {
|
|
1867
|
-
this.dragPreviewOptionsInternal = options;
|
|
1868
|
-
}
|
|
1869
|
-
}, {
|
|
1870
|
-
key: "reconnect",
|
|
1871
|
-
value: function reconnect() {
|
|
1872
|
-
this.reconnectDragSource();
|
|
1873
|
-
this.reconnectDragPreview();
|
|
1874
|
-
}
|
|
1875
|
-
}, {
|
|
1876
|
-
key: "reconnectDragSource",
|
|
1877
|
-
value: function reconnectDragSource() {
|
|
1878
|
-
var dragSource = this.dragSource; // if nothing has changed then don't resubscribe
|
|
1879
|
-
|
|
1880
|
-
var didChange = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange();
|
|
1881
|
-
|
|
1882
|
-
if (didChange) {
|
|
1883
|
-
this.disconnectDragSource();
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
if (!this.handlerId) {
|
|
1887
|
-
return;
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
|
-
if (!dragSource) {
|
|
1891
|
-
this.lastConnectedDragSource = dragSource;
|
|
1892
|
-
return;
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
if (didChange) {
|
|
1896
|
-
this.lastConnectedHandlerId = this.handlerId;
|
|
1897
|
-
this.lastConnectedDragSource = dragSource;
|
|
1898
|
-
this.lastConnectedDragSourceOptions = this.dragSourceOptions;
|
|
1899
|
-
this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions);
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
}, {
|
|
1903
|
-
key: "reconnectDragPreview",
|
|
1904
|
-
value: function reconnectDragPreview() {
|
|
1905
|
-
var dragPreview = this.dragPreview; // if nothing has changed then don't resubscribe
|
|
1906
|
-
|
|
1907
|
-
var didChange = this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange();
|
|
1908
|
-
|
|
1909
|
-
if (didChange) {
|
|
1910
|
-
this.disconnectDragPreview();
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
if (!this.handlerId) {
|
|
1914
|
-
return;
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
if (!dragPreview) {
|
|
1918
|
-
this.lastConnectedDragPreview = dragPreview;
|
|
1919
|
-
return;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
if (didChange) {
|
|
1923
|
-
this.lastConnectedHandlerId = this.handlerId;
|
|
1924
|
-
this.lastConnectedDragPreview = dragPreview;
|
|
1925
|
-
this.lastConnectedDragPreviewOptions = this.dragPreviewOptions;
|
|
1926
|
-
this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions);
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
}, {
|
|
1930
|
-
key: "didHandlerIdChange",
|
|
1931
|
-
value: function didHandlerIdChange() {
|
|
1932
|
-
return this.lastConnectedHandlerId !== this.handlerId;
|
|
1933
|
-
}
|
|
1934
|
-
}, {
|
|
1935
|
-
key: "didConnectedDragSourceChange",
|
|
1936
|
-
value: function didConnectedDragSourceChange() {
|
|
1937
|
-
return this.lastConnectedDragSource !== this.dragSource;
|
|
1938
|
-
}
|
|
1939
|
-
}, {
|
|
1940
|
-
key: "didConnectedDragPreviewChange",
|
|
1941
|
-
value: function didConnectedDragPreviewChange() {
|
|
1942
|
-
return this.lastConnectedDragPreview !== this.dragPreview;
|
|
1943
|
-
}
|
|
1944
|
-
}, {
|
|
1945
|
-
key: "didDragSourceOptionsChange",
|
|
1946
|
-
value: function didDragSourceOptionsChange() {
|
|
1947
|
-
return !shallowEqual(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
|
|
1948
|
-
}
|
|
1949
|
-
}, {
|
|
1950
|
-
key: "didDragPreviewOptionsChange",
|
|
1951
|
-
value: function didDragPreviewOptionsChange() {
|
|
1952
|
-
return !shallowEqual(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
|
|
1953
|
-
}
|
|
1954
|
-
}, {
|
|
1955
|
-
key: "disconnectDragSource",
|
|
1956
|
-
value: function disconnectDragSource() {
|
|
1957
|
-
if (this.dragSourceUnsubscribe) {
|
|
1958
|
-
this.dragSourceUnsubscribe();
|
|
1959
|
-
this.dragSourceUnsubscribe = undefined;
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
}, {
|
|
1963
|
-
key: "disconnectDragPreview",
|
|
1964
|
-
value: function disconnectDragPreview() {
|
|
1965
|
-
if (this.dragPreviewUnsubscribe) {
|
|
1966
|
-
this.dragPreviewUnsubscribe();
|
|
1967
|
-
this.dragPreviewUnsubscribe = undefined;
|
|
1968
|
-
this.dragPreviewNode = null;
|
|
1969
|
-
this.dragPreviewRef = null;
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
}, {
|
|
1973
|
-
key: "dragSource",
|
|
1974
|
-
get: function get() {
|
|
1975
|
-
return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current;
|
|
1976
|
-
}
|
|
1977
|
-
}, {
|
|
1978
|
-
key: "dragPreview",
|
|
1979
|
-
get: function get() {
|
|
1980
|
-
return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current;
|
|
1981
|
-
}
|
|
1982
|
-
}, {
|
|
1983
|
-
key: "clearDragSource",
|
|
1984
|
-
value: function clearDragSource() {
|
|
1985
|
-
this.dragSourceNode = null;
|
|
1986
|
-
this.dragSourceRef = null;
|
|
1987
|
-
}
|
|
1988
|
-
}, {
|
|
1989
|
-
key: "clearDragPreview",
|
|
1990
|
-
value: function clearDragPreview() {
|
|
1991
|
-
this.dragPreviewNode = null;
|
|
1992
|
-
this.dragPreviewRef = null;
|
|
1993
|
-
}
|
|
1994
|
-
}]);
|
|
1995
|
-
|
|
1996
|
-
return SourceConnector;
|
|
1997
|
-
}();
|
|
1998
|
-
|
|
1999
|
-
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2000
|
-
|
|
2001
|
-
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); } }
|
|
2002
|
-
|
|
2003
|
-
function _createClass$4(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); if (staticProps) _defineProperties$4(Constructor, staticProps); return Constructor; }
|
|
2004
|
-
|
|
2005
|
-
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; }
|
|
2006
|
-
var TargetConnector = /*#__PURE__*/function () {
|
|
2007
|
-
// The drop target may either be attached via ref or connect function
|
|
2008
|
-
function TargetConnector(backend) {
|
|
2009
|
-
var _this = this;
|
|
2010
|
-
|
|
2011
|
-
_classCallCheck$4(this, TargetConnector);
|
|
2012
|
-
|
|
2013
|
-
_defineProperty$4(this, "hooks", wrapConnectorHooks({
|
|
2014
|
-
dropTarget: function dropTarget(node, options) {
|
|
2015
|
-
_this.clearDropTarget();
|
|
2016
|
-
|
|
2017
|
-
_this.dropTargetOptions = options;
|
|
2018
|
-
|
|
2019
|
-
if (isRef(node)) {
|
|
2020
|
-
_this.dropTargetRef = node;
|
|
2021
|
-
} else {
|
|
2022
|
-
_this.dropTargetNode = node;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
_this.reconnect();
|
|
2026
|
-
}
|
|
2027
|
-
}));
|
|
2028
|
-
|
|
2029
|
-
_defineProperty$4(this, "handlerId", null);
|
|
2030
|
-
|
|
2031
|
-
_defineProperty$4(this, "dropTargetRef", null);
|
|
2032
|
-
|
|
2033
|
-
_defineProperty$4(this, "dropTargetNode", void 0);
|
|
2034
|
-
|
|
2035
|
-
_defineProperty$4(this, "dropTargetOptionsInternal", null);
|
|
2036
|
-
|
|
2037
|
-
_defineProperty$4(this, "unsubscribeDropTarget", void 0);
|
|
2038
|
-
|
|
2039
|
-
_defineProperty$4(this, "lastConnectedHandlerId", null);
|
|
2040
|
-
|
|
2041
|
-
_defineProperty$4(this, "lastConnectedDropTarget", null);
|
|
2042
|
-
|
|
2043
|
-
_defineProperty$4(this, "lastConnectedDropTargetOptions", null);
|
|
2044
|
-
|
|
2045
|
-
_defineProperty$4(this, "backend", void 0);
|
|
2046
|
-
|
|
2047
|
-
this.backend = backend;
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
_createClass$4(TargetConnector, [{
|
|
2051
|
-
key: "connectTarget",
|
|
2052
|
-
get: function get() {
|
|
2053
|
-
return this.dropTarget;
|
|
2054
|
-
}
|
|
2055
|
-
}, {
|
|
2056
|
-
key: "reconnect",
|
|
2057
|
-
value: function reconnect() {
|
|
2058
|
-
// if nothing has changed then don't resubscribe
|
|
2059
|
-
var didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();
|
|
2060
|
-
|
|
2061
|
-
if (didChange) {
|
|
2062
|
-
this.disconnectDropTarget();
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
var dropTarget = this.dropTarget;
|
|
2066
|
-
|
|
2067
|
-
if (!this.handlerId) {
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
if (!dropTarget) {
|
|
2072
|
-
this.lastConnectedDropTarget = dropTarget;
|
|
2073
|
-
return;
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
if (didChange) {
|
|
2077
|
-
this.lastConnectedHandlerId = this.handlerId;
|
|
2078
|
-
this.lastConnectedDropTarget = dropTarget;
|
|
2079
|
-
this.lastConnectedDropTargetOptions = this.dropTargetOptions;
|
|
2080
|
-
this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
}, {
|
|
2084
|
-
key: "receiveHandlerId",
|
|
2085
|
-
value: function receiveHandlerId(newHandlerId) {
|
|
2086
|
-
if (newHandlerId === this.handlerId) {
|
|
2087
|
-
return;
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
this.handlerId = newHandlerId;
|
|
2091
|
-
this.reconnect();
|
|
2092
|
-
}
|
|
2093
|
-
}, {
|
|
2094
|
-
key: "dropTargetOptions",
|
|
2095
|
-
get: function get() {
|
|
2096
|
-
return this.dropTargetOptionsInternal;
|
|
2097
|
-
},
|
|
2098
|
-
set: function set(options) {
|
|
2099
|
-
this.dropTargetOptionsInternal = options;
|
|
2100
|
-
}
|
|
2101
|
-
}, {
|
|
2102
|
-
key: "didHandlerIdChange",
|
|
2103
|
-
value: function didHandlerIdChange() {
|
|
2104
|
-
return this.lastConnectedHandlerId !== this.handlerId;
|
|
2105
|
-
}
|
|
2106
|
-
}, {
|
|
2107
|
-
key: "didDropTargetChange",
|
|
2108
|
-
value: function didDropTargetChange() {
|
|
2109
|
-
return this.lastConnectedDropTarget !== this.dropTarget;
|
|
2110
|
-
}
|
|
2111
|
-
}, {
|
|
2112
|
-
key: "didOptionsChange",
|
|
2113
|
-
value: function didOptionsChange() {
|
|
2114
|
-
return !shallowEqual(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
|
|
2115
|
-
}
|
|
2116
|
-
}, {
|
|
2117
|
-
key: "disconnectDropTarget",
|
|
2118
|
-
value: function disconnectDropTarget() {
|
|
2119
|
-
if (this.unsubscribeDropTarget) {
|
|
2120
|
-
this.unsubscribeDropTarget();
|
|
2121
|
-
this.unsubscribeDropTarget = undefined;
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
}, {
|
|
2125
|
-
key: "dropTarget",
|
|
2126
|
-
get: function get() {
|
|
2127
|
-
return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;
|
|
2128
|
-
}
|
|
2129
|
-
}, {
|
|
2130
|
-
key: "clearDropTarget",
|
|
2131
|
-
value: function clearDropTarget() {
|
|
2132
|
-
this.dropTargetRef = null;
|
|
2133
|
-
this.dropTargetNode = null;
|
|
2134
|
-
}
|
|
2135
|
-
}]);
|
|
2136
|
-
|
|
2137
|
-
return TargetConnector;
|
|
2138
|
-
}();
|
|
2139
|
-
|
|
2140
|
-
function registerTarget(type, target, manager) {
|
|
2141
|
-
var registry = manager.getRegistry();
|
|
2142
|
-
var targetId = registry.addTarget(type, target);
|
|
2143
|
-
return [targetId, function () {
|
|
2144
|
-
return registry.removeTarget(targetId);
|
|
2145
|
-
}];
|
|
2146
|
-
}
|
|
2147
|
-
function registerSource(type, source, manager) {
|
|
2148
|
-
var registry = manager.getRegistry();
|
|
2149
|
-
var sourceId = registry.addSource(type, source);
|
|
2150
|
-
return [sourceId, function () {
|
|
2151
|
-
return registry.removeSource(sourceId);
|
|
2152
|
-
}];
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
|
-
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); }
|
|
2156
|
-
|
|
2157
|
-
function getDecoratedComponent(instanceRef) {
|
|
2158
|
-
var currentRef = instanceRef.current;
|
|
2159
|
-
|
|
2160
|
-
if (currentRef == null) {
|
|
2161
|
-
return null;
|
|
2162
|
-
} else if (currentRef.decoratedRef) {
|
|
2163
|
-
// go through the private field in decorateHandler to avoid the invariant hit
|
|
2164
|
-
return currentRef.decoratedRef.current;
|
|
2165
|
-
} else {
|
|
2166
|
-
return currentRef;
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
function isClassComponent(Component) {
|
|
2170
|
-
return Component && Component.prototype && typeof Component.prototype.render === 'function';
|
|
2171
|
-
}
|
|
2172
|
-
function isRefForwardingComponent(C) {
|
|
2173
|
-
var _item$$$typeof;
|
|
2174
|
-
|
|
2175
|
-
var item = C;
|
|
2176
|
-
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)';
|
|
2177
|
-
}
|
|
2178
|
-
function isRefable(C) {
|
|
2179
|
-
return isClassComponent(C) || isRefForwardingComponent(C);
|
|
2180
|
-
}
|
|
2181
|
-
function checkDecoratorArguments(functionName, signature) {
|
|
2182
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2183
|
-
for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) {
|
|
2184
|
-
var arg = i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2];
|
|
2185
|
-
|
|
2186
|
-
if (arg && arg.prototype && arg.prototype.render) {
|
|
2187
|
-
// eslint-disable-next-line no-console
|
|
2188
|
-
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');
|
|
2189
|
-
return;
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
function isFunction(input) {
|
|
2195
|
-
return typeof input === 'function';
|
|
2196
|
-
}
|
|
2197
|
-
function noop() {// noop
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
function isObjectLike(input) {
|
|
2201
|
-
return _typeof$1(input) === 'object' && input !== null;
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
function isPlainObject(input) {
|
|
2205
|
-
if (!isObjectLike(input)) {
|
|
2206
|
-
return false;
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
2210
|
-
return true;
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
|
-
var proto = input;
|
|
2214
|
-
|
|
2215
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
2216
|
-
proto = Object.getPrototypeOf(proto);
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
return Object.getPrototypeOf(input) === proto;
|
|
2220
|
-
}
|
|
2221
|
-
function isValidType(type, allowArray) {
|
|
2222
|
-
return typeof type === 'string' || _typeof$1(type) === 'symbol' || !!allowArray && Array.isArray(type) && type.every(function (t) {
|
|
2223
|
-
return isValidType(t, false);
|
|
2224
|
-
});
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2228
|
-
|
|
2229
|
-
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); } }
|
|
2230
|
-
|
|
2231
|
-
function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); if (staticProps) _defineProperties$3(Constructor, staticProps); return Constructor; }
|
|
2232
|
-
|
|
2233
|
-
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; }
|
|
2234
|
-
/**
|
|
2235
|
-
* Provides a set of static methods for creating Disposables.
|
|
2236
|
-
* @param {Function} action Action to run during the first call to dispose.
|
|
2237
|
-
* The action is guaranteed to be run at most once.
|
|
2238
|
-
*/
|
|
2239
|
-
|
|
2240
|
-
var Disposable = /*#__PURE__*/function () {
|
|
2241
|
-
function Disposable(action) {
|
|
2242
|
-
_classCallCheck$3(this, Disposable);
|
|
2243
|
-
|
|
2244
|
-
_defineProperty$3(this, "isDisposed", false);
|
|
2245
|
-
|
|
2246
|
-
_defineProperty$3(this, "action", void 0);
|
|
2247
|
-
|
|
2248
|
-
this.action = isFunction(action) ? action : noop;
|
|
2249
|
-
}
|
|
2250
|
-
/** Performs the task of cleaning up resources. */
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
_createClass$3(Disposable, [{
|
|
2254
|
-
key: "dispose",
|
|
2255
|
-
value: function dispose() {
|
|
2256
|
-
if (!this.isDisposed) {
|
|
2257
|
-
this.action();
|
|
2258
|
-
this.isDisposed = true;
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
}], [{
|
|
2262
|
-
key: "isDisposable",
|
|
2263
|
-
value:
|
|
2264
|
-
/**
|
|
2265
|
-
* Gets the disposable that does nothing when disposed.
|
|
2266
|
-
*/
|
|
2267
|
-
|
|
2268
|
-
/**
|
|
2269
|
-
* Validates whether the given object is a disposable
|
|
2270
|
-
* @param {Object} Object to test whether it has a dispose method
|
|
2271
|
-
* @returns {Boolean} true if a disposable object, else false.
|
|
2272
|
-
*/
|
|
2273
|
-
function isDisposable(d) {
|
|
2274
|
-
return Boolean(d && isFunction(d.dispose));
|
|
2275
|
-
}
|
|
2276
|
-
}, {
|
|
2277
|
-
key: "_fixup",
|
|
2278
|
-
value: function _fixup(result) {
|
|
2279
|
-
return Disposable.isDisposable(result) ? result : Disposable.empty;
|
|
2280
|
-
}
|
|
2281
|
-
/**
|
|
2282
|
-
* Creates a disposable object that invokes the specified action when disposed.
|
|
2283
|
-
* @param {Function} dispose Action to run during the first call to dispose.
|
|
2284
|
-
* The action is guaranteed to be run at most once.
|
|
2285
|
-
* @return {Disposable} The disposable object that runs the given action upon disposal.
|
|
2286
|
-
*/
|
|
2287
|
-
|
|
2288
|
-
}, {
|
|
2289
|
-
key: "create",
|
|
2290
|
-
value: function create(action) {
|
|
2291
|
-
return new Disposable(action);
|
|
2292
|
-
}
|
|
2293
|
-
}]);
|
|
2294
|
-
|
|
2295
|
-
return Disposable;
|
|
2296
|
-
}();
|
|
2297
|
-
/**
|
|
2298
|
-
* Represents a group of disposable resources that are disposed together.
|
|
2299
|
-
* @constructor
|
|
2300
|
-
*/
|
|
2301
|
-
|
|
2302
|
-
_defineProperty$3(Disposable, "empty", {
|
|
2303
|
-
dispose: noop
|
|
2304
|
-
});
|
|
2305
|
-
|
|
2306
|
-
var CompositeDisposable = /*#__PURE__*/function () {
|
|
2307
|
-
function CompositeDisposable() {
|
|
2308
|
-
_classCallCheck$3(this, CompositeDisposable);
|
|
2309
|
-
|
|
2310
|
-
_defineProperty$3(this, "isDisposed", false);
|
|
2311
|
-
|
|
2312
|
-
_defineProperty$3(this, "disposables", void 0);
|
|
2313
|
-
|
|
2314
|
-
for (var _len = arguments.length, disposables = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2315
|
-
disposables[_key] = arguments[_key];
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
this.disposables = disposables;
|
|
2319
|
-
}
|
|
2320
|
-
/**
|
|
2321
|
-
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
|
|
2322
|
-
* @param {Any} item Disposable to add.
|
|
2323
|
-
*/
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
_createClass$3(CompositeDisposable, [{
|
|
2327
|
-
key: "add",
|
|
2328
|
-
value: function add(item) {
|
|
2329
|
-
if (this.isDisposed) {
|
|
2330
|
-
item.dispose();
|
|
2331
|
-
} else {
|
|
2332
|
-
this.disposables.push(item);
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
|
-
/**
|
|
2336
|
-
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
|
|
2337
|
-
* @param {Any} item Disposable to remove.
|
|
2338
|
-
* @returns {Boolean} true if found; false otherwise.
|
|
2339
|
-
*/
|
|
2340
|
-
|
|
2341
|
-
}, {
|
|
2342
|
-
key: "remove",
|
|
2343
|
-
value: function remove(item) {
|
|
2344
|
-
var shouldDispose = false;
|
|
2345
|
-
|
|
2346
|
-
if (!this.isDisposed) {
|
|
2347
|
-
var idx = this.disposables.indexOf(item);
|
|
2348
|
-
|
|
2349
|
-
if (idx !== -1) {
|
|
2350
|
-
shouldDispose = true;
|
|
2351
|
-
this.disposables.splice(idx, 1);
|
|
2352
|
-
item.dispose();
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
|
|
2356
|
-
return shouldDispose;
|
|
2357
|
-
}
|
|
2358
|
-
/**
|
|
2359
|
-
* Disposes all disposables in the group and removes them from the group but
|
|
2360
|
-
* does not dispose the CompositeDisposable.
|
|
2361
|
-
*/
|
|
2362
|
-
|
|
2363
|
-
}, {
|
|
2364
|
-
key: "clear",
|
|
2365
|
-
value: function clear() {
|
|
2366
|
-
if (!this.isDisposed) {
|
|
2367
|
-
var len = this.disposables.length;
|
|
2368
|
-
var currentDisposables = new Array(len);
|
|
2369
|
-
|
|
2370
|
-
for (var i = 0; i < len; i++) {
|
|
2371
|
-
currentDisposables[i] = this.disposables[i];
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
this.disposables = [];
|
|
2375
|
-
|
|
2376
|
-
for (var _i = 0; _i < len; _i++) {
|
|
2377
|
-
currentDisposables[_i].dispose();
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
/**
|
|
2382
|
-
* Disposes all disposables in the group and removes them from the group.
|
|
2383
|
-
*/
|
|
2384
|
-
|
|
2385
|
-
}, {
|
|
2386
|
-
key: "dispose",
|
|
2387
|
-
value: function dispose() {
|
|
2388
|
-
if (!this.isDisposed) {
|
|
2389
|
-
this.isDisposed = true;
|
|
2390
|
-
var len = this.disposables.length;
|
|
2391
|
-
var currentDisposables = new Array(len);
|
|
2392
|
-
|
|
2393
|
-
for (var i = 0; i < len; i++) {
|
|
2394
|
-
currentDisposables[i] = this.disposables[i];
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
this.disposables = [];
|
|
2398
|
-
|
|
2399
|
-
for (var _i2 = 0; _i2 < len; _i2++) {
|
|
2400
|
-
currentDisposables[_i2].dispose();
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
}]);
|
|
2405
|
-
|
|
2406
|
-
return CompositeDisposable;
|
|
2407
|
-
}();
|
|
2408
|
-
/**
|
|
2409
|
-
* Represents a disposable resource whose underlying disposable resource can
|
|
2410
|
-
* be replaced by another disposable resource, causing automatic disposal of
|
|
2411
|
-
* the previous underlying disposable resource.
|
|
2412
|
-
*/
|
|
2413
|
-
|
|
2414
|
-
var SerialDisposable = /*#__PURE__*/function () {
|
|
2415
|
-
function SerialDisposable() {
|
|
2416
|
-
_classCallCheck$3(this, SerialDisposable);
|
|
2417
|
-
|
|
2418
|
-
_defineProperty$3(this, "isDisposed", false);
|
|
2419
|
-
|
|
2420
|
-
_defineProperty$3(this, "current", void 0);
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
|
-
_createClass$3(SerialDisposable, [{
|
|
2424
|
-
key: "getDisposable",
|
|
2425
|
-
value:
|
|
2426
|
-
/**
|
|
2427
|
-
* Gets the underlying disposable.
|
|
2428
|
-
* @returns {Any} the underlying disposable.
|
|
2429
|
-
*/
|
|
2430
|
-
function getDisposable() {
|
|
2431
|
-
return this.current;
|
|
2432
|
-
}
|
|
2433
|
-
}, {
|
|
2434
|
-
key: "setDisposable",
|
|
2435
|
-
value: function setDisposable(value) {
|
|
2436
|
-
var shouldDispose = this.isDisposed;
|
|
2437
|
-
|
|
2438
|
-
if (!shouldDispose) {
|
|
2439
|
-
var old = this.current;
|
|
2440
|
-
this.current = value;
|
|
2441
|
-
|
|
2442
|
-
if (old) {
|
|
2443
|
-
old.dispose();
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
if (shouldDispose && value) {
|
|
2448
|
-
value.dispose();
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
/** Performs the task of cleaning up resources. */
|
|
2452
|
-
|
|
2453
|
-
}, {
|
|
2454
|
-
key: "dispose",
|
|
2455
|
-
value: function dispose() {
|
|
2456
|
-
if (!this.isDisposed) {
|
|
2457
|
-
this.isDisposed = true;
|
|
2458
|
-
var old = this.current;
|
|
2459
|
-
this.current = undefined;
|
|
2460
|
-
|
|
2461
|
-
if (old) {
|
|
2462
|
-
old.dispose();
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
}]);
|
|
2467
|
-
|
|
2468
|
-
return SerialDisposable;
|
|
2469
|
-
}();
|
|
2470
|
-
|
|
2471
|
-
var reactIs$1 = {exports: {}};
|
|
2472
|
-
|
|
2473
|
-
var reactIs_production_min = {};
|
|
2474
|
-
|
|
2475
|
-
/** @license React v16.13.1
|
|
2476
|
-
* react-is.production.min.js
|
|
2477
|
-
*
|
|
2478
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2479
|
-
*
|
|
2480
|
-
* This source code is licensed under the MIT license found in the
|
|
2481
|
-
* LICENSE file in the root directory of this source tree.
|
|
2482
|
-
*/
|
|
2483
|
-
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?
|
|
2484
|
-
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;
|
|
2485
|
-
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;
|
|
2486
|
-
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};
|
|
2487
|
-
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};
|
|
2488
|
-
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;
|
|
2489
|
-
|
|
2490
|
-
var reactIs_development = {};
|
|
2491
|
-
|
|
2492
|
-
/** @license React v16.13.1
|
|
2493
|
-
* react-is.development.js
|
|
2494
|
-
*
|
|
2495
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2496
|
-
*
|
|
2497
|
-
* This source code is licensed under the MIT license found in the
|
|
2498
|
-
* LICENSE file in the root directory of this source tree.
|
|
2499
|
-
*/
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2504
|
-
(function() {
|
|
2505
|
-
|
|
2506
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
2507
|
-
// nor polyfill, then a plain number is used for performance.
|
|
2508
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
2509
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
2510
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
2511
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
2512
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
2513
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
2514
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
2515
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
2516
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
2517
|
-
|
|
2518
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
2519
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2520
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2521
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2522
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
2523
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2524
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2525
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
2526
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
2527
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
2528
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
2529
|
-
|
|
2530
|
-
function isValidElementType(type) {
|
|
2531
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
2532
|
-
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);
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
function typeOf(object) {
|
|
2536
|
-
if (typeof object === 'object' && object !== null) {
|
|
2537
|
-
var $$typeof = object.$$typeof;
|
|
2538
|
-
|
|
2539
|
-
switch ($$typeof) {
|
|
2540
|
-
case REACT_ELEMENT_TYPE:
|
|
2541
|
-
var type = object.type;
|
|
2542
|
-
|
|
2543
|
-
switch (type) {
|
|
2544
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
2545
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
2546
|
-
case REACT_FRAGMENT_TYPE:
|
|
2547
|
-
case REACT_PROFILER_TYPE:
|
|
2548
|
-
case REACT_STRICT_MODE_TYPE:
|
|
2549
|
-
case REACT_SUSPENSE_TYPE:
|
|
2550
|
-
return type;
|
|
2551
|
-
|
|
2552
|
-
default:
|
|
2553
|
-
var $$typeofType = type && type.$$typeof;
|
|
2554
|
-
|
|
2555
|
-
switch ($$typeofType) {
|
|
2556
|
-
case REACT_CONTEXT_TYPE:
|
|
2557
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2558
|
-
case REACT_LAZY_TYPE:
|
|
2559
|
-
case REACT_MEMO_TYPE:
|
|
2560
|
-
case REACT_PROVIDER_TYPE:
|
|
2561
|
-
return $$typeofType;
|
|
2562
|
-
|
|
2563
|
-
default:
|
|
2564
|
-
return $$typeof;
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
case REACT_PORTAL_TYPE:
|
|
2570
|
-
return $$typeof;
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
|
|
2574
|
-
return undefined;
|
|
2575
|
-
} // AsyncMode is deprecated along with isAsyncMode
|
|
2576
|
-
|
|
2577
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
2578
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
2579
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
2580
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
2581
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
2582
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
2583
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
2584
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
2585
|
-
var Memo = REACT_MEMO_TYPE;
|
|
2586
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
2587
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
2588
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2589
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
2590
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
2591
|
-
|
|
2592
|
-
function isAsyncMode(object) {
|
|
2593
|
-
{
|
|
2594
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
2595
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
2596
|
-
|
|
2597
|
-
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.');
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
2602
|
-
}
|
|
2603
|
-
function isConcurrentMode(object) {
|
|
2604
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
2605
|
-
}
|
|
2606
|
-
function isContextConsumer(object) {
|
|
2607
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
2608
|
-
}
|
|
2609
|
-
function isContextProvider(object) {
|
|
2610
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
2611
|
-
}
|
|
2612
|
-
function isElement(object) {
|
|
2613
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2614
|
-
}
|
|
2615
|
-
function isForwardRef(object) {
|
|
2616
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
2617
|
-
}
|
|
2618
|
-
function isFragment(object) {
|
|
2619
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
2620
|
-
}
|
|
2621
|
-
function isLazy(object) {
|
|
2622
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
2623
|
-
}
|
|
2624
|
-
function isMemo(object) {
|
|
2625
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
2626
|
-
}
|
|
2627
|
-
function isPortal(object) {
|
|
2628
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
2629
|
-
}
|
|
2630
|
-
function isProfiler(object) {
|
|
2631
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
2632
|
-
}
|
|
2633
|
-
function isStrictMode(object) {
|
|
2634
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
2635
|
-
}
|
|
2636
|
-
function isSuspense(object) {
|
|
2637
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
2641
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
2642
|
-
reactIs_development.ContextConsumer = ContextConsumer;
|
|
2643
|
-
reactIs_development.ContextProvider = ContextProvider;
|
|
2644
|
-
reactIs_development.Element = Element;
|
|
2645
|
-
reactIs_development.ForwardRef = ForwardRef;
|
|
2646
|
-
reactIs_development.Fragment = Fragment;
|
|
2647
|
-
reactIs_development.Lazy = Lazy;
|
|
2648
|
-
reactIs_development.Memo = Memo;
|
|
2649
|
-
reactIs_development.Portal = Portal;
|
|
2650
|
-
reactIs_development.Profiler = Profiler;
|
|
2651
|
-
reactIs_development.StrictMode = StrictMode;
|
|
2652
|
-
reactIs_development.Suspense = Suspense;
|
|
2653
|
-
reactIs_development.isAsyncMode = isAsyncMode;
|
|
2654
|
-
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
2655
|
-
reactIs_development.isContextConsumer = isContextConsumer;
|
|
2656
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
2657
|
-
reactIs_development.isElement = isElement;
|
|
2658
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
2659
|
-
reactIs_development.isFragment = isFragment;
|
|
2660
|
-
reactIs_development.isLazy = isLazy;
|
|
2661
|
-
reactIs_development.isMemo = isMemo;
|
|
2662
|
-
reactIs_development.isPortal = isPortal;
|
|
2663
|
-
reactIs_development.isProfiler = isProfiler;
|
|
2664
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
2665
|
-
reactIs_development.isSuspense = isSuspense;
|
|
2666
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
2667
|
-
reactIs_development.typeOf = typeOf;
|
|
2668
|
-
})();
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2671
|
-
if (process.env.NODE_ENV === 'production') {
|
|
2672
|
-
reactIs$1.exports = reactIs_production_min;
|
|
2673
|
-
} else {
|
|
2674
|
-
reactIs$1.exports = reactIs_development;
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2677
|
-
var reactIs = reactIs$1.exports;
|
|
2678
|
-
|
|
2679
|
-
/**
|
|
2680
|
-
* Copyright 2015, Yahoo! Inc.
|
|
2681
|
-
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
2682
|
-
*/
|
|
2683
|
-
var REACT_STATICS = {
|
|
2684
|
-
childContextTypes: true,
|
|
2685
|
-
contextType: true,
|
|
2686
|
-
contextTypes: true,
|
|
2687
|
-
defaultProps: true,
|
|
2688
|
-
displayName: true,
|
|
2689
|
-
getDefaultProps: true,
|
|
2690
|
-
getDerivedStateFromError: true,
|
|
2691
|
-
getDerivedStateFromProps: true,
|
|
2692
|
-
mixins: true,
|
|
2693
|
-
propTypes: true,
|
|
2694
|
-
type: true
|
|
2695
|
-
};
|
|
2696
|
-
var KNOWN_STATICS = {
|
|
2697
|
-
name: true,
|
|
2698
|
-
length: true,
|
|
2699
|
-
prototype: true,
|
|
2700
|
-
caller: true,
|
|
2701
|
-
callee: true,
|
|
2702
|
-
arguments: true,
|
|
2703
|
-
arity: true
|
|
2704
|
-
};
|
|
2705
|
-
var FORWARD_REF_STATICS = {
|
|
2706
|
-
'$$typeof': true,
|
|
2707
|
-
render: true,
|
|
2708
|
-
defaultProps: true,
|
|
2709
|
-
displayName: true,
|
|
2710
|
-
propTypes: true
|
|
2711
|
-
};
|
|
2712
|
-
var MEMO_STATICS = {
|
|
2713
|
-
'$$typeof': true,
|
|
2714
|
-
compare: true,
|
|
2715
|
-
defaultProps: true,
|
|
2716
|
-
displayName: true,
|
|
2717
|
-
propTypes: true,
|
|
2718
|
-
type: true
|
|
2719
|
-
};
|
|
2720
|
-
var TYPE_STATICS = {};
|
|
2721
|
-
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
2722
|
-
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
2723
|
-
|
|
2724
|
-
function getStatics(component) {
|
|
2725
|
-
// React v16.11 and below
|
|
2726
|
-
if (reactIs.isMemo(component)) {
|
|
2727
|
-
return MEMO_STATICS;
|
|
2728
|
-
} // React v16.12 and above
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
var defineProperty = Object.defineProperty;
|
|
2735
|
-
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
2736
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2737
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
2738
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
|
2739
|
-
var objectPrototype = Object.prototype;
|
|
2740
|
-
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
2741
|
-
if (typeof sourceComponent !== 'string') {
|
|
2742
|
-
// don't hoist over string (html) components
|
|
2743
|
-
if (objectPrototype) {
|
|
2744
|
-
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
2745
|
-
|
|
2746
|
-
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
2747
|
-
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
2748
|
-
}
|
|
2749
|
-
}
|
|
2750
|
-
|
|
2751
|
-
var keys = getOwnPropertyNames(sourceComponent);
|
|
2752
|
-
|
|
2753
|
-
if (getOwnPropertySymbols) {
|
|
2754
|
-
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
|
-
var targetStatics = getStatics(targetComponent);
|
|
2758
|
-
var sourceStatics = getStatics(sourceComponent);
|
|
2759
|
-
|
|
2760
|
-
for (var i = 0; i < keys.length; ++i) {
|
|
2761
|
-
var key = keys[i];
|
|
2762
|
-
|
|
2763
|
-
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
2764
|
-
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
2765
|
-
|
|
2766
|
-
try {
|
|
2767
|
-
// Avoid failures from read-only properties
|
|
2768
|
-
defineProperty(targetComponent, key, descriptor);
|
|
2769
|
-
} catch (e) {}
|
|
2770
|
-
}
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2774
|
-
return targetComponent;
|
|
2775
|
-
}
|
|
2776
|
-
|
|
2777
|
-
var hoistNonReactStatics_cjs = hoistNonReactStatics;
|
|
2778
|
-
|
|
2779
|
-
var hoistStatics = hoistNonReactStatics_cjs;
|
|
2780
|
-
|
|
2781
|
-
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); }
|
|
2782
|
-
|
|
2783
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2784
|
-
|
|
2785
|
-
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."); }
|
|
2786
|
-
|
|
2787
|
-
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); }
|
|
2788
|
-
|
|
2789
|
-
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; }
|
|
2790
|
-
|
|
2791
|
-
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; }
|
|
2792
|
-
|
|
2793
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2794
|
-
|
|
2795
|
-
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2796
|
-
|
|
2797
|
-
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); } }
|
|
2798
|
-
|
|
2799
|
-
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); return Constructor; }
|
|
2800
|
-
|
|
2801
|
-
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); }
|
|
2802
|
-
|
|
2803
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
2804
|
-
|
|
2805
|
-
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); }; }
|
|
2806
|
-
|
|
2807
|
-
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); }
|
|
2808
|
-
|
|
2809
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2810
|
-
|
|
2811
|
-
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; } }
|
|
2812
|
-
|
|
2813
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
2814
|
-
|
|
2815
|
-
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; }
|
|
2816
|
-
function decorateHandler(_ref) {
|
|
2817
|
-
var DecoratedComponent = _ref.DecoratedComponent,
|
|
2818
|
-
createHandler = _ref.createHandler,
|
|
2819
|
-
createMonitor = _ref.createMonitor,
|
|
2820
|
-
createConnector = _ref.createConnector,
|
|
2821
|
-
registerHandler = _ref.registerHandler,
|
|
2822
|
-
containerDisplayName = _ref.containerDisplayName,
|
|
2823
|
-
getType = _ref.getType,
|
|
2824
|
-
collect = _ref.collect,
|
|
2825
|
-
options = _ref.options;
|
|
2826
|
-
var _options$arePropsEqua = options.arePropsEqual,
|
|
2827
|
-
arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;
|
|
2828
|
-
var Decorated = DecoratedComponent;
|
|
2829
|
-
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
|
|
2830
|
-
|
|
2831
|
-
var DragDropContainer = /*#__PURE__*/function (_Component) {
|
|
2832
|
-
_inherits(DragDropContainer, _Component);
|
|
2833
|
-
|
|
2834
|
-
var _super = _createSuper(DragDropContainer);
|
|
2835
|
-
|
|
2836
|
-
function DragDropContainer(props) {
|
|
2837
|
-
var _this;
|
|
2838
|
-
|
|
2839
|
-
_classCallCheck$2(this, DragDropContainer);
|
|
2840
|
-
|
|
2841
|
-
_this = _super.call(this, props);
|
|
2842
|
-
|
|
2843
|
-
_defineProperty$2(_assertThisInitialized(_this), "decoratedRef", createRef());
|
|
2844
|
-
|
|
2845
|
-
_defineProperty$2(_assertThisInitialized(_this), "handlerId", void 0);
|
|
2846
|
-
|
|
2847
|
-
_defineProperty$2(_assertThisInitialized(_this), "manager", void 0);
|
|
2848
|
-
|
|
2849
|
-
_defineProperty$2(_assertThisInitialized(_this), "handlerMonitor", void 0);
|
|
2850
|
-
|
|
2851
|
-
_defineProperty$2(_assertThisInitialized(_this), "handlerConnector", void 0);
|
|
2852
|
-
|
|
2853
|
-
_defineProperty$2(_assertThisInitialized(_this), "handler", void 0);
|
|
2854
|
-
|
|
2855
|
-
_defineProperty$2(_assertThisInitialized(_this), "disposable", void 0);
|
|
2856
|
-
|
|
2857
|
-
_defineProperty$2(_assertThisInitialized(_this), "currentType", void 0);
|
|
2858
|
-
|
|
2859
|
-
_defineProperty$2(_assertThisInitialized(_this), "handleChange", function () {
|
|
2860
|
-
var nextState = _this.getCurrentState();
|
|
2861
|
-
|
|
2862
|
-
if (!shallowEqual(nextState, _this.state)) {
|
|
2863
|
-
_this.setState(nextState);
|
|
2864
|
-
}
|
|
2865
|
-
});
|
|
2866
|
-
|
|
2867
|
-
_this.disposable = new SerialDisposable();
|
|
2868
|
-
|
|
2869
|
-
_this.receiveProps(props);
|
|
2870
|
-
|
|
2871
|
-
_this.dispose();
|
|
2872
|
-
|
|
2873
|
-
return _this;
|
|
2874
|
-
}
|
|
2875
|
-
|
|
2876
|
-
_createClass$2(DragDropContainer, [{
|
|
2877
|
-
key: "getHandlerId",
|
|
2878
|
-
value: function getHandlerId() {
|
|
2879
|
-
return this.handlerId;
|
|
2880
|
-
}
|
|
2881
|
-
}, {
|
|
2882
|
-
key: "getDecoratedComponentInstance",
|
|
2883
|
-
value: function getDecoratedComponentInstance() {
|
|
2884
|
-
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()');
|
|
2885
|
-
return this.decoratedRef.current;
|
|
2886
|
-
}
|
|
2887
|
-
}, {
|
|
2888
|
-
key: "shouldComponentUpdate",
|
|
2889
|
-
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
2890
|
-
return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);
|
|
2891
|
-
}
|
|
2892
|
-
}, {
|
|
2893
|
-
key: "componentDidMount",
|
|
2894
|
-
value: function componentDidMount() {
|
|
2895
|
-
this.disposable = new SerialDisposable();
|
|
2896
|
-
this.currentType = undefined;
|
|
2897
|
-
this.receiveProps(this.props);
|
|
2898
|
-
this.handleChange();
|
|
2899
|
-
}
|
|
2900
|
-
}, {
|
|
2901
|
-
key: "componentDidUpdate",
|
|
2902
|
-
value: function componentDidUpdate(prevProps) {
|
|
2903
|
-
if (!arePropsEqual(this.props, prevProps)) {
|
|
2904
|
-
this.receiveProps(this.props);
|
|
2905
|
-
this.handleChange();
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
}, {
|
|
2909
|
-
key: "componentWillUnmount",
|
|
2910
|
-
value: function componentWillUnmount() {
|
|
2911
|
-
this.dispose();
|
|
2912
|
-
}
|
|
2913
|
-
}, {
|
|
2914
|
-
key: "receiveProps",
|
|
2915
|
-
value: function receiveProps(props) {
|
|
2916
|
-
if (!this.handler) {
|
|
2917
|
-
return;
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
this.handler.receiveProps(props);
|
|
2921
|
-
this.receiveType(getType(props));
|
|
2922
|
-
}
|
|
2923
|
-
}, {
|
|
2924
|
-
key: "receiveType",
|
|
2925
|
-
value: function receiveType(type) {
|
|
2926
|
-
if (!this.handlerMonitor || !this.manager || !this.handlerConnector) {
|
|
2927
|
-
return;
|
|
2928
|
-
}
|
|
2929
|
-
|
|
2930
|
-
if (type === this.currentType) {
|
|
2931
|
-
return;
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
this.currentType = type;
|
|
2935
|
-
|
|
2936
|
-
var _registerHandler = registerHandler(type, this.handler, this.manager),
|
|
2937
|
-
_registerHandler2 = _slicedToArray(_registerHandler, 2),
|
|
2938
|
-
handlerId = _registerHandler2[0],
|
|
2939
|
-
unregister = _registerHandler2[1];
|
|
2940
|
-
|
|
2941
|
-
this.handlerId = handlerId;
|
|
2942
|
-
this.handlerMonitor.receiveHandlerId(handlerId);
|
|
2943
|
-
this.handlerConnector.receiveHandlerId(handlerId);
|
|
2944
|
-
var globalMonitor = this.manager.getMonitor();
|
|
2945
|
-
var unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, {
|
|
2946
|
-
handlerIds: [handlerId]
|
|
2947
|
-
});
|
|
2948
|
-
this.disposable.setDisposable(new CompositeDisposable(new Disposable(unsubscribe), new Disposable(unregister)));
|
|
2949
|
-
}
|
|
2950
|
-
}, {
|
|
2951
|
-
key: "dispose",
|
|
2952
|
-
value: function dispose() {
|
|
2953
|
-
this.disposable.dispose();
|
|
2954
|
-
|
|
2955
|
-
if (this.handlerConnector) {
|
|
2956
|
-
this.handlerConnector.receiveHandlerId(null);
|
|
2957
|
-
}
|
|
2958
|
-
}
|
|
2959
|
-
}, {
|
|
2960
|
-
key: "getCurrentState",
|
|
2961
|
-
value: function getCurrentState() {
|
|
2962
|
-
if (!this.handlerConnector) {
|
|
2963
|
-
return {};
|
|
2964
|
-
}
|
|
2965
|
-
|
|
2966
|
-
var nextState = collect(this.handlerConnector.hooks, this.handlerMonitor, this.props);
|
|
2967
|
-
|
|
2968
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2969
|
-
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);
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
return nextState;
|
|
2973
|
-
}
|
|
2974
|
-
}, {
|
|
2975
|
-
key: "render",
|
|
2976
|
-
value: function render() {
|
|
2977
|
-
var _this2 = this;
|
|
2978
|
-
|
|
2979
|
-
return jsx(DndContext.Consumer, {
|
|
2980
|
-
children: function children(_ref2) {
|
|
2981
|
-
var dragDropManager = _ref2.dragDropManager;
|
|
2982
|
-
|
|
2983
|
-
_this2.receiveDragDropManager(dragDropManager);
|
|
2984
|
-
|
|
2985
|
-
if (typeof requestAnimationFrame !== 'undefined') {
|
|
2986
|
-
requestAnimationFrame(function () {
|
|
2987
|
-
var _this2$handlerConnect;
|
|
2988
|
-
|
|
2989
|
-
return (_this2$handlerConnect = _this2.handlerConnector) === null || _this2$handlerConnect === void 0 ? void 0 : _this2$handlerConnect.reconnect();
|
|
2990
|
-
});
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
return jsx(Decorated, Object.assign({}, _this2.props, _this2.getCurrentState(), {
|
|
2994
|
-
// NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.
|
|
2995
|
-
ref: isRefable(Decorated) ? _this2.decoratedRef : null
|
|
2996
|
-
}), void 0);
|
|
2997
|
-
}
|
|
2998
|
-
}, void 0);
|
|
2999
|
-
}
|
|
3000
|
-
}, {
|
|
3001
|
-
key: "receiveDragDropManager",
|
|
3002
|
-
value: function receiveDragDropManager(dragDropManager) {
|
|
3003
|
-
if (this.manager !== undefined) {
|
|
3004
|
-
return;
|
|
3005
|
-
}
|
|
3006
|
-
|
|
3007
|
-
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);
|
|
3008
|
-
|
|
3009
|
-
if (dragDropManager === undefined) {
|
|
3010
|
-
return;
|
|
3011
|
-
}
|
|
3012
|
-
|
|
3013
|
-
this.manager = dragDropManager;
|
|
3014
|
-
this.handlerMonitor = createMonitor(dragDropManager);
|
|
3015
|
-
this.handlerConnector = createConnector(dragDropManager.getBackend());
|
|
3016
|
-
this.handler = createHandler(this.handlerMonitor, this.decoratedRef);
|
|
3017
|
-
}
|
|
3018
|
-
}]);
|
|
3019
|
-
|
|
3020
|
-
return DragDropContainer;
|
|
3021
|
-
}(Component);
|
|
3022
|
-
|
|
3023
|
-
_defineProperty$2(DragDropContainer, "DecoratedComponent", DecoratedComponent);
|
|
3024
|
-
|
|
3025
|
-
_defineProperty$2(DragDropContainer, "displayName", "".concat(containerDisplayName, "(").concat(displayName, ")"));
|
|
3026
|
-
|
|
3027
|
-
return hoistStatics(DragDropContainer, DecoratedComponent);
|
|
3028
|
-
}
|
|
3029
|
-
|
|
3030
|
-
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3031
|
-
|
|
3032
|
-
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); } }
|
|
3033
|
-
|
|
3034
|
-
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
|
3035
|
-
|
|
3036
|
-
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; }
|
|
3037
|
-
var ALLOWED_SPEC_METHODS$1 = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];
|
|
3038
|
-
var REQUIRED_SPEC_METHODS = ['beginDrag'];
|
|
3039
|
-
|
|
3040
|
-
var SourceImpl = /*#__PURE__*/function () {
|
|
3041
|
-
function SourceImpl(spec, monitor, ref) {
|
|
3042
|
-
var _this = this;
|
|
3043
|
-
|
|
3044
|
-
_classCallCheck$1(this, SourceImpl);
|
|
3045
|
-
|
|
3046
|
-
_defineProperty$1(this, "props", null);
|
|
3047
|
-
|
|
3048
|
-
_defineProperty$1(this, "spec", void 0);
|
|
3049
|
-
|
|
3050
|
-
_defineProperty$1(this, "monitor", void 0);
|
|
3051
|
-
|
|
3052
|
-
_defineProperty$1(this, "ref", void 0);
|
|
3053
|
-
|
|
3054
|
-
_defineProperty$1(this, "beginDrag", function () {
|
|
3055
|
-
if (!_this.props) {
|
|
3056
|
-
return;
|
|
3057
|
-
}
|
|
3058
|
-
|
|
3059
|
-
var item = _this.spec.beginDrag(_this.props, _this.monitor, _this.ref.current);
|
|
3060
|
-
|
|
3061
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3062
|
-
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);
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
|
-
return item;
|
|
3066
|
-
});
|
|
3067
|
-
|
|
3068
|
-
this.spec = spec;
|
|
3069
|
-
this.monitor = monitor;
|
|
3070
|
-
this.ref = ref;
|
|
3071
|
-
}
|
|
3072
|
-
|
|
3073
|
-
_createClass$1(SourceImpl, [{
|
|
3074
|
-
key: "receiveProps",
|
|
3075
|
-
value: function receiveProps(props) {
|
|
3076
|
-
this.props = props;
|
|
3077
|
-
}
|
|
3078
|
-
}, {
|
|
3079
|
-
key: "canDrag",
|
|
3080
|
-
value: function canDrag() {
|
|
3081
|
-
if (!this.props) {
|
|
3082
|
-
return false;
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
if (!this.spec.canDrag) {
|
|
3086
|
-
return true;
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
return this.spec.canDrag(this.props, this.monitor);
|
|
3090
|
-
}
|
|
3091
|
-
}, {
|
|
3092
|
-
key: "isDragging",
|
|
3093
|
-
value: function isDragging(globalMonitor, sourceId) {
|
|
3094
|
-
if (!this.props) {
|
|
3095
|
-
return false;
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
|
-
if (!this.spec.isDragging) {
|
|
3099
|
-
return sourceId === globalMonitor.getSourceId();
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
return this.spec.isDragging(this.props, this.monitor);
|
|
3103
|
-
}
|
|
3104
|
-
}, {
|
|
3105
|
-
key: "endDrag",
|
|
3106
|
-
value: function endDrag() {
|
|
3107
|
-
if (!this.props) {
|
|
3108
|
-
return;
|
|
3109
|
-
}
|
|
3110
|
-
|
|
3111
|
-
if (!this.spec.endDrag) {
|
|
3112
|
-
return;
|
|
3113
|
-
}
|
|
3114
|
-
|
|
3115
|
-
this.spec.endDrag(this.props, this.monitor, getDecoratedComponent(this.ref));
|
|
3116
|
-
}
|
|
3117
|
-
}]);
|
|
3118
|
-
|
|
3119
|
-
return SourceImpl;
|
|
3120
|
-
}();
|
|
3121
|
-
|
|
3122
|
-
function createSourceFactory(spec) {
|
|
3123
|
-
Object.keys(spec).forEach(function (key) {
|
|
3124
|
-
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);
|
|
3125
|
-
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]);
|
|
3126
|
-
});
|
|
3127
|
-
REQUIRED_SPEC_METHODS.forEach(function (key) {
|
|
3128
|
-
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]);
|
|
3129
|
-
});
|
|
3130
|
-
return function createSource(monitor, ref) {
|
|
3131
|
-
return new SourceImpl(spec, monitor, ref);
|
|
3132
|
-
};
|
|
3133
|
-
}
|
|
3134
|
-
|
|
3135
|
-
/**
|
|
3136
|
-
* Decorates a component as a dragsource
|
|
3137
|
-
* @param type The dragsource type
|
|
3138
|
-
* @param spec The drag source specification
|
|
3139
|
-
* @param collect The props collector function
|
|
3140
|
-
* @param options DnD options
|
|
3141
|
-
*/
|
|
3142
|
-
|
|
3143
|
-
function DragSource(type, spec, collect) {
|
|
3144
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3145
|
-
checkDecoratorArguments('DragSource', 'type, spec, collect[, options]', type, spec, collect, options);
|
|
3146
|
-
var getType = type;
|
|
3147
|
-
|
|
3148
|
-
if (typeof type !== 'function') {
|
|
3149
|
-
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);
|
|
3150
|
-
|
|
3151
|
-
getType = function getType() {
|
|
3152
|
-
return type;
|
|
3153
|
-
};
|
|
3154
|
-
}
|
|
3155
|
-
|
|
3156
|
-
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);
|
|
3157
|
-
var createSource = createSourceFactory(spec);
|
|
3158
|
-
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);
|
|
3159
|
-
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);
|
|
3160
|
-
return function decorateSource(DecoratedComponent) {
|
|
3161
|
-
return decorateHandler({
|
|
3162
|
-
containerDisplayName: 'DragSource',
|
|
3163
|
-
createHandler: createSource,
|
|
3164
|
-
registerHandler: registerSource,
|
|
3165
|
-
createConnector: function createConnector(backend) {
|
|
3166
|
-
return new SourceConnector(backend);
|
|
3167
|
-
},
|
|
3168
|
-
createMonitor: function createMonitor(manager) {
|
|
3169
|
-
return new DragSourceMonitorImpl(manager);
|
|
3170
|
-
},
|
|
3171
|
-
DecoratedComponent: DecoratedComponent,
|
|
3172
|
-
getType: getType,
|
|
3173
|
-
collect: collect,
|
|
3174
|
-
options: options
|
|
3175
|
-
});
|
|
3176
|
-
};
|
|
3177
|
-
}
|
|
3178
|
-
|
|
3179
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3180
|
-
|
|
3181
|
-
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); } }
|
|
3182
|
-
|
|
3183
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
3184
|
-
|
|
3185
|
-
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; }
|
|
3186
|
-
var ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];
|
|
3187
|
-
|
|
3188
|
-
var TargetImpl = /*#__PURE__*/function () {
|
|
3189
|
-
function TargetImpl(spec, monitor, ref) {
|
|
3190
|
-
_classCallCheck(this, TargetImpl);
|
|
3191
|
-
|
|
3192
|
-
_defineProperty(this, "props", null);
|
|
3193
|
-
|
|
3194
|
-
_defineProperty(this, "spec", void 0);
|
|
3195
|
-
|
|
3196
|
-
_defineProperty(this, "monitor", void 0);
|
|
3197
|
-
|
|
3198
|
-
_defineProperty(this, "ref", void 0);
|
|
3199
|
-
|
|
3200
|
-
this.spec = spec;
|
|
3201
|
-
this.monitor = monitor;
|
|
3202
|
-
this.ref = ref;
|
|
3203
|
-
}
|
|
3204
|
-
|
|
3205
|
-
_createClass(TargetImpl, [{
|
|
3206
|
-
key: "receiveProps",
|
|
3207
|
-
value: function receiveProps(props) {
|
|
3208
|
-
this.props = props;
|
|
3209
|
-
}
|
|
3210
|
-
}, {
|
|
3211
|
-
key: "receiveMonitor",
|
|
3212
|
-
value: function receiveMonitor(monitor) {
|
|
3213
|
-
this.monitor = monitor;
|
|
3214
|
-
}
|
|
3215
|
-
}, {
|
|
3216
|
-
key: "canDrop",
|
|
3217
|
-
value: function canDrop() {
|
|
3218
|
-
if (!this.spec.canDrop) {
|
|
3219
|
-
return true;
|
|
3220
|
-
}
|
|
3221
|
-
|
|
3222
|
-
return this.spec.canDrop(this.props, this.monitor);
|
|
3223
|
-
}
|
|
3224
|
-
}, {
|
|
3225
|
-
key: "hover",
|
|
3226
|
-
value: function hover() {
|
|
3227
|
-
if (!this.spec.hover || !this.props) {
|
|
3228
|
-
return;
|
|
3229
|
-
}
|
|
3230
|
-
|
|
3231
|
-
this.spec.hover(this.props, this.monitor, getDecoratedComponent(this.ref));
|
|
3232
|
-
}
|
|
3233
|
-
}, {
|
|
3234
|
-
key: "drop",
|
|
3235
|
-
value: function drop() {
|
|
3236
|
-
if (!this.spec.drop) {
|
|
3237
|
-
return undefined;
|
|
3238
|
-
}
|
|
3239
|
-
|
|
3240
|
-
var dropResult = this.spec.drop(this.props, this.monitor, this.ref.current);
|
|
3241
|
-
|
|
3242
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3243
|
-
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);
|
|
3244
|
-
}
|
|
3245
|
-
|
|
3246
|
-
return dropResult;
|
|
3247
|
-
}
|
|
3248
|
-
}]);
|
|
3249
|
-
|
|
3250
|
-
return TargetImpl;
|
|
3251
|
-
}();
|
|
3252
|
-
|
|
3253
|
-
function createTargetFactory(spec) {
|
|
3254
|
-
Object.keys(spec).forEach(function (key) {
|
|
3255
|
-
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);
|
|
3256
|
-
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]);
|
|
3257
|
-
});
|
|
3258
|
-
return function createTarget(monitor, ref) {
|
|
3259
|
-
return new TargetImpl(spec, monitor, ref);
|
|
3260
|
-
};
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
/**
|
|
3264
|
-
* @param type The accepted target type
|
|
3265
|
-
* @param spec The DropTarget specification
|
|
3266
|
-
* @param collect The props collector function
|
|
3267
|
-
* @param options Options
|
|
3268
|
-
*/
|
|
3269
|
-
|
|
3270
|
-
function DropTarget(type, spec, collect) {
|
|
3271
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3272
|
-
checkDecoratorArguments('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);
|
|
3273
|
-
var getType = type;
|
|
3274
|
-
|
|
3275
|
-
if (typeof type !== 'function') {
|
|
3276
|
-
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);
|
|
3277
|
-
|
|
3278
|
-
getType = function getType() {
|
|
3279
|
-
return type;
|
|
3280
|
-
};
|
|
3281
|
-
}
|
|
3282
|
-
|
|
3283
|
-
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);
|
|
3284
|
-
var createTarget = createTargetFactory(spec);
|
|
3285
|
-
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);
|
|
3286
|
-
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);
|
|
3287
|
-
return function decorateTarget(DecoratedComponent) {
|
|
3288
|
-
return decorateHandler({
|
|
3289
|
-
containerDisplayName: 'DropTarget',
|
|
3290
|
-
createHandler: createTarget,
|
|
3291
|
-
registerHandler: registerTarget,
|
|
3292
|
-
createMonitor: function createMonitor(manager) {
|
|
3293
|
-
return new DropTargetMonitorImpl(manager);
|
|
3294
|
-
},
|
|
3295
|
-
createConnector: function createConnector(backend) {
|
|
3296
|
-
return new TargetConnector(backend);
|
|
3297
|
-
},
|
|
3298
|
-
DecoratedComponent: DecoratedComponent,
|
|
3299
|
-
getType: getType,
|
|
3300
|
-
collect: collect,
|
|
3301
|
-
options: options
|
|
3302
|
-
});
|
|
3303
|
-
};
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
const log = debug('@pie-element:placement-ordering:configure:trait-tile');
|
|
3307
|
-
|
|
3308
|
-
const styles$2 = theme => ({
|
|
3309
|
-
actions: {
|
|
3310
|
-
color: color.text()
|
|
3311
|
-
},
|
|
3312
|
-
primaryBlock: {
|
|
3313
|
-
display: 'flex',
|
|
3314
|
-
flexDirection: 'column',
|
|
3315
|
-
justifyContent: 'space-between',
|
|
3316
|
-
marginBottom: theme.spacing.unit * 5
|
|
3317
|
-
},
|
|
3318
|
-
controls: {
|
|
3319
|
-
display: 'flex',
|
|
3320
|
-
alignItems: 'center',
|
|
3321
|
-
width: '100%',
|
|
3322
|
-
cursor: 'pointer'
|
|
3323
|
-
},
|
|
3324
|
-
options: {
|
|
3325
|
-
marginLeft: 'auto'
|
|
3326
|
-
},
|
|
3327
|
-
dragHandle: {},
|
|
3328
|
-
removeLabel: {
|
|
3329
|
-
display: 'flex',
|
|
3330
|
-
whiteSpace: 'break-spaces'
|
|
3331
|
-
},
|
|
3332
|
-
errorText: {
|
|
3333
|
-
fontSize: theme.typography.fontSize - 2,
|
|
3334
|
-
color: theme.palette.error.main,
|
|
3335
|
-
paddingBottom: theme.spacing.unit
|
|
3336
|
-
}
|
|
3337
|
-
});
|
|
3338
|
-
|
|
3339
|
-
class TraitTile extends React.Component {
|
|
3340
|
-
constructor(...args) {
|
|
3341
|
-
super(...args);
|
|
3342
|
-
this.state = {};
|
|
3343
|
-
|
|
3344
|
-
this.onTraitChanged = params => {
|
|
3345
|
-
const {
|
|
3346
|
-
trait,
|
|
3347
|
-
onTraitChanged
|
|
3348
|
-
} = this.props;
|
|
3349
|
-
if (isEmpty(params)) return;
|
|
3350
|
-
Object.keys(params).forEach(key => {
|
|
3351
|
-
trait[key] = params[key];
|
|
3352
|
-
});
|
|
3353
|
-
onTraitChanged(trait);
|
|
3354
|
-
};
|
|
3355
|
-
|
|
3356
|
-
this.onScorePointDescriptorChange = ({
|
|
3357
|
-
descriptor,
|
|
3358
|
-
value
|
|
3359
|
-
}) => {
|
|
3360
|
-
const {
|
|
3361
|
-
trait: {
|
|
3362
|
-
scorePointsDescriptors
|
|
3363
|
-
}
|
|
3364
|
-
} = this.props;
|
|
3365
|
-
if (value < 0 || value >= scorePointsDescriptors.length) return;
|
|
3366
|
-
scorePointsDescriptors[value] = descriptor;
|
|
3367
|
-
this.onTraitChanged({
|
|
3368
|
-
scorePointsDescriptors
|
|
3369
|
-
});
|
|
3370
|
-
};
|
|
3371
|
-
|
|
3372
|
-
this.handleClick = event => this.setState({
|
|
3373
|
-
anchorEl: event.currentTarget
|
|
3374
|
-
});
|
|
3375
|
-
|
|
3376
|
-
this.handleClose = () => this.setState({
|
|
3377
|
-
anchorEl: null
|
|
3378
|
-
});
|
|
3379
|
-
|
|
3380
|
-
this.scrollToPosition = position => this.secondaryBlock.scrollTo({
|
|
3381
|
-
left: position
|
|
3382
|
-
});
|
|
3383
|
-
|
|
3384
|
-
this.openMenu = () => {
|
|
3385
|
-
this.props.onTraitRemoved();
|
|
3386
|
-
this.handleClose();
|
|
3387
|
-
};
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3390
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
3391
|
-
if (nextProps.currentPosition !== this.props.currentPosition || this.secondaryBlock && this.secondaryBlock.scrollLeft !== nextProps.currentPosition) {
|
|
3392
|
-
this.scrollToPosition(nextProps.currentPosition);
|
|
3393
|
-
}
|
|
3394
|
-
}
|
|
3395
|
-
|
|
3396
|
-
render() {
|
|
3397
|
-
const {
|
|
3398
|
-
classes,
|
|
3399
|
-
connectDragSource,
|
|
3400
|
-
connectDropTarget,
|
|
3401
|
-
connectDragPreview,
|
|
3402
|
-
error,
|
|
3403
|
-
trait: {
|
|
3404
|
-
name,
|
|
3405
|
-
standards,
|
|
3406
|
-
description,
|
|
3407
|
-
scorePointsDescriptors
|
|
3408
|
-
},
|
|
3409
|
-
traitLabel,
|
|
3410
|
-
scorePointsValues,
|
|
3411
|
-
showStandards,
|
|
3412
|
-
showDescription,
|
|
3413
|
-
enableDragAndDrop,
|
|
3414
|
-
currentPosition,
|
|
3415
|
-
secondaryBlockWidth,
|
|
3416
|
-
spellCheck,
|
|
3417
|
-
maxPoints,
|
|
3418
|
-
uploadSoundSupport,
|
|
3419
|
-
mathMlOptions = {},
|
|
3420
|
-
expandedPluginProps = {},
|
|
3421
|
-
labelPluginProps = {},
|
|
3422
|
-
imageSupport = {}
|
|
3423
|
-
} = this.props;
|
|
3424
|
-
const {
|
|
3425
|
-
anchorEl
|
|
3426
|
-
} = this.state;
|
|
3427
|
-
return connectDragPreview(connectDropTarget( /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(PrimaryBlock, {
|
|
3428
|
-
className: classes.primaryBlock
|
|
3429
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3430
|
-
className: classes.controls
|
|
3431
|
-
}, enableDragAndDrop ? connectDragSource( /*#__PURE__*/React.createElement("span", {
|
|
3432
|
-
className: classes.dragHandle
|
|
3433
|
-
}, /*#__PURE__*/React.createElement(DragIndicatorIcon, {
|
|
3434
|
-
className: classes.actions
|
|
3435
|
-
}))) : null, /*#__PURE__*/React.createElement(IconButton, {
|
|
3436
|
-
className: classes.options,
|
|
3437
|
-
"aria-label": "more",
|
|
3438
|
-
"aria-controls": "long-menu",
|
|
3439
|
-
"aria-haspopup": "true",
|
|
3440
|
-
onClick: this.handleClick
|
|
3441
|
-
}, /*#__PURE__*/React.createElement(MoreVertIcon, null)), /*#__PURE__*/React.createElement(Menu, {
|
|
3442
|
-
id: "long-menu",
|
|
3443
|
-
anchorEl: anchorEl,
|
|
3444
|
-
keepMounted: true,
|
|
3445
|
-
open: !!anchorEl,
|
|
3446
|
-
onClose: this.handleClose
|
|
3447
|
-
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
3448
|
-
onClick: this.openMenu
|
|
3449
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3450
|
-
className: classes.removeLabel,
|
|
3451
|
-
dangerouslySetInnerHTML: {
|
|
3452
|
-
__html: `Remove ${name || traitLabel}`
|
|
3453
|
-
}
|
|
3454
|
-
})))), /*#__PURE__*/React.createElement(UnderlinedInput, {
|
|
3455
|
-
markup: name,
|
|
3456
|
-
error: (error == null ? void 0 : error.name) || '',
|
|
3457
|
-
onChange: name => this.onTraitChanged({
|
|
3458
|
-
name
|
|
3459
|
-
}),
|
|
3460
|
-
pluginProps: labelPluginProps,
|
|
3461
|
-
placeholder: `Enter ${traitLabel}`,
|
|
3462
|
-
spellCheck: spellCheck,
|
|
3463
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3464
|
-
mathMlOptions: mathMlOptions,
|
|
3465
|
-
imageSupport: imageSupport
|
|
3466
|
-
}), error && /*#__PURE__*/React.createElement("div", {
|
|
3467
|
-
className: classes.errorText
|
|
3468
|
-
}, error.name || '')), /*#__PURE__*/React.createElement(SecondaryBlock, {
|
|
3469
|
-
setRef: ref => {
|
|
3470
|
-
this.secondaryBlock = ref;
|
|
3471
|
-
},
|
|
3472
|
-
width: `${secondaryBlockWidth}px`
|
|
3473
|
-
}, showStandards && standards && /*#__PURE__*/React.createElement(Block, null, /*#__PURE__*/React.createElement(ExpandedInput, {
|
|
3474
|
-
placeholder: "Standards",
|
|
3475
|
-
markup: standards.join(','),
|
|
3476
|
-
onChange: standards => this.onTraitChanged({
|
|
3477
|
-
standards: standards.split(',')
|
|
3478
|
-
}),
|
|
3479
|
-
pluginProps: expandedPluginProps,
|
|
3480
|
-
spellCheck: spellCheck,
|
|
3481
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3482
|
-
mathMlOptions: mathMlOptions,
|
|
3483
|
-
imageSupport: imageSupport
|
|
3484
|
-
})), showDescription && /*#__PURE__*/React.createElement(Block, null, /*#__PURE__*/React.createElement(ExpandedInput, {
|
|
3485
|
-
placeholder: "Enter Description",
|
|
3486
|
-
markup: description,
|
|
3487
|
-
error: (error == null ? void 0 : error.description) || '',
|
|
3488
|
-
onChange: description => this.onTraitChanged({
|
|
3489
|
-
description
|
|
3490
|
-
}),
|
|
3491
|
-
pluginProps: expandedPluginProps,
|
|
3492
|
-
spellCheck: spellCheck,
|
|
3493
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3494
|
-
mathMlOptions: mathMlOptions,
|
|
3495
|
-
imageSupport: imageSupport
|
|
3496
|
-
}), error && /*#__PURE__*/React.createElement("div", {
|
|
3497
|
-
className: classes.errorText
|
|
3498
|
-
}, error.description || '')), (scorePointsValues || []).map((scorePointsValue, index) => {
|
|
3499
|
-
const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding
|
|
3500
|
-
|
|
3501
|
-
const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 98;
|
|
3502
|
-
const value = scorePointsValues.length - index - 1;
|
|
3503
|
-
let scoreDescriptor;
|
|
3504
|
-
|
|
3505
|
-
try {
|
|
3506
|
-
scoreDescriptor = scorePointsDescriptors[value] || '';
|
|
3507
|
-
} catch (e) {
|
|
3508
|
-
scoreDescriptor = '';
|
|
3509
|
-
}
|
|
3510
|
-
|
|
3511
|
-
return /*#__PURE__*/React.createElement(Block, {
|
|
3512
|
-
key: `key-key-${index}`
|
|
3513
|
-
}, /*#__PURE__*/React.createElement(ExpandedInput, {
|
|
3514
|
-
placeholder: "Enter Descriptor",
|
|
3515
|
-
markup: scoreDescriptor,
|
|
3516
|
-
onChange: descriptor => this.onScorePointDescriptorChange({
|
|
3517
|
-
descriptor,
|
|
3518
|
-
value
|
|
3519
|
-
}),
|
|
3520
|
-
pluginProps: expandedPluginProps,
|
|
3521
|
-
alignToRight: remainingSpace < 296 && scorePointsValue < maxPoints // 296 is the space required for the toolbar
|
|
3522
|
-
,
|
|
3523
|
-
spellCheck: spellCheck,
|
|
3524
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3525
|
-
mathMlOptions: mathMlOptions,
|
|
3526
|
-
imageSupport: imageSupport
|
|
3527
|
-
}));
|
|
3528
|
-
}))))));
|
|
3529
|
-
}
|
|
3530
|
-
|
|
3531
|
-
}
|
|
3532
|
-
TraitTile.propTypes = {
|
|
3533
|
-
spellCheck: PropTypes.bool,
|
|
3534
|
-
uploadSoundSupport: PropTypes.object
|
|
3535
|
-
};
|
|
3536
|
-
TraitTile.propTypes = {
|
|
3537
|
-
connectDragSource: PropTypes.func.isRequired,
|
|
3538
|
-
connectDropTarget: PropTypes.func.isRequired,
|
|
3539
|
-
connectDragPreview: PropTypes.func.isRequired,
|
|
3540
|
-
classes: PropTypes.object.isRequired,
|
|
3541
|
-
error: PropTypes.object,
|
|
3542
|
-
isDragging: PropTypes.bool.isRequired,
|
|
3543
|
-
id: PropTypes.any,
|
|
3544
|
-
isOver: PropTypes.bool,
|
|
3545
|
-
index: PropTypes.number,
|
|
3546
|
-
onTraitChanged: PropTypes.func.isRequired,
|
|
3547
|
-
onTraitRemoved: PropTypes.func.isRequired,
|
|
3548
|
-
trait: PropTypes.shape({
|
|
3549
|
-
name: PropTypes.string,
|
|
3550
|
-
standards: PropTypes.arrayOf(PropTypes.string),
|
|
3551
|
-
scorePointsDescriptors: PropTypes.arrayOf(PropTypes.string),
|
|
3552
|
-
description: PropTypes.string
|
|
3553
|
-
}),
|
|
3554
|
-
traitLabel: PropTypes.string,
|
|
3555
|
-
scorePointsValues: PropTypes.arrayOf(PropTypes.number),
|
|
3556
|
-
showStandards: PropTypes.bool,
|
|
3557
|
-
showDescription: PropTypes.bool,
|
|
3558
|
-
maxPoints: PropTypes.number,
|
|
3559
|
-
enableDragAndDrop: PropTypes.bool,
|
|
3560
|
-
currentPosition: PropTypes.number,
|
|
3561
|
-
secondaryBlockWidth: PropTypes.number,
|
|
3562
|
-
expandedPluginProps: PropTypes.object,
|
|
3563
|
-
labelPluginProps: PropTypes.object,
|
|
3564
|
-
imageSupport: PropTypes.shape({
|
|
3565
|
-
add: PropTypes.func.isRequired,
|
|
3566
|
-
delete: PropTypes.func.isRequired
|
|
3567
|
-
})
|
|
3568
|
-
};
|
|
3569
|
-
const StyledTrait = withStyles(styles$2)(TraitTile);
|
|
3570
|
-
const NAME = 'trait-config';
|
|
3571
|
-
const traitSource = {
|
|
3572
|
-
beginDrag(props) {
|
|
3573
|
-
return {
|
|
3574
|
-
name: props.trait.name,
|
|
3575
|
-
index: props.index
|
|
3576
|
-
};
|
|
3577
|
-
}
|
|
3578
|
-
|
|
3579
|
-
};
|
|
3580
|
-
const StyledSource = DragSource(NAME, traitSource, (connect, monitor) => ({
|
|
3581
|
-
connectDragSource: connect.dragSource(),
|
|
3582
|
-
connectDragPreview: connect.dragPreview(),
|
|
3583
|
-
isDragging: monitor.isDragging()
|
|
3584
|
-
}))(StyledTrait);
|
|
3585
|
-
const traitTarget = {
|
|
3586
|
-
hover() {
|
|
3587
|
-
log('[hover]');
|
|
3588
|
-
},
|
|
3589
|
-
|
|
3590
|
-
drop(props, monitor) {
|
|
3591
|
-
const item = monitor.getItem();
|
|
3592
|
-
log('[drop] item: ', item, 'didDrop?', monitor.didDrop());
|
|
3593
|
-
props.onTraitDropped(item, props.index);
|
|
3594
|
-
}
|
|
3595
|
-
|
|
3596
|
-
};
|
|
3597
|
-
const StyledSourceAndTarget = DropTarget(NAME, traitTarget, (connect, monitor) => ({
|
|
3598
|
-
connectDropTarget: connect.dropTarget(),
|
|
3599
|
-
isOver: monitor.isOver()
|
|
3600
|
-
}))(StyledSource);
|
|
3601
|
-
|
|
3602
|
-
const AdjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding
|
|
3603
|
-
|
|
3604
|
-
const styles$1 = theme => ({
|
|
3605
|
-
scaleWrapper: {
|
|
3606
|
-
display: 'flex',
|
|
3607
|
-
flexDirection: 'column',
|
|
3608
|
-
wordBreak: 'break-word',
|
|
3609
|
-
position: 'relative',
|
|
3610
|
-
marginBottom: theme.spacing.unit * 2.5
|
|
3611
|
-
},
|
|
3612
|
-
maxPoints: {
|
|
3613
|
-
width: '300px',
|
|
3614
|
-
marginTop: theme.spacing.unit * 2,
|
|
3615
|
-
marginBottom: theme.spacing.unit * 4
|
|
3616
|
-
},
|
|
3617
|
-
trait: {
|
|
3618
|
-
background: color.secondaryBackground(),
|
|
3619
|
-
marginTop: theme.spacing.unit * 2,
|
|
3620
|
-
marginBottom: theme.spacing.unit * 2,
|
|
3621
|
-
padding: theme.spacing.unit * 2
|
|
3622
|
-
}
|
|
3623
|
-
});
|
|
3624
|
-
|
|
3625
|
-
class Scale extends React.Component {
|
|
3626
|
-
constructor(...args) {
|
|
3627
|
-
super(...args);
|
|
3628
|
-
this.state = {
|
|
3629
|
-
showDecreaseMaxPointsDialog: false,
|
|
3630
|
-
showDeleteScaleDialog: false,
|
|
3631
|
-
showDeleteTraitDialog: false,
|
|
3632
|
-
currentPosition: 0,
|
|
3633
|
-
showRight: null,
|
|
3634
|
-
showLeft: null,
|
|
3635
|
-
showInfoDialog: false,
|
|
3636
|
-
infoDialogText: ''
|
|
3637
|
-
};
|
|
3638
|
-
|
|
3639
|
-
this.set = newState => this.setState(newState);
|
|
3640
|
-
|
|
3641
|
-
this.updateMaxPointsFieldValue = ({
|
|
3642
|
-
target
|
|
3643
|
-
}) => {
|
|
3644
|
-
const {
|
|
3645
|
-
scale,
|
|
3646
|
-
scaleIndex,
|
|
3647
|
-
onScaleChanged
|
|
3648
|
-
} = this.props || {};
|
|
3649
|
-
const {
|
|
3650
|
-
maxPoints
|
|
3651
|
-
} = scale;
|
|
3652
|
-
const numberValue = parseInt(target.value, 10);
|
|
3653
|
-
this.setState({
|
|
3654
|
-
currentPosition: 0,
|
|
3655
|
-
showLeft: false,
|
|
3656
|
-
showRight: this.secondaryBlockRef && this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth
|
|
3657
|
-
});
|
|
3658
|
-
|
|
3659
|
-
if (numberValue < maxPoints) {
|
|
3660
|
-
this.showDecreaseMaxPointsModal({
|
|
3661
|
-
newMaxPoints: numberValue
|
|
3662
|
-
});
|
|
3663
|
-
} else {
|
|
3664
|
-
onScaleChanged(scaleIndex, {
|
|
3665
|
-
maxPoints: numberValue
|
|
3666
|
-
});
|
|
3667
|
-
}
|
|
3668
|
-
};
|
|
3669
|
-
|
|
3670
|
-
this.showDecreaseMaxPointsModal = ({
|
|
3671
|
-
newMaxPoints
|
|
3672
|
-
}) => this.set({
|
|
3673
|
-
showDecreaseMaxPointsDialog: true,
|
|
3674
|
-
newMaxPoints
|
|
3675
|
-
});
|
|
3676
|
-
|
|
3677
|
-
this.hideDecreaseMaxPointsModal = () => this.set({
|
|
3678
|
-
showDecreaseMaxPointsDialog: false,
|
|
3679
|
-
newMaxPoints: undefined
|
|
3680
|
-
});
|
|
3681
|
-
|
|
3682
|
-
this.changeMaxPoints = () => {
|
|
3683
|
-
const {
|
|
3684
|
-
newMaxPoints
|
|
3685
|
-
} = this.state || {};
|
|
3686
|
-
const {
|
|
3687
|
-
scaleIndex,
|
|
3688
|
-
onScaleChanged
|
|
3689
|
-
} = this.props || {};
|
|
3690
|
-
|
|
3691
|
-
if (newMaxPoints) {
|
|
3692
|
-
onScaleChanged(scaleIndex, {
|
|
3693
|
-
maxPoints: newMaxPoints
|
|
3694
|
-
});
|
|
3695
|
-
}
|
|
3696
|
-
|
|
3697
|
-
this.hideDecreaseMaxPointsModal();
|
|
3698
|
-
};
|
|
3699
|
-
|
|
3700
|
-
this.showDeleteScaleModal = () => this.set({
|
|
3701
|
-
showDeleteScaleDialog: true
|
|
3702
|
-
});
|
|
3703
|
-
|
|
3704
|
-
this.hideDeleteScaleModal = () => this.set({
|
|
3705
|
-
showDeleteScaleDialog: false
|
|
3706
|
-
});
|
|
3707
|
-
|
|
3708
|
-
this.deleteScale = () => {
|
|
3709
|
-
const {
|
|
3710
|
-
scaleIndex,
|
|
3711
|
-
onScaleRemoved
|
|
3712
|
-
} = this.props || {};
|
|
3713
|
-
this.hideDeleteScaleModal();
|
|
3714
|
-
onScaleRemoved(scaleIndex);
|
|
3715
|
-
};
|
|
3716
|
-
|
|
3717
|
-
this.showDeleteTraitModal = traitToDeleteIndex => this.set({
|
|
3718
|
-
showDeleteTraitDialog: true,
|
|
3719
|
-
traitToDeleteIndex
|
|
3720
|
-
});
|
|
3721
|
-
|
|
3722
|
-
this.hideDeleteTraitModal = () => this.set({
|
|
3723
|
-
showDeleteTraitDialog: false,
|
|
3724
|
-
traitToDeleteIndex: undefined
|
|
3725
|
-
});
|
|
3726
|
-
|
|
3727
|
-
this.onTraitRemoved = () => {
|
|
3728
|
-
const {
|
|
3729
|
-
traitToDeleteIndex
|
|
3730
|
-
} = this.state;
|
|
3731
|
-
const {
|
|
3732
|
-
scale,
|
|
3733
|
-
scaleIndex,
|
|
3734
|
-
onScaleChanged,
|
|
3735
|
-
minNoOfTraits
|
|
3736
|
-
} = this.props || {};
|
|
3737
|
-
let {
|
|
3738
|
-
traits,
|
|
3739
|
-
traitLabel
|
|
3740
|
-
} = scale || {};
|
|
3741
|
-
if (traitToDeleteIndex < 0 || traitToDeleteIndex >= traits.length) return;
|
|
3742
|
-
|
|
3743
|
-
if (traits.length === minNoOfTraits) {
|
|
3744
|
-
this.set({
|
|
3745
|
-
infoDialogText: `There can't be less than ${minNoOfTraits} ${(traitLabel || 'trait').toLowerCase()}s.`,
|
|
3746
|
-
showInfoDialog: true
|
|
3747
|
-
});
|
|
3748
|
-
return false;
|
|
3749
|
-
}
|
|
3750
|
-
|
|
3751
|
-
traits = [...traits.slice(0, traitToDeleteIndex), ...traits.slice(traitToDeleteIndex + 1)];
|
|
3752
|
-
onScaleChanged(scaleIndex, {
|
|
3753
|
-
traits
|
|
3754
|
-
});
|
|
3755
|
-
this.hideDeleteTraitModal();
|
|
3756
|
-
};
|
|
3757
|
-
|
|
3758
|
-
this.onTraitAdded = () => {
|
|
3759
|
-
const {
|
|
3760
|
-
scale,
|
|
3761
|
-
scaleIndex,
|
|
3762
|
-
onScaleChanged,
|
|
3763
|
-
maxNoOfTraits
|
|
3764
|
-
} = this.props || {};
|
|
3765
|
-
const {
|
|
3766
|
-
traits,
|
|
3767
|
-
scorePointsLabels
|
|
3768
|
-
} = scale || {};
|
|
3769
|
-
|
|
3770
|
-
if (traits.length === maxNoOfTraits) {
|
|
3771
|
-
this.set({
|
|
3772
|
-
infoDialogText: `There can't be more than ${maxNoOfTraits} scales.`,
|
|
3773
|
-
showInfoDialog: true
|
|
3774
|
-
});
|
|
3775
|
-
return false;
|
|
3776
|
-
}
|
|
3777
|
-
|
|
3778
|
-
traits.push({
|
|
3779
|
-
name: '',
|
|
3780
|
-
description: '',
|
|
3781
|
-
standards: [],
|
|
3782
|
-
scorePointsDescriptors: Array.from({
|
|
3783
|
-
length: scorePointsLabels.length
|
|
3784
|
-
}, () => '')
|
|
3785
|
-
});
|
|
3786
|
-
onScaleChanged(scaleIndex, {
|
|
3787
|
-
traits
|
|
3788
|
-
});
|
|
3789
|
-
};
|
|
3790
|
-
|
|
3791
|
-
this.onTraitChanged = (traitIndex, trait) => {
|
|
3792
|
-
const {
|
|
3793
|
-
scale,
|
|
3794
|
-
scaleIndex,
|
|
3795
|
-
onScaleChanged
|
|
3796
|
-
} = this.props || {};
|
|
3797
|
-
const {
|
|
3798
|
-
traits
|
|
3799
|
-
} = scale || {};
|
|
3800
|
-
|
|
3801
|
-
if (traitIndex >= 0 && traitIndex < traits.length) {
|
|
3802
|
-
traits[traitIndex] = trait;
|
|
3803
|
-
onScaleChanged(scaleIndex, {
|
|
3804
|
-
traits
|
|
3805
|
-
});
|
|
3806
|
-
}
|
|
3807
|
-
};
|
|
3808
|
-
|
|
3809
|
-
this.onTraitDropped = (source, newIndex) => {
|
|
3810
|
-
const {
|
|
3811
|
-
scale,
|
|
3812
|
-
scaleIndex,
|
|
3813
|
-
onScaleChanged
|
|
3814
|
-
} = this.props || {};
|
|
3815
|
-
const {
|
|
3816
|
-
traits
|
|
3817
|
-
} = scale || {};
|
|
3818
|
-
const {
|
|
3819
|
-
index: oldIndex
|
|
3820
|
-
} = source;
|
|
3821
|
-
const cup = traits[oldIndex];
|
|
3822
|
-
const remainingTraits = traits.filter((item, index) => index !== oldIndex);
|
|
3823
|
-
const newTraits = [...remainingTraits.slice(0, newIndex), cup, ...remainingTraits.slice(newIndex)];
|
|
3824
|
-
onScaleChanged(scaleIndex, {
|
|
3825
|
-
traits: newTraits
|
|
3826
|
-
});
|
|
3827
|
-
};
|
|
3828
|
-
|
|
3829
|
-
this.decreasePosition = () => {
|
|
3830
|
-
const {
|
|
3831
|
-
currentPosition
|
|
3832
|
-
} = this.state;
|
|
3833
|
-
const decreasedPosition = currentPosition - (currentPosition === AdjustedBlockWidth / 2 ? AdjustedBlockWidth / 2 : AdjustedBlockWidth);
|
|
3834
|
-
this.setState({
|
|
3835
|
-
currentPosition: decreasedPosition,
|
|
3836
|
-
showRight: decreasedPosition < this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth,
|
|
3837
|
-
showLeft: decreasedPosition > 0
|
|
3838
|
-
});
|
|
3839
|
-
};
|
|
3840
|
-
|
|
3841
|
-
this.increasePosition = () => {
|
|
3842
|
-
const {
|
|
3843
|
-
currentPosition
|
|
3844
|
-
} = this.state;
|
|
3845
|
-
const increasedPosition = currentPosition + (currentPosition === 0 ? AdjustedBlockWidth / 2 : AdjustedBlockWidth);
|
|
3846
|
-
this.setState({
|
|
3847
|
-
currentPosition: increasedPosition,
|
|
3848
|
-
showRight: increasedPosition < this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth,
|
|
3849
|
-
showLeft: increasedPosition > 0
|
|
3850
|
-
});
|
|
3851
|
-
};
|
|
3852
|
-
}
|
|
3853
|
-
|
|
3854
|
-
componentDidMount() {
|
|
3855
|
-
if (this.state.showRight === null && this.secondaryBlockRef) {
|
|
3856
|
-
this.setState({
|
|
3857
|
-
showRight: this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth
|
|
3858
|
-
});
|
|
3859
|
-
}
|
|
3860
|
-
}
|
|
3861
|
-
|
|
3862
|
-
componentDidUpdate(prevProps) {
|
|
3863
|
-
if (prevProps.scale.maxPoints !== this.props.scale.maxPoints || prevProps.showDescription !== this.props.showDescription || prevProps.excludeZero !== this.props.excludeZero) {
|
|
3864
|
-
this.setState({
|
|
3865
|
-
showRight: this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth
|
|
3866
|
-
});
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
|
|
3870
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
3871
|
-
if (nextProps.excludeZero !== this.props.excludeZero || nextProps.showStandards !== this.props.showStandards || nextProps.showDescription !== this.props.showDescription) {
|
|
3872
|
-
this.setState({
|
|
3873
|
-
currentPosition: 0,
|
|
3874
|
-
showLeft: false,
|
|
3875
|
-
showRight: this.secondaryBlockRef && this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth
|
|
3876
|
-
});
|
|
3877
|
-
}
|
|
3878
|
-
} // Max Points
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
render() {
|
|
3882
|
-
const {
|
|
3883
|
-
classes,
|
|
3884
|
-
errors,
|
|
3885
|
-
scale,
|
|
3886
|
-
scaleIndex,
|
|
3887
|
-
showStandards,
|
|
3888
|
-
onScaleChanged,
|
|
3889
|
-
excludeZero,
|
|
3890
|
-
showDescription,
|
|
3891
|
-
showLevelTagInput,
|
|
3892
|
-
showScorePointLabels,
|
|
3893
|
-
enableDragAndDrop,
|
|
3894
|
-
spellCheck,
|
|
3895
|
-
width,
|
|
3896
|
-
uploadSoundSupport,
|
|
3897
|
-
maxPointsEnabled,
|
|
3898
|
-
mathMlOptions = {},
|
|
3899
|
-
maxMaxPoints,
|
|
3900
|
-
expandedPluginProps = {},
|
|
3901
|
-
labelPluginProps = {},
|
|
3902
|
-
imageSupport = {}
|
|
3903
|
-
} = this.props || {};
|
|
3904
|
-
const {
|
|
3905
|
-
maxPoints,
|
|
3906
|
-
scorePointsLabels,
|
|
3907
|
-
traitLabel,
|
|
3908
|
-
traits
|
|
3909
|
-
} = scale || {};
|
|
3910
|
-
const {
|
|
3911
|
-
showDecreaseMaxPointsDialog,
|
|
3912
|
-
showDeleteScaleDialog,
|
|
3913
|
-
showDeleteTraitDialog,
|
|
3914
|
-
currentPosition,
|
|
3915
|
-
showRight,
|
|
3916
|
-
showLeft,
|
|
3917
|
-
showInfoDialog,
|
|
3918
|
-
infoDialogText
|
|
3919
|
-
} = this.state;
|
|
3920
|
-
const {
|
|
3921
|
-
traitsErrors,
|
|
3922
|
-
scorePointsErrors
|
|
3923
|
-
} = errors || {};
|
|
3924
|
-
const currentScaleTraitsErrors = traitsErrors && traitsErrors[scaleIndex] || {};
|
|
3925
|
-
const currentScalePointsLabelsErrors = scorePointsErrors && scorePointsErrors[scaleIndex] || {};
|
|
3926
|
-
const scorePointsValues = [];
|
|
3927
|
-
const secondaryBlockWidth = parseInt(width) - DragHandleSpace - PrimaryBlockWidth || 320; // 320 is minWidth
|
|
3928
|
-
// determining the score points values
|
|
3929
|
-
|
|
3930
|
-
for (let pointValue = maxPoints; pointValue >= excludeZero ? 1 : 0; pointValue -= 1) {
|
|
3931
|
-
scorePointsValues.push(pointValue);
|
|
3932
|
-
}
|
|
3933
|
-
|
|
3934
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
3935
|
-
key: `scale-${scaleIndex}`,
|
|
3936
|
-
className: classes.scaleWrapper,
|
|
3937
|
-
ref: ref => {
|
|
3938
|
-
this.scaleWrapper = ref;
|
|
3939
|
-
}
|
|
3940
|
-
}, /*#__PURE__*/React.createElement(TraitsHeader, {
|
|
3941
|
-
setSecondaryBlockRef: ref => {
|
|
3942
|
-
if (ref) {
|
|
3943
|
-
this.secondaryBlockRef = ref;
|
|
3944
|
-
}
|
|
3945
|
-
},
|
|
3946
|
-
key: 'header-key',
|
|
3947
|
-
errors: currentScalePointsLabelsErrors,
|
|
3948
|
-
traitLabel: traitLabel,
|
|
3949
|
-
scorePointsValues: scorePointsValues,
|
|
3950
|
-
scorePointsLabels: scorePointsLabels,
|
|
3951
|
-
onScaleChange: params => onScaleChanged(scaleIndex, params),
|
|
3952
|
-
onTraitLabelChange: label => onScaleChanged(scaleIndex, {
|
|
3953
|
-
traitLabel: label
|
|
3954
|
-
}),
|
|
3955
|
-
showStandards: showStandards,
|
|
3956
|
-
showDescription: showDescription,
|
|
3957
|
-
showLevelTagInput: showLevelTagInput,
|
|
3958
|
-
showScorePointLabels: showScorePointLabels,
|
|
3959
|
-
maxPoints: maxPoints,
|
|
3960
|
-
updateMaxPointsFieldValue: this.updateMaxPointsFieldValue,
|
|
3961
|
-
scaleIndex: scaleIndex,
|
|
3962
|
-
showDeleteScaleModal: this.showDeleteScaleModal,
|
|
3963
|
-
currentPosition: currentPosition,
|
|
3964
|
-
secondaryBlockWidth: secondaryBlockWidth,
|
|
3965
|
-
spellCheck: spellCheck,
|
|
3966
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3967
|
-
maxPointsEnabled: maxPointsEnabled,
|
|
3968
|
-
mathMlOptions: mathMlOptions,
|
|
3969
|
-
maxMaxPoints: maxMaxPoints,
|
|
3970
|
-
expandedPluginProps: expandedPluginProps,
|
|
3971
|
-
labelPluginProps: labelPluginProps,
|
|
3972
|
-
imageSupport: imageSupport
|
|
3973
|
-
}), traits.map((trait, index) => /*#__PURE__*/React.createElement(StyledSourceAndTarget, {
|
|
3974
|
-
key: index,
|
|
3975
|
-
index: index,
|
|
3976
|
-
error: currentScaleTraitsErrors && currentScaleTraitsErrors[index],
|
|
3977
|
-
trait: trait,
|
|
3978
|
-
traitLabel: traitLabel || 'Trait',
|
|
3979
|
-
scorePointsValues: scorePointsValues,
|
|
3980
|
-
scorePointsLabels: scorePointsLabels,
|
|
3981
|
-
onTraitRemoved: () => this.showDeleteTraitModal(index),
|
|
3982
|
-
onTraitChanged: trait => this.onTraitChanged(index, trait),
|
|
3983
|
-
onTraitDropped: this.onTraitDropped,
|
|
3984
|
-
showStandards: showStandards,
|
|
3985
|
-
showDescription: showDescription,
|
|
3986
|
-
maxPoints: maxPoints,
|
|
3987
|
-
currentPosition: currentPosition,
|
|
3988
|
-
enableDragAndDrop: enableDragAndDrop,
|
|
3989
|
-
secondaryBlockWidth: secondaryBlockWidth,
|
|
3990
|
-
spellCheck: spellCheck,
|
|
3991
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
3992
|
-
mathMlOptions: mathMlOptions,
|
|
3993
|
-
expandedPluginProps: expandedPluginProps,
|
|
3994
|
-
labelPluginProps: labelPluginProps,
|
|
3995
|
-
imageSupport: imageSupport
|
|
3996
|
-
})), /*#__PURE__*/React.createElement(Arrow, {
|
|
3997
|
-
width: `${AdjustedBlockWidth / 2}px`,
|
|
3998
|
-
show: showLeft,
|
|
3999
|
-
onClick: this.decreasePosition,
|
|
4000
|
-
left: `${PrimaryBlockWidth}px`,
|
|
4001
|
-
showLevelTagInput: showLevelTagInput
|
|
4002
|
-
}, /*#__PURE__*/React.createElement(ArrowBackIosIcon, null)), /*#__PURE__*/React.createElement(Arrow, {
|
|
4003
|
-
width: `${AdjustedBlockWidth / 2}px`,
|
|
4004
|
-
show: showRight,
|
|
4005
|
-
onClick: this.increasePosition,
|
|
4006
|
-
showLevelTagInput: showLevelTagInput
|
|
4007
|
-
}, /*#__PURE__*/React.createElement(ArrowForwardIosIcon, null)), /*#__PURE__*/React.createElement(MultiTraitButton, {
|
|
4008
|
-
onClick: this.onTraitAdded
|
|
4009
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4010
|
-
dangerouslySetInnerHTML: {
|
|
4011
|
-
__html: `Add ${traitLabel || ' Trait'}`
|
|
4012
|
-
}
|
|
4013
|
-
})), /*#__PURE__*/React.createElement(DecreaseMaxPoints, {
|
|
4014
|
-
open: !!showDecreaseMaxPointsDialog,
|
|
4015
|
-
deleteScorePoints: this.changeMaxPoints,
|
|
4016
|
-
cancel: this.hideDecreaseMaxPointsModal
|
|
4017
|
-
}), /*#__PURE__*/React.createElement(DeleteScale, {
|
|
4018
|
-
open: !!showDeleteScaleDialog,
|
|
4019
|
-
scaleIndex: scaleIndex,
|
|
4020
|
-
deleteScale: this.deleteScale,
|
|
4021
|
-
cancel: this.hideDeleteScaleModal
|
|
4022
|
-
}), /*#__PURE__*/React.createElement(DeleteTrait, {
|
|
4023
|
-
open: !!showDeleteTraitDialog,
|
|
4024
|
-
deleteTrait: this.onTraitRemoved,
|
|
4025
|
-
cancel: this.hideDeleteTraitModal,
|
|
4026
|
-
traitLabel: traitLabel.toLowerCase()
|
|
4027
|
-
}), /*#__PURE__*/React.createElement(InfoDialog, {
|
|
4028
|
-
open: showInfoDialog,
|
|
4029
|
-
text: infoDialogText,
|
|
4030
|
-
onClose: () => this.set({
|
|
4031
|
-
showInfoDialog: false
|
|
4032
|
-
})
|
|
4033
|
-
}));
|
|
4034
|
-
}
|
|
4035
|
-
|
|
4036
|
-
}
|
|
4037
|
-
Scale.propTypes = {
|
|
4038
|
-
classes: PropTypes.object,
|
|
4039
|
-
errors: PropTypes.object,
|
|
4040
|
-
scale: PropTypes.shape({
|
|
4041
|
-
maxPoints: PropTypes.number,
|
|
4042
|
-
scorePointsLabels: PropTypes.arrayOf(PropTypes.string),
|
|
4043
|
-
traitLabel: PropTypes.string,
|
|
4044
|
-
traits: PropTypes.arrayOf(PropTypes.shape({
|
|
4045
|
-
name: PropTypes.string,
|
|
4046
|
-
standards: PropTypes.arrayOf(PropTypes.string),
|
|
4047
|
-
scorePointsDescriptors: PropTypes.arrayOf(PropTypes.string),
|
|
4048
|
-
description: PropTypes.string
|
|
4049
|
-
}))
|
|
4050
|
-
}),
|
|
4051
|
-
width: PropTypes.string,
|
|
4052
|
-
excludeZero: PropTypes.bool,
|
|
4053
|
-
scaleIndex: PropTypes.number,
|
|
4054
|
-
onScaleChanged: PropTypes.func,
|
|
4055
|
-
onScaleRemoved: PropTypes.func,
|
|
4056
|
-
showStandards: PropTypes.bool,
|
|
4057
|
-
showLevelTagInput: PropTypes.bool,
|
|
4058
|
-
showDescription: PropTypes.bool,
|
|
4059
|
-
uploadSoundSupport: PropTypes.object,
|
|
4060
|
-
showScorePointLabels: PropTypes.bool,
|
|
4061
|
-
enableDragAndDrop: PropTypes.bool,
|
|
4062
|
-
expandedPluginProps: PropTypes.object,
|
|
4063
|
-
labelPluginProps: PropTypes.object
|
|
4064
|
-
};
|
|
4065
|
-
var Scale$1 = withDragContext(withStyles(styles$1)(Scale));
|
|
4066
|
-
|
|
4067
|
-
const {
|
|
4068
|
-
Panel,
|
|
4069
|
-
toggle
|
|
4070
|
-
} = settings;
|
|
4071
|
-
const MIN_WIDTH = '650px';
|
|
4072
|
-
|
|
4073
|
-
const styles = theme => ({
|
|
4074
|
-
design: {
|
|
4075
|
-
fontFamily: 'Cerebri Sans',
|
|
4076
|
-
fontSize: theme.typography.fontSize
|
|
4077
|
-
}
|
|
4078
|
-
});
|
|
4079
|
-
|
|
4080
|
-
const ShowModal = ({
|
|
4081
|
-
showExcludeZeroDialog,
|
|
4082
|
-
excludeZero,
|
|
4083
|
-
changeExcludeZero,
|
|
4084
|
-
cancel
|
|
4085
|
-
}) => {
|
|
4086
|
-
if (showExcludeZeroDialog && !excludeZero) {
|
|
4087
|
-
return /*#__PURE__*/React.createElement(ExcludeZeroDialog, {
|
|
4088
|
-
open: showExcludeZeroDialog && !excludeZero,
|
|
4089
|
-
changeExcludeZero: changeExcludeZero,
|
|
4090
|
-
cancel: cancel
|
|
4091
|
-
});
|
|
4092
|
-
} else if (showExcludeZeroDialog && excludeZero) {
|
|
4093
|
-
return /*#__PURE__*/React.createElement(IncludeZeroDialog, {
|
|
4094
|
-
open: showExcludeZeroDialog && excludeZero,
|
|
4095
|
-
changeExcludeZero: changeExcludeZero,
|
|
4096
|
-
cancel: cancel
|
|
4097
|
-
});
|
|
4098
|
-
} else {
|
|
4099
|
-
return null;
|
|
4100
|
-
}
|
|
4101
|
-
};
|
|
4102
|
-
|
|
4103
|
-
ShowModal.propTypes = {
|
|
4104
|
-
showExcludeZeroDialog: PropTypes.bool,
|
|
4105
|
-
excludeZero: PropTypes.bool,
|
|
4106
|
-
changeExcludeZero: PropTypes.func,
|
|
4107
|
-
cancel: PropTypes.func
|
|
4108
|
-
};
|
|
4109
|
-
class Main extends React.Component {
|
|
4110
|
-
constructor(props) {
|
|
4111
|
-
super(props);
|
|
4112
|
-
this.state = {
|
|
4113
|
-
showDecreaseMaxPointsDialog: false,
|
|
4114
|
-
showDeleteScaleDialog: false,
|
|
4115
|
-
showDeleteTraitDialog: false,
|
|
4116
|
-
showExcludeZeroDialog: false,
|
|
4117
|
-
showInfoDialog: false,
|
|
4118
|
-
infoDialogText: '',
|
|
4119
|
-
adjustedWidth: MIN_WIDTH,
|
|
4120
|
-
initialUpdateCompleted: false // flag to track the initial update of the div width
|
|
4121
|
-
|
|
4122
|
-
};
|
|
4123
|
-
this.updateDivWidthDebounced = debounce(() => this.updateDivWidth(), 50);
|
|
4124
|
-
|
|
4125
|
-
this.onScaleAdded = () => {
|
|
4126
|
-
var _scales$;
|
|
4127
|
-
|
|
4128
|
-
const {
|
|
4129
|
-
model,
|
|
4130
|
-
onModelChanged,
|
|
4131
|
-
configuration
|
|
4132
|
-
} = this.props;
|
|
4133
|
-
let {
|
|
4134
|
-
scales,
|
|
4135
|
-
excludeZero
|
|
4136
|
-
} = model || {};
|
|
4137
|
-
const {
|
|
4138
|
-
maxNoOfScales
|
|
4139
|
-
} = configuration || {};
|
|
4140
|
-
let {
|
|
4141
|
-
defaultTraitLabel
|
|
4142
|
-
} = configuration || '';
|
|
4143
|
-
|
|
4144
|
-
if (!scales.length) {
|
|
4145
|
-
scales = [];
|
|
4146
|
-
} // if no default trait label is defined, take the trait label of the first scale
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
defaultTraitLabel = typeof defaultTraitLabel === 'string' ? defaultTraitLabel : ((_scales$ = scales[0]) == null ? void 0 : _scales$.traitLabel) || '';
|
|
4150
|
-
|
|
4151
|
-
if (scales.length === maxNoOfScales) {
|
|
4152
|
-
this.set({
|
|
4153
|
-
infoDialogText: `There can't be more than ${maxNoOfScales} scales.`,
|
|
4154
|
-
showInfoDialog: true
|
|
4155
|
-
});
|
|
4156
|
-
return false;
|
|
4157
|
-
}
|
|
4158
|
-
|
|
4159
|
-
scales.push({
|
|
4160
|
-
maxPoints: 1,
|
|
4161
|
-
scorePointsLabels: excludeZero ? [''] : ['', ''],
|
|
4162
|
-
traitLabel: defaultTraitLabel,
|
|
4163
|
-
traits: []
|
|
4164
|
-
});
|
|
4165
|
-
onModelChanged(_extends({}, model, {
|
|
4166
|
-
scales
|
|
4167
|
-
}));
|
|
4168
|
-
};
|
|
4169
|
-
|
|
4170
|
-
this.onScaleChanged = (scaleIndex, params) => {
|
|
4171
|
-
const {
|
|
4172
|
-
model,
|
|
4173
|
-
onModelChanged
|
|
4174
|
-
} = this.props;
|
|
4175
|
-
let scales = cloneDeep((model || {}).scales);
|
|
4176
|
-
if (scaleIndex < 0 || scaleIndex >= scales.length || isEmpty(params)) return false;
|
|
4177
|
-
Object.keys(params).forEach(key => {
|
|
4178
|
-
scales[scaleIndex][key] = params[key];
|
|
4179
|
-
});
|
|
4180
|
-
|
|
4181
|
-
if (model.excludeZero && params.maxPoints === 1) {
|
|
4182
|
-
// excludeZero should be false and disabled when maxPoints is 1 for any scale
|
|
4183
|
-
model.excludeZero = false;
|
|
4184
|
-
scales = addOrRemoveScaleColumn(scales, excludeZeroTypes.add0);
|
|
4185
|
-
}
|
|
4186
|
-
|
|
4187
|
-
onModelChanged(_extends({}, model, {
|
|
4188
|
-
scales
|
|
4189
|
-
}));
|
|
4190
|
-
};
|
|
4191
|
-
|
|
4192
|
-
this.onScaleRemoved = scaleIndex => {
|
|
4193
|
-
const {
|
|
4194
|
-
model,
|
|
4195
|
-
onModelChanged,
|
|
4196
|
-
configuration
|
|
4197
|
-
} = this.props;
|
|
4198
|
-
let {
|
|
4199
|
-
scales
|
|
4200
|
-
} = model || {};
|
|
4201
|
-
const {
|
|
4202
|
-
minNoOfScales
|
|
4203
|
-
} = configuration || {};
|
|
4204
|
-
if (scaleIndex < 0 || scaleIndex >= scales.length) return false;
|
|
4205
|
-
|
|
4206
|
-
if (scales.length === minNoOfScales) {
|
|
4207
|
-
this.set({
|
|
4208
|
-
infoDialogText: `There can't be less than ${minNoOfScales} scales.`,
|
|
4209
|
-
showInfoDialog: true
|
|
4210
|
-
});
|
|
4211
|
-
return false;
|
|
4212
|
-
}
|
|
4213
|
-
|
|
4214
|
-
scales = [...scales.slice(0, scaleIndex), ...scales.slice(scaleIndex + 1)];
|
|
4215
|
-
onModelChanged(_extends({}, model, {
|
|
4216
|
-
scales
|
|
4217
|
-
}));
|
|
4218
|
-
};
|
|
4219
|
-
|
|
4220
|
-
this.onHalfScoringChanged = () => {
|
|
4221
|
-
const {
|
|
4222
|
-
model,
|
|
4223
|
-
onModelChanged
|
|
4224
|
-
} = this.props;
|
|
4225
|
-
let {
|
|
4226
|
-
halfScoring
|
|
4227
|
-
} = model || {};
|
|
4228
|
-
onModelChanged(_extends({}, model, {
|
|
4229
|
-
halfScoring: !halfScoring
|
|
4230
|
-
}));
|
|
4231
|
-
};
|
|
4232
|
-
|
|
4233
|
-
this.onVisibleToStudentChanged = () => {
|
|
4234
|
-
const {
|
|
4235
|
-
model,
|
|
4236
|
-
onModelChanged
|
|
4237
|
-
} = this.props;
|
|
4238
|
-
let {
|
|
4239
|
-
visibleToStudent
|
|
4240
|
-
} = model || {};
|
|
4241
|
-
onModelChanged(_extends({}, model, {
|
|
4242
|
-
visibleToStudent: !visibleToStudent
|
|
4243
|
-
}));
|
|
4244
|
-
};
|
|
4245
|
-
|
|
4246
|
-
this.set = newState => this.setState(newState);
|
|
4247
|
-
|
|
4248
|
-
this.changeShowScorePointLabels = () => {
|
|
4249
|
-
const {
|
|
4250
|
-
model,
|
|
4251
|
-
onModelChanged
|
|
4252
|
-
} = this.props || {};
|
|
4253
|
-
let {
|
|
4254
|
-
pointLabels
|
|
4255
|
-
} = model || {};
|
|
4256
|
-
pointLabels = !pointLabels;
|
|
4257
|
-
onModelChanged(_extends({}, model, {
|
|
4258
|
-
pointLabels
|
|
4259
|
-
}));
|
|
4260
|
-
};
|
|
4261
|
-
|
|
4262
|
-
this.changeShowDescription = () => {
|
|
4263
|
-
const {
|
|
4264
|
-
model,
|
|
4265
|
-
onModelChanged
|
|
4266
|
-
} = this.props || {};
|
|
4267
|
-
let {
|
|
4268
|
-
description
|
|
4269
|
-
} = model || {};
|
|
4270
|
-
description = !description;
|
|
4271
|
-
onModelChanged(_extends({}, model, {
|
|
4272
|
-
description
|
|
4273
|
-
}));
|
|
4274
|
-
};
|
|
4275
|
-
|
|
4276
|
-
this.changeShowStandards = () => {
|
|
4277
|
-
const {
|
|
4278
|
-
model,
|
|
4279
|
-
onModelChanged
|
|
4280
|
-
} = this.props || {};
|
|
4281
|
-
let {
|
|
4282
|
-
standards
|
|
4283
|
-
} = model || {};
|
|
4284
|
-
standards = !standards;
|
|
4285
|
-
onModelChanged(_extends({}, model, {
|
|
4286
|
-
standards
|
|
4287
|
-
}));
|
|
4288
|
-
};
|
|
4289
|
-
|
|
4290
|
-
this.showToggleExcludeZeroModal = () => this.set({
|
|
4291
|
-
showExcludeZeroDialog: true
|
|
4292
|
-
});
|
|
4293
|
-
|
|
4294
|
-
this.hideToggleExcludeZeroModal = () => {
|
|
4295
|
-
this.set({
|
|
4296
|
-
showExcludeZeroDialog: false
|
|
4297
|
-
});
|
|
4298
|
-
};
|
|
4299
|
-
|
|
4300
|
-
this.onCloseInfoDialog = () => this.set({
|
|
4301
|
-
showInfoDialog: false
|
|
4302
|
-
});
|
|
4303
|
-
|
|
4304
|
-
this.changeExcludeZero = excludeZeroType => {
|
|
4305
|
-
const {
|
|
4306
|
-
model,
|
|
4307
|
-
onModelChanged
|
|
4308
|
-
} = this.props || {};
|
|
4309
|
-
const {
|
|
4310
|
-
scales
|
|
4311
|
-
} = model || {};
|
|
4312
|
-
let {
|
|
4313
|
-
excludeZero
|
|
4314
|
-
} = model || {};
|
|
4315
|
-
if (!scales || !scales.length) return;
|
|
4316
|
-
excludeZero = !excludeZero;
|
|
4317
|
-
const newScales = addOrRemoveScaleColumn(scales, excludeZeroType);
|
|
4318
|
-
onModelChanged(_extends({}, model, {
|
|
4319
|
-
scales: newScales,
|
|
4320
|
-
excludeZero
|
|
4321
|
-
}));
|
|
4322
|
-
this.hideToggleExcludeZeroModal();
|
|
4323
|
-
};
|
|
4324
|
-
|
|
4325
|
-
this.onModelChanged = (updatedModel, updatedProperty) => {
|
|
4326
|
-
const {
|
|
4327
|
-
onModelChanged
|
|
4328
|
-
} = this.props || {};
|
|
4329
|
-
|
|
4330
|
-
if (updatedProperty === 'excludeZero') {
|
|
4331
|
-
this.showToggleExcludeZeroModal();
|
|
4332
|
-
} else {
|
|
4333
|
-
onModelChanged(updatedModel);
|
|
4334
|
-
}
|
|
4335
|
-
};
|
|
4336
|
-
|
|
4337
|
-
this.divRef = /*#__PURE__*/React.createRef();
|
|
4338
|
-
this.updateDivWidth = this.updateDivWidth.bind(this);
|
|
4339
|
-
}
|
|
4340
|
-
|
|
4341
|
-
componentDidMount() {
|
|
4342
|
-
window.addEventListener('resize', this.updateDivWidthDebounced);
|
|
4343
|
-
window.addEventListener('load', this.updateDivWidth); // delay updateDivWidth to avoid having this.divRef.current = null at first load
|
|
4344
|
-
|
|
4345
|
-
setTimeout(this.updateDivWidth, 0);
|
|
4346
|
-
}
|
|
4347
|
-
|
|
4348
|
-
componentWillUnmount() {
|
|
4349
|
-
window.removeEventListener('resize', this.updateDivWidthDebounced);
|
|
4350
|
-
window.removeEventListener('load', this.updateDivWidth);
|
|
4351
|
-
}
|
|
4352
|
-
|
|
4353
|
-
componentDidUpdate() {
|
|
4354
|
-
if (!this.state.initialUpdateCompleted) {
|
|
4355
|
-
this.updateDivWidth();
|
|
4356
|
-
this.setState({
|
|
4357
|
-
initialUpdateCompleted: true
|
|
4358
|
-
});
|
|
4359
|
-
}
|
|
4360
|
-
}
|
|
4361
|
-
|
|
4362
|
-
updateDivWidth() {
|
|
4363
|
-
if (this.divRef && this.divRef.current) {
|
|
4364
|
-
const divWidth = this.divRef.current.offsetWidth;
|
|
4365
|
-
|
|
4366
|
-
if (divWidth !== this.state.adjustedWidth) {
|
|
4367
|
-
this.set({
|
|
4368
|
-
adjustedWidth: divWidth
|
|
4369
|
-
});
|
|
4370
|
-
}
|
|
4371
|
-
}
|
|
4372
|
-
}
|
|
4373
|
-
|
|
4374
|
-
render() {
|
|
4375
|
-
const {
|
|
4376
|
-
model,
|
|
4377
|
-
configuration,
|
|
4378
|
-
onConfigurationChanged,
|
|
4379
|
-
uploadSoundSupport,
|
|
4380
|
-
imageSupport
|
|
4381
|
-
} = this.props || {};
|
|
4382
|
-
const {
|
|
4383
|
-
addScale,
|
|
4384
|
-
baseInputConfiguration = {},
|
|
4385
|
-
dragAndDrop,
|
|
4386
|
-
contentDimensions = {},
|
|
4387
|
-
showDescription,
|
|
4388
|
-
showExcludeZero,
|
|
4389
|
-
showLevelTagInput,
|
|
4390
|
-
showStandards,
|
|
4391
|
-
showHalfScoring,
|
|
4392
|
-
showMaxPoint,
|
|
4393
|
-
showScorePointLabels,
|
|
4394
|
-
showVisibleToStudent,
|
|
4395
|
-
spellCheck = {},
|
|
4396
|
-
settingsPanelDisabled,
|
|
4397
|
-
maxNoOfTraits,
|
|
4398
|
-
minNoOfTraits,
|
|
4399
|
-
width,
|
|
4400
|
-
mathMlOptions = {},
|
|
4401
|
-
maxMaxPoints,
|
|
4402
|
-
expandedInput = {},
|
|
4403
|
-
labelInput = {}
|
|
4404
|
-
} = configuration || {};
|
|
4405
|
-
const {
|
|
4406
|
-
errors,
|
|
4407
|
-
extraCSSRules,
|
|
4408
|
-
scales,
|
|
4409
|
-
excludeZero,
|
|
4410
|
-
description,
|
|
4411
|
-
pointLabels,
|
|
4412
|
-
standards,
|
|
4413
|
-
spellCheckEnabled,
|
|
4414
|
-
maxPointsEnabled,
|
|
4415
|
-
addScaleEnabled
|
|
4416
|
-
} = model || {};
|
|
4417
|
-
const {
|
|
4418
|
-
showExcludeZeroDialog,
|
|
4419
|
-
showInfoDialog,
|
|
4420
|
-
infoDialogText,
|
|
4421
|
-
adjustedWidth
|
|
4422
|
-
} = this.state || {}; // excludeZero should be false and disabled when maxPoints is 1 for any scale
|
|
4423
|
-
|
|
4424
|
-
const disabledExcludeZero = scales == null ? void 0 : scales.some(scale => scale.maxPoints === 1);
|
|
4425
|
-
const panelSettings = {
|
|
4426
|
-
standards: showStandards.settings && toggle(showStandards.label),
|
|
4427
|
-
'showLevelTagInput.enabled': showLevelTagInput.settings && toggle(showLevelTagInput.label, true),
|
|
4428
|
-
visibleToStudent: showVisibleToStudent.settings && toggle(showVisibleToStudent.label),
|
|
4429
|
-
excludeZero: showExcludeZero.settings && toggle(showExcludeZero.label, false, disabledExcludeZero),
|
|
4430
|
-
halfScoring: showHalfScoring.settings && toggle(showHalfScoring.label),
|
|
4431
|
-
'dragAndDrop.enabled': dragAndDrop.settings && toggle(dragAndDrop.label, true)
|
|
4432
|
-
};
|
|
4433
|
-
const panelProperties = {
|
|
4434
|
-
description: showDescription.settings && toggle(showDescription.label),
|
|
4435
|
-
pointLabels: showScorePointLabels.settings && toggle(showScorePointLabels.label),
|
|
4436
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
4437
|
-
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
4438
|
-
addScaleEnabled: addScale.settings && toggle(addScale.label)
|
|
4439
|
-
};
|
|
4440
|
-
|
|
4441
|
-
const getPluginProps = props => {
|
|
4442
|
-
return Object.assign(_extends({}, baseInputConfiguration), props || {});
|
|
4443
|
-
};
|
|
4444
|
-
|
|
4445
|
-
return /*#__PURE__*/React.createElement(layout.ConfigLayout, {
|
|
4446
|
-
extraCSSRules: extraCSSRules,
|
|
4447
|
-
dimensions: contentDimensions,
|
|
4448
|
-
hideSettings: settingsPanelDisabled,
|
|
4449
|
-
settings: /*#__PURE__*/React.createElement(Panel, {
|
|
4450
|
-
model: model,
|
|
4451
|
-
onChangeModel: this.onModelChanged,
|
|
4452
|
-
configuration: configuration,
|
|
4453
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
4454
|
-
groups: {
|
|
4455
|
-
Settings: panelSettings,
|
|
4456
|
-
Properties: panelProperties
|
|
4457
|
-
},
|
|
4458
|
-
modal: /*#__PURE__*/React.createElement(ShowModal, {
|
|
4459
|
-
showExcludeZeroDialog: showExcludeZeroDialog,
|
|
4460
|
-
excludeZero: excludeZero,
|
|
4461
|
-
changeExcludeZero: this.changeExcludeZero,
|
|
4462
|
-
cancel: this.hideToggleExcludeZeroModal
|
|
4463
|
-
})
|
|
4464
|
-
})
|
|
4465
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4466
|
-
style: {
|
|
4467
|
-
width: '100%'
|
|
4468
|
-
},
|
|
4469
|
-
ref: this.divRef
|
|
4470
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
4471
|
-
style: {
|
|
4472
|
-
width: width || adjustedWidth
|
|
4473
|
-
}
|
|
4474
|
-
}, (scales || []).map((scale, scaleIndex) => /*#__PURE__*/React.createElement(Scale$1, _extends({
|
|
4475
|
-
key: `scale-${scaleIndex}`,
|
|
4476
|
-
scale: scale,
|
|
4477
|
-
scaleIndex: scaleIndex,
|
|
4478
|
-
errors: errors,
|
|
4479
|
-
onScaleRemoved: this.onScaleRemoved,
|
|
4480
|
-
onScaleChanged: this.onScaleChanged,
|
|
4481
|
-
showStandards: standards,
|
|
4482
|
-
showScorePointLabels: pointLabels,
|
|
4483
|
-
showDescription: description,
|
|
4484
|
-
showLevelTagInput: showLevelTagInput.enabled,
|
|
4485
|
-
excludeZero: excludeZero,
|
|
4486
|
-
enableDragAndDrop: dragAndDrop.enabled,
|
|
4487
|
-
spellCheck: spellCheckEnabled,
|
|
4488
|
-
width: adjustedWidth,
|
|
4489
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
4490
|
-
maxPointsEnabled: maxPointsEnabled,
|
|
4491
|
-
maxNoOfTraits: maxNoOfTraits,
|
|
4492
|
-
minNoOfTraits: minNoOfTraits,
|
|
4493
|
-
imageSupport: imageSupport
|
|
4494
|
-
}, this.props, {
|
|
4495
|
-
classes: {},
|
|
4496
|
-
mathMlOptions: mathMlOptions,
|
|
4497
|
-
maxMaxPoints: maxMaxPoints,
|
|
4498
|
-
expandedPluginProps: getPluginProps(expandedInput == null ? void 0 : expandedInput.inputConfiguration),
|
|
4499
|
-
labelPluginProps: getPluginProps(labelInput == null ? void 0 : labelInput.inputConfiguration)
|
|
4500
|
-
}))), addScaleEnabled && /*#__PURE__*/React.createElement(MultiTraitButton, {
|
|
4501
|
-
onClick: this.onScaleAdded
|
|
4502
|
-
}, "Add Scale")), /*#__PURE__*/React.createElement(InfoDialog, {
|
|
4503
|
-
open: showInfoDialog,
|
|
4504
|
-
text: infoDialogText,
|
|
4505
|
-
onClose: () => this.set({
|
|
4506
|
-
showInfoDialog: false
|
|
4507
|
-
})
|
|
4508
|
-
}));
|
|
4509
|
-
}
|
|
4510
|
-
|
|
4511
|
-
}
|
|
4512
|
-
Main.propTypes = {
|
|
4513
|
-
classes: PropTypes.object,
|
|
4514
|
-
model: PropTypes.object,
|
|
4515
|
-
uploadSoundSupport: PropTypes.object,
|
|
4516
|
-
configuration: PropTypes.object,
|
|
4517
|
-
onModelChanged: PropTypes.func,
|
|
4518
|
-
onConfigurationChanged: PropTypes.func,
|
|
4519
|
-
imageSupport: PropTypes.shape({
|
|
4520
|
-
add: PropTypes.func.isRequired,
|
|
4521
|
-
delete: PropTypes.func.isRequired
|
|
4522
|
-
})
|
|
4523
|
-
};
|
|
4524
|
-
var Main$1 = withDragContext(withStyles(styles)(Main));
|
|
4525
|
-
|
|
4526
|
-
const modelWithDefaults = m => _extends({}, defaults.model, m);
|
|
4527
|
-
|
|
4528
|
-
const configurationWithDefaults = c => _extends({}, defaults.configuration, c);
|
|
4529
|
-
|
|
4530
|
-
class MultiTraitRubricElement extends HTMLElement {
|
|
4531
|
-
constructor() {
|
|
4532
|
-
super();
|
|
4533
|
-
|
|
4534
|
-
this.updateModelAccordingToReceivedProps = m => {
|
|
4535
|
-
const currentModel = _extends({}, this._model);
|
|
4536
|
-
|
|
4537
|
-
if (!m) {
|
|
4538
|
-
return currentModel;
|
|
4539
|
-
}
|
|
4540
|
-
|
|
4541
|
-
const validatedModel = _extends({}, m);
|
|
4542
|
-
|
|
4543
|
-
const {
|
|
4544
|
-
scales,
|
|
4545
|
-
excludeZero
|
|
4546
|
-
} = validatedModel || {};
|
|
4547
|
-
(scales || []).forEach(scale => {
|
|
4548
|
-
if (!scale) {
|
|
4549
|
-
scale = {
|
|
4550
|
-
scorePointsLabels: [],
|
|
4551
|
-
traits: []
|
|
4552
|
-
};
|
|
4553
|
-
}
|
|
4554
|
-
|
|
4555
|
-
const {
|
|
4556
|
-
maxPoints
|
|
4557
|
-
} = scale || {};
|
|
4558
|
-
scale.scorePointsLabels = [...(scale.scorePointsLabels || [])];
|
|
4559
|
-
scale.traits = [...(scale.traits || [])];
|
|
4560
|
-
const howManyScorePointLabelsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
|
|
4561
|
-
const howManyScorePointLabelsItHas = scale.scorePointsLabels.length;
|
|
4562
|
-
|
|
4563
|
-
if (howManyScorePointLabelsItHas !== howManyScorePointLabelsShouldHave) {
|
|
4564
|
-
if (howManyScorePointLabelsItHas < howManyScorePointLabelsShouldHave) {
|
|
4565
|
-
for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointLabelsItHas; i++) {
|
|
4566
|
-
scale.scorePointsLabels.push('');
|
|
4567
|
-
}
|
|
4568
|
-
} else {
|
|
4569
|
-
scale.scorePointsLabels = scale.scorePointsLabels.slice(0, howManyScorePointLabelsShouldHave);
|
|
4570
|
-
}
|
|
4571
|
-
}
|
|
4572
|
-
|
|
4573
|
-
(scale.traits || []).forEach(trait => {
|
|
4574
|
-
if (!trait) {
|
|
4575
|
-
trait = {
|
|
4576
|
-
scorePointsDescriptors: []
|
|
4577
|
-
};
|
|
4578
|
-
}
|
|
4579
|
-
|
|
4580
|
-
trait.scorePointsDescriptors = [...(trait.scorePointsDescriptors || [])];
|
|
4581
|
-
const howManyScorePointDescriptorsItHas = trait.scorePointsDescriptors.length;
|
|
4582
|
-
|
|
4583
|
-
if (howManyScorePointDescriptorsItHas !== howManyScorePointLabelsShouldHave) {
|
|
4584
|
-
if (howManyScorePointDescriptorsItHas < howManyScorePointLabelsShouldHave) {
|
|
4585
|
-
for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointDescriptorsItHas; i++) {
|
|
4586
|
-
trait.scorePointsDescriptors.push('');
|
|
4587
|
-
}
|
|
4588
|
-
} else {
|
|
4589
|
-
trait.scorePointsDescriptors = trait.scorePointsDescriptors.slice(0, howManyScorePointLabelsShouldHave);
|
|
4590
|
-
}
|
|
4591
|
-
}
|
|
4592
|
-
});
|
|
4593
|
-
});
|
|
4594
|
-
|
|
4595
|
-
if (validatedModel.excludeZero) {
|
|
4596
|
-
// check if any scale has maxPoints set to 1
|
|
4597
|
-
const shouldAddColumn0 = validatedModel.scales.some(scale => scale.maxPoints === 1);
|
|
4598
|
-
|
|
4599
|
-
if (shouldAddColumn0) {
|
|
4600
|
-
// excludeZero should be false and disabled when maxPoints is 1
|
|
4601
|
-
validatedModel.excludeZero = false; // add column 0 for all scales
|
|
4602
|
-
|
|
4603
|
-
validatedModel.scales = addOrRemoveScaleColumn(scales, excludeZeroTypes.add0);
|
|
4604
|
-
}
|
|
4605
|
-
}
|
|
4606
|
-
|
|
4607
|
-
return validatedModel;
|
|
4608
|
-
};
|
|
4609
|
-
|
|
4610
|
-
this.onModelChanged = m => {
|
|
4611
|
-
this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
|
|
4612
|
-
|
|
4613
|
-
this._render();
|
|
4614
|
-
|
|
4615
|
-
this.dispatchEvent(new ModelUpdatedEvent(this._model, false));
|
|
4616
|
-
};
|
|
4617
|
-
|
|
4618
|
-
this.onConfigurationChanged = c => {
|
|
4619
|
-
this._configuration = configurationWithDefaults(c);
|
|
4620
|
-
|
|
4621
|
-
this._render();
|
|
4622
|
-
};
|
|
4623
|
-
|
|
4624
|
-
this._model = modelWithDefaults();
|
|
4625
|
-
this._configuration = configurationWithDefaults();
|
|
4626
|
-
}
|
|
4627
|
-
|
|
4628
|
-
set model(m) {
|
|
4629
|
-
this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
|
|
4630
|
-
|
|
4631
|
-
this._render();
|
|
4632
|
-
}
|
|
4633
|
-
|
|
4634
|
-
set configuration(c) {
|
|
4635
|
-
this._configuration = configurationWithDefaults(c);
|
|
4636
|
-
|
|
4637
|
-
this._render();
|
|
4638
|
-
}
|
|
4639
|
-
|
|
4640
|
-
insertSound(handler) {
|
|
4641
|
-
this.dispatchEvent(new InsertSoundEvent(handler));
|
|
4642
|
-
}
|
|
4643
|
-
|
|
4644
|
-
onDeleteSound(src, done) {
|
|
4645
|
-
this.dispatchEvent(new DeleteSoundEvent(src, done));
|
|
4646
|
-
}
|
|
4647
|
-
|
|
4648
|
-
insertImage(handler) {
|
|
4649
|
-
this.dispatchEvent(new InsertImageEvent(handler));
|
|
4650
|
-
}
|
|
4651
|
-
|
|
4652
|
-
onDeleteImage(src, done) {
|
|
4653
|
-
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
4654
|
-
}
|
|
4655
|
-
|
|
4656
|
-
_render() {
|
|
4657
|
-
if (this._model) {
|
|
4658
|
-
let element = /*#__PURE__*/React.createElement(Main$1, {
|
|
4659
|
-
model: this._model,
|
|
4660
|
-
configuration: this._configuration,
|
|
4661
|
-
onModelChanged: this.onModelChanged,
|
|
4662
|
-
onConfigurationChanged: this.onConfigurationChanged,
|
|
4663
|
-
uploadSoundSupport: {
|
|
4664
|
-
add: this.insertSound.bind(this),
|
|
4665
|
-
delete: this.onDeleteSound.bind(this)
|
|
4666
|
-
},
|
|
4667
|
-
imageSupport: {
|
|
4668
|
-
add: this.insertImage.bind(this),
|
|
4669
|
-
delete: this.onDeleteImage.bind(this)
|
|
4670
|
-
}
|
|
4671
|
-
});
|
|
4672
|
-
ReactDOM.render(element, this);
|
|
4673
|
-
}
|
|
4674
|
-
}
|
|
4675
|
-
|
|
4676
|
-
}
|
|
4677
|
-
|
|
4678
|
-
export { MultiTraitRubricElement as default };
|
|
4679
|
-
//# sourceMappingURL=configure.js.map
|