@pie-element/multi-trait-rubric 1.4.2 → 1.4.3-next.1008

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2993 +0,0 @@
1
- import {_dll_pie_lib__editable_html, _dll_pie_lib__config_ui, _dll_pie_framework__pie_configure_events} from "../../shared-config@^1.8.13/module/index.js";
2
- import {_dll_react, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_prop_types, _dll_lodash, _dll_react_dnd, _dll_pie_lib__drag, _dll_react_dom} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
3
- function unwrapExports(x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
- function createCommonjsModule(fn, module) {
7
- return (module = {
8
- exports: {}
9
- }, fn(module, module.exports), module.exports);
10
- }
11
- var interopRequireDefault = createCommonjsModule(function (module) {
12
- function _interopRequireDefault(obj) {
13
- return obj && obj.__esModule ? obj : {
14
- "default": obj
15
- };
16
- }
17
- module.exports = _interopRequireDefault;
18
- });
19
- unwrapExports(interopRequireDefault);
20
- var setPrototypeOf = createCommonjsModule(function (module) {
21
- function _setPrototypeOf(o, p) {
22
- module.exports = _setPrototypeOf = Object.setPrototypeOf || (function _setPrototypeOf(o, p) {
23
- o.__proto__ = p;
24
- return o;
25
- });
26
- return _setPrototypeOf(o, p);
27
- }
28
- module.exports = _setPrototypeOf;
29
- });
30
- function _inheritsLoose(subClass, superClass) {
31
- subClass.prototype = Object.create(superClass.prototype);
32
- subClass.prototype.constructor = subClass;
33
- setPrototypeOf(subClass, superClass);
34
- }
35
- var inheritsLoose = _inheritsLoose;
36
- var setStatic_1 = createCommonjsModule(function (module, exports) {
37
- exports.__esModule = true;
38
- exports.default = void 0;
39
- var setStatic = function setStatic(key, value) {
40
- return function (BaseComponent) {
41
- BaseComponent[key] = value;
42
- return BaseComponent;
43
- };
44
- };
45
- var _default = setStatic;
46
- exports.default = _default;
47
- });
48
- unwrapExports(setStatic_1);
49
- var setDisplayName_1 = createCommonjsModule(function (module, exports) {
50
- exports.__esModule = true;
51
- exports.default = void 0;
52
- var _setStatic = interopRequireDefault(setStatic_1);
53
- var setDisplayName = function setDisplayName(displayName) {
54
- return (0, _setStatic.default)('displayName', displayName);
55
- };
56
- var _default = setDisplayName;
57
- exports.default = _default;
58
- });
59
- unwrapExports(setDisplayName_1);
60
- var getDisplayName_1 = createCommonjsModule(function (module, exports) {
61
- exports.__esModule = true;
62
- exports.default = void 0;
63
- var getDisplayName = function getDisplayName(Component) {
64
- if (typeof Component === 'string') {
65
- return Component;
66
- }
67
- if (!Component) {
68
- return undefined;
69
- }
70
- return Component.displayName || Component.name || 'Component';
71
- };
72
- var _default = getDisplayName;
73
- exports.default = _default;
74
- });
75
- unwrapExports(getDisplayName_1);
76
- var wrapDisplayName_1 = createCommonjsModule(function (module, exports) {
77
- exports.__esModule = true;
78
- exports.default = void 0;
79
- var _getDisplayName = interopRequireDefault(getDisplayName_1);
80
- var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
81
- return hocName + "(" + (0, _getDisplayName.default)(BaseComponent) + ")";
82
- };
83
- var _default = wrapDisplayName;
84
- exports.default = _default;
85
- });
86
- unwrapExports(wrapDisplayName_1);
87
- const _react = _dll_react;
88
- var shouldUpdate_1 = createCommonjsModule(function (module, exports) {
89
- exports.__esModule = true;
90
- exports.default = void 0;
91
- var _inheritsLoose2 = interopRequireDefault(inheritsLoose);
92
- var _setDisplayName = interopRequireDefault(setDisplayName_1);
93
- var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
94
- var shouldUpdate = function shouldUpdate(test) {
95
- return function (BaseComponent) {
96
- var factory = (0, _react.createFactory)(BaseComponent);
97
- var ShouldUpdate = (function (_Component) {
98
- (0, _inheritsLoose2.default)(ShouldUpdate, _Component);
99
- function ShouldUpdate() {
100
- return _Component.apply(this, arguments) || this;
101
- }
102
- var _proto = ShouldUpdate.prototype;
103
- _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
104
- return test(this.props, nextProps);
105
- };
106
- _proto.render = function render() {
107
- return factory(this.props);
108
- };
109
- return ShouldUpdate;
110
- })(_react.Component);
111
- {
112
- return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'shouldUpdate'))(ShouldUpdate);
113
- }
114
- };
115
- };
116
- var _default = shouldUpdate;
117
- exports.default = _default;
118
- });
119
- unwrapExports(shouldUpdate_1);
120
- var hasOwnProperty = Object.prototype.hasOwnProperty;
121
- function is(x, y) {
122
- if (x === y) {
123
- return x !== 0 || y !== 0 || 1 / x === 1 / y;
124
- } else {
125
- return x !== x && y !== y;
126
- }
127
- }
128
- function shallowEqual(objA, objB) {
129
- if (is(objA, objB)) {
130
- return true;
131
- }
132
- if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
133
- return false;
134
- }
135
- var keysA = Object.keys(objA);
136
- var keysB = Object.keys(objB);
137
- if (keysA.length !== keysB.length) {
138
- return false;
139
- }
140
- for (var i = 0; i < keysA.length; i++) {
141
- if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
142
- return false;
143
- }
144
- }
145
- return true;
146
- }
147
- var shallowEqual_1 = shallowEqual;
148
- var shallowEqual$1 = createCommonjsModule(function (module, exports) {
149
- exports.__esModule = true;
150
- exports.default = void 0;
151
- var _shallowEqual = interopRequireDefault(shallowEqual_1);
152
- var _default = _shallowEqual.default;
153
- exports.default = _default;
154
- });
155
- unwrapExports(shallowEqual$1);
156
- var pure_1 = createCommonjsModule(function (module, exports) {
157
- exports.__esModule = true;
158
- exports.default = void 0;
159
- var _shouldUpdate = interopRequireDefault(shouldUpdate_1);
160
- var _shallowEqual = interopRequireDefault(shallowEqual$1);
161
- var _setDisplayName = interopRequireDefault(setDisplayName_1);
162
- var _wrapDisplayName = interopRequireDefault(wrapDisplayName_1);
163
- var pure = function pure(BaseComponent) {
164
- var hoc = (0, _shouldUpdate.default)(function (props, nextProps) {
165
- return !(0, _shallowEqual.default)(props, nextProps);
166
- });
167
- {
168
- return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
169
- }
170
- };
171
- var _default = pure;
172
- exports.default = _default;
173
- });
174
- unwrapExports(pure_1);
175
- const require$$0 = _dll_react;
176
- const {SvgIcon: require$$2} = _dll_material_ui__core;
177
- var createSvgIcon_1 = createCommonjsModule(function (module, exports) {
178
- Object.defineProperty(exports, "__esModule", {
179
- value: true
180
- });
181
- exports.default = void 0;
182
- var _react = interopRequireDefault(require$$0);
183
- var _pure = interopRequireDefault(pure_1);
184
- var _SvgIcon = interopRequireDefault(require$$2);
185
- function createSvgIcon(path, displayName) {
186
- var Icon = function Icon(props) {
187
- return _react.default.createElement(_SvgIcon.default, props, path);
188
- };
189
- Icon.displayName = ("").concat(displayName, "Icon");
190
- Icon = (0, _pure.default)(Icon);
191
- Icon.muiName = 'SvgIcon';
192
- return Icon;
193
- }
194
- var _default = createSvgIcon;
195
- exports.default = _default;
196
- });
197
- unwrapExports(createSvgIcon_1);
198
- const require$$0$1 = _dll_react;
199
- var ArrowBackIos = createCommonjsModule(function (module, exports) {
200
- Object.defineProperty(exports, "__esModule", {
201
- value: true
202
- });
203
- exports.default = void 0;
204
- var _react = interopRequireDefault(require$$0$1);
205
- var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
206
- var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
207
- d: "M11.67 3.87L9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"
208
- }), _react.default.createElement("path", {
209
- fill: "none",
210
- d: "M0 0h24v24H0z"
211
- })), 'ArrowBackIos');
212
- exports.default = _default;
213
- });
214
- var ArrowBackIosIcon = unwrapExports(ArrowBackIos);
215
- const require$$0$2 = _dll_react;
216
- var ArrowForwardIos = createCommonjsModule(function (module, exports) {
217
- Object.defineProperty(exports, "__esModule", {
218
- value: true
219
- });
220
- exports.default = void 0;
221
- var _react = interopRequireDefault(require$$0$2);
222
- var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
223
- var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
224
- d: "M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z"
225
- }), _react.default.createElement("path", {
226
- fill: "none",
227
- d: "M0 0h24v24H0z"
228
- })), 'ArrowForwardIos');
229
- exports.default = _default;
230
- });
231
- var ArrowForwardIosIcon = unwrapExports(ArrowForwardIos);
232
- const require$$0$3 = _dll_react;
233
- var MoreVert = createCommonjsModule(function (module, exports) {
234
- Object.defineProperty(exports, "__esModule", {
235
- value: true
236
- });
237
- exports.default = void 0;
238
- var _react = interopRequireDefault(require$$0$3);
239
- var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
240
- var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
241
- fill: "none",
242
- d: "M0 0h24v24H0z"
243
- }), _react.default.createElement("path", {
244
- d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
245
- })), 'MoreVert');
246
- exports.default = _default;
247
- });
248
- var MoreVertIcon = unwrapExports(MoreVert);
249
- var classnames = createCommonjsModule(function (module) {
250
- (function () {
251
- var hasOwn = ({}).hasOwnProperty;
252
- function classNames() {
253
- var classes = [];
254
- for (var i = 0; i < arguments.length; i++) {
255
- var arg = arguments[i];
256
- if (!arg) continue;
257
- var argType = typeof arg;
258
- if (argType === 'string' || argType === 'number') {
259
- classes.push(arg);
260
- } else if (Array.isArray(arg) && arg.length) {
261
- var inner = classNames.apply(null, arg);
262
- if (inner) {
263
- classes.push(inner);
264
- }
265
- } else if (argType === 'object') {
266
- for (var key in arg) {
267
- if (hasOwn.call(arg, key) && arg[key]) {
268
- classes.push(key);
269
- }
270
- }
271
- }
272
- }
273
- return classes.join(' ');
274
- }
275
- if (module.exports) {
276
- classNames.default = classNames;
277
- module.exports = classNames;
278
- } else {
279
- window.classNames = classNames;
280
- }
281
- })();
282
- });
283
- const React = _dll_react;
284
- const {withStyles: withStyles} = _dll_material_ui__core_styles;
285
- const {FormControl: FormControl} = _dll_material_ui__core;
286
- const {InputLabel: InputLabel} = _dll_material_ui__core;
287
- const {Select: Select} = _dll_material_ui__core;
288
- const {MenuItem: MenuItem} = _dll_material_ui__core;
289
- const {InputBase: InputBase} = _dll_material_ui__core;
290
- const {colors: {grey: grey}} = _dll_material_ui__core;
291
- const {color: color} = _dll_pie_lib__render_ui;
292
- const EditableHtml = _dll_pie_lib__editable_html;
293
- const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/packages/multi-trait-rubric/configure/src/common.jsx";
294
- const BlockWidth = 180;
295
- const PrimaryBlockWidth = 200;
296
- const DragHandleSpace = 32;
297
- const HeaderHeight = '100px';
298
- const HeaderHeightLarge = '160px';
299
- const InputHeight = '120px';
300
- const greyBorder = `solid 1px ${grey[400]}`;
301
- const Padding = '8px';
302
- const MultiTraitButton = withStyles({
303
- button: {
304
- fontSize: '16px',
305
- textAlign: 'right',
306
- display: 'flex',
307
- flexDirection: 'row',
308
- alignItems: 'flex-start',
309
- padding: '11px 16px',
310
- width: '114px',
311
- background: color.secondaryBackground(),
312
- borderRadius: '4px',
313
- justifyContent: 'space-around',
314
- color: color.text(),
315
- cursor: 'pointer'
316
- }
317
- })(({classes, children, onClick}) => React.createElement('div', {
318
- className: classes.button,
319
- onClick: onClick,
320
- __self: undefined,
321
- __source: {
322
- fileName: _jsxFileName,
323
- lineNumber: 39
324
- }
325
- }, React.createElement('strong', {
326
- __self: undefined,
327
- __source: {
328
- fileName: _jsxFileName,
329
- lineNumber: 43
330
- }
331
- }, "+"), React.createElement('div', {
332
- __self: undefined,
333
- __source: {
334
- fileName: _jsxFileName,
335
- lineNumber: 44
336
- }
337
- }, children)));
338
- const PrimaryBlock = withStyles({
339
- primaryBlock: {
340
- width: `${PrimaryBlockWidth}px`,
341
- minWidth: `${PrimaryBlockWidth}px`,
342
- position: 'relative',
343
- padding: Padding,
344
- boxSizing: 'border-box'
345
- }
346
- })(({classes, children, className}) => React.createElement('div', {
347
- className: classnames(classes.primaryBlock, className),
348
- __self: undefined,
349
- __source: {
350
- fileName: _jsxFileName,
351
- lineNumber: 57
352
- }
353
- }, children));
354
- const Block = withStyles({
355
- block: {
356
- width: `${BlockWidth}px`,
357
- minWidth: `${BlockWidth}px`,
358
- padding: Padding
359
- }
360
- })(({classes, children}) => React.createElement('div', {
361
- className: classes.block,
362
- __self: undefined,
363
- __source: {
364
- fileName: _jsxFileName,
365
- lineNumber: 69
366
- }
367
- }, children));
368
- const SecondaryBlock = withStyles({
369
- secondaryBlock: {
370
- display: 'flex',
371
- overflowX: 'hidden',
372
- alignItems: 'flex-end',
373
- paddingBottom: '22px'
374
- }
375
- })(({classes, children, setRef}) => React.createElement('div', {
376
- className: classes.secondaryBlock,
377
- ref: setRef,
378
- __self: undefined,
379
- __source: {
380
- fileName: _jsxFileName,
381
- lineNumber: 83
382
- }
383
- }, children));
384
- const Row = withStyles({
385
- row: {
386
- display: 'flex',
387
- margin: '4px 0'
388
- }
389
- })(({classes, children, className, height}) => React.createElement('div', {
390
- className: classnames(classes.row, className),
391
- style: {
392
- height
393
- },
394
- __self: undefined,
395
- __source: {
396
- fileName: _jsxFileName,
397
- lineNumber: 94
398
- }
399
- }, children));
400
- const ScorePoint = withStyles({
401
- scorePointBoxWrapper: {
402
- padding: '0 10px'
403
- },
404
- scorePointBox: {
405
- display: 'flex',
406
- borderRadius: '4px',
407
- background: 'white',
408
- flexDirection: 'row',
409
- alignItems: 'center',
410
- justifyContent: 'space-between',
411
- border: greyBorder
412
- },
413
- scorePointBoxDisabled: {
414
- background: 'none',
415
- justifyContent: 'center',
416
- border: '0'
417
- },
418
- subLabel: {
419
- width: '24px',
420
- textAlign: 'center'
421
- },
422
- editableLabel: {
423
- textAlign: 'left',
424
- flex: 1,
425
- border: 'none',
426
- '& div': {
427
- padding: 0
428
- },
429
- '& > div': {
430
- border: 'none',
431
- borderLeft: greyBorder,
432
- borderRadius: 0,
433
- padding: Padding
434
- }
435
- },
436
- slateEditor: {
437
- fontFamily: 'Cerebri'
438
- }
439
- })(({classes, scorePointsValue, scoreDescriptor, pluginProps, onChange, showScorePointLabels}) => {
440
- const scoreBoxClasses = showScorePointLabels ? classes.scorePointBox : `${classes.scorePointBox} ${classes.scorePointBoxDisabled}`;
441
- return React.createElement('div', {
442
- className: classes.scorePointBoxWrapper,
443
- __self: undefined,
444
- __source: {
445
- fileName: _jsxFileName,
446
- lineNumber: 151
447
- }
448
- }, React.createElement('div', {
449
- className: scoreBoxClasses,
450
- __self: undefined,
451
- __source: {
452
- fileName: _jsxFileName,
453
- lineNumber: 152
454
- }
455
- }, React.createElement('div', {
456
- className: classes.subLabel,
457
- __self: undefined,
458
- __source: {
459
- fileName: _jsxFileName,
460
- lineNumber: 153
461
- }
462
- }, scorePointsValue), showScorePointLabels ? React.createElement(EditableHtml, {
463
- className: classes.editableLabel,
464
- classes: {
465
- slateEditor: classes.slateEditor
466
- },
467
- markup: scoreDescriptor,
468
- placeholder: "Label",
469
- onChange: onChange,
470
- pluginProps: pluginProps,
471
- __self: undefined,
472
- __source: {
473
- fileName: _jsxFileName,
474
- lineNumber: 157
475
- }
476
- }) : null));
477
- });
478
- const maxScoreOptions = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
479
- const inputStyles = {
480
- root: {
481
- background: 'white',
482
- 'label + &': {
483
- marginTop: '20px',
484
- marginBottom: 0,
485
- width: '80px'
486
- }
487
- },
488
- input: {
489
- borderRadius: '4px',
490
- position: 'relative',
491
- border: greyBorder,
492
- fontSize: '14px',
493
- fontFamily: 'Cerebri Sans',
494
- padding: '8px 12px',
495
- '&:focus': {
496
- borderRadius: '4px'
497
- }
498
- }
499
- };
500
- const BootstrapInput = withStyles(inputStyles)(InputBase);
501
- const MaxPointsPicker = withStyles({})(({maxPoints, onChange}) => React.createElement(FormControl, {
502
- __self: undefined,
503
- __source: {
504
- fileName: _jsxFileName,
505
- lineNumber: 197
506
- }
507
- }, React.createElement(InputLabel, {
508
- __self: undefined,
509
- __source: {
510
- fileName: _jsxFileName,
511
- lineNumber: 198
512
- }
513
- }, "Max Points"), React.createElement(Select, {
514
- value: maxPoints,
515
- onChange: onChange,
516
- input: React.createElement(BootstrapInput, {
517
- __self: undefined,
518
- __source: {
519
- fileName: _jsxFileName,
520
- lineNumber: 204
521
- }
522
- }),
523
- __self: undefined,
524
- __source: {
525
- fileName: _jsxFileName,
526
- lineNumber: 201
527
- }
528
- }, (maxScoreOptions || []).map(maxScore => React.createElement(MenuItem, {
529
- key: `menu-item-${maxScore}`,
530
- value: maxScore,
531
- __self: undefined,
532
- __source: {
533
- fileName: _jsxFileName,
534
- lineNumber: 207
535
- }
536
- }, maxScore)))));
537
- const SimpleInput = withStyles({
538
- simpleInput: {
539
- display: 'flex',
540
- justifyContent: 'space-between',
541
- alignItems: 'center',
542
- margin: '12px 0'
543
- },
544
- editableLevel: {
545
- background: 'white',
546
- width: '60%'
547
- },
548
- slateEditor: {
549
- fontFamily: 'Cerebri'
550
- }
551
- })(({classes, markup, onChange, pluginProps, label}) => React.createElement('div', {
552
- className: classes.simpleInput,
553
- __self: undefined,
554
- __source: {
555
- fileName: _jsxFileName,
556
- lineNumber: 233
557
- }
558
- }, label && React.createElement('div', {
559
- __self: undefined,
560
- __source: {
561
- fileName: _jsxFileName,
562
- lineNumber: 234
563
- }
564
- }, label), React.createElement(EditableHtml, {
565
- className: classes.editableLevel,
566
- classes: {
567
- slateEditor: classes.slateEditor
568
- },
569
- markup: markup,
570
- onChange: onChange,
571
- placeholder: "Trait Label",
572
- pluginProps: pluginProps,
573
- __self: undefined,
574
- __source: {
575
- fileName: _jsxFileName,
576
- lineNumber: 236
577
- }
578
- })));
579
- const UnderlinedInput = withStyles({
580
- underlinedInputWrapper: {
581
- width: '100%',
582
- height: '100%',
583
- display: 'flex',
584
- justifyContent: 'center',
585
- alignItems: 'center'
586
- },
587
- editableLevel: {
588
- background: 'white',
589
- width: '100%',
590
- '& div': {
591
- padding: 0
592
- },
593
- '& > div': {
594
- border: 'none',
595
- borderBottom: greyBorder,
596
- borderRadius: 0,
597
- padding: Padding
598
- }
599
- },
600
- slateEditor: {
601
- fontFamily: 'Cerebri'
602
- }
603
- })(({classes, markup, onChange, pluginProps, label, placeholder}) => React.createElement('div', {
604
- className: classes.underlinedInputWrapper,
605
- __self: undefined,
606
- __source: {
607
- fileName: _jsxFileName,
608
- lineNumber: 274
609
- }
610
- }, label && React.createElement('div', {
611
- __self: undefined,
612
- __source: {
613
- fileName: _jsxFileName,
614
- lineNumber: 275
615
- }
616
- }, label), React.createElement(EditableHtml, {
617
- className: classes.editableLevel,
618
- classes: {
619
- slateEditor: classes.slateEditor
620
- },
621
- markup: markup,
622
- onChange: onChange,
623
- placeholder: placeholder,
624
- pluginProps: pluginProps,
625
- __self: undefined,
626
- __source: {
627
- fileName: _jsxFileName,
628
- lineNumber: 277
629
- }
630
- })));
631
- const ExpandedInput = withStyles({
632
- slateEditor: {
633
- fontFamily: 'Cerebri',
634
- height: InputHeight,
635
- padding: 0
636
- },
637
- prompt: {
638
- border: 'none',
639
- margin: '10px'
640
- }
641
- })(({classes, markup, onChange, pluginProps, placeholder}) => React.createElement('div', {
642
- __self: undefined,
643
- __source: {
644
- fileName: _jsxFileName,
645
- lineNumber: 300
646
- }
647
- }, React.createElement(EditableHtml, {
648
- className: classes.prompt,
649
- classes: {
650
- slateEditor: classes.slateEditor
651
- },
652
- markup: markup,
653
- onChange: onChange,
654
- placeholder: placeholder,
655
- pluginProps: pluginProps,
656
- __self: undefined,
657
- __source: {
658
- fileName: _jsxFileName,
659
- lineNumber: 301
660
- }
661
- })));
662
- const ScaleSettings = withStyles({
663
- scaleSettings: {
664
- display: 'flex',
665
- justifyContent: 'space-between',
666
- alignItems: 'flex-end'
667
- }
668
- })(({classes, children}) => React.createElement('div', {
669
- className: classes.scaleSettings,
670
- __self: undefined,
671
- __source: {
672
- fileName: _jsxFileName,
673
- lineNumber: 319
674
- }
675
- }, children));
676
- const Arrow = withStyles({
677
- arrow: {
678
- position: 'absolute',
679
- zIndex: 10,
680
- cursor: 'pointer',
681
- right: 0,
682
- alignItems: 'flex-start',
683
- justifyContent: 'center',
684
- background: `linear-gradient(to left, white, ${color.background()})`,
685
- boxSizing: 'border-box',
686
- padding: '4px 0'
687
- },
688
- innerGrey: {
689
- position: 'absolute',
690
- zIndex: 11,
691
- cursor: 'pointer',
692
- right: 0,
693
- alignItems: 'flex-start',
694
- justifyContent: 'center',
695
- background: `linear-gradient(to left, white, ${color.background()})`,
696
- boxSizing: 'border-box',
697
- '& svg': {
698
- position: 'absolute',
699
- bottom: '-24px'
700
- }
701
- }
702
- })(({classes, children, className, show, width, onClick, left, showLevelTagInput}) => React.createElement('div', {
703
- className: classnames(classes.arrow, className),
704
- style: {
705
- height: '-webkit-fill-available',
706
- display: show ? 'flex' : 'none',
707
- width: width,
708
- left: left,
709
- background: left ? `linear-gradient(to right, white, ${color.background()})` : undefined
710
- },
711
- onClick: onClick,
712
- __self: undefined,
713
- __source: {
714
- fileName: _jsxFileName,
715
- lineNumber: 353
716
- }
717
- }, React.createElement('div', {
718
- className: classnames(classes.innerGrey, className),
719
- style: {
720
- display: show ? 'flex' : 'none',
721
- width: width,
722
- height: showLevelTagInput ? HeaderHeightLarge : HeaderHeight,
723
- left: 0,
724
- background: left ? `linear-gradient(to right, ${color.secondaryBackground()}, ${color.background()})` : undefined
725
- },
726
- onClick: onClick,
727
- __self: undefined,
728
- __source: {
729
- fileName: _jsxFileName,
730
- lineNumber: 363
731
- }
732
- }, children)));
733
- const React$1 = _dll_react;
734
- const PropTypes = _dll_prop_types;
735
- const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
736
- const {IconButton: IconButton} = _dll_material_ui__core;
737
- const {Menu: Menu} = _dll_material_ui__core;
738
- const {MenuItem: MenuItem$1} = _dll_material_ui__core;
739
- const {color: color$1} = _dll_pie_lib__render_ui;
740
- const _jsxFileName$1 = "/home/ede/dev/github/pie-framework/pie-elements/packages/multi-trait-rubric/configure/src/traitsHeader.jsx";
741
- const styles = {
742
- label: {
743
- textAlign: 'center',
744
- width: '140px',
745
- border: 'none',
746
- margin: '8px',
747
- padding: '10px 0',
748
- display: 'flex',
749
- alignItems: 'center',
750
- justifyContent: 'space-around'
751
- },
752
- greyHeader: {
753
- background: color$1.secondaryBackground(),
754
- borderRadius: '4px',
755
- position: 'relative'
756
- },
757
- primaryBlockGreyHeader: {
758
- paddingTop: '12px'
759
- }
760
- };
761
- class TraitsHeaderTile extends React$1.Component {
762
- constructor(...args) {
763
- super(...args);
764
- TraitsHeaderTile.prototype.__init.call(this);
765
- TraitsHeaderTile.prototype.__init2.call(this);
766
- TraitsHeaderTile.prototype.__init3.call(this);
767
- TraitsHeaderTile.prototype.__init4.call(this);
768
- TraitsHeaderTile.prototype.__init5.call(this);
769
- TraitsHeaderTile.prototype.__init6.call(this);
770
- }
771
- __init() {
772
- this.state = {
773
- anchorEl: null
774
- };
775
- }
776
- UNSAFE_componentWillReceiveProps(nextProps) {
777
- if (nextProps.currentPosition !== this.props.currentPosition) {
778
- this.scrollToPosition(nextProps.currentPosition);
779
- }
780
- }
781
- __init2() {
782
- this.onScorePointLabelChange = ({scorePointLabel, value}) => {
783
- const {scorePointsLabels, onScaleChange} = this.props;
784
- if (value < 0 || value >= scorePointsLabels.length) return;
785
- scorePointsLabels[value] = scorePointLabel;
786
- onScaleChange({
787
- scorePointsLabels
788
- });
789
- };
790
- }
791
- __init3() {
792
- this.handleClick = event => this.setState({
793
- anchorEl: event.currentTarget
794
- });
795
- }
796
- __init4() {
797
- this.handleClose = () => this.setState({
798
- anchorEl: null
799
- });
800
- }
801
- __init5() {
802
- this.scrollToPosition = position => this.secondaryBlock.scrollTo({
803
- left: position
804
- });
805
- }
806
- __init6() {
807
- this.openMenu = () => {
808
- this.props.showDeleteScaleModal();
809
- this.handleClose();
810
- };
811
- }
812
- render() {
813
- const {scorePointsValues, scorePointsLabels, traitLabel, classes, showStandards, onTraitLabelChange, showDescription, showLevelTagInput, maxPoints, updateMaxPointsFieldValue, scaleIndex, showScorePointLabels, setSecondaryBlockRef} = this.props;
814
- const pluginProps = {
815
- image: {
816
- disabled: true
817
- },
818
- math: {
819
- disabled: true
820
- }
821
- };
822
- const {anchorEl} = this.state;
823
- return React$1.createElement(Row, {
824
- className: classes.greyHeader,
825
- height: showLevelTagInput ? HeaderHeightLarge : HeaderHeight,
826
- __self: this,
827
- __source: {
828
- fileName: _jsxFileName$1,
829
- lineNumber: 100
830
- }
831
- }, React$1.createElement(PrimaryBlock, {
832
- className: classes.primaryBlockGreyHeader,
833
- __self: this,
834
- __source: {
835
- fileName: _jsxFileName$1,
836
- lineNumber: 101
837
- }
838
- }, showLevelTagInput && React$1.createElement(SimpleInput, {
839
- markup: traitLabel || 'Trait',
840
- onChange: onTraitLabelChange,
841
- pluginProps: pluginProps,
842
- label: "Level Label",
843
- __self: this,
844
- __source: {
845
- fileName: _jsxFileName$1,
846
- lineNumber: 103
847
- }
848
- }), React$1.createElement(ScaleSettings, {
849
- __self: this,
850
- __source: {
851
- fileName: _jsxFileName$1,
852
- lineNumber: 111
853
- }
854
- }, React$1.createElement('div', {
855
- __self: this,
856
- __source: {
857
- fileName: _jsxFileName$1,
858
- lineNumber: 112
859
- }
860
- }, "Scale ", scaleIndex + 1), React$1.createElement(MaxPointsPicker, {
861
- maxPoints: maxPoints,
862
- onChange: updateMaxPointsFieldValue,
863
- __self: this,
864
- __source: {
865
- fileName: _jsxFileName$1,
866
- lineNumber: 116
867
- }
868
- }), React$1.createElement('div', {
869
- __self: this,
870
- __source: {
871
- fileName: _jsxFileName$1,
872
- lineNumber: 121
873
- }
874
- }, React$1.createElement(IconButton, {
875
- 'aria-label': "more",
876
- 'aria-controls': "long-menu",
877
- 'aria-haspopup': "true",
878
- onClick: this.handleClick,
879
- __self: this,
880
- __source: {
881
- fileName: _jsxFileName$1,
882
- lineNumber: 122
883
- }
884
- }, React$1.createElement(MoreVertIcon, {
885
- __self: this,
886
- __source: {
887
- fileName: _jsxFileName$1,
888
- lineNumber: 128
889
- }
890
- })), React$1.createElement(Menu, {
891
- id: "long-menu",
892
- anchorEl: anchorEl,
893
- keepMounted: true,
894
- open: !!anchorEl,
895
- onClose: this.handleClose,
896
- __self: this,
897
- __source: {
898
- fileName: _jsxFileName$1,
899
- lineNumber: 130
900
- }
901
- }, ['Remove Scale'].map(option => React$1.createElement(MenuItem$1, {
902
- key: option,
903
- onClick: this.openMenu,
904
- __self: this,
905
- __source: {
906
- fileName: _jsxFileName$1,
907
- lineNumber: 138
908
- }
909
- }, option)))))), React$1.createElement(SecondaryBlock, {
910
- setRef: ref => {
911
- if (ref) {
912
- this.secondaryBlock = ref;
913
- setSecondaryBlockRef(ref);
914
- }
915
- },
916
- __self: this,
917
- __source: {
918
- fileName: _jsxFileName$1,
919
- lineNumber: 150
920
- }
921
- }, showStandards && React$1.createElement(Block, {
922
- __self: this,
923
- __source: {
924
- fileName: _jsxFileName$1,
925
- lineNumber: 161
926
- }
927
- }, React$1.createElement('div', {
928
- className: classes.label,
929
- __self: this,
930
- __source: {
931
- fileName: _jsxFileName$1,
932
- lineNumber: 162
933
- }
934
- }, "Standard(s)")), showDescription && React$1.createElement(Block, {
935
- __self: this,
936
- __source: {
937
- fileName: _jsxFileName$1,
938
- lineNumber: 169
939
- }
940
- }, React$1.createElement('div', {
941
- className: classes.label,
942
- __self: this,
943
- __source: {
944
- fileName: _jsxFileName$1,
945
- lineNumber: 170
946
- }
947
- }, "Description")), scorePointsValues.map((scorePointsValue, index) => {
948
- const value = scorePointsValues.length - index - 1;
949
- let scoreDescriptor;
950
- try {
951
- scoreDescriptor = scorePointsLabels[value] || '';
952
- } catch (e) {
953
- scoreDescriptor = '';
954
- }
955
- return React$1.createElement(Block, {
956
- key: `secondary-block-part-${index}`,
957
- __self: this,
958
- __source: {
959
- fileName: _jsxFileName$1,
960
- lineNumber: 187
961
- }
962
- }, React$1.createElement(ScorePoint, {
963
- scorePointsValue: scorePointsValue,
964
- scoreDescriptor: scoreDescriptor,
965
- pluginProps: pluginProps,
966
- showScorePointLabels: showScorePointLabels,
967
- onChange: scorePointLabel => this.onScorePointLabelChange({
968
- scorePointLabel,
969
- value
970
- }),
971
- __self: this,
972
- __source: {
973
- fileName: _jsxFileName$1,
974
- lineNumber: 188
975
- }
976
- }));
977
- })));
978
- }
979
- }
980
- TraitsHeaderTile.propTypes = {
981
- classes: PropTypes.object.isRequired,
982
- onTraitLabelChange: PropTypes.func,
983
- onScaleChange: PropTypes.func,
984
- scorePointsValues: PropTypes.arrayOf(PropTypes.number),
985
- scorePointsLabels: PropTypes.arrayOf(PropTypes.string),
986
- traitLabel: PropTypes.string,
987
- showStandards: PropTypes.bool,
988
- showLevelTagInput: PropTypes.bool,
989
- showDescription: PropTypes.bool,
990
- maxPoints: PropTypes.number,
991
- updateMaxPointsFieldValue: PropTypes.func,
992
- scaleIndex: PropTypes.number,
993
- currentPosition: PropTypes.number,
994
- showDeleteScaleModal: PropTypes.func,
995
- showScorePointLabels: PropTypes.bool,
996
- setSecondaryBlockRef: PropTypes.func
997
- };
998
- var TraitsHeader = withStyles$1(styles)(TraitsHeaderTile);
999
- var s = 1000;
1000
- var m = s * 60;
1001
- var h = m * 60;
1002
- var d = h * 24;
1003
- var w = d * 7;
1004
- var y = d * 365.25;
1005
- var ms = function (val, options) {
1006
- options = options || ({});
1007
- var type = typeof val;
1008
- if (type === 'string' && val.length > 0) {
1009
- return parse(val);
1010
- } else if (type === 'number' && isFinite(val)) {
1011
- return options.long ? fmtLong(val) : fmtShort(val);
1012
- }
1013
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
1014
- };
1015
- function parse(str) {
1016
- str = String(str);
1017
- if (str.length > 100) {
1018
- return;
1019
- }
1020
- var match = (/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i).exec(str);
1021
- if (!match) {
1022
- return;
1023
- }
1024
- var n = parseFloat(match[1]);
1025
- var type = (match[2] || 'ms').toLowerCase();
1026
- switch (type) {
1027
- case 'years':
1028
- case 'year':
1029
- case 'yrs':
1030
- case 'yr':
1031
- case 'y':
1032
- return n * y;
1033
- case 'weeks':
1034
- case 'week':
1035
- case 'w':
1036
- return n * w;
1037
- case 'days':
1038
- case 'day':
1039
- case 'd':
1040
- return n * d;
1041
- case 'hours':
1042
- case 'hour':
1043
- case 'hrs':
1044
- case 'hr':
1045
- case 'h':
1046
- return n * h;
1047
- case 'minutes':
1048
- case 'minute':
1049
- case 'mins':
1050
- case 'min':
1051
- case 'm':
1052
- return n * m;
1053
- case 'seconds':
1054
- case 'second':
1055
- case 'secs':
1056
- case 'sec':
1057
- case 's':
1058
- return n * s;
1059
- case 'milliseconds':
1060
- case 'millisecond':
1061
- case 'msecs':
1062
- case 'msec':
1063
- case 'ms':
1064
- return n;
1065
- default:
1066
- return undefined;
1067
- }
1068
- }
1069
- function fmtShort(ms) {
1070
- var msAbs = Math.abs(ms);
1071
- if (msAbs >= d) {
1072
- return Math.round(ms / d) + 'd';
1073
- }
1074
- if (msAbs >= h) {
1075
- return Math.round(ms / h) + 'h';
1076
- }
1077
- if (msAbs >= m) {
1078
- return Math.round(ms / m) + 'm';
1079
- }
1080
- if (msAbs >= s) {
1081
- return Math.round(ms / s) + 's';
1082
- }
1083
- return ms + 'ms';
1084
- }
1085
- function fmtLong(ms) {
1086
- var msAbs = Math.abs(ms);
1087
- if (msAbs >= d) {
1088
- return plural(ms, msAbs, d, 'day');
1089
- }
1090
- if (msAbs >= h) {
1091
- return plural(ms, msAbs, h, 'hour');
1092
- }
1093
- if (msAbs >= m) {
1094
- return plural(ms, msAbs, m, 'minute');
1095
- }
1096
- if (msAbs >= s) {
1097
- return plural(ms, msAbs, s, 'second');
1098
- }
1099
- return ms + ' ms';
1100
- }
1101
- function plural(ms, msAbs, n, name) {
1102
- var isPlural = msAbs >= n * 1.5;
1103
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
1104
- }
1105
- function setup(env) {
1106
- createDebug.debug = createDebug;
1107
- createDebug.default = createDebug;
1108
- createDebug.coerce = coerce;
1109
- createDebug.disable = disable;
1110
- createDebug.enable = enable;
1111
- createDebug.enabled = enabled;
1112
- createDebug.humanize = ms;
1113
- Object.keys(env).forEach(function (key) {
1114
- createDebug[key] = env[key];
1115
- });
1116
- createDebug.instances = [];
1117
- createDebug.names = [];
1118
- createDebug.skips = [];
1119
- createDebug.formatters = {};
1120
- function selectColor(namespace) {
1121
- var hash = 0;
1122
- for (var i = 0; i < namespace.length; i++) {
1123
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
1124
- hash |= 0;
1125
- }
1126
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
1127
- }
1128
- createDebug.selectColor = selectColor;
1129
- function createDebug(namespace) {
1130
- var prevTime;
1131
- function debug() {
1132
- if (!debug.enabled) {
1133
- return;
1134
- }
1135
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1136
- args[_key] = arguments[_key];
1137
- }
1138
- var self = debug;
1139
- var curr = Number(new Date());
1140
- var ms = curr - (prevTime || curr);
1141
- self.diff = ms;
1142
- self.prev = prevTime;
1143
- self.curr = curr;
1144
- prevTime = curr;
1145
- args[0] = createDebug.coerce(args[0]);
1146
- if (typeof args[0] !== 'string') {
1147
- args.unshift('%O');
1148
- }
1149
- var index = 0;
1150
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
1151
- if (match === '%%') {
1152
- return match;
1153
- }
1154
- index++;
1155
- var formatter = createDebug.formatters[format];
1156
- if (typeof formatter === 'function') {
1157
- var val = args[index];
1158
- match = formatter.call(self, val);
1159
- args.splice(index, 1);
1160
- index--;
1161
- }
1162
- return match;
1163
- });
1164
- createDebug.formatArgs.call(self, args);
1165
- var logFn = self.log || createDebug.log;
1166
- logFn.apply(self, args);
1167
- }
1168
- debug.namespace = namespace;
1169
- debug.enabled = createDebug.enabled(namespace);
1170
- debug.useColors = createDebug.useColors();
1171
- debug.color = selectColor(namespace);
1172
- debug.destroy = destroy;
1173
- debug.extend = extend;
1174
- if (typeof createDebug.init === 'function') {
1175
- createDebug.init(debug);
1176
- }
1177
- createDebug.instances.push(debug);
1178
- return debug;
1179
- }
1180
- function destroy() {
1181
- var index = createDebug.instances.indexOf(this);
1182
- if (index !== -1) {
1183
- createDebug.instances.splice(index, 1);
1184
- return true;
1185
- }
1186
- return false;
1187
- }
1188
- function extend(namespace, delimiter) {
1189
- return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
1190
- }
1191
- function enable(namespaces) {
1192
- createDebug.save(namespaces);
1193
- createDebug.names = [];
1194
- createDebug.skips = [];
1195
- var i;
1196
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
1197
- var len = split.length;
1198
- for (i = 0; i < len; i++) {
1199
- if (!split[i]) {
1200
- continue;
1201
- }
1202
- namespaces = split[i].replace(/\*/g, '.*?');
1203
- if (namespaces[0] === '-') {
1204
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
1205
- } else {
1206
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
1207
- }
1208
- }
1209
- for (i = 0; i < createDebug.instances.length; i++) {
1210
- var instance = createDebug.instances[i];
1211
- instance.enabled = createDebug.enabled(instance.namespace);
1212
- }
1213
- }
1214
- function disable() {
1215
- createDebug.enable('');
1216
- }
1217
- function enabled(name) {
1218
- if (name[name.length - 1] === '*') {
1219
- return true;
1220
- }
1221
- var i;
1222
- var len;
1223
- for ((i = 0, len = createDebug.skips.length); i < len; i++) {
1224
- if (createDebug.skips[i].test(name)) {
1225
- return false;
1226
- }
1227
- }
1228
- for ((i = 0, len = createDebug.names.length); i < len; i++) {
1229
- if (createDebug.names[i].test(name)) {
1230
- return true;
1231
- }
1232
- }
1233
- return false;
1234
- }
1235
- function coerce(val) {
1236
- if (val instanceof Error) {
1237
- return val.stack || val.message;
1238
- }
1239
- return val;
1240
- }
1241
- createDebug.enable(createDebug.load());
1242
- return createDebug;
1243
- }
1244
- var common = setup;
1245
- var browser = createCommonjsModule(function (module, exports) {
1246
- function _typeof(obj) {
1247
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1248
- _typeof = function _typeof(obj) {
1249
- return typeof obj;
1250
- };
1251
- } else {
1252
- _typeof = function _typeof(obj) {
1253
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1254
- };
1255
- }
1256
- return _typeof(obj);
1257
- }
1258
- exports.log = log;
1259
- exports.formatArgs = formatArgs;
1260
- exports.save = save;
1261
- exports.load = load;
1262
- exports.useColors = useColors;
1263
- exports.storage = localstorage();
1264
- exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
1265
- function useColors() {
1266
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
1267
- return true;
1268
- }
1269
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
1270
- return false;
1271
- }
1272
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
1273
- }
1274
- function formatArgs(args) {
1275
- args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
1276
- if (!this.useColors) {
1277
- return;
1278
- }
1279
- var c = 'color: ' + this.color;
1280
- args.splice(1, 0, c, 'color: inherit');
1281
- var index = 0;
1282
- var lastC = 0;
1283
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
1284
- if (match === '%%') {
1285
- return;
1286
- }
1287
- index++;
1288
- if (match === '%c') {
1289
- lastC = index;
1290
- }
1291
- });
1292
- args.splice(lastC, 0, c);
1293
- }
1294
- function log() {
1295
- var _console;
1296
- return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
1297
- }
1298
- function save(namespaces) {
1299
- try {
1300
- if (namespaces) {
1301
- exports.storage.setItem('debug', namespaces);
1302
- } else {
1303
- exports.storage.removeItem('debug');
1304
- }
1305
- } catch (error) {}
1306
- }
1307
- function load() {
1308
- var r;
1309
- try {
1310
- r = exports.storage.getItem('debug');
1311
- } catch (error) {}
1312
- if (!r && typeof process !== 'undefined' && ('env' in process)) {
1313
- r = process.env.DEBUG;
1314
- }
1315
- return r;
1316
- }
1317
- function localstorage() {
1318
- try {
1319
- return localStorage;
1320
- } catch (error) {}
1321
- }
1322
- module.exports = common(exports);
1323
- var formatters = module.exports.formatters;
1324
- formatters.j = function (v) {
1325
- try {
1326
- return JSON.stringify(v);
1327
- } catch (error) {
1328
- return '[UnexpectedJSONParseError]: ' + error.message;
1329
- }
1330
- };
1331
- });
1332
- browser.log;
1333
- browser.formatArgs;
1334
- browser.save;
1335
- browser.load;
1336
- browser.useColors;
1337
- browser.storage;
1338
- browser.colors;
1339
- const require$$0$4 = _dll_react;
1340
- var DragIndicator = createCommonjsModule(function (module, exports) {
1341
- Object.defineProperty(exports, "__esModule", {
1342
- value: true
1343
- });
1344
- exports.default = void 0;
1345
- var _react = interopRequireDefault(require$$0$4);
1346
- var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
1347
- var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
1348
- fill: "none",
1349
- d: "M0 0h24v24H0V0z"
1350
- }), _react.default.createElement("path", {
1351
- d: "M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
1352
- })), 'DragIndicator');
1353
- exports.default = _default;
1354
- });
1355
- var DragIndicatorIcon = unwrapExports(DragIndicator);
1356
- const React$2 = _dll_react;
1357
- const PropTypes$1 = _dll_prop_types;
1358
- const {isEmpty: isEmpty} = _dll_lodash;
1359
- const {DragSource: DragSource} = _dll_react_dnd;
1360
- const {DropTarget: DropTarget} = _dll_react_dnd;
1361
- const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
1362
- const {color: color$2} = _dll_pie_lib__render_ui;
1363
- const {IconButton: IconButton$1} = _dll_material_ui__core;
1364
- const {Menu: Menu$1} = _dll_material_ui__core;
1365
- const {MenuItem: MenuItem$2} = _dll_material_ui__core;
1366
- const _jsxFileName$2 = "/home/ede/dev/github/pie-framework/pie-elements/packages/multi-trait-rubric/configure/src/trait.jsx";
1367
- const log = browser('@pie-element:placement-ordering:configure:trait-tile');
1368
- const styles$1 = {
1369
- actions: {
1370
- color: color$2.secondaryBackground()
1371
- },
1372
- controls: {
1373
- display: 'flex',
1374
- justifyContent: 'flex-end',
1375
- position: 'absolute',
1376
- top: '28px',
1377
- right: '8px',
1378
- cursor: 'pointer'
1379
- },
1380
- dragHandle: {
1381
- position: 'absolute',
1382
- top: '80px',
1383
- left: `-${DragHandleSpace}px`,
1384
- cursor: 'move'
1385
- }
1386
- };
1387
- class TraitTile extends React$2.Component {
1388
- constructor(...args) {
1389
- super(...args);
1390
- TraitTile.prototype.__init.call(this);
1391
- TraitTile.prototype.__init2.call(this);
1392
- TraitTile.prototype.__init3.call(this);
1393
- TraitTile.prototype.__init4.call(this);
1394
- TraitTile.prototype.__init5.call(this);
1395
- TraitTile.prototype.__init6.call(this);
1396
- TraitTile.prototype.__init7.call(this);
1397
- }
1398
- __init() {
1399
- this.state = {};
1400
- }
1401
- UNSAFE_componentWillReceiveProps(nextProps) {
1402
- if (nextProps.currentPosition !== this.props.currentPosition || this.secondaryBlock && this.secondaryBlock.scrollLeft !== nextProps.currentPosition) {
1403
- this.scrollToPosition(nextProps.currentPosition);
1404
- }
1405
- }
1406
- __init2() {
1407
- this.onTraitChanged = params => {
1408
- const {trait, onTraitChanged} = this.props;
1409
- if (isEmpty(params)) return;
1410
- Object.keys(params).forEach(key => {
1411
- trait[key] = params[key];
1412
- });
1413
- onTraitChanged(trait);
1414
- };
1415
- }
1416
- __init3() {
1417
- this.onScorePointDescriptorChange = ({descriptor, value}) => {
1418
- const {trait: {scorePointsDescriptors}} = this.props;
1419
- if (value < 0 || value >= scorePointsDescriptors.length) return;
1420
- scorePointsDescriptors[value] = descriptor;
1421
- this.onTraitChanged({
1422
- scorePointsDescriptors
1423
- });
1424
- };
1425
- }
1426
- __init4() {
1427
- this.handleClick = event => this.setState({
1428
- anchorEl: event.currentTarget
1429
- });
1430
- }
1431
- __init5() {
1432
- this.handleClose = () => this.setState({
1433
- anchorEl: null
1434
- });
1435
- }
1436
- __init6() {
1437
- this.scrollToPosition = position => this.secondaryBlock.scrollTo({
1438
- left: position
1439
- });
1440
- }
1441
- __init7() {
1442
- this.openMenu = () => {
1443
- this.props.onTraitRemoved();
1444
- this.handleClose();
1445
- };
1446
- }
1447
- render() {
1448
- const {classes, connectDragSource, connectDropTarget, trait: {name, standards, description, scorePointsDescriptors}, scorePointsValues, showStandards, showDescription, enableDragAndDrop} = this.props;
1449
- const {anchorEl} = this.state;
1450
- const dragSourceOpts = {};
1451
- const pluginProps = {
1452
- image: {
1453
- disabled: true
1454
- },
1455
- math: {
1456
- disabled: true
1457
- }
1458
- };
1459
- return connectDragSource(connectDropTarget(React$2.createElement('div', {
1460
- __self: this,
1461
- __source: {
1462
- fileName: _jsxFileName$2,
1463
- lineNumber: 115
1464
- }
1465
- }, React$2.createElement(Row, {
1466
- __self: this,
1467
- __source: {
1468
- fileName: _jsxFileName$2,
1469
- lineNumber: 116
1470
- }
1471
- }, React$2.createElement(PrimaryBlock, {
1472
- __self: this,
1473
- __source: {
1474
- fileName: _jsxFileName$2,
1475
- lineNumber: 117
1476
- }
1477
- }, enableDragAndDrop ? React$2.createElement('span', {
1478
- className: classes.dragHandle,
1479
- __self: this,
1480
- __source: {
1481
- fileName: _jsxFileName$2,
1482
- lineNumber: 119
1483
- }
1484
- }, React$2.createElement(DragIndicatorIcon, {
1485
- className: classes.actions,
1486
- __self: this,
1487
- __source: {
1488
- fileName: _jsxFileName$2,
1489
- lineNumber: 120
1490
- }
1491
- })) : null, React$2.createElement('div', {
1492
- className: classes.controls,
1493
- __self: this,
1494
- __source: {
1495
- fileName: _jsxFileName$2,
1496
- lineNumber: 123
1497
- }
1498
- }, React$2.createElement(IconButton$1, {
1499
- 'aria-label': "more",
1500
- 'aria-controls': "long-menu",
1501
- 'aria-haspopup': "true",
1502
- onClick: this.handleClick,
1503
- __self: this,
1504
- __source: {
1505
- fileName: _jsxFileName$2,
1506
- lineNumber: 124
1507
- }
1508
- }, React$2.createElement(MoreVertIcon, {
1509
- __self: this,
1510
- __source: {
1511
- fileName: _jsxFileName$2,
1512
- lineNumber: 130
1513
- }
1514
- })), React$2.createElement(Menu$1, {
1515
- id: "long-menu",
1516
- anchorEl: anchorEl,
1517
- keepMounted: true,
1518
- open: !!anchorEl,
1519
- onClose: this.handleClose,
1520
- __self: this,
1521
- __source: {
1522
- fileName: _jsxFileName$2,
1523
- lineNumber: 132
1524
- }
1525
- }, ['Remove Trait'].map(option => React$2.createElement(MenuItem$2, {
1526
- key: option,
1527
- onClick: this.openMenu,
1528
- __self: this,
1529
- __source: {
1530
- fileName: _jsxFileName$2,
1531
- lineNumber: 140
1532
- }
1533
- }, option)))), React$2.createElement(UnderlinedInput, {
1534
- markup: name,
1535
- onChange: name => this.onTraitChanged({
1536
- name
1537
- }),
1538
- pluginProps: pluginProps,
1539
- placeholder: "Enter Trait",
1540
- __self: this,
1541
- __source: {
1542
- fileName: _jsxFileName$2,
1543
- lineNumber: 150
1544
- }
1545
- })), React$2.createElement(SecondaryBlock, {
1546
- setRef: ref => {
1547
- this.secondaryBlock = ref;
1548
- },
1549
- __self: this,
1550
- __source: {
1551
- fileName: _jsxFileName$2,
1552
- lineNumber: 157
1553
- }
1554
- }, showStandards && standards && React$2.createElement(Block, {
1555
- __self: this,
1556
- __source: {
1557
- fileName: _jsxFileName$2,
1558
- lineNumber: 163
1559
- }
1560
- }, React$2.createElement(ExpandedInput, {
1561
- placeholder: "Standards",
1562
- markup: standards.join(','),
1563
- onChange: standards => this.onTraitChanged({
1564
- standards: standards.split(',')
1565
- }),
1566
- pluginProps: pluginProps,
1567
- __self: this,
1568
- __source: {
1569
- fileName: _jsxFileName$2,
1570
- lineNumber: 164
1571
- }
1572
- })), showDescription && React$2.createElement(Block, {
1573
- __self: this,
1574
- __source: {
1575
- fileName: _jsxFileName$2,
1576
- lineNumber: 174
1577
- }
1578
- }, React$2.createElement(ExpandedInput, {
1579
- placeholder: "Description",
1580
- markup: description,
1581
- onChange: description => this.onTraitChanged({
1582
- description
1583
- }),
1584
- pluginProps: pluginProps,
1585
- __self: this,
1586
- __source: {
1587
- fileName: _jsxFileName$2,
1588
- lineNumber: 175
1589
- }
1590
- })), (scorePointsValues || []).map((scorePointsValue, index) => {
1591
- const value = scorePointsValues.length - index - 1;
1592
- let scoreDescriptor;
1593
- try {
1594
- scoreDescriptor = scorePointsDescriptors[value] || '';
1595
- } catch (e) {
1596
- scoreDescriptor = '';
1597
- }
1598
- return React$2.createElement(Block, {
1599
- key: `key-key-${index}`,
1600
- __self: this,
1601
- __source: {
1602
- fileName: _jsxFileName$2,
1603
- lineNumber: 195
1604
- }
1605
- }, React$2.createElement(ExpandedInput, {
1606
- placeholder: "Enter Description Here",
1607
- markup: scoreDescriptor,
1608
- onChange: descriptor => this.onScorePointDescriptorChange({
1609
- descriptor,
1610
- value
1611
- }),
1612
- pluginProps: pluginProps,
1613
- __self: this,
1614
- __source: {
1615
- fileName: _jsxFileName$2,
1616
- lineNumber: 196
1617
- }
1618
- }));
1619
- }))))), dragSourceOpts);
1620
- }
1621
- }
1622
- TraitTile.propTypes = {
1623
- connectDragSource: PropTypes$1.func.isRequired,
1624
- connectDropTarget: PropTypes$1.func.isRequired,
1625
- classes: PropTypes$1.object.isRequired,
1626
- isDragging: PropTypes$1.bool.isRequired,
1627
- id: PropTypes$1.any,
1628
- isOver: PropTypes$1.bool,
1629
- index: PropTypes$1.number,
1630
- onTraitChanged: PropTypes$1.func.isRequired,
1631
- onTraitRemoved: PropTypes$1.func.isRequired,
1632
- trait: PropTypes$1.shape({
1633
- name: PropTypes$1.string,
1634
- standards: PropTypes$1.arrayOf(PropTypes$1.string),
1635
- scorePointsDescriptors: PropTypes$1.arrayOf(PropTypes$1.string),
1636
- description: PropTypes$1.string
1637
- }),
1638
- scorePointsValues: PropTypes$1.arrayOf(PropTypes$1.number),
1639
- showStandards: PropTypes$1.bool,
1640
- showDescription: PropTypes$1.bool,
1641
- enableDragAndDrop: PropTypes$1.bool,
1642
- currentPosition: PropTypes$1.number
1643
- };
1644
- const StyledTrait = withStyles$2(styles$1)(TraitTile);
1645
- const NAME = 'trait-config';
1646
- const traitSource = {
1647
- beginDrag(props) {
1648
- return {
1649
- name: props.trait.name,
1650
- index: props.index
1651
- };
1652
- }
1653
- };
1654
- const StyledSource = DragSource(NAME, traitSource, (connect, monitor) => ({
1655
- connectDragSource: connect.dragSource(),
1656
- isDragging: monitor.isDragging()
1657
- }))(StyledTrait);
1658
- const traitTarget = {
1659
- hover() {
1660
- log('[hover]');
1661
- },
1662
- drop(props, monitor) {
1663
- const item = monitor.getItem();
1664
- log('[drop] item: ', item, 'didDrop?', monitor.didDrop());
1665
- props.onTraitDropped(item, props.index);
1666
- }
1667
- };
1668
- const StyledSourceAndTarget = DropTarget(NAME, traitTarget, (connect, monitor) => ({
1669
- connectDropTarget: connect.dropTarget(),
1670
- isOver: monitor.isOver()
1671
- }))(StyledSource);
1672
- const React$3 = _dll_react;
1673
- const PropTypes$2 = _dll_prop_types;
1674
- const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
1675
- const {Dialog: Dialog} = _dll_material_ui__core;
1676
- const {DialogTitle: DialogTitle} = _dll_material_ui__core;
1677
- const {DialogActions: DialogActions} = _dll_material_ui__core;
1678
- const {DialogContent: DialogContent} = _dll_material_ui__core;
1679
- const {DialogContentText: DialogContentText} = _dll_material_ui__core;
1680
- const {Button: Button} = _dll_material_ui__core;
1681
- const {color: color$3} = _dll_pie_lib__render_ui;
1682
- const _jsxFileName$3 = "/home/ede/dev/github/pie-framework/pie-elements/packages/multi-trait-rubric/configure/src/modals.jsx";
1683
- const excludeZeroTypes = {
1684
- remove0: 'remove0',
1685
- add0: 'add0',
1686
- shiftLeft: 'shiftLeft',
1687
- shiftRight: 'shiftRight'
1688
- };
1689
- const styles$2 = () => ({
1690
- root: {
1691
- padding: '20px'
1692
- },
1693
- title: {
1694
- padding: '0 0 18px 0',
1695
- '& h2': {
1696
- fontSize: '20px',
1697
- lineHeight: '23px',
1698
- fontFamily: 'Cerebri Sans',
1699
- color: color$3.text()
1700
- }
1701
- },
1702
- text: {
1703
- paddingLeft: '0',
1704
- '& p': {
1705
- fontSize: '16px',
1706
- fontFamily: 'Cerebri Sans',
1707
- color: color$3.text()
1708
- }
1709
- },
1710
- button: {
1711
- padding: '11px 16px',
1712
- borderRadius: '4px',
1713
- fontSize: '14px',
1714
- fontFamily: 'Cerebri Sans',
1715
- lineHeight: '14px',
1716
- textTransform: 'none',
1717
- background: color$3.primary(),
1718
- color: 'white'
1719
- },
1720
- cancelButton: {
1721
- background: color$3.secondaryBackground(),
1722
- color: color$3.text()
1723
- }
1724
- });
1725
- const RawExcludeZeroDialog = ({open, changeExcludeZero, cancel, classes}) => React$3.createElement(Dialog, {
1726
- open: open,
1727
- classes: {
1728
- paper: classes.root
1729
- },
1730
- __self: undefined,
1731
- __source: {
1732
- fileName: _jsxFileName$3,
1733
- lineNumber: 61
1734
- }
1735
- }, React$3.createElement(DialogTitle, {
1736
- classes: {
1737
- root: classes.title
1738
- },
1739
- __self: undefined,
1740
- __source: {
1741
- fileName: _jsxFileName$3,
1742
- lineNumber: 62
1743
- }
1744
- }, "Exclude 0 (Zero) from Score Point Values."), React$3.createElement(DialogContent, {
1745
- classes: {
1746
- root: classes.text
1747
- },
1748
- __self: undefined,
1749
- __source: {
1750
- fileName: _jsxFileName$3,
1751
- lineNumber: 66
1752
- }
1753
- }, React$3.createElement('div', {
1754
- __self: undefined,
1755
- __source: {
1756
- fileName: _jsxFileName$3,
1757
- lineNumber: 67
1758
- }
1759
- }, "You are about to exclude 0 from score point values.", React$3.createElement('br', {
1760
- __self: undefined,
1761
- __source: {
1762
- fileName: _jsxFileName$3,
1763
- lineNumber: 69
1764
- }
1765
- }), "Some of the existing data has to be changed.", React$3.createElement('br', {
1766
- __self: undefined,
1767
- __source: {
1768
- fileName: _jsxFileName$3,
1769
- lineNumber: 71
1770
- }
1771
- }), "Please choose if you want to:", React$3.createElement('ul', {
1772
- __self: undefined,
1773
- __source: {
1774
- fileName: _jsxFileName$3,
1775
- lineNumber: 73
1776
- }
1777
- }, React$3.createElement('li', {
1778
- __self: undefined,
1779
- __source: {
1780
- fileName: _jsxFileName$3,
1781
- lineNumber: 74
1782
- }
1783
- }, "shift Labels and Descriptions to the left"), React$3.createElement('li', {
1784
- __self: undefined,
1785
- __source: {
1786
- fileName: _jsxFileName$3,
1787
- lineNumber: 77
1788
- }
1789
- }, "remove 0 column with its Label and Description")))), React$3.createElement(DialogActions, {
1790
- __self: undefined,
1791
- __source: {
1792
- fileName: _jsxFileName$3,
1793
- lineNumber: 84
1794
- }
1795
- }, React$3.createElement(Button, {
1796
- classes: {
1797
- root: `${classes.button} ${classes.cancelButton}`
1798
- },
1799
- onClick: cancel,
1800
- __self: undefined,
1801
- __source: {
1802
- fileName: _jsxFileName$3,
1803
- lineNumber: 85
1804
- }
1805
- }, "Cancel"), React$3.createElement(Button, {
1806
- classes: {
1807
- root: classes.button
1808
- },
1809
- onClick: () => changeExcludeZero(excludeZeroTypes.shiftLeft),
1810
- __self: undefined,
1811
- __source: {
1812
- fileName: _jsxFileName$3,
1813
- lineNumber: 89
1814
- }
1815
- }, "Shift to Left"), React$3.createElement(Button, {
1816
- classes: {
1817
- root: classes.button
1818
- },
1819
- onClick: () => changeExcludeZero(excludeZeroTypes.remove0),
1820
- __self: undefined,
1821
- __source: {
1822
- fileName: _jsxFileName$3,
1823
- lineNumber: 93
1824
- }
1825
- }, "Remove 0 column")));
1826
- RawExcludeZeroDialog.propTypes = {
1827
- classes: PropTypes$2.object,
1828
- open: PropTypes$2.bool,
1829
- changeExcludeZero: PropTypes$2.func,
1830
- cancel: PropTypes$2.func
1831
- };
1832
- const ExcludeZeroDialog = withStyles$3(styles$2)(RawExcludeZeroDialog);
1833
- const RawIncludeZeroDialog = ({open, changeExcludeZero, cancel, classes}) => React$3.createElement(Dialog, {
1834
- open: open,
1835
- classes: {
1836
- paper: classes.root
1837
- },
1838
- __self: undefined,
1839
- __source: {
1840
- fileName: _jsxFileName$3,
1841
- lineNumber: 111
1842
- }
1843
- }, React$3.createElement(DialogTitle, {
1844
- classes: {
1845
- root: classes.title
1846
- },
1847
- __self: undefined,
1848
- __source: {
1849
- fileName: _jsxFileName$3,
1850
- lineNumber: 112
1851
- }
1852
- }, "Include 0 (Zero) in Score Point Values."), React$3.createElement(DialogContent, {
1853
- classes: {
1854
- root: classes.text
1855
- },
1856
- __self: undefined,
1857
- __source: {
1858
- fileName: _jsxFileName$3,
1859
- lineNumber: 116
1860
- }
1861
- }, React$3.createElement('div', {
1862
- __self: undefined,
1863
- __source: {
1864
- fileName: _jsxFileName$3,
1865
- lineNumber: 117
1866
- }
1867
- }, "You are about to include 0 in score point values.", React$3.createElement('br', {
1868
- __self: undefined,
1869
- __source: {
1870
- fileName: _jsxFileName$3,
1871
- lineNumber: 119
1872
- }
1873
- }), "Some of the existing data has to be changed.", React$3.createElement('br', {
1874
- __self: undefined,
1875
- __source: {
1876
- fileName: _jsxFileName$3,
1877
- lineNumber: 121
1878
- }
1879
- }), "Please choose if you want to:", React$3.createElement('ul', {
1880
- __self: undefined,
1881
- __source: {
1882
- fileName: _jsxFileName$3,
1883
- lineNumber: 123
1884
- }
1885
- }, React$3.createElement('li', {
1886
- __self: undefined,
1887
- __source: {
1888
- fileName: _jsxFileName$3,
1889
- lineNumber: 124
1890
- }
1891
- }, "shift Labels and Descriptions to the right"), React$3.createElement('li', {
1892
- __self: undefined,
1893
- __source: {
1894
- fileName: _jsxFileName$3,
1895
- lineNumber: 127
1896
- }
1897
- }, "add 0 column with empty Label and Descriptions")))), React$3.createElement(DialogActions, {
1898
- __self: undefined,
1899
- __source: {
1900
- fileName: _jsxFileName$3,
1901
- lineNumber: 134
1902
- }
1903
- }, React$3.createElement(Button, {
1904
- classes: {
1905
- root: `${classes.button} ${classes.cancelButton}`
1906
- },
1907
- onClick: cancel,
1908
- __self: undefined,
1909
- __source: {
1910
- fileName: _jsxFileName$3,
1911
- lineNumber: 135
1912
- }
1913
- }, "Cancel"), React$3.createElement(Button, {
1914
- classes: {
1915
- root: classes.button
1916
- },
1917
- onClick: () => changeExcludeZero(excludeZeroTypes.shiftRight),
1918
- __self: undefined,
1919
- __source: {
1920
- fileName: _jsxFileName$3,
1921
- lineNumber: 139
1922
- }
1923
- }, "Shift to Right"), React$3.createElement(Button, {
1924
- classes: {
1925
- root: classes.button
1926
- },
1927
- onClick: () => changeExcludeZero(excludeZeroTypes.add0),
1928
- __self: undefined,
1929
- __source: {
1930
- fileName: _jsxFileName$3,
1931
- lineNumber: 143
1932
- }
1933
- }, "Add 0 column")));
1934
- RawIncludeZeroDialog.propTypes = {
1935
- classes: PropTypes$2.object,
1936
- open: PropTypes$2.bool,
1937
- changeExcludeZero: PropTypes$2.func,
1938
- cancel: PropTypes$2.func
1939
- };
1940
- const IncludeZeroDialog = withStyles$3(styles$2)(RawIncludeZeroDialog);
1941
- const RawDecreaseMaxPoints = ({open, deleteScorePoints, cancel, classes}) => React$3.createElement(Dialog, {
1942
- open: open,
1943
- classes: {
1944
- paper: classes.root
1945
- },
1946
- __self: undefined,
1947
- __source: {
1948
- fileName: _jsxFileName$3,
1949
- lineNumber: 161
1950
- }
1951
- }, React$3.createElement(DialogTitle, {
1952
- classes: {
1953
- root: classes.title
1954
- },
1955
- __self: undefined,
1956
- __source: {
1957
- fileName: _jsxFileName$3,
1958
- lineNumber: 162
1959
- }
1960
- }, "Decreasing Max Points."), React$3.createElement(DialogContent, {
1961
- classes: {
1962
- root: classes.text
1963
- },
1964
- __self: undefined,
1965
- __source: {
1966
- fileName: _jsxFileName$3,
1967
- lineNumber: 166
1968
- }
1969
- }, React$3.createElement(DialogContentText, {
1970
- __self: undefined,
1971
- __source: {
1972
- fileName: _jsxFileName$3,
1973
- lineNumber: 167
1974
- }
1975
- }, "You are about to decrease max score point value.", React$3.createElement('br', {
1976
- __self: undefined,
1977
- __source: {
1978
- fileName: _jsxFileName$3,
1979
- lineNumber: 169
1980
- }
1981
- }), "All the Labels and Descriptions for scores above Max Point will be deleted.")), React$3.createElement(DialogActions, {
1982
- __self: undefined,
1983
- __source: {
1984
- fileName: _jsxFileName$3,
1985
- lineNumber: 174
1986
- }
1987
- }, React$3.createElement(Button, {
1988
- classes: {
1989
- root: `${classes.button} ${classes.cancelButton}`
1990
- },
1991
- onClick: cancel,
1992
- __self: undefined,
1993
- __source: {
1994
- fileName: _jsxFileName$3,
1995
- lineNumber: 175
1996
- }
1997
- }, "Cancel"), React$3.createElement(Button, {
1998
- classes: {
1999
- root: classes.button
2000
- },
2001
- onClick: deleteScorePoints,
2002
- __self: undefined,
2003
- __source: {
2004
- fileName: _jsxFileName$3,
2005
- lineNumber: 179
2006
- }
2007
- }, "Confirm")));
2008
- RawDecreaseMaxPoints.propTypes = {
2009
- classes: PropTypes$2.object,
2010
- open: PropTypes$2.bool,
2011
- deleteScorePoints: PropTypes$2.func,
2012
- cancel: PropTypes$2.func
2013
- };
2014
- const DecreaseMaxPoints = withStyles$3(styles$2)(RawDecreaseMaxPoints);
2015
- const RawDeleteScale = ({open, scaleIndex, deleteScale, cancel, classes}) => React$3.createElement(Dialog, {
2016
- open: open,
2017
- classes: {
2018
- paper: classes.root
2019
- },
2020
- __self: undefined,
2021
- __source: {
2022
- fileName: _jsxFileName$3,
2023
- lineNumber: 196
2024
- }
2025
- }, React$3.createElement(DialogTitle, {
2026
- classes: {
2027
- root: classes.title
2028
- },
2029
- __self: undefined,
2030
- __source: {
2031
- fileName: _jsxFileName$3,
2032
- lineNumber: 197
2033
- }
2034
- }, "Delete Scale #", scaleIndex), React$3.createElement(DialogContent, {
2035
- classes: {
2036
- root: classes.text
2037
- },
2038
- __self: undefined,
2039
- __source: {
2040
- fileName: _jsxFileName$3,
2041
- lineNumber: 201
2042
- }
2043
- }, React$3.createElement(DialogContentText, {
2044
- __self: undefined,
2045
- __source: {
2046
- fileName: _jsxFileName$3,
2047
- lineNumber: 202
2048
- }
2049
- }, "Are you sure you want to delete this scale?")), React$3.createElement(DialogActions, {
2050
- __self: undefined,
2051
- __source: {
2052
- fileName: _jsxFileName$3,
2053
- lineNumber: 207
2054
- }
2055
- }, React$3.createElement(Button, {
2056
- classes: {
2057
- root: `${classes.button} ${classes.cancelButton}`
2058
- },
2059
- onClick: cancel,
2060
- __self: undefined,
2061
- __source: {
2062
- fileName: _jsxFileName$3,
2063
- lineNumber: 208
2064
- }
2065
- }, "Cancel"), React$3.createElement(Button, {
2066
- classes: {
2067
- root: classes.button
2068
- },
2069
- onClick: deleteScale,
2070
- __self: undefined,
2071
- __source: {
2072
- fileName: _jsxFileName$3,
2073
- lineNumber: 212
2074
- }
2075
- }, "Delete")));
2076
- RawDeleteScale.propTypes = {
2077
- classes: PropTypes$2.object,
2078
- open: PropTypes$2.bool,
2079
- scaleIndex: PropTypes$2.number,
2080
- deleteScale: PropTypes$2.func,
2081
- cancel: PropTypes$2.func
2082
- };
2083
- const DeleteScale = withStyles$3(styles$2)(RawDeleteScale);
2084
- const RawDeleteTrait = ({open, deleteTrait, cancel, classes}) => React$3.createElement(Dialog, {
2085
- open: open,
2086
- classes: {
2087
- paper: classes.root
2088
- },
2089
- __self: undefined,
2090
- __source: {
2091
- fileName: _jsxFileName$3,
2092
- lineNumber: 231
2093
- }
2094
- }, React$3.createElement(DialogTitle, {
2095
- classes: {
2096
- root: classes.title
2097
- },
2098
- __self: undefined,
2099
- __source: {
2100
- fileName: _jsxFileName$3,
2101
- lineNumber: 232
2102
- }
2103
- }, "Delete Trait"), React$3.createElement(DialogContent, {
2104
- classes: {
2105
- root: classes.text
2106
- },
2107
- __self: undefined,
2108
- __source: {
2109
- fileName: _jsxFileName$3,
2110
- lineNumber: 236
2111
- }
2112
- }, React$3.createElement(DialogContentText, {
2113
- __self: undefined,
2114
- __source: {
2115
- fileName: _jsxFileName$3,
2116
- lineNumber: 237
2117
- }
2118
- }, "Are you sure you want to delete this trait?")), React$3.createElement(DialogActions, {
2119
- __self: undefined,
2120
- __source: {
2121
- fileName: _jsxFileName$3,
2122
- lineNumber: 242
2123
- }
2124
- }, React$3.createElement(Button, {
2125
- classes: {
2126
- root: `${classes.button} ${classes.cancelButton}`
2127
- },
2128
- onClick: cancel,
2129
- __self: undefined,
2130
- __source: {
2131
- fileName: _jsxFileName$3,
2132
- lineNumber: 243
2133
- }
2134
- }, "Cancel"), React$3.createElement(Button, {
2135
- classes: {
2136
- root: classes.button
2137
- },
2138
- onClick: deleteTrait,
2139
- __self: undefined,
2140
- __source: {
2141
- fileName: _jsxFileName$3,
2142
- lineNumber: 247
2143
- }
2144
- }, "Delete")));
2145
- RawDeleteTrait.propTypes = {
2146
- classes: PropTypes$2.object,
2147
- open: PropTypes$2.bool,
2148
- deleteTrait: PropTypes$2.func,
2149
- cancel: PropTypes$2.func
2150
- };
2151
- const DeleteTrait = withStyles$3(styles$2)(RawDeleteTrait);
2152
- const React$4 = _dll_react;
2153
- const PropTypes$3 = _dll_prop_types;
2154
- const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
2155
- const {withDragContext: withDragContext} = _dll_pie_lib__drag;
2156
- const {color: color$4} = _dll_pie_lib__render_ui;
2157
- const _jsxFileName$4 = "/home/ede/dev/github/pie-framework/pie-elements/packages/multi-trait-rubric/configure/src/scale.jsx";
2158
- const AdjustedBlockWidth = BlockWidth + 2 * 8;
2159
- const styles$3 = {
2160
- scaleWrapper: {
2161
- display: 'flex',
2162
- flexDirection: 'column',
2163
- margin: '12px 0',
2164
- wordBreak: 'break-word',
2165
- padding: `16px 0 16px ${DragHandleSpace}px`,
2166
- position: 'relative'
2167
- },
2168
- maxPoints: {
2169
- width: '300px',
2170
- margin: '16px 0 32px'
2171
- },
2172
- trait: {
2173
- background: color$4.secondaryBackground(),
2174
- margin: '16px 0',
2175
- padding: '16px'
2176
- }
2177
- };
2178
- class Scale extends React$4.Component {
2179
- constructor(...args) {
2180
- super(...args);
2181
- Scale.prototype.__init.call(this);
2182
- Scale.prototype.__init2.call(this);
2183
- Scale.prototype.__init3.call(this);
2184
- Scale.prototype.__init4.call(this);
2185
- Scale.prototype.__init5.call(this);
2186
- Scale.prototype.__init6.call(this);
2187
- Scale.prototype.__init7.call(this);
2188
- Scale.prototype.__init8.call(this);
2189
- Scale.prototype.__init9.call(this);
2190
- Scale.prototype.__init10.call(this);
2191
- Scale.prototype.__init11.call(this);
2192
- Scale.prototype.__init12.call(this);
2193
- Scale.prototype.__init13.call(this);
2194
- Scale.prototype.__init14.call(this);
2195
- Scale.prototype.__init15.call(this);
2196
- Scale.prototype.__init16.call(this);
2197
- Scale.prototype.__init17.call(this);
2198
- }
2199
- __init() {
2200
- this.state = {
2201
- showDecreaseMaxPointsDialog: false,
2202
- showDeleteScaleDialog: false,
2203
- showDeleteTraitDialog: false,
2204
- currentPosition: 0,
2205
- showRight: null,
2206
- showLeft: null
2207
- };
2208
- }
2209
- __init2() {
2210
- this.set = newState => this.setState(newState);
2211
- }
2212
- componentDidMount() {
2213
- if (this.state.showRight === null && this.secondaryBlockRef) {
2214
- this.setState({
2215
- showRight: this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth
2216
- });
2217
- }
2218
- }
2219
- UNSAFE_componentWillReceiveProps(nextProps) {
2220
- if (nextProps.excludeZero !== this.props.excludeZero || nextProps.showStandards !== this.props.showStandards || nextProps.showDescription !== this.props.showDescription) {
2221
- this.setState({
2222
- currentPosition: 0,
2223
- showLeft: false,
2224
- showRight: this.secondaryBlockRef && this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth
2225
- });
2226
- }
2227
- }
2228
- __init3() {
2229
- this.updateMaxPointsFieldValue = ({target}) => {
2230
- const {scale, scaleIndex, onScaleChanged} = this.props || ({});
2231
- const {maxPoints, scorePointsLabels, traits} = scale;
2232
- const numberValue = parseInt(target.value, 10);
2233
- this.setState({
2234
- currentPosition: 0,
2235
- showLeft: false,
2236
- showRight: this.secondaryBlockRef && this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth
2237
- });
2238
- if (numberValue < maxPoints) {
2239
- this.showDecreaseMaxPointsModal({
2240
- newMaxPoints: numberValue
2241
- });
2242
- } else {
2243
- for (let i = 0; i <= numberValue; i++) {
2244
- if (!scorePointsLabels[i]) {
2245
- scorePointsLabels.push('');
2246
- }
2247
- traits.forEach((trait, index) => {
2248
- if (!traits[index].scorePointsDescriptors[i]) {
2249
- traits[index].scorePointsDescriptors.push('');
2250
- }
2251
- });
2252
- }
2253
- onScaleChanged(scaleIndex, {
2254
- maxPoints: numberValue,
2255
- scorePointsLabels,
2256
- traits
2257
- });
2258
- }
2259
- };
2260
- }
2261
- __init4() {
2262
- this.showDecreaseMaxPointsModal = ({newMaxPoints}) => this.set({
2263
- showDecreaseMaxPointsDialog: true,
2264
- newMaxPoints
2265
- });
2266
- }
2267
- __init5() {
2268
- this.hideDecreaseMaxPointsModal = () => this.set({
2269
- showDecreaseMaxPointsDialog: false,
2270
- newMaxPoints: undefined
2271
- });
2272
- }
2273
- __init6() {
2274
- this.changeMaxPoints = () => {
2275
- const {newMaxPoints} = this.state || ({});
2276
- const {scaleIndex, onScaleChanged} = this.props || ({});
2277
- if (newMaxPoints) {
2278
- onScaleChanged(scaleIndex, {
2279
- maxPoints: newMaxPoints
2280
- });
2281
- }
2282
- this.hideDecreaseMaxPointsModal();
2283
- };
2284
- }
2285
- __init7() {
2286
- this.showDeleteScaleModal = () => this.set({
2287
- showDeleteScaleDialog: true
2288
- });
2289
- }
2290
- __init8() {
2291
- this.hideDeleteScaleModal = () => this.set({
2292
- showDeleteScaleDialog: false
2293
- });
2294
- }
2295
- __init9() {
2296
- this.deleteScale = () => {
2297
- const {scaleIndex, onScaleRemoved} = this.props || ({});
2298
- this.hideDeleteScaleModal();
2299
- onScaleRemoved(scaleIndex);
2300
- };
2301
- }
2302
- __init10() {
2303
- this.showDeleteTraitModal = traitToDeleteIndex => this.set({
2304
- showDeleteTraitDialog: true,
2305
- traitToDeleteIndex
2306
- });
2307
- }
2308
- __init11() {
2309
- this.hideDeleteTraitModal = () => this.set({
2310
- showDeleteTraitDialog: false,
2311
- traitToDeleteIndex: undefined
2312
- });
2313
- }
2314
- __init12() {
2315
- this.onTraitRemoved = () => {
2316
- const {traitToDeleteIndex} = this.state;
2317
- const {scale, scaleIndex, onScaleChanged} = this.props || ({});
2318
- let {traits} = scale || ({});
2319
- if (traitToDeleteIndex < 0 || traitToDeleteIndex >= traits.length) return;
2320
- traits = [...traits.slice(0, traitToDeleteIndex), ...traits.slice(traitToDeleteIndex + 1)];
2321
- onScaleChanged(scaleIndex, {
2322
- traits
2323
- });
2324
- this.hideDeleteTraitModal();
2325
- };
2326
- }
2327
- __init13() {
2328
- this.onTraitAdded = () => {
2329
- const {scale, scaleIndex, onScaleChanged} = this.props || ({});
2330
- const {traits, scorePointsLabels} = scale || ({});
2331
- traits.push({
2332
- name: '',
2333
- description: '',
2334
- standards: [],
2335
- scorePointsDescriptors: Array.from({
2336
- length: scorePointsLabels.length
2337
- }, () => '')
2338
- });
2339
- onScaleChanged(scaleIndex, {
2340
- traits
2341
- });
2342
- };
2343
- }
2344
- __init14() {
2345
- this.onTraitChanged = (traitIndex, trait) => {
2346
- const {scale, scaleIndex, onScaleChanged} = this.props || ({});
2347
- const {traits} = scale || ({});
2348
- if (traitIndex >= 0 && traitIndex < traits.length) {
2349
- traits[traitIndex] = trait;
2350
- onScaleChanged(scaleIndex, {
2351
- traits
2352
- });
2353
- }
2354
- };
2355
- }
2356
- __init15() {
2357
- this.onTraitDropped = (source, newIndex) => {
2358
- const {scale, scaleIndex, onScaleChanged} = this.props || ({});
2359
- const {traits} = scale || ({});
2360
- const {index: oldIndex} = source;
2361
- const cup = traits[oldIndex];
2362
- traits[oldIndex] = traits[newIndex];
2363
- traits[newIndex] = cup;
2364
- onScaleChanged(scaleIndex, {
2365
- traits
2366
- });
2367
- };
2368
- }
2369
- __init16() {
2370
- this.decreasePosition = () => {
2371
- const {currentPosition} = this.state;
2372
- const decreasedPosition = currentPosition - (currentPosition === AdjustedBlockWidth / 2 ? AdjustedBlockWidth / 2 : AdjustedBlockWidth);
2373
- this.setState({
2374
- currentPosition: decreasedPosition,
2375
- showRight: decreasedPosition < this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth,
2376
- showLeft: decreasedPosition > 0
2377
- });
2378
- };
2379
- }
2380
- __init17() {
2381
- this.increasePosition = () => {
2382
- const {currentPosition} = this.state;
2383
- const increasedPosition = currentPosition + (currentPosition === 0 ? AdjustedBlockWidth / 2 : AdjustedBlockWidth);
2384
- this.setState({
2385
- currentPosition: increasedPosition,
2386
- showRight: increasedPosition < this.secondaryBlockRef.scrollWidth - this.secondaryBlockRef.offsetWidth,
2387
- showLeft: increasedPosition > 0
2388
- });
2389
- };
2390
- }
2391
- render() {
2392
- const {classes, scale, scaleIndex, showStandards, onScaleChanged, excludeZero, showDescription, showLevelTagInput, showScorePointLabels, enableDragAndDrop} = this.props || ({});
2393
- const {maxPoints, scorePointsLabels, traitLabel, traits} = scale || ({});
2394
- const {showDecreaseMaxPointsDialog, showDeleteScaleDialog, showDeleteTraitDialog, currentPosition, showRight, showLeft} = this.state;
2395
- const scorePointsValues = [];
2396
- for (let pointValue = maxPoints; pointValue >= excludeZero ? 1 : 0; pointValue -= 1) {
2397
- scorePointsValues.push(pointValue);
2398
- }
2399
- return React$4.createElement('div', {
2400
- key: `scale-${scaleIndex}`,
2401
- className: classes.scaleWrapper,
2402
- ref: ref => {
2403
- this.scaleWrapper = ref;
2404
- },
2405
- __self: this,
2406
- __source: {
2407
- fileName: _jsxFileName$4,
2408
- lineNumber: 261
2409
- }
2410
- }, React$4.createElement(TraitsHeader, {
2411
- setSecondaryBlockRef: ref => {
2412
- if (ref) {
2413
- this.secondaryBlockRef = ref;
2414
- }
2415
- },
2416
- key: 'header-key',
2417
- traitLabel: traitLabel,
2418
- scorePointsValues: scorePointsValues,
2419
- scorePointsLabels: scorePointsLabels,
2420
- onScaleChange: params => onScaleChanged(scaleIndex, params),
2421
- onTraitLabelChange: label => onScaleChanged(scaleIndex, {
2422
- traitLabel: label
2423
- }),
2424
- showStandards: showStandards,
2425
- showDescription: showDescription,
2426
- showLevelTagInput: showLevelTagInput,
2427
- showScorePointLabels: showScorePointLabels,
2428
- maxPoints: maxPoints,
2429
- updateMaxPointsFieldValue: this.updateMaxPointsFieldValue,
2430
- scaleIndex: scaleIndex,
2431
- showDeleteScaleModal: this.showDeleteScaleModal,
2432
- currentPosition: currentPosition,
2433
- __self: this,
2434
- __source: {
2435
- fileName: _jsxFileName$4,
2436
- lineNumber: 268
2437
- }
2438
- }), traits.map((trait, index) => React$4.createElement(StyledSourceAndTarget, {
2439
- key: index,
2440
- index: index,
2441
- trait: trait,
2442
- scorePointsValues: scorePointsValues,
2443
- scorePointsLabels: scorePointsLabels,
2444
- onTraitRemoved: () => this.showDeleteTraitModal(index),
2445
- onTraitChanged: trait => this.onTraitChanged(index, trait),
2446
- onTraitDropped: this.onTraitDropped,
2447
- showStandards: showStandards,
2448
- showDescription: showDescription,
2449
- currentPosition: currentPosition,
2450
- enableDragAndDrop: enableDragAndDrop,
2451
- __self: this,
2452
- __source: {
2453
- fileName: _jsxFileName$4,
2454
- lineNumber: 292
2455
- }
2456
- })), React$4.createElement(Arrow, {
2457
- width: `${AdjustedBlockWidth / 2}px`,
2458
- show: showLeft,
2459
- onClick: this.decreasePosition,
2460
- left: `${PrimaryBlockWidth + DragHandleSpace}px`,
2461
- showLevelTagInput: showLevelTagInput,
2462
- __self: this,
2463
- __source: {
2464
- fileName: _jsxFileName$4,
2465
- lineNumber: 308
2466
- }
2467
- }, React$4.createElement(ArrowBackIosIcon, {
2468
- __self: this,
2469
- __source: {
2470
- fileName: _jsxFileName$4,
2471
- lineNumber: 315
2472
- }
2473
- })), React$4.createElement(Arrow, {
2474
- width: `${AdjustedBlockWidth / 2}px`,
2475
- show: showRight,
2476
- onClick: this.increasePosition,
2477
- showLevelTagInput: showLevelTagInput,
2478
- __self: this,
2479
- __source: {
2480
- fileName: _jsxFileName$4,
2481
- lineNumber: 317
2482
- }
2483
- }, React$4.createElement(ArrowForwardIosIcon, {
2484
- __self: this,
2485
- __source: {
2486
- fileName: _jsxFileName$4,
2487
- lineNumber: 323
2488
- }
2489
- })), React$4.createElement(MultiTraitButton, {
2490
- onClick: this.onTraitAdded,
2491
- __self: this,
2492
- __source: {
2493
- fileName: _jsxFileName$4,
2494
- lineNumber: 326
2495
- }
2496
- }, React$4.createElement('div', {
2497
- dangerouslySetInnerHTML: {
2498
- __html: `Add ${traitLabel || ' Trait'}`
2499
- },
2500
- __self: this,
2501
- __source: {
2502
- fileName: _jsxFileName$4,
2503
- lineNumber: 327
2504
- }
2505
- })), React$4.createElement(DecreaseMaxPoints, {
2506
- open: !!showDecreaseMaxPointsDialog,
2507
- deleteScorePoints: this.changeMaxPoints,
2508
- cancel: this.hideDecreaseMaxPointsModal,
2509
- __self: this,
2510
- __source: {
2511
- fileName: _jsxFileName$4,
2512
- lineNumber: 330
2513
- }
2514
- }), React$4.createElement(DeleteScale, {
2515
- open: !!showDeleteScaleDialog,
2516
- scaleIndex: scaleIndex,
2517
- deleteScale: this.deleteScale,
2518
- cancel: this.hideDeleteScaleModal,
2519
- __self: this,
2520
- __source: {
2521
- fileName: _jsxFileName$4,
2522
- lineNumber: 336
2523
- }
2524
- }), React$4.createElement(DeleteTrait, {
2525
- open: !!showDeleteTraitDialog,
2526
- deleteTrait: this.onTraitRemoved,
2527
- cancel: this.hideDeleteTraitModal,
2528
- __self: this,
2529
- __source: {
2530
- fileName: _jsxFileName$4,
2531
- lineNumber: 343
2532
- }
2533
- }));
2534
- }
2535
- }
2536
- Scale.propTypes = {
2537
- classes: PropTypes$3.object,
2538
- scale: PropTypes$3.shape({
2539
- maxPoints: PropTypes$3.number,
2540
- scorePointsLabels: PropTypes$3.arrayOf(PropTypes$3.string),
2541
- traitLabel: PropTypes$3.string,
2542
- traits: PropTypes$3.arrayOf(PropTypes$3.shape({
2543
- name: PropTypes$3.string,
2544
- standards: PropTypes$3.arrayOf(PropTypes$3.string),
2545
- scorePointsDescriptors: PropTypes$3.arrayOf(PropTypes$3.string),
2546
- description: PropTypes$3.string
2547
- }))
2548
- }),
2549
- excludeZero: PropTypes$3.bool,
2550
- scaleIndex: PropTypes$3.number,
2551
- onScaleChanged: PropTypes$3.func,
2552
- onScaleRemoved: PropTypes$3.func,
2553
- showStandards: PropTypes$3.bool,
2554
- showLevelTagInput: PropTypes$3.bool,
2555
- showDescription: PropTypes$3.bool,
2556
- showScorePointLabels: PropTypes$3.bool,
2557
- enableDragAndDrop: PropTypes$3.bool
2558
- };
2559
- var Scale$1 = withDragContext(withStyles$4(styles$3)(Scale));
2560
- const React$5 = _dll_react;
2561
- const PropTypes$4 = _dll_prop_types;
2562
- const {isEmpty: isEmpty$1} = _dll_lodash;
2563
- const {withStyles: withStyles$5} = _dll_material_ui__core_styles;
2564
- const {withDragContext: withDragContext$1} = _dll_pie_lib__drag;
2565
- const {layout: layout} = _dll_pie_lib__config_ui;
2566
- const {settings: settings} = _dll_pie_lib__config_ui;
2567
- const _jsxFileName$5 = "/home/ede/dev/github/pie-framework/pie-elements/packages/multi-trait-rubric/configure/src/main.jsx";
2568
- const {Panel, toggle} = settings;
2569
- const styles$4 = {
2570
- design: {
2571
- fontFamily: 'Cerebri Sans',
2572
- fontSize: '14px'
2573
- }
2574
- };
2575
- class Main extends React$5.Component {
2576
- constructor(...args) {
2577
- super(...args);
2578
- Main.prototype.__init.call(this);
2579
- Main.prototype.__init2.call(this);
2580
- Main.prototype.__init3.call(this);
2581
- Main.prototype.__init4.call(this);
2582
- Main.prototype.__init5.call(this);
2583
- Main.prototype.__init6.call(this);
2584
- Main.prototype.__init7.call(this);
2585
- Main.prototype.__init8.call(this);
2586
- Main.prototype.__init9.call(this);
2587
- Main.prototype.__init10.call(this);
2588
- Main.prototype.__init11.call(this);
2589
- Main.prototype.__init12.call(this);
2590
- Main.prototype.__init13.call(this);
2591
- Main.prototype.__init14.call(this);
2592
- }
2593
- __init() {
2594
- this.state = {
2595
- showDecreaseMaxPointsDialog: false,
2596
- showDeleteScaleDialog: false,
2597
- showDeleteTraitDialog: false,
2598
- showExcludeZeroDialog: false
2599
- };
2600
- }
2601
- __init2() {
2602
- this.onScaleAdded = () => {
2603
- const {model, onModelChanged} = this.props;
2604
- let {scales} = model || ({});
2605
- if (!scales.length) {
2606
- scales = [];
2607
- }
2608
- scales.push({
2609
- excludeZero: false,
2610
- maxPoints: 1,
2611
- scorePointsLabels: ['', ''],
2612
- traitLabel: '',
2613
- traits: []
2614
- });
2615
- onModelChanged({
2616
- ...model,
2617
- scales
2618
- });
2619
- };
2620
- }
2621
- __init3() {
2622
- this.onScaleChanged = (scaleIndex, params) => {
2623
- const {model, onModelChanged} = this.props;
2624
- const {scales} = model || ({});
2625
- if (scaleIndex < 0 || scaleIndex >= scales.length || isEmpty$1(params)) return false;
2626
- Object.keys(params).forEach(key => {
2627
- scales[scaleIndex][key] = params[key];
2628
- });
2629
- onModelChanged({
2630
- ...model,
2631
- scales
2632
- });
2633
- };
2634
- }
2635
- __init4() {
2636
- this.onScaleRemoved = scaleIndex => {
2637
- const {model, onModelChanged} = this.props;
2638
- let {scales} = model || ({});
2639
- if (scaleIndex < 0 || scaleIndex >= scales.length) return false;
2640
- scales = [...scales.slice(0, scaleIndex), ...scales.slice(scaleIndex + 1)];
2641
- onModelChanged({
2642
- ...model,
2643
- scales
2644
- });
2645
- };
2646
- }
2647
- __init5() {
2648
- this.onHalfScoringChanged = () => {
2649
- const {model, onModelChanged} = this.props;
2650
- let {halfScoring} = model || ({});
2651
- onModelChanged({
2652
- ...model,
2653
- halfScoring: !halfScoring
2654
- });
2655
- };
2656
- }
2657
- __init6() {
2658
- this.onVisibleToStudentChanged = () => {
2659
- const {model, onModelChanged} = this.props;
2660
- let {visibleToStudent} = model || ({});
2661
- onModelChanged({
2662
- ...model,
2663
- visibleToStudent: !visibleToStudent
2664
- });
2665
- };
2666
- }
2667
- __init7() {
2668
- this.set = newState => this.setState(newState);
2669
- }
2670
- __init8() {
2671
- this.changeShowScorePointLabels = () => {
2672
- const {model, onModelChanged} = this.props || ({});
2673
- let {pointLabels} = model || ({});
2674
- pointLabels = !pointLabels;
2675
- onModelChanged({
2676
- ...model,
2677
- pointLabels
2678
- });
2679
- };
2680
- }
2681
- __init9() {
2682
- this.changeShowDescription = () => {
2683
- const {model, onModelChanged} = this.props || ({});
2684
- let {description} = model || ({});
2685
- description = !description;
2686
- onModelChanged({
2687
- ...model,
2688
- description
2689
- });
2690
- };
2691
- }
2692
- __init10() {
2693
- this.changeShowStandards = () => {
2694
- const {model, onModelChanged} = this.props || ({});
2695
- let {standards} = model || ({});
2696
- standards = !standards;
2697
- onModelChanged({
2698
- ...model,
2699
- standards
2700
- });
2701
- };
2702
- }
2703
- __init11() {
2704
- this.showToggleExcludeZeroModal = () => this.set({
2705
- showExcludeZeroDialog: true
2706
- });
2707
- }
2708
- __init12() {
2709
- this.hideToggleExcludeZeroModal = () => this.set({
2710
- showExcludeZeroDialog: false
2711
- });
2712
- }
2713
- __init13() {
2714
- this.changeExcludeZero = excludeZeroType => {
2715
- const {model, onModelChanged} = this.props || ({});
2716
- const {scales} = model || ({});
2717
- let {excludeZero} = model || ({});
2718
- if (!scales || !scales.length) return;
2719
- excludeZero = !excludeZero;
2720
- const newScales = scales.reduce((acc, scale) => {
2721
- let {scorePointsLabels, traits} = scale || ({});
2722
- if (scorePointsLabels.length < 1) return acc;
2723
- switch (excludeZeroType) {
2724
- case excludeZeroTypes.remove0:
2725
- {
2726
- scorePointsLabels = scorePointsLabels.slice(1);
2727
- traits = traits.map(({scorePointsDescriptors, ...trait}) => ({
2728
- ...trait,
2729
- scorePointsDescriptors: scorePointsDescriptors.slice(1)
2730
- }));
2731
- break;
2732
- }
2733
- case excludeZeroTypes.add0:
2734
- {
2735
- scorePointsLabels = ['', ...scorePointsLabels];
2736
- traits = traits.map(({scorePointsDescriptors, ...trait}) => ({
2737
- ...trait,
2738
- scorePointsDescriptors: ['', ...scorePointsDescriptors]
2739
- }));
2740
- break;
2741
- }
2742
- case excludeZeroTypes.shiftLeft:
2743
- {
2744
- scorePointsLabels = scorePointsLabels.slice(0, -1);
2745
- traits = traits.map(({scorePointsDescriptors, ...trait}) => ({
2746
- ...trait,
2747
- scorePointsDescriptors: scorePointsDescriptors.slice(0, -1)
2748
- }));
2749
- break;
2750
- }
2751
- case excludeZeroTypes.shiftRight:
2752
- {
2753
- scorePointsLabels = [...scorePointsLabels, ''];
2754
- traits = traits.map(({scorePointsDescriptors, ...trait}) => ({
2755
- ...trait,
2756
- scorePointsDescriptors: [...scorePointsDescriptors, '']
2757
- }));
2758
- break;
2759
- }
2760
- }
2761
- acc.push({
2762
- ...scale,
2763
- scorePointsLabels,
2764
- traits
2765
- });
2766
- return acc;
2767
- }, []);
2768
- onModelChanged({
2769
- ...model,
2770
- scales: newScales,
2771
- excludeZero
2772
- });
2773
- this.hideToggleExcludeZeroModal();
2774
- };
2775
- }
2776
- __init14() {
2777
- this.onModelChanged = (updatedModel, updatedProperty) => {
2778
- const {onModelChanged} = this.props || ({});
2779
- if (updatedProperty === 'excludeZero') {
2780
- this.showToggleExcludeZeroModal();
2781
- } else {
2782
- onModelChanged(updatedModel);
2783
- }
2784
- };
2785
- }
2786
- render() {
2787
- const {model, classes, configuration, onConfigurationChanged} = this.props || ({});
2788
- const {showStandards, showExcludeZero, showLevelTagInput, showDescription, showVisibleToStudent, showHalfScoring, showScorePointLabels, dragAndDrop, maxWidth} = configuration || ({});
2789
- const {scales, excludeZero, description, pointLabels, standards} = model || ({});
2790
- const {showExcludeZeroDialog} = this.state || ({});
2791
- return React$5.createElement('div', {
2792
- className: classes.design,
2793
- __self: this,
2794
- __source: {
2795
- fileName: _jsxFileName$5,
2796
- lineNumber: 226
2797
- }
2798
- }, React$5.createElement(layout.ConfigLayout, {
2799
- settings: React$5.createElement(Panel, {
2800
- model: model,
2801
- onChangeModel: this.onModelChanged,
2802
- configuration: configuration,
2803
- onChangeConfiguration: onConfigurationChanged,
2804
- groups: {
2805
- Settings: {
2806
- standards: showStandards.settings && toggle(showStandards.label),
2807
- 'showLevelTagInput.enabled': showLevelTagInput.settings && toggle(showLevelTagInput.label, true),
2808
- visibleToStudent: showVisibleToStudent.settings && toggle(showVisibleToStudent.label),
2809
- excludeZero: showExcludeZero.settings && toggle(showExcludeZero.label),
2810
- halfScoring: showHalfScoring.settings && toggle(showHalfScoring.label),
2811
- 'dragAndDrop.enabled': dragAndDrop.settings && toggle(dragAndDrop.label, true)
2812
- },
2813
- Properties: {
2814
- description: showDescription.settings && toggle(showDescription.label),
2815
- pointLabels: showScorePointLabels.settings && toggle(showScorePointLabels.label)
2816
- }
2817
- },
2818
- __self: this,
2819
- __source: {
2820
- fileName: _jsxFileName$5,
2821
- lineNumber: 229
2822
- }
2823
- }),
2824
- __self: this,
2825
- __source: {
2826
- fileName: _jsxFileName$5,
2827
- lineNumber: 227
2828
- }
2829
- }, React$5.createElement('div', {
2830
- style: {
2831
- maxWidth: maxWidth
2832
- },
2833
- __self: this,
2834
- __source: {
2835
- fileName: _jsxFileName$5,
2836
- lineNumber: 251
2837
- }
2838
- }, (scales || []).map((scale, scaleIndex) => React$5.createElement(Scale$1, {
2839
- key: `scale-${scaleIndex}`,
2840
- scale: scale,
2841
- scaleIndex: scaleIndex,
2842
- onScaleRemoved: this.onScaleRemoved,
2843
- onScaleChanged: this.onScaleChanged,
2844
- showStandards: standards,
2845
- showScorePointLabels: pointLabels,
2846
- showDescription: description,
2847
- showLevelTagInput: showLevelTagInput.enabled,
2848
- excludeZero: excludeZero,
2849
- enableDragAndDrop: dragAndDrop.enabled,
2850
- ...this.props,
2851
- classes: {},
2852
- __self: this,
2853
- __source: {
2854
- fileName: _jsxFileName$5,
2855
- lineNumber: 253
2856
- }
2857
- })), React$5.createElement(MultiTraitButton, {
2858
- onClick: this.onScaleAdded,
2859
- __self: this,
2860
- __source: {
2861
- fileName: _jsxFileName$5,
2862
- lineNumber: 270
2863
- }
2864
- }, "Add Scale"))), React$5.createElement(ExcludeZeroDialog, {
2865
- open: showExcludeZeroDialog && !excludeZero,
2866
- changeExcludeZero: this.changeExcludeZero,
2867
- cancel: this.hideToggleExcludeZeroModal,
2868
- __self: this,
2869
- __source: {
2870
- fileName: _jsxFileName$5,
2871
- lineNumber: 276
2872
- }
2873
- }), React$5.createElement(IncludeZeroDialog, {
2874
- open: showExcludeZeroDialog && excludeZero,
2875
- changeExcludeZero: this.changeExcludeZero,
2876
- cancel: this.hideToggleExcludeZeroModal,
2877
- __self: this,
2878
- __source: {
2879
- fileName: _jsxFileName$5,
2880
- lineNumber: 282
2881
- }
2882
- }));
2883
- }
2884
- }
2885
- Main.propTypes = {
2886
- classes: PropTypes$4.object,
2887
- model: PropTypes$4.object,
2888
- configuration: PropTypes$4.object,
2889
- onModelChanged: PropTypes$4.func,
2890
- onConfigurationChanged: PropTypes$4.func
2891
- };
2892
- var Main$1 = withDragContext$1(withStyles$5(styles$4)(Main));
2893
- var defaults = {
2894
- model: {
2895
- visibleToStudent: true,
2896
- halfScoring: false,
2897
- pointLabels: true,
2898
- description: false,
2899
- standards: false,
2900
- scales: [],
2901
- excludeZero: false
2902
- },
2903
- configuration: {
2904
- showExcludeZero: {
2905
- settings: true,
2906
- label: 'Exclude Zero'
2907
- },
2908
- showScorePointLabels: {
2909
- settings: true,
2910
- label: 'Show Score Point Labels'
2911
- },
2912
- showDescription: {
2913
- settings: true,
2914
- label: 'Show Description'
2915
- },
2916
- showVisibleToStudent: {
2917
- settings: true,
2918
- label: 'Visible to Student'
2919
- },
2920
- showHalfScoring: {
2921
- settings: true,
2922
- label: 'Half Scoring'
2923
- },
2924
- maxWidth: '1000px',
2925
- showStandards: {
2926
- settings: false,
2927
- label: 'Show Standards'
2928
- },
2929
- showLevelTagInput: {
2930
- settings: false,
2931
- label: 'Show Level Tag Input',
2932
- enabled: false
2933
- },
2934
- dragAndDrop: {
2935
- settings: false,
2936
- label: 'Enable Drag and Drop',
2937
- enabled: false
2938
- }
2939
- }
2940
- };
2941
- const {ModelUpdatedEvent: ModelUpdatedEvent} = _dll_pie_framework__pie_configure_events;
2942
- const React$6 = _dll_react;
2943
- const ReactDOM = _dll_react_dom;
2944
- const modelWithDefaults = m => ({
2945
- ...defaults.model,
2946
- ...m
2947
- });
2948
- const configurationWithDefaults = c => ({
2949
- ...defaults.configuration,
2950
- ...c
2951
- });
2952
- class MultiTraitRubricElement extends HTMLElement {
2953
- constructor() {
2954
- super();
2955
- MultiTraitRubricElement.prototype.__init.call(this);
2956
- MultiTraitRubricElement.prototype.__init2.call(this);
2957
- this._model = modelWithDefaults();
2958
- this._configuration = configurationWithDefaults();
2959
- }
2960
- set model(m) {
2961
- this._model = modelWithDefaults(m);
2962
- this._render();
2963
- }
2964
- set configuration(c) {
2965
- this._configuration = configurationWithDefaults(c);
2966
- this._render();
2967
- }
2968
- __init() {
2969
- this.onModelChanged = m => {
2970
- this._model = modelWithDefaults(m);
2971
- this._render();
2972
- this.dispatchEvent(new ModelUpdatedEvent(this._model, false));
2973
- };
2974
- }
2975
- __init2() {
2976
- this.onConfigurationChanged = c => {
2977
- this._configuration = configurationWithDefaults(c);
2978
- this._render();
2979
- };
2980
- }
2981
- _render() {
2982
- if (this._model) {
2983
- let element = React$6.createElement(Main$1, {
2984
- model: this._model,
2985
- configuration: this._configuration,
2986
- onModelChanged: this.onModelChanged,
2987
- onConfigurationChanged: this.onConfigurationChanged
2988
- });
2989
- ReactDOM.render(element, this);
2990
- }
2991
- }
2992
- }
2993
- export default MultiTraitRubricElement;